interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / src / cudapp_freest_attn_tables.c

281 lines · 19239 bytes Raw Blame History
1#if defined(__GNUC__)
2#pragma GCC diagnostic push
3#pragma GCC diagnostic ignored "-Wunused-function"
4#pragma GCC diagnostic ignored "-Wunused-parameter"
5#pragma GCC diagnostic ignored "-Wmisleading-indentation"
6#endif
7/* Omega Bridge freestanding checked runtime views. GNU C11; no hosted imports. */
8#include <stdint.h>
9#include <stddef.h>
10struct ombr_fs_ctx { unsigned code, depth; };
11static uint64_t fs_error(struct ombr_fs_ctx *fs,unsigned code){fs->code=code;return 0;}
12static uint64_t fs_leave(struct ombr_fs_ctx *fs,uint64_t v){--fs->depth;return v;}
13static unsigned o_width(unsigned t){static const unsigned w[]={0,1,8,16,32,64,8,16,32,64};return w[t];}
14static int o_valid(unsigned t,uint64_t v){unsigned w=o_width(t);if(t<6)return w==64||v<((uint64_t)1<<w);if(w==64)return 1;uint64_t m=(uint64_t)1<<(w-1);return v<m||v>=UINT64_MAX-m+1;}
15static uint64_t fs_cast(struct ombr_fs_ctx *fs,unsigned t,unsigned s,uint64_t a){if((s>=6&&a>>63&&t<6)||(s<6&&t>=6&&a>>63)||!o_valid(t,a))return fs_error(fs,5);return a;}
16static uint64_t fs_op(struct ombr_fs_ctx *fs,unsigned op,unsigned t,uint64_t a,uint64_t b){
17unsigned w=o_width(t);uint64_t mask=UINT64_MAX>>(64-w),r=0;
18if(op>=6&&op<=11){uint64_t x=t>=6?a^((uint64_t)1<<63):a,y=t>=6?b^((uint64_t)1<<63):b;switch(op){case 6:return x==y;case 7:return x!=y;case 8:return x<y;case 9:return x<=y;case 10:return x>y;default:return x>=y;}}
19if(op==12)return a&b;if(op==13)return a|b;if(op==14)return a^b;
20if(op==18)return t==1?!a:(t>=6?~a:(~a)&mask);
21if(op==15||op==16){if(b>=w)return fs_error(fs,7);if(op==16){if(t<6||!b)return a>>b;return (a>>b)|((a>>63)?(UINT64_MAX<<(64-b)):0);}if(t<6)return (a<<b)&mask;uint64_t m=(uint64_t)1<<(w-1),x=a>>63?0-a:a,lim=a>>63?m:m-1;if(x>(lim>>b))return fs_error(fs,1);return a<<b;}
22if(op==4||op==5){if(!b)return fs_error(fs,2);if(t<6)return op==4?a/b:a%b;uint64_t x=a>>63?0-a:a,y=b>>63?0-b:b;int neg=op==4?(int)((a^b)>>63):(int)(a>>63);r=op==4?x/y:x%y;if(neg)r=0-r;if(!o_valid(t,r)||(!neg&&r>>63))return fs_error(fs,1);return r;}
23if(t<6){if(op==17)return (0-a)&mask;if(op==1)return (a+b)&mask;if(op==2)return (a-b)&mask;return (a*b)&mask;}
24if(op==17){r=0-a;if(a&&r==a)return fs_error(fs,1);}
25if(op==1){r=a+b;if((~(a^b)&(a^r))>>63)return fs_error(fs,1);}
26if(op==2){r=a-b;if(((a^b)&(a^r))>>63)return fs_error(fs,1);}
27if(op==3){uint64_t x=a>>63?0-a:a,y=b>>63?0-b:b,m=(uint64_t)1<<(w-1),lim=(a^b)>>63?m:m-1;if(y&&x>lim/y)return fs_error(fs,1);r=a*b;}
28if(!o_valid(t,r))return fs_error(fs,1);return r;
29}
30static uint64_t fs_get(struct ombr_fs_ctx *fs,const void *p,uint64_t n,uint64_t i,unsigned t){if(i>=n)return fs_error(fs,3);unsigned w=t==11?32:t==12?64:o_width(t);const uint8_t *b=(const uint8_t*)p+i*(w/8);uint64_t v=0;if(w==8)v=b[0];else if(w==16){uint16_t x;__builtin_memcpy(&x,b,2);v=x;}else if(w==32){uint32_t x;__builtin_memcpy(&x,b,4);v=x;}else if(w==64)__builtin_memcpy(&v,b,8);if(t>=6&&t<=9&&w<64&&(v>>(w-1)))v|=UINT64_MAX<<w;return v;}
31static void fs_put(struct ombr_fs_ctx *fs,void *p,uint64_t n,uint64_t i,uint64_t v,unsigned t){if(i>=n){fs_error(fs,3);return;}unsigned w=t==11?32:t==12?64:o_width(t);if(t<11&&!o_valid(t,v)){fs_error(fs,5);return;}uint8_t *b=(uint8_t*)p+i*(w/8);if(w==8)b[0]=(uint8_t)v;else if(w==16){uint16_t x=(uint16_t)v;__builtin_memcpy(b,&x,2);}else if(w==32){uint32_t x=(uint32_t)v;__builtin_memcpy(b,&x,4);}else if(w==64)__builtin_memcpy(b,&v,8);}
32static void fs_fill(struct ombr_fs_ctx *fs,void *p,uint64_t n,uint64_t v,unsigned t){for(uint64_t i=0;i<n;i++){fs_put(fs,p,n,i,v,t);if(fs->code)return;}}
33static int o_buf(const void *p,uint64_t n,uint64_t want,unsigned t){uintptr_t a=(uintptr_t)p;uint64_t z=t==11?4:t==12?8:o_width(t)/8;return p&&n==want&&a%z==0&&n<=UINTPTR_MAX/z&&a<=UINTPTR_MAX-n*z;}
34static int o_overlap(const void *a,uint64_t an,const void *b,uint64_t bn){uintptr_t x=(uintptr_t)a,y=(uintptr_t)b;return x<y+bn&&y<x+an;}
35#define o_cast(t,s,a) ({uint64_t fs_r=fs_cast(fs,t,s,a);if(fs->code)goto fs_fail;fs_r;})
36#define o_op(op,t,a,b) ({uint64_t fs_r=fs_op(fs,op,t,a,b);if(fs->code)goto fs_fail;fs_r;})
37#define o_get(p,n,i,t) ({uint64_t fs_r=fs_get(fs,p,n,i,t);if(fs->code)goto fs_fail;fs_r;})
38#define o_put(p,n,i,v,t) do{fs_put(fs,p,n,i,v,t);if(fs->code)goto fs_fail;}while(0)
39#define o_fill(p,n,v,t) do{fs_fill(fs,p,n,v,t);if(fs->code)goto fs_fail;}while(0)
40#define o_leave(v) fs_leave(fs,(v))
41#define o_enter() do{if(fs->depth>=128){fs->code=6;return 0;}++fs->depth;}while(0)
42#define o_trap(c) do{fs->code=(c);goto fs_fail;}while(0)
43static uint64_t o_arg32(float v){uint32_t b;__builtin_memcpy(&b,&v,4);return b;}
44static uint64_t o_arg64(double v){uint64_t b;__builtin_memcpy(&b,&v,8);return b;}
45#if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
46#error seeded C profile requires little-endian storage
47#endif
48#include <float.h>
49#include <fenv.h>
50#if FLT_RADIX != 2 || FLT_MANT_DIG != 24 || FLT_MAX_EXP != 128 || DBL_MANT_DIG != 53 || DBL_MAX_EXP != 1024 || FLT_EVAL_METHOD != 0
51#error unsupported binary32 or binary64 environment
52#endif
53#if defined(__FAST_MATH__)
54#error fast math is not a supported Omega environment
55#endif
56static int o_fnan(unsigned t,uint64_t a){return t==11?((a>>23&255)==255&&(a&UINT64_C(0x7fffff))!=0):((a>>52&2047)==2047&&(a&UINT64_C(0xfffffffffffff))!=0);}
57static uint64_t o_fpn(unsigned t,uint64_t a,uint64_t b,uint64_t r){uint64_t q=t==11?UINT64_C(0x400000):UINT64_C(0x8000000000000);if(!o_fnan(t,r))return r;if(o_fnan(t,a)&&!(a&q))return a|q;if(o_fnan(t,b)&&!(b&q))return b|q;if(o_fnan(t,a))return a;if(o_fnan(t,b))return b;return t==11?UINT64_C(0x7fc00000):UINT64_C(0x7ff8000000000000);}
58static float o_sqrt32(float a){float r;
59#if defined(__aarch64__)
60__asm__("fsqrt %s0, %s1":"=w"(r):"w"(a));
61#elif defined(__x86_64__)
62__asm__("sqrtss %1, %0":"=x"(r):"x"(a));
63#else
64#error unsupported seeded float sqrt target
65#endif
66return r;}
67static double o_sqrt64(double a){double r;
68#if defined(__aarch64__)
69__asm__("fsqrt %d0, %d1":"=w"(r):"w"(a));
70#elif defined(__x86_64__)
71__asm__("sqrtsd %1, %0":"=x"(r):"x"(a));
72#else
73#error unsupported seeded float sqrt target
74#endif
75return r;}
76static uint64_t o_fp(unsigned op,unsigned t,uint64_t a,uint64_t b){if(t==11){uint32_t ua=(uint32_t)a,ub=(uint32_t)b,ur;float x,y;volatile float z;__builtin_memcpy(&x,&ua,4);__builtin_memcpy(&y,&ub,4);switch(op){case 1:z=x+y;break;case 2:z=x-y;break;case 3:z=x*y;break;case 4:z=x/y;break;case 6:return x==y;case 7:return x!=y;case 8:return x<y;case 9:return x<=y;case 10:return x>y;case 11:return x>=y;case 17:return ua^UINT32_C(0x80000000);case 19:return ua&UINT32_C(0x7fffffff);case 20:z=o_sqrt32(x);break;default:__builtin_trap();}__builtin_memcpy(&ur,(const void*)&z,4);return o_fpn(11,ua,ub,ur);}uint64_t ur;double x,y;volatile double z;__builtin_memcpy(&x,&a,8);__builtin_memcpy(&y,&b,8);switch(op){case 1:z=x+y;break;case 2:z=x-y;break;case 3:z=x*y;break;case 4:z=x/y;break;case 6:return x==y;case 7:return x!=y;case 8:return x<y;case 9:return x<=y;case 10:return x>y;case 11:return x>=y;case 17:return a^UINT64_C(0x8000000000000000);case 19:return a&UINT64_C(0x7fffffffffffffff);case 20:z=o_sqrt64(x);break;default:__builtin_trap();}__builtin_memcpy(&ur,(const void*)&z,8);return o_fpn(12,a,b,ur);}
77static uint64_t o_fcv(unsigned t,unsigned s,uint64_t a){uint32_t u=(uint32_t)a;float f;double x;if(s==t)return a;if(s<11){if(t==11){volatile float z=s>=6?(float)(int64_t)a:(float)a;__builtin_memcpy(&u,(const void*)&z,4);return u;}volatile double z=s>=6?(double)(int64_t)a:(double)a;__builtin_memcpy(&a,(const void*)&z,8);return a;}if(t==12){if(o_fnan(11,a))return (uint64_t)(u>>31)<<63|UINT64_C(0x7ff8000000000000)|(uint64_t)(u&UINT32_C(0x7fffff))<<29;__builtin_memcpy(&f,&u,4);volatile double z=f;__builtin_memcpy(&a,(const void*)&z,8);return a;}if(t==11){if(o_fnan(12,a))return (a>>63)<<31|UINT64_C(0x7fc00000)|(a>>29&UINT64_C(0x3fffff));__builtin_memcpy(&x,&a,8);volatile float z=(float)x;__builtin_memcpy(&u,(const void*)&z,4);return u;}if(s==11){__builtin_memcpy(&f,&u,4);x=f;}else __builtin_memcpy(&x,&a,8);if(x!=x)return 0;unsigned w=o_width(t);if(t>=6){double m=(double)((uint64_t)1<<(w-1));if(x>=m)return ((uint64_t)1<<(w-1))-1;if(x<-m)return (uint64_t)0-((uint64_t)1<<(w-1));return (uint64_t)(int64_t)x;}if(x<1.0)return 0;if(x>=(w==64?18446744073709551616.0:(double)((uint64_t)1<<w)))return w==64?UINT64_MAX:((uint64_t)1<<w)-1;return (uint64_t)x;}
78/* Omega Bridge runtime views: numeric extents are capacities; * is unsized. */
79static int o_rbuf(const void *p,uint64_t n,uint64_t want,unsigned t){uintptr_t a=(uintptr_t)p;uint64_t z=t==11?4:o_width(t)/8;if(n>UINTPTR_MAX/z)return 0;if(want&&n>want)return 0;if(!n)return 1;if(!p)return 0;return a%z==0&&a<=UINTPTR_MAX-n*z;}
80static int o_rover(const void *a,uint64_t an,const void *b,uint64_t bn){return an&&bn&&o_overlap(a,an,b,bn);}
81static uint64_t f0(struct ombr_fs_ctx *fs, uint64_t v0);
82static uint64_t f1(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, const void *v1, uint64_t v1_n, uint64_t v2, void *v3, uint64_t v3_n);
83static uint64_t f2(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, const void *v1, uint64_t v1_n, const void *v2, uint64_t v2_n, uint64_t v3);
84static uint64_t f3(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, void *v1, uint64_t v1_n, const void *v2, uint64_t v2_n, const void *v3, uint64_t v3_n);
85static uint64_t f4(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, void *v1, uint64_t v1_n, const void *v2, uint64_t v2_n);
86static uint64_t f5(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, void *v1, uint64_t v1_n, const void *v2, uint64_t v2_n);
87static uint64_t f0(struct ombr_fs_ctx *fs, uint64_t v0){
88o_enter();
89if(({uint64_t _a=v0;uint64_t _b=3271426048ULL;o_fp(9, 11, _a,_b);})){
90return o_leave(0ULL);
91}
92if(({uint64_t _a=v0;uint64_t _b=1123942400ULL;o_fp(10, 11, _a,_b);})){
93v0=1123942400ULL;
94}
95uint64_t __attribute__((unused)) v1=1056964608ULL;
96if(({uint64_t _a=v0;uint64_t _b=0ULL;o_fp(8, 11, _a,_b);})){
97v1=3204448256ULL;
98}
99uint64_t __attribute__((unused)) v2=o_fcv(8, 11, ({uint64_t _a=v0;uint64_t _b=v1;o_fp(1, 11, _a,_b);}));
100uint64_t __attribute__((unused)) v3=({uint64_t _a=v0;uint64_t _b=o_fcv(11, 8, v2);o_fp(2, 11, _a,_b);});
101uint64_t __attribute__((unused)) v4=958463454ULL;
102v4=({uint64_t _a=({uint64_t _a=v4;uint64_t _b=v3;o_fp(3, 11, _a,_b);});uint64_t _b=984588073ULL;o_fp(1, 11, _a,_b);});
103v4=({uint64_t _a=({uint64_t _a=v4;uint64_t _b=v3;o_fp(3, 11, _a,_b);});uint64_t _b=1008572070ULL;o_fp(1, 11, _a,_b);});
104v4=({uint64_t _a=({uint64_t _a=v4;uint64_t _b=v3;o_fp(3, 11, _a,_b);});uint64_t _b=1029920628ULL;o_fp(1, 11, _a,_b);});
105v4=({uint64_t _a=({uint64_t _a=v4;uint64_t _b=v3;o_fp(3, 11, _a,_b);});uint64_t _b=1047920110ULL;o_fp(1, 11, _a,_b);});
106v4=({uint64_t _a=({uint64_t _a=v4;uint64_t _b=v3;o_fp(3, 11, _a,_b);});uint64_t _b=1060205080ULL;o_fp(1, 11, _a,_b);});
107v4=({uint64_t _a=1065353216ULL;uint64_t _b=({uint64_t _a=v3;uint64_t _b=v4;o_fp(3, 11, _a,_b);});o_fp(1, 11, _a,_b);});
108if(({uint64_t _a=v2;uint64_t _b=18446744073709551490ULL;o_op(8, 8, _a,_b);})){
109v4=({uint64_t _a=v4;uint64_t _b=1056964608ULL;o_fp(3, 11, _a,_b);});
110v2=18446744073709551490ULL;
111}
112return o_leave(({uint64_t _a=v4;uint64_t _b=({uint64_t _a=o_cast(4, 8, ({uint64_t _a=v2;uint64_t _b=127ULL;o_op(1, 8, _a,_b);}));uint64_t _b=23ULL;o_op(15, 4, _a,_b);});o_fp(3, 11, _a,_b);}));
113fs_fail: __attribute__((unused));--fs->depth;return 0;
114}
115static uint64_t f1(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, const void *v1, uint64_t v1_n, uint64_t v2, void *v3, uint64_t v3_n){
116o_enter();
117uint64_t __attribute__((unused)) v4=({uint64_t _a=o_get(v1, v1_n, 2ULL, 5);uint64_t _b=2ULL;o_op(1, 5, _a,_b);});
118uint64_t __attribute__((unused)) v5=({uint64_t _a=v2;uint64_t _b=o_get(v1, v1_n, 1ULL, 5);o_op(3, 5, _a,_b);});
119v5=({uint64_t _a=v5;uint64_t _b=v4;o_op(3, 5, _a,_b);});
120uint64_t __attribute__((unused)) v6=4286578688ULL;
121{
122uint64_t v7=0;
123uint64_t k1=o_get(v1, v1_n, 1ULL, 5);
124uint64_t c1=0;
125for(;o_op(8,5, v7, k1);v7=o_op(1,5, v7,1)){
126if(c1++>=1000000)o_trap(4);
127uint64_t __attribute__((unused)) v8=({uint64_t _a=v7;uint64_t _b=v4;o_op(3, 5, _a,_b);});
128v8=({uint64_t _a=v8;uint64_t _b=v5;o_op(1, 5, _a,_b);});
129v8=({uint64_t _a=v8;uint64_t _b=o_get(v1, v1_n, 2ULL, 5);o_op(1, 5, _a,_b);});
130uint64_t __attribute__((unused)) v9=o_get(v0, v0_n, v8, 11);
131if(({uint64_t _a=v9;uint64_t _b=v6;o_fp(10, 11, _a,_b);})){
132v6=v9;
133}
134}
135}
136{uint64_t _i=17ULL;uint64_t _v=0ULL;o_put(v3, v3_n, _i,_v,11);}
137if(({uint64_t _a=({uint64_t _a=v6;uint64_t _b=4286578688ULL;o_fp(10, 11, _a,_b);});uint64_t _b=0;o_op(18, 1, _a,_b);})){
138return o_leave(0ULL);
139}
140{uint64_t _i=17ULL;uint64_t _v=1065353216ULL;o_put(v3, v3_n, _i,_v,11);}
141uint64_t __attribute__((unused)) v7=0ULL;
142{
143uint64_t v8=0;
144uint64_t k1=o_get(v1, v1_n, 1ULL, 5);
145uint64_t c1=0;
146for(;o_op(8,5, v8, k1);v8=o_op(1,5, v8,1)){
147if(c1++>=1000000)o_trap(4);
148uint64_t __attribute__((unused)) v9=({uint64_t _a=v8;uint64_t _b=v4;o_op(3, 5, _a,_b);});
149v9=({uint64_t _a=v9;uint64_t _b=v5;o_op(1, 5, _a,_b);});
150v9=({uint64_t _a=v9;uint64_t _b=o_get(v1, v1_n, 2ULL, 5);o_op(1, 5, _a,_b);});
151uint64_t __attribute__((unused)) v10=o_get(v0, v0_n, v9, 11);
152v10=({uint64_t fs_value=(({uint64_t p0=({uint64_t _a=v10;uint64_t _b=v6;o_fp(2, 11, _a,_b);});f0(fs, p0);}));if(fs->code)goto fs_fail;fs_value;});
153{uint64_t _i=v8;uint64_t _v=v10;o_put(v3, v3_n, _i,_v,11);}
154v9=({uint64_t _a=v9;uint64_t _b=1ULL;o_op(1, 5, _a,_b);});
155v10=({uint64_t _a=v10;uint64_t _b=o_get(v0, v0_n, v9, 11);o_fp(3, 11, _a,_b);});
156v7=({uint64_t _a=v7;uint64_t _b=v10;o_fp(1, 11, _a,_b);});
157}
158}
159{uint64_t _i=16ULL;uint64_t _v=({uint64_t _a=1065353216ULL;uint64_t _b=v7;o_fp(4, 11, _a,_b);});o_put(v3, v3_n, _i,_v,11);}
160return o_leave(0ULL);
161fs_fail: __attribute__((unused));--fs->depth;return 0;
162}
163static uint64_t f2(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, const void *v1, uint64_t v1_n, const void *v2, uint64_t v2_n, uint64_t v3){
164o_enter();
165if(({uint64_t _a=({uint64_t _a=o_get(v1, v1_n, 17ULL, 11);uint64_t _b=0ULL;o_fp(10, 11, _a,_b);});uint64_t _b=0;o_op(18, 1, _a,_b);})){
166return o_leave(0ULL);
167}
168uint64_t __attribute__((unused)) v4=({uint64_t _a=o_get(v2, v2_n, 3ULL, 5);uint64_t _b=o_get(v2, v2_n, 1ULL, 5);o_op(3, 5, _a,_b);});
169v4=({uint64_t _a=v4;uint64_t _b=({uint64_t _a=o_get(v2, v2_n, 2ULL, 5);uint64_t _b=2ULL;o_op(1, 5, _a,_b);});o_op(3, 5, _a,_b);});
170uint64_t __attribute__((unused)) v5=0ULL;
171{
172uint64_t v6=0;
173uint64_t k1=o_get(v2, v2_n, 1ULL, 5);
174uint64_t c1=0;
175for(;o_op(8,5, v6, k1);v6=o_op(1,5, v6,1)){
176if(c1++>=1000000)o_trap(4);
177uint64_t __attribute__((unused)) v7=({uint64_t _a=v6;uint64_t _b=({uint64_t _a=o_get(v2, v2_n, 2ULL, 5);uint64_t _b=2ULL;o_op(1, 5, _a,_b);});o_op(3, 5, _a,_b);});
178v7=({uint64_t _a=v7;uint64_t _b=v4;o_op(1, 5, _a,_b);});
179v7=({uint64_t _a=v7;uint64_t _b=v3;o_op(1, 5, _a,_b);});
180uint64_t __attribute__((unused)) v8=o_get(v0, v0_n, v7, 11);
181v8=({uint64_t _a=o_get(v1, v1_n, v6, 11);uint64_t _b=v8;o_fp(3, 11, _a,_b);});
182v5=({uint64_t _a=v5;uint64_t _b=v8;o_fp(1, 11, _a,_b);});
183}
184}
185return o_leave(({uint64_t _a=v5;uint64_t _b=o_get(v1, v1_n, 16ULL, 11);o_fp(3, 11, _a,_b);}));
186fs_fail: __attribute__((unused));--fs->depth;return 0;
187}
188static uint64_t f3(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, void *v1, uint64_t v1_n, const void *v2, uint64_t v2_n, const void *v3, uint64_t v3_n){
189o_enter();
190{
191uint64_t v4=0;
192uint64_t k1=o_get(v3, v3_n, 2ULL, 5);
193uint64_t c1=0;
194for(;o_op(8,5, v4, k1);v4=o_op(1,5, v4,1)){
195if(c1++>=1000000)o_trap(4);
196uint64_t __attribute__((unused)) v5=({uint64_t fs_value=(({uint64_t p3=v4;f2(fs, v0, v0_n, v2, v2_n, v3, v3_n, p3);}));if(fs->code)goto fs_fail;fs_value;});
197uint64_t __attribute__((unused)) v6=({uint64_t _a=o_get(v3, v3_n, 3ULL, 5);uint64_t _b=o_get(v3, v3_n, 2ULL, 5);o_op(3, 5, _a,_b);});
198v6=({uint64_t _a=v6;uint64_t _b=v4;o_op(1, 5, _a,_b);});
199{uint64_t _i=v6;uint64_t _v=v5;o_put(v1, v1_n, _i,_v,11);}
200}
201}
202return o_leave(0);
203fs_fail: __attribute__((unused));--fs->depth;return 0;
204}
205static uint64_t f4(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, void *v1, uint64_t v1_n, const void *v2, uint64_t v2_n){
206o_enter();
207uint32_t v3[18];
208uint64_t v3_n=18;
209o_fill(v3, v3_n, 0ULL, 11);
210uint64_t v4[4];
211uint64_t v4_n=4;
212o_fill(v4, v4_n, 0ULL, 5);
213{uint64_t _i=0ULL;uint64_t _v=o_get(v2, v2_n, 0ULL, 5);o_put(v4, v4_n, _i,_v,5);}
214{uint64_t _i=1ULL;uint64_t _v=o_get(v2, v2_n, 1ULL, 5);o_put(v4, v4_n, _i,_v,5);}
215{uint64_t _i=2ULL;uint64_t _v=o_get(v2, v2_n, 2ULL, 5);o_put(v4, v4_n, _i,_v,5);}
216{
217uint64_t v5=0;
218uint64_t k1=o_get(v2, v2_n, 7ULL, 5);
219uint64_t c1=0;
220for(;o_op(8,5, v5, k1);v5=o_op(1,5, v5,1)){
221if(c1++>=1000000)o_trap(4);
222uint64_t __attribute__((unused)) v6=({uint64_t _a=o_get(v2, v2_n, 6ULL, 5);uint64_t _b=v5;o_op(1, 5, _a,_b);});
223uint64_t __attribute__((unused)) v7=({uint64_t fs_value=(({uint64_t p2=v6;f1(fs, v0, v0_n, v2, v2_n, p2, v3, v3_n);}));if(fs->code)goto fs_fail;fs_value;});
224if(({uint64_t _a=v7;uint64_t _b=0ULL;o_op(7, 5, _a,_b);})){
225return o_leave(v7);
226}
227{uint64_t _i=3ULL;uint64_t _v=v6;o_put(v4, v4_n, _i,_v,5);}
228({uint64_t fs_value=(({f3(fs, v0, v0_n, v1, v1_n, v3, v3_n, v4, v4_n);}));if(fs->code)goto fs_fail;fs_value;});
229}
230}
231return o_leave(0ULL);
232fs_fail: __attribute__((unused));--fs->depth;return 0;
233}
234static uint64_t f5(struct ombr_fs_ctx *fs, const void *v0, uint64_t v0_n, void *v1, uint64_t v1_n, const void *v2, uint64_t v2_n){
235o_enter();
236uint64_t v3[16];
237uint64_t v3_n=16;
238o_fill(v3, v3_n, 0ULL, 5);
239{
240uint64_t v4=0;
241uint64_t k1=16ULL;
242for(;o_op(8,5, v4, k1);v4=o_op(1,5, v4,1)){
243{uint64_t _i=v4;uint64_t _v=o_get(v2, v2_n, v4, 5);o_put(v3, v3_n, _i,_v,5);}
244}
245}
246{
247uint64_t v4=0;
248uint64_t k1=({uint64_t _a=({uint64_t _a=o_get(v2, v2_n, 0ULL, 5);uint64_t _b=1000000ULL;o_op(4, 5, _a,_b);});uint64_t _b=1ULL;o_op(1, 5, _a,_b);});
249uint64_t c1=0;
250for(;o_op(8,5, v4, k1);v4=o_op(1,5, v4,1)){
251if(c1++>=1000000)o_trap(4);
252{uint64_t _i=6ULL;uint64_t _v=({uint64_t _a=v4;uint64_t _b=1000000ULL;o_op(3, 5, _a,_b);});o_put(v3, v3_n, _i,_v,5);}
253uint64_t __attribute__((unused)) v5=({uint64_t _a=o_get(v2, v2_n, 0ULL, 5);uint64_t _b=o_get(v3, v3_n, 6ULL, 5);o_op(2, 5, _a,_b);});
254if(({uint64_t _a=v5;uint64_t _b=1000000ULL;o_op(10, 5, _a,_b);})){
255v5=1000000ULL;
256}
257{uint64_t _i=7ULL;uint64_t _v=v5;o_put(v3, v3_n, _i,_v,5);}
258uint64_t __attribute__((unused)) v6=({uint64_t fs_value=(({f4(fs, v0, v0_n, v1, v1_n, v3, v3_n);}));if(fs->code)goto fs_fail;fs_value;});
259if(({uint64_t _a=v6;uint64_t _b=0ULL;o_op(7, 5, _a,_b);})){
260return o_leave(v6);
261}
262}
263}
264return o_leave(0ULL);
265fs_fail: __attribute__((unused));--fs->depth;return 0;
266}
267uint32_t omega_av_fold(uint64_t *result, const void *p0, volatile uint64_t p0_n, void *p1, volatile uint64_t p1_n, const void *p2, volatile uint64_t p2_n){
268 if(!o_buf(result,1,1,5))return 32;
269if(!o_rbuf(p0, p0_n,0, 11))return 32;
270 if(o_rover(result,8,p0, p0_n*4))return 32;
271if(!o_rbuf(p1, p1_n,0, 11))return 32;
272 if(o_rover(result,8,p1, p1_n*4))return 32;
273if(o_rover(p1, p1_n*4, p0, p0_n*4))return 32;
274if(!o_rbuf(p2, p2_n,16, 5))return 32;
275 if(o_rover(result,8,p2, p2_n*8))return 32;
276if(o_rover(p2, p2_n*8, p1, p1_n*4))return 32;
277 struct ombr_fs_ctx fs_state={0,0};struct ombr_fs_ctx *fs=&fs_state;uint64_t _result=f5(fs, p0, p0_n, p1, p1_n, p2, p2_n);if(!fs->code)fs_put(fs,result,1,0,_result,5);return fs->code;
278}
279#if defined(__GNUC__)
280#pragma GCC diagnostic pop
281#endif