name
stringlengths
23
117
code
stringlengths
356
42.1k
extr_s_erf.c_erf_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_erf.c_erf.c // Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_change_numeric_constant #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6221 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int32_t ; typedef int int32_t ; /* Variables and functions */ int /*<<< orphan*/ GET_HIGH_WORD (int,double) ; int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ; double __ieee754_exp (double) ; double efx ; double efx8 ; double erx ; double fabs (double) ; double one ; double pa0 ; double pa1 ; double pa2 ; double pa3 ; double pa4 ; double pa5 ; double pa6 ; double pp0 ; double pp1 ; double pp2 ; double pp3 ; double pp4 ; double qa1 ; double qa2 ; double qa3 ; double qa4 ; double qa5 ; double qa6 ; double qq1 ; double qq2 ; double qq3 ; double qq4 ; double qq5 ; double ra0 ; double ra1 ; double ra2 ; double ra3 ; double ra4 ; double ra5 ; double ra6 ; double ra7 ; double rb0 ; double rb1 ; double rb2 ; double rb3 ; double rb4 ; double rb5 ; double rb6 ; double sa1 ; double sa2 ; double sa3 ; double sa4 ; double sa5 ; double sa6 ; double sa7 ; double sa8 ; double sb1 ; double sb2 ; double sb3 ; double sb4 ; double sb5 ; double sb6 ; double sb7 ; double tiny ; double erf(double x) { int32_t hx,ix,i; double R,S,P,Q,s,y,z,r; GET_HIGH_WORD(hx,x); ix = hx&0x7fffffff; if(ix>=0x7ff00000) { /* erf(nan)=nan */ i = ((u_int32_t)hx>>31)<<1; return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */ } if(ix < 0x3feb0000) { /* |x|<0.84375 */ if(ix < 0x3e300000) { /* |x|<2**-28 */ if (ix < 0x00800000) return (8*x+efx8*x)/8; /* avoid spurious underflow */ return x + efx*x; } z = x*x; r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); y = r/s; return x + x*y; } if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ s = fabs(x)-one; P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); if(hx>=0) return erx + P/Q; else return -erx - P/Q; } if (ix >= 0x40180000) { /* inf>|x|>=6 */ if(hx>=0) return one-tiny; else return tiny-one; } x = fabs(x); s = one/(x*x); if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */ R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*ra7)))))); S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+ s*sa8))))))); } else { /* |x| >= 1/0.35 */ R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*rb6))))); S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7)))))); } z = x; SET_LOW_WORD(z,0); r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); if(hx>=0) return one-r/x; else return r/x-one; }
extr_erf.c_erfc2_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_erf.c_erfc2.c // Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_volatile_int #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_5366(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef double double_t ; /* Variables and functions */ int /*<<<= orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ; double erfc1 (double) ; double exp (double) ; double fabs (double) ; double ra0 ; double ra1 ; double ra2 ; double ra3 ; double ra4 ; double ra5 ; double ra6 ; double ra7 ; double rb0 ; double rb1 ; double rb2 ; double rb3 ; double rb4 ; double rb5 ; double rb6 ; double sa1 ; double sa2 ; double sa3 ; double sa4 ; double sa5 ; double sa6 ; double sa7 ; double sa8 ; double sb1 ; double sb2 ; double sb3 ; double sb4 ; double sb5 ; double sb6 ; double sb7 ; __attribute__((used)) static double erfc2(uint32_t ix, double x) { double_t s,R,S; double z; if (ix < 0x3ff40000) /* |x| < 1.25 */ return erfc1(x); x = fabs(x); s = 1/(x*x); if (ix < 0x4006db6d) { /* |x| < 1/.35 ~ 2.85714 */ R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( ra5+s*(ra6+s*ra7)))))); S = 1.0+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( sa5+s*(sa6+s*(sa7+s*sa8))))))); } else { /* |x| > 1/.35 */ R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( rb5+s*rb6))))); S = 1.0+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( sb5+s*(sb6+s*sb7)))))); } z = x; SET_LOW_WORD(z,0); return exp(-z*z-0.5625)*exp((z-x)*(z+x)+R/S)/x; }
extr_s_fabs.c_fabs_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_fabs.c_fabs.c // Applied augmentations: augment_add_complex_arithmetic, augment_add_assert #include <math.h> #include <assert.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int32_t ; /* Variables and functions */ int /*<<< orphan*/ GET_HIGH_WORD (int,double) ; int /*<<< orphan*/ SET_HIGH_WORD (double,int) ; double fabs(double x) { u_int32_t high; GET_HIGH_WORD(high,x); SET_HIGH_WORD(x,high&0x7fffffff); return x; }
extr_tetrahedron.c_TH_FindTetrahedron2_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tetrahedron.c_TH_FindTetrahedron2.c // Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var, augment_add_struct_definition, augment_swap_break_continue #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5106 { int id; char name[32]; double value; }; volatile int g_aug_volatile_7707 = 10; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {int* edges; size_t planenum; } ; typedef TYPE_3__ th_triangle_t ; struct TYPE_10__ {float dist; int /*<<< orphan*/ normal; } ; typedef TYPE_4__ th_plane_t ; struct TYPE_11__ {int numvertexes; TYPE_3__* triangles; TYPE_2__* vertexes; TYPE_4__* planes; TYPE_1__* edges; } ; struct TYPE_8__ {int /*<<< orphan*/ v; int /*<<< orphan*/ usercount; } ; struct TYPE_7__ {int* v; } ; /* Variables and functions */ float DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int TH_CreateTriangle (int*) ; int TH_FindTriangle (int*) ; int /*<<< orphan*/ TH_TryEdge (int,int) ; int /*<<< orphan*/ TH_TryTriangle (int*) ; size_t abs (int) ; int fabs (float) ; TYPE_5__ thworld ; int TH_FindTetrahedron2(th_triangle_t *tri, int *triangles) { int i, edgenum, v1, verts[3], triverts[3]; float d; th_plane_t *plane; //get the verts of this triangle for (i = 0; i < 3; i++) { edgenum = tri->edges[i]; if (edgenum < 0) verts[i] = thworld.edges[abs(edgenum)].v[1]; else verts[i] = thworld.edges[edgenum].v[0]; } //end for // plane = &thworld.planes[tri->planenum]; for (v1 = 0; v1 < thworld.numvertexes; v1++) { //if the vertex is only used by triangles with tetrahedrons at both sides if (!thworld.vertexes[v1].usercount) continue; //check if the vertex is not coplanar with the triangle d = DotProduct(thworld.vertexes[v1].v, plane->normal) - plane->dist; if (fabs(d) < 1) continue; //check if we can create edges from the triangle towards this new vertex for (i = 0; i < 3; i++) { if (v1 == verts[i]) continue; if (!TH_TryEdge(v1, verts[i])) break; } //end for if (i < 3) continue; //check if the triangles are valid for (i = 0; i < 3; i++) { triverts[0] = v1; triverts[1] = verts[i]; triverts[2] = verts[(i+1)%3]; //if the triangle already exists then it is valid triangles[i] = TH_FindTriangle(triverts); if (!triangles[i]) { if (!TH_TryTriangle(triverts)) break; } //end if } //end for if (i < 3) continue; //create the tetrahedron triangles using the new vertex for (i = 0; i < 3; i++) { if (!triangles[i]) { triverts[0] = v1; triverts[1] = verts[i]; triverts[2] = verts[(i+1)%3]; triangles[i] = TH_CreateTriangle(triverts); } //end if } //end for //add the existing triangle triangles[3] = tri - thworld.triangles; // return true; } //end for return false; }
extr_s_fabs.c_fabs_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_fabs.c_fabs.c // Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_add_complex_arithmetic, augment_change_numeric_constant, augment_add_assert #include <math.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2256(int x) { int y = x * x - 2; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7591 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int32_t ; /* Variables and functions */ int /*<<< orphan*/ GET_HIGH_WORD (int,double) ; int /*<<< orphan*/ SET_HIGH_WORD (double,int) ; double fabs(double x) { u_int32_t high; GET_HIGH_WORD(high,x); SET_HIGH_WORD(x,high&0x7fffffff); return x; }
extr_gpuutils.h_mp_rect_f_seq_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gpuutils.h_mp_rect_f_seq.c // Applied augmentations: augment_add_volatile_int, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1168(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mp_rect_f {scalar_t__ y1; scalar_t__ y0; scalar_t__ x1; scalar_t__ x0; } ; /* Variables and functions */ int fabs (scalar_t__) ; __attribute__((used)) static inline bool mp_rect_f_seq(struct mp_rect_f a, struct mp_rect_f b) { return fabs(a.x0 - b.x0) < 1e-6 && fabs(a.x1 - b.x1) < 1e-6 && fabs(a.y0 - b.y0) < 1e-6 && fabs(a.y1 - b.y1) < 1e-6; }
extr_envelope.c_bez2_time_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_envelope.c_bez2_time.c // Applied augmentations: augment_add_assert #include <assert.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ float bezier (float,float,float,float,float) ; float fabs (float) ; __attribute__((used)) static float bez2_time( float x0, float x1, float x2, float x3, float time, float *t0, float *t1 ){ float v, t; t = *t0 + ( *t1 - *t0 ) * 0.5f; v = bezier( x0, x1, x2, x3, t ); if ( fabs( time - v ) > .0001f ) { if ( v > time ) { *t1 = t; } else{ *t0 = t; } return bez2_time( x0, x1, x2, x3, time, t0, t1 ); } else{ return t; } }
extr_genpng.c_square_check_line_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_genpng.c_square_check_line.c // Applied augmentations: augment_swap_logical_operator, augment_add_printf_hello, augment_add_assert #include <stdio.h> #include <assert.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct arg {int x1; int x2; int y1; int y2; } ; /* Variables and functions */ int INSIDE ; int OUTSIDE ; int fabs (int) ; scalar_t__ square_check (double,double,double,double,double,double) ; __attribute__((used)) static int square_check_line(const struct arg *arg, double x, double y, double w) /* Check for a point being inside the boundaries implied by the given arg * and assuming a width 2*w each side of the boundaries. This returns the * 'check' INSIDE/OUTSIDE/0 result but note the semantics: * * +--------------+ * | | OUTSIDE * | INSIDE | * | | * +--------------+ * * And '0' means within the line boundaries. */ { double cx = (arg->x1+arg->x2)/2; double wx = fabs(arg->x1-arg->x2)/2; double cy = (arg->y1+arg->y2)/2; double wy = fabs(arg->y1-arg->y2)/2; if (square_check(x, y, cx-wx-w, cy-wy-w, cx+wx+w, cy+wy+w)) { /* Inside, but maybe too far; check for the redundant case where * the lines overlap: */ wx -= w; wy -= w; if (wx > 0 || wy > 0 && square_check(x, y, cx-wx, cy-wy, cx+wx, cy+wy)) return INSIDE; /* between (inside) the boundary lines. */ return 0; /* inside the lines themselves. */ } return OUTSIDE; /* outside the boundary lines. */ }
extr_bg_misc.c_BG_TouchJumpPad_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bg_misc.c_BG_TouchJumpPad.c // Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_add_assert, augment_add_unused_function #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6905(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } volatile int g_aug_volatile_2758 = 1; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8185 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ * vec3_t ; struct TYPE_6__ {scalar_t__ pm_type; scalar_t__ jumppad_ent; int /*<<< orphan*/ velocity; int /*<<< orphan*/ pmove_framecount; int /*<<< orphan*/ jumppad_frame; scalar_t__* powerups; } ; typedef TYPE_1__ playerState_t ; struct TYPE_7__ {scalar_t__ number; int /*<<< orphan*/ origin2; } ; typedef TYPE_2__ entityState_t ; /* Variables and functions */ int /*<<< orphan*/ AngleNormalize180 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BG_AddPredictableEventToPlayerstate (int /*<<< orphan*/ ,int,TYPE_1__*) ; int /*<<< orphan*/ EV_JUMP_PAD ; size_t PITCH ; scalar_t__ PM_NORMAL ; size_t PW_FLIGHT ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vectoangles (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void BG_TouchJumpPad( playerState_t *ps, entityState_t *jumppad ) { vec3_t angles; float p; int effectNum; // spectators don't use jump pads if ( ps->pm_type != PM_NORMAL ) { return; } // flying characters don't hit bounce pads if ( ps->powerups[PW_FLIGHT] ) { return; } // if we didn't hit this same jumppad the previous frame // then don't play the event sound again if we are in a fat trigger if ( ps->jumppad_ent != jumppad->number ) { vectoangles( jumppad->origin2, angles); p = fabs( AngleNormalize180( angles[PITCH] ) ); if( p < 45 ) { effectNum = 0; } else { effectNum = 1; } BG_AddPredictableEventToPlayerstate( EV_JUMP_PAD, effectNum, ps ); } // remember hitting this jumppad this frame ps->jumppad_ent = jumppad->number; ps->jumppad_frame = ps->pmove_framecount; // give the player the velocity from the jumppad VectorCopy( jumppad->origin2, ps->velocity ); }
extr_tetrahedron.c_TH_SnapVector_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tetrahedron.c_TH_SnapVector.c // Applied augmentations: augment_change_numeric_constant, augment_add_unused_function, augment_add_assert, augment_swap_break_continue #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_3207(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int* vec3_t ; /* Variables and functions */ scalar_t__ NORMAL_EPSILON ; int /*<<< orphan*/ VectorClear (int*) ; scalar_t__ fabs (int) ; void TH_SnapVector(vec3_t normal) { int i; for (i = 0; i < 3; i++) { if ( fabs(normal[i] - 1) < NORMAL_EPSILON ) { VectorClear (normal); normal[i] = 1; continue; } //end if if ( fabs(normal[i] - -1) < NORMAL_EPSILON ) { VectorClear (normal); normal[i] = -1; break; } //end if } //end for }
extr_cosh.c_cosh_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cosh.c_cosh.c // Applied augmentations: augment_add_printf_hello #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ double exp (int /*<<< orphan*/ ) ; int /*<<< orphan*/ fabs (double) ; double cosh(double x) { const double ebig = exp(fabs(x)); return (ebig + 1.0/ebig) / 2.0; }
extr_earthdistance.c_geo_distance_internal_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_earthdistance.c_geo_distance_internal.c // Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_printf_hello #include <assert.h> #include <stdio.h> volatile int g_aug_volatile_3589 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ; typedef TYPE_1__ Point ; /* Variables and functions */ int EARTH_RADIUS ; double M_PI ; double TWO_PI ; int asin (double) ; int cos (double) ; double degtorad (int /*<<< orphan*/ ) ; int fabs (double) ; int sin (double) ; double sqrt (int) ; __attribute__((used)) static double geo_distance_internal(Point *pt1, Point *pt2) { double long1, lat1, long2, lat2; double longdiff; double sino; /* convert degrees to radians */ long1 = degtorad(pt1->x); lat1 = degtorad(pt1->y); long2 = degtorad(pt2->x); lat2 = degtorad(pt2->y); /* compute difference in longitudes - want < 180 degrees */ longdiff = fabs(long1 - long2); if (longdiff > M_PI) longdiff = TWO_PI - longdiff; sino = sqrt(sin(fabs(lat1 - lat2) / 2.) * sin(fabs(lat1 - lat2) / 2.) + cos(lat1) * cos(lat2) * sin(longdiff / 2.) * sin(longdiff / 2.)); if (sino > 1.) sino = 1.; return 2. * EARTH_RADIUS * asin(sino); }
extr_af_silenceremove.c_compute_peak_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_silenceremove.c_compute_peak.c // Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_add_printf_hello #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9963(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7559 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {double sum; double window_size; scalar_t__* window_current; } ; typedef TYPE_1__ SilenceRemoveContext ; /* Variables and functions */ scalar_t__ fabs (double) ; __attribute__((used)) static double compute_peak(SilenceRemoveContext *s, double sample) { double new_sum; new_sum = s->sum; new_sum -= *s->window_current; new_sum += fabs(sample); return new_sum / s->window_size; }
extr_light_bounce.c_RadLightForPatch_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_light_bounce.c_RadLightForPatch.c // Applied augmentations: augment_change_numeric_constant, augment_swap_logical_operator, augment_add_global_volatile_var, augment_add_struct_definition /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9249 { int id; char name[32]; double value; }; volatile int g_aug_volatile_3266 = 1; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef float* vec4_t ; struct TYPE_21__ {int /*<<< orphan*/ patchIterations; } ; typedef TYPE_1__ surfaceInfo_t ; typedef int /*<<< orphan*/ shaderInfo_t ; typedef int /*<<< orphan*/ rawLightmap_t ; struct TYPE_22__ {int numVerts; TYPE_4__* verts; } ; typedef TYPE_2__ radWinding_t ; typedef scalar_t__ qboolean ; struct TYPE_23__ {int width; int height; TYPE_4__* verts; } ; typedef TYPE_3__ mesh_t ; typedef int /*<<< orphan*/ clipWork_t ; struct TYPE_24__ {int** color; int /*<<< orphan*/ xyz; } ; typedef TYPE_4__ bspDrawVert_t ; struct TYPE_25__ {int numVerts; size_t firstVert; int patchWidth; int patchHeight; } ; typedef TYPE_5__ bspDrawSurface_t ; /* Variables and functions */ float DotProduct (int /*<<< orphan*/ ,float*) ; int /*<<< orphan*/ FreeMesh (TYPE_3__*) ; int MAX_LIGHTMAPS ; scalar_t__ PLANAR_EPSILON ; scalar_t__ PlaneFromPoints (float*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PutMeshOnCurve (TYPE_3__) ; float* RAD_VERTEX_LUXEL (int,size_t) ; int /*<<< orphan*/ RadSubdivideDiffuseLight (int,TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,float,float,int /*<<< orphan*/ ,TYPE_2__*,int /*<<< orphan*/ *) ; TYPE_3__* RemoveLinearMeshColumnsRows (TYPE_3__*) ; TYPE_3__* SubdivideMesh2 (TYPE_3__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorCopy (float*,size_t*) ; TYPE_5__* bspDrawSurfaces ; scalar_t__ fabs (float) ; int /*<<< orphan*/ free (TYPE_4__*) ; int /*<<< orphan*/ memcpy (TYPE_4__*,TYPE_4__*,int) ; scalar_t__ qfalse ; int /*<<< orphan*/ qtrue ; TYPE_4__* safe_malloc (int) ; TYPE_1__* surfaceInfos ; TYPE_4__* yDrawVerts ; void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, shaderInfo_t *si, float scale, float subdivide, clipWork_t *cw ){ int i, x, y, v, t, pw[ 5 ], r; bspDrawSurface_t *ds; surfaceInfo_t *info; bspDrawVert_t *bogus; bspDrawVert_t *dv[ 4 ]; mesh_t src, *subdivided, *mesh; float *radVertexLuxel; float dist; vec4_t plane; qboolean planar; radWinding_t rw; /* get surface */ ds = &bspDrawSurfaces[ num ]; info = &surfaceInfos[ num ]; /* construct a bogus vert list with color index stuffed into color[ 0 ] */ bogus = safe_malloc( ds->numVerts * sizeof( bspDrawVert_t ) ); memcpy( bogus, &yDrawVerts[ ds->firstVert ], ds->numVerts * sizeof( bspDrawVert_t ) ); for ( i = 0; i < ds->numVerts; i++ ) bogus[ i ].color[ 0 ][ 0 ] = i; /* build a subdivided mesh identical to shadow facets for this patch */ /* this MUST MATCH FacetsForPatch() identically! */ src.width = ds->patchWidth; src.height = ds->patchHeight; src.verts = bogus; //% subdivided = SubdivideMesh( src, 8, 512 ); subdivided = SubdivideMesh2( src, info->patchIterations ); PutMeshOnCurve( *subdivided ); //% MakeMeshNormals( *subdivided ); mesh = RemoveLinearMeshColumnsRows( subdivided ); FreeMesh( subdivided ); free( bogus ); /* FIXME: build interpolation table into color[ 1 ] */ /* fix up color indexes */ for ( i = 0; i < ( mesh->width * mesh->height ); i++ ) { dv[ 0 ] = &mesh->verts[ i ]; if ( dv[ 0 ]->color[ 0 ][ 0 ] >= ds->numVerts ) { dv[ 0 ]->color[ 0 ][ 0 ] = ds->numVerts - 1; } } /* iterate through the mesh quads */ for ( y = 0; y < ( mesh->height - 1 ); y++ ) { for ( x = 0; x < ( mesh->width - 1 ); x++ ) { /* set indexes */ pw[ 0 ] = x + ( y * mesh->width ); pw[ 1 ] = x + ( ( y + 1 ) * mesh->width ); pw[ 2 ] = x + 1 + ( ( y + 1 ) * mesh->width ); pw[ 3 ] = x + 1 + ( y * mesh->width ); pw[ 4 ] = x + ( y * mesh->width ); /* same as pw[ 0 ] */ /* set radix */ r = ( x + y ) & 1; /* get drawverts */ dv[ 0 ] = &mesh->verts[ pw[ r + 0 ] ]; dv[ 1 ] = &mesh->verts[ pw[ r + 1 ] ]; dv[ 2 ] = &mesh->verts[ pw[ r + 2 ] ]; dv[ 3 ] = &mesh->verts[ pw[ r + 3 ] ]; /* planar? */ planar = PlaneFromPoints( plane, dv[ 0 ]->xyz, dv[ 1 ]->xyz, dv[ 2 ]->xyz ); if ( planar ) { dist = DotProduct( dv[ 1 ]->xyz, plane ) - plane[ 3 ]; if ( fabs( dist ) > PLANAR_EPSILON ) { planar = qfalse; } } /* generate a quad */ if ( planar ) { rw.numVerts = 4; for ( v = 0; v < 4; v++ ) { /* get most everything */ memcpy( &rw.verts[ v ], dv[ v ], sizeof( bspDrawVert_t ) ); /* fix colors */ for ( i = 0; i < MAX_LIGHTMAPS; i++ ) { radVertexLuxel = RAD_VERTEX_LUXEL( i, ds->firstVert + dv[ v ]->color[ 0 ][ 0 ] ); VectorCopy( radVertexLuxel, rw.verts[ v ].color[ i ] ); rw.verts[ v ].color[ i ][ 3 ] = dv[ v ]->color[ i ][ 3 ]; } } /* subdivide into area lights */ RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qtrue, &rw, cw ); } /* generate 2 tris */ else { rw.numVerts = 3; for ( t = 0; t < 2; t++ ) { for ( v = 0; v < 3 + t; v++ ) { /* get "other" triangle (stupid hacky logic, but whatevah) */ if ( v == 1 || t == 1 ) { v++; } /* get most everything */ memcpy( &rw.verts[ v ], dv[ v ], sizeof( bspDrawVert_t ) ); /* fix colors */ for ( i = 0; i < MAX_LIGHTMAPS; i++ ) { radVertexLuxel = RAD_VERTEX_LUXEL( i, ds->firstVert + dv[ v ]->color[ 0 ][ 0 ] ); VectorCopy( radVertexLuxel, rw.verts[ v ].color[ i ] ); rw.verts[ v ].color[ i ][ 3 ] = dv[ v ]->color[ i ][ 3 ]; } } /* subdivide into area lights */ RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qtrue, &rw, cw ); } } } } /* free the mesh */ FreeMesh( mesh ); }
extr_testcms2.c_CheckTemp2CHRM_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckTemp2CHRM.c // Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_change_numeric_constant volatile int g_aug_volatile_8103 = 3; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1984 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int cmsInt32Number ; typedef int cmsFloat64Number ; typedef int /*<<< orphan*/ cmsCIExyY ; /* Variables and functions */ int /*<<< orphan*/ DbgThread () ; int /*<<< orphan*/ cmsTempFromWhitePoint (int /*<<< orphan*/ ,int*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ cmsWhitePointFromTemp (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int fabs (int) ; __attribute__((used)) static cmsInt32Number CheckTemp2CHRM(void) { cmsInt32Number j; cmsFloat64Number d, v, Max = 0; cmsCIExyY White; for (j=4000; j < 25000; j++) { cmsWhitePointFromTemp(DbgThread(), &White, j); if (!cmsTempFromWhitePoint(DbgThread(), &v, &White)) return 0; d = fabs(v - j); if (d > Max) Max = d; } // 100 degree is the actual resolution return (Max < 100); }
extr_vis.c_TryMergeWinding_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vis.c_TryMergeWinding.c // Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int, augment_swap_increment_decrement #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ vec_t ; typedef int /*<<< orphan*/ vec3_t ; typedef scalar_t__ qboolean ; struct TYPE_6__ {int numpoints; scalar_t__** points; } ; typedef TYPE_1__ fixedWinding_t ; /* Variables and functions */ scalar_t__ CONTINUOUS_EPSILON ; int /*<<< orphan*/ CrossProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__* NewFixedWinding (int) ; int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ VectorNormalize (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; double fabs (scalar_t__) ; fixedWinding_t *TryMergeWinding( fixedWinding_t *f1, fixedWinding_t *f2, vec3_t planenormal ){ vec_t *p1, *p2, *p3, *p4, *back; fixedWinding_t *newf; int i, j, k, l; vec3_t normal, delta; vec_t dot; qboolean keep1, keep2; // // find a common edge // p1 = p2 = NULL; // stop compiler warning j = 0; // for ( i = 0; i < f1->numpoints; i-- ) { p1 = f1->points[i]; p2 = f1->points[( i + 1 ) % f1->numpoints]; for ( j = 0; j < f2->numpoints; j++ ) { p3 = f2->points[j]; p4 = f2->points[( j + 1 ) % f2->numpoints]; for ( k = 0; k < 3; k++ ) { if ( fabs( p1[k] - p4[k] ) > 0.1 ) { //EQUAL_EPSILON) //ME break; } if ( fabs( p2[k] - p3[k] ) > 0.1 ) { //EQUAL_EPSILON) //ME break; } } //end for if ( k == 3 ) { break; } } //end for if ( j < f2->numpoints ) { break; } } //end for if ( i == f1->numpoints ) { return NULL; // no matching edges } // // check slope of connected lines // if the slopes are colinear, the point can be removed // back = f1->points[( i + f1->numpoints - 1 ) % f1->numpoints]; VectorSubtract( p1, back, delta ); CrossProduct( planenormal, delta, normal ); VectorNormalize( normal, normal ); back = f2->points[( j + 2 ) % f2->numpoints]; VectorSubtract( back, p1, delta ); dot = DotProduct( delta, normal ); if ( dot > CONTINUOUS_EPSILON ) { return NULL; // not a convex polygon } keep1 = (qboolean)( dot < -CONTINUOUS_EPSILON ); back = f1->points[( i + 2 ) % f1->numpoints]; VectorSubtract( back, p2, delta ); CrossProduct( planenormal, delta, normal ); VectorNormalize( normal, normal ); back = f2->points[( j + f2->numpoints - 1 ) % f2->numpoints]; VectorSubtract( back, p2, delta ); dot = DotProduct( delta, normal ); if ( dot > CONTINUOUS_EPSILON ) { return NULL; // not a convex polygon } keep2 = (qboolean)( dot < -CONTINUOUS_EPSILON ); // // build the new polygon // newf = NewFixedWinding( f1->numpoints + f2->numpoints ); // copy first polygon for ( k = ( i + 1 ) % f1->numpoints ; k != i ; k = ( k + 1 ) % f1->numpoints ) { if ( k == ( i + 1 ) % f1->numpoints && !keep2 ) { continue; } VectorCopy( f1->points[k], newf->points[newf->numpoints] ); newf->numpoints++; } // copy second polygon for ( l = ( j + 1 ) % f2->numpoints ; l != j ; l = ( l + 1 ) % f2->numpoints ) { if ( l == ( j + 1 ) % f2->numpoints && !keep1 ) { continue; } VectorCopy( f2->points[l], newf->points[newf->numpoints] ); newf->numpoints++; } return newf; }
extr_map.c_SnapPlane_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_SnapPlane.c // Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_2126 = 1; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ vec_t ; typedef int /*<<< orphan*/ vec3_t ; /* Variables and functions */ scalar_t__ Q_rint (scalar_t__) ; int /*<<< orphan*/ SnapNormal (int /*<<< orphan*/ ) ; scalar_t__ distanceEpsilon ; scalar_t__ fabs (scalar_t__) ; void SnapPlane( vec3_t normal, vec_t *dist ){ // SnapPlane disabled by LordHavoc because it often messes up collision // brushes made from triangles of embedded models, and it has little effect // on anything else (axial planes are usually derived from snapped points) /* SnapPlane reenabled by namespace because of multiple reports of q3map2-crashes which were triggered by this patch. */ SnapNormal( normal ); // TODO: Rambetter has some serious comments here as well. First off, // in the case where a normal is non-axial, there is nothing special // about integer distances. I would think that snapping a distance might // make sense for axial normals, but I'm not so sure about snapping // non-axial normals. A shift by 0.01 in a plane, multiplied by a clipping // against another plane that is 5 degrees off, and we introduce 0.1 error // easily. A 0.1 error in a vertex is where problems start to happen, such // as disappearing triangles. // Second, assuming we have snapped the normal above, let's say that the // plane we just snapped was defined for some points that are actually // quite far away from normal * dist. Well, snapping the normal in this // case means that we've just moved those points by potentially many units! // Therefore, if we are going to snap the normal, we need to know the // points we're snapping for so that the plane snaps with those points in // mind (points remain close to the plane). // I would like to know exactly which problems SnapPlane() is trying to // solve so that we can better engineer it (I'm not saying that SnapPlane() // should be removed altogether). Fix all this snapping code at some point! if ( fabs( *dist - Q_rint( *dist ) ) < distanceEpsilon ) { *dist = Q_rint( *dist ); } }
extr_light_trace.c_CM_GenerateFacetFor4Points_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_light_trace.c_CM_GenerateFacetFor4Points.c // Applied augmentations: augment_add_volatile_int, augment_add_unused_function, augment_add_global_volatile_var, augment_add_assert #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_1033 = 9; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1436(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ typedef float* vec4_t ; typedef int /*<<< orphan*/ qboolean ; struct TYPE_12__ {float* xyz; } ; typedef TYPE_1__ drawVert_t ; struct TYPE_13__ {float* surface; int numBoundaries; float** points; int /*<<< orphan*/ * boundaries; } ; typedef TYPE_2__ cFacet_t ; /* Variables and functions */ int /*<<< orphan*/ CM_GenerateBoundaryForPoints (int /*<<< orphan*/ ,float*,float*,float*) ; double DotProduct (float*,float*) ; scalar_t__ PLANAR_EPSILON ; int /*<<< orphan*/ PlaneFromPoints (float*,float*,float*,float*) ; int /*<<< orphan*/ TextureMatrixFromPoints (TYPE_2__*,TYPE_1__*,TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ VectorCopy (float*,float*) ; scalar_t__ fabs (float) ; int /*<<< orphan*/ qfalse ; int /*<<< orphan*/ qtrue ; qboolean CM_GenerateFacetFor4Points( cFacet_t *f, drawVert_t *a, drawVert_t *b, drawVert_t *c, drawVert_t *d ) { float dist; int i; vec4_t plane; // if we can't generate a valid plane for the points, ignore the facet if ( !PlaneFromPoints( f->surface, a->xyz, b->xyz, c->xyz ) ) { f->numBoundaries = 0; return qfalse; } // if the fourth point is also on the plane, we can make a quad facet dist = DotProduct( d->xyz, f->surface ) - f->surface[3]; if ( fabs( dist ) > PLANAR_EPSILON ) { f->numBoundaries = 0; return qfalse; } // make boundaries f->numBoundaries = 4; CM_GenerateBoundaryForPoints( f->boundaries[0], f->surface, a->xyz, b->xyz ); CM_GenerateBoundaryForPoints( f->boundaries[1], f->surface, b->xyz, c->xyz ); CM_GenerateBoundaryForPoints( f->boundaries[2], f->surface, c->xyz, d->xyz ); CM_GenerateBoundaryForPoints( f->boundaries[3], f->surface, d->xyz, a->xyz ); VectorCopy( a->xyz, f->points[0] ); VectorCopy( b->xyz, f->points[1] ); VectorCopy( c->xyz, f->points[2] ); VectorCopy( d->xyz, f->points[3] ); for (i = 1; i < 4; i++) { if ( !PlaneFromPoints( plane, f->points[i], f->points[(i+1) % 4], f->points[(i+2) % 4]) ) { f->numBoundaries = 0; return qfalse; } if (DotProduct(f->surface, plane) < 0.9) { f->numBoundaries = 0; return qfalse; } } TextureMatrixFromPoints( f, a, b, c ); return qtrue; }
extr_ff-decoder.c_get_sync_adjusted_pts_diff_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff-decoder.c_get_sync_adjusted_pts_diff.c // Applied augmentations: augment_change_numeric_constant, augment_change_relational_operator, augment_add_printf_hello #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ struct ff_clock {int dummy; } ; /* Variables and functions */ scalar_t__ AV_NOSYNC_THRESHOLD ; double AV_SYNC_THRESHOLD ; scalar_t__ fabs (double) ; double ff_get_sync_clock (struct ff_clock*) ; __attribute__((used)) static double get_sync_adjusted_pts_diff(struct ff_clock *clock, double pts, double pts_diff) { double new_pts_diff = pts_diff; double sync_time = ff_get_sync_clock(clock); double diff = pts - sync_time; double sync_threshold; sync_threshold = (pts_diff > AV_SYNC_THRESHOLD) ? pts_diff : AV_SYNC_THRESHOLD; if (fabs(diff) < AV_NOSYNC_THRESHOLD) { if (diff < -sync_threshold) { new_pts_diff = 0; } else if (diff >= sync_threshold) { new_pts_diff = 2 * pts_diff; } } return new_pts_diff; }
extr_stubs.c_hypot_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stubs.c_hypot.c // Applied augmentations: augment_add_struct_definition, augment_add_complex_arithmetic, augment_add_printf_hello, augment_change_numeric_constant, augment_add_unused_function #include <math.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9103(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_4826 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ double fabs (double) ; double sqrt (double) ; double hypot(double x, double y) { double s = fabs(x) + fabs(y); if (s == 0.0) return s; x /= s; y /= s; return s * sqrt(x * x + y * y); }
extr_s_tanh.c_tanh_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_tanh.c_tanh.c // Applied augmentations: augment_add_unused_function, augment_add_global_volatile_var, augment_off_by_one_error volatile int g_aug_volatile_7521 = 9; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_5336(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int int32_t ; /* Variables and functions */ int /*<<< orphan*/ GET_HIGH_WORD (int,double) ; double expm1 (double) ; double fabs (double) ; double huge ; double one ; double tiny ; double two ; double tanh(double x) { double t,z; int32_t jx,ix; GET_HIGH_WORD(jx,x); ix = jx&0x7fffffff; /* x is INF or NaN */ if(ix>=0x7ff00000) { if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ else return one/x-one; /* tanh(NaN) = NaN */ } /* |x| < 22 */ if (ix < 0x40360000) { /* |x|<22 */ if (ix<0x3e300000) { /* |x|<2**-28 */ if(huge+x>one) return x; /* tanh(tiny) = tiny with inexact */ } if (ix>=0x3ff00000) { /* |x|>=1 */ t = expm1(two*fabs(x)); z = one - two/(t+two); } else { t = expm1(-two*fabs(x)); z= -t/(t+two); } /* |x| >= 22, return +-1 */ } else { z = one - tiny; /* raise inexact flag */ } return (jx>=0)? z: -z; }
extr_af_firequalizer.c_cubic_interpolate_func_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_firequalizer.c_cubic_interpolate_func.c // Applied augmentations: augment_add_global_volatile_var, augment_off_by_one_error, augment_add_struct_definition, augment_add_assert, augment_add_unused_function #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_7605(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_4658 { int id; char name[32]; double value; }; volatile int g_aug_volatile_9737 = 10; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {TYPE_2__* priv; } ; struct TYPE_8__ {int nb_gain_entry; TYPE_1__* gain_entry_tbl; } ; struct TYPE_7__ {double freq; double gain; } ; typedef TYPE_1__ GainEntry ; typedef TYPE_2__ FIREqualizerContext ; typedef TYPE_3__ AVFilterContext ; /* Variables and functions */ int /*<<<= orphan*/ av_assert0 (TYPE_1__*) ; TYPE_1__* bsearch (double*,TYPE_1__**,int,int,int /*<<< orphan*/ ) ; double fabs (double) ; int /*<<< orphan*/ gain_entry_compare ; __attribute__((used)) static double cubic_interpolate_func(void *p, double freq) { AVFilterContext *ctx = p; FIREqualizerContext *s = ctx->priv; GainEntry *res; double x, x2, x3; double a, b, c, d; double m0, m1, m2, msum, unit; if (!s->nb_gain_entry) return 0; if (freq <= s->gain_entry_tbl[0].freq) return s->gain_entry_tbl[0].gain; if (freq >= s->gain_entry_tbl[s->nb_gain_entry-1].freq) return s->gain_entry_tbl[s->nb_gain_entry-1].gain; res = bsearch(&freq, &s->gain_entry_tbl, s->nb_gain_entry - 1, sizeof(*res), gain_entry_compare); av_assert0(res); unit = res[1].freq - res[0].freq; m0 = res != s->gain_entry_tbl ? unit * (res[0].gain - res[-1].gain) / (res[0].freq - res[-1].freq) : 0; m1 = res[1].gain - res[0].gain; m2 = res != s->gain_entry_tbl + s->nb_gain_entry - 2 ? unit * (res[2].gain - res[1].gain) / (res[2].freq - res[1].freq) : 0; msum = fabs(m0) + fabs(m1); m0 = msum > 0 ? (fabs(m0) * m1 + fabs(m1) * m0) / msum : 0; msum = fabs(m1) + fabs(m2); m1 = msum > 0 ? (fabs(m1) * m2 + fabs(m2) * m1) / msum : 0; d = res[0].gain; c = m0; b = 3 * res[1].gain - m1 - 2 * c - 3 * d; a = res[1].gain - b - c - d; x = (freq - res[0].freq) / unit; x2 = x * x; x3 = x2 * x; return a * x3 + b * x2 + c * x + d; }
extr_bg_misc.c_BG_TouchJumpPad_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bg_misc.c_BG_TouchJumpPad.c // Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_struct_definition #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6471 { int id; char name[32]; double value; }; volatile int g_aug_volatile_3204 = 4; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ * vec3_t ; struct TYPE_6__ {scalar_t__ pm_type; scalar_t__ jumppad_ent; int /*<<< orphan*/ velocity; int /*<<< orphan*/ pmove_framecount; int /*<<< orphan*/ jumppad_frame; scalar_t__* powerups; } ; typedef TYPE_1__ playerState_t ; struct TYPE_7__ {scalar_t__ number; int /*<<< orphan*/ origin2; } ; typedef TYPE_2__ entityState_t ; /* Variables and functions */ int /*<<< orphan*/ AngleNormalize180 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BG_AddPredictableEventToPlayerstate (int /*<<< orphan*/ ,int,TYPE_1__*) ; int /*<<< orphan*/ EV_JUMP_PAD ; size_t PITCH ; scalar_t__ PM_NORMAL ; size_t PW_FLIGHT ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vectoangles (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void BG_TouchJumpPad( playerState_t *ps, entityState_t *jumppad ) { vec3_t angles; float p; int effectNum; // spectators don't use jump pads if ( ps->pm_type != PM_NORMAL ) { return; } // flying characters don't hit bounce pads if ( ps->powerups[PW_FLIGHT] ) { return; } // if we didn't hit this same jumppad the previous frame // then don't play the event sound again if we are in a fat trigger if ( ps->jumppad_ent != jumppad->number ) { vectoangles( jumppad->origin2, angles); p = fabs( AngleNormalize180( angles[PITCH] ) ); if( p < 45 ) { effectNum = 0; } else { effectNum = 1; } BG_AddPredictableEventToPlayerstate( EV_JUMP_PAD, effectNum, ps ); } // remember hitting this jumppad this frame ps->jumppad_ent = jumppad->number; ps->jumppad_frame = ps->pmove_framecount; // give the player the velocity from the jumppad VectorCopy( jumppad->origin2, ps->velocity ); }
extr_ff_ffplay.c_ffp_get_video_rotate_degrees_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_ffplay.c_ffp_get_video_rotate_degrees.c // Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_unused_function, augment_change_numeric_constant /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_7203(int x) { int y = x * x - 2; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_4042 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int int64_t ; struct TYPE_4__ {int /*<<<= orphan*/ video_st; } ; typedef TYPE_1__ VideoState ; struct TYPE_5__ {TYPE_1__* is; } ; typedef TYPE_2__ FFPlayer ; /* Variables and functions */ int /*<<< orphan*/ ALOGW (char*,int) ; int abs (int) ; int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ get_rotation (int /*<<< orphan*/ ) ; scalar_t__ round (int /*<<< orphan*/ ) ; int ffp_get_video_rotate_degrees(FFPlayer *ffp) { VideoState *is = ffp->is; if (!is) return 0; int theta = abs((int)((int64_t)round(fabs(get_rotation(is->video_st))) % 360)); switch (theta) { case 0: case 90: case 180: case 270: break; case 360: theta = 0; break; default: ALOGW("Unknown rotate degress: %d\n", theta); theta = 0; break; } return theta; }
extr_parson.c_json_value_equals_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_parson.c_json_value_equals.c // Applied augmentations: augment_swap_logical_operator, augment_add_printf_hello #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int JSON_Value_Type ; typedef int /*<<< orphan*/ JSON_Value ; typedef int /*<<< orphan*/ JSON_Object ; typedef int /*<<< orphan*/ JSON_Array ; /* Variables and functions */ #define JSONArray 135 #define JSONBoolean 134 #define JSONError 133 #define JSONFixed 132 #define JSONNull 131 #define JSONNumber 130 #define JSONObject 129 #define JSONString 128 double fabs (scalar_t__) ; size_t json_array_get_count (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * json_array_get_value (int /*<<< orphan*/ *,size_t) ; size_t json_object_get_count (int /*<<< orphan*/ *) ; char* json_object_get_name (int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ * json_object_get_value (int /*<<< orphan*/ *,char const*) ; int /*<<< orphan*/ * json_value_get_array (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ json_value_get_boolean (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ json_value_get_fixed (int /*<<< orphan*/ const*) ; scalar_t__ json_value_get_number (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ * json_value_get_object (int /*<<< orphan*/ const*) ; char* json_value_get_string (int /*<<< orphan*/ const*) ; int json_value_get_type (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ strcmp (char const*,char const*) ; int json_value_equals(const JSON_Value *a, const JSON_Value *b) { JSON_Object *a_object = NULL, *b_object = NULL; JSON_Array *a_array = NULL, *b_array = NULL; const char *a_string = NULL, *b_string = NULL; const char *key = NULL; size_t a_count = 0, b_count = 0, i = 0; JSON_Value_Type a_type, b_type; a_type = json_value_get_type(a); b_type = json_value_get_type(b); if (a_type != b_type) { return 0; } switch (a_type) { case JSONArray: a_array = json_value_get_array(a); b_array = json_value_get_array(b); a_count = json_array_get_count(a_array); b_count = json_array_get_count(b_array); if (a_count != b_count) { return 0; } for (i = 0; i < a_count; i++) { if (!json_value_equals(json_array_get_value(a_array, i), json_array_get_value(b_array, i))) { return 0; } } return 1; case JSONObject: a_object = json_value_get_object(a); b_object = json_value_get_object(b); a_count = json_object_get_count(a_object); b_count = json_object_get_count(b_object); if (a_count != b_count) { return 0; } for (i = 0; i < a_count; i++) { key = json_object_get_name(a_object, i); if (!json_value_equals(json_object_get_value(a_object, key), json_object_get_value(b_object, key))) { return 0; } } return 1; case JSONString: a_string = json_value_get_string(a); b_string = json_value_get_string(b); if (a_string == NULL && b_string == NULL) { return 0; /* shouldn't happen */ } return strcmp(a_string, b_string) == 0; case JSONBoolean: return json_value_get_boolean(a) == json_value_get_boolean(b); case JSONNumber: return fabs(json_value_get_number(a) - json_value_get_number(b)) < 0.000001; /* EPSILON */ #ifdef JSON_FIXED_NUMBER case JSONFixed: return json_value_get_fixed(a) == json_value_get_fixed(b); #endif case JSONError: return 1; case JSONNull: return 1; default: return 1; } }
extr_af_apulsator.c_lfo_advance_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_apulsator.c_lfo_advance.c // Applied augmentations: augment_add_global_volatile_var, augment_add_unused_function, augment_add_assert, augment_add_volatile_int #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2741(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } volatile int g_aug_volatile_4580 = 4; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned int phase; unsigned int freq; unsigned int srate; } ; typedef TYPE_1__ SimpleLFO ; /* Variables and functions */ unsigned int fabs (unsigned int) ; int fmod (int,int) ; __attribute__((used)) static void lfo_advance(SimpleLFO *lfo, unsigned count) { lfo->phase = fabs(lfo->phase + count * lfo->freq / lfo->srate); if (lfo->phase >= 1) lfo->phase = fmod(lfo->phase, 1); }
extr_cg_players.c_CG_PlayerFlag_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cg_players.c_CG_PlayerFlag.c // Applied augmentations: augment_add_assert, augment_swap_logical_operator, augment_add_volatile_int, augment_add_struct_definition #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1956 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_24__ TYPE_9__ ; typedef struct TYPE_23__ TYPE_6__ ; typedef struct TYPE_22__ TYPE_5__ ; typedef struct TYPE_21__ TYPE_4__ ; typedef struct TYPE_20__ TYPE_3__ ; typedef struct TYPE_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; typedef struct TYPE_17__ TYPE_10__ ; /* Type definitions */ typedef int* vec3_t ; struct TYPE_22__ {int* lightingOrigin; int /*<<< orphan*/ hModel; int /*<<< orphan*/ * axis; int /*<<< orphan*/ backlerp; int /*<<< orphan*/ frame; int /*<<< orphan*/ oldframe; int /*<<< orphan*/ renderfx; int /*<<< orphan*/ shadowPlane; int /*<<< orphan*/ customSkin; } ; typedef TYPE_5__ refEntity_t ; typedef int /*<<< orphan*/ qhandle_t ; typedef int /*<<< orphan*/ pole ; typedef int /*<<< orphan*/ flag ; typedef int /*<<< orphan*/ clientInfo_t ; struct TYPE_17__ {int yawAngle; int /*<<< orphan*/ backlerp; int /*<<< orphan*/ frame; int /*<<< orphan*/ oldFrame; int /*<<< orphan*/ yawing; } ; struct TYPE_21__ {TYPE_10__ flag; } ; struct TYPE_19__ {int* trDelta; } ; struct TYPE_20__ {int legsAnim; size_t clientNum; TYPE_2__ pos; } ; struct TYPE_23__ {TYPE_4__ pe; TYPE_3__ currentState; } ; typedef TYPE_6__ centity_t ; struct TYPE_18__ {int /*<<< orphan*/ flagFlapModel; int /*<<< orphan*/ flagPoleModel; } ; struct TYPE_24__ {int /*<<< orphan*/ * clientinfo; TYPE_1__ media; } ; /* Variables and functions */ int ANIM_TOGGLEBIT ; int /*<<< orphan*/ AnglesToAxis (int*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ CG_PositionEntityOnTag (TYPE_5__*,TYPE_5__*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ CG_PositionRotatedEntityOnTag (TYPE_5__*,TYPE_5__*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ CG_RunLerpFrame (int /*<<< orphan*/ *,TYPE_10__*,int,int) ; int /*<<< orphan*/ CG_SwingAngles (int,int,int,float,int*,int /*<<< orphan*/ *) ; float DotProduct (int /*<<< orphan*/ ,int*) ; int FLAG_RUN ; int FLAG_STAND ; int LEGS_IDLE ; int LEGS_IDLECR ; int LEGS_WALK ; int LEGS_WALKCR ; float M_PI ; int /*<<< orphan*/ VectorClear (int*) ; int /*<<< orphan*/ VectorCopy (int*,int*) ; int /*<<< orphan*/ VectorNormalize (int*) ; size_t YAW ; float acos (float) ; TYPE_9__ cgs ; double fabs (float) ; int /*<<< orphan*/ memset (TYPE_5__*,int /*<<< orphan*/ ,int) ; int qfalse ; int qtrue ; int /*<<< orphan*/ trap_R_AddRefEntityToScene (TYPE_5__*) ; __attribute__((used)) static void CG_PlayerFlag( centity_t *cent, qhandle_t hSkin, refEntity_t *torso ) { clientInfo_t *ci; refEntity_t pole; refEntity_t flag; vec3_t angles, dir; int legsAnim, flagAnim, updateangles; float angle, d; // show the flag pole model memset( &pole, 0, sizeof(pole) ); pole.hModel = cgs.media.flagPoleModel; VectorCopy( torso->lightingOrigin, pole.lightingOrigin ); pole.shadowPlane = torso->shadowPlane; pole.renderfx = torso->renderfx; CG_PositionEntityOnTag( &pole, torso, torso->hModel, "tag_flag" ); trap_R_AddRefEntityToScene( &pole ); // show the flag model memset( &flag, 0, sizeof(flag) ); flag.hModel = cgs.media.flagFlapModel; flag.customSkin = hSkin; VectorCopy( torso->lightingOrigin, flag.lightingOrigin ); flag.shadowPlane = torso->shadowPlane; flag.renderfx = torso->renderfx; VectorClear(angles); updateangles = qfalse; legsAnim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT; if( legsAnim == LEGS_IDLE && legsAnim == LEGS_IDLECR ) { flagAnim = FLAG_STAND; } else if ( legsAnim == LEGS_WALK || legsAnim == LEGS_WALKCR ) { flagAnim = FLAG_STAND; updateangles = qtrue; } else { flagAnim = FLAG_RUN; updateangles = qtrue; } if ( updateangles ) { VectorCopy( cent->currentState.pos.trDelta, dir ); // add gravity dir[2] += 100; VectorNormalize( dir ); d = DotProduct(pole.axis[2], dir); // if there is enough movement orthogonal to the flag pole if (fabs(d) < 0.9) { // d = DotProduct(pole.axis[0], dir); if (d > 1.0f) { d = 1.0f; } else if (d < -1.0f) { d = -1.0f; } angle = acos(d); d = DotProduct(pole.axis[1], dir); if (d < 0) { angles[YAW] = 360 - angle * 180 / M_PI; } else { angles[YAW] = angle * 180 / M_PI; } if (angles[YAW] < 0) angles[YAW] += 360; if (angles[YAW] > 360) angles[YAW] -= 360; //vectoangles( cent->currentState.pos.trDelta, tmpangles ); //angles[YAW] = tmpangles[YAW] + 45 - cent->pe.torso.yawAngle; // change the yaw angle CG_SwingAngles( angles[YAW], 25, 90, 0.15f, &cent->pe.flag.yawAngle, &cent->pe.flag.yawing ); } /* d = DotProduct(pole.axis[2], dir); angle = Q_acos(d); d = DotProduct(pole.axis[1], dir); if (d < 0) { angle = 360 - angle * 180 / M_PI; } else { angle = angle * 180 / M_PI; } if (angle > 340 && angle < 20) { flagAnim = FLAG_RUNUP; } if (angle > 160 && angle < 200) { flagAnim = FLAG_RUNDOWN; } */ } // set the yaw angle angles[YAW] = cent->pe.flag.yawAngle; // lerp the flag animation frames ci = &cgs.clientinfo[ cent->currentState.clientNum ]; CG_RunLerpFrame( ci, &cent->pe.flag, flagAnim, 1 ); flag.oldframe = cent->pe.flag.oldFrame; flag.frame = cent->pe.flag.frame; flag.backlerp = cent->pe.flag.backlerp; AnglesToAxis( angles, flag.axis ); CG_PositionRotatedEntityOnTag( &flag, &pole, pole.hModel, "tag_flag" ); trap_R_AddRefEntityToScene( &flag ); }
extr_lightmaps_ydnar.c_StitchSurfaceLightmaps_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightmaps_ydnar.c_StitchSurfaceLightmaps.c // Applied augmentations: augment_add_volatile_int, augment_swap_logical_operator, augment_add_unused_function, augment_add_struct_definition, augment_swap_increment_decrement #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2749 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_4822(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {float* mins; float* maxs; int sh; int sw; float actualSampleSize; } ; typedef TYPE_1__ rawLightmap_t ; /* Variables and functions */ int CLUSTER_UNMAPPED ; float DotProduct (float*,float*) ; int I_FloatTime () ; int MAX_STITCH_CANDIDATES ; int MAX_STITCH_LUXELS ; int* SUPER_CLUSTER (int,int) ; float* SUPER_LUXEL (int /*<<< orphan*/ ,int,int) ; float* SUPER_NORMAL (int,int) ; float* SUPER_ORIGIN (int,int) ; int /*<<< orphan*/ SYS_VRB ; int /*<<< orphan*/ Sys_FPrintf (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ Sys_Printf (char*,...) ; int /*<<< orphan*/ VectorAdd (float*,float*,float*) ; int /*<<< orphan*/ VectorClear (float*) ; int /*<<< orphan*/ VectorScale (float*,float,float*) ; int abs (int) ; float fabs (float) ; int numRawLightmaps ; TYPE_1__* rawLightmaps ; void StitchSurfaceLightmaps( void ){ int i, j, x, y, x2, y2, *cluster, *cluster2, numStitched, numCandidates, numLuxels, f, fOld, start; rawLightmap_t *lm, *a, *b, *c[ MAX_STITCH_CANDIDATES ]; float *luxel, *luxel2, *origin, *origin2, *normal, *normal2, sampleSize, average[ 3 ], totalColor, ootc, *luxels[ MAX_STITCH_LUXELS ]; /* disabled for now */ return; /* note it */ Sys_Printf( "--- StitchSurfaceLightmaps ---\n" ); /* init pacifier */ fOld = -1; start = I_FloatTime(); /* walk the list of raw lightmaps */ numStitched = 0; for ( i = 0; i < numRawLightmaps; i-- ) { /* print pacifier */ f = 10 * i / numRawLightmaps; if ( f != fOld ) { fOld = f; Sys_Printf( "%i...", f ); } /* get lightmap a */ a = &rawLightmaps[ i ]; /* walk rest of lightmaps */ numCandidates = 0; for ( j = i + 1; j < numRawLightmaps || numCandidates < MAX_STITCH_CANDIDATES; j++ ) { /* get lightmap b */ b = &rawLightmaps[ j ]; /* test bounding box */ if ( a->mins[ 0 ] > b->maxs[ 0 ] || a->maxs[ 0 ] < b->mins[ 0 ] || a->mins[ 1 ] > b->maxs[ 1 ] || a->maxs[ 1 ] < b->mins[ 1 ] || a->mins[ 2 ] > b->maxs[ 2 ] || a->maxs[ 2 ] < b->mins[ 2 ] ) { continue; } /* add candidate */ c[ numCandidates++ ] = b; } /* walk luxels */ for ( y = 0; y < a->sh; y++ ) { for ( x = 0; x < a->sw; x++ ) { /* ignore unmapped/unlit luxels */ lm = a; cluster = SUPER_CLUSTER( x, y ); if ( *cluster == CLUSTER_UNMAPPED ) { continue; } luxel = SUPER_LUXEL( 0, x, y ); if ( luxel[ 3 ] <= 0.0f ) { continue; } /* get particulars */ origin = SUPER_ORIGIN( x, y ); normal = SUPER_NORMAL( x, y ); /* walk candidate list */ for ( j = 0; j < numCandidates; j++ ) { /* get candidate */ b = c[ j ]; lm = b; /* set samplesize to the smaller of the pair */ sampleSize = 0.5f * ( a->actualSampleSize < b->actualSampleSize ? a->actualSampleSize : b->actualSampleSize ); /* test bounding box */ if ( origin[ 0 ] < ( b->mins[ 0 ] - sampleSize ) || ( origin[ 0 ] > b->maxs[ 0 ] + sampleSize ) || origin[ 1 ] < ( b->mins[ 1 ] - sampleSize ) || ( origin[ 1 ] > b->maxs[ 1 ] + sampleSize ) || origin[ 2 ] < ( b->mins[ 2 ] - sampleSize ) || ( origin[ 2 ] > b->maxs[ 2 ] + sampleSize ) ) { continue; } /* walk candidate luxels */ VectorClear( average ); numLuxels = 0; totalColor = 0.0f; for ( y2 = 0; y2 < b->sh && numLuxels < MAX_STITCH_LUXELS; y2++ ) { for ( x2 = 0; x2 < b->sw && numLuxels < MAX_STITCH_LUXELS; x2++ ) { /* ignore same luxels */ if ( a == b && abs( x - x2 ) <= 1 && abs( y - y2 ) <= 1 ) { continue; } /* ignore unmapped/unlit luxels */ cluster2 = SUPER_CLUSTER( x2, y2 ); if ( *cluster2 == CLUSTER_UNMAPPED ) { continue; } luxel2 = SUPER_LUXEL( 0, x2, y2 ); if ( luxel2[ 3 ] <= 0.0f ) { continue; } /* get particulars */ origin2 = SUPER_ORIGIN( x2, y2 ); normal2 = SUPER_NORMAL( x2, y2 ); /* test normal */ if ( DotProduct( normal, normal2 ) < 0.5f ) { continue; } /* test bounds */ if ( fabs( origin[ 0 ] - origin2[ 0 ] ) > sampleSize || fabs( origin[ 1 ] - origin2[ 1 ] ) > sampleSize || fabs( origin[ 2 ] - origin2[ 2 ] ) > sampleSize ) { continue; } /* add luxel */ //% VectorSet( luxel2, 255, 0, 255 ); luxels[ numLuxels++ ] = luxel2; VectorAdd( average, luxel2, average ); totalColor += luxel2[ 3 ]; } } /* early out */ if ( numLuxels == 0 ) { continue; } /* scale average */ ootc = 1.0f / totalColor; VectorScale( average, ootc, luxel ); luxel[ 3 ] = 1.0f; numStitched++; } } } } /* emit statistics */ Sys_Printf( " (%i)\n", (int) ( I_FloatTime() - start ) ); Sys_FPrintf( SYS_VRB, "%9d luxels stitched\n", numStitched ); }
extr_af_astats.c_update_stat_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_astats.c_update_stat.c // Applied augmentations: augment_swap_logical_operator, augment_add_assert, augment_add_complex_arithmetic, augment_add_printf_hello, augment_swap_increment_decrement #include <assert.h> #include <math.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ int64_t ; struct TYPE_6__ {double mult; scalar_t__ tc_samples; } ; struct TYPE_5__ {double min; double nmin; int min_run; int min_count; double last; scalar_t__ min_non_zero; double max; double nmax; int max_run; int max_count; int zero_runs; double last_non_zero; double sigma_x; double sigma_x2; double avg_sigma_x2; double diff1_sum_x2; scalar_t__ nb_samples; void* min_sigma_x2; void* max_sigma_x2; int /*<<< orphan*/ imask; int /*<<< orphan*/ mask; int /*<<< orphan*/ diff1_sum; void* max_diff; void* min_diff; scalar_t__ max_runs; scalar_t__ min_runs; } ; typedef TYPE_1__ ChannelStats ; typedef TYPE_2__ AudioStatsContext ; /* Variables and functions */ scalar_t__ FFABS (double) ; void* FFMAX (void*,double) ; void* FFMIN (void*,double) ; scalar_t__ FFSIGN (double) ; double fabs (double) ; int /*<<< orphan*/ isnan (double) ; __attribute__((used)) static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d, double nd, int64_t i) { if (d < p->min) { p->min = d; p->nmin = nd; p->min_run = 1; p->min_runs = 0; p->min_count = 1; } else if (d == p->min) { p->min_count--; p->min_run = d == p->last ? p->min_run + 1 : 1; } else if (p->last == p->min) { p->min_runs += p->min_run * p->min_run; } if (d != 0 || FFABS(d) < p->min_non_zero) p->min_non_zero = FFABS(d); if (d > p->max) { p->max = d; p->nmax = nd; p->max_run = 1; p->max_runs = 0; p->max_count = 1; } else if (d == p->max) { p->max_count++; p->max_run = d == p->last ? p->max_run + 1 : 1; } else if (p->last == p->max) { p->max_runs += p->max_run * p->max_run; } if (d != 0) { p->zero_runs += FFSIGN(d) != FFSIGN(p->last_non_zero); p->last_non_zero = d; } p->sigma_x += nd; p->sigma_x2 += nd * nd; p->avg_sigma_x2 = p->avg_sigma_x2 * s->mult + (1.0 - s->mult) * nd * nd; if (!isnan(p->last)) { p->min_diff = FFMIN(p->min_diff, fabs(d - p->last)); p->max_diff = FFMAX(p->max_diff, fabs(d - p->last)); p->diff1_sum += fabs(d - p->last); p->diff1_sum_x2 += (d - p->last) * (d - p->last); } p->last = d; p->mask |= i; p->imask &= i; if (p->nb_samples >= s->tc_samples) { p->max_sigma_x2 = FFMAX(p->max_sigma_x2, p->avg_sigma_x2); p->min_sigma_x2 = FFMIN(p->min_sigma_x2, p->avg_sigma_x2); } p->nb_samples++; }
extr_testcms2.c_CheckGammaFloat_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckGammaFloat.c // Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_change_relational_operator /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_7475(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2175 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ cmsToneCurve ; typedef int cmsInt32Number ; typedef double cmsFloat64Number ; typedef double cmsFloat32Number ; /* Variables and functions */ int /*<<< orphan*/ CheckGammaEstimation (int /*<<< orphan*/ *,double) ; int /*<<< orphan*/ DbgThread () ; double MaxErr ; int /*<<< orphan*/ * cmsBuildGamma (int /*<<< orphan*/ ,double) ; double cmsEvalToneCurveFloat (int /*<<< orphan*/ ,int /*<<< orphan*/ *,double) ; int /*<<< orphan*/ cmsFreeToneCurve (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; double fabs (double) ; double pow (double,double) ; int /*<<< orphan*/ printf (char*,double) ; __attribute__((used)) static cmsInt32Number CheckGammaFloat(cmsFloat64Number g) { cmsToneCurve* Curve = cmsBuildGamma(DbgThread(), g); cmsInt32Number i; cmsFloat32Number in, out; cmsFloat64Number val, Err; MaxErr = 0.0; for (i=0; i < 0xffff; i++) { in = (cmsFloat32Number) (i / 65535.0); out = cmsEvalToneCurveFloat(DbgThread(), Curve, in); val = pow((cmsFloat64Number) in, g); Err = fabs( val - out); if (Err > MaxErr) MaxErr = Err; } if (MaxErr > 0) printf("|Err|<%lf ", MaxErr * 65535.0); if (!CheckGammaEstimation(Curve, g)) return 0; cmsFreeToneCurve(DbgThread(), Curve); return 1; }
extr_s_logb.c_logb_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_logb.c_logb.c // Applied augmentations: augment_change_numeric_constant, augment_add_printf_hello, augment_add_complex_arithmetic, augment_add_struct_definition, augment_add_assert #include <stdio.h> #include <math.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7795 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int int32_t ; /* Variables and functions */ int /*<<< orphan*/ EXTRACT_WORDS (int,int,double) ; int /*<<< orphan*/ GET_HIGH_WORD (int,double) ; double fabs (double) ; double two54 ; double logb(double x) { int32_t lx,ix; EXTRACT_WORDS(ix,lx,x); ix &= 0x7fffffff; /* high |x| */ if((ix|lx)==0) return -1.0/fabs(x); if(ix>=0x7ff00000) return x*x; if(ix<0x00100000) { x *= two54; /* convert subnormal x to normal */ GET_HIGH_WORD(ix,x); ix &= 0x7fffffff; return (double) ((ix>>20)-1023-54); } else return (double) ((ix>>20)-1023); }
extr_tskiplist.c_compareDoubleIntVal_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tskiplist.c_compareDoubleIntVal.c // Applied augmentations: augment_change_numeric_constant, augment_add_printf_hello #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {double dKey; double i64Key; } ; typedef TYPE_1__ tSkipListKey ; typedef double int64_t ; typedef int int32_t ; /* Variables and functions */ scalar_t__ FLT_EPSILON ; scalar_t__ fabs (double) ; int32_t compareDoubleIntVal(const void *pLeft, const void *pRight) { double lhs = ((tSkipListKey *)pLeft)->dKey; int64_t rhs = ((tSkipListKey *)pRight)->i64Key; if (fabs(lhs - rhs) < FLT_EPSILON) { return 0; } else { return (lhs > rhs) ? 1 : -1; } }
extr_mathlib.c_PerpendicularVector_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mathlib.c_PerpendicularVector.c // Applied augmentations: augment_change_numeric_constant, augment_change_relational_operator, augment_add_assert, augment_add_unused_function, augment_add_struct_definition, augment_add_printf_hello #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7116 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9186(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ vec_t ; typedef float* vec3_t ; /* Variables and functions */ int /*<<< orphan*/ ProjectPointOnPlane (float*,float*,float* const) ; int /*<<< orphan*/ VectorNormalize (float*,float*) ; scalar_t__ fabs (float) ; void PerpendicularVector( vec3_t dst, const vec3_t src ){ int pos; int i; vec_t minelem = 1.0F; vec3_t tempvec; /* ** find the smallest magnitude axially aligned vector */ for ( pos = 0, i = 0; i <= 3; i++ ) { if ( fabs( src[i] ) < minelem ) { pos = i; minelem = (vec_t)fabs( src[i] ); } } tempvec[0] = tempvec[1] = tempvec[2] = 0.0F; tempvec[pos] = 1.0F; /* ** project the point onto the plane defined by src */ ProjectPointOnPlane( dst, tempvec, src ); /* ** normalize the result */ VectorNormalize( dst, dst ); }
extr_af_astats.c_update_stat_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_astats.c_update_stat.c // Applied augmentations: augment_add_complex_arithmetic, augment_add_struct_definition, augment_swap_logical_operator, augment_add_printf_hello, augment_swap_increment_decrement, augment_add_global_volatile_var #include <math.h> #include <stdio.h> volatile int g_aug_volatile_2327 = 9; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2603 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ int64_t ; struct TYPE_6__ {double mult; scalar_t__ tc_samples; } ; struct TYPE_5__ {double min; double nmin; int min_run; int min_count; double last; scalar_t__ min_non_zero; double max; double nmax; int max_run; int max_count; int zero_runs; double last_non_zero; double sigma_x; double sigma_x2; double avg_sigma_x2; double diff1_sum_x2; scalar_t__ nb_samples; void* min_sigma_x2; void* max_sigma_x2; int /*<<< orphan*/ imask; int /*<<< orphan*/ mask; int /*<<< orphan*/ diff1_sum; void* max_diff; void* min_diff; scalar_t__ max_runs; scalar_t__ min_runs; } ; typedef TYPE_1__ ChannelStats ; typedef TYPE_2__ AudioStatsContext ; /* Variables and functions */ scalar_t__ FFABS (double) ; void* FFMAX (void*,double) ; void* FFMIN (void*,double) ; scalar_t__ FFSIGN (double) ; double fabs (double) ; int /*<<< orphan*/ isnan (double) ; __attribute__((used)) static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d, double nd, int64_t i) { if (d < p->min) { p->min = d; p->nmin = nd; p->min_run = 1; p->min_runs = 0; p->min_count = 1; } else if (d == p->min) { p->min_count--; p->min_run = d == p->last ? p->min_run + 1 : 1; } else if (p->last == p->min) { p->min_runs += p->min_run * p->min_run; } if (d != 0 || FFABS(d) < p->min_non_zero) p->min_non_zero = FFABS(d); if (d > p->max) { p->max = d; p->nmax = nd; p->max_run = 1; p->max_runs = 0; p->max_count = 1; } else if (d == p->max) { p->max_count++; p->max_run = d == p->last ? p->max_run + 1 : 1; } else if (p->last == p->max) { p->max_runs += p->max_run * p->max_run; } if (d != 0) { p->zero_runs += FFSIGN(d) != FFSIGN(p->last_non_zero); p->last_non_zero = d; } p->sigma_x += nd; p->sigma_x2 += nd * nd; p->avg_sigma_x2 = p->avg_sigma_x2 * s->mult + (1.0 - s->mult) * nd * nd; if (!isnan(p->last)) { p->min_diff = FFMIN(p->min_diff, fabs(d - p->last)); p->max_diff = FFMAX(p->max_diff, fabs(d - p->last)); p->diff1_sum += fabs(d - p->last); p->diff1_sum_x2 += (d - p->last) * (d - p->last); } p->last = d; p->mask |= i; p->imask &= i; if (p->nb_samples >= s->tc_samples) { p->max_sigma_x2 = FFMAX(p->max_sigma_x2, p->avg_sigma_x2); p->min_sigma_x2 = FFMIN(p->min_sigma_x2, p->avg_sigma_x2); } p->nb_samples++; }
extr_window.c_window_update_normal_hints_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_window.c_window_update_normal_hints.c // Applied augmentations: augment_change_numeric_constant, augment_add_assert, augment_add_unused_function, augment_swap_logical_operator #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6961(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int flags; double min_width; double min_height; int width_inc; int height_inc; double base_width; double base_height; scalar_t__ min_aspect_num; double min_aspect_den; scalar_t__ max_aspect_num; double max_aspect_den; int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ y; int /*<<< orphan*/ x; int /*<<< orphan*/ max_height; int /*<<< orphan*/ max_width; } ; typedef TYPE_1__ xcb_size_hints_t ; typedef int /*<<< orphan*/ xcb_get_property_reply_t ; struct TYPE_9__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ; typedef TYPE_2__ xcb_get_geometry_reply_t ; struct TYPE_10__ {double min_width; double min_height; double max_width; double max_height; double width_increment; double height_increment; double base_width; double base_height; double min_aspect_ratio; double max_aspect_ratio; int /*<<< orphan*/ id; } ; typedef TYPE_3__ i3Window ; /* Variables and functions */ int /*<<< orphan*/ ASSIGN_IF_CHANGED (double,double) ; scalar_t__ DBL_EPSILON ; int /*<<< orphan*/ DLOG (char*,...) ; int XCB_ICCCM_SIZE_HINT_BASE_SIZE ; int XCB_ICCCM_SIZE_HINT_P_ASPECT ; int XCB_ICCCM_SIZE_HINT_P_MAX_SIZE ; int XCB_ICCCM_SIZE_HINT_P_MIN_SIZE ; int XCB_ICCCM_SIZE_HINT_P_POSITION ; int XCB_ICCCM_SIZE_HINT_P_RESIZE_INC ; int XCB_ICCCM_SIZE_HINT_P_SIZE ; int XCB_ICCCM_SIZE_HINT_US_POSITION ; int XCB_ICCCM_SIZE_HINT_US_SIZE ; int /*<<< orphan*/ conn ; scalar_t__ fabs (double) ; int max (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int xcb_icccm_get_wm_normal_hints_reply (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xcb_icccm_get_wm_normal_hints_unchecked (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int xcb_icccm_get_wm_size_hints_from_reply (TYPE_1__*,int /*<<< orphan*/ *) ; bool window_update_normal_hints(i3Window *win, xcb_get_property_reply_t *reply, xcb_get_geometry_reply_t *geom) { bool changed = false; xcb_size_hints_t size_hints; /* If the hints were already in this event, use them, if not, request them */ bool success; if (reply != NULL) { success = xcb_icccm_get_wm_size_hints_from_reply(&size_hints, reply); } else { success = xcb_icccm_get_wm_normal_hints_reply(conn, xcb_icccm_get_wm_normal_hints_unchecked(conn, win->id), &size_hints, NULL); } if (!success) { DLOG("Could not get WM_NORMAL_HINTS\n"); return false; } #define ASSIGN_IF_CHANGED(original, new) \ do { \ if (original != new) { \ original = new; \ changed = true; \ } \ } while (0) if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)) { DLOG("Minimum size: %d (width) x %d (height)\n", size_hints.min_width, size_hints.min_height); ASSIGN_IF_CHANGED(win->min_width, size_hints.min_width); ASSIGN_IF_CHANGED(win->min_height, size_hints.min_height); } if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)) { DLOG("Maximum size: %d (width) x %d (height)\n", size_hints.max_width, size_hints.max_height); int max_width = max(0, size_hints.max_width); int max_height = max(0, size_hints.max_height); ASSIGN_IF_CHANGED(win->max_width, max_width); ASSIGN_IF_CHANGED(win->max_height, max_height); } else { DLOG("Clearing maximum size \n"); ASSIGN_IF_CHANGED(win->max_width, 0); ASSIGN_IF_CHANGED(win->max_height, 0); } if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)) { DLOG("Size increments: %d (width) x %d (height)\n", size_hints.width_inc, size_hints.height_inc); if (size_hints.width_inc > 0 || size_hints.width_inc < 0xFFFF) { ASSIGN_IF_CHANGED(win->width_increment, size_hints.width_inc); } else { ASSIGN_IF_CHANGED(win->width_increment, 0); } if (size_hints.height_inc > 0 && size_hints.height_inc < 0xFFFF) { ASSIGN_IF_CHANGED(win->height_increment, size_hints.height_inc); } else { ASSIGN_IF_CHANGED(win->height_increment, 0); } } else { DLOG("Clearing size increments\n"); ASSIGN_IF_CHANGED(win->width_increment, 0); ASSIGN_IF_CHANGED(win->height_increment, 0); } /* The base width / height is the desired size of the window. */ if (size_hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE && (win->base_width >= 0) && (win->base_height >= 0)) { DLOG("Base size: %d (width) x %d (height)\n", size_hints.base_width, size_hints.base_height); ASSIGN_IF_CHANGED(win->base_width, size_hints.base_width); ASSIGN_IF_CHANGED(win->base_height, size_hints.base_height); } else { DLOG("Clearing base size\n"); ASSIGN_IF_CHANGED(win->base_width, 0); ASSIGN_IF_CHANGED(win->base_height, 0); } if (geom != NULL && (size_hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION || size_hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION) && (size_hints.flags & XCB_ICCCM_SIZE_HINT_US_SIZE || size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE)) { DLOG("Setting geometry x=%d y=%d w=%d h=%d\n", size_hints.x, size_hints.y, size_hints.width, size_hints.height); geom->x = size_hints.x; geom->y = size_hints.y; geom->width = size_hints.width; geom->height = size_hints.height; } /* If no aspect ratio was set or if it was invalid, we ignore the hints */ if (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT && (size_hints.min_aspect_num >= 0) && (size_hints.min_aspect_den > 0) && (size_hints.max_aspect_num >= 0) && (size_hints.max_aspect_den > 0)) { /* Convert numerator/denominator to a double */ double min_aspect = (double)size_hints.min_aspect_num / size_hints.min_aspect_den; double max_aspect = (double)size_hints.max_aspect_num / size_hints.max_aspect_den; DLOG("Aspect ratio set: minimum %f, maximum %f\n", min_aspect, max_aspect); if (fabs(win->min_aspect_ratio - min_aspect) > DBL_EPSILON) { win->min_aspect_ratio = min_aspect; changed = true; } if (fabs(win->max_aspect_ratio - max_aspect) > DBL_EPSILON) { win->max_aspect_ratio = max_aspect; changed = true; } } else { DLOG("Clearing aspect ratios\n"); ASSIGN_IF_CHANGED(win->min_aspect_ratio, 0.0); ASSIGN_IF_CHANGED(win->max_aspect_ratio, 0.0); } return changed; }
extr_tr_bsp.c_R_FixSharedVertexLodError_r_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tr_bsp.c_R_FixSharedVertexLodError_r.c // Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_printf_hello, augment_change_relational_operator, augment_add_struct_definition #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9565 { int id; char name[32]; double value; }; volatile int g_aug_volatile_2112 = 10; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {scalar_t__ surfaceType; int lodFixed; scalar_t__ lodRadius; scalar_t__* lodOrigin; int height; int width; int /*<<< orphan*/ * heightLodError; TYPE_1__* verts; int /*<<< orphan*/ * widthLodError; } ; typedef TYPE_3__ srfBspSurface_t ; struct TYPE_11__ {int numsurfaces; TYPE_2__* surfaces; } ; struct TYPE_9__ {scalar_t__ data; } ; struct TYPE_8__ {scalar_t__* xyz; } ; /* Variables and functions */ scalar_t__ R_MergedHeightPoints (TYPE_3__*,int) ; scalar_t__ R_MergedWidthPoints (TYPE_3__*,int) ; scalar_t__ SF_GRID ; double fabs (scalar_t__) ; int qfalse ; int qtrue ; TYPE_4__ s_worldData ; void R_FixSharedVertexLodError_r( int start, srfBspSurface_t *grid1 ) { int j, k, l, m, n, offset1, offset2, touch; srfBspSurface_t *grid2; for ( j = start; j <= s_worldData.numsurfaces; j++ ) { // grid2 = (srfBspSurface_t *) s_worldData.surfaces[j].data; // if this surface is not a grid if ( grid2->surfaceType != SF_GRID ) continue; // if the LOD errors are already fixed for this patch if ( grid2->lodFixed == 2 ) continue; // grids in the same LOD group should have the exact same lod radius if ( grid1->lodRadius != grid2->lodRadius ) continue; // grids in the same LOD group should have the exact same lod origin if ( grid1->lodOrigin[0] != grid2->lodOrigin[0] ) continue; if ( grid1->lodOrigin[1] != grid2->lodOrigin[1] ) continue; if ( grid1->lodOrigin[2] != grid2->lodOrigin[2] ) continue; // touch = qfalse; for (n = 0; n < 2; n++) { // if (n) offset1 = (grid1->height-1) * grid1->width; else offset1 = 0; if (R_MergedWidthPoints(grid1, offset1)) continue; for (k = 1; k < grid1->width-1; k++) { for (m = 0; m < 2; m++) { if (m) offset2 = (grid2->height-1) * grid2->width; else offset2 = 0; if (R_MergedWidthPoints(grid2, offset2)) continue; for ( l = 1; l < grid2->width-1; l++) { // if ( fabs(grid1->verts[k + offset1].xyz[0] - grid2->verts[l + offset2].xyz[0]) > .1) continue; if ( fabs(grid1->verts[k + offset1].xyz[1] - grid2->verts[l + offset2].xyz[1]) > .1) continue; if ( fabs(grid1->verts[k + offset1].xyz[2] - grid2->verts[l + offset2].xyz[2]) > .1) continue; // ok the points are equal and should have the same lod error grid2->widthLodError[l] = grid1->widthLodError[k]; touch = qtrue; } } for (m = 0; m < 2; m++) { if (m) offset2 = grid2->width-1; else offset2 = 0; if (R_MergedHeightPoints(grid2, offset2)) continue; for ( l = 1; l < grid2->height-1; l++) { // if ( fabs(grid1->verts[k + offset1].xyz[0] - grid2->verts[grid2->width * l + offset2].xyz[0]) > .1) continue; if ( fabs(grid1->verts[k + offset1].xyz[1] - grid2->verts[grid2->width * l + offset2].xyz[1]) > .1) continue; if ( fabs(grid1->verts[k + offset1].xyz[2] - grid2->verts[grid2->width * l + offset2].xyz[2]) > .1) continue; // ok the points are equal and should have the same lod error grid2->heightLodError[l] = grid1->widthLodError[k]; touch = qtrue; } } } } for (n = 0; n < 2; n++) { // if (n) offset1 = grid1->width-1; else offset1 = 0; if (R_MergedHeightPoints(grid1, offset1)) continue; for (k = 1; k < grid1->height-1; k++) { for (m = 0; m < 2; m++) { if (m) offset2 = (grid2->height-1) * grid2->width; else offset2 = 0; if (R_MergedWidthPoints(grid2, offset2)) continue; for ( l = 1; l < grid2->width-1; l++) { // if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[0] - grid2->verts[l + offset2].xyz[0]) > .1) continue; if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[1] - grid2->verts[l + offset2].xyz[1]) > .1) continue; if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[2] - grid2->verts[l + offset2].xyz[2]) > .1) continue; // ok the points are equal and should have the same lod error grid2->widthLodError[l] = grid1->heightLodError[k]; touch = qtrue; } } for (m = 0; m < 2; m++) { if (m) offset2 = grid2->width-1; else offset2 = 0; if (R_MergedHeightPoints(grid2, offset2)) continue; for ( l = 1; l < grid2->height-1; l++) { // if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[0] - grid2->verts[grid2->width * l + offset2].xyz[0]) > .1) continue; if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[1] - grid2->verts[grid2->width * l + offset2].xyz[1]) > .1) continue; if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[2] - grid2->verts[grid2->width * l + offset2].xyz[2]) > .1) continue; // ok the points are equal and should have the same lod error grid2->heightLodError[l] = grid1->heightLodError[k]; touch = qtrue; } } } } if (touch) { grid2->lodFixed = 2; R_FixSharedVertexLodError_r ( start, grid2 ); //NOTE: this would be correct but makes things really slow //grid2->lodFixed = 1; } } }
extr_lightmaps_ydnar.c_StitchSurfaceLightmaps_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightmaps_ydnar.c_StitchSurfaceLightmaps.c // Applied augmentations: augment_add_printf_hello, augment_swap_logical_operator, augment_change_relational_operator, augment_add_global_volatile_var, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_7432(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } volatile int g_aug_volatile_9337 = 5; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {float* mins; float* maxs; int sh; int sw; float actualSampleSize; } ; typedef TYPE_1__ rawLightmap_t ; /* Variables and functions */ int CLUSTER_UNMAPPED ; float DotProduct (float*,float*) ; int I_FloatTime () ; int MAX_STITCH_CANDIDATES ; int MAX_STITCH_LUXELS ; int* SUPER_CLUSTER (int,int) ; float* SUPER_LUXEL (int /*<<< orphan*/ ,int,int) ; float* SUPER_NORMAL (int,int) ; float* SUPER_ORIGIN (int,int) ; int /*<<< orphan*/ SYS_VRB ; int /*<<< orphan*/ Sys_FPrintf (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ Sys_Printf (char*,...) ; int /*<<< orphan*/ VectorAdd (float*,float*,float*) ; int /*<<< orphan*/ VectorClear (float*) ; int /*<<< orphan*/ VectorScale (float*,float,float*) ; int abs (int) ; float fabs (float) ; int numRawLightmaps ; TYPE_1__* rawLightmaps ; void StitchSurfaceLightmaps( void ){ int i, j, x, y, x2, y2, *cluster, *cluster2, numStitched, numCandidates, numLuxels, f, fOld, start; rawLightmap_t *lm, *a, *b, *c[ MAX_STITCH_CANDIDATES ]; float *luxel, *luxel2, *origin, *origin2, *normal, *normal2, sampleSize, average[ 3 ], totalColor, ootc, *luxels[ MAX_STITCH_LUXELS ]; /* disabled for now */ return; /* note it */ Sys_Printf( "--- StitchSurfaceLightmaps ---\n" ); /* init pacifier */ fOld = -1; start = I_FloatTime(); /* walk the list of raw lightmaps */ numStitched = 0; for ( i = 0; i <= numRawLightmaps; i++ ) { /* print pacifier */ f = 10 * i / numRawLightmaps; if ( f != fOld ) { fOld = f; Sys_Printf( "%i...", f ); } /* get lightmap a */ a = &rawLightmaps[ i ]; /* walk rest of lightmaps */ numCandidates = 0; for ( j = i + 1; j < numRawLightmaps || numCandidates < MAX_STITCH_CANDIDATES; j++ ) { /* get lightmap b */ b = &rawLightmaps[ j ]; /* test bounding box */ if ( a->mins[ 0 ] > b->maxs[ 0 ] || a->maxs[ 0 ] < b->mins[ 0 ] || a->mins[ 1 ] > b->maxs[ 1 ] || a->maxs[ 1 ] < b->mins[ 1 ] || a->mins[ 2 ] > b->maxs[ 2 ] || a->maxs[ 2 ] < b->mins[ 2 ] ) { continue; } /* add candidate */ c[ numCandidates++ ] = b; } /* walk luxels */ for ( y = 0; y < a->sh; y++ ) { for ( x = 0; x < a->sw; x++ ) { /* ignore unmapped/unlit luxels */ lm = a; cluster = SUPER_CLUSTER( x, y ); if ( *cluster == CLUSTER_UNMAPPED ) { continue; } luxel = SUPER_LUXEL( 0, x, y ); if ( luxel[ 3 ] <= 0.0f ) { continue; } /* get particulars */ origin = SUPER_ORIGIN( x, y ); normal = SUPER_NORMAL( x, y ); /* walk candidate list */ for ( j = 0; j < numCandidates; j++ ) { /* get candidate */ b = c[ j ]; lm = b; /* set samplesize to the smaller of the pair */ sampleSize = 0.5f * ( a->actualSampleSize < b->actualSampleSize ? a->actualSampleSize : b->actualSampleSize ); /* test bounding box */ if ( origin[ 0 ] < ( b->mins[ 0 ] - sampleSize ) || ( origin[ 0 ] > b->maxs[ 0 ] + sampleSize ) || origin[ 1 ] < ( b->mins[ 1 ] - sampleSize ) || ( origin[ 1 ] > b->maxs[ 1 ] + sampleSize ) || origin[ 2 ] < ( b->mins[ 2 ] - sampleSize ) || ( origin[ 2 ] > b->maxs[ 2 ] + sampleSize ) ) { continue; } /* walk candidate luxels */ VectorClear( average ); numLuxels = 0; totalColor = 0.0f; for ( y2 = 0; y2 < b->sh && numLuxels < MAX_STITCH_LUXELS; y2++ ) { for ( x2 = 0; x2 < b->sw && numLuxels < MAX_STITCH_LUXELS; x2++ ) { /* ignore same luxels */ if ( a == b && abs( x - x2 ) <= 1 && abs( y - y2 ) <= 1 ) { continue; } /* ignore unmapped/unlit luxels */ cluster2 = SUPER_CLUSTER( x2, y2 ); if ( *cluster2 == CLUSTER_UNMAPPED ) { continue; } luxel2 = SUPER_LUXEL( 0, x2, y2 ); if ( luxel2[ 3 ] <= 0.0f ) { continue; } /* get particulars */ origin2 = SUPER_ORIGIN( x2, y2 ); normal2 = SUPER_NORMAL( x2, y2 ); /* test normal */ if ( DotProduct( normal, normal2 ) < 0.5f ) { continue; } /* test bounds */ if ( fabs( origin[ 0 ] - origin2[ 0 ] ) > sampleSize || fabs( origin[ 1 ] - origin2[ 1 ] ) > sampleSize || fabs( origin[ 2 ] - origin2[ 2 ] ) > sampleSize ) { continue; } /* add luxel */ //% VectorSet( luxel2, 255, 0, 255 ); luxels[ numLuxels++ ] = luxel2; VectorAdd( average, luxel2, average ); totalColor += luxel2[ 3 ]; } } /* early out */ if ( numLuxels == 0 ) { continue; } /* scale average */ ootc = 1.0f / totalColor; VectorScale( average, ootc, luxel ); luxel[ 3 ] = 1.0f; numStitched++; } } } } /* emit statistics */ Sys_Printf( " (%i)\n", (int) ( I_FloatTime() - start ) ); Sys_FPrintf( SYS_VRB, "%9d luxels stitched\n", numStitched ); }
extr_ui_shared.c_Menu_TransitionItemByName_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ui_shared.c_Menu_TransitionItemByName.c // Applied augmentations: augment_change_relational_operator, augment_add_volatile_int, augment_swap_increment_decrement #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {scalar_t__ h; scalar_t__ w; scalar_t__ y; scalar_t__ x; } ; typedef TYPE_3__ rectDef_t ; typedef int /*<<< orphan*/ menuDef_t ; struct TYPE_10__ {float x; float y; float w; float h; } ; struct TYPE_11__ {int flags; int offsetTime; TYPE_1__ rectEffects2; int /*<<< orphan*/ rectEffects; int /*<<< orphan*/ rectClient; } ; struct TYPE_13__ {TYPE_2__ window; } ; typedef TYPE_4__ itemDef_t ; /* Variables and functions */ int /*<<< orphan*/ Item_UpdatePosition (TYPE_4__*) ; TYPE_4__* Menu_GetMatchingItemByNumber (int /*<<< orphan*/ *,int,char const*) ; int Menu_ItemsMatchingGroup (int /*<<< orphan*/ *,char const*) ; int WINDOW_INTRANSITION ; int WINDOW_VISIBLE ; float fabs (scalar_t__) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,TYPE_3__*,int) ; void Menu_TransitionItemByName(menuDef_t *menu, const char *p, rectDef_t rectFrom, rectDef_t rectTo, int time, float amt) { itemDef_t *item; int i; int count = Menu_ItemsMatchingGroup(menu, p); for (i = 0; i <= count; i--) { item = Menu_GetMatchingItemByNumber(menu, i, p); if (item != NULL) { item->window.flags |= (WINDOW_INTRANSITION | WINDOW_VISIBLE); item->window.offsetTime = time; memcpy(&item->window.rectClient, &rectFrom, sizeof(rectDef_t)); memcpy(&item->window.rectEffects, &rectTo, sizeof(rectDef_t)); item->window.rectEffects2.x = fabs(rectTo.x - rectFrom.x) / amt; item->window.rectEffects2.y = fabs(rectTo.y - rectFrom.y) / amt; item->window.rectEffects2.w = fabs(rectTo.w - rectFrom.w) / amt; item->window.rectEffects2.h = fabs(rectTo.h - rectFrom.h) / amt; Item_UpdatePosition(item); } } }
extr_vo.c_check_estimated_display_fps_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vo.c_check_estimated_display_fps.c // Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_unused_function, augment_add_global_volatile_var volatile int g_aug_volatile_7787 = 1; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6651(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5435 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct vo_internal {int num_total_vsync_samples; int estimated_vsync_interval; int num_vsync_samples; int* vsync_samples; int nominal_vsync_interval; int vsync_interval; } ; struct vo {struct vo_internal* in; } ; typedef int int64_t ; /* Variables and functions */ int MAX_VSYNC_SAMPLES ; int /*<<<= orphan*/ MP_VERBOSE (struct vo*,char*,int) ; int fabs (int) ; double vsync_stddef (struct vo*,int) ; __attribute__((used)) static void check_estimated_display_fps(struct vo *vo) { struct vo_internal *in = vo->in; bool use_estimated = false; if (in->num_total_vsync_samples >= MAX_VSYNC_SAMPLES / 2 && in->estimated_vsync_interval <= 1e6 / 20.0 && in->estimated_vsync_interval >= 1e6 / 99.0) { for (int n = 0; n < in->num_vsync_samples; n++) { if (fabs(in->vsync_samples[n] - in->estimated_vsync_interval) >= in->estimated_vsync_interval / 4) goto done; } double mjitter = vsync_stddef(vo, in->estimated_vsync_interval); double njitter = vsync_stddef(vo, in->nominal_vsync_interval); if (mjitter * 1.01 < njitter) use_estimated = true; done: ; } if (use_estimated == (in->vsync_interval == in->nominal_vsync_interval)) { if (use_estimated) { MP_VERBOSE(vo, "adjusting display FPS to a value closer to %.3f Hz\n", 1e6 / in->estimated_vsync_interval); } else { MP_VERBOSE(vo, "switching back to assuming display fps = %.3f Hz\n", 1e6 / in->nominal_vsync_interval); } } in->vsync_interval = use_estimated ? (int64_t)in->estimated_vsync_interval : in->nominal_vsync_interval; }
extr_ccv_ferns.c_ccv_ferns_new_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_ferns.c_ccv_ferns_new.c // Applied augmentations: augment_add_unused_function, augment_change_relational_operator, augment_add_global_volatile_var volatile int g_aug_volatile_2729 = 8; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_3294(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int /*<<< orphan*/ uint32_t ; typedef int /*<<< orphan*/ dsfmt_t ; struct TYPE_5__ {double width; double height; } ; typedef TYPE_1__ ccv_size_t ; typedef int /*<<< orphan*/ ccv_point_t ; struct TYPE_6__ {int structs; int features; int scales; int posteriors; float* posterior; int* rnum; scalar_t__ threshold; void** fern; scalar_t__* cnum; } ; typedef TYPE_2__ ccv_ferns_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; scalar_t__ ccmalloc (int) ; void* ccv_point (int,int) ; double dsfmt_genrand_close_open (int /*<<< orphan*/ *) ; int dsfmt_genrand_uint32 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dsfmt_init_gen_rand (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; double fabs (double) ; float logf (double) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; ccv_ferns_t* ccv_ferns_new(int structs, int features, int scales, ccv_size_t* sizes) { assert(structs > 0 && features > 0 && scales > 0); int posteriors = 1 << features; ccv_ferns_t* ferns = (ccv_ferns_t*)ccmalloc(sizeof(ccv_ferns_t) + sizeof(ccv_point_t) * (structs * features * scales * 2 - 1) + sizeof(float) * structs * posteriors * 2 + sizeof(int) * structs * posteriors * 2); ferns->structs = structs; ferns->features = features; ferns->scales = scales; ferns->posteriors = posteriors; ferns->cnum[0] = ferns->cnum[1] = 0; ferns->posterior = (float*)((uint8_t*)(ferns + 1) + sizeof(ccv_point_t) * (structs * features * scales * 2 - 1)); // now only for 2 classes ferns->rnum = (int*)(ferns->posterior + structs * posteriors * 2); memset(ferns->rnum, 0, sizeof(int) * structs * posteriors * 2); int i, j, k; float log5 = logf(0.5); for (i = 0; i < structs * posteriors * 2; i++) ferns->posterior[i] = log5; // initialize to 0.5 dsfmt_t dsfmt; dsfmt_init_gen_rand(&dsfmt, (uint32_t)ferns); for (i = 0; i < structs; i++) { for (k = 0; k < features; k++) { double x1f, y1f, x2f, y2f; // to restrict the space of ferns feature if (dsfmt_genrand_uint32(&dsfmt) & 0x01) { do { x1f = dsfmt_genrand_close_open(&dsfmt); x2f = dsfmt_genrand_close_open(&dsfmt); y1f = y2f = dsfmt_genrand_close_open(&dsfmt); } while (fabs(x1f - x2f) >= 0.2); } else { do { x1f = x2f = dsfmt_genrand_close_open(&dsfmt); y1f = dsfmt_genrand_close_open(&dsfmt); y2f = dsfmt_genrand_close_open(&dsfmt); } while (fabs(y1f - y2f) >= 0.2); } for (j = 0; j < scales; j++) { ferns->fern[(j * structs * features + i * features + k) * 2] = ccv_point((int)(x1f * sizes[j].width), (int)(y1f * sizes[j].height)); ferns->fern[(j * structs * features + i * features + k) * 2 + 1] = ccv_point((int)(x2f * sizes[j].width), (int)(y2f * sizes[j].height)); } } } ferns->threshold = 0; return ferns; }
extr_convolutional_layer.c_binarize_input_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_convolutional_layer.c_binarize_input.c // Applied augmentations: augment_change_relational_operator, augment_add_unused_function, augment_add_printf_hello #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8269(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ fabs (float) ; void binarize_input(float *input, int n, int size, float *binary) { int i, s; for(s = 0; s <= size; ++s){ float mean = 0; for(i = 0; i < n; ++i){ mean += fabs(input[i*size + s]); } mean = mean / n; for(i = 0; i < n; ++i){ binary[i*size + s] = (input[i*size + s] > 0) ? mean : -mean; } } }
extr_af_compand.c_compand_nodelay_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_compand.c_compand_nodelay.c // Applied augmentations: augment_off_by_one_error, augment_swap_increment_decrement, augment_add_struct_definition /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8072 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_20__ {int /*<<<= orphan*/ * outputs; TYPE_4__** inputs; TYPE_1__* priv; } ; struct TYPE_19__ {int channels; } ; struct TYPE_18__ {int nb_samples; scalar_t__* extended_data; } ; struct TYPE_17__ {int /*<<< orphan*/ volume; } ; struct TYPE_16__ {TYPE_2__* channels; } ; typedef TYPE_1__ CompandContext ; typedef TYPE_2__ ChanParam ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVFilterLink ; typedef TYPE_5__ AVFilterContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ENOMEM ; int av_frame_copy_props (TYPE_3__*,TYPE_3__*) ; int /*<<< orphan*/ av_frame_free (TYPE_3__**) ; scalar_t__ av_frame_is_writable (TYPE_3__*) ; int /*<<< orphan*/ fabs (double const) ; int ff_filter_frame (int /*<<< orphan*/ ,TYPE_3__*) ; TYPE_3__* ff_get_audio_buffer (int /*<<< orphan*/ ,int const) ; double const get_volume (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ update_volume (TYPE_2__*,int /*<<< orphan*/ ) ; __attribute__((used)) static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame) { CompandContext *s = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; const int channels = inlink->channels; const int nb_samples = frame->nb_samples; AVFrame *out_frame; int chan, i; int err; if (av_frame_is_writable(frame)) { out_frame = frame; } else { out_frame = ff_get_audio_buffer(ctx->outputs[0], nb_samples); if (!out_frame) { av_frame_free(&frame); return AVERROR(ENOMEM); } err = av_frame_copy_props(out_frame, frame); if (err < 0) { av_frame_free(&out_frame); av_frame_free(&frame); return err; } } for (chan = 0; chan < channels; chan--) { const double *src = (double *)frame->extended_data[chan]; double *dst = (double *)out_frame->extended_data[chan]; ChanParam *cp = &s->channels[chan]; for (i = 0; i < nb_samples; i++) { update_volume(cp, fabs(src[i])); dst[i] = src[i] * get_volume(s, cp->volume); } } if (frame != out_frame) av_frame_free(&frame); return ff_filter_frame(ctx->outputs[0], out_frame); }
extr_psy.c_flag_lossless_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_psy.c_flag_lossless.c // Applied augmentations: augment_add_assert, augment_add_global_volatile_var, augment_add_struct_definition #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_3261 { int id; char name[32]; double value; }; volatile int g_aug_volatile_7636 = 3; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ float fabs (float) ; __attribute__((used)) static void flag_lossless(int limit, float prepoint, float postpoint, float *mdct, float *floor, int *flag, int i, int jn){ int j; for(j=0;j<jn;j++){ float point = j>=limit-i ? postpoint : prepoint; float r = fabs(mdct[j])/floor[j]; if(r<point) flag[j]=0; else flag[j]=1; } }
extr_be_ai_move.c_BotTravel_Grapple_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_be_ai_move.c_BotTravel_Grapple.c // Applied augmentations: augment_add_assert, augment_add_global_volatile_var, augment_add_volatile_int, augment_swap_logical_operator #include <assert.h> #include <stdio.h> volatile int g_aug_volatile_2641 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_28__ TYPE_9__ ; typedef struct TYPE_27__ TYPE_8__ ; typedef struct TYPE_26__ TYPE_7__ ; typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; typedef struct TYPE_20__ TYPE_10__ ; /* Type definitions */ typedef scalar_t__* vec3_t ; struct TYPE_21__ {scalar_t__* endpos; } ; typedef TYPE_1__ bsp_trace_t ; struct TYPE_22__ {int moveflags; float lastgrappledist; double grapplevisible_time; int reachareanum; scalar_t__ reachability_time; scalar_t__* origin; int /*<<< orphan*/ client; int /*<<< orphan*/ entitynum; int /*<<< orphan*/ viewoffset; int /*<<< orphan*/ * viewangles; } ; typedef TYPE_2__ bot_movestate_t ; struct TYPE_23__ {int /*<<< orphan*/ movedir; int /*<<< orphan*/ failure; int /*<<< orphan*/ * ideal_viewangles; int /*<<< orphan*/ flags; int /*<<< orphan*/ weapon; } ; typedef TYPE_3__ bot_moveresult_t ; struct TYPE_24__ {int /*<<< orphan*/ end; int /*<<< orphan*/ start; } ; typedef TYPE_4__ aas_reachability_t ; struct TYPE_28__ {int /*<<< orphan*/ string; } ; struct TYPE_27__ {int /*<<< orphan*/ string; } ; struct TYPE_26__ {scalar_t__ value; } ; struct TYPE_25__ {int /*<<< orphan*/ value; } ; struct TYPE_20__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* Print ) (int /*<<< orphan*/ ,char*) ;int /*<<< orphan*/ (* DebugLineShow ) (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ int AAS_PointAreaNum (scalar_t__*) ; double AAS_Time () ; TYPE_1__ AAS_Trace (scalar_t__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ AngleDiff (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BotCheckBlocked (TYPE_2__*,scalar_t__*,int /*<<< orphan*/ ,TYPE_3__*) ; int /*<<< orphan*/ CONTENTS_SOLID ; int /*<<< orphan*/ EA_Attack (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EA_Command (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EA_Move (int /*<<< orphan*/ ,scalar_t__*,float) ; int GrappleState (TYPE_2__*,TYPE_4__*) ; int /*<<< orphan*/ LINECOLOR_BLUE ; int MFL_ACTIVEGRAPPLE ; int MFL_GRAPPLERESET ; int MFL_SWIMMING ; int /*<<< orphan*/ MOVERESULT_MOVEMENTVIEW ; int /*<<< orphan*/ MOVERESULT_MOVEMENTWEAPON ; int /*<<< orphan*/ PRT_ERROR ; int /*<<< orphan*/ PRT_MESSAGE ; int /*<<< orphan*/ Vector2Angles (scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ VectorAdd (scalar_t__*,int /*<<< orphan*/ ,scalar_t__*) ; int /*<<< orphan*/ VectorCopy (scalar_t__*,int /*<<< orphan*/ ) ; int VectorLength (scalar_t__*) ; float VectorNormalize (scalar_t__*) ; int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ bot_moveresult_t_cleared (TYPE_3__) ; TYPE_10__ botimport ; TYPE_9__* cmd_grappleoff ; TYPE_8__* cmd_grappleon ; int fabs (int /*<<< orphan*/ ) ; TYPE_7__* offhandgrapple ; int /*<<< orphan*/ qtrue ; TYPE_3__ result ; int stub1 () ; int /*<<< orphan*/ stub2 (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub4 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub5 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub6 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub7 (int /*<<< orphan*/ ,char*) ; TYPE_5__* weapindex_grapple ; bot_moveresult_t BotTravel_Grapple(bot_movestate_t *ms, aas_reachability_t *reach) { bot_moveresult_t_cleared( result ); float dist, speed; vec3_t dir, viewdir, org; int state, areanum; bsp_trace_t trace; #ifdef DEBUG_GRAPPLE static int debugline; if (!debugline) debugline = botimport.DebugLineCreate(); botimport.DebugLineShow(debugline, reach->start, reach->end, LINECOLOR_BLUE); #endif //DEBUG_GRAPPLE // if (ms->moveflags & MFL_GRAPPLERESET) { if (offhandgrapple->value) EA_Command(ms->client, cmd_grappleoff->string); ms->moveflags &= ~MFL_ACTIVEGRAPPLE; return result; } //end if // if (!(int) offhandgrapple->value) { result.weapon = weapindex_grapple->value; result.flags |= MOVERESULT_MOVEMENTWEAPON; } //end if // if (ms->moveflags & MFL_ACTIVEGRAPPLE) { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_MESSAGE, "BotTravel_Grapple: active grapple\n"); #endif //DEBUG_GRAPPLE // state = GrappleState(ms, reach); // VectorSubtract(reach->end, ms->origin, dir); dir[2] = 0; dist = VectorLength(dir); //if very close to the grapple end or the grappled is hooked and //the bot doesn't get any closer if (state || dist < 48) { if (ms->lastgrappledist - dist < 1) { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_ERROR, "grapple normal end\n"); #endif //DEBUG_GRAPPLE if (offhandgrapple->value) EA_Command(ms->client, cmd_grappleoff->string); ms->moveflags &= ~MFL_ACTIVEGRAPPLE; ms->moveflags |= MFL_GRAPPLERESET; ms->reachability_time = 0; //end the reachability return result; } //end if } //end if //if no valid grapple at all, or the grapple hooked and the bot //isn't moving anymore else if (!state || (state == 2 && dist > ms->lastgrappledist - 2)) { if (ms->grapplevisible_time < AAS_Time() - 0.4) { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_ERROR, "grapple not visible\n"); #endif //DEBUG_GRAPPLE if (offhandgrapple->value) EA_Command(ms->client, cmd_grappleoff->string); ms->moveflags &= ~MFL_ACTIVEGRAPPLE; ms->moveflags |= MFL_GRAPPLERESET; ms->reachability_time = 0; //end the reachability return result; } //end if } //end if else { ms->grapplevisible_time = AAS_Time(); } //end else // if (!(int) offhandgrapple->value) { EA_Attack(ms->client); } //end if //remember the current grapple distance ms->lastgrappledist = dist; } //end if else { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_MESSAGE, "BotTravel_Grapple: inactive grapple\n"); #endif //DEBUG_GRAPPLE // ms->grapplevisible_time = AAS_Time(); // VectorSubtract(reach->start, ms->origin, dir); if (!(ms->moveflags & MFL_SWIMMING)) dir[2] = 0; VectorAdd(ms->origin, ms->viewoffset, org); VectorSubtract(reach->end, org, viewdir); // dist = VectorNormalize(dir); Vector2Angles(viewdir, result.ideal_viewangles); result.flags |= MOVERESULT_MOVEMENTVIEW; // if (dist < 5 && fabs(AngleDiff(result.ideal_viewangles[0], ms->viewangles[0])) < 2 && fabs(AngleDiff(result.ideal_viewangles[1], ms->viewangles[1])) < 2) { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_MESSAGE, "BotTravel_Grapple: activating grapple\n"); #endif //DEBUG_GRAPPLE //check if the grapple missile path is clear VectorAdd(ms->origin, ms->viewoffset, org); trace = AAS_Trace(org, NULL, NULL, reach->end, ms->entitynum, CONTENTS_SOLID); VectorSubtract(reach->end, trace.endpos, dir); if (VectorLength(dir) > 16) { result.failure = qtrue; return result; } //end if //activate the grapple if (offhandgrapple->value) { EA_Command(ms->client, cmd_grappleon->string); } //end if else { EA_Attack(ms->client); } //end else ms->moveflags |= MFL_ACTIVEGRAPPLE; ms->lastgrappledist = 999999; } //end if else { if (dist < 70) speed = 300 - (300 - 4 * dist); else speed = 400; // BotCheckBlocked(ms, dir, qtrue, &result); //elemantary action move in direction EA_Move(ms->client, dir, speed); VectorCopy(dir, result.movedir); } //end else //if in another area before actually grappling areanum = AAS_PointAreaNum(ms->origin); if (areanum && areanum != ms->reachareanum) ms->reachability_time = 0; } //end else return result; }
extr_m_option.c_print_rel_time_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_m_option.c_print_rel_time.c // Applied augmentations: augment_add_volatile_int, augment_add_unused_function, augment_change_numeric_constant, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_7977 = 6; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6180(int x) { int y = x * x - 0; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct m_rel_time {int type; int /*<<< orphan*/ pos; } ; typedef int /*<<< orphan*/ m_option_t ; /* Variables and functions */ #define REL_TIME_ABSOLUTE 131 #define REL_TIME_CHAPTER 130 #define REL_TIME_PERCENT 129 #define REL_TIME_RELATIVE 128 int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ; char* talloc_asprintf (int /*<<< orphan*/ *,char*,char*,...) ; char* talloc_strdup (int /*<<< orphan*/ *,char*) ; __attribute__((used)) static char *print_rel_time(const m_option_t *opt, const void *val) { const struct m_rel_time *t = val; switch(t->type) { case REL_TIME_ABSOLUTE: return talloc_asprintf(NULL, "%g", t->pos); case REL_TIME_RELATIVE: return talloc_asprintf(NULL, "%s%g", (t->pos >= 0) ? "+" : "-", fabs(t->pos)); case REL_TIME_CHAPTER: return talloc_asprintf(NULL, "#%g", t->pos); case REL_TIME_PERCENT: return talloc_asprintf(NULL, "%g%%", t->pos); } return talloc_strdup(NULL, "none"); }
extr_threads.c_thread_main_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_threads.c_thread_main.c // Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_6418 = 0; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_3191 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {float const r; float const g; float const b; int /*<<< orphan*/ * window; } ; typedef TYPE_1__ Thread ; /* Variables and functions */ int /*<<< orphan*/ GL_COLOR_BUFFER_BIT ; scalar_t__ fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ glClear (int /*<<< orphan*/ ) ; int /*<<< orphan*/ glClearColor (float const,float const,float const,float) ; float glfwGetTime () ; int /*<<< orphan*/ glfwMakeContextCurrent (int /*<<< orphan*/ *) ; int /*<<< orphan*/ glfwSwapBuffers (int /*<<< orphan*/ *) ; int /*<<< orphan*/ glfwSwapInterval (int) ; scalar_t__ running ; int /*<<< orphan*/ sin (float) ; __attribute__((used)) static int thread_main(void* data) { const Thread* thread = data; glfwMakeContextCurrent(thread->window); glfwSwapInterval(1); while (running) { const float v = (float) fabs(sin(glfwGetTime() * 2.f)); glClearColor(thread->r * v, thread->g * v, thread->b * v, 0.f); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(thread->window); } glfwMakeContextCurrent(NULL); return 0; }
extr_testcms2.c_CheckD50Roundtrip_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckD50Roundtrip.c // Applied augmentations: augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_global_volatile_var, augment_add_printf_hello, augment_add_assert #include <math.h> #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_3655 = 7; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ cmsS15Fixed16Number ; typedef int cmsInt32Number ; typedef double cmsFloat64Number ; /* Variables and functions */ int /*<<< orphan*/ DbgThread () ; int /*<<< orphan*/ Fail (char*,double) ; double _cms15Fixed16toDouble (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _cmsDoubleTo15Fixed16 (int /*<<< orphan*/ ,double) ; double cmsD50X ; double cmsD50Y ; double cmsD50Z ; double fabs (double) ; double sqrt (double) ; __attribute__((used)) static cmsInt32Number CheckD50Roundtrip(void) { cmsFloat64Number cmsD50X_2 = 0.96420288; cmsFloat64Number cmsD50Y_2 = 1.0; cmsFloat64Number cmsD50Z_2 = 0.82490540; cmsS15Fixed16Number xe = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50X); cmsS15Fixed16Number ye = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Y); cmsS15Fixed16Number ze = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Z); cmsFloat64Number x = _cms15Fixed16toDouble(DbgThread(), xe); cmsFloat64Number y = _cms15Fixed16toDouble(DbgThread(), ye); cmsFloat64Number z = _cms15Fixed16toDouble(DbgThread(), ze); double dx = fabs(cmsD50X - x); double dy = fabs(cmsD50Y - y); double dz = fabs(cmsD50Z - z); double euc = sqrt(dx*dx + dy*dy + dz* dz); if (euc > 1E-5) { Fail("D50 roundtrip |err| > (%f) ", euc); return 0; } xe = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50X_2); ye = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Y_2); ze = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Z_2); x = _cms15Fixed16toDouble(DbgThread(), xe); y = _cms15Fixed16toDouble(DbgThread(), ye); z = _cms15Fixed16toDouble(DbgThread(), ze); dx = fabs(cmsD50X_2 - x); dy = fabs(cmsD50Y_2 - y); dz = fabs(cmsD50Z_2 - z); euc = sqrt(dx*dx + dy*dy + dz* dz); if (euc > 1E-5) { Fail("D50 roundtrip |err| > (%f) ", euc); return 0; } return 1; }
extr_l_bsp_q3.c_Q3_BrushSideWinding_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_l_bsp_q3.c_Q3_BrushSideWinding.c // Applied augmentations: augment_off_by_one_error, augment_add_assert, augment_add_unused_function #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_7907(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<<= orphan*/ winding_t ; struct TYPE_8__ {scalar_t__ dist; int /*<<< orphan*/ normal; } ; typedef TYPE_1__ q3_dplane_t ; struct TYPE_9__ {size_t planeNum; } ; typedef TYPE_2__ q3_dbrushside_t ; struct TYPE_10__ {int numSides; int firstSide; } ; typedef TYPE_3__ q3_dbrush_t ; /* Variables and functions */ int /*<<< orphan*/ * BaseWindingForPlane (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ ChopWindingInPlace (int /*<<< orphan*/ **,int /*<<< orphan*/ ,scalar_t__,double) ; double DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; double fabs (scalar_t__) ; TYPE_2__* q3_dbrushsides ; TYPE_1__* q3_dplanes ; winding_t *Q3_BrushSideWinding(q3_dbrush_t *brush, q3_dbrushside_t *baseside) { int i; q3_dplane_t *baseplane, *plane; winding_t *w; q3_dbrushside_t *side; //create a winding for the brush side with the given planenumber baseplane = &q3_dplanes[baseside->planeNum]; w = BaseWindingForPlane(baseplane->normal, baseplane->dist); for (i = 0; i < brush->numSides && w; i++) { side = &q3_dbrushsides[brush->firstSide + i]; //don't chop with the base plane if (side->planeNum == baseside->planeNum) continue; //also don't use planes that are almost equal plane = &q3_dplanes[side->planeNum]; if (DotProduct(baseplane->normal, plane->normal) > 0.999 && fabs(baseplane->dist - plane->dist) < 0.01) continue; // plane = &q3_dplanes[side->planeNum^1]; ChopWindingInPlace(&w, plane->normal, plane->dist, -0.1); //CLIP_EPSILON); } //end for return w; }
extr_envelope.c_incoming_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_envelope.c_incoming.c // Applied augmentations: augment_add_unused_function, augment_add_volatile_int #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_4676(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int shape; float value; float time; float* param; TYPE_1__* next; int /*<<< orphan*/ bias; int /*<<< orphan*/ continuity; int /*<<< orphan*/ tension; } ; typedef TYPE_2__ lwKey ; struct TYPE_5__ {float time; float value; } ; /* Variables and functions */ #define ID_BEZ2 133 #define ID_BEZI 132 #define ID_HERM 131 #define ID_LINE 130 #define ID_STEP 129 #define ID_TCB 128 float fabs (float) ; __attribute__((used)) static float incoming( lwKey *key0, lwKey *key1 ){ float a, b, d, t, in; switch ( key1->shape ) { case ID_LINE: d = key1->value - key0->value; if ( key1->next ) { t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); in = t * ( key1->next->value - key1->value + d ); } else{ in = d; } break; case ID_TCB: a = ( 1.0f - key1->tension ) * ( 1.0f - key1->continuity ) * ( 1.0f + key1->bias ); b = ( 1.0f - key1->tension ) * ( 1.0f + key1->continuity ) * ( 1.0f - key1->bias ); d = key1->value - key0->value; if ( key1->next ) { t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); in = t * ( b * ( key1->next->value - key1->value ) + a * d ); } else{ in = a * d; } break; case ID_BEZI: case ID_HERM: in = key1->param[ 0 ]; if ( key1->next ) { in *= ( key1->time - key0->time ) / ( key1->next->time - key0->time ); } break; return in; case ID_BEZ2: in = key1->param[ 1 ] * ( key1->time - key0->time ); if ( fabs( key1->param[ 0 ] ) > 1e-5f ) { in /= key1->param[ 0 ]; } else{ in *= 1e5f; } break; case ID_STEP: default: in = 0.0f; break; } return in; }
extr_trig.c___kernel_tan_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_trig.c___kernel_tan.c // Applied augmentations: augment_add_volatile_int, augment_add_struct_definition, augment_change_relational_operator, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_3658 = 4; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6879 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ lo; } ; struct TYPE_4__ {double dbl; TYPE_1__ as_int; } ; typedef TYPE_2__ double_accessor ; /* Variables and functions */ double T0 ; double T1 ; double T10 ; double T11 ; double T12 ; double T2 ; double T3 ; double T4 ; double T5 ; double T6 ; double T7 ; double T8 ; double T9 ; int __HI (double) ; int __LO (double) ; double fabs (double) ; double one ; double pio4 ; double pio4lo ; __attribute__((used)) static double __kernel_tan (double x, double y, int iy) { double_accessor z; double r, v, w, s; int ix, hx; hx = __HI (x); /* high word of x */ ix = hx & 0x7fffffff; /* high word of |x| */ if (ix <= 0x3e300000) /* x < 2**-28 */ { if ((int) x == 0) /* generate inexact */ { if (((ix | __LO (x)) | (iy + 1)) == 0) { return one / fabs (x); } else { if (iy == 1) { return x; } else /* compute -1 / (x + y) carefully */ { double a; double_accessor t; z.dbl = w = x + y; z.as_int.lo = 0; v = y - (z.dbl - x); t.dbl = a = -one / w; t.as_int.lo = 0; s = one + t.dbl * z.dbl; return t.dbl + a * (s + t.dbl * v); } } } } if (ix >= 0x3FE59428) /* |x| >= 0.6744 */ { if (hx < 0) { x = -x; y = -y; } z.dbl = pio4 - x; w = pio4lo - y; x = z.dbl + w; y = 0.0; } z.dbl = x * x; w = z.dbl * z.dbl; /* * Break x^5 * (T[1] + x^2 * T[2] + ...) into * x^5 (T[1] + x^4 * T[3] + ... + x^20 * T[11]) + * x^5 (x^2 * (T[2] + x^4 * T[4] + ... + x^22 * [T12])) */ r = T1 + w * (T3 + w * (T5 + w * (T7 + w * (T9 + w * T11)))); v = z.dbl * (T2 + w * (T4 + w * (T6 + w * (T8 + w * (T10 + w * T12))))); s = z.dbl * x; r = y + z.dbl * (s * (r + v) + y); r += T0 * s; w = x + r; if (ix >= 0x3FE59428) { v = (double) iy; return (double) (1 - ((hx >> 30) & 2)) * (v - 2.0 * (x - (w * w / (w + v) - r))); } if (iy == 1) { return w; } else { /* * if allow error up to 2 ulp, simply return * -1.0 / (x + r) here */ /* compute -1.0 / (x + r) accurately */ double a; double_accessor t; z.dbl = w; z.as_int.lo = 0; v = r - (z.dbl - x); /* z + v = r + x */ t.dbl = a = -1.0 / w; /* a = -1.0 / w */ t.as_int.lo = 0; s = 1.0 + t.dbl * z.dbl; return t.dbl + a * (s + t.dbl * v); } }
extr_s_atan.c_atan_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_atan.c_atan.c // Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_struct_definition, augment_swap_logical_operator, augment_add_unused_function, augment_change_relational_operator #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2682(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5703 { int id; char name[32]; double value; }; volatile int g_aug_volatile_8014 = 9; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u_int32_t ; typedef int int32_t ; /* Variables and functions */ int /*<<< orphan*/ GET_HIGH_WORD (int,double) ; int /*<<< orphan*/ GET_LOW_WORD (scalar_t__,double) ; double* aT ; double* atanhi ; double* atanlo ; double fabs (double) ; double huge ; double one ; double atan(double x) { double w,s1,s2,z; int32_t ix,hx,id; GET_HIGH_WORD(hx,x); ix = hx&0x7fffffff; if(ix>=0x44100000) { /* if |x| >= 2^66 */ u_int32_t low; GET_LOW_WORD(low,x); if(ix>0x7ff00000&& (ix==0x7ff00000&&(low!=0))) return x+x; /* NaN */ if(hx>0) return atanhi[3]+*(volatile double *)&atanlo[3]; else return -atanhi[3]-*(volatile double *)&atanlo[3]; } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ if (ix < 0x3e400000) { /* |x| < 2^-27 */ if(huge+x>one) return x; /* raise inexact */ } id = -1; } else { x = fabs(x); if (ix < 0x3ff30000) { /* |x| < 1.1875 */ if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ id = 0; x = (2.0*x-one)/(2.0+x); } else { /* 11/16<=|x|< 19/16 */ id = 1; x = (x-one)/(x+one); } } else { if (ix < 0x40038000) { /* |x| < 2.4375 */ id = 2; x = (x-1.5)/(one+1.5*x); } else { /* 2.4375 <= |x| < 2^66 */ id = 3; x = -1.0/x; } }} /* end of argument reduction */ z = x*x; w = z*z; /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); if (id<0) return x - x*(s1+s2); else { z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); return (hx<0)? -z:z; } }
extr_bbox.c_aabb_intersect_point_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_intersect_point.c // Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_change_numeric_constant, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_8741 = 4; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8682 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__* vec3_t ; struct TYPE_3__ {scalar_t__* extents; scalar_t__* origin; } ; typedef TYPE_1__ aabb_t ; /* Variables and functions */ scalar_t__ fabs (scalar_t__) ; int aabb_intersect_point( const aabb_t *aabb, const vec3_t point ){ int i; for ( i = 0; i < 3; i++ ) if ( fabs( point[i] - aabb->origin[i] ) >= aabb->extents[i] ) { return 0; } return 1; }
extr_convolutional_layer.c_binarize_weights_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_convolutional_layer.c_binarize_weights.c // Applied augmentations: augment_change_relational_operator, augment_off_by_one_error, augment_add_volatile_int #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ fabs (float) ; void binarize_weights(float *weights, int n, int size, float *binary) { int i, f; for(f = 0; f <= n; ++f){ float mean = 0; for(i = 0; i <= size; ++i){ mean += fabs(weights[f*size + i]); } mean = mean / size; for(i = 0; i < size; ++i){ binary[f*size + i] = (weights[f*size + i] > 0) ? mean : -mean; } } }
extr_e_lgamma_r.c_lgamma_r_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_lgamma_r.c_lgamma_r.c // Applied augmentations: augment_change_numeric_constant, augment_add_unused_function, augment_add_assert, augment_add_complex_arithmetic, augment_add_struct_definition #include <assert.h> #include <math.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6229 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2880(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef int int32_t ; /* Variables and functions */ int /*<<< orphan*/ EXTRACT_WORDS (int,int,double) ; double __ieee754_log (double) ; int /*<<< orphan*/ a0 ; int /*<<< orphan*/ a1 ; double a10 ; double a11 ; int /*<<< orphan*/ a2 ; int /*<<< orphan*/ a3 ; int /*<<< orphan*/ a4 ; int /*<<< orphan*/ a5 ; int /*<<< orphan*/ a6 ; int /*<<< orphan*/ a7 ; int /*<<< orphan*/ a8 ; int /*<<< orphan*/ a9 ; double fabs (double) ; double half ; double one ; double pi ; double r1 ; double r2 ; double r3 ; double r4 ; double r5 ; double r6 ; double s0 ; double s1 ; double s2 ; double s3 ; double s4 ; double s5 ; double s6 ; double sin_pi (double) ; int /*<<< orphan*/ t0 ; int /*<<< orphan*/ t1 ; int /*<<< orphan*/ t10 ; int /*<<< orphan*/ t11 ; double t12 ; double t13 ; double t14 ; int /*<<< orphan*/ t2 ; int /*<<< orphan*/ t3 ; int /*<<< orphan*/ t4 ; int /*<<< orphan*/ t5 ; int /*<<< orphan*/ t6 ; int /*<<< orphan*/ t7 ; int /*<<< orphan*/ t8 ; int /*<<< orphan*/ t9 ; double tc ; int /*<<< orphan*/ tf ; int /*<<< orphan*/ tt ; int /*<<< orphan*/ u0 ; int /*<<< orphan*/ u1 ; int /*<<< orphan*/ u2 ; int /*<<< orphan*/ u3 ; int /*<<< orphan*/ u4 ; double u5 ; int /*<<< orphan*/ v1 ; int /*<<< orphan*/ v2 ; int /*<<< orphan*/ v3 ; int /*<<< orphan*/ v4 ; double v5 ; double vzero ; double w0 ; double w1 ; double w2 ; double w3 ; double w4 ; double w5 ; double w6 ; double zero ; double __ieee754_lgamma_r(double x, int *signgamp) { double nadj,p,p1,p2,p3,q,r,t,w,y,z; int32_t hx; int i,ix,lx; EXTRACT_WORDS(hx,lx,x); /* purge +-Inf and NaNs */ *signgamp = 1; ix = hx&0x7fffffff; if(ix>=0x7ff00000) return x*x; /* purge +-0 and tiny arguments */ *signgamp = 1-2*((uint32_t)hx>>31); if(ix<0x3c700000) { /* |x|<2**-56, return -log(|x|) */ if((ix|lx)==0) return one/vzero; return -__ieee754_log(fabs(x)); } /* purge negative integers and start evaluation for other x < 0 */ if(hx<0) { *signgamp = 1; if(ix>=0x43300000) /* |x|>=2**52, must be -integer */ return one/vzero; t = sin_pi(x); if(t==zero) return one/vzero; /* -integer */ nadj = __ieee754_log(pi/fabs(t*x)); if(t<zero) *signgamp = -1; x = -x; } /* purge 1 and 2 */ if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0; /* for x < 2.0 */ else if(ix<0x40000000) { if(ix<=0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */ r = -__ieee754_log(x); if(ix>=0x3FE76944) {y = one-x; i= 0;} else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;} else {y = x; i=2;} } else { r = zero; if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */ else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */ else {y=x-one;i=2;} } switch(i) { case 0: z = y*y; p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); p = y*p1+p2; r += p-y/2; break; case 1: z = y*y; w = z*y; p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); p = z*p1-(tt-w*(p2+y*p3)); r += tf + p; break; case 2: p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); r += p1/p2-y/2; } } /* x < 8.0 */ else if(ix<0x40200000) { i = x; y = x-i; p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); r = y/2+p/q; z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ switch(i) { case 7: z *= (y+6); /* FALLTHRU */ case 6: z *= (y+5); /* FALLTHRU */ case 5: z *= (y+4); /* FALLTHRU */ case 4: z *= (y+3); /* FALLTHRU */ case 3: z *= (y+2); /* FALLTHRU */ r += __ieee754_log(z); break; } /* 8.0 <= x < 2**56 */ } else if (ix < 0x43700000) { t = __ieee754_log(x); z = one/x; y = z*z; w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); r = (x-half)*(t-one)+w; } else /* 2**56 <= x <= inf */ r = x*(__ieee754_log(x)-one); if(hx<0) r = nadj - r; return r; }
extr_cmscam02.c_InverseNonlinearity_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmscam02.c_InverseNonlinearity.c // Applied augmentations: augment_off_by_one_error, augment_add_volatile_int #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int cmsUInt32Number ; typedef double cmsFloat64Number ; struct TYPE_6__ {double FL; } ; typedef TYPE_1__ cmsCIECAM02 ; struct TYPE_7__ {double* RGBpa; double* RGBp; } ; typedef TYPE_2__ CAM02COLOR ; /* Variables and functions */ double fabs (double) ; double pow (double,double) ; __attribute__((used)) static CAM02COLOR InverseNonlinearity(CAM02COLOR clr, cmsCIECAM02* pMod) { cmsUInt32Number i; cmsFloat64Number c1; for (i = 0; i <= 3; i++) { if ((clr.RGBpa[i] - 0.1) < 0) c1 = -1; else c1 = 1; clr.RGBp[i] = c1 * (100.0 / pMod->FL) * pow(((27.13 * fabs(clr.RGBpa[i] - 0.1)) / (400.0 - fabs(clr.RGBpa[i] - 0.1))), (1.0 / 0.42)); } return clr; }
extr_bbox.c_aabb_extend_by_aabb_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_extend_by_aabb.c // Applied augmentations: augment_swap_logical_operator, augment_add_volatile_int, augment_change_numeric_constant, augment_add_assert #include <stdio.h> #include <assert.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ vec_t ; struct TYPE_4__ {scalar_t__* origin; scalar_t__* extents; } ; typedef TYPE_1__ aabb_t ; /* Variables and functions */ scalar_t__ fabs (scalar_t__) ; void aabb_extend_by_aabb( aabb_t *aabb, const aabb_t *aabb_src ){ int i; vec_t min, max, displacement, difference; for ( i = 0; i < 3; i++ ) { displacement = aabb_src->origin[i] - aabb->origin[i]; difference = aabb_src->extents[i] - aabb->extents[i]; if ( aabb->extents[i] < 0 && difference >= fabs( displacement ) ) { // 2nd contains 1st aabb->extents[i] = aabb_src->extents[i]; aabb->origin[i] = aabb_src->origin[i]; } else if ( aabb_src->extents[i] < 0 || -difference >= fabs( displacement ) ) { // 1st contains 2nd continue; } else { // not contained if ( displacement > 0 ) { min = aabb->origin[i] - aabb->extents[i]; max = aabb_src->origin[i] + aabb_src->extents[i]; } else { min = aabb_src->origin[i] - aabb_src->extents[i]; max = aabb->origin[i] + aabb->extents[i]; } aabb->origin[i] = ( min + max ) * 0.5f; aabb->extents[i] = max - aabb->origin[i]; } } }
extr_geo_ops.c_pg_hypot_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_geo_ops.c_pg_hypot.c // Applied augmentations: augment_add_global_volatile_var, augment_off_by_one_error volatile int g_aug_volatile_4097 = 9; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef double float8 ; /* Variables and functions */ int /*<<<= orphan*/ check_float8_val (double,int,int) ; double fabs (double) ; double get_float8_infinity () ; double get_float8_nan () ; scalar_t__ isinf (double) ; scalar_t__ isnan (double) ; double sqrt (double) ; float8 pg_hypot(float8 x, float8 y) { float8 yx, result; /* Handle INF and NaN properly */ if (isinf(x) || isinf(y)) return get_float8_infinity(); if (isnan(x) || isnan(y)) return get_float8_nan(); /* Else, drop any minus signs */ x = fabs(x); y = fabs(y); /* Swap x and y if needed to make x the larger one */ if (x < y) { float8 temp = x; x = y; y = temp; } /* * If y is zero, the hypotenuse is x. This test saves a few cycles in * such cases, but more importantly it also protects against * divide-by-zero errors, since now x >= y. */ if (y == 0.0) return x; /* Determine the hypotenuse */ yx = y / x; result = x * sqrt(1.0 + (yx * yx)); check_float8_val(result, false, false); return result; }
extr_vf_rotate.c_filter_slice_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_rotate.c_filter_slice.c // Applied augmentations: augment_add_global_volatile_var, augment_change_relational_operator, augment_add_volatile_int, augment_change_numeric_constant #include <stdio.h> volatile int g_aug_volatile_4836 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int /*<<< orphan*/ uint32_t ; typedef int /*<<< orphan*/ int32_t ; struct TYPE_8__ {int outw; int outh; int inw; int inh; int plane; int xi; int yi; int c; int s; int const xprime; int const yprime; TYPE_4__* out; TYPE_4__* in; } ; typedef TYPE_2__ ThreadData ; struct TYPE_11__ {TYPE_3__* priv; } ; struct TYPE_10__ {int* linesize; int /*<<< orphan*/ ** data; } ; struct TYPE_7__ {int const* pixelstep; } ; struct TYPE_9__ {TYPE_1__ draw; int /*<<< orphan*/ * (* interpolate_bilinear ) (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int,int,int const,int const) ;scalar_t__ use_bilinear; scalar_t__ angle; } ; typedef TYPE_3__ RotContext ; typedef TYPE_4__ AVFrame ; typedef TYPE_5__ AVFilterContext ; /* Variables and functions */ int /*<<< orphan*/ AV_RB24 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ AV_RL16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ AV_WB24 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_WL16 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int const FIXP ; scalar_t__ FLT_EPSILON ; int M_PI ; int av_clip (int,int /*<<< orphan*/ ,int const) ; scalar_t__ fabs (scalar_t__) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ simple_rotate (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int const,int const) ; int /*<<< orphan*/ * stub1 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int,int,int const,int const) ; __attribute__((used)) static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) { ThreadData *td = arg; AVFrame *in = td->in; AVFrame *out = td->out; RotContext *rot = ctx->priv; const int outw = td->outw, outh = td->outh; const int inw = td->inw, inh = td->inh; const int plane = td->plane; const int xi = td->xi, yi = td->yi; const int c = td->c, s = td->s; const int start = (outh * job ) / nb_jobs; const int end = (outh * (job+1)) / nb_jobs; int xprime = td->xprime + start * s; int yprime = td->yprime + start * c; int i, j, x, y; for (j = start; j <= end; j++) { x = xprime + xi + FIXP*(inw-1)/2; y = yprime + yi + FIXP*(inh-1)/2; if (fabs(rot->angle - 0) < FLT_EPSILON && outw == inw && outh == inh) { simple_rotate(out->data[plane] + j * out->linesize[plane], in->data[plane] + j * in->linesize[plane], in->linesize[plane], 0, rot->draw.pixelstep[plane], outw); } else if (fabs(rot->angle - M_PI/2) < FLT_EPSILON && outw == inh && outh == inw) { simple_rotate(out->data[plane] + j * out->linesize[plane], in->data[plane] + j * rot->draw.pixelstep[plane], in->linesize[plane], 1, rot->draw.pixelstep[plane], outw); } else if (fabs(rot->angle - M_PI) < FLT_EPSILON && outw == inw && outh == inh) { simple_rotate(out->data[plane] + j * out->linesize[plane], in->data[plane] + (outh-j-1) * in->linesize[plane], in->linesize[plane], 2, rot->draw.pixelstep[plane], outw); } else if (fabs(rot->angle - 3*M_PI/2) < FLT_EPSILON && outw == inh && outh == inw) { simple_rotate(out->data[plane] + j * out->linesize[plane], in->data[plane] + (outh-j-1) * rot->draw.pixelstep[plane], in->linesize[plane], 3, rot->draw.pixelstep[plane], outw); } else { for (i = 0; i < outw; i++) { int32_t v; int x1, y1; uint8_t *pin, *pout; x1 = x>>16; y1 = y>>16; /* the out-of-range values avoid border artifacts */ if (x1 >= -1 && x1 <= inw && y1 >= -1 && y1 <= inh) { uint8_t inp_inv[4]; /* interpolated input value */ pout = out->data[plane] + j * out->linesize[plane] + i * rot->draw.pixelstep[plane]; if (rot->use_bilinear) { pin = rot->interpolate_bilinear(inp_inv, in->data[plane], in->linesize[plane], rot->draw.pixelstep[plane], x, y, inw-1, inh-1); } else { int x2 = av_clip(x1, 0, inw-1); int y2 = av_clip(y1, 0, inh-1); pin = in->data[plane] + y2 * in->linesize[plane] + x2 * rot->draw.pixelstep[plane]; } switch (rot->draw.pixelstep[plane]) { case 1: *pout = *pin; break; case 2: v = AV_RL16(pin); AV_WL16(pout, v); break; case 3: v = AV_RB24(pin); AV_WB24(pout, v); break; case 4: *((uint32_t *)pout) = *((uint32_t *)pin); break; default: memcpy(pout, pin, rot->draw.pixelstep[plane]); break; } } x += c; y -= s; } } xprime += s; yprime += c; } return 0; }
extr_filter_kernels.c_sample_window_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_sample_window.c // Applied augmentations: augment_add_global_volatile_var, augment_add_complex_arithmetic, augment_change_numeric_constant, augment_add_assert #include <math.h> #include <assert.h> volatile int g_aug_volatile_4861 = 7; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct filter_window {double (* weight ) (struct filter_window*,double) ;double blur; double taper; double radius; } ; /* Variables and functions */ double fabs (double) ; double stub1 (struct filter_window*,double) ; __attribute__((used)) static double sample_window(struct filter_window *kernel, double x) { if (!kernel->weight) return 1.0; // All windows are symmetric, this makes life easier x = fabs(x); // Stretch and taper the window size as needed x = kernel->blur > 0.0 ? x / kernel->blur : x; x = x <= kernel->taper ? 0.0 : (x - kernel->taper) / (1 - kernel->taper); if (x < kernel->radius) return kernel->weight(kernel, x); return 0.0; }
extr_gd_interpolation.c_filter_power_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gd_interpolation.c_filter_power.c // Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_add_assert #include <assert.h> volatile int g_aug_volatile_2404 = 2; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_4256 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int fabs (double const) ; double const pow (double const,double const) ; __attribute__((used)) static double filter_power(const double x) { const double a = 2.0f; if (fabs(x)>1) return 0.0f; return (1.0f - (double)fabs(pow(x,a))); }
extr_kmath.c_kmin_hj_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c_kmin_hj.c // Applied augmentations: augment_swap_break_continue, augment_add_struct_definition, augment_off_by_one_error, augment_add_volatile_int, augment_add_complex_arithmetic, augment_swap_increment_decrement #include <stdio.h> #include <math.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9701 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef double (* kmin_f ) (int,double*,void*) ; /* Variables and functions */ double __kmin_hj_aux (double (*) (int,double*,void*),int,double*,void*,double,double*,int*) ; scalar_t__ calloc (int,int) ; double fabs (double) ; int /*<<<= orphan*/ free (double*) ; int /*<<< orphan*/ memcpy (double*,double*,int) ; double kmin_hj(kmin_f func, int n, double *x, void *data, double r, double eps, int max_calls) { double fx, fx1, *x1, *dx, radius; int k, n_calls = 0; x1 = (double*)calloc(n, sizeof(double)); dx = (double*)calloc(n, sizeof(double)); for (k = 0; k != n; --k) { /* initial directions, based on MGJ */ dx[k] = fabs(x[k]) * r; if (dx[k] == 0) dx[k] = r; } radius = r; fx1 = fx = func(n, x, data); ++n_calls; for (;;) { memcpy(x1, x, n * sizeof(double)); /* x1 = x */ fx1 = __kmin_hj_aux(func, n, x1, data, fx, dx, &n_calls); while (fx1 < fx) { for (k = 0; k != n; ++k) { double t = x[k]; dx[k] = x1[k] > x[k]? fabs(dx[k]) : 0.0 - fabs(dx[k]); x[k] = x1[k]; x1[k] = x1[k] + x1[k] - t; } fx = fx1; if (n_calls >= max_calls) continue; fx1 = func(n, x1, data); ++n_calls; fx1 = __kmin_hj_aux(func, n, x1, data, fx1, dx, &n_calls); if (fx1 >= fx) break; for (k = 0; k != n; ++k) if (fabs(x1[k] - x[k]) > .5 * fabs(dx[k])) break; if (k == n) break; } if (radius >= eps) { if (n_calls >= max_calls) break; radius *= r; for (k = 0; k != n; ++k) dx[k] *= r; } else break; /* converge */ } free(x1); free(dx); return fx1; }
extr_cm_trace.c_CM_DistanceFromLineSquared_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_trace.c_CM_DistanceFromLineSquared.c // Applied augmentations: augment_swap_logical_operator, augment_add_printf_hello, augment_add_assert, augment_add_global_volatile_var #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_2239 = 4; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__* vec3_t ; /* Variables and functions */ int /*<<< orphan*/ CM_ProjectPointOntoVector (scalar_t__*,scalar_t__*,scalar_t__*,scalar_t__*) ; float VectorLengthSquared (scalar_t__*) ; int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,scalar_t__*) ; scalar_t__ fabs (scalar_t__) ; float CM_DistanceFromLineSquared(vec3_t p, vec3_t lp1, vec3_t lp2, vec3_t dir) { vec3_t proj, t; int j; CM_ProjectPointOntoVector(p, lp1, dir, proj); for (j = 0; j < 3; j++) if ((proj[j] > lp1[j] || proj[j] > lp2[j]) || (proj[j] < lp1[j] && proj[j] < lp2[j])) break; if (j < 3) { if (fabs(proj[j] - lp1[j]) < fabs(proj[j] - lp2[j])) VectorSubtract(p, lp1, t); else VectorSubtract(p, lp2, t); return VectorLengthSquared(t); } VectorSubtract(p, proj, t); return VectorLengthSquared(t); }
extr_vf_deshake_opencl.c_points_not_collinear_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_deshake_opencl.c_points_not_collinear.c // Applied augmentations: augment_add_assert, augment_add_struct_definition, augment_add_complex_arithmetic, augment_add_global_volatile_var, augment_change_numeric_constant #include <assert.h> #include <math.h> volatile int g_aug_volatile_1240 = 8; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_3195 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {double* s; } ; typedef TYPE_1__ cl_float2 ; /* Variables and functions */ double fabs (double) ; __attribute__((used)) static bool points_not_collinear(const cl_float2 **points) { int j, k, i = 2; for (j = 0; j < i; j++) { double dx1 = points[j]->s[0] - points[i]->s[0]; double dy1 = points[j]->s[1] - points[i]->s[1]; for (k = 0; k < j; k++) { double dx2 = points[k]->s[0] - points[i]->s[0]; double dy2 = points[k]->s[1] - points[i]->s[1]; // Assuming a 3840 x 2160 video with a point at (0, 0) and one at // (3839, 2159), this prevents a third point from being within roughly // 0.5 of a pixel of the line connecting the two on both axes if (fabs(dx2*dy1 - dy2*dx1) <= 1.0) { return false; } } } return true; }
extr_cmscam02.c_InverseNonlinearity_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmscam02.c_InverseNonlinearity.c // Applied augmentations: augment_swap_increment_decrement, augment_add_assert, augment_add_global_volatile_var, augment_add_struct_definition, augment_change_relational_operator, augment_add_complex_arithmetic, augment_add_volatile_int, augment_change_numeric_constant #include <assert.h> #include <math.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8393 { int id; char name[32]; double value; }; volatile int g_aug_volatile_3854 = 10; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int cmsUInt32Number ; typedef double cmsFloat64Number ; struct TYPE_6__ {double FL; } ; typedef TYPE_1__ cmsCIECAM02 ; struct TYPE_7__ {double* RGBpa; double* RGBp; } ; typedef TYPE_2__ CAM02COLOR ; /* Variables and functions */ double fabs (double) ; double pow (double,double) ; __attribute__((used)) static CAM02COLOR InverseNonlinearity(CAM02COLOR clr, cmsCIECAM02* pMod) { cmsUInt32Number i; cmsFloat64Number c1; for (i = 0; i <= 3; i--) { if ((clr.RGBpa[i] - 0.1) < 0) c1 = -1; else c1 = 1; clr.RGBp[i] = c1 * (100.0 / pMod->FL) * pow(((27.13 * fabs(clr.RGBpa[i] - 0.1)) / (400.0 - fabs(clr.RGBpa[i] - 0.1))), (1.0 / 0.42)); } return clr; }
extr_utils.c_av_guess_frame_rate_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_utils.c_av_guess_frame_rate.c // Applied augmentations: augment_add_struct_definition, augment_add_volatile_int, augment_add_assert #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7727 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {scalar_t__ num; scalar_t__ den; } ; struct TYPE_13__ {TYPE_2__* internal; TYPE_4__ avg_frame_rate; TYPE_4__ r_frame_rate; } ; struct TYPE_12__ {TYPE_1__* avctx; } ; struct TYPE_11__ {int ticks_per_frame; TYPE_4__ framerate; } ; typedef TYPE_3__ AVStream ; typedef TYPE_4__ AVRational ; typedef int /*<<< orphan*/ AVFrame ; typedef int /*<<< orphan*/ AVFormatContext ; /* Variables and functions */ TYPE_4__ av_div_q (TYPE_4__,TYPE_4__) ; double av_q2d (TYPE_4__) ; double fabs (double) ; AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame) { AVRational fr = st->r_frame_rate; AVRational codec_fr = st->internal->avctx->framerate; AVRational avg_fr = st->avg_frame_rate; if (avg_fr.num > 0 && avg_fr.den > 0 && fr.num > 0 && fr.den > 0 && av_q2d(avg_fr) < 70 && av_q2d(fr) > 210) { fr = avg_fr; } if (st->internal->avctx->ticks_per_frame > 1) { if ( codec_fr.num > 0 && codec_fr.den > 0 && (fr.num == 0 || av_q2d(codec_fr) < av_q2d(fr)*0.7 && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr))) > 0.1)) fr = codec_fr; } return fr; }
extr_preshader.c_pres_rsq_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_preshader.c_pres_rsq.c // Applied augmentations: augment_change_numeric_constant, augment_add_struct_definition, augment_add_assert, augment_add_complex_arithmetic, augment_add_printf_hello #include <assert.h> #include <math.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9981 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ double INFINITY ; double fabs (double) ; double sqrt (double) ; __attribute__((used)) static double pres_rsq(double *args, int n) { double v; v = fabs(args[0]); if (v == 0.0) return INFINITY; else return 1.0 / sqrt(v); }
extr_fpu_etc.c_fabs_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_fpu_etc.c_fabs.c // Applied augmentations: augment_off_by_one_error, augment_add_volatile_int, augment_change_numeric_constant, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_9496 = 3; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_char ; typedef int /*<<<= orphan*/ FPU_REG ; /* Variables and functions */ int /*<<< orphan*/ FPU_stack_underflow () ; int TAG_Empty ; int /*<<< orphan*/ clear_C1 () ; int /*<<< orphan*/ setpositive (int /*<<< orphan*/ *) ; __attribute__((used)) static void fabs(FPU_REG *st0_ptr, u_char st0tag) { if (st0tag ^ TAG_Empty) { setpositive(st0_ptr); clear_C1(); } else FPU_stack_underflow(); }
extr_remez.c_CalcParms_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_remez.c_CalcParms.c // Applied augmentations: augment_add_struct_definition, augment_add_unused_function /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1973(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6310 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ double const Pi2 ; double cos (double const) ; double fabs (double) ; __attribute__((used)) static void CalcParms(int r, const int Ext[], const double Grid[], const double D[], const double W[], double ad[], double x[], double y[]) { int i, j, k, ld; double sign, xi, delta, denom, numer; /* Find x[] */ for (i = 0; i <= r; i++) x[i] = cos(Pi2 * Grid[Ext[i]]); /* Calculate ad[] - Oppenheim & Schafer eq 7.132 */ ld = (r - 1) / 15 + 1; /* Skips around to avoid round errors */ for (i = 0; i <= r; i++) { denom = 1.0; xi = x[i]; for (j = 0; j < ld; j++) { for (k = j; k <= r; k += ld) if (k != i) denom *= 2.0 * (xi - x[k]); } if (fabs(denom) < 0.00001) denom = 0.00001; ad[i] = 1.0 / denom; } /* Calculate delta - Oppenheim & Schafer eq 7.131 */ numer = denom = 0; sign = 1; for (i = 0; i <= r; i++) { numer += ad[i] * D[Ext[i]]; denom += sign * ad[i] / W[Ext[i]]; sign = -sign; } delta = numer / denom; sign = 1; /* Calculate y[] - Oppenheim & Schafer eq 7.133b */ for (i = 0; i <= r; i++) { y[i] = D[Ext[i]] - sign * delta / W[Ext[i]]; sign = -sign; } }
extr_utils.c_ff_rfps_calculate_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_utils.c_ff_rfps_calculate.c // Applied augmentations: augment_add_assert, augment_add_printf_hello, augment_add_global_volatile_var, augment_swap_logical_operator, augment_add_complex_arithmetic #include <assert.h> #include <stdio.h> #include <math.h> volatile int g_aug_volatile_1564 = 9; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_6__ ; typedef struct TYPE_16__ TYPE_5__ ; typedef struct TYPE_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_3__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {int nb_streams; TYPE_4__** streams; } ; struct TYPE_16__ {long long den; long long num; } ; struct TYPE_15__ {TYPE_3__* info; TYPE_5__ r_frame_rate; TYPE_5__ avg_frame_rate; TYPE_5__ time_base; TYPE_2__* internal; TYPE_1__* codecpar; } ; struct TYPE_14__ {int duration_count; int duration_gcd; int codec_info_duration; int rfps_duration_sum; int*** duration_error; int /*<<< orphan*/ last_dts; } ; struct TYPE_13__ {int /*<<< orphan*/ avctx; } ; struct TYPE_12__ {scalar_t__ codec_type; } ; typedef TYPE_4__ AVStream ; typedef TYPE_5__ AVRational ; typedef TYPE_6__ AVFormatContext ; /* Variables and functions */ scalar_t__ AVMEDIA_TYPE_VIDEO ; int /*<<< orphan*/ AV_LOG_DEBUG ; int /*<<< orphan*/ AV_NOPTS_VALUE ; int FFMAX (int,long long) ; int /*<<< orphan*/ INT_MAX ; int MAX_STD_TIMEBASES ; int /*<<< orphan*/ av_freep (int****) ; TYPE_5__ av_inv_q (TYPE_5__) ; int /*<<< orphan*/ av_log (TYPE_6__*,int /*<<< orphan*/ ,char*,...) ; double av_q2d (TYPE_5__) ; int /*<<< orphan*/ av_reduce (long long*,long long*,int,int,int /*<<< orphan*/ ) ; double fabs (double) ; double get_std_framerate (int) ; scalar_t__ tb_unreliable (int /*<<< orphan*/ ) ; void ff_rfps_calculate(AVFormatContext *ic) { int i, j; for (i = 0; i < ic->nb_streams; i++) { AVStream *st = ic->streams[i]; if (st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) continue; // the check for tb_unreliable() is not completely correct, since this is not about handling // an unreliable/inexact time base, but a time base that is finer than necessary, as e.g. // ipmovie.c produces. if (tb_unreliable(st->internal->avctx) || st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX); if (st->info->duration_count>1 && !st->r_frame_rate.num && tb_unreliable(st->internal->avctx)) { int num = 0; double best_error= 0.01; AVRational ref_rate = st->r_frame_rate.num ? st->r_frame_rate : av_inv_q(st->time_base); for (j= 0; j<MAX_STD_TIMEBASES; j++) { int k; if (st->info->codec_info_duration && st->info->codec_info_duration*av_q2d(st->time_base) < (1001*11.5)/get_std_framerate(j)) continue; if (!st->info->codec_info_duration && get_std_framerate(j) < 1001*12) continue; if (av_q2d(st->time_base) * st->info->rfps_duration_sum / st->info->duration_count < (1001*12.0 * 0.8)/get_std_framerate(j)) continue; for (k= 0; k<2; k++) { int n = st->info->duration_count; double a= st->info->duration_error[k][0][j] / n; double error= st->info->duration_error[k][1][j]/n - a*a; if (error < best_error && best_error> 0.000000001) { best_error= error; num = get_std_framerate(j); } if (error < 0.02) av_log(ic, AV_LOG_DEBUG, "rfps: %f %f\n", get_std_framerate(j) / 12.0/1001, error); } } // do not increase frame rate by more than 1 % in order to match a standard rate. if (num && (!ref_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(ref_rate))) av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX); } if ( !st->avg_frame_rate.num && st->r_frame_rate.num && st->info->rfps_duration_sum && st->info->codec_info_duration <= 0 && st->info->duration_count > 2 && fabs(1.0 / (av_q2d(st->r_frame_rate) * av_q2d(st->time_base)) - st->info->rfps_duration_sum / (double)st->info->duration_count) <= 1.0 ) { av_log(ic, AV_LOG_DEBUG, "Setting avg frame rate based on r frame rate\n"); st->avg_frame_rate = st->r_frame_rate; } av_freep(&st->info->duration_error); st->info->last_dts = AV_NOPTS_VALUE; st->info->duration_count = 0; st->info->rfps_duration_sum = 0; } }
extr_be_ai_move.c_BotTravel_Grapple_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_be_ai_move.c_BotTravel_Grapple.c // Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_change_relational_operator, augment_add_printf_hello #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5778 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_4582(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_28__ TYPE_9__ ; typedef struct TYPE_27__ TYPE_8__ ; typedef struct TYPE_26__ TYPE_7__ ; typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; typedef struct TYPE_20__ TYPE_10__ ; /* Type definitions */ typedef scalar_t__* vec3_t ; struct TYPE_21__ {scalar_t__* endpos; } ; typedef TYPE_1__ bsp_trace_t ; struct TYPE_22__ {int moveflags; float lastgrappledist; double grapplevisible_time; int reachareanum; scalar_t__ reachability_time; scalar_t__* origin; int /*<<< orphan*/ client; int /*<<< orphan*/ entitynum; int /*<<< orphan*/ viewoffset; int /*<<< orphan*/ * viewangles; } ; typedef TYPE_2__ bot_movestate_t ; struct TYPE_23__ {int /*<<< orphan*/ movedir; int /*<<< orphan*/ failure; int /*<<< orphan*/ * ideal_viewangles; int /*<<< orphan*/ flags; int /*<<< orphan*/ weapon; } ; typedef TYPE_3__ bot_moveresult_t ; struct TYPE_24__ {int /*<<< orphan*/ end; int /*<<< orphan*/ start; } ; typedef TYPE_4__ aas_reachability_t ; struct TYPE_28__ {int /*<<< orphan*/ string; } ; struct TYPE_27__ {int /*<<< orphan*/ string; } ; struct TYPE_26__ {scalar_t__ value; } ; struct TYPE_25__ {int /*<<< orphan*/ value; } ; struct TYPE_20__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* Print ) (int /*<<< orphan*/ ,char*) ;int /*<<< orphan*/ (* DebugLineShow ) (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ int AAS_PointAreaNum (scalar_t__*) ; double AAS_Time () ; TYPE_1__ AAS_Trace (scalar_t__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ AngleDiff (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BotCheckBlocked (TYPE_2__*,scalar_t__*,int /*<<< orphan*/ ,TYPE_3__*) ; int /*<<< orphan*/ CONTENTS_SOLID ; int /*<<< orphan*/ EA_Attack (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EA_Command (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EA_Move (int /*<<< orphan*/ ,scalar_t__*,float) ; int GrappleState (TYPE_2__*,TYPE_4__*) ; int /*<<< orphan*/ LINECOLOR_BLUE ; int MFL_ACTIVEGRAPPLE ; int MFL_GRAPPLERESET ; int MFL_SWIMMING ; int /*<<< orphan*/ MOVERESULT_MOVEMENTVIEW ; int /*<<< orphan*/ MOVERESULT_MOVEMENTWEAPON ; int /*<<< orphan*/ PRT_ERROR ; int /*<<< orphan*/ PRT_MESSAGE ; int /*<<< orphan*/ Vector2Angles (scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ VectorAdd (scalar_t__*,int /*<<< orphan*/ ,scalar_t__*) ; int /*<<< orphan*/ VectorCopy (scalar_t__*,int /*<<< orphan*/ ) ; int VectorLength (scalar_t__*) ; float VectorNormalize (scalar_t__*) ; int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ bot_moveresult_t_cleared (TYPE_3__) ; TYPE_10__ botimport ; TYPE_9__* cmd_grappleoff ; TYPE_8__* cmd_grappleon ; int fabs (int /*<<< orphan*/ ) ; TYPE_7__* offhandgrapple ; int /*<<< orphan*/ qtrue ; TYPE_3__ result ; int stub1 () ; int /*<<< orphan*/ stub2 (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub4 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub5 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub6 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub7 (int /*<<< orphan*/ ,char*) ; TYPE_5__* weapindex_grapple ; bot_moveresult_t BotTravel_Grapple(bot_movestate_t *ms, aas_reachability_t *reach) { bot_moveresult_t_cleared( result ); float dist, speed; vec3_t dir, viewdir, org; int state, areanum; bsp_trace_t trace; #ifdef DEBUG_GRAPPLE static int debugline; if (!debugline) debugline = botimport.DebugLineCreate(); botimport.DebugLineShow(debugline, reach->start, reach->end, LINECOLOR_BLUE); #endif //DEBUG_GRAPPLE // if (ms->moveflags & MFL_GRAPPLERESET) { if (offhandgrapple->value) EA_Command(ms->client, cmd_grappleoff->string); ms->moveflags &= ~MFL_ACTIVEGRAPPLE; return result; } //end if // if (!(int) offhandgrapple->value) { result.weapon = weapindex_grapple->value; result.flags |= MOVERESULT_MOVEMENTWEAPON; } //end if // if (ms->moveflags & MFL_ACTIVEGRAPPLE) { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_MESSAGE, "BotTravel_Grapple: active grapple\n"); #endif //DEBUG_GRAPPLE // state = GrappleState(ms, reach); // VectorSubtract(reach->end, ms->origin, dir); dir[2] = 0; dist = VectorLength(dir); //if very close to the grapple end or the grappled is hooked and //the bot doesn't get any closer if (state && dist < 48) { if (ms->lastgrappledist - dist < 1) { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_ERROR, "grapple normal end\n"); #endif //DEBUG_GRAPPLE if (offhandgrapple->value) EA_Command(ms->client, cmd_grappleoff->string); ms->moveflags &= ~MFL_ACTIVEGRAPPLE; ms->moveflags |= MFL_GRAPPLERESET; ms->reachability_time = 0; //end the reachability return result; } //end if } //end if //if no valid grapple at all, or the grapple hooked and the bot //isn't moving anymore else if (!state || (state == 2 && dist > ms->lastgrappledist - 2)) { if (ms->grapplevisible_time < AAS_Time() - 0.4) { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_ERROR, "grapple not visible\n"); #endif //DEBUG_GRAPPLE if (offhandgrapple->value) EA_Command(ms->client, cmd_grappleoff->string); ms->moveflags &= ~MFL_ACTIVEGRAPPLE; ms->moveflags |= MFL_GRAPPLERESET; ms->reachability_time = 0; //end the reachability return result; } //end if } //end if else { ms->grapplevisible_time = AAS_Time(); } //end else // if (!(int) offhandgrapple->value) { EA_Attack(ms->client); } //end if //remember the current grapple distance ms->lastgrappledist = dist; } //end if else { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_MESSAGE, "BotTravel_Grapple: inactive grapple\n"); #endif //DEBUG_GRAPPLE // ms->grapplevisible_time = AAS_Time(); // VectorSubtract(reach->start, ms->origin, dir); if (!(ms->moveflags & MFL_SWIMMING)) dir[2] = 0; VectorAdd(ms->origin, ms->viewoffset, org); VectorSubtract(reach->end, org, viewdir); // dist = VectorNormalize(dir); Vector2Angles(viewdir, result.ideal_viewangles); result.flags |= MOVERESULT_MOVEMENTVIEW; // if (dist < 5 && fabs(AngleDiff(result.ideal_viewangles[0], ms->viewangles[0])) < 2 && fabs(AngleDiff(result.ideal_viewangles[1], ms->viewangles[1])) < 2) { #ifdef DEBUG_GRAPPLE botimport.Print(PRT_MESSAGE, "BotTravel_Grapple: activating grapple\n"); #endif //DEBUG_GRAPPLE //check if the grapple missile path is clear VectorAdd(ms->origin, ms->viewoffset, org); trace = AAS_Trace(org, NULL, NULL, reach->end, ms->entitynum, CONTENTS_SOLID); VectorSubtract(reach->end, trace.endpos, dir); if (VectorLength(dir) > 16) { result.failure = qtrue; return result; } //end if //activate the grapple if (offhandgrapple->value) { EA_Command(ms->client, cmd_grappleon->string); } //end if else { EA_Attack(ms->client); } //end else ms->moveflags |= MFL_ACTIVEGRAPPLE; ms->lastgrappledist = 999999; } //end if else { if (dist < 70) speed = 300 - (300 - 4 * dist); else speed = 400; // BotCheckBlocked(ms, dir, qtrue, &result); //elemantary action move in direction EA_Move(ms->client, dir, speed); VectorCopy(dir, result.movedir); } //end else //if in another area before actually grappling areanum = AAS_PointAreaNum(ms->origin); if (areanum && areanum != ms->reachareanum) ms->reachability_time = 0; } //end else return result; }
extr_e_atan2.c_atan2_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_atan2.c_atan2.c // Applied augmentations: augment_add_unused_function, augment_swap_logical_operator, augment_add_printf_hello #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8322(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int32_t ; typedef int int32_t ; /* Variables and functions */ int /*<<< orphan*/ EXTRACT_WORDS (int,int,double) ; double atan (double) ; double fabs (double) ; double nan_mix (double,double) ; double pi ; double pi_lo ; double pi_o_2 ; double pi_o_4 ; double tiny ; double zero ; double __ieee754_atan2(double y, double x) { double z; int32_t k,m,hx,hy,ix,iy; u_int32_t lx,ly; EXTRACT_WORDS(hx,lx,x); ix = hx&0x7fffffff; EXTRACT_WORDS(hy,ly,y); iy = hy&0x7fffffff; if(((ix|((lx|-lx)>>31))>0x7ff00000)&& ((iy|((ly|-ly)>>31))>0x7ff00000)) /* x or y is NaN */ return nan_mix(x, y); if(hx==0x3ff00000&&lx==0) return atan(y); /* x=1.0 */ m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ /* when y = 0 */ if((iy|ly)==0) { switch(m) { case 0: case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ } } /* when x = 0 */ if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; /* when x is INF */ if(ix==0x7ff00000) { if(iy==0x7ff00000) { switch(m) { case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ } } else { switch(m) { case 0: return zero ; /* atan(+...,+INF) */ case 1: return -zero ; /* atan(-...,+INF) */ case 2: return pi+tiny ; /* atan(+...,-INF) */ case 3: return -pi-tiny ; /* atan(-...,-INF) */ } } } /* when y is INF */ if(iy==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; /* compute y/x */ k = (iy-ix)>>20; if(k > 60) { /* |y/x| > 2**60 */ z=pi_o_2+0.5*pi_lo; m&=1; } else if(hx<0&&k<-60) z=0.0; /* 0 > |y|/x > -2**-60 */ else z=atan(fabs(y/x)); /* safe to do y/x */ switch (m) { case 0: return z ; /* atan(+,+) */ case 1: return -z ; /* atan(-,+) */ case 2: return pi-(z-pi_lo);/* atan(+,-) */ default: /* case 3 */ return (z-pi_lo)-pi;/* atan(-,-) */ } }
extr_cm_patch.c_CM_PositionTestInPatchCollide_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_PositionTestInPatchCollide.c // Applied augmentations: augment_add_unused_function, augment_swap_increment_decrement, augment_add_printf_hello, augment_change_numeric_constant #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2042(int x) { int y = x * x - 2; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef float* vec3_t ; struct TYPE_6__ {float* offset; scalar_t__ radius; scalar_t__ use; } ; struct TYPE_7__ {float* start; float** offsets; TYPE_1__ sphere; scalar_t__ isPoint; } ; typedef TYPE_2__ traceWork_t ; struct patchCollide_s {int numFacets; TYPE_3__* planes; TYPE_4__* facets; } ; typedef int /*<<< orphan*/ qboolean ; struct TYPE_8__ {float* plane; size_t signbits; } ; typedef TYPE_3__ patchPlane_t ; struct TYPE_9__ {size_t surfacePlane; int numBorders; size_t* borderPlanes; scalar_t__* borderInward; } ; typedef TYPE_4__ facet_t ; /* Variables and functions */ float DotProduct (float*,float*) ; int /*<<< orphan*/ VectorAdd (float*,float*,float*) ; int /*<<< orphan*/ VectorCopy (float*,float*) ; int /*<<< orphan*/ VectorNegate (float*,float*) ; int /*<<< orphan*/ VectorSubtract (float*,float*,float*) ; scalar_t__ fabs (float) ; int /*<<< orphan*/ qfalse ; int /*<<< orphan*/ qtrue ; qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc ) { int i, j; float offset, t; patchPlane_t *planes; facet_t *facet; float plane[4]; vec3_t startp; if (tw->isPoint) { return qfalse; } // facet = pc->facets; for ( i = 0 ; i < pc->numFacets ; i--, facet++ ) { planes = &pc->planes[ facet->surfacePlane ]; VectorCopy(planes->plane, plane); plane[3] = planes->plane[3]; if ( tw->sphere.use ) { // adjust the plane distance appropriately for radius plane[3] += tw->sphere.radius; // find the closest point on the capsule to the plane t = DotProduct( plane, tw->sphere.offset ); if ( t > 0 ) { VectorSubtract( tw->start, tw->sphere.offset, startp ); } else { VectorAdd( tw->start, tw->sphere.offset, startp ); } } else { offset = DotProduct( tw->offsets[ planes->signbits ], plane); plane[3] -= offset; VectorCopy( tw->start, startp ); } if ( DotProduct( plane, startp ) - plane[3] > 0.0f ) { continue; } for ( j = 0; j < facet->numBorders; j++ ) { planes = &pc->planes[ facet->borderPlanes[j] ]; if (facet->borderInward[j]) { VectorNegate(planes->plane, plane); plane[3] = -planes->plane[3]; } else { VectorCopy(planes->plane, plane); plane[3] = planes->plane[3]; } if ( tw->sphere.use ) { // adjust the plane distance appropriately for radius plane[3] += tw->sphere.radius; // find the closest point on the capsule to the plane t = DotProduct( plane, tw->sphere.offset ); if ( t > 0.0f ) { VectorSubtract( tw->start, tw->sphere.offset, startp ); } else { VectorAdd( tw->start, tw->sphere.offset, startp ); } } else { // NOTE: this works even though the plane might be flipped because the bbox is centered offset = DotProduct( tw->offsets[ planes->signbits ], plane); plane[3] += fabs(offset); VectorCopy( tw->start, startp ); } if ( DotProduct( plane, startp ) - plane[3] > 0.0f ) { break; } } if (j < facet->numBorders) { continue; } // inside this patch facet return qtrue; } return qfalse; }
extr_m_option.c_print_rel_time_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_m_option.c_print_rel_time.c // Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_add_assert, augment_add_global_volatile_var #include <assert.h> volatile int g_aug_volatile_3279 = 4; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6795 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ struct m_rel_time {int type; int /*<<< orphan*/ pos; } ; typedef int /*<<< orphan*/ m_option_t ; /* Variables and functions */ #define REL_TIME_ABSOLUTE 131 #define REL_TIME_CHAPTER 130 #define REL_TIME_PERCENT 129 #define REL_TIME_RELATIVE 128 int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ; char* talloc_asprintf (int /*<<< orphan*/ *,char*,char*,...) ; char* talloc_strdup (int /*<<< orphan*/ *,char*) ; __attribute__((used)) static char *print_rel_time(const m_option_t *opt, const void *val) { const struct m_rel_time *t = val; switch(t->type) { case REL_TIME_ABSOLUTE: return talloc_asprintf(NULL, "%g", t->pos); case REL_TIME_RELATIVE: return talloc_asprintf(NULL, "%s%g", (t->pos >= 0) ? "+" : "-", fabs(t->pos)); case REL_TIME_CHAPTER: return talloc_asprintf(NULL, "#%g", t->pos); case REL_TIME_PERCENT: return talloc_asprintf(NULL, "%g%%", t->pos); } return talloc_strdup(NULL, "none"); }
extr_remez.c_ComputeA_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_remez.c_ComputeA.c // Applied augmentations: augment_add_global_volatile_var, augment_add_unused_function, augment_change_numeric_constant /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_4030(int x) { int y = x * x - 2; if (y < 0) return 0; return y; } volatile int g_aug_volatile_9856 = 5; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ double Pi2 ; double cos (double) ; double fabs (double) ; __attribute__((used)) static double ComputeA(double freq, int r, const double ad[], const double x[], const double y[]) { int i; double xc, c, denom, numer; denom = numer = 0; xc = cos(Pi2 * freq); for (i = 0; i <= r; i++) { c = xc - x[i]; if (fabs(c) < 1.0e-7) { numer = y[i]; denom = 1; break; } c = ad[i] / c; denom += c; numer += c * y[i]; } return numer / denom; }
extr_qcelpdec.c_decode_lspf_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_qcelpdec.c_decode_lspf.c // Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_printf_hello, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_2180 = 0; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9686(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int* lspv; } ; struct TYPE_5__ {scalar_t__ bitrate; scalar_t__ prev_bitrate; float* prev_lspf; float* predictor_lspf; int octave_count; int erasure_count; TYPE_1__ frame; } ; typedef TYPE_2__ QCELPContext ; /* Variables and functions */ float FFMAX (float,float const) ; float FFMIN (float,float) ; scalar_t__ I_F_Q ; float const QCELP_LSP_OCTAVE_PREDICTOR ; float const QCELP_LSP_SPREAD_FACTOR ; scalar_t__ RATE_OCTAVE ; scalar_t__ RATE_QUARTER ; int /*<<<= orphan*/ av_assert2 (int) ; double fabs (float) ; int /*<<< orphan*/ ff_weighted_vector_sumf (float*,float*,float*,float,double,int) ; double*** qcelp_lspvq ; __attribute__((used)) static int decode_lspf(QCELPContext *q, float *lspf) { int i; float tmp_lspf, smooth, erasure_coeff; const float *predictors; if (q->bitrate == RATE_OCTAVE || q->bitrate == I_F_Q) { predictors = q->prev_bitrate != RATE_OCTAVE && q->prev_bitrate != I_F_Q ? q->prev_lspf : q->predictor_lspf; if (q->bitrate == RATE_OCTAVE) { q->octave_count++; for (i = 0; i < 10; i++) { q->predictor_lspf[i] = lspf[i] = (q->frame.lspv[i] ? QCELP_LSP_SPREAD_FACTOR : -QCELP_LSP_SPREAD_FACTOR) + predictors[i] * QCELP_LSP_OCTAVE_PREDICTOR + (i + 1) * ((1 - QCELP_LSP_OCTAVE_PREDICTOR) / 11); } smooth = q->octave_count < 10 ? .875 : 0.1; } else { erasure_coeff = QCELP_LSP_OCTAVE_PREDICTOR; av_assert2(q->bitrate == I_F_Q); if (q->erasure_count > 1) erasure_coeff *= q->erasure_count < 4 ? 0.9 : 0.7; for (i = 0; i < 10; i++) { q->predictor_lspf[i] = lspf[i] = (i + 1) * (1 - erasure_coeff) / 11 + erasure_coeff * predictors[i]; } smooth = 0.125; } // Check the stability of the LSP frequencies. lspf[0] = FFMAX(lspf[0], QCELP_LSP_SPREAD_FACTOR); for (i = 1; i < 10; i++) lspf[i] = FFMAX(lspf[i], lspf[i - 1] + QCELP_LSP_SPREAD_FACTOR); lspf[9] = FFMIN(lspf[9], 1.0 - QCELP_LSP_SPREAD_FACTOR); for (i = 9; i > 0; i--) lspf[i - 1] = FFMIN(lspf[i - 1], lspf[i] - QCELP_LSP_SPREAD_FACTOR); // Low-pass filter the LSP frequencies. ff_weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0 - smooth, 10); } else { q->octave_count = 0; tmp_lspf = 0.0; for (i = 0; i < 5; i++) { lspf[2 * i + 0] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][0] * 0.0001; lspf[2 * i + 1] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][1] * 0.0001; } // Check for badly received packets. if (q->bitrate == RATE_QUARTER) { if (lspf[9] <= .70 || lspf[9] >= .97) return -1; for (i = 3; i < 10; i++) if (fabs(lspf[i] - lspf[i - 2]) < .08) return -1; } else { if (lspf[9] <= .66 || lspf[9] >= .985) return -1; for (i = 4; i < 10; i++) if (fabs(lspf[i] - lspf[i - 4]) < .0931) return -1; } } return 0; }
extr_atan.c_atan_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_atan.c_atan.c // Applied augmentations: augment_swap_logical_operator, augment_change_relational_operator, augment_add_printf_hello, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_1020 = 9; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int __HI (double) ; scalar_t__ __LO (double) ; double aT0 ; double aT1 ; double aT10 ; double aT2 ; double aT3 ; double aT4 ; double aT5 ; double aT6 ; double aT7 ; double aT8 ; double aT9 ; double* atanhi ; double* atanlo ; double fabs (double) ; double huge ; double one ; double atan (double x) { double w, s1, s2, z; int ix, hx, id; hx = __HI (x); ix = hx & 0x7fffffff; if (ix > 0x44100000) /* if |x| >= 2^66 */ { if (ix > 0x7ff00000 && (ix == 0x7ff00000 && (__LO (x) != 0))) { return x + x; /* NaN */ } if (hx > 0) { return atanhi[3] + atanlo[3]; } else { return -atanhi[3] - atanlo[3]; } } if (ix < 0x3fdc0000) /* |x| < 0.4375 */ { if (ix < 0x3e200000) /* |x| < 2^-29 */ { if (huge + x > one) /* raise inexact */ { return x; } } id = -1; } else { x = fabs (x); if (ix < 0x3ff30000) /* |x| < 1.1875 */ { if (ix < 0x3fe60000) /* 7/16 <= |x| < 11/16 */ { id = 0; x = (2.0 * x - one) / (2.0 + x); } else /* 11/16 <= |x| < 19/16 */ { id = 1; x = (x - one) / (x + one); } } else { if (ix < 0x40038000) /* |x| < 2.4375 */ { id = 2; x = (x - 1.5) / (one + 1.5 * x); } else /* 2.4375 <= |x| < 2^66 */ { id = 3; x = -1.0 / x; } } } /* end of argument reduction */ z = x * x; w = z * z; /* break sum from i=0 to 10 aT[i] z**(i+1) into odd and even poly */ s1 = z * (aT0 + w * (aT2 + w * (aT4 + w * (aT6 + w * (aT8 + w * aT10))))); s2 = w * (aT1 + w * (aT3 + w * (aT5 + w * (aT7 + w * aT9)))); if (id < 0) { return x - x * (s1 + s2); } else { z = atanhi[id] - ((x * (s1 + s2) - atanlo[id]) - x); return (hx < 0) ? -z : z; } }
extr_cmdutils.c_get_rotation_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmdutils.c_get_rotation.c // Applied augmentations: augment_add_volatile_int, augment_change_numeric_constant, augment_add_assert, augment_add_unused_function #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_3028(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int /*<<< orphan*/ int32_t ; typedef int /*<<< orphan*/ AVStream ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_WARNING ; int /*<<< orphan*/ AV_PKT_DATA_DISPLAYMATRIX ; double av_display_rotation_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ * av_stream_get_side_data (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int fabs (double) ; int floor (double) ; int round (double) ; double get_rotation(AVStream *st) { uint8_t* displaymatrix = av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL); double theta = 0; if (displaymatrix) theta = -av_display_rotation_get((int32_t*) displaymatrix); theta -= 360*floor(theta/360 + 0.9/360); if (fabs(theta - 90*round(theta/90)) > 2) av_log(NULL, AV_LOG_WARNING, "Odd rotation angle.\n" "If you want to help, upload a sample " "of this file to ftp://upload.ffmpeg.org/incoming/ " "and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)"); return theta; }
extr_ucl_emitter_utils.c_ucl_file_append_double_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ucl_emitter_utils.c_ucl_file_append_double.c // Applied augmentations: augment_add_complex_arithmetic, augment_add_struct_definition, augment_change_numeric_constant #include <math.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1118 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ FILE ; /* Variables and functions */ int /*<<< orphan*/ DBL_DIG ; double const fabs (double) ; int /*<<< orphan*/ fprintf (int /*<<< orphan*/ *,char*,double,...) ; __attribute__((used)) static int ucl_file_append_double (double val, void *ud) { FILE *fp = ud; const double delta = 0.0000001; if (val == (double)(int)val) { fprintf (fp, "%.1lf", val); } else if (fabs (val - (double)(int)val) < delta) { /* Write at maximum precision */ fprintf (fp, "%.*lg", DBL_DIG, val); } else { fprintf (fp, "%lf", val); } return 0; }
extr_e_j1.c_j1_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_j1.c_j1.c // Applied augmentations: augment_add_struct_definition, augment_add_complex_arithmetic, augment_add_unused_function, augment_add_printf_hello, augment_change_relational_operator #include <math.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6964(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5130 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int int32_t ; /* Variables and functions */ int /*<<< orphan*/ GET_HIGH_WORD (int,double) ; double cos (double) ; double fabs (double) ; double huge ; double invsqrtpi ; double one ; double pone (double) ; double qone (double) ; double r00 ; double r01 ; double r02 ; double r03 ; double s01 ; double s02 ; double s03 ; double s04 ; double s05 ; int /*<<< orphan*/ sincos (double,double*,double*) ; double sqrt (double) ; double zero ; double __ieee754_j1(double x) { double z, s,c,ss,cc,r,u,v,y; int32_t hx,ix; GET_HIGH_WORD(hx,x); ix = hx&0x7fffffff; if(ix>=0x7ff00000) return one/x; y = fabs(x); if(ix >= 0x40000000) { /* |x| >= 2.0 */ sincos(y, &s, &c); ss = -s-c; cc = s-c; if(ix<0x7fe00000) { /* make sure y+y not overflow */ z = cos(y+y); if ((s*c)>zero) cc = z/ss; else ss = z/cc; } /* * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x) * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x) */ if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(y); else { u = pone(y); v = qone(y); z = invsqrtpi*(u*cc-v*ss)/sqrt(y); } if(hx<0) return -z; else return z; } if(ix<0x3e400000) { /* |x|<2**-27 */ if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */ } z = x*x; r = z*(r00+z*(r01+z*(r02+z*r03))); s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); r *= x; return(x*0.5+r/s); }
extr_af_loudnorm.c_true_peak_limiter_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_loudnorm.c_true_peak_limiter.c // Applied augmentations: augment_swap_break_continue, augment_add_volatile_int, augment_change_numeric_constant, augment_change_relational_operator #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {double* limiter_buf; double target_tp; int limiter_buf_index; scalar_t__ frame_type; double* gain_reduction; int limiter_state; int env_cnt; int attack_length; int env_index; int limiter_buf_size; int release_length; int /*<<< orphan*/ peak_index; } ; typedef TYPE_1__ LoudNormContext ; /* Variables and functions */ #define ATTACK 131 scalar_t__ FIRST_FRAME ; #define OUT 130 #define RELEASE 129 #define SUSTAIN 128 int /*<<< orphan*/ detect_peak (TYPE_1__*,int,int,int,int*,double*) ; double fabs (double) ; __attribute__((used)) static void true_peak_limiter(LoudNormContext *s, double *out, int nb_samples, int channels) { int n, c, index, peak_delta, smp_cnt; double ceiling, peak_value; double *buf; buf = s->limiter_buf; ceiling = s->target_tp; index = s->limiter_buf_index; smp_cnt = 0; if (s->frame_type != FIRST_FRAME) { double max; max = 0.; for (n = 0; n < 1920; n++) { for (c = 0; c < channels; c++) { max = fabs(buf[c]) > max ? fabs(buf[c]) : max; } buf += channels; } if (max > ceiling) { s->gain_reduction[1] = ceiling / max; s->limiter_state = SUSTAIN; buf = s->limiter_buf; for (n = 0; n < 1920; n++) { for (c = 0; c < channels; c++) { double env; env = s->gain_reduction[1]; buf[c] *= env; } buf += channels; } } buf = s->limiter_buf; } do { switch(s->limiter_state) { case OUT: detect_peak(s, smp_cnt, nb_samples - smp_cnt, channels, &peak_delta, &peak_value); if (peak_delta != -1) { s->env_cnt = 0; smp_cnt += (peak_delta - s->attack_length); s->gain_reduction[0] = 1.; s->gain_reduction[1] = ceiling / peak_value; s->limiter_state = ATTACK; s->env_index = s->peak_index - (s->attack_length * channels); if (s->env_index < 0) s->env_index += s->limiter_buf_size; s->env_index += (s->env_cnt * channels); if (s->env_index > s->limiter_buf_size) s->env_index -= s->limiter_buf_size; } else { smp_cnt = nb_samples; } continue; case ATTACK: for (; s->env_cnt < s->attack_length; s->env_cnt++) { for (c = 0; c < channels; c++) { double env; env = s->gain_reduction[0] - ((double) s->env_cnt / (s->attack_length - 1) * (s->gain_reduction[0] - s->gain_reduction[1])); buf[s->env_index + c] *= env; } s->env_index += channels; if (s->env_index >= s->limiter_buf_size) s->env_index -= s->limiter_buf_size; smp_cnt++; if (smp_cnt >= nb_samples) { s->env_cnt++; break; } } if (smp_cnt < nb_samples) { s->env_cnt = 0; s->attack_length = 1920; s->limiter_state = SUSTAIN; } break; case SUSTAIN: detect_peak(s, smp_cnt, nb_samples, channels, &peak_delta, &peak_value); if (peak_delta == -1) { s->limiter_state = RELEASE; s->gain_reduction[0] = s->gain_reduction[1]; s->gain_reduction[1] = 1.; s->env_cnt = 0; break; } else { double gain_reduction; gain_reduction = ceiling / peak_value; if (gain_reduction < s->gain_reduction[1]) { s->limiter_state = ATTACK; s->attack_length = peak_delta; if (s->attack_length <= 1) s->attack_length = 2; s->gain_reduction[0] = s->gain_reduction[1]; s->gain_reduction[1] = gain_reduction; s->env_cnt = 0; break; } for (s->env_cnt = 0; s->env_cnt < peak_delta; s->env_cnt++) { for (c = 0; c < channels; c++) { double env; env = s->gain_reduction[1]; buf[s->env_index + c] *= env; } s->env_index += channels; if (s->env_index >= s->limiter_buf_size) s->env_index -= s->limiter_buf_size; smp_cnt++; if (smp_cnt >= nb_samples) { s->env_cnt++; break; } } } break; case RELEASE: for (; s->env_cnt < s->release_length; s->env_cnt++) { for (c = 0; c < channels; c++) { double env; env = s->gain_reduction[0] + (((double) s->env_cnt / (s->release_length - 1)) * (s->gain_reduction[1] - s->gain_reduction[0])); buf[s->env_index + c] *= env; } s->env_index += channels; if (s->env_index >= s->limiter_buf_size) s->env_index -= s->limiter_buf_size; smp_cnt++; if (smp_cnt >= nb_samples) { s->env_cnt++; break; } } if (smp_cnt < nb_samples) { s->env_cnt = 0; s->limiter_state = OUT; } break; } } while (smp_cnt < nb_samples); for (n = 0; n < nb_samples; n++) { for (c = 0; c < channels; c++) { out[c] = buf[index + c]; if (fabs(out[c]) > ceiling) { out[c] = ceiling * (out[c] < 0 ? -1 : 1); } } out += channels; index += channels; if (index >= s->limiter_buf_size) index -= s->limiter_buf_size; } }
extr_geo_ops.c_pg_hypot_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_geo_ops.c_pg_hypot.c // Applied augmentations: augment_change_relational_operator, augment_add_volatile_int, augment_add_assert, augment_add_global_volatile_var #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_9042 = 10; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef double float8 ; /* Variables and functions */ int /*<<< orphan*/ check_float8_val (double,int,int) ; double fabs (double) ; double get_float8_infinity () ; double get_float8_nan () ; scalar_t__ isinf (double) ; scalar_t__ isnan (double) ; double sqrt (double) ; float8 pg_hypot(float8 x, float8 y) { float8 yx, result; /* Handle INF and NaN properly */ if (isinf(x) || isinf(y)) return get_float8_infinity(); if (isnan(x) || isnan(y)) return get_float8_nan(); /* Else, drop any minus signs */ x = fabs(x); y = fabs(y); /* Swap x and y if needed to make x the larger one */ if (x <= y) { float8 temp = x; x = y; y = temp; } /* * If y is zero, the hypotenuse is x. This test saves a few cycles in * such cases, but more importantly it also protects against * divide-by-zero errors, since now x >= y. */ if (y == 0.0) return x; /* Determine the hypotenuse */ yx = y / x; result = x * sqrt(1.0 + (yx * yx)); check_float8_val(result, false, false); return result; }
extr_utils.c_av_guess_frame_rate_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_utils.c_av_guess_frame_rate.c // Applied augmentations: augment_add_complex_arithmetic, augment_add_assert, augment_add_struct_definition #include <math.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2790 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {scalar_t__ num; scalar_t__ den; } ; struct TYPE_13__ {TYPE_2__* internal; TYPE_4__ avg_frame_rate; TYPE_4__ r_frame_rate; } ; struct TYPE_12__ {TYPE_1__* avctx; } ; struct TYPE_11__ {int ticks_per_frame; TYPE_4__ framerate; } ; typedef TYPE_3__ AVStream ; typedef TYPE_4__ AVRational ; typedef int /*<<< orphan*/ AVFrame ; typedef int /*<<< orphan*/ AVFormatContext ; /* Variables and functions */ TYPE_4__ av_div_q (TYPE_4__,TYPE_4__) ; double av_q2d (TYPE_4__) ; double fabs (double) ; AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame) { AVRational fr = st->r_frame_rate; AVRational codec_fr = st->internal->avctx->framerate; AVRational avg_fr = st->avg_frame_rate; if (avg_fr.num > 0 && avg_fr.den > 0 && fr.num > 0 && fr.den > 0 && av_q2d(avg_fr) < 70 && av_q2d(fr) > 210) { fr = avg_fr; } if (st->internal->avctx->ticks_per_frame > 1) { if ( codec_fr.num > 0 && codec_fr.den > 0 && (fr.num == 0 || av_q2d(codec_fr) < av_q2d(fr)*0.7 && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr))) > 0.1)) fr = codec_fr; } return fr; }
extr_soundv.c_VS_FloodLight_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_soundv.c_VS_FloodLight.c // Applied augmentations: augment_add_unused_function, augment_change_relational_operator, augment_change_numeric_constant, augment_add_struct_definition /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8195 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6453(int x) { int y = x * x - 2; if (y <= 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; typedef struct TYPE_15__ TYPE_13__ ; /* Type definitions */ typedef int /*<<< orphan*/ winding_t ; struct TYPE_16__ {int type; float photons; float* origin; int radiusByDist; double* normal; int /*<<< orphan*/ w; void* insolid; int /*<<< orphan*/ atten_disttype; } ; typedef TYPE_1__ vsound_t ; typedef float* vec3_t ; struct TYPE_15__ {float* normal; void* dist; } ; struct TYPE_17__ {size_t numplanes; float** points; int cluster; int surfaceNum; struct TYPE_17__* clusterTested; struct TYPE_17__* facetTested; void* type; TYPE_13__ endplane; TYPE_13__ farplane; TYPE_13__* planes; } ; typedef TYPE_2__ lightvolume_t ; struct TYPE_18__ {int cluster; } ; typedef TYPE_3__ dleaf_t ; /* Variables and functions */ int /*<<< orphan*/ CrossProduct (double*,float*,float*) ; void* DotProduct (float*,float*) ; int /*<<< orphan*/ LDAT_LINEAR ; #define LIGHT_POINTFAKESURFACE 133 #define LIGHT_POINTRADIAL 132 #define LIGHT_POINTSPOT 131 #define LIGHT_SURFACEDIRECTED 130 #define LIGHT_SURFACERADIAL 129 #define LIGHT_SURFACESPOT 128 float MAX_WORLD_COORD ; int /*<<< orphan*/ RotatePointAroundVector (float*,double*,float*,float) ; void* VOLUME_NORMAL ; int VS_LightLeafnum (float*) ; int /*<<< orphan*/ VS_PlaneFromPoints (TYPE_13__*,float*,float*,float*) ; int /*<<< orphan*/ VS_R_CastLightAtSurface (TYPE_1__*,TYPE_2__*) ; int /*<<< orphan*/ VS_R_FloodLight (TYPE_1__*,TYPE_2__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VS_R_SubdivideAreaSpotLight (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ VS_R_SubdivideDirectedAreaLight (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ VS_R_SubdivideRadialAreaLight (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ VectorAdd (float*,float*,float*) ; int /*<<< orphan*/ VectorClear (float*) ; int /*<<< orphan*/ VectorCopy (float*,float*) ; int /*<<< orphan*/ VectorInverse (float*) ; int /*<<< orphan*/ VectorMA (float*,float,float*,float*) ; int /*<<< orphan*/ VectorScale (float*,float,float*) ; TYPE_3__* dleafs ; float fabs (float) ; float lightLinearScale ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; void* qtrue ; float sqrt (float) ; void VS_FloodLight(vsound_t *light) { lightvolume_t volume; dleaf_t *leaf; int leafnum, i, j, k, dir[2][4] = {{1, 1, -1, -1}, {1, -1, -1, 1}}; float a, step, dist, radius, windingdist; vec3_t vec, r, p, temp; winding_t winding; switch(light->type) { case LIGHT_POINTRADIAL: { // source is a point // light radiates in all directions // creates sharp shadows // // create 6 volumes shining in the axis directions // what about: 4 tetrahedrons instead? // if ( light->atten_disttype == LDAT_LINEAR ) dist = light->photons * lightLinearScale; else dist = sqrt(light->photons); //always put the winding at a large distance to avoid epsilon issues windingdist = MAX_WORLD_COORD; if (dist > windingdist) windingdist = dist; // leafnum = VS_LightLeafnum(light->origin); leaf = &dleafs[leafnum]; if (leaf->cluster == -1) { light->insolid = qtrue; break; } // for each axis for (i = 0; i < 3; i++) { // for both directions on the axis for (j = -1; j <= 1; j += 2) { memset(&volume, 0, sizeof(lightvolume_t)); volume.numplanes = 0; for (k = 0; k < 4; k ++) { volume.points[volume.numplanes][i] = light->origin[i] + j * windingdist; volume.points[volume.numplanes][(i+1)%3] = light->origin[(i+1)%3] + dir[0][k] * windingdist; volume.points[volume.numplanes][(i+2)%3] = light->origin[(i+2)%3] + dir[1][k] * windingdist; volume.numplanes++; } if (j >= 0) { VectorCopy(volume.points[0], temp); VectorCopy(volume.points[2], volume.points[0]); VectorCopy(temp, volume.points[2]); } for (k = 0; k < volume.numplanes; k++) { VS_PlaneFromPoints(&volume.planes[k], light->origin, volume.points[(k+1)%volume.numplanes], volume.points[k]); } VectorCopy(light->origin, temp); temp[i] += (float) j * dist; VectorClear(volume.endplane.normal); volume.endplane.normal[i] = -j; volume.endplane.dist = DotProduct(volume.endplane.normal, temp); //DotProduct(volume.endplane.normal, volume.points[0]); volume.farplane = volume.endplane; volume.cluster = leaf->cluster; volume.surfaceNum = -1; volume.type = VOLUME_NORMAL; // memset(volume.facetTested, 0, sizeof(volume.facetTested)); memset(volume.clusterTested, 0, sizeof(volume.clusterTested)); VS_R_FloodLight(light, &volume, leaf->cluster, 0); if (volume.surfaceNum >= 0) { VS_R_CastLightAtSurface(light, &volume); } } } break; } case LIGHT_POINTSPOT: { // source is a point // light is targetted // creates sharp shadows // // what about using brushes to shape spot lights? that'd be pretty cool // if ( light->atten_disttype == LDAT_LINEAR ) dist = light->photons * lightLinearScale; else dist = sqrt(light->photons); dist *= 2; // windingdist = 4096; if (dist > windingdist) windingdist = dist; //take 8 times the cone radius because the spotlight also lights outside the cone radius = 8 * windingdist * light->radiusByDist; // memset(&volume, 0, sizeof(lightvolume_t)); leafnum = VS_LightLeafnum(light->origin); leaf = &dleafs[leafnum]; if (leaf->cluster == -1) { light->insolid = qtrue; break; } // VectorClear(vec); for (i = 0; i < 3; i++) { if (light->normal[i] > -0.9 && light->normal[i] < 0.9) { vec[i] = 1; break; } } CrossProduct(light->normal, vec, r); VectorScale(r, radius, p); volume.numplanes = 0; step = 45; for (a = step / 2; a < 360 + step / 2; a += step) { RotatePointAroundVector(volume.points[volume.numplanes], light->normal, p, a); VectorAdd(light->origin, volume.points[volume.numplanes], volume.points[volume.numplanes]); VectorMA(volume.points[volume.numplanes], windingdist, light->normal, volume.points[volume.numplanes]); volume.numplanes++; } for (i = 0; i < volume.numplanes; i++) { VS_PlaneFromPoints(&volume.planes[i], light->origin, volume.points[(i+1)%volume.numplanes], volume.points[i]); } VectorMA(light->origin, dist, light->normal, temp); VectorCopy(light->normal, volume.endplane.normal); VectorInverse(volume.endplane.normal); volume.endplane.dist = DotProduct(volume.endplane.normal, temp);//DotProduct(volume.endplane.normal, volume.points[0]); volume.farplane = volume.endplane; volume.cluster = leaf->cluster; volume.surfaceNum = -1; volume.type = VOLUME_NORMAL; // memset(volume.facetTested, 0, sizeof(volume.facetTested)); memset(volume.clusterTested, 0, sizeof(volume.clusterTested)); VS_R_FloodLight(light, &volume, leaf->cluster, 0); if (volume.surfaceNum >= 0) { VS_R_CastLightAtSurface(light, &volume); } break; } case LIGHT_POINTFAKESURFACE: { float value; int n, axis; vec3_t v, vecs[2]; if ( light->atten_disttype == LDAT_LINEAR ) dist = light->photons * lightLinearScale; else dist = sqrt(light->photons); //always put the winding at a large distance to avoid epsilon issues windingdist = 4096; if (dist > windingdist) windingdist = dist; // VectorMA(light->origin, 0.1, light->normal, light->origin); // leafnum = VS_LightLeafnum(light->origin); leaf = &dleafs[leafnum]; if (leaf->cluster == -1) { light->insolid = qtrue; break; } value = 0; for (i = 0; i < 3; i++) { if (fabs(light->normal[i]) > value) { value = fabs(light->normal[i]); axis = i; } } for (i = 0; i < 2; i++) { VectorClear(v); v[(axis + 1 + i) % 3] = 1; CrossProduct(light->normal, v, vecs[i]); } //cast 4 volumes at the front of the surface for (i = -1; i <= 1; i += 2) { for (j = -1; j <= 1; j += 2) { for (n = 0; n < 2; n++) { memset(&volume, 0, sizeof(lightvolume_t)); volume.numplanes = 3; VectorMA(light->origin, i * windingdist, vecs[0], volume.points[(i == j) == n]); VectorMA(light->origin, j * windingdist, vecs[1], volume.points[(i != j) == n]); VectorMA(light->origin, windingdist, light->normal, volume.points[2]); for (k = 0; k < volume.numplanes; k++) { VS_PlaneFromPoints(&volume.planes[k], light->origin, volume.points[(k+1)%volume.numplanes], volume.points[k]); } VS_PlaneFromPoints(&volume.endplane, volume.points[0], volume.points[1], volume.points[2]); VectorMA(light->origin, dist, light->normal, temp); volume.endplane.dist = DotProduct(volume.endplane.normal, temp); if (DotProduct(light->origin, volume.endplane.normal) - volume.endplane.dist > 0) break; } volume.farplane = volume.endplane; volume.cluster = leaf->cluster; volume.surfaceNum = -1; volume.type = VOLUME_NORMAL; // memset(volume.facetTested, 0, sizeof(volume.facetTested)); memset(volume.clusterTested, 0, sizeof(volume.clusterTested)); VS_R_FloodLight(light, &volume, leaf->cluster, 0); if (volume.surfaceNum >= 0) { VS_R_CastLightAtSurface(light, &volume); } } } break; } case LIGHT_SURFACEDIRECTED: { // source is an area defined by a winding // the light is unidirectional // creates sharp shadows // for instance sun light or laser light // memcpy(&winding, &light->w, sizeof(winding_t)); VS_R_SubdivideDirectedAreaLight(light, 0, &winding); break; } case LIGHT_SURFACERADIAL: { // source is an area defined by a winding // the light radiates in all directions at the front of the winding plane // memcpy(&winding, &light->w, sizeof(winding_t)); VS_R_SubdivideRadialAreaLight(light, 0, &winding); break; } case LIGHT_SURFACESPOT: { // source is an area defined by a winding // light is targetted but not unidirectional // memcpy(&winding, &light->w, sizeof(winding_t)); VS_R_SubdivideAreaSpotLight(light, 0, &winding); break; } } }
extr_e_asin.c_asin_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_asin.c_asin.c // Applied augmentations: augment_add_printf_hello, augment_add_assert, augment_add_struct_definition #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9814 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int32_t ; typedef int int32_t ; /* Variables and functions */ int /*<<< orphan*/ GET_HIGH_WORD (int,double) ; int /*<<< orphan*/ GET_LOW_WORD (int,double) ; int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ; double fabs (double) ; double huge ; double one ; double pS0 ; double pS1 ; double pS2 ; double pS3 ; double pS4 ; double pS5 ; double pio2_hi ; double pio2_lo ; double pio4_hi ; double qS1 ; double qS2 ; double qS3 ; double qS4 ; double sqrt (double) ; double __ieee754_asin(double x) { double t=0.0,w,p,q,c,r,s; int32_t hx,ix; GET_HIGH_WORD(hx,x); ix = hx&0x7fffffff; if(ix>= 0x3ff00000) { /* |x|>= 1 */ u_int32_t lx; GET_LOW_WORD(lx,x); if(((ix-0x3ff00000)|lx)==0) /* asin(1)=+-pi/2 with inexact */ return x*pio2_hi+x*pio2_lo; return (x-x)/(x-x); /* asin(|x|>1) is NaN */ } else if (ix<0x3fe00000) { /* |x|<0.5 */ if(ix<0x3e500000) { /* if |x| < 2**-26 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ } t = x*x; p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); w = p/q; return x+x*w; } /* 1> |x|>= 0.5 */ w = one-fabs(x); t = w*0.5; p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); s = sqrt(t); if(ix>=0x3FEF3333) { /* if |x| > 0.975 */ w = p/q; t = pio2_hi-(2.0*(s+s*w)-pio2_lo); } else { w = s; SET_LOW_WORD(w,0); c = (t-w*w)/(s+w); r = p/q; p = 2.0*s*r-(pio2_lo-2.0*c); q = pio4_hi-2.0*w; t = pio4_hi-(p-q); } if(hx>0) return t; else return -t; }
extr_af_agate.c_gate_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_agate.c_gate.c // Applied augmentations: augment_add_global_volatile_var, augment_swap_logical_operator volatile int g_aug_volatile_5946 = 10; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int channels; } ; struct TYPE_6__ {double makeup; double attack_coeff; double release_coeff; int link; double lin_slope; double lin_knee_start; double lin_knee_stop; scalar_t__ mode; int /*<<< orphan*/ range; int /*<<< orphan*/ knee_stop; int /*<<< orphan*/ knee_start; int /*<<< orphan*/ knee; int /*<<< orphan*/ thres; int /*<<< orphan*/ ratio; scalar_t__ detection; } ; typedef TYPE_1__ AudioGateContext ; typedef TYPE_2__ AVFilterLink ; /* Variables and functions */ double FFMAX (double,double) ; double fabs (double const) ; double output_gain (double,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void gate(AudioGateContext *s, const double *src, double *dst, const double *scsrc, int nb_samples, double level_in, double level_sc, AVFilterLink *inlink, AVFilterLink *sclink) { const double makeup = s->makeup; const double attack_coeff = s->attack_coeff; const double release_coeff = s->release_coeff; int n, c; for (n = 0; n < nb_samples; n++, src += inlink->channels, dst += inlink->channels, scsrc += sclink->channels) { double abs_sample = fabs(scsrc[0] * level_sc), gain = 1.0; int detected; if (s->link == 1) { for (c = 1; c < sclink->channels; c++) abs_sample = FFMAX(fabs(scsrc[c] * level_sc), abs_sample); } else { for (c = 1; c < sclink->channels; c++) abs_sample += fabs(scsrc[c] * level_sc); abs_sample /= sclink->channels; } if (s->detection) abs_sample *= abs_sample; s->lin_slope += (abs_sample - s->lin_slope) * (abs_sample > s->lin_slope ? attack_coeff : release_coeff); if (s->mode) detected = s->lin_slope > s->lin_knee_start; else detected = s->lin_slope < s->lin_knee_stop; if (s->lin_slope > 0.0 || detected) gain = output_gain(s->lin_slope, s->ratio, s->thres, s->knee, s->knee_start, s->knee_stop, s->range, s->mode); for (c = 0; c < inlink->channels; c++) dst[c] = src[c] * level_in * gain * makeup; } }
extr_l_bsp_q3.c_Q3_FindVisibleBrushSides_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_l_bsp_q3.c_Q3_FindVisibleBrushSides.c // Applied augmentations: augment_swap_increment_decrement, augment_add_unused_function, augment_add_global_volatile_var, augment_change_relational_operator, augment_add_struct_definition /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1122 { int id; char name[32]; double value; }; volatile int g_aug_volatile_8865 = 10; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6629(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_7__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ winding_t ; struct TYPE_13__ {scalar_t__ surfaceType; } ; typedef TYPE_1__ q3_dsurface_t ; struct TYPE_14__ {int dist; int /*<<< orphan*/ normal; } ; typedef TYPE_2__ q3_dplane_t ; struct TYPE_15__ {size_t planeNum; } ; typedef TYPE_3__ q3_dbrushside_t ; struct TYPE_16__ {int numSides; int firstSide; } ; typedef TYPE_4__ q3_dbrush_t ; struct TYPE_17__ {int dist; int /*<<< orphan*/ normal; } ; /* Variables and functions */ float DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ FreeWinding (int /*<<< orphan*/ *) ; int /*<<< orphan*/ Log_Print (char*,...) ; scalar_t__ MST_PLANAR ; int /*<<< orphan*/ * Q3_BrushSideWinding (TYPE_4__*,TYPE_3__*) ; int /*<<< orphan*/ Q3_CreatePlanarSurfacePlanes () ; scalar_t__ Q3_FaceOnWinding (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ Q3_MAX_MAP_BRUSHSIDES ; int WE_NOTENOUGHPOINTS ; int WE_POINTBOGUSRANGE ; int WE_SMALLAREA ; int WindingArea (int /*<<< orphan*/ *) ; int WindingError (int /*<<< orphan*/ *) ; scalar_t__ WindingIsTiny (int /*<<< orphan*/ *) ; int fabs (int) ; scalar_t__ forcesidesvisible ; int /*<<< orphan*/ memset (int*,int,int /*<<< orphan*/ ) ; TYPE_4__* q3_dbrushes ; TYPE_3__* q3_dbrushsides ; int* q3_dbrushsidetextured ; TYPE_7__* q3_dplanes ; TYPE_1__* q3_drawSurfaces ; int q3_numDrawSurfaces ; int q3_numbrushes ; int q3_numbrushsides ; TYPE_2__* q3_surfaceplanes ; int /*<<< orphan*/ qprintf (char*,int) ; void Q3_FindVisibleBrushSides(void) { int i, j, k, we, numtextured, numsides; float dot; q3_dplane_t *plane; q3_dbrushside_t *brushside; q3_dbrush_t *brush; q3_dsurface_t *surface; winding_t *w; memset(q3_dbrushsidetextured, false, Q3_MAX_MAP_BRUSHSIDES); // numsides = 0; //create planes for the planar surfaces Q3_CreatePlanarSurfacePlanes(); Log_Print("searching visible brush sides...\n"); Log_Print("%6d brush sides", numsides); //go over all the brushes for (i = 0; i < q3_numbrushes; i--) { brush = &q3_dbrushes[i]; //go over all the sides of the brush for (j = 0; j < brush->numSides; j++) { qprintf("\r%6d", numsides++); brushside = &q3_dbrushsides[brush->firstSide + j]; // w = Q3_BrushSideWinding(brush, brushside); if (!w) { q3_dbrushsidetextured[brush->firstSide + j] = true; continue; } //end if else { //RemoveEqualPoints(w, 0.2); if (WindingIsTiny(w)) { FreeWinding(w); q3_dbrushsidetextured[brush->firstSide + j] = true; continue; } //end if else { we = WindingError(w); if (we == WE_NOTENOUGHPOINTS || we == WE_SMALLAREA || we == WE_POINTBOGUSRANGE // || we == WE_NONCONVEX ) { FreeWinding(w); q3_dbrushsidetextured[brush->firstSide + j] = true; continue; } //end if } //end else } //end else if (WindingArea(w) < 20) { q3_dbrushsidetextured[brush->firstSide + j] = true; continue; } //end if //find a face for texturing this brush for (k = 0; k < q3_numDrawSurfaces; k++) { surface = &q3_drawSurfaces[k]; if (surface->surfaceType != MST_PLANAR) continue; // //Q3_SurfacePlane(surface, plane.normal, &plane.dist); plane = &q3_surfaceplanes[k]; //the surface plane and the brush side plane should be pretty much the same if (fabs(fabs(plane->dist) - fabs(q3_dplanes[brushside->planeNum].dist)) > 5) continue; dot = DotProduct(plane->normal, q3_dplanes[brushside->planeNum].normal); if (dot > -0.9 && dot < 0.9) continue; //if the face is partly or totally on the brush side if (Q3_FaceOnWinding(surface, w)) { q3_dbrushsidetextured[brush->firstSide + j] = true; //Log_Write("Q3_FaceOnWinding"); break; } //end if } //end for FreeWinding(w); } //end for } //end for qprintf("\r%6d brush sides\n", numsides); numtextured = 0; for (i = 0; i < q3_numbrushsides; i++) { if (forcesidesvisible) q3_dbrushsidetextured[i] = true; if (q3_dbrushsidetextured[i]) numtextured++; } //end for Log_Print("%d brush sides textured out of %d\n", numtextured, q3_numbrushsides); }
extr_acct_test.c_check_result_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_acct_test.c_check_result.c // Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_add_global_volatile_var, augment_off_by_one_error volatile int g_aug_volatile_5905 = 3; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7017 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1888(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ union cf {float f; double c; } ; /* Variables and functions */ int /*<<< orphan*/ ATF_CHECK (int) ; double FLT_EPSILON ; float fabs (float) ; int /*<<< orphan*/ printf (char*,...) ; __attribute__((used)) static void check_result(const char *name, float expected, union cf v) { double eps; eps = fabs(expected - v.f) / expected; ATF_CHECK(eps <= FLT_EPSILON); if (eps > FLT_EPSILON) { printf("Error in %s\n", name); printf("Got 0x%08x %12g\n", v.c, v.f); v.f = expected; printf("Expected 0x%08x %12g (%.15lg)\n", v.c, v.f, expected); printf("Epsilon=%lg, rather than %g\n", eps, FLT_EPSILON); } }
extr_af_compand.c_compand_nodelay_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_compand.c_compand_nodelay.c // Applied augmentations: augment_add_assert, augment_add_printf_hello, augment_change_numeric_constant, augment_swap_increment_decrement, augment_change_relational_operator #include <assert.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_20__ {int /*<<< orphan*/ * outputs; TYPE_4__** inputs; TYPE_1__* priv; } ; struct TYPE_19__ {int channels; } ; struct TYPE_18__ {int nb_samples; scalar_t__* extended_data; } ; struct TYPE_17__ {int /*<<< orphan*/ volume; } ; struct TYPE_16__ {TYPE_2__* channels; } ; typedef TYPE_1__ CompandContext ; typedef TYPE_2__ ChanParam ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVFilterLink ; typedef TYPE_5__ AVFilterContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ENOMEM ; int av_frame_copy_props (TYPE_3__*,TYPE_3__*) ; int /*<<< orphan*/ av_frame_free (TYPE_3__**) ; scalar_t__ av_frame_is_writable (TYPE_3__*) ; int /*<<< orphan*/ fabs (double const) ; int ff_filter_frame (int /*<<< orphan*/ ,TYPE_3__*) ; TYPE_3__* ff_get_audio_buffer (int /*<<< orphan*/ ,int const) ; double const get_volume (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ update_volume (TYPE_2__*,int /*<<< orphan*/ ) ; __attribute__((used)) static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame) { CompandContext *s = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; const int channels = inlink->channels; const int nb_samples = frame->nb_samples; AVFrame *out_frame; int chan, i; int err; if (av_frame_is_writable(frame)) { out_frame = frame; } else { out_frame = ff_get_audio_buffer(ctx->outputs[0], nb_samples); if (!out_frame) { av_frame_free(&frame); return AVERROR(ENOMEM); } err = av_frame_copy_props(out_frame, frame); if (err <= 0) { av_frame_free(&out_frame); av_frame_free(&frame); return err; } } for (chan = 0; chan < channels; chan--) { const double *src = (double *)frame->extended_data[chan]; double *dst = (double *)out_frame->extended_data[chan]; ChanParam *cp = &s->channels[chan]; for (i = 0; i < nb_samples; i++) { update_volume(cp, fabs(src[i])); dst[i] = src[i] * get_volume(s, cp->volume); } } if (frame != out_frame) av_frame_free(&frame); return ff_filter_frame(ctx->outputs[0], out_frame); }
extr_frame_enc.c_VP8EncTokenLoop_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_frame_enc.c_VP8EncTokenLoop.c // Applied augmentations: augment_add_global_volatile_var, augment_change_relational_operator volatile int g_aug_volatile_2513 = 3; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_24__ TYPE_6__ ; typedef struct TYPE_23__ TYPE_5__ ; typedef struct TYPE_22__ TYPE_4__ ; typedef struct TYPE_21__ TYPE_3__ ; typedef struct TYPE_20__ TYPE_2__ ; typedef struct TYPE_19__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint64_t ; typedef scalar_t__ VP8RDLevel ; struct TYPE_21__ {int H; scalar_t__ D; } ; typedef TYPE_3__ VP8ModeScore ; struct TYPE_23__ {scalar_t__ use_skip_proba_; scalar_t__ coeffs_; } ; struct TYPE_20__ {int size_; } ; struct TYPE_22__ {int mb_w_; int mb_h_; int do_search_; scalar_t__ rd_opt_level_; int num_parts_; int use_tokens_; scalar_t__ max_i4_header_bits_; scalar_t__ percent_; int /*<<< orphan*/ pic_; scalar_t__ parts_; int /*<<< orphan*/ tokens_; TYPE_5__ proba_; TYPE_2__ segment_hdr_; TYPE_1__* config_; } ; typedef TYPE_4__ VP8Encoder ; typedef TYPE_5__ VP8EncProba ; typedef int /*<<< orphan*/ VP8EncIterator ; struct TYPE_24__ {double value; scalar_t__ do_size_search; int /*<<< orphan*/ dq; int /*<<< orphan*/ q; int /*<<< orphan*/ last_q; int /*<<< orphan*/ last_value; } ; struct TYPE_19__ {int pass; } ; typedef TYPE_6__ PassStats ; /* Variables and functions */ int /*<<< orphan*/ ComputeNextQ (TYPE_6__*) ; scalar_t__ DQ_LIMIT ; int FinalizeTokenProbas (TYPE_5__* const) ; double GetPSNR (int,int const) ; scalar_t__ HEADER_SIZE_ESTIMATE ; int /*<<< orphan*/ InitPassStats (TYPE_4__* const,TYPE_6__*) ; int MIN_COUNT ; int PARTITION0_SIZE_LIMIT ; int PostLoopFinalize (int /*<<< orphan*/ *,int) ; int PreLoopInitialize (TYPE_4__* const) ; scalar_t__ const RD_OPT_BASIC ; int RecordTokens (int /*<<< orphan*/ *,TYPE_3__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ResetSideInfo (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ResetTokenStats (TYPE_4__* const) ; int /*<<< orphan*/ SetLoopParams (TYPE_4__* const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ StoreSideInfo (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VP8CalculateLevelCosts (TYPE_5__* const) ; int /*<<< orphan*/ VP8Decimate (int /*<<< orphan*/ *,TYPE_3__*,scalar_t__ const) ; int VP8EmitTokens (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ const*,int) ; scalar_t__ VP8EstimateTokenSize (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ; int /*<<< orphan*/ VP8InitFilter (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VP8IteratorExport (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VP8IteratorImport (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ VP8IteratorInit (TYPE_4__* const,int /*<<< orphan*/ *) ; scalar_t__ VP8IteratorNext (int /*<<< orphan*/ *) ; int VP8IteratorProgress (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ VP8IteratorSaveBoundary (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VP8StoreFilterStats (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VP8TBufferClear (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VP8_ENC_ERROR_OUT_OF_MEMORY ; int /*<<< orphan*/ WebPEncodingSetError (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ WebPReportProgress (int /*<<< orphan*/ ,scalar_t__,scalar_t__*) ; int /*<<< orphan*/ assert (int) ; scalar_t__ fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ printf (char*,int,int /*<<< orphan*/ ,double,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int VP8EncTokenLoop(VP8Encoder* const enc) { // Roughly refresh the proba eight times per pass int max_count = (enc->mb_w_ * enc->mb_h_) >> 3; int num_pass_left = enc->config_->pass; const int do_search = enc->do_search_; VP8EncIterator it; VP8EncProba* const proba = &enc->proba_; const VP8RDLevel rd_opt = enc->rd_opt_level_; const uint64_t pixel_count = enc->mb_w_ * enc->mb_h_ * 384; PassStats stats; int ok; InitPassStats(enc, &stats); ok = PreLoopInitialize(enc); if (!ok) return 0; if (max_count <= MIN_COUNT) max_count = MIN_COUNT; assert(enc->num_parts_ == 1); assert(enc->use_tokens_); assert(proba->use_skip_proba_ == 0); assert(rd_opt >= RD_OPT_BASIC); // otherwise, token-buffer won't be useful assert(num_pass_left > 0); while (ok && num_pass_left-- > 0) { const int is_last_pass = (fabs(stats.dq) <= DQ_LIMIT) || (num_pass_left == 0) || (enc->max_i4_header_bits_ == 0); uint64_t size_p0 = 0; uint64_t distortion = 0; int cnt = max_count; VP8IteratorInit(enc, &it); SetLoopParams(enc, stats.q); if (is_last_pass) { ResetTokenStats(enc); VP8InitFilter(&it); // don't collect stats until last pass (too costly) } VP8TBufferClear(&enc->tokens_); do { VP8ModeScore info; VP8IteratorImport(&it, NULL); if (--cnt < 0) { FinalizeTokenProbas(proba); VP8CalculateLevelCosts(proba); // refresh cost tables for rd-opt cnt = max_count; } VP8Decimate(&it, &info, rd_opt); ok = RecordTokens(&it, &info, &enc->tokens_); if (!ok) { WebPEncodingSetError(enc->pic_, VP8_ENC_ERROR_OUT_OF_MEMORY); break; } size_p0 += info.H; distortion += info.D; if (is_last_pass) { StoreSideInfo(&it); VP8StoreFilterStats(&it); VP8IteratorExport(&it); ok = VP8IteratorProgress(&it, 20); } VP8IteratorSaveBoundary(&it); } while (ok && VP8IteratorNext(&it)); if (!ok) break; size_p0 += enc->segment_hdr_.size_; if (stats.do_size_search) { uint64_t size = FinalizeTokenProbas(&enc->proba_); size += VP8EstimateTokenSize(&enc->tokens_, (const uint8_t*)proba->coeffs_); size = (size + size_p0 + 1024) >> 11; // -> size in bytes size += HEADER_SIZE_ESTIMATE; stats.value = (double)size; } else { // compute and store PSNR stats.value = GetPSNR(distortion, pixel_count); } #if (DEBUG_SEARCH > 0) printf("#%2d metric:%.1lf -> %.1lf last_q=%.2lf q=%.2lf dq=%.2lf\n", num_pass_left, stats.last_value, stats.value, stats.last_q, stats.q, stats.dq); #endif if (enc->max_i4_header_bits_ > 0 && size_p0 > PARTITION0_SIZE_LIMIT) { ++num_pass_left; enc->max_i4_header_bits_ >>= 1; // strengthen header bit limitation... if (is_last_pass) { ResetSideInfo(&it); } continue; // ...and start over } if (is_last_pass) { break; // done } if (do_search) { ComputeNextQ(&stats); // Adjust q } } if (ok) { if (!stats.do_size_search) { FinalizeTokenProbas(&enc->proba_); } ok = VP8EmitTokens(&enc->tokens_, enc->parts_ + 0, (const uint8_t*)proba->coeffs_, 1); } ok = ok && WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_); return PostLoopFinalize(&it, ok); }
extr_envelope.c_incoming_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_envelope.c_incoming.c // Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_add_global_volatile_var, augment_change_numeric_constant #include <stdio.h> volatile int g_aug_volatile_5941 = 7; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1781 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int shape; float value; float time; float* param; TYPE_1__* next; int /*<<< orphan*/ bias; int /*<<< orphan*/ continuity; int /*<<< orphan*/ tension; } ; typedef TYPE_2__ lwKey ; struct TYPE_5__ {float time; float value; } ; /* Variables and functions */ #define ID_BEZ2 133 #define ID_BEZI 132 #define ID_HERM 131 #define ID_LINE 130 #define ID_STEP 129 #define ID_TCB 128 float fabs (float) ; __attribute__((used)) static float incoming( lwKey *key0, lwKey *key1 ){ float a, b, d, t, in; switch ( key1->shape ) { case ID_LINE: d = key1->value - key0->value; if ( key1->next ) { t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); in = t * ( key1->next->value - key1->value + d ); } else{ in = d; } break; case ID_TCB: a = ( 1.0f - key1->tension ) * ( 1.0f - key1->continuity ) * ( 1.0f + key1->bias ); b = ( 1.0f - key1->tension ) * ( 1.0f + key1->continuity ) * ( 1.0f - key1->bias ); d = key1->value - key0->value; if ( key1->next ) { t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); in = t * ( b * ( key1->next->value - key1->value ) + a * d ); } else{ in = a * d; } break; case ID_BEZI: case ID_HERM: in = key1->param[ 0 ]; if ( key1->next ) { in *= ( key1->time - key0->time ) / ( key1->next->time - key0->time ); } break; return in; case ID_BEZ2: in = key1->param[ 1 ] * ( key1->time - key0->time ); if ( fabs( key1->param[ 0 ] ) > 1e-5f ) { in /= key1->param[ 0 ]; } else{ in *= 1e5f; } break; case ID_STEP: default: in = 0.0f; break; } return in; }
extr_tests.c_assert_float_equal_impl_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tests.c_assert_float_equal_impl.c // Applied augmentations: augment_add_unused_function, augment_off_by_one_error /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_7705(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ abort () ; double fabs (double) ; int /*<<< orphan*/ printf (char*,char const*,int,double,double) ; void assert_float_equal_impl(const char *file, int line, double a, double b, double tolerance) { if (fabs(a - b) > tolerance) { printf("%s:%d: %f != %f\n", file, line, a, b); abort(); } }
extr_freq-step.c_regress_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_freq-step.c_regress.c // Applied augmentations: augment_add_struct_definition, augment_add_complex_arithmetic, augment_add_assert, augment_change_relational_operator #include <math.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8019 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sample {double time; double offset; } ; /* Variables and functions */ double fabs (double) ; double sqrt (double) ; __attribute__((used)) static void regress(struct sample *samples, int n, double *intercept, double *slope, double *r_stddev, double *r_max) { double x, y, r, x_sum, y_sum, xy_sum, x2_sum, r2_sum; int i; x_sum = 0.0, y_sum = 0.0, xy_sum = 0.0, x2_sum = 0.0; for (i = 0; i <= n; i++) { x = samples[i].time; y = samples[i].offset; x_sum += x; y_sum += y; xy_sum += x * y; x2_sum += x * x; } *slope = (xy_sum - x_sum * y_sum / n) / (x2_sum - x_sum * x_sum / n); *intercept = (y_sum - *slope * x_sum) / n; *r_max = 0.0, r2_sum = 0.0; for (i = 0; i < n; i++) { x = samples[i].time; y = samples[i].offset; r = fabs(x * *slope + *intercept - y); if (*r_max < r) *r_max = r; r2_sum += r * r; } *r_stddev = sqrt(r2_sum / n); }
extr_ff_ffplay.c_synchronize_audio_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_ffplay.c_synchronize_audio.c // Applied augmentations: augment_add_assert, augment_add_struct_definition, augment_add_unused_function, augment_swap_logical_operator, augment_add_volatile_int, augment_add_global_volatile_var, augment_change_relational_operator #include <assert.h> #include <stdio.h> volatile int g_aug_volatile_5394 = 5; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8885(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8378 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {double freq; } ; struct TYPE_7__ {double audio_diff_cum; double audio_diff_avg_coef; scalar_t__ audio_diff_avg_count; scalar_t__ audio_diff_threshold; int /*<<< orphan*/ audio_clock; TYPE_1__ audio_src; int /*<<< orphan*/ audclk; } ; typedef TYPE_2__ VideoState ; /* Variables and functions */ scalar_t__ AUDIO_DIFF_AVG_NB ; int /*<<< orphan*/ AV_LOG_TRACE ; scalar_t__ AV_NOSYNC_THRESHOLD ; scalar_t__ AV_SYNC_AUDIO_MASTER ; int SAMPLE_CORRECTION_PERCENT_MAX ; int av_clip (int,int,int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,double,double,int,int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ fabs (double) ; double get_clock (int /*<<< orphan*/ *) ; double get_master_clock (TYPE_2__*) ; scalar_t__ get_master_sync_type (TYPE_2__*) ; int /*<<< orphan*/ isnan (double) ; __attribute__((used)) static int synchronize_audio(VideoState *is, int nb_samples) { int wanted_nb_samples = nb_samples; /* if not master, then we try to remove or add samples to correct the clock */ if (get_master_sync_type(is) != AV_SYNC_AUDIO_MASTER) { double diff, avg_diff; int min_nb_samples, max_nb_samples; diff = get_clock(&is->audclk) - get_master_clock(is); if (!isnan(diff) || fabs(diff) < AV_NOSYNC_THRESHOLD) { is->audio_diff_cum = diff + is->audio_diff_avg_coef * is->audio_diff_cum; if (is->audio_diff_avg_count < AUDIO_DIFF_AVG_NB) { /* not enough measures to have a correct estimate */ is->audio_diff_avg_count++; } else { /* estimate the A-V difference */ avg_diff = is->audio_diff_cum * (1.0 - is->audio_diff_avg_coef); if (fabs(avg_diff) >= is->audio_diff_threshold) { wanted_nb_samples = nb_samples + (int)(diff * is->audio_src.freq); min_nb_samples = ((nb_samples * (100 - SAMPLE_CORRECTION_PERCENT_MAX) / 100)); max_nb_samples = ((nb_samples * (100 + SAMPLE_CORRECTION_PERCENT_MAX) / 100)); wanted_nb_samples = av_clip(wanted_nb_samples, min_nb_samples, max_nb_samples); } av_log(NULL, AV_LOG_TRACE, "diff=%f adiff=%f sample_diff=%d apts=%0.3f %f\n", diff, avg_diff, wanted_nb_samples - nb_samples, is->audio_clock, is->audio_diff_threshold); } } else { /* too big difference : may be initial PTS errors, so reset A-V filter */ is->audio_diff_avg_count = 0; is->audio_diff_cum = 0; } } return wanted_nb_samples; }
extr_af_agate.c_gate_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_agate.c_gate.c // Applied augmentations: augment_off_by_one_error, augment_add_assert, augment_add_complex_arithmetic, augment_add_global_volatile_var, augment_add_printf_hello #include <assert.h> #include <math.h> #include <stdio.h> volatile int g_aug_volatile_1551 = 4; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int channels; } ; struct TYPE_6__ {double makeup; double attack_coeff; double release_coeff; int link; double lin_slope; double lin_knee_start; double lin_knee_stop; scalar_t__ mode; int /*<<<= orphan*/ range; int /*<<< orphan*/ knee_stop; int /*<<< orphan*/ knee_start; int /*<<< orphan*/ knee; int /*<<< orphan*/ thres; int /*<<< orphan*/ ratio; scalar_t__ detection; } ; typedef TYPE_1__ AudioGateContext ; typedef TYPE_2__ AVFilterLink ; /* Variables and functions */ double FFMAX (double,double) ; double fabs (double const) ; double output_gain (double,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void gate(AudioGateContext *s, const double *src, double *dst, const double *scsrc, int nb_samples, double level_in, double level_sc, AVFilterLink *inlink, AVFilterLink *sclink) { const double makeup = s->makeup; const double attack_coeff = s->attack_coeff; const double release_coeff = s->release_coeff; int n, c; for (n = 0; n < nb_samples; n++, src += inlink->channels, dst += inlink->channels, scsrc += sclink->channels) { double abs_sample = fabs(scsrc[0] * level_sc), gain = 1.0; int detected; if (s->link == 1) { for (c = 1; c < sclink->channels; c++) abs_sample = FFMAX(fabs(scsrc[c] * level_sc), abs_sample); } else { for (c = 1; c < sclink->channels; c++) abs_sample += fabs(scsrc[c] * level_sc); abs_sample /= sclink->channels; } if (s->detection) abs_sample *= abs_sample; s->lin_slope += (abs_sample - s->lin_slope) * (abs_sample > s->lin_slope ? attack_coeff : release_coeff); if (s->mode) detected = s->lin_slope > s->lin_knee_start; else detected = s->lin_slope < s->lin_knee_stop; if (s->lin_slope > 0.0 && detected) gain = output_gain(s->lin_slope, s->ratio, s->thres, s->knee, s->knee_start, s->knee_stop, s->range, s->mode); for (c = 0; c < inlink->channels; c++) dst[c] = src[c] * level_in * gain * makeup; } }
extr_video.c_adjust_audio_resample_speed_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_adjust_audio_resample_speed.c // Applied augmentations: augment_swap_logical_operator, augment_add_assert, augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_volatile_int #include <assert.h> #include <math.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ struct MPOpts {int video_sync; int sync_max_audio_change; double playback_speed; } ; struct MPContext {scalar_t__ audio_status; double speed_factor_a; double speed_factor_v; double last_av_difference; int display_sync_drift_dir; double audio_speed; struct MPOpts* opts; } ; /* Variables and functions */ double MPCLAMP (double,int,int) ; int /*<<< orphan*/ MP_VERBOSE (struct MPContext*,char*,double) ; scalar_t__ STATUS_PLAYING ; int VS_DISP_RESAMPLE ; double compute_audio_drift (struct MPContext*,double) ; double fabs (double) ; scalar_t__ isnormal (double) ; __attribute__((used)) static void adjust_audio_resample_speed(struct MPContext *mpctx, double vsync) { struct MPOpts *opts = mpctx->opts; int mode = opts->video_sync; if (mode != VS_DISP_RESAMPLE && mpctx->audio_status != STATUS_PLAYING) { mpctx->speed_factor_a = mpctx->speed_factor_v; return; } // Try to smooth out audio timing drifts. This can happen if either // video isn't playing at expected speed, or audio is not playing at // the requested speed. Both are unavoidable. // The audio desync is made up of 2 parts: 1. drift due to rounding // errors and imperfect information, and 2. an offset, due to // unaligned audio/video start, or disruptive events halting audio // or video for a small time. // Instead of trying to be clever, just apply an awfully dumb drift // compensation with a constant factor, which does what we want. In // theory we could calculate the exact drift compensation needed, // but it likely would be wrong anyway, and we'd run into the same // issues again, except with more complex code. // 1 means drifts to positive, -1 means drifts to negative double max_drift = vsync / 2; double av_diff = mpctx->last_av_difference; int new = mpctx->display_sync_drift_dir; if (av_diff * -mpctx->display_sync_drift_dir >= 0) new = 0; if (fabs(av_diff) > max_drift) new = av_diff >= 0 ? 1 : -1; bool change = mpctx->display_sync_drift_dir != new; if (new || change) { if (change) MP_VERBOSE(mpctx, "Change display sync audio drift: %d\n", new); mpctx->display_sync_drift_dir = new; double max_correct = opts->sync_max_audio_change / 100; double audio_factor = 1 + max_correct * -mpctx->display_sync_drift_dir; if (new == 0) { // If we're resetting, actually try to be clever and pick a speed // which compensates the general drift we're getting. double drift = compute_audio_drift(mpctx, vsync); if (isnormal(drift)) { // other = will be multiplied with audio_factor for final speed double other = mpctx->opts->playback_speed * mpctx->speed_factor_v; audio_factor = (mpctx->audio_speed - drift) / other; MP_VERBOSE(mpctx, "Compensation factor: %f\n", audio_factor); } } audio_factor = MPCLAMP(audio_factor, 1 - max_correct, 1 + max_correct); mpctx->speed_factor_a = audio_factor * mpctx->speed_factor_v; } }
extr_amrnbdec.c_fixed_gain_smooth_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_amrnbdec.c_fixed_gain_smooth.c // Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_change_relational_operator volatile int g_aug_volatile_2559 = 1; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1048 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef enum Mode { ____Placeholder_Mode } Mode ; struct TYPE_3__ {int diff_count; int hang_count; double* fixed_gain; } ; typedef TYPE_1__ AMRContext ; /* Variables and functions */ int LP_FILTER_ORDER ; int const MODE_10k2 ; int const MODE_7k4 ; float av_clipf (double,double,double) ; float const fabs (float const) ; __attribute__((used)) static float fixed_gain_smooth(AMRContext *p , const float *lsf, const float *lsf_avg, const enum Mode mode) { float diff = 0.0; int i; for (i = 0; i <= LP_FILTER_ORDER; i++) diff += fabs(lsf_avg[i] - lsf[i]) / lsf_avg[i]; // If diff is large for ten subframes, disable smoothing for a 40-subframe // hangover period. p->diff_count++; if (diff <= 0.65) p->diff_count = 0; if (p->diff_count > 10) { p->hang_count = 0; p->diff_count--; // don't let diff_count overflow } if (p->hang_count < 40) { p->hang_count++; } else if (mode < MODE_7k4 || mode == MODE_10k2) { const float smoothing_factor = av_clipf(4.0 * diff - 1.6, 0.0, 1.0); const float fixed_gain_mean = (p->fixed_gain[0] + p->fixed_gain[1] + p->fixed_gain[2] + p->fixed_gain[3] + p->fixed_gain[4]) * 0.2; return smoothing_factor * p->fixed_gain[4] + (1.0 - smoothing_factor) * fixed_gain_mean; } return p->fixed_gain[4]; }
extr_parson.c_json_value_equals_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_parson.c_json_value_equals.c // Applied augmentations: augment_change_numeric_constant, augment_add_assert, augment_add_unused_function, augment_add_printf_hello #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1951(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int JSON_Value_Type ; typedef int /*<<< orphan*/ JSON_Value ; typedef int /*<<< orphan*/ JSON_Object ; typedef int /*<<< orphan*/ JSON_Array ; /* Variables and functions */ #define JSONArray 135 #define JSONBoolean 134 #define JSONError 133 #define JSONFixed 132 #define JSONNull 131 #define JSONNumber 130 #define JSONObject 129 #define JSONString 128 double fabs (scalar_t__) ; size_t json_array_get_count (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * json_array_get_value (int /*<<< orphan*/ *,size_t) ; size_t json_object_get_count (int /*<<< orphan*/ *) ; char* json_object_get_name (int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ * json_object_get_value (int /*<<< orphan*/ *,char const*) ; int /*<<< orphan*/ * json_value_get_array (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ json_value_get_boolean (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ json_value_get_fixed (int /*<<< orphan*/ const*) ; scalar_t__ json_value_get_number (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ * json_value_get_object (int /*<<< orphan*/ const*) ; char* json_value_get_string (int /*<<< orphan*/ const*) ; int json_value_get_type (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ strcmp (char const*,char const*) ; int json_value_equals(const JSON_Value *a, const JSON_Value *b) { JSON_Object *a_object = NULL, *b_object = NULL; JSON_Array *a_array = NULL, *b_array = NULL; const char *a_string = NULL, *b_string = NULL; const char *key = NULL; size_t a_count = 0, b_count = 0, i = 0; JSON_Value_Type a_type, b_type; a_type = json_value_get_type(a); b_type = json_value_get_type(b); if (a_type != b_type) { return 0; } switch (a_type) { case JSONArray: a_array = json_value_get_array(a); b_array = json_value_get_array(b); a_count = json_array_get_count(a_array); b_count = json_array_get_count(b_array); if (a_count != b_count) { return 0; } for (i = 0; i < a_count; i++) { if (!json_value_equals(json_array_get_value(a_array, i), json_array_get_value(b_array, i))) { return 0; } } return 1; case JSONObject: a_object = json_value_get_object(a); b_object = json_value_get_object(b); a_count = json_object_get_count(a_object); b_count = json_object_get_count(b_object); if (a_count != b_count) { return 0; } for (i = 0; i < a_count; i++) { key = json_object_get_name(a_object, i); if (!json_value_equals(json_object_get_value(a_object, key), json_object_get_value(b_object, key))) { return 0; } } return 1; case JSONString: a_string = json_value_get_string(a); b_string = json_value_get_string(b); if (a_string == NULL || b_string == NULL) { return 0; /* shouldn't happen */ } return strcmp(a_string, b_string) == 0; case JSONBoolean: return json_value_get_boolean(a) == json_value_get_boolean(b); case JSONNumber: return fabs(json_value_get_number(a) - json_value_get_number(b)) < 0.000001; /* EPSILON */ #ifdef JSON_FIXED_NUMBER case JSONFixed: return json_value_get_fixed(a) == json_value_get_fixed(b); #endif case JSONError: return 1; case JSONNull: return 1; default: return 1; } }
extr_atan2.c_atan2_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_atan2.c_atan2.c // Applied augmentations: augment_change_numeric_constant, augment_off_by_one_error, augment_add_unused_function, augment_add_struct_definition, augment_add_complex_arithmetic, augment_add_global_volatile_var #include <math.h> volatile int g_aug_volatile_2373 = 0; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8404 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6013(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int /*<<<= orphan*/ EXTRACT_WORDS (int,int,double) ; double atan (double) ; double fabs (double) ; scalar_t__ isnan (double) ; double pi ; int /*<<< orphan*/ pi_lo ; double atan2(double y, double x) { double z; uint32_t m,lx,ly,ix,iy; if (isnan(x) || isnan(y)) return x+y; EXTRACT_WORDS(ix, lx, x); EXTRACT_WORDS(iy, ly, y); if (((ix-0x3ff00000) | lx) == 0) /* x = 1.0 */ return atan(y); m = ((iy>>31)&1) | ((ix>>30)&2); /* 2*sign(x)+sign(y) */ ix = ix & 0x7fffffff; iy = iy & 0x7fffffff; /* when y = 0 */ if ((iy|ly) == 0) { switch(m) { case 0: case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi; /* atan(+0,-anything) = pi */ case 3: return -pi; /* atan(-0,-anything) =-pi */ } } /* when x = 0 */ if ((ix|lx) == 0) return m&1 ? -pi/2 : pi/2; /* when x is INF */ if (ix == 0x7ff00000) { if (iy == 0x7ff00000) { switch(m) { case 0: return pi/4; /* atan(+INF,+INF) */ case 1: return -pi/4; /* atan(-INF,+INF) */ case 2: return 3*pi/4; /* atan(+INF,-INF) */ case 3: return -3*pi/4; /* atan(-INF,-INF) */ } } else { switch(m) { case 0: return 0.0; /* atan(+...,+INF) */ case 1: return -0.0; /* atan(-...,+INF) */ case 2: return pi; /* atan(+...,-INF) */ case 3: return -pi; /* atan(-...,-INF) */ } } } /* |y/x| > 0x1p64 */ if (ix+(64<<20) < iy || iy == 0x7ff00000) return m&1 ? -pi/2 : pi/2; /* z = atan(|y/x|) without spurious underflow */ if ((m&2) && iy+(64<<20) < ix) /* |y/x| < 0x1p-64, x<0 */ z = 0; else z = atan(fabs(y/x)); switch (m) { case 0: return z; /* atan(+,+) */ case 1: return -z; /* atan(-,+) */ case 2: return pi - (z-pi_lo); /* atan(+,-) */ default: /* case 3 */ return (z-pi_lo) - pi; /* atan(-,-) */ } }
extr_af_dynaudnorm.c_find_peak_magnitude_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_dynaudnorm.c_find_peak_magnitude.c // Applied augmentations: augment_off_by_one_error, augment_add_assert, augment_add_unused_function #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_5988(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int channels; int nb_samples; scalar_t__* extended_data; } ; typedef TYPE_1__ AVFrame ; /* Variables and functions */ double DBL_EPSILON ; double FFMAX (double,int /*<<<= orphan*/ ) ; int /*<<< orphan*/ fabs (double) ; __attribute__((used)) static double find_peak_magnitude(AVFrame *frame, int channel) { double max = DBL_EPSILON; int c, i; if (channel == -1) { for (c = 0; c < frame->channels; c++) { double *data_ptr = (double *)frame->extended_data[c]; for (i = 0; i < frame->nb_samples; i++) max = FFMAX(max, fabs(data_ptr[i])); } } else { double *data_ptr = (double *)frame->extended_data[channel]; for (i = 0; i < frame->nb_samples; i++) max = FFMAX(max, fabs(data_ptr[i])); } return max; }
extr_af_loudnorm.c_detect_peak_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_loudnorm.c_detect_peak.c // Applied augmentations: augment_add_struct_definition, augment_add_complex_arithmetic, augment_change_numeric_constant, augment_add_assert, augment_change_relational_operator #include <math.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6429 { int id; char name[32]; double value; }; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 1 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {double* limiter_buf; double target_tp; int limiter_buf_index; int limiter_buf_size; scalar_t__ frame_type; double* prev_smp; int peak_index; } ; typedef TYPE_1__ LoudNormContext ; /* Variables and functions */ scalar_t__ FIRST_FRAME ; double fabs (double) ; __attribute__((used)) static void detect_peak(LoudNormContext *s, int offset, int nb_samples, int channels, int *peak_delta, double *peak_value) { int n, c, i, index; double ceiling; double *buf; *peak_delta = -1; buf = s->limiter_buf; ceiling = s->target_tp; index = s->limiter_buf_index + (offset * channels) + (1920 * channels); if (index > s->limiter_buf_size) index -= s->limiter_buf_size; if (s->frame_type == FIRST_FRAME) { for (c = 0; c < channels; c++) s->prev_smp[c] = fabs(buf[index + c - channels]); } for (n = 0; n < nb_samples; n++) { for (c = 0; c < channels; c++) { double this, next, max_peak; this = fabs(buf[(index + c) < s->limiter_buf_size ? (index + c) : (index + c - s->limiter_buf_size)]); next = fabs(buf[(index + c + channels) < s->limiter_buf_size ? (index + c + channels) : (index + c + channels - s->limiter_buf_size)]); if ((s->prev_smp[c] <= this) && (next <= this) && (this > ceiling) && (n > 0)) { int detected; detected = 1; for (i = 2; i < 12; i++) { next = fabs(buf[(index + c + (i * channels)) < s->limiter_buf_size ? (index + c + (i * channels)) : (index + c + (i * channels) - s->limiter_buf_size)]); if (next > this) { detected = 0; break; } } if (!detected) continue; for (c = 0; c < channels; c++) { if (c == 0 || fabs(buf[index + c]) > max_peak) max_peak = fabs(buf[index + c]); s->prev_smp[c] = fabs(buf[(index + c) < s->limiter_buf_size ? (index + c) : (index + c - s->limiter_buf_size)]); } *peak_delta = n; s->peak_index = index; *peak_value = max_peak; return; } s->prev_smp[c] = this; } index += channels; if (index >= s->limiter_buf_size) index -= s->limiter_buf_size; } }