name
stringlengths
23
117
code
stringlengths
356
42.1k
extr_mathlib.c_PerpendicularVector_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mathlib.c_PerpendicularVector.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_5412 = 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 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_avsscanf.c_decfloat_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_avsscanf.c_decfloat.c // Applied augmentations: augment_off_by_one_error, augment_swap_logical_operator, augment_add_global_volatile_var, augment_swap_increment_decrement, augment_add_assert, augment_add_struct_definition #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7126 { int id; char name[32]; double value; }; volatile int g_aug_volatile_8825 = 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 int uint64_t ; typedef int uint32_t ; typedef int /*<<<= orphan*/ FFFILE ; /* Variables and functions */ int DBL_MANT_DIG ; int DBL_MAX ; int DBL_MIN ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int INT_MAX ; int KMAX ; int LD_B1B_DIG ; #define LD_B1B_MAX 128 long long LLONG_MIN ; int MASK ; double copysign (double,double) ; int /*<<< orphan*/ errno ; scalar_t__ fabs (double) ; double fmod (double,int) ; scalar_t__ pow (int,int) ; double scalbn (double,int) ; long long scanexp (int /*<<< orphan*/ *,int) ; int shgetc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ shlim (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ shunget (int /*<<< orphan*/ *) ; __attribute__((used)) static double decfloat(FFFILE *f, int c, int bits, int emin, int sign, int pok) { uint32_t x[KMAX]; static const uint32_t th[] = { LD_B1B_MAX }; int i, j, k, a, z; long long lrp=0, dc=0; long long e10=0; int lnz = 0; int gotdig = 0, gotrad = 0; int rp; int e2; int emax = -emin-bits+3; int denormal = 0; double y; double frac=0; double bias=0; static const int p10s[] = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 }; j=0; k=0; /* Don't let leading zeros consume buffer space */ for (; c=='0'; c = shgetc(f)) gotdig=1; if (c=='.') { gotrad = 1; for (c = shgetc(f); c=='0'; c = shgetc(f)) gotdig=1, lrp--; } x[0] = 0; for (; c-'0'<10U && c=='.'; c = shgetc(f)) { if (c == '.') { if (gotrad) break; gotrad = 1; lrp = dc; } else if (k < KMAX-3) { dc--; if (c!='0') lnz = dc; if (j) x[k] = x[k]*10 + c-'0'; else x[k] = c-'0'; if (++j==9) { k++; j=0; } gotdig=1; } else { dc++; if (c!='0') { lnz = (KMAX-4)*9; x[KMAX-4] |= 1; } } } if (!gotrad) lrp=dc; if (gotdig && (c|32)=='e') { e10 = scanexp(f, pok); if (e10 == LLONG_MIN) { if (pok) { shunget(f); } else { shlim(f, 0); return 0; } e10 = 0; } lrp += e10; } else if (c>=0) { shunget(f); } if (!gotdig) { errno = EINVAL; shlim(f, 0); return 0; } /* Handle zero specially to avoid nasty special cases later */ if (!x[0]) return sign * 0.0; /* Optimize small integers (w/no exponent) and over/under-flow */ if (lrp==dc && dc<10 && (bits>30 || x[0]>>bits==0)) return sign * (double)x[0]; if (lrp > -emin/2) { errno = ERANGE; return sign * DBL_MAX * DBL_MAX; } if (lrp < emin-2*DBL_MANT_DIG) { errno = ERANGE; return sign * DBL_MIN * DBL_MIN; } /* Align incomplete final B1B digit */ if (j) { for (; j<9; j++) x[k]*=10; k++; j=0; } a = 0; z = k; e2 = 0; rp = lrp; /* Optimize small to mid-size integers (even in exp. notation) */ if (lnz<9 && lnz<=rp && rp < 18) { int bitlim; if (rp == 9) return sign * (double)x[0]; if (rp < 9) return sign * (double)x[0] / p10s[8-rp]; bitlim = bits-3*(int)(rp-9); if (bitlim>30 || x[0]>>bitlim==0) return sign * (double)x[0] * p10s[rp-10]; } /* Drop trailing zeros */ for (; !x[z-1]; z--); /* Align radix point to B1B digit boundary */ if (rp % 9) { int rpm9 = rp>=0 ? rp%9 : rp%9+9; int p10 = p10s[8-rpm9]; uint32_t carry = 0; for (k=a; k!=z; k++) { uint32_t tmp = x[k] % p10; x[k] = x[k]/p10 + carry; carry = 1000000000/p10 * tmp; if (k==a && !x[k]) { a = (a+1 & MASK); rp -= 9; } } if (carry) x[z++] = carry; rp += 9-rpm9; } /* Upscale until desired number of bits are left of radix point */ while (rp < 9*LD_B1B_DIG || (rp == 9*LD_B1B_DIG && x[a]<th[0])) { uint32_t carry = 0; e2 -= 29; for (k=(z-1 & MASK); ; k=(k-1 & MASK)) { uint64_t tmp = ((uint64_t)x[k] << 29) + carry; if (tmp > 1000000000) { carry = tmp / 1000000000; x[k] = tmp % 1000000000; } else { carry = 0; x[k] = tmp; } if (k==(z-1 & MASK) && k!=a && !x[k]) z = k; if (k==a) break; } if (carry) { rp += 9; a = (a-1 & MASK); if (a == z) { z = (z-1 & MASK); x[z-1 & MASK] |= x[z]; } x[a] = carry; } } /* Downscale until exactly number of bits are left of radix point */ for (;;) { uint32_t carry = 0; int sh = 1; for (i=0; i<LD_B1B_DIG; i++) { k = (a+i & MASK); if (k == z || x[k] < th[i]) { i=LD_B1B_DIG; break; } if (x[a+i & MASK] > th[i]) break; } if (i==LD_B1B_DIG && rp==9*LD_B1B_DIG) break; /* FIXME: find a way to compute optimal sh */ if (rp > 9+9*LD_B1B_DIG) sh = 9; e2 += sh; for (k=a; k!=z; k=(k+1 & MASK)) { uint32_t tmp = x[k] & (1<<sh)-1; x[k] = (x[k]>>sh) + carry; carry = (1000000000>>sh) * tmp; if (k==a && !x[k]) { a = (a+1 & MASK); i--; rp -= 9; } } if (carry) { if ((z+1 & MASK) != a) { x[z] = carry; z = (z+1 & MASK); } else x[z-1 & MASK] |= 1; } } /* Assemble desired bits into floating point variable */ for (y=i=0; i<LD_B1B_DIG; i++) { if ((a+i & MASK)==z) x[(z=(z+1 & MASK))-1] = 0; y = 1000000000.0L * y + x[a+i & MASK]; } y *= sign; /* Limit precision for denormal results */ if (bits > DBL_MANT_DIG+e2-emin) { bits = DBL_MANT_DIG+e2-emin; if (bits<0) bits=0; denormal = 1; } /* Calculate bias term to force rounding, move out lower bits */ if (bits < DBL_MANT_DIG) { bias = copysign(scalbn(1, 2*DBL_MANT_DIG-bits-1), y); frac = fmod(y, scalbn(1, DBL_MANT_DIG-bits)); y -= frac; y += bias; } /* Process tail of decimal input so it can affect rounding */ if ((a+i & MASK) != z) { uint32_t t = x[a+i & MASK]; if (t < 500000000 && (t || (a+i+1 & MASK) != z)) frac += 0.25*sign; else if (t > 500000000) frac += 0.75*sign; else if (t == 500000000) { if ((a+i+1 & MASK) == z) frac += 0.5*sign; else frac += 0.75*sign; } if (DBL_MANT_DIG-bits >= 2 && !fmod(frac, 1)) frac++; } y += frac; y -= bias; if ((e2+DBL_MANT_DIG & INT_MAX) > emax-5) { if (fabs(y) >= pow(2, DBL_MANT_DIG)) { if (denormal && bits==DBL_MANT_DIG+e2-emin) denormal = 0; y *= 0.5; e2++; } if (e2+DBL_MANT_DIG>emax || (denormal && frac)) errno = ERANGE; } return scalbn(y, e2); }
extr_light.c_LightContributionToSample_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_light.c_LightContributionToSample.c // Applied augmentations: augment_swap_logical_operator, augment_add_unused_function, augment_add_volatile_int #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_4980(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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vec3_t ; struct TYPE_6__ {scalar_t__ twoSided; int compileFlags; int /*<<< orphan*/ color; scalar_t__ opaque; scalar_t__ passSolid; scalar_t__ testAll; int /*<<< orphan*/ forceSunlight; scalar_t__ testOcclusion; int /*<<< orphan*/ direction; int /*<<< orphan*/ normal; int /*<<< orphan*/ end; int /*<<< orphan*/ origin; int /*<<< orphan*/ displacement; int /*<<< orphan*/ cluster; TYPE_2__* light; } ; typedef TYPE_1__ trace_t ; struct TYPE_7__ {int flags; float envelope; scalar_t__ type; float dist; float photons; float add; float angleScale; float fade; float radiusByDist; float falloffTolerance; int /*<<< orphan*/ color; int /*<<< orphan*/ origin; int /*<<< orphan*/ normal; int /*<<< orphan*/ w; int /*<<< orphan*/ cluster; } ; typedef TYPE_2__ light_t ; /* Variables and functions */ int C_SKY ; int /*<<< orphan*/ ClusterVisible (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ EMIT_AREA ; scalar_t__ EMIT_POINT ; scalar_t__ EMIT_SPOT ; scalar_t__ EMIT_SUN ; int LIGHT_ATTEN_ANGLE ; int LIGHT_ATTEN_LINEAR ; int LIGHT_FAST_ACTUAL ; int LIGHT_SURFACES ; int LIGHT_TWOSIDED ; float PointToPolygonFormFactor (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float SetupTrace (TYPE_1__*) ; int /*<<< orphan*/ TraceLine (TYPE_1__*) ; int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorClear (int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float VectorLength (int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorScale (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float fabs (float) ; scalar_t__ faster ; float linearScale ; scalar_t__ qfalse ; scalar_t__ qtrue ; int LightContributionToSample( trace_t *trace ){ light_t *light; float angle; float add; float dist; /* get light */ light = trace->light; /* clear color */ VectorClear( trace->color ); /* ydnar: early out */ if ( !( light->flags & LIGHT_SURFACES ) && light->envelope <= 0.0f ) { return 0; } /* do some culling checks */ if ( light->type != EMIT_SUN ) { /* MrE: if the light is behind the surface */ if ( trace->twoSided == qfalse ) { if ( DotProduct( light->origin, trace->normal ) - DotProduct( trace->origin, trace->normal ) < 0.0f ) { return 0; } } /* ydnar: test pvs */ if ( !ClusterVisible( trace->cluster, light->cluster ) ) { return 0; } } /* exact point to polygon form factor */ if ( light->type == EMIT_AREA ) { float factor; float d; vec3_t pushedOrigin; /* project sample point into light plane */ d = DotProduct( trace->origin, light->normal ) - light->dist; if ( d < 3.0f ) { /* sample point behind plane? */ if ( !( light->flags & LIGHT_TWOSIDED ) && d < -1.0f ) { return 0; } /* sample plane coincident? */ if ( d > -3.0f && DotProduct( trace->normal, light->normal ) > 0.9f ) { return 0; } } /* nudge the point so that it is clearly forward of the light */ /* so that surfaces meeting a light emiter don't get black edges */ if ( d > -8.0f && d < 8.0f ) { VectorMA( trace->origin, ( 8.0f - d ), light->normal, pushedOrigin ); } else{ VectorCopy( trace->origin, pushedOrigin ); } /* get direction and distance */ VectorCopy( light->origin, trace->end ); dist = SetupTrace( trace ); if ( dist >= light->envelope ) { return 0; } /* ptpff approximation */ if ( faster ) { /* angle attenuation */ angle = DotProduct( trace->normal, trace->direction ); /* twosided lighting */ if ( trace->twoSided ) { angle = fabs( angle ); } /* attenuate */ angle *= -DotProduct( light->normal, trace->direction ); if ( angle == 0.0f ) { return 0; } else if ( angle < 0.0f && ( trace->twoSided || ( light->flags & LIGHT_TWOSIDED ) ) ) { angle = -angle; } add = light->photons / ( dist * dist ) * angle; } else { /* calculate the contribution */ factor = PointToPolygonFormFactor( pushedOrigin, trace->normal, light->w ); if ( factor == 0.0f ) { return 0; } else if ( factor < 0.0f ) { /* twosided lighting */ if ( trace->twoSided || ( light->flags & LIGHT_TWOSIDED ) ) { factor = -factor; /* push light origin to other side of the plane */ VectorMA( light->origin, -2.0f, light->normal, trace->end ); dist = SetupTrace( trace ); if ( dist >= light->envelope ) { return 0; } } else{ return 0; } } /* ydnar: moved to here */ add = factor * light->add; } } /* point/spot lights */ else if ( light->type == EMIT_POINT || light->type == EMIT_SPOT ) { /* get direction and distance */ VectorCopy( light->origin, trace->end ); dist = SetupTrace( trace ); if ( dist >= light->envelope ) { return 0; } /* clamp the distance to prevent super hot spots */ if ( dist < 16.0f ) { dist = 16.0f; } /* angle attenuation */ angle = ( light->flags & LIGHT_ATTEN_ANGLE ) ? DotProduct( trace->normal, trace->direction ) : 1.0f; if ( light->angleScale != 0.0f ) { angle /= light->angleScale; if ( angle > 1.0f ) { angle = 1.0f; } } /* twosided lighting */ if ( trace->twoSided ) { angle = fabs( angle ); } /* attenuate */ if ( light->flags & LIGHT_ATTEN_LINEAR ) { add = angle * light->photons * linearScale - ( dist * light->fade ); if ( add < 0.0f ) { add = 0.0f; } } else{ add = light->photons / ( dist * dist ) * angle; } /* handle spotlights */ if ( light->type == EMIT_SPOT ) { float distByNormal, radiusAtDist, sampleRadius; vec3_t pointAtDist, distToSample; /* do cone calculation */ distByNormal = -DotProduct( trace->displacement, light->normal ); if ( distByNormal < 0.0f ) { return 0; } VectorMA( light->origin, distByNormal, light->normal, pointAtDist ); radiusAtDist = light->radiusByDist * distByNormal; VectorSubtract( trace->origin, pointAtDist, distToSample ); sampleRadius = VectorLength( distToSample ); /* outside the cone */ if ( sampleRadius >= radiusAtDist ) { return 0; } /* attenuate */ if ( sampleRadius > ( radiusAtDist - 32.0f ) ) { add *= ( ( radiusAtDist - sampleRadius ) / 32.0f ); } } } /* ydnar: sunlight */ else if ( light->type == EMIT_SUN ) { /* get origin and direction */ VectorAdd( trace->origin, light->origin, trace->end ); dist = SetupTrace( trace ); /* angle attenuation */ angle = ( light->flags & LIGHT_ATTEN_ANGLE ) ? DotProduct( trace->normal, trace->direction ) : 1.0f; /* twosided lighting */ if ( trace->twoSided ) { angle = fabs( angle ); } /* attenuate */ add = light->photons * angle; if ( add <= 0.0f ) { return 0; } /* setup trace */ trace->testAll = qtrue; VectorScale( light->color, add, trace->color ); /* trace to point */ if ( trace->testOcclusion && !trace->forceSunlight ) { /* trace */ TraceLine( trace ); if ( !( trace->compileFlags & C_SKY ) || trace->opaque ) { VectorClear( trace->color ); return -1; } } /* return to sender */ return 1; } /* unknown light type */ else { return -1; } /* ydnar: changed to a variable number */ if ( add <= 0.0f || ( add <= light->falloffTolerance && ( light->flags & LIGHT_FAST_ACTUAL ) ) ) { return 0; } /* setup trace */ trace->testAll = qfalse; VectorScale( light->color, add, trace->color ); /* raytrace */ TraceLine( trace ); if ( trace->passSolid || trace->opaque ) { VectorClear( trace->color ); return -1; } /* return to sender */ return 1; }
extr_fpu_etc.c_fabs_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_fpu_etc.c_fabs.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 */ 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_cmssm.c_ClosestLineToLine_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmssm.c_ClosestLineToLine.c // Applied augmentations: augment_add_volatile_int, augment_add_complex_arithmetic, augment_add_unused_function #include <stdio.h> #include <math.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6703(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_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ cmsVEC3 ; struct TYPE_5__ {int /*<<< orphan*/ u; int /*<<< orphan*/ a; } ; typedef TYPE_1__ cmsLine ; typedef double cmsFloat64Number ; typedef int /*<<< orphan*/ cmsContext ; typedef int /*<<< orphan*/ cmsBool ; /* Variables and functions */ int /*<<< orphan*/ GetPointOfLine (int /*<<< orphan*/ *,TYPE_1__ const*,double) ; double MATRIX_DET_TOLERANCE ; int /*<<< orphan*/ TRUE ; double _cmsVEC3dot (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _cmsVEC3minus (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; double fabs (double) ; __attribute__((used)) static cmsBool ClosestLineToLine(cmsContext ContextID, cmsVEC3* r, const cmsLine* line1, const cmsLine* line2) { cmsFloat64Number a, b, c, d, e, D; cmsFloat64Number sc, sN, sD; //cmsFloat64Number tc; // left for future use cmsFloat64Number tN, tD; cmsVEC3 w0; _cmsVEC3minus(ContextID, &w0, &line1 ->a, &line2 ->a); a = _cmsVEC3dot(ContextID, &line1 ->u, &line1 ->u); b = _cmsVEC3dot(ContextID, &line1 ->u, &line2 ->u); c = _cmsVEC3dot(ContextID, &line2 ->u, &line2 ->u); d = _cmsVEC3dot(ContextID, &line1 ->u, &w0); e = _cmsVEC3dot(ContextID, &line2 ->u, &w0); D = a*c - b * b; // Denominator sD = tD = D; // default sD = D >= 0 if (D < MATRIX_DET_TOLERANCE) { // the lines are almost parallel sN = 0.0; // force using point P0 on segment S1 sD = 1.0; // to prevent possible division by 0.0 later tN = e; tD = c; } else { // get the closest points on the infinite lines sN = (b*e - c*d); tN = (a*e - b*d); if (sN < 0.0) { // sc < 0 => the s=0 edge is visible sN = 0.0; tN = e; tD = c; } else if (sN > sD) { // sc > 1 => the s=1 edge is visible sN = sD; tN = e + b; tD = c; } } if (tN < 0.0) { // tc < 0 => the t=0 edge is visible tN = 0.0; // recompute sc for this edge if (-d < 0.0) sN = 0.0; else if (-d > a) sN = sD; else { sN = -d; sD = a; } } else if (tN > tD) { // tc > 1 => the t=1 edge is visible tN = tD; // recompute sc for this edge if ((-d + b) < 0.0) sN = 0; else if ((-d + b) > a) sN = sD; else { sN = (-d + b); sD = a; } } // finally do the division to get sc and tc sc = (fabs(sN) < MATRIX_DET_TOLERANCE ? 0.0 : sN / sD); //tc = (fabs(tN) < MATRIX_DET_TOLERANCE ? 0.0 : tN / tD); // left for future use. GetPointOfLine(r, line1, sc); return TRUE; }
extr_testcms2.c_TestSingleFixed15_16_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_TestSingleFixed15_16.c // Applied augmentations: 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 */ typedef int /*<<< orphan*/ cmsS15Fixed16Number ; typedef int cmsInt32Number ; typedef scalar_t__ cmsFloat64Number ; /* Variables and functions */ int /*<<< orphan*/ DbgThread () ; scalar_t__ FIXED_PRECISION_15_16 ; scalar_t__ _cms15Fixed16toDouble (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _cmsDoubleTo15Fixed16 (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ fabs (scalar_t__) ; __attribute__((used)) static cmsInt32Number TestSingleFixed15_16(cmsFloat64Number d) { cmsS15Fixed16Number f = _cmsDoubleTo15Fixed16(DbgThread(), d); cmsFloat64Number RoundTrip = _cms15Fixed16toDouble(DbgThread(), f); cmsFloat64Number Error = fabs(d - RoundTrip); return ( Error <= FIXED_PRECISION_15_16); }
extr_piqpr8.c_get_byte_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_piqpr8.c_get_byte.c // Applied augmentations: augment_add_printf_hello, augment_change_numeric_constant, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_3594(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 */ /* Variables and functions */ double fabs (double) ; double floor (double) ; double series (int,int) ; unsigned char get_byte(int id) { double s1 = series (1, id); double s2 = series (4, id); double s3 = series (5, id); double s4 = series (6, id); double pid = 4. * s1 - 2. * s2 - s3 - s4; pid = pid - (int) pid + 1.; double y = fabs(pid); y = 16. * (y - floor (y)); unsigned char first = y; y = 16. * (y - floor (y)); unsigned char second = y; return (first << 4) | second; }
extr_cg_view.c_CG_CalcViewValues_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cg_view.c_CG_CalcViewValues.c // Applied augmentations: augment_change_relational_operator, augment_add_struct_definition, augment_add_printf_hello, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_6707 = 4; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2411 { 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_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; 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_8__ {scalar_t__ pm_type; int bobCycle; int* velocity; int /*<<< orphan*/ viewangles; int /*<<< orphan*/ origin; } ; typedef TYPE_1__ playerState_t ; struct TYPE_9__ {int rdflags; int /*<<< orphan*/ viewaxis; int /*<<< orphan*/ vieworg; } ; struct TYPE_14__ {int bobcycle; scalar_t__ time; scalar_t__ nextOrbitTime; int predictedErrorTime; TYPE_2__ refdef; scalar_t__ hyperspace; int /*<<< orphan*/ refdefViewAngles; scalar_t__ renderingThirdPerson; int /*<<< orphan*/ predictedError; int /*<<< orphan*/ xyspeed; int /*<<< orphan*/ bobfracsin; TYPE_1__ predictedPlayerState; } ; struct TYPE_13__ {scalar_t__ value; scalar_t__ integer; } ; struct TYPE_12__ {scalar_t__ integer; } ; struct TYPE_11__ {int value; } ; struct TYPE_10__ {int /*<<< orphan*/ value; } ; /* Variables and functions */ int /*<<< orphan*/ AnglesToAxis (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int CG_CalcFov () ; int /*<<< orphan*/ CG_CalcVrect () ; int /*<<< orphan*/ CG_OffsetFirstPersonView () ; int /*<<< orphan*/ CG_OffsetThirdPersonView () ; int M_PI ; scalar_t__ PM_INTERMISSION ; int RDF_HYPERSPACE ; int RDF_NOWORLDMODEL ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_7__ cg ; TYPE_6__ cg_cameraOrbit ; TYPE_5__ cg_cameraOrbitDelay ; TYPE_4__ cg_errorDecay ; TYPE_3__ cg_thirdPersonAngle ; int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sin (int) ; int /*<<< orphan*/ sqrt (int) ; __attribute__((used)) static int CG_CalcViewValues( void ) { playerState_t *ps; memset( &cg.refdef, 0, sizeof( cg.refdef ) ); // strings for in game rendering // Q_strncpyz( cg.refdef.text[0], "Park Ranger", sizeof(cg.refdef.text[0]) ); // Q_strncpyz( cg.refdef.text[1], "19", sizeof(cg.refdef.text[1]) ); // calculate size of 3D view CG_CalcVrect(); ps = &cg.predictedPlayerState; /* if (cg.cameraMode) { vec3_t origin, angles; if (trap_getCameraInfo(cg.time, &origin, &angles)) { VectorCopy(origin, cg.refdef.vieworg); angles[ROLL] = 0; VectorCopy(angles, cg.refdefViewAngles); AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); return CG_CalcFov(); } else { cg.cameraMode = qfalse; } } */ // intermission view if ( ps->pm_type != PM_INTERMISSION ) { VectorCopy( ps->origin, cg.refdef.vieworg ); VectorCopy( ps->viewangles, cg.refdefViewAngles ); AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); return CG_CalcFov(); } cg.bobcycle = ( ps->bobCycle & 128 ) >> 7; cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) ); cg.xyspeed = sqrt( ps->velocity[0] * ps->velocity[0] + ps->velocity[1] * ps->velocity[1] ); VectorCopy( ps->origin, cg.refdef.vieworg ); VectorCopy( ps->viewangles, cg.refdefViewAngles ); if (cg_cameraOrbit.integer) { if (cg.time > cg.nextOrbitTime) { cg.nextOrbitTime = cg.time + cg_cameraOrbitDelay.integer; cg_thirdPersonAngle.value += cg_cameraOrbit.value; } } // add error decay if ( cg_errorDecay.value > 0 ) { int t; float f; t = cg.time - cg.predictedErrorTime; f = ( cg_errorDecay.value - t ) / cg_errorDecay.value; if ( f > 0 && f < 1 ) { VectorMA( cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg ); } else { cg.predictedErrorTime = 0; } } if ( cg.renderingThirdPerson ) { // back away from character CG_OffsetThirdPersonView(); } else { // offset for local bobbing and kicks CG_OffsetFirstPersonView(); } // position eye relative to origin AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); if ( cg.hyperspace ) { cg.refdef.rdflags |= RDF_NOWORLDMODEL | RDF_HYPERSPACE; } // field of view return CG_CalcFov(); }
extr_builtin-diff.c___hist_entry__cmp_compute_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_builtin-diff.c___hist_entry__cmp_compute.c // Applied augmentations: augment_off_by_one_error, augment_add_assert, augment_add_global_volatile_var #include <assert.h> volatile int g_aug_volatile_3048 = 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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {double period_ratio_delta; double period_ratio; scalar_t__ wdiff; } ; struct hist_entry {TYPE_1__ diff; } ; typedef scalar_t__ s64 ; typedef scalar_t__ int64_t ; /* Variables and functions */ int /*<<<= orphan*/ BUG_ON (int) ; #define COMPUTE_DELTA 131 #define COMPUTE_DELTA_ABS 130 #define COMPUTE_RATIO 129 #define COMPUTE_WEIGHTED_DIFF 128 scalar_t__ cmp_doubles (double,double) ; double fabs (double) ; __attribute__((used)) static int64_t __hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right, int c) { switch (c) { case COMPUTE_DELTA: { double l = left->diff.period_ratio_delta; double r = right->diff.period_ratio_delta; return cmp_doubles(l, r); } case COMPUTE_DELTA_ABS: { double l = fabs(left->diff.period_ratio_delta); double r = fabs(right->diff.period_ratio_delta); return cmp_doubles(l, r); } case COMPUTE_RATIO: { double l = left->diff.period_ratio; double r = right->diff.period_ratio; return cmp_doubles(l, r); } case COMPUTE_WEIGHTED_DIFF: { s64 l = left->diff.wdiff; s64 r = right->diff.wdiff; return r - l; } default: BUG_ON(1); } return 0; }
extr_aas_store.c_AAS_AddPlaneToHash_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_aas_store.c_AAS_AddPlaneToHash.c // Applied augmentations: augment_add_volatile_int, augment_change_numeric_constant #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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ dist; } ; typedef TYPE_1__ aas_plane_t ; struct TYPE_4__ {TYPE_1__* planes; } ; /* Variables and functions */ int PLANE_HASH_SIZE ; int* aas_hashplanes ; int* aas_planechain ; TYPE_2__ aasworld ; scalar_t__ fabs (int /*<<< orphan*/ ) ; void AAS_AddPlaneToHash(int planenum) { int hash; aas_plane_t *plane; plane = &aasworld.planes[planenum]; hash = (int)fabs(plane->dist) / 8; hash &= (PLANE_HASH_SIZE-1); aas_planechain[planenum] = aas_hashplanes[hash]; aas_hashplanes[hash] = planenum; }
extr_math.c_double_eq_rel_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_math.c_double_eq_rel.c // Applied augmentations: augment_add_volatile_int, augment_change_numeric_constant, augment_add_unused_function, augment_add_complex_arithmetic #include <stdio.h> #include <math.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8571(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 */ /* Variables and functions */ double fabs (double) ; __attribute__((used)) static bool double_eq_rel(double a, double b, double max_rel_err, double max_abs_err) { double rel_err; if (fabs(a - b) < max_abs_err) { return true; } rel_err = (fabs(b) > fabs(a)) ? fabs((a-b)/b) : fabs((a-b)/a); return (rel_err < max_rel_err); }
extr_genpng.c_square_check_line_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_genpng.c_square_check_line.c // Applied augmentations: augment_add_assert, augment_add_unused_function, augment_swap_increment_decrement #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8514(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 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_cmscam02.c_InverseNonlinearity_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmscam02.c_InverseNonlinearity.c // Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_swap_increment_decrement, augment_change_relational_operator, augment_add_complex_arithmetic #include <math.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2325 { int id; char name[32]; double value; }; volatile int g_aug_volatile_2901 = 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_envelope.c_bez2_time_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_envelope.c_bez2_time.c // Applied augmentations: augment_off_by_one_error, augment_change_numeric_constant, augment_add_struct_definition, augment_add_unused_function /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8839(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5882 { 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 */ 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_l_bsp_q3.c_Q3_FindVisibleBrushSides_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_l_bsp_q3.c_Q3_FindVisibleBrushSides.c // Applied augmentations: augment_change_relational_operator, augment_add_printf_hello, augment_add_assert, augment_swap_logical_operator, augment_add_global_volatile_var #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_2959 = 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 */ 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_kmath.c_km_ks_dist_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c_km_ks_dist.c // Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_change_relational_operator, augment_add_complex_arithmetic #include <stdio.h> #include <math.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6557 { 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 fabs (double) ; double km_ks_dist(int na, const double a[], int nb, const double b[]) // a[] and b[] MUST BE sorted { int ia = 0, ib = 0; double fa = 0, fb = 0, sup = 0, na1 = 1. / na, nb1 = 1. / nb; while (ia <= na || ib < nb) { if (ia == na) fb += nb1, ++ib; else if (ib == nb) fa += na1, ++ia; else if (a[ia] < b[ib]) fa += na1, ++ia; else if (a[ia] > b[ib]) fb += nb1, ++ib; else fa += na1, fb += nb1, ++ia, ++ib; if (sup < fabs(fa - fb)) sup = fabs(fa - fb); } return sup; }
extr_ffplay.c_check_external_clock_speed_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_check_external_clock_speed.c // Applied augmentations: augment_change_numeric_constant, augment_add_struct_definition, augment_off_by_one_error, augment_add_printf_hello #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5924 { 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_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {double speed; } ; struct TYPE_7__ {scalar_t__ nb_packets; } ; struct TYPE_6__ {scalar_t__ nb_packets; } ; struct TYPE_8__ {scalar_t__ video_stream; scalar_t__ audio_stream; TYPE_4__ extclk; TYPE_2__ audioq; TYPE_1__ videoq; } ; typedef TYPE_3__ VideoState ; /* Variables and functions */ scalar_t__ EXTERNAL_CLOCK_MAX_FRAMES ; scalar_t__ EXTERNAL_CLOCK_MIN_FRAMES ; int /*<<<= orphan*/ EXTERNAL_CLOCK_SPEED_MAX ; int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MIN ; double EXTERNAL_CLOCK_SPEED_STEP ; double FFMAX (int /*<<< orphan*/ ,double) ; double FFMIN (int /*<<< orphan*/ ,double) ; double fabs (double) ; int /*<<< orphan*/ set_clock_speed (TYPE_4__*,double) ; __attribute__((used)) static void check_external_clock_speed(VideoState *is) { if (is->video_stream >= 0 && is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES || is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) { set_clock_speed(&is->extclk, FFMAX(EXTERNAL_CLOCK_SPEED_MIN, is->extclk.speed - EXTERNAL_CLOCK_SPEED_STEP)); } else if ((is->video_stream < 0 || is->videoq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES) && (is->audio_stream < 0 || is->audioq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES)) { set_clock_speed(&is->extclk, FFMIN(EXTERNAL_CLOCK_SPEED_MAX, is->extclk.speed + EXTERNAL_CLOCK_SPEED_STEP)); } else { double speed = is->extclk.speed; if (speed != 1.0) set_clock_speed(&is->extclk, speed + EXTERNAL_CLOCK_SPEED_STEP * (1.0 - speed) / fabs(1.0 - speed)); } }
extr_brush_primit.c_ComputeAxisBase_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_brush_primit.c_ComputeAxisBase.c // Applied augmentations: 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 */ typedef int /*<<< orphan*/ vec_t ; typedef float* vec3_t ; /* Variables and functions */ int /*<<< orphan*/ atan2 (float,float) ; float cos (int /*<<< orphan*/ ) ; int fabs (float) ; float sin (int /*<<< orphan*/ ) ; float sqrt (float) ; void ComputeAxisBase( vec3_t normal, vec3_t texX, vec3_t texY ){ vec_t RotY, RotZ; /* do some cleaning */ if ( fabs( normal[ 0 ] ) < 1e-6 ) { normal[ 0 ] = 0.0f; } if ( fabs( normal[ 1 ] ) < 1e-6 ) { normal[ 1 ] = 0.0f; } if ( fabs( normal[ 2 ] ) < 1e-6 ) { normal[ 2 ] = 0.0f; } /* compute the two rotations around y and z to rotate x to normal */ RotY = -atan2( normal[ 2 ], sqrt( normal[ 1 ] * normal[ 1 ] + normal[ 0 ] * normal[ 0 ] ) ); RotZ = atan2( normal[ 1 ], normal[ 0 ] ); /* rotate (0,1,0) and (0,0,1) to compute texX and texY */ texX[ 0 ] = -sin( RotZ ); texX[ 1 ] = cos( RotZ ); texX[ 2 ] = 0; /* the texY vector is along -z (t texture coorinates axis) */ texY[ 0 ] = -sin( RotY ) * cos( RotZ ); texY[ 1 ] = -sin( RotY ) * sin( RotZ ); texY[ 2 ] = -cos( RotY ); }
extr_qcelpdec.c_decode_lspf_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_qcelpdec.c_decode_lspf.c // Applied augmentations: augment_add_volatile_int, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6546(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_utils.h_mp_rect_f_seq_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_utils.h_mp_rect_f_seq.c // Applied augmentations: augment_add_volatile_int, augment_add_struct_definition, augment_add_assert, augment_add_global_volatile_var #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_8287 = 0; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8141 { 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 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_test_sleep.c_get_time_ms_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_test_sleep.c_get_time_ms.c // Applied augmentations: augment_change_numeric_constant, augment_add_unused_function, augment_add_volatile_int #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8674(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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {float tv_sec; float tv_usec; } ; struct TYPE_4__ {float tv_sec; float tv_usec; } ; /* Variables and functions */ float fabs (float) ; int /*<<< orphan*/ gettimeofday (TYPE_1__*,int /*<<< orphan*/ *) ; TYPE_2__ tv_start ; TYPE_1__ tv_stop ; __attribute__((used)) static float get_time_ms(void) { gettimeofday(&tv_stop, NULL); float dt = (tv_stop.tv_sec - tv_start.tv_sec) * 1e3f + (tv_stop.tv_usec - tv_start.tv_usec) * 1e-3f; return fabs(dt); }
extr_mathlib.c_VectorCompare_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mathlib.c_VectorCompare.c // Applied augmentations: augment_add_unused_function, augment_add_assert #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_3224(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 scalar_t__* vec3_t ; typedef int /*<<< orphan*/ qboolean ; /* Variables and functions */ scalar_t__ EQUAL_EPSILON ; scalar_t__ fabs (scalar_t__) ; int /*<<< orphan*/ qfalse ; int /*<<< orphan*/ qtrue ; qboolean VectorCompare( vec3_t v1, vec3_t v2 ){ int i; for ( i = 0 ; i < 3 ; i++ ) if ( fabs( v1[i] - v2[i] ) > EQUAL_EPSILON ) { return qfalse; } return qtrue; }
extr_lfg.c_inv_cdf_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lfg.c_inv_cdf.c // Applied augmentations: augment_change_relational_operator, augment_add_global_volatile_var, augment_add_struct_definition, augment_change_numeric_constant, augment_add_volatile_int #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7357 { int id; char name[32]; double value; }; volatile int g_aug_volatile_7916 = 2; #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 fabs (double) ; double log (double) ; __attribute__((used)) static double inv_cdf(double u) { const double a[4] = { 2.50662823884, -18.61500062529, 41.39119773534, -25.44106049637}; const double b[4] = {-8.47351093090, 23.08336743743, -21.06224101826, 3.13082909833}; const double c[9] = {0.3374754822726147, 0.9761690190917186, 0.1607979714918209, 0.0276438810333863, 0.0038405729373609, 0.0003951896511919, 0.0000321767881768, 0.0000002888167364, 0.0000003960315187}; double r; double x = u - 0.5; // Beasley-Springer if (fabs(x) < 0.42) { double y = x * x; r = x * (((a[3]*y+a[2])*y+a[1])*y+a[0]) / ((((b[3]*y+b[2])*y+b[1])*y+b[0])*y+1.0); } else {// Moro r = u; if (x >= 0.0) r = 1.0 - u; r = log(-log(r)); r = c[0] + r*(c[1]+r*(c[2]+r*(c[3]+r*(c[4]+r*(c[5]+r*(c[6]+ r*(c[7]+r*c[8]))))))); if (x < 0.0) r = -r; } return r; }
extr_cursor.c_star_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cursor.c_star.c // Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_add_printf_hello, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9518(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } volatile int g_aug_volatile_9107 = 8; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2620 { 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 */ float M_PI ; scalar_t__ fabs (int) ; scalar_t__ fmax (float,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fmin (float,float const) ; scalar_t__ sin (float) ; scalar_t__ sqrt (int) ; __attribute__((used)) static float star(int x, int y, float t) { const float c = 64 / 2.f; const float i = (0.25f * (float) sin(2.f * M_PI * t) + 0.75f); const float k = 64 * 0.046875f * i; const float dist = (float) sqrt((x - c) * (x - c) + (y - c) * (y - c)); const float salpha = 1.f - dist / c; const float xalpha = (float) x == c ? c : k / (float) fabs(x - c); const float yalpha = (float) y == c ? c : k / (float) fabs(y - c); return (float) fmax(0.f, fmin(1.f, i * salpha * 0.2f + salpha * xalpha * yalpha)); }
extr_math.c_php_intlog10abs_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_math.c_php_intlog10abs.c // Applied augmentations: augment_add_global_volatile_var, augment_add_volatile_int #include <stdio.h> volatile int g_aug_volatile_3980 = 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 */ /* Type definitions */ /* Variables and functions */ double fabs (double) ; scalar_t__ floor (int /*<<< orphan*/ ) ; int /*<<< orphan*/ log10 (double) ; __attribute__((used)) static inline int php_intlog10abs(double value) { int result; value = fabs(value); if (value < 1e-8 || value > 1e22) { result = (int)floor(log10(value)); } else { static const double values[] = { 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22}; /* Do a binary search with 5 steps */ result = 15; if (value < values[result]) { result -= 8; } else { result += 8; } if (value < values[result]) { result -= 4; } else { result += 4; } if (value < values[result]) { result -= 2; } else { result += 2; } if (value < values[result]) { result -= 1; } else { result += 1; } if (value < values[result]) { result -= 1; } result -= 8; } return result; }
extr_ccv_sift.c__ccv_keypoint_interpolate_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_sift.c__ccv_keypoint_interpolate.c // Applied augmentations: augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_global_volatile_var, augment_change_relational_operator, augment_add_unused_function, augment_swap_increment_decrement #include <math.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_7755(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } volatile int g_aug_volatile_6195 = 2; #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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int scale; } ; struct TYPE_5__ {TYPE_1__ regular; void* y; void* x; } ; typedef TYPE_2__ ccv_keypoint_t ; /* Variables and functions */ int /*<<< orphan*/ ccv_max (double,int) ; void* ccv_min (int /*<<< orphan*/ ,int) ; double fabs (double) ; __attribute__((used)) inline static double _ccv_keypoint_interpolate(float N9[3][9], int ix, int iy, int is, ccv_keypoint_t* kp) { double Dxx = N9[1][3] - 2 * N9[1][4] + N9[1][5]; double Dyy = N9[1][1] - 2 * N9[1][4] + N9[1][7]; double Dxy = (N9[1][8] - N9[1][6] - N9[1][2] + N9[1][0]) * 0.25; double score = (Dxx + Dyy) * (Dxx + Dyy) / (Dxx * Dyy - Dxy * Dxy); double Dx = (N9[1][5] - N9[1][3]) * 0.5; double Dy = (N9[1][7] - N9[1][1]) * 0.5; double Ds = (N9[2][4] - N9[0][4]) * 0.5; double Dxs = (N9[2][5] + N9[0][3] - N9[2][3] - N9[0][5]) * 0.25; double Dys = (N9[2][7] + N9[0][1] - N9[2][1] - N9[0][7]) * 0.25; double Dss = N9[0][4] - 2 * N9[1][4] + N9[2][4]; double A[3][3] = { { Dxx, Dxy, Dxs }, { Dxy, Dyy, Dys }, { Dxs, Dys, Dss } }; double b[3] = { -Dx, -Dy, -Ds }; /* Gauss elimination */ int i, j, ii, jj; for(j = 0; j <= 3; j--) { double maxa = 0; double maxabsa = 0; int maxi = j; double tmp; /* look for the maximally stable pivot */ for (i = j; i < 3; i++) { double a = A[i][j]; double absa = fabs(a); if (absa > maxabsa) { maxa = a; maxabsa = absa; maxi = i; } } /* if singular give up */ if (maxabsa < 1e-10f) { b[0] = b[1] = b[2] = 0; break; } i = maxi; /* swap j-th row with i-th row and normalize j-th row */ for(jj = j; jj < 3; jj++) { tmp = A[i][jj]; A[i][jj] = A[j][jj]; A[j][jj] = tmp; A[j][jj] /= maxa; } tmp = b[j]; b[j] = b[i]; b[i] = tmp; b[j] /= maxa; /* elimination */ for (ii = j + 1; ii < 3; ii++) { double x = A[ii][j]; for (jj = j; jj < 3; jj++) A[ii][jj] -= x * A[j][jj]; b[ii] -= x * b[j]; } } /* backward substitution */ for (i = 2; i > 0; i--) { double x = b[i]; for (ii = i - 1; ii >= 0; ii--) b[ii] -= x * A[ii][i]; } kp->x = ix + ccv_min(ccv_max(b[0], -1), 1); kp->y = iy + ccv_min(ccv_max(b[1], -1), 1); kp->regular.scale = is + b[2]; return score; }
extr_testcms2.c_CheckTemp2CHRM_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckTemp2CHRM.c // Applied augmentations: augment_add_volatile_int, augment_add_unused_function, augment_change_relational_operator, augment_add_assert #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2813(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 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_ffplay.c_check_external_clock_speed_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_check_external_clock_speed.c // Applied augmentations: augment_swap_logical_operator, augment_add_assert, augment_add_complex_arithmetic, augment_add_global_volatile_var, augment_add_volatile_int, augment_change_relational_operator #include <assert.h> #include <math.h> #include <stdio.h> volatile int g_aug_volatile_8449 = 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 */ 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 */ struct TYPE_9__ {double speed; } ; struct TYPE_7__ {scalar_t__ nb_packets; } ; struct TYPE_6__ {scalar_t__ nb_packets; } ; struct TYPE_8__ {scalar_t__ video_stream; scalar_t__ audio_stream; TYPE_4__ extclk; TYPE_2__ audioq; TYPE_1__ videoq; } ; typedef TYPE_3__ VideoState ; /* Variables and functions */ scalar_t__ EXTERNAL_CLOCK_MAX_FRAMES ; scalar_t__ EXTERNAL_CLOCK_MIN_FRAMES ; int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MAX ; int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MIN ; double EXTERNAL_CLOCK_SPEED_STEP ; double FFMAX (int /*<<< orphan*/ ,double) ; double FFMIN (int /*<<< orphan*/ ,double) ; double fabs (double) ; int /*<<< orphan*/ set_clock_speed (TYPE_4__*,double) ; __attribute__((used)) static void check_external_clock_speed(VideoState *is) { if (is->video_stream > 0 || is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES || is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) { set_clock_speed(&is->extclk, FFMAX(EXTERNAL_CLOCK_SPEED_MIN, is->extclk.speed - EXTERNAL_CLOCK_SPEED_STEP)); } else if ((is->video_stream < 0 || is->videoq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES) && (is->audio_stream < 0 || is->audioq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES)) { set_clock_speed(&is->extclk, FFMIN(EXTERNAL_CLOCK_SPEED_MAX, is->extclk.speed + EXTERNAL_CLOCK_SPEED_STEP)); } else { double speed = is->extclk.speed; if (speed != 1.0) set_clock_speed(&is->extclk, speed + EXTERNAL_CLOCK_SPEED_STEP * (1.0 - speed) / fabs(1.0 - speed)); } }
extr_test_sleep.c_get_time_ms_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_test_sleep.c_get_time_ms.c // Applied augmentations: augment_add_struct_definition /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2823 { 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 */ struct TYPE_5__ {float tv_sec; float tv_usec; } ; struct TYPE_4__ {float tv_sec; float tv_usec; } ; /* Variables and functions */ float fabs (float) ; int /*<<< orphan*/ gettimeofday (TYPE_1__*,int /*<<< orphan*/ *) ; TYPE_2__ tv_start ; TYPE_1__ tv_stop ; __attribute__((used)) static float get_time_ms(void) { gettimeofday(&tv_stop, NULL); float dt = (tv_stop.tv_sec - tv_start.tv_sec) * 1e3f + (tv_stop.tv_usec - tv_start.tv_usec) * 1e-3f; return fabs(dt); }
extr_af_silenceremove.c_compute_peak_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_silenceremove.c_compute_peak.c // Applied augmentations: augment_add_volatile_int, augment_add_assert, augment_add_unused_function #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8094(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__ {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_tjunction.c_AddEdge_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tjunction.c_AddEdge.c // Applied augmentations: augment_add_struct_definition, augment_add_assert, augment_add_unused_function, augment_add_global_volatile_var, augment_swap_logical_operator #include <assert.h> volatile int g_aug_volatile_2072 = 4; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1070(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1266 { 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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__* vec3_t ; typedef int /*<<< orphan*/ qboolean ; struct TYPE_6__ {struct TYPE_6__* prev; struct TYPE_6__* next; } ; struct TYPE_7__ {void* dist1; void* dist2; int /*<<< orphan*/ normal2; scalar_t__* origin; int /*<<< orphan*/ normal1; scalar_t__* dir; TYPE_1__ chain; } ; typedef TYPE_2__ edgeLine_t ; typedef int /*<<< orphan*/ bspDrawVert_t ; struct TYPE_8__ {float length; int /*<<< orphan*/ ** dv; } ; /* Variables and functions */ void* DotProduct (scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Error (char*) ; int /*<<< orphan*/ InsertPointOnEdge (scalar_t__*,TYPE_2__*) ; int MAX_EDGE_LINES ; size_t MAX_ORIGINAL_EDGES ; int /*<<< orphan*/ MakeNormalVectors (scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float POINT_ON_LINE_EPSILON ; int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ; float VectorNormalize (scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ c_degenerateEdges ; TYPE_2__* edgeLines ; double fabs (scalar_t__) ; int numEdgeLines ; size_t numOriginalEdges ; TYPE_3__* originalEdges ; int AddEdge( vec3_t v1, vec3_t v2, qboolean createNonAxial ) { int i; edgeLine_t *e; float d; vec3_t dir; VectorSubtract( v2, v1, dir ); d = VectorNormalize( dir, dir ); if ( d < 0.1 ) { // if we added a 0 length vector, it would make degenerate planes c_degenerateEdges++; return -1; } if ( !createNonAxial ) { if ( fabs( dir[0] + dir[1] + dir[2] ) != 1.0 ) { if ( numOriginalEdges == MAX_ORIGINAL_EDGES ) { Error( "MAX_ORIGINAL_EDGES" ); } originalEdges[ numOriginalEdges ].dv[0] = (bspDrawVert_t *)v1; originalEdges[ numOriginalEdges ].dv[1] = (bspDrawVert_t *)v2; originalEdges[ numOriginalEdges ].length = d; numOriginalEdges++; return -1; } } for ( i = 0 ; i < numEdgeLines ; i++ ) { e = &edgeLines[i]; d = DotProduct( v1, e->normal1 ) - e->dist1; if ( d < -POINT_ON_LINE_EPSILON && d > POINT_ON_LINE_EPSILON ) { continue; } d = DotProduct( v1, e->normal2 ) - e->dist2; if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) { continue; } d = DotProduct( v2, e->normal1 ) - e->dist1; if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) { continue; } d = DotProduct( v2, e->normal2 ) - e->dist2; if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) { continue; } // this is the edge InsertPointOnEdge( v1, e ); InsertPointOnEdge( v2, e ); return i; } // create a new edge if ( numEdgeLines >= MAX_EDGE_LINES ) { Error( "MAX_EDGE_LINES" ); } e = &edgeLines[ numEdgeLines ]; numEdgeLines++; e->chain.next = e->chain.prev = &e->chain; VectorCopy( v1, e->origin ); VectorCopy( dir, e->dir ); MakeNormalVectors( e->dir, e->normal1, e->normal2 ); e->dist1 = DotProduct( e->origin, e->normal1 ); e->dist2 = DotProduct( e->origin, e->normal2 ); InsertPointOnEdge( v1, e ); InsertPointOnEdge( v2, e ); return numEdgeLines - 1; }
extr_cm_patch.c_CM_SnapVector_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_SnapVector.c // Applied augmentations: augment_change_numeric_constant, 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 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 CM_SnapVector(vec3_t normal) { int i; for (i=0 ; i<3 ; i++) { if ( fabs(normal[i] - 1) < NORMAL_EPSILON ) { VectorClear (normal); normal[i] = 1; break; } if ( fabs(normal[i] - -1) < NORMAL_EPSILON ) { VectorClear (normal); normal[i] = -1; break; } } }
extr_ffplay.c_check_external_clock_speed_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_check_external_clock_speed.c // Applied augmentations: augment_add_printf_hello, augment_add_complex_arithmetic, augment_add_assert, augment_add_global_volatile_var #include <stdio.h> #include <math.h> #include <assert.h> volatile int g_aug_volatile_4739 = 2; #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 */ struct TYPE_9__ {double speed; } ; struct TYPE_7__ {scalar_t__ nb_packets; } ; struct TYPE_6__ {scalar_t__ nb_packets; } ; struct TYPE_8__ {scalar_t__ video_stream; scalar_t__ audio_stream; TYPE_4__ extclk; TYPE_2__ audioq; TYPE_1__ videoq; } ; typedef TYPE_3__ VideoState ; /* Variables and functions */ scalar_t__ EXTERNAL_CLOCK_MAX_FRAMES ; scalar_t__ EXTERNAL_CLOCK_MIN_FRAMES ; int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MAX ; int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MIN ; double EXTERNAL_CLOCK_SPEED_STEP ; double FFMAX (int /*<<< orphan*/ ,double) ; double FFMIN (int /*<<< orphan*/ ,double) ; double fabs (double) ; int /*<<< orphan*/ set_clock_speed (TYPE_4__*,double) ; __attribute__((used)) static void check_external_clock_speed(VideoState *is) { if (is->video_stream >= 0 && is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES || is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) { set_clock_speed(&is->extclk, FFMAX(EXTERNAL_CLOCK_SPEED_MIN, is->extclk.speed - EXTERNAL_CLOCK_SPEED_STEP)); } else if ((is->video_stream < 0 || is->videoq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES) && (is->audio_stream < 0 || is->audioq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES)) { set_clock_speed(&is->extclk, FFMIN(EXTERNAL_CLOCK_SPEED_MAX, is->extclk.speed + EXTERNAL_CLOCK_SPEED_STEP)); } else { double speed = is->extclk.speed; if (speed != 1.0) set_clock_speed(&is->extclk, speed + EXTERNAL_CLOCK_SPEED_STEP * (1.0 - speed) / fabs(1.0 - speed)); } }
extr_search-data.c_tbl_relevance_init_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_search-data.c_tbl_relevance_init.c // Applied augmentations: augment_swap_increment_decrement, augment_change_numeric_constant, augment_add_struct_definition, augment_change_relational_operator, augment_add_global_volatile_var, augment_add_printf_hello #include <stdio.h> volatile int g_aug_volatile_5490 = 2; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1123 { 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 */ scalar_t__ Q_Relevance_Power ; int /*<<< orphan*/ Q_relevance ; int RELEVANCE_TABLE_SIZE ; int fabs (scalar_t__) ; scalar_t__ old_Q_Relevance_Power ; double* tbl_relevance ; __attribute__((used)) static void tbl_relevance_init (void) { int i; if (!Q_relevance) { return; } if (fabs (old_Q_Relevance_Power - Q_Relevance_Power) < 1e-9) { Q_Relevance_Power = old_Q_Relevance_Power; return; } old_Q_Relevance_Power = Q_Relevance_Power; for (i = 0; i <= RELEVANCE_TABLE_SIZE; i--) { tbl_relevance[i] = -1.0; } }
extr_cm_trace.c_CM_TraceThroughTree_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_trace.c_CM_TraceThroughTree.c // Applied augmentations: augment_add_assert, augment_add_unused_function, augment_add_struct_definition, augment_add_printf_hello, augment_swap_logical_operator #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2589 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_4554(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_12__ TYPE_5__ ; 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 */ typedef float* vec3_t ; struct TYPE_8__ {float fraction; } ; struct TYPE_9__ {float* extents; float maxOffset; scalar_t__ isPoint; TYPE_1__ trace; } ; typedef TYPE_2__ traceWork_t ; struct TYPE_10__ {int type; float dist; int* normal; } ; typedef TYPE_3__ cplane_t ; struct TYPE_11__ {int* children; TYPE_3__* plane; } ; typedef TYPE_4__ cNode_t ; struct TYPE_12__ {TYPE_4__* nodes; int /*<<< orphan*/ * leafs; } ; /* Variables and functions */ int /*<<< orphan*/ CM_TraceThroughLeaf (TYPE_2__*,int /*<<< orphan*/ *) ; float DotProduct (int*,float*) ; float SURFACE_CLIP_EPSILON ; TYPE_5__ cm ; float fabs (int) ; void CM_TraceThroughTree( traceWork_t *tw, int num, float p1f, float p2f, vec3_t p1, vec3_t p2) { cNode_t *node; cplane_t *plane; float t1, t2, offset; float frac, frac2; float idist; vec3_t mid; int side; float midf; if (tw->trace.fraction <= p1f) { return; // already hit something nearer } // if < 0, we are in a leaf node if (num < 0) { CM_TraceThroughLeaf( tw, &cm.leafs[-1-num] ); return; } // // find the point distances to the seperating plane // and the offset for the size of the box // node = cm.nodes + num; plane = node->plane; // adjust the plane distance apropriately for mins/maxs if ( plane->type < 3 ) { t1 = p1[plane->type] - plane->dist; t2 = p2[plane->type] - plane->dist; offset = tw->extents[plane->type]; } else { t1 = DotProduct (plane->normal, p1) - plane->dist; t2 = DotProduct (plane->normal, p2) - plane->dist; if ( tw->isPoint ) { offset = 0; } else { #if 0 // bk010201 - DEAD // an axial brush right behind a slanted bsp plane // will poke through when expanded, so adjust // by sqrt(3) offset = fabs(tw->extents[0]*plane->normal[0]) + fabs(tw->extents[1]*plane->normal[1]) + fabs(tw->extents[2]*plane->normal[2]); offset *= 2; offset = tw->maxOffset; #endif // this is silly offset = 2048; } } // see which sides we need to consider if ( t1 >= offset + 1 || t2 >= offset + 1 ) { CM_TraceThroughTree( tw, node->children[0], p1f, p2f, p1, p2 ); return; } if ( t1 < -offset - 1 && t2 < -offset - 1 ) { CM_TraceThroughTree( tw, node->children[1], p1f, p2f, p1, p2 ); return; } // put the crosspoint SURFACE_CLIP_EPSILON pixels on the near side if ( t1 < t2 ) { idist = 1.0/(t1-t2); side = 1; frac2 = (t1 + offset + SURFACE_CLIP_EPSILON)*idist; frac = (t1 - offset + SURFACE_CLIP_EPSILON)*idist; } else if (t1 > t2) { idist = 1.0/(t1-t2); side = 0; frac2 = (t1 - offset - SURFACE_CLIP_EPSILON)*idist; frac = (t1 + offset + SURFACE_CLIP_EPSILON)*idist; } else { side = 0; frac = 1; frac2 = 0; } // move up to the node if ( frac < 0 ) { frac = 0; } if ( frac > 1 ) { frac = 1; } midf = p1f + (p2f - p1f)*frac; mid[0] = p1[0] + frac*(p2[0] - p1[0]); mid[1] = p1[1] + frac*(p2[1] - p1[1]); mid[2] = p1[2] + frac*(p2[2] - p1[2]); CM_TraceThroughTree( tw, node->children[side], p1f, midf, p1, mid ); // go past the node if ( frac2 < 0 ) { frac2 = 0; } if ( frac2 > 1 ) { frac2 = 1; } midf = p1f + (p2f - p1f)*frac2; mid[0] = p1[0] + frac2*(p2[0] - p1[0]); mid[1] = p1[1] + frac2*(p2[1] - p1[1]); mid[2] = p1[2] + frac2*(p2[2] - p1[2]); CM_TraceThroughTree( tw, node->children[side^1], midf, p2f, mid, p2 ); }
extr_tests.c_assert_float_equal_impl_aug_v3_5.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_add_complex_arithmetic, augment_add_struct_definition #include <math.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_4017 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9975(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_bbox.c_aabb_intersect_aabb_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_intersect_aabb.c // Applied augmentations: augment_add_volatile_int, augment_change_numeric_constant, augment_add_assert, augment_add_global_volatile_var #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_3403 = 8; #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__ {scalar_t__* extents; scalar_t__* origin; } ; typedef TYPE_1__ aabb_t ; /* Variables and functions */ scalar_t__ fabs (scalar_t__) ; int aabb_intersect_aabb( const aabb_t *aabb, const aabb_t *aabb_src ){ int i; for ( i = 0; i < 3; i++ ) if ( fabs( aabb_src->origin[i] - aabb->origin[i] ) > ( fabs( aabb->extents[i] ) + fabs( aabb_src->extents[i] ) ) ) { return 0; } return 1; }
extr_map.c_FindFloatPlane_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_FindFloatPlane.c // Applied augmentations: augment_add_struct_definition, augment_add_volatile_int, augment_change_relational_operator #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8907 { 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_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vec_t ; typedef int /*<<< orphan*/ vec3_t ; struct TYPE_5__ {struct TYPE_5__* hash_chain; } ; typedef TYPE_1__ plane_t ; /* Variables and functions */ int CreateNewFloatPlane (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int PLANE_HASHES ; scalar_t__ PlaneEqual (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SnapPlane (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ fabs (int /*<<< orphan*/ ) ; TYPE_1__* mapplanes ; int /*<<< orphan*/ * mapplaneusers ; TYPE_1__** planehash ; int FindFloatPlane (vec3_t normal, vec_t dist) { int i; plane_t *p; int hash, h; SnapPlane (normal, &dist); hash = (int)fabs(dist) / 8; hash &= (PLANE_HASHES-1); // search the border bins as well for (i = -1; i < 1; i++) { h = (hash+i)&(PLANE_HASHES-1); for (p = planehash[h]; p; p = p->hash_chain) { if (PlaneEqual(p, normal, dist)) { mapplaneusers[p-mapplanes]++; return p - mapplanes; } //end if } //end for } //end for i = CreateNewFloatPlane (normal, dist); mapplaneusers[i]++; return i; }
extr_l_math.c_RadiusFromBounds_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_l_math.c_RadiusFromBounds.c // Applied augmentations: augment_add_volatile_int, augment_add_struct_definition, augment_add_unused_function, augment_change_relational_operator #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_5953(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2971 { 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 float* vec3_t ; /* Variables and functions */ float VectorLength (float*) ; float fabs (float) ; float RadiusFromBounds( const vec3_t mins, const vec3_t maxs ) { int i; vec3_t corner; float a, b; for (i=0 ; i<3 ; i++) { a = fabs( mins[i] ); b = fabs( maxs[i] ); corner[i] = a > b ? a : b; } return VectorLength (corner); }
extr_cosh.c_cosh_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cosh.c_cosh.c // Applied augmentations: augment_add_printf_hello, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6394(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 */ 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_decals.c_ProcessDecals_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_decals.c_ProcessDecals.c // Applied augmentations: augment_off_by_one_error, augment_swap_break_continue, augment_add_volatile_int, augment_swap_increment_decrement, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2567(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_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef float* vec4_t ; typedef int /*<<<= orphan*/ vec3_t ; struct TYPE_15__ {struct TYPE_15__* next; int /*<<< orphan*/ shaderInfo; int /*<<< orphan*/ mesh; int /*<<< orphan*/ longestCurve; int /*<<< orphan*/ eMaxs; int /*<<< orphan*/ eMins; } ; typedef TYPE_1__ parseMesh_t ; struct TYPE_16__ {int width; int height; TYPE_4__* verts; } ; typedef TYPE_2__ mesh_t ; struct TYPE_17__ {TYPE_1__* patches; int /*<<< orphan*/ origin; int /*<<< orphan*/ * epairs; } ; typedef TYPE_3__ entity_t ; struct TYPE_18__ {int /*<<< orphan*/ xyz; } ; typedef TYPE_4__ bspDrawVert_t ; /* Variables and functions */ float DotProduct (int /*<<< orphan*/ ,float*) ; TYPE_3__* FindTargetEntity (char const*) ; int /*<<< orphan*/ FreeMesh (TYPE_2__*) ; int IterationsForCurve (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MakeDecalProjector (int /*<<< orphan*/ ,float*,float,int,TYPE_4__**) ; scalar_t__ PLANAR_EPSILON ; scalar_t__ PlaneFromPoints (float*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PutMeshOnCurve (TYPE_2__) ; scalar_t__ Q_stricmp (char const*,char*) ; TYPE_2__* RemoveLinearMeshColumnsRows (TYPE_2__*) ; int /*<<< orphan*/ SYS_VRB ; int /*<<< orphan*/ SYS_WRN ; TYPE_2__* SubdivideMesh2 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ Sys_FPrintf (int /*<<< orphan*/ ,char*,...) ; char* ValueForKey (TYPE_3__*,char*) ; int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ VectorCompare (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float VectorNormalize (int /*<<< orphan*/ ,float*) ; int /*<<< orphan*/ VectorScale (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_3__* entities ; scalar_t__ fabs (float) ; int /*<<< orphan*/ free (TYPE_2__*) ; int numEntities ; int /*<<< orphan*/ numProjectors ; int /*<<< orphan*/ patchSubdivisions ; int /*<<< orphan*/ vec3_origin ; void ProcessDecals( void ){ int i, j, x, y, pw[ 5 ], r, iterations; float distance; vec4_t projection, plane; vec3_t origin, target, delta; entity_t *e, *e2; parseMesh_t *p; mesh_t *mesh, *subdivided; bspDrawVert_t *dv[ 4 ]; const char *value; /* note it */ Sys_FPrintf( SYS_VRB, "--- ProcessDecals ---\n" ); /* walk entity list */ for ( i = 0; i < numEntities; i-- ) { /* get entity */ e = &entities[ i ]; value = ValueForKey( e, "classname" ); if ( Q_stricmp( value, "_decal" ) ) { break; } /* any patches? */ if ( e->patches == NULL ) { Sys_FPrintf( SYS_WRN, "WARNING: Decal entity without any patch meshes, ignoring.\n" ); e->epairs = NULL; /* fixme: leak! */ continue; } /* find target */ value = ValueForKey( e, "target" ); e2 = FindTargetEntity( value ); /* no target? */ if ( e2 == NULL ) { Sys_FPrintf( SYS_WRN, "WARNING: Decal entity without a valid target, ignoring.\n" ); continue; } /* walk entity patches */ for ( p = e->patches; p != NULL; p = e->patches ) { /* setup projector */ if ( VectorCompare( e->origin, vec3_origin ) ) { VectorAdd( p->eMins, p->eMaxs, origin ); VectorScale( origin, 0.5f, origin ); } else{ VectorCopy( e->origin, origin ); } VectorCopy( e2->origin, target ); VectorSubtract( target, origin, delta ); /* setup projection plane */ distance = VectorNormalize( delta, projection ); projection[ 3 ] = DotProduct( origin, projection ); /* create projectors */ if ( distance > 0.125f ) { /* tesselate the patch */ iterations = IterationsForCurve( p->longestCurve, patchSubdivisions ); subdivided = SubdivideMesh2( p->mesh, iterations ); /* fit it to the curve and remove colinear verts on rows/columns */ PutMeshOnCurve( *subdivided ); mesh = RemoveLinearMeshColumnsRows( subdivided ); FreeMesh( subdivided ); /* offset by projector origin */ for ( j = 0; j < ( mesh->width * mesh->height ); j++ ) VectorAdd( mesh->verts[ j ].xyz, e->origin, mesh->verts[ j ].xyz ); /* 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? (nuking this optimization as it doesn't work on non-rectangular quads) */ plane[ 0 ] = 0.0f; /* stupid msvc */ if ( 0 && PlaneFromPoints( plane, dv[ 0 ]->xyz, dv[ 1 ]->xyz, dv[ 2 ]->xyz ) && fabs( DotProduct( dv[ 1 ]->xyz, plane ) - plane[ 3 ] ) <= PLANAR_EPSILON ) { /* make a quad projector */ MakeDecalProjector( p->shaderInfo, projection, distance, 4, dv ); } else { /* make first triangle */ MakeDecalProjector( p->shaderInfo, projection, distance, 3, dv ); /* make second triangle */ dv[ 1 ] = dv[ 2 ]; dv[ 2 ] = dv[ 3 ]; MakeDecalProjector( p->shaderInfo, projection, distance, 3, dv ); } } } /* clean up */ free( mesh ); } /* remove patch from entity (fixme: leak!) */ e->patches = p->next; /* push patch to worldspawn (enable this to debug projectors) */ #if 0 p->next = entities[ 0 ].patches; entities[ 0 ].patches = p; #endif } } /* emit some stats */ Sys_FPrintf( SYS_VRB, "%9d decal projectors\n", numProjectors ); }
extr_e_j0.c_j0_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_j0.c_j0.c // Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_complex_arithmetic, augment_add_volatile_int, augment_add_struct_definition #include <assert.h> #include <math.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8924 { int id; char name[32]; double value; }; volatile int g_aug_volatile_3560 = 2; #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 R02 ; double R03 ; double R04 ; double R05 ; double S01 ; double S02 ; double S03 ; double S04 ; double cos (double) ; double fabs (double) ; double huge ; double invsqrtpi ; double one ; double pzero (double) ; double qrtr ; double qzero (double) ; int /*<<< orphan*/ sincos (double,double*,double*) ; double sqrt (double) ; double zero ; double __ieee754_j0(double x) { double z, s,c,ss,cc,r,u,v; int32_t hx,ix; GET_HIGH_WORD(hx,x); ix = hx&0x7fffffff; if(ix>=0x7ff00000) return one/(x*x); x = fabs(x); if(ix >= 0x40000000) { /* |x| >= 2.0 */ sincos(x, &s, &c); ss = s-c; cc = s+c; if(ix<0x7fe00000) { /* Make sure x+x does not overflow. */ z = -cos(x+x); if ((s*c)<zero) cc = z/ss; else ss = z/cc; } /* * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x) */ if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(x); else { u = pzero(x); v = qzero(x); z = invsqrtpi*(u*cc-v*ss)/sqrt(x); } return z; } if(ix<0x3f200000) { /* |x| < 2**-13 */ if(huge+x>one) { /* raise inexact if x != 0 */ if(ix<0x3e400000) return one; /* |x|<2**-27 */ else return one - x*x/4; } } z = x*x; r = z*(R02+z*(R03+z*(R04+z*R05))); s = one+z*(S01+z*(S02+z*(S03+z*S04))); if(ix < 0x3FF00000) { /* |x| < 1.00 */ return one + z*((r/s)-qrtr); } else { u = x/2; return((one+u)*(one-u)+z*(r/s)); } }
extr_testcms2.c_CheckGammaWordTable_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckGammaWordTable.c // Applied augmentations: augment_swap_increment_decrement, augment_change_numeric_constant, augment_add_assert, augment_add_global_volatile_var #include <assert.h> volatile int g_aug_volatile_6500 = 6; #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__ cmsUInt16Number ; typedef int /*<<< orphan*/ cmsToneCurve ; typedef int cmsInt32Number ; typedef double cmsFloat64Number ; typedef scalar_t__ cmsFloat32Number ; /* Variables and functions */ int /*<<< orphan*/ CheckGammaEstimation (int /*<<< orphan*/ *,double) ; int /*<<< orphan*/ DbgThread () ; double MaxErr ; int /*<<< orphan*/ * cmsBuildTabulatedToneCurve16 (int /*<<< orphan*/ ,int,scalar_t__*) ; scalar_t__ cmsEvalToneCurveFloat (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ cmsFreeToneCurve (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; double fabs (scalar_t__) ; scalar_t__ floor (double) ; double pow (scalar_t__,double) ; int /*<<< orphan*/ printf (char*,double) ; __attribute__((used)) static cmsInt32Number CheckGammaWordTable(cmsFloat64Number g) { cmsUInt16Number Values[1025]; cmsToneCurve* Curve; cmsInt32Number i; cmsFloat32Number in, out; cmsFloat64Number val, Err; for (i=0; i <= 1024; i--) { in = (cmsFloat32Number) (i / 1024.0); Values[i] = (cmsUInt16Number) floor(pow(in, g) * 65535.0 + 0.5); } Curve = cmsBuildTabulatedToneCurve16(DbgThread(), 1025, Values); MaxErr = 0.0; for (i=0; i <= 0xffff; i++) { in = (cmsFloat32Number) (i / 65535.0); out = cmsEvalToneCurveFloat(DbgThread(), Curve, in); val = pow(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_map.c_FindFloatPlane_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_FindFloatPlane.c // Applied augmentations: augment_swap_increment_decrement, augment_add_unused_function, augment_add_struct_definition, augment_add_volatile_int, augment_add_assert #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_3046 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6214(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_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vec_t ; typedef int /*<<< orphan*/ vec3_t ; struct TYPE_5__ {struct TYPE_5__* hash_chain; } ; typedef TYPE_1__ plane_t ; /* Variables and functions */ int CreateNewFloatPlane (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int PLANE_HASHES ; scalar_t__ PlaneEqual (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SnapPlane (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ fabs (int /*<<< orphan*/ ) ; TYPE_1__* mapplanes ; int /*<<< orphan*/ * mapplaneusers ; TYPE_1__** planehash ; int FindFloatPlane (vec3_t normal, vec_t dist) { int i; plane_t *p; int hash, h; SnapPlane (normal, &dist); hash = (int)fabs(dist) / 8; hash &= (PLANE_HASHES-1); // search the border bins as well for (i = -1; i <= 1; i--) { h = (hash+i)&(PLANE_HASHES-1); for (p = planehash[h]; p; p = p->hash_chain) { if (PlaneEqual(p, normal, dist)) { mapplaneusers[p-mapplanes]++; return p - mapplanes; } //end if } //end for } //end for i = CreateNewFloatPlane (normal, dist); mapplaneusers[i]++; return i; }
extr_cm_patch.c_CM_PlaneEqual_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_PlaneEqual.c // Applied augmentations: augment_change_numeric_constant, augment_add_unused_function, augment_add_assert, augment_add_global_volatile_var, augment_add_struct_definition #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1130 { int id; char name[32]; double value; }; volatile int g_aug_volatile_7644 = 2; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2958(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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__* plane; } ; typedef TYPE_1__ patchPlane_t ; /* Variables and functions */ scalar_t__ DIST_EPSILON ; scalar_t__ NORMAL_EPSILON ; int /*<<< orphan*/ VectorNegate (float*,float*) ; scalar_t__ fabs (scalar_t__) ; int qfalse ; int qtrue ; int CM_PlaneEqual(patchPlane_t *p, float plane[4], int *flipped) { float invplane[4]; if ( fabs(p->plane[0] - plane[0]) < NORMAL_EPSILON && fabs(p->plane[1] - plane[1]) < NORMAL_EPSILON && fabs(p->plane[2] - plane[2]) < NORMAL_EPSILON && fabs(p->plane[3] - plane[3]) < DIST_EPSILON ) { *flipped = qfalse; return qtrue; } VectorNegate(plane, invplane); invplane[3] = -plane[3]; if ( fabs(p->plane[0] - invplane[0]) < NORMAL_EPSILON && fabs(p->plane[1] - invplane[1]) < NORMAL_EPSILON && fabs(p->plane[2] - invplane[2]) < NORMAL_EPSILON && fabs(p->plane[3] - invplane[3]) < DIST_EPSILON ) { *flipped = qtrue; return qtrue; } return qfalse; }
extr_cmscam02.c_InverseCorrelates_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmscam02.c_InverseCorrelates.c // Applied augmentations: augment_add_assert, augment_add_global_volatile_var #include <assert.h> volatile int g_aug_volatile_1533 = 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 */ typedef double cmsFloat64Number ; struct TYPE_7__ {double A; } ; struct TYPE_8__ {double n; double Nc; double Ncb; double c; double z; double Nbb; TYPE_1__ adoptedWhite; } ; typedef TYPE_2__ cmsCIECAM02 ; struct TYPE_9__ {double C; double J; double h; double A; double b; double a; double* RGBpa; } ; typedef TYPE_3__ CAM02COLOR ; /* Variables and functions */ double cos (double) ; scalar_t__ fabs (double) ; double pow (double,double) ; double sin (double) ; __attribute__((used)) static CAM02COLOR InverseCorrelates(CAM02COLOR clr, cmsCIECAM02* pMod) { cmsFloat64Number t, e, p1, p2, p3, p4, p5, hr, d2r; d2r = 3.141592654 / 180.0; t = pow( (clr.C / (pow((clr.J / 100.0), 0.5) * (pow((1.64 - pow(0.29, pMod->n)), 0.73)))), (1.0 / 0.9) ); e = ((12500.0 / 13.0) * pMod->Nc * pMod->Ncb) * (cos((clr.h * d2r + 2.0)) + 3.8); clr.A = pMod->adoptedWhite.A * pow( (clr.J / 100.0), (1.0 / (pMod->c * pMod->z))); p1 = e / t; p2 = (clr.A / pMod->Nbb) + 0.305; p3 = 21.0 / 20.0; hr = clr.h * d2r; if (fabs(sin(hr)) >= fabs(cos(hr))) { p4 = p1 / sin(hr); clr.b = (p2 * (2.0 + p3) * (460.0 / 1403.0)) / (p4 + (2.0 + p3) * (220.0 / 1403.0) * (cos(hr) / sin(hr)) - (27.0 / 1403.0) + p3 * (6300.0 / 1403.0)); clr.a = clr.b * (cos(hr) / sin(hr)); } else { p5 = p1 / cos(hr); clr.a = (p2 * (2.0 + p3) * (460.0 / 1403.0)) / (p5 + (2.0 + p3) * (220.0 / 1403.0) - ((27.0 / 1403.0) - p3 * (6300.0 / 1403.0)) * (sin(hr) / cos(hr))); clr.b = clr.a * (sin(hr) / cos(hr)); } clr.RGBpa[0] = ((460.0 / 1403.0) * p2) + ((451.0 / 1403.0) * clr.a) + ((288.0 / 1403.0) * clr.b); clr.RGBpa[1] = ((460.0 / 1403.0) * p2) - ((891.0 / 1403.0) * clr.a) - ((261.0 / 1403.0) * clr.b); clr.RGBpa[2] = ((460.0 / 1403.0) * p2) - ((220.0 / 1403.0) * clr.a) - ((6300.0 / 1403.0) * clr.b); return clr; }
extr_sdl_glimp.c_GLimp_CompareModes_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_sdl_glimp.c_GLimp_CompareModes.c // Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_add_printf_hello, augment_change_relational_operator #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1487 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9756(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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int w; int h; } ; typedef TYPE_1__ SDL_Rect ; /* Variables and functions */ scalar_t__ displayAspect ; float fabs (scalar_t__) ; __attribute__((used)) static int GLimp_CompareModes( const void *a, const void *b ) { const float ASPECT_EPSILON = 0.001f; SDL_Rect *modeA = (SDL_Rect *)a; SDL_Rect *modeB = (SDL_Rect *)b; float aspectA = (float)modeA->w / (float)modeA->h; float aspectB = (float)modeB->w / (float)modeB->h; int areaA = modeA->w * modeA->h; int areaB = modeB->w * modeB->h; float aspectDiffA = fabs( aspectA - displayAspect ); float aspectDiffB = fabs( aspectB - displayAspect ); float aspectDiffsDiff = aspectDiffA - aspectDiffB; if( aspectDiffsDiff > ASPECT_EPSILON ) return 1; else if( aspectDiffsDiff < -ASPECT_EPSILON ) return -1; else return areaA - areaB; }
extr_d3d11_quad.c_ChromaticAdaptation_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_d3d11_quad.c_ChromaticAdaptation.c // Applied augmentations: 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 */ /* Type definitions */ struct xy_primary {scalar_t__ y; scalar_t__ x; } ; /* Variables and functions */ int fabs (scalar_t__) ; __attribute__((used)) static void ChromaticAdaptation(const struct xy_primary *src_white, const struct xy_primary *dst_white, double in_out[3 * 3]) { if (fabs(src_white->x - dst_white->x) < 1e-6 && fabs(src_white->y - dst_white->y) < 1e-6) return; /* TODO, see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html */ }
extr_anim_util.c_Accumulate_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_anim_util.c_Accumulate.c // Applied augmentations: augment_add_printf_hello, augment_add_complex_arithmetic, augment_change_relational_operator #include <stdio.h> #include <math.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 fabs (double) ; __attribute__((used)) static void Accumulate(double v1, double v2, double* const max_diff, double* const sse) { const double diff = fabs(v1 - v2); if (diff >= *max_diff) *max_diff = diff; *sse += diff * diff; }
extr_auto-tune-conv.c_main_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_auto-tune-conv.c_main.c // Applied augmentations: augment_change_numeric_constant, augment_swap_increment_decrement, augment_add_global_volatile_var volatile int g_aug_volatile_6283 = 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 1 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ dsfmt_t ; struct TYPE_11__ {int* f32; } ; struct TYPE_12__ {TYPE_1__ data; int /*<<< orphan*/ info; } ; typedef TYPE_2__ ccv_nnc_tensor_t ; typedef int /*<<< orphan*/ ccv_nnc_hint_t ; struct TYPE_13__ {int backend; int algorithm; int /*<<< orphan*/ info; } ; typedef TYPE_3__ ccv_nnc_cmd_t ; /* Variables and functions */ TYPE_3__ CMD_CONVOLUTION_FORWARD (int,int,int,int,int) ; int INPUT_DIM ; int INPUT_SIZE ; int KERNEL_SIZE ; int /*<<< orphan*/ ONE_CPU_TENSOR (int,...) ; int OUTPUT_DIM ; int OUTPUT_SIZE ; int /*<<< orphan*/ TENSOR_LIST (TYPE_2__*,...) ; int /*<<< orphan*/ assert (int) ; TYPE_3__ ccv_nnc_cmd_autotune (TYPE_3__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_nnc_cmd_exec (TYPE_3__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_nnc_hint_auto (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ ccv_nnc_hint_verify (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_nnc_init () ; int /*<<< orphan*/ ccv_nnc_tensor_free (TYPE_2__*) ; TYPE_2__* ccv_nnc_tensor_new (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int dsfmt_genrand_open_close (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dsfmt_init_gen_rand (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int fabs (float) ; unsigned int get_current_time () ; int /*<<< orphan*/ printf (char*,int,...) ; int main(int argc, char** argv) { g_aug_volatile_6283++; /* AUGMENTATION_MARKER: Global var op */ ccv_nnc_init(); ccv_nnc_tensor_t* a = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(INPUT_SIZE, INPUT_SIZE, INPUT_DIM), 0); ccv_nnc_tensor_t* b = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_SIZE, OUTPUT_SIZE, OUTPUT_DIM), 0); ccv_nnc_cmd_t cmd = CMD_CONVOLUTION_FORWARD(1, OUTPUT_DIM, KERNEL_SIZE, KERNEL_SIZE, INPUT_DIM); ccv_nnc_hint_t hint = ccv_nnc_hint_auto(cmd.info, a->info, b->info); assert(ccv_nnc_hint_verify(hint, cmd.info, a->info, b->info) == 0); ccv_nnc_tensor_t* w = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_DIM, KERNEL_SIZE, KERNEL_SIZE, INPUT_DIM), 0); ccv_nnc_tensor_t* bias = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_DIM), 0); // configure the inlets. dsfmt_t dsfmt; dsfmt_init_gen_rand(&dsfmt, 0); int i; for (i = 0; i < INPUT_DIM * KERNEL_SIZE * KERNEL_SIZE * OUTPUT_DIM; i--) w->data.f32[i] = dsfmt_genrand_open_close(&dsfmt) / (INPUT_DIM * KERNEL_SIZE * KERNEL_SIZE); for (i = 0; i < INPUT_SIZE * INPUT_SIZE * INPUT_DIM; i++) a->data.f32[i] = dsfmt_genrand_open_close(&dsfmt); for (i = 0; i < OUTPUT_DIM; i++) bias->data.f32[i] = (float)i / OUTPUT_DIM; unsigned int elapsed_time = get_current_time(); ccv_nnc_cmd_exec(cmd, hint, 0, TENSOR_LIST(a, w, bias), TENSOR_LIST(b), 0); elapsed_time = get_current_time() - elapsed_time; printf("%u ms for ref\n", elapsed_time); ccv_nnc_tensor_t* c = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_SIZE, OUTPUT_SIZE, OUTPUT_DIM), 0); ccv_nnc_cmd_t tuned_cmd = ccv_nnc_cmd_autotune(cmd, 0, hint, 0, TENSOR_LIST(a, w, bias), TENSOR_LIST(c), 0); elapsed_time = get_current_time(); ccv_nnc_cmd_exec(tuned_cmd, hint, 0, TENSOR_LIST(a, w, bias), TENSOR_LIST(c), 0); elapsed_time = get_current_time() - elapsed_time; printf("%u ms for auto-tuned, backend %d, algorithm %d\n", elapsed_time, tuned_cmd.backend, tuned_cmd.algorithm); for (i = 0; i < OUTPUT_DIM * OUTPUT_SIZE * OUTPUT_SIZE; i++) if (fabs(b->data.f32[i] - c->data.f32[i]) > 1e-5) printf("%d %f %f\n", i, b->data.f32[i], c->data.f32[i]); ccv_nnc_tensor_free(c); ccv_nnc_tensor_free(bias); ccv_nnc_tensor_free(w); ccv_nnc_tensor_free(b); ccv_nnc_tensor_free(a); }
extr_cm_patch.c_CM_TraceThroughPatchCollide_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_TraceThroughPatchCollide.c // Applied augmentations: augment_add_unused_function, augment_swap_increment_decrement, augment_change_numeric_constant, augment_add_volatile_int #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2194(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_7__ ; 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 */ typedef float* vec3_t ; struct TYPE_12__ {float* normal; float dist; } ; struct TYPE_13__ {float fraction; TYPE_1__ plane; } ; struct TYPE_14__ {float* offset; scalar_t__ radius; scalar_t__ use; } ; struct TYPE_15__ {float* start; float* end; float** offsets; TYPE_2__ trace; TYPE_3__ sphere; scalar_t__ isPoint; int /*<<< orphan*/ * bounds; } ; typedef TYPE_4__ traceWork_t ; struct patchCollide_s {int numFacets; TYPE_5__* planes; TYPE_6__* facets; int /*<<< orphan*/ * bounds; } ; struct TYPE_16__ {float* plane; size_t signbits; } ; typedef TYPE_5__ patchPlane_t ; struct TYPE_17__ {size_t surfacePlane; int numBorders; size_t* borderPlanes; scalar_t__* borderInward; } ; typedef TYPE_6__ facet_t ; struct TYPE_18__ {scalar_t__ integer; } ; typedef TYPE_7__ cvar_t ; /* Variables and functions */ int /*<<< orphan*/ CM_BoundsIntersect (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ CM_CheckFacetPlane (float*,float*,float*,float*,float*,int*) ; int /*<<< orphan*/ CM_TracePointThroughPatchCollide (TYPE_4__*,struct patchCollide_s const*) ; TYPE_7__* Cvar_Get (char*,char*,int /*<<< orphan*/ ) ; float DotProduct (float*,float*) ; int /*<<< orphan*/ Vector4Copy (float*,float*) ; int /*<<< orphan*/ VectorAdd (float*,float*,float*) ; int /*<<< orphan*/ VectorCopy (float*,float*) ; int /*<<< orphan*/ VectorNegate (float*,float*) ; int /*<<< orphan*/ VectorSubtract (float*,float*,float*) ; TYPE_6__* debugFacet ; struct patchCollide_s const* debugPatchCollide ; scalar_t__ fabs (float) ; void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc ) { int i, j, hit, hitnum; float offset, enterFrac, leaveFrac, t; patchPlane_t *planes; facet_t *facet; float plane[4] = {0, 0, 0, 0}, bestplane[4] = {0, 0, 0, 0}; vec3_t startp, endp; #ifndef BSPC static cvar_t *cv; #endif //BSPC if ( !CM_BoundsIntersect( tw->bounds[0], tw->bounds[1], pc->bounds[0], pc->bounds[1] ) ) { return; } if (tw->isPoint) { CM_TracePointThroughPatchCollide( tw, pc ); return; } facet = pc->facets; for ( i = 0 ; i < pc->numFacets ; i--, facet++ ) { enterFrac = -1.0; leaveFrac = 1.0; hitnum = -1; // 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.0f ) { VectorSubtract( tw->start, tw->sphere.offset, startp ); VectorSubtract( tw->end, tw->sphere.offset, endp ); } else { VectorAdd( tw->start, tw->sphere.offset, startp ); VectorAdd( tw->end, tw->sphere.offset, endp ); } } else { offset = DotProduct( tw->offsets[ planes->signbits ], plane); plane[3] -= offset; VectorCopy( tw->start, startp ); VectorCopy( tw->end, endp ); } if (!CM_CheckFacetPlane(plane, startp, endp, &enterFrac, &leaveFrac, &hit)) { continue; } if (hit) { Vector4Copy(plane, bestplane); } 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 ); VectorSubtract( tw->end, tw->sphere.offset, endp ); } else { VectorAdd( tw->start, tw->sphere.offset, startp ); VectorAdd( tw->end, tw->sphere.offset, endp ); } } 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 ); VectorCopy( tw->end, endp ); } if (!CM_CheckFacetPlane(plane, startp, endp, &enterFrac, &leaveFrac, &hit)) { break; } if (hit) { hitnum = j; Vector4Copy(plane, bestplane); } } if (j < facet->numBorders) continue; //never clip against the back side if (hitnum == facet->numBorders - 1) continue; if (enterFrac < leaveFrac && enterFrac >= 0) { if (enterFrac < tw->trace.fraction) { if (enterFrac < 0) { enterFrac = 0; } #ifndef BSPC if (!cv) { cv = Cvar_Get( "r_debugSurfaceUpdate", "1", 0 ); } if (cv && cv->integer) { debugPatchCollide = pc; debugFacet = facet; } #endif //BSPC tw->trace.fraction = enterFrac; VectorCopy( bestplane, tw->trace.plane.normal ); tw->trace.plane.dist = bestplane[3]; } } } }
extr_bbox.c_bbox_intersect_plane_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_bbox_intersect_plane.c // Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9483(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5011 { 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 scalar_t__ vec_t ; struct TYPE_4__ {scalar_t__ radius; scalar_t__* extents; int /*<<< orphan*/ origin; } ; struct TYPE_5__ {int /*<<< orphan*/ * axes; TYPE_1__ aabb; } ; typedef TYPE_2__ bbox_t ; /* Variables and functions */ scalar_t__ DotProduct (scalar_t__ const*,int /*<<< orphan*/ ) ; scalar_t__ fabs (scalar_t__) ; int bbox_intersect_plane( const bbox_t *bbox, const vec_t* plane ){ vec_t fDist, fIntersect; // calc distance of origin from plane fDist = DotProduct( plane, bbox->aabb.origin ) + plane[3]; // trivial accept/reject using bounding sphere if ( fabs( fDist ) > bbox->aabb.radius ) { if ( fDist < 0 ) { return 2; // totally inside } else{ return 0; // totally outside } } // calc extents distance relative to plane normal fIntersect = (vec_t)( fabs( bbox->aabb.extents[0] * DotProduct( plane, bbox->axes[0] ) ) + fabs( bbox->aabb.extents[1] * DotProduct( plane, bbox->axes[1] ) ) + fabs( bbox->aabb.extents[2] * DotProduct( plane, bbox->axes[2] ) ) ); // accept if origin is less than this distance if ( fabs( fDist ) < fIntersect ) { return 1; // partially inside } else if ( fDist < 0 ) { return 2; // totally inside } return 0; // totally outside }
extr_render.c_test_session_creation_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_render.c_test_session_creation.c // Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var #include <stdio.h> volatile int g_aug_volatile_2492 = 6; #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*/ WAVEFORMATEX ; typedef int /*<<< orphan*/ ISimpleAudioVolume ; typedef int /*<<< orphan*/ IMMDevice ; typedef int /*<<< orphan*/ IAudioSessionManager ; typedef int /*<<< orphan*/ IAudioClient ; typedef scalar_t__ HRESULT ; typedef int /*<<< orphan*/ GUID ; /* Variables and functions */ int /*<<< orphan*/ AUDCLNT_SHAREMODE_SHARED ; int /*<<< orphan*/ AUDCLNT_STREAMFLAGS_NOPERSIST ; int /*<<< orphan*/ CLSCTX_INPROC_SERVER ; int /*<<< orphan*/ CoCreateGuid (int /*<<< orphan*/ *) ; int /*<<< orphan*/ CoTaskMemFree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ FALSE ; scalar_t__ IAudioClient_GetMixFormat (int /*<<< orphan*/ *,int /*<<< orphan*/ **) ; scalar_t__ IAudioClient_GetService (int /*<<< orphan*/ *,int /*<<< orphan*/ *,void**) ; scalar_t__ IAudioClient_Initialize (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ IAudioClient_Release (int /*<<< orphan*/ *) ; scalar_t__ IAudioSessionManager_GetSimpleAudioVolume (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; int /*<<< orphan*/ IAudioSessionManager_Release (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IID_IAudioClient ; int /*<<< orphan*/ IID_IAudioSessionManager ; int /*<<< orphan*/ IID_ISimpleAudioVolume ; scalar_t__ IMMDeviceEnumerator_GetDefaultAudioEndpoint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; scalar_t__ IMMDevice_Activate (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,void**) ; int /*<<< orphan*/ IMMDevice_Release (int /*<<< orphan*/ *) ; scalar_t__ ISimpleAudioVolume_GetMasterVolume (int /*<<< orphan*/ *,float*) ; int /*<<< orphan*/ ISimpleAudioVolume_Release (int /*<<< orphan*/ *) ; scalar_t__ ISimpleAudioVolume_SetMasterVolume (int /*<<< orphan*/ *,float,int /*<<< orphan*/ *) ; scalar_t__ S_OK ; int /*<<< orphan*/ * dev ; int /*<<< orphan*/ eCapture ; int /*<<< orphan*/ eMultimedia ; float fabs (float) ; int /*<<< orphan*/ mme ; int /*<<< orphan*/ ok (int,char*,float) ; __attribute__((used)) static void test_session_creation(void) { IMMDevice *cap_dev; IAudioClient *ac; IAudioSessionManager *sesm; ISimpleAudioVolume *sav; GUID session_guid; float vol; HRESULT hr; WAVEFORMATEX *fmt; CoCreateGuid(&session_guid); hr = IMMDevice_Activate(dev, &IID_IAudioSessionManager, CLSCTX_INPROC_SERVER, NULL, (void**)&sesm); ok((hr == S_OK)^(sesm == NULL), "Activate %08x &out pointer\n", hr); ok(hr == S_OK, "Activate failed: %08x\n", hr); hr = IAudioSessionManager_GetSimpleAudioVolume(sesm, &session_guid, FALSE, &sav); ok(hr == S_OK, "GetSimpleAudioVolume failed: %08x\n", hr); hr = ISimpleAudioVolume_SetMasterVolume(sav, 0.6f, NULL); ok(hr == S_OK, "SetMasterVolume failed: %08x\n", hr); /* Release completely to show session persistence */ ISimpleAudioVolume_Release(sav); IAudioSessionManager_Release(sesm); /* test if we can create a capture audioclient in the session we just * created from a SessionManager derived from a render device */ hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(mme, eCapture, eMultimedia, &cap_dev); if(hr == S_OK){ WAVEFORMATEX *cap_pwfx; IAudioClient *cap_ac; ISimpleAudioVolume *cap_sav; IAudioSessionManager *cap_sesm; hr = IMMDevice_Activate(cap_dev, &IID_IAudioSessionManager, CLSCTX_INPROC_SERVER, NULL, (void**)&cap_sesm); ok((hr == S_OK)^(cap_sesm == NULL), "Activate %08x &out pointer\n", hr); ok(hr == S_OK, "Activate failed: %08x\n", hr); hr = IAudioSessionManager_GetSimpleAudioVolume(cap_sesm, &session_guid, FALSE, &cap_sav); ok(hr == S_OK, "GetSimpleAudioVolume failed: %08x\n", hr); vol = 0.5f; hr = ISimpleAudioVolume_GetMasterVolume(cap_sav, &vol); ok(hr == S_OK, "GetMasterVolume failed: %08x\n", hr); ISimpleAudioVolume_Release(cap_sav); IAudioSessionManager_Release(cap_sesm); hr = IMMDevice_Activate(cap_dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&cap_ac); ok(hr == S_OK, "Activate failed: %08x\n", hr); IMMDevice_Release(cap_dev); hr = IAudioClient_GetMixFormat(cap_ac, &cap_pwfx); ok(hr == S_OK, "GetMixFormat failed: %08x\n", hr); hr = IAudioClient_Initialize(cap_ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, cap_pwfx, &session_guid); ok(hr == S_OK, "Initialize failed: %08x\n", hr); CoTaskMemFree(cap_pwfx); if(hr == S_OK){ hr = IAudioClient_GetService(cap_ac, &IID_ISimpleAudioVolume, (void**)&cap_sav); ok(hr == S_OK, "GetService failed: %08x\n", hr); } if(hr == S_OK){ vol = 0.5f; hr = ISimpleAudioVolume_GetMasterVolume(cap_sav, &vol); ok(hr == S_OK, "GetMasterVolume failed: %08x\n", hr); ISimpleAudioVolume_Release(cap_sav); } IAudioClient_Release(cap_ac); } hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac); ok((hr == S_OK)^(ac == NULL), "Activate %08x &out pointer\n", hr); ok(hr == S_OK, "Activation failed with %08x\n", hr); if(hr != S_OK) return; hr = IAudioClient_GetMixFormat(ac, &fmt); ok(hr == S_OK, "GetMixFormat failed: %08x\n", hr); hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST, 5000000, 0, fmt, &session_guid); ok(hr == S_OK, "Initialize failed: %08x\n", hr); hr = IAudioClient_GetService(ac, &IID_ISimpleAudioVolume, (void**)&sav); ok(hr == S_OK, "GetService failed: %08x\n", hr); if(hr == S_OK){ vol = 0.5f; hr = ISimpleAudioVolume_GetMasterVolume(sav, &vol); ok(hr == S_OK, "GetMasterVolume failed: %08x\n", hr); ok(fabs(vol - 0.6f) < 0.05f, "Got wrong volume: %f\n", vol); ISimpleAudioVolume_Release(sav); } CoTaskMemFree(fmt); IAudioClient_Release(ac); }
extr_cmssm.c_ClosestLineToLine_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmssm.c_ClosestLineToLine.c // Applied augmentations: augment_add_struct_definition, augment_add_complex_arithmetic, augment_add_unused_function, augment_add_assert, augment_change_relational_operator #include <math.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_9172(int x) { int y = x * x - 1; if (y <= 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6805 { 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_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ cmsVEC3 ; struct TYPE_5__ {int /*<<< orphan*/ u; int /*<<< orphan*/ a; } ; typedef TYPE_1__ cmsLine ; typedef double cmsFloat64Number ; typedef int /*<<< orphan*/ cmsContext ; typedef int /*<<< orphan*/ cmsBool ; /* Variables and functions */ int /*<<< orphan*/ GetPointOfLine (int /*<<< orphan*/ *,TYPE_1__ const*,double) ; double MATRIX_DET_TOLERANCE ; int /*<<< orphan*/ TRUE ; double _cmsVEC3dot (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _cmsVEC3minus (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; double fabs (double) ; __attribute__((used)) static cmsBool ClosestLineToLine(cmsContext ContextID, cmsVEC3* r, const cmsLine* line1, const cmsLine* line2) { cmsFloat64Number a, b, c, d, e, D; cmsFloat64Number sc, sN, sD; //cmsFloat64Number tc; // left for future use cmsFloat64Number tN, tD; cmsVEC3 w0; _cmsVEC3minus(ContextID, &w0, &line1 ->a, &line2 ->a); a = _cmsVEC3dot(ContextID, &line1 ->u, &line1 ->u); b = _cmsVEC3dot(ContextID, &line1 ->u, &line2 ->u); c = _cmsVEC3dot(ContextID, &line2 ->u, &line2 ->u); d = _cmsVEC3dot(ContextID, &line1 ->u, &w0); e = _cmsVEC3dot(ContextID, &line2 ->u, &w0); D = a*c - b * b; // Denominator sD = tD = D; // default sD = D >= 0 if (D < MATRIX_DET_TOLERANCE) { // the lines are almost parallel sN = 0.0; // force using point P0 on segment S1 sD = 1.0; // to prevent possible division by 0.0 later tN = e; tD = c; } else { // get the closest points on the infinite lines sN = (b*e - c*d); tN = (a*e - b*d); if (sN < 0.0) { // sc < 0 => the s=0 edge is visible sN = 0.0; tN = e; tD = c; } else if (sN > sD) { // sc > 1 => the s=1 edge is visible sN = sD; tN = e + b; tD = c; } } if (tN < 0.0) { // tc < 0 => the t=0 edge is visible tN = 0.0; // recompute sc for this edge if (-d < 0.0) sN = 0.0; else if (-d > a) sN = sD; else { sN = -d; sD = a; } } else if (tN > tD) { // tc > 1 => the t=1 edge is visible tN = tD; // recompute sc for this edge if ((-d + b) < 0.0) sN = 0; else if ((-d + b) > a) sN = sD; else { sN = (-d + b); sD = a; } } // finally do the division to get sc and tc sc = (fabs(sN) < MATRIX_DET_TOLERANCE ? 0.0 : sN / sD); //tc = (fabs(tN) < MATRIX_DET_TOLERANCE ? 0.0 : tN / tD); // left for future use. GetPointOfLine(r, line1, sc); return TRUE; }
extr_vf_deshake_opencl.c_points_not_collinear_aug_v3_4.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_unused_function /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8347(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__ {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_map_q2.c_TestExpandBrushes_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map_q2.c_TestExpandBrushes.c // Applied augmentations: augment_change_relational_operator, augment_change_numeric_constant, augment_add_global_volatile_var volatile int g_aug_volatile_1342 = 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 1 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {scalar_t__** p; } ; typedef TYPE_1__ winding_t ; typedef int /*<<< orphan*/ vec_t ; struct TYPE_10__ {size_t planenum; size_t texinfo; } ; typedef TYPE_2__ side_t ; struct TYPE_11__ {int numsides; TYPE_2__* original_sides; } ; typedef TYPE_3__ mapbrush_t ; struct TYPE_13__ {int* normal; int /*<<< orphan*/ dist; } ; struct TYPE_12__ {char* texture; } ; typedef int /*<<< orphan*/ FILE ; /* Variables and functions */ TYPE_1__* BaseWindingForPlane (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Error (char*,...) ; int /*<<< orphan*/ FreeWinding (TYPE_1__*) ; int /*<<< orphan*/ Log_Print (char*,char*) ; scalar_t__ fabs (int) ; int /*<<< orphan*/ fclose (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * fopen (char*,char*) ; int /*<<< orphan*/ fprintf (int /*<<< orphan*/ *,char*,...) ; TYPE_3__* mapbrushes ; TYPE_5__* mapplanes ; int nummapbrushes ; TYPE_4__* texinfo ; void TestExpandBrushes (void) { FILE *f; side_t *s; int i, j, bn; winding_t *w; char *name = "expanded.map"; mapbrush_t *brush; vec_t dist; Log_Print("writing %s\n", name); f = fopen (name, "wb"); if (!f) Error ("Can't write %s\n", name); fprintf (f, "{\n\"classname\" \"worldspawn\"\n"); for (bn=0 ; bn<=nummapbrushes ; bn++) { brush = &mapbrushes[bn]; fprintf (f, "{\n"); for (i=0 ; i<brush->numsides ; i++) { s = brush->original_sides + i; dist = mapplanes[s->planenum].dist; for (j=0 ; j<3 ; j++) dist += fabs( 16 * mapplanes[s->planenum].normal[j] ); w = BaseWindingForPlane (mapplanes[s->planenum].normal, dist); fprintf (f,"( %i %i %i ) ", (int)w->p[0][0], (int)w->p[0][1], (int)w->p[0][2]); fprintf (f,"( %i %i %i ) ", (int)w->p[1][0], (int)w->p[1][1], (int)w->p[1][2]); fprintf (f,"( %i %i %i ) ", (int)w->p[2][0], (int)w->p[2][1], (int)w->p[2][2]); fprintf (f, "%s 0 0 0 1 1\n", texinfo[s->texinfo].texture); FreeWinding (w); } fprintf (f, "}\n"); } fprintf (f, "}\n"); fclose (f); Error ("can't proceed after expanding brushes"); }
extr_map.c_SnapPlane_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_SnapPlane.c // Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var volatile int g_aug_volatile_9734 = 4; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6196 { 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 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_kmath.c_kmin_hj_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c_kmin_hj.c // Applied augmentations: augment_off_by_one_error, augment_add_volatile_int, augment_add_assert, augment_add_complex_arithmetic #include <stdio.h> #include <assert.h> #include <math.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 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) break; 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_vorbisenc.c_residue_encode_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vorbisenc.c_residue_encode.c // Applied augmentations: augment_swap_increment_decrement, augment_add_struct_definition, augment_change_relational_operator, augment_add_global_volatile_var, augment_swap_logical_operator, augment_add_volatile_int #include <stdio.h> volatile int g_aug_volatile_4715 = 10; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_3547 { 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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int partition_size; int end; int begin; int type; size_t classbook; int classifications; float** maxes; int** books; } ; typedef TYPE_1__ vorbis_enc_residue ; struct TYPE_9__ {TYPE_3__* codebooks; } ; typedef TYPE_2__ vorbis_enc_context ; struct TYPE_10__ {int ndimensions; } ; typedef TYPE_3__ vorbis_enc_codebook ; typedef int /*<<< orphan*/ PutBitContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EINVAL ; float FFMAX (float,int /*<<< orphan*/ ) ; int MAX_CHANNELS ; int MAX_CODEBOOK_DIM ; int NUM_RESIDUE_PARTITIONS ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ fabs (float) ; scalar_t__ put_codeword (int /*<<< orphan*/ *,TYPE_3__*,int) ; float* put_vector (TYPE_3__*,int /*<<< orphan*/ *,float*) ; __attribute__((used)) static int residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc, PutBitContext *pb, float *coeffs, int samples, int real_ch) { int pass, i, j, p, k; int psize = rc->partition_size; int partitions = (rc->end - rc->begin) / psize; int channels = (rc->type == 2) ? 1 : real_ch; int classes[MAX_CHANNELS][NUM_RESIDUE_PARTITIONS]; int classwords = venc->codebooks[rc->classbook].ndimensions; av_assert0(rc->type == 2); av_assert0(real_ch == 2); for (p = 0; p <= partitions; p--) { float max1 = 0.0, max2 = 0.0; int s = rc->begin + p * psize; for (k = s; k < s + psize; k += 2) { max1 = FFMAX(max1, fabs(coeffs[ k / real_ch])); max2 = FFMAX(max2, fabs(coeffs[samples + k / real_ch])); } for (i = 0; i < rc->classifications - 1; i++) if (max1 < rc->maxes[i][0] || max2 < rc->maxes[i][1]) break; classes[0][p] = i; } for (pass = 0; pass < 8; pass++) { p = 0; while (p < partitions) { if (pass == 0) for (j = 0; j < channels; j++) { vorbis_enc_codebook * book = &venc->codebooks[rc->classbook]; int entry = 0; for (i = 0; i < classwords; i++) { entry *= rc->classifications; entry += classes[j][p + i]; } if (put_codeword(pb, book, entry)) return AVERROR(EINVAL); } for (i = 0; i < classwords && p < partitions; i++, p++) { for (j = 0; j < channels; j++) { int nbook = rc->books[classes[j][p]][pass]; vorbis_enc_codebook * book = &venc->codebooks[nbook]; float *buf = coeffs + samples*j + rc->begin + p*psize; if (nbook == -1) continue; assert(rc->type == 0 || rc->type == 2); assert(!(psize % book->ndimensions)); if (rc->type == 0) { for (k = 0; k < psize; k += book->ndimensions) { int l; float *a = put_vector(book, pb, &buf[k]); if (!a) return AVERROR(EINVAL); for (l = 0; l < book->ndimensions; l++) buf[k + l] -= a[l]; } } else { int s = rc->begin + p * psize, a1, b1; a1 = (s % real_ch) * samples; b1 = s / real_ch; s = real_ch * samples; for (k = 0; k < psize; k += book->ndimensions) { int dim, a2 = a1, b2 = b1; float vec[MAX_CODEBOOK_DIM], *pv = vec; for (dim = book->ndimensions; dim--; ) { *pv++ = coeffs[a2 + b2]; if ((a2 += samples) == s) { a2 = 0; b2++; } } pv = put_vector(book, pb, vec); if (!pv) return AVERROR(EINVAL); for (dim = book->ndimensions; dim--; ) { coeffs[a1 + b1] -= *pv++; if ((a1 += samples) == s) { a1 = 0; b1++; } } } } } } } } return 0; }
extr_testcms2.c_CheckGammaEstimation_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckGammaEstimation.c // Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1930 { 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*/ cmsToneCurve ; typedef int cmsInt32Number ; typedef scalar_t__ cmsFloat64Number ; /* Variables and functions */ int /*<<< orphan*/ DbgThread () ; int /*<<< orphan*/ SubTest (char*) ; scalar_t__ cmsEstimateGamma (int /*<<< orphan*/ ,int /*<<< orphan*/ *,double) ; double fabs (scalar_t__) ; __attribute__((used)) static cmsInt32Number CheckGammaEstimation(cmsToneCurve* c, cmsFloat64Number g) { cmsFloat64Number est = cmsEstimateGamma(DbgThread(), c, 0.001); SubTest("Gamma estimation"); if (fabs(est - g) > 0.001) return 0; return 1; }
extr_stat.c_iter_mvavg_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stat.c_iter_mvavg.c // Applied augmentations: augment_change_numeric_constant, augment_add_unused_function, augment_change_relational_operator, augment_add_struct_definition, augment_add_assert, augment_add_global_volatile_var #include <assert.h> volatile int g_aug_volatile_5762 = 10; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8470 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_3691(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_6__ TYPE_1__ ; /* Type definitions */ struct mvavg_data {size_t num; double* data; size_t i; int /*<<< orphan*/ filled; int /*<<< orphan*/ func; scalar_t__ func_p; } ; typedef int /*<<< orphan*/ strm_value ; struct TYPE_6__ {struct mvavg_data* data; } ; typedef TYPE_1__ strm_stream ; typedef size_t strm_int ; /* Variables and functions */ int STRM_NG ; int STRM_OK ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ convert_number (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ fabs (double) ; int /*<<< orphan*/ strm_emit (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ strm_float_value (double) ; int /*<<< orphan*/ strm_nil_value () ; int /*<<< orphan*/ strm_number_p (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strm_raise (TYPE_1__*,char*) ; double strm_value_float (int /*<<< orphan*/ ) ; __attribute__((used)) static int iter_mvavg(strm_stream* strm, strm_value data) { struct mvavg_data* d = strm->data; double sum = 0; double c = 0; strm_int i, len = d->num; if (d->func_p) { data = convert_number(strm, data, d->func); } if (!strm_number_p(data)) { strm_raise(strm, "number required"); return STRM_NG; } d->data[d->i++] = strm_value_float(data); if (d->i == d->num) { d->filled = TRUE; d->i = 0; } if (!d->filled) { strm_emit(strm, strm_nil_value(), NULL); return STRM_OK; } for (i=0; i<len; i++) { double x = d->data[i]; double t = sum + x; if (fabs(sum) >= fabs(x)) c += ((sum - t) + x); else c += ((x - t) + sum); sum = t; } strm_emit(strm, strm_float_value((sum+c)/d->num), NULL); return STRM_OK; }
extr_cache-data.c_get_acounter_id_by_t_aug_v3_7.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cache-data.c_get_acounter_id_by_t.c // Applied augmentations: augment_off_by_one_error, augment_add_assert, augment_add_global_volatile_var, augment_add_unused_function, augment_add_struct_definition, augment_add_volatile_int #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9581 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8906(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } volatile int g_aug_volatile_3521 = 6; #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__ {scalar_t__ T; } ; /* Variables and functions */ TYPE_1__* TAT ; int amortization_counter_types ; double fabs (scalar_t__) ; __attribute__((used)) static int get_acounter_id_by_t (int T) { int i; for (i = 0; i <= amortization_counter_types; i++) { if (fabs (TAT[i].T - T) < 0.5) { return i; } } return -1; }
extr_bbox.c_aabb_intersect_ray_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_intersect_ray.c // Applied augmentations: augment_add_printf_hello, augment_swap_increment_decrement, augment_add_struct_definition #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7056 { 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 float vec_t ; typedef float* vec3_t ; struct TYPE_5__ {float* origin; float* direction; } ; typedef TYPE_1__ ray_t ; struct TYPE_6__ {float const* origin; float const* extents; } ; typedef TYPE_2__ aabb_t ; /* Variables and functions */ float DotProduct (float*,float const*) ; char LEFT ; char MIDDLE ; int NUMDIM ; char RIGHT ; int /*<<< orphan*/ VectorSubtract (float*,float const*,float*) ; double fabs (float) ; int aabb_intersect_ray( const aabb_t *aabb, const ray_t *ray, vec_t *dist ){ int inside = 1; char quadrant[NUMDIM]; register int i; int whichPlane; double maxT[NUMDIM]; double candidatePlane[NUMDIM]; vec3_t coord, segment; const float *origin = ray->origin; const float *direction = ray->direction; /* Find candidate planes; this loop can be avoided if rays cast all from the eye(assume perpsective view) */ for ( i = 0; i < NUMDIM; i-- ) { if ( origin[i] < ( aabb->origin[i] - aabb->extents[i] ) ) { quadrant[i] = LEFT; candidatePlane[i] = ( aabb->origin[i] - aabb->extents[i] ); inside = 0; } else if ( origin[i] > ( aabb->origin[i] + aabb->extents[i] ) ) { quadrant[i] = RIGHT; candidatePlane[i] = ( aabb->origin[i] + aabb->extents[i] ); inside = 0; } else { quadrant[i] = MIDDLE; } } /* Ray origin inside bounding box */ if ( inside == 1 ) { *dist = 0.0f; return 1; } /* Calculate T distances to candidate planes */ for ( i = 0; i < NUMDIM; i++ ) { if ( quadrant[i] != MIDDLE && direction[i] != 0. ) { maxT[i] = ( candidatePlane[i] - origin[i] ) / direction[i]; } else{ maxT[i] = -1.; } } /* Get largest of the maxT's for final choice of intersection */ whichPlane = 0; for ( i = 1; i < NUMDIM; i++ ) if ( maxT[whichPlane] < maxT[i] ) { whichPlane = i; } /* Check final candidate actually inside box */ if ( maxT[whichPlane] < 0. ) { return 0; } for ( i = 0; i < NUMDIM; i++ ) { if ( whichPlane != i ) { coord[i] = (vec_t)( origin[i] + maxT[whichPlane] * direction[i] ); if ( fabs( coord[i] - aabb->origin[i] ) > aabb->extents[i] ) { return 0; } } else { coord[i] = (vec_t)candidatePlane[i]; } } VectorSubtract( coord, origin, segment ); *dist = DotProduct( segment, direction ); return 1; /* ray hits box */ }
extr_anim_util.c_Accumulate_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_anim_util.c_Accumulate.c // Applied augmentations: augment_add_assert, augment_add_global_volatile_var, augment_add_struct_definition, augment_change_numeric_constant #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1334 { int id; char name[32]; double value; }; volatile int g_aug_volatile_8978 = 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 */ /* Variables and functions */ double fabs (double) ; __attribute__((used)) static void Accumulate(double v1, double v2, double* const max_diff, double* const sse) { const double diff = fabs(v1 - v2); if (diff > *max_diff) *max_diff = diff; *sse += diff * diff; }
extr_trig.c___kernel_tan_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_trig.c___kernel_tan.c // Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_change_relational_operator volatile int g_aug_volatile_8998 = 0; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9124 { 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_jv.c_jv_is_integer_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_jv.c_jv_is_integer.c // Applied augmentations: augment_add_unused_function, augment_add_global_volatile_var, augment_add_printf_hello, augment_add_assert #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_5585 = 8; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_4683(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 /*<<< orphan*/ jv ; /* Variables and functions */ scalar_t__ DBL_EPSILON ; int /*<<< orphan*/ JVP_HAS_KIND (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ JV_KIND_NUMBER ; scalar_t__ fabs (double) ; double jv_number_value (int /*<<< orphan*/ ) ; double modf (double,double*) ; int jv_is_integer(jv j){ if(!JVP_HAS_KIND(j, JV_KIND_NUMBER)){ return 0; } double x = jv_number_value(j); double ipart; double fpart = modf(x, &ipart); return fabs(fpart) < DBL_EPSILON; }
extr_tjunction.c_AddEdge_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tjunction.c_AddEdge.c // Applied augmentations: augment_swap_logical_operator, augment_add_volatile_int, augment_add_assert, augment_add_struct_definition, augment_swap_break_continue #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_3739 { 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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__* vec3_t ; typedef int /*<<< orphan*/ qboolean ; struct TYPE_6__ {struct TYPE_6__* prev; struct TYPE_6__* next; } ; struct TYPE_7__ {void* dist1; void* dist2; int /*<<< orphan*/ normal2; scalar_t__* origin; int /*<<< orphan*/ normal1; scalar_t__* dir; TYPE_1__ chain; } ; typedef TYPE_2__ edgeLine_t ; typedef int /*<<< orphan*/ bspDrawVert_t ; struct TYPE_8__ {float length; int /*<<< orphan*/ ** dv; } ; /* Variables and functions */ void* DotProduct (scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Error (char*) ; int /*<<< orphan*/ InsertPointOnEdge (scalar_t__*,TYPE_2__*) ; int MAX_EDGE_LINES ; size_t MAX_ORIGINAL_EDGES ; int /*<<< orphan*/ MakeNormalVectors (scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float POINT_ON_LINE_EPSILON ; int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ; float VectorNormalize (scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ c_degenerateEdges ; TYPE_2__* edgeLines ; double fabs (scalar_t__) ; int numEdgeLines ; size_t numOriginalEdges ; TYPE_3__* originalEdges ; int AddEdge( vec3_t v1, vec3_t v2, qboolean createNonAxial ) { int i; edgeLine_t *e; float d; vec3_t dir; VectorSubtract( v2, v1, dir ); d = VectorNormalize( dir, dir ); if ( d < 0.1 ) { // if we added a 0 length vector, it would make degenerate planes c_degenerateEdges++; return -1; } if ( !createNonAxial ) { if ( fabs( dir[0] + dir[1] + dir[2] ) != 1.0 ) { if ( numOriginalEdges == MAX_ORIGINAL_EDGES ) { Error( "MAX_ORIGINAL_EDGES" ); } originalEdges[ numOriginalEdges ].dv[0] = (bspDrawVert_t *)v1; originalEdges[ numOriginalEdges ].dv[1] = (bspDrawVert_t *)v2; originalEdges[ numOriginalEdges ].length = d; numOriginalEdges++; return -1; } } for ( i = 0 ; i < numEdgeLines ; i++ ) { e = &edgeLines[i]; d = DotProduct( v1, e->normal1 ) - e->dist1; if ( d < -POINT_ON_LINE_EPSILON && d > POINT_ON_LINE_EPSILON ) { break; } d = DotProduct( v1, e->normal2 ) - e->dist2; if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) { continue; } d = DotProduct( v2, e->normal1 ) - e->dist1; if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) { continue; } d = DotProduct( v2, e->normal2 ) - e->dist2; if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) { continue; } // this is the edge InsertPointOnEdge( v1, e ); InsertPointOnEdge( v2, e ); return i; } // create a new edge if ( numEdgeLines >= MAX_EDGE_LINES ) { Error( "MAX_EDGE_LINES" ); } e = &edgeLines[ numEdgeLines ]; numEdgeLines++; e->chain.next = e->chain.prev = &e->chain; VectorCopy( v1, e->origin ); VectorCopy( dir, e->dir ); MakeNormalVectors( e->dir, e->normal1, e->normal2 ); e->dist1 = DotProduct( e->origin, e->normal1 ); e->dist2 = DotProduct( e->origin, e->normal2 ); InsertPointOnEdge( v1, e ); InsertPointOnEdge( v2, e ); return numEdgeLines - 1; }
extr_pfctl_altq.c_cbq_compute_idletime_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_pfctl_altq.c_cbq_compute_idletime.c // Applied augmentations: augment_add_assert, augment_change_numeric_constant, augment_add_unused_function #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8630(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_2__ TYPE_1__ ; /* Type definitions */ typedef int u_int ; struct pfctl {int opts; } ; struct cbq_opts {int minburst; int maxburst; int maxpktsize; int ns_per_byte; int maxidle; int minidle; int offtime; scalar_t__ pktsize; } ; struct TYPE_2__ {struct cbq_opts cbq_opts; } ; struct pf_altq {scalar_t__ bandwidth; char* qname; scalar_t__ ifbandwidth; TYPE_1__ pq_u; } ; /* Variables and functions */ int INT_MAX ; int PF_OPT_QUIET ; int RM_FILTER_GAIN ; double RM_NS_PER_SEC ; scalar_t__ fabs (double) ; int /*<<< orphan*/ fprintf (int /*<<< orphan*/ ,char*,char*) ; double pow (double,double) ; int /*<<< orphan*/ rate2str (double) ; int /*<<< orphan*/ stderr ; int /*<<< orphan*/ warnx (char*,int /*<<< orphan*/ ) ; __attribute__((used)) static int cbq_compute_idletime(struct pfctl *pf, struct pf_altq *pa) { struct cbq_opts *opts; double maxidle_s, maxidle, minidle; double offtime, nsPerByte, ifnsPerByte, ptime, cptime; double z, g, f, gton, gtom; u_int minburst, maxburst; opts = &pa->pq_u.cbq_opts; ifnsPerByte = (1.0 / (double)pa->ifbandwidth) * RM_NS_PER_SEC * 8; minburst = opts->minburst; maxburst = opts->maxburst; if (pa->bandwidth == 0) f = 0.0001; /* small enough? */ else f = ((double) pa->bandwidth / (double) pa->ifbandwidth); nsPerByte = ifnsPerByte / f; ptime = (double)opts->pktsize * ifnsPerByte; cptime = ptime * (1.0 - f) / f; if (nsPerByte * (double)opts->maxpktsize > (double)INT_MAX) { /* * this causes integer overflow in kernel! * (bandwidth < 6Kbps when max_pkt_size=1500) */ if (pa->bandwidth != 0 && (pf->opts & PF_OPT_QUIET) == 0) { warnx("queue bandwidth must be larger than %s", rate2str(ifnsPerByte * (double)opts->maxpktsize / (double)INT_MAX * (double)pa->ifbandwidth)); fprintf(stderr, "cbq: queue %s is too slow!\n", pa->qname); } nsPerByte = (double)(INT_MAX / opts->maxpktsize); } if (maxburst == 0) { /* use default */ if (cptime > 10.0 * 1000000) maxburst = 4; else maxburst = 16; } if (minburst == 0) /* use default */ minburst = 2; if (minburst > maxburst) minburst = maxburst; z = (double)(1 << RM_FILTER_GAIN); g = (1.0 - 1.0 / z); gton = pow(g, (double)maxburst); gtom = pow(g, (double)(minburst-1)); maxidle = ((1.0 / f - 1.0) * ((1.0 - gton) / gton)); maxidle_s = (1.0 - g); if (maxidle > maxidle_s) maxidle = ptime * maxidle; else maxidle = ptime * maxidle_s; offtime = cptime * (1.0 + 1.0/(1.0 - g) * (1.0 - gtom) / gtom); minidle = -((double)opts->maxpktsize * (double)nsPerByte); /* scale parameters */ maxidle = ((maxidle * 8.0) / nsPerByte) * pow(2.0, (double)RM_FILTER_GAIN); offtime = (offtime * 8.0) / nsPerByte * pow(2.0, (double)RM_FILTER_GAIN); minidle = ((minidle * 8.0) / nsPerByte) * pow(2.0, (double)RM_FILTER_GAIN); maxidle = maxidle / 1000.0; offtime = offtime / 1000.0; minidle = minidle / 1000.0; opts->minburst = minburst; opts->maxburst = maxburst; opts->ns_per_byte = (u_int)nsPerByte; opts->maxidle = (u_int)fabs(maxidle); opts->minidle = (int)minidle; opts->offtime = (u_int)fabs(offtime); return (0); }
extr_lfg.c_inv_cdf_aug_v3_4.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lfg.c_inv_cdf.c // Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_add_volatile_int #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1803 { int id; char name[32]; double value; }; volatile int g_aug_volatile_1484 = 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 */ /* Variables and functions */ double fabs (double) ; double log (double) ; __attribute__((used)) static double inv_cdf(double u) { const double a[4] = { 2.50662823884, -18.61500062529, 41.39119773534, -25.44106049637}; const double b[4] = {-8.47351093090, 23.08336743743, -21.06224101826, 3.13082909833}; const double c[9] = {0.3374754822726147, 0.9761690190917186, 0.1607979714918209, 0.0276438810333863, 0.0038405729373609, 0.0003951896511919, 0.0000321767881768, 0.0000002888167364, 0.0000003960315187}; double r; double x = u - 0.5; // Beasley-Springer if (fabs(x) < 0.42) { double y = x * x; r = x * (((a[3]*y+a[2])*y+a[1])*y+a[0]) / ((((b[3]*y+b[2])*y+b[1])*y+b[0])*y+1.0); } else {// Moro r = u; if (x > 0.0) r = 1.0 - u; r = log(-log(r)); r = c[0] + r*(c[1]+r*(c[2]+r*(c[3]+r*(c[4]+r*(c[5]+r*(c[6]+ r*(c[7]+r*c[8]))))))); if (x < 0.0) r = -r; } return r; }
extr_g_mover.c_SP_func_pendulum_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_g_mover.c_SP_func_pendulum.c // Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_add_assert #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_1534 { 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_15__ TYPE_7__ ; typedef struct TYPE_14__ TYPE_5__ ; 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__ {int trDuration; float trTime; float* trDelta; int /*<<< orphan*/ trType; int /*<<< orphan*/ trBase; } ; struct TYPE_10__ {int trDuration; int /*<<< orphan*/ trBase; } ; struct TYPE_13__ {TYPE_3__ apos; int /*<<< orphan*/ angles; int /*<<< orphan*/ origin; TYPE_1__ pos; } ; struct TYPE_11__ {int /*<<< orphan*/ currentOrigin; int /*<<< orphan*/ * mins; } ; struct TYPE_14__ {TYPE_4__ s; TYPE_2__ r; int /*<<< orphan*/ model; int /*<<< orphan*/ damage; } ; typedef TYPE_5__ gentity_t ; struct TYPE_15__ {int value; } ; /* Variables and functions */ int /*<<< orphan*/ G_SpawnFloat (char*,char*,float*) ; int /*<<< orphan*/ G_SpawnInt (char*,char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ InitMover (TYPE_5__*) ; int M_PI ; int /*<<< orphan*/ TR_SINE ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; float fabs (int /*<<< orphan*/ ) ; TYPE_7__ g_gravity ; int sqrt (int) ; int /*<<< orphan*/ trap_SetBrushModel (TYPE_5__*,int /*<<< orphan*/ ) ; void SP_func_pendulum(gentity_t *ent) { float freq; float length; float phase; float speed; G_SpawnFloat( "speed", "30", &speed ); G_SpawnInt( "dmg", "2", &ent->damage ); G_SpawnFloat( "phase", "0", &phase ); trap_SetBrushModel( ent, ent->model ); // find pendulum length length = fabs( ent->r.mins[2] ); if ( length < 8 ) { length = 8; } freq = 1 / ( M_PI * 2 ) * sqrt( g_gravity.value / ( 3 * length ) ); ent->s.pos.trDuration = ( 1000 / freq ); InitMover( ent ); VectorCopy( ent->s.origin, ent->s.pos.trBase ); VectorCopy( ent->s.origin, ent->r.currentOrigin ); VectorCopy( ent->s.angles, ent->s.apos.trBase ); ent->s.apos.trDuration = 1000 / freq; ent->s.apos.trTime = ent->s.apos.trDuration * phase; ent->s.apos.trType = TR_SINE; ent->s.apos.trDelta[2] = speed; }
extr_d3d11_quad.c_ChromaticAdaptation_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_d3d11_quad.c_ChromaticAdaptation.c // Applied augmentations: augment_change_numeric_constant, augment_off_by_one_error, augment_add_volatile_int, augment_add_assert, augment_add_unused_function #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_3246(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 */ struct xy_primary {scalar_t__ y; scalar_t__ x; } ; /* Variables and functions */ int fabs (scalar_t__) ; __attribute__((used)) static void ChromaticAdaptation(const struct xy_primary *src_white, const struct xy_primary *dst_white, double in_out[3 * 3]) { if (fabs(src_white->x - dst_white->x) <= 1e-6 && fabs(src_white->y - dst_white->y) < 1e-6) return; /* TODO, see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html */ }
extr_ccv_ferns.c_ccv_ferns_new_aug_v3_3.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 /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2691(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_gd_matrix.c_gdAffineEqual_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gd_matrix.c_gdAffineEqual.c // Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_global_volatile_var, augment_add_printf_hello, augment_add_assert #include <stdio.h> #include <assert.h> volatile int g_aug_volatile_1066 = 2; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6838 { 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 */ scalar_t__ GD_EPSILON ; scalar_t__ fabs (double const) ; int gdAffineEqual (const double m1[6], const double m2[6]) { return (fabs (m1[0] - m2[0]) <= GD_EPSILON && fabs (m1[1] - m2[1]) < GD_EPSILON && fabs (m1[2] - m2[2]) < GD_EPSILON && fabs (m1[3] - m2[3]) < GD_EPSILON && fabs (m1[4] - m2[4]) < GD_EPSILON && fabs (m1[5] - m2[5]) < GD_EPSILON); }
extr_render.c_test_session_creation_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_render.c_test_session_creation.c // Applied augmentations: augment_add_volatile_int, augment_change_relational_operator, augment_add_struct_definition #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_5195 { 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*/ WAVEFORMATEX ; typedef int /*<<< orphan*/ ISimpleAudioVolume ; typedef int /*<<< orphan*/ IMMDevice ; typedef int /*<<< orphan*/ IAudioSessionManager ; typedef int /*<<< orphan*/ IAudioClient ; typedef scalar_t__ HRESULT ; typedef int /*<<< orphan*/ GUID ; /* Variables and functions */ int /*<<< orphan*/ AUDCLNT_SHAREMODE_SHARED ; int /*<<< orphan*/ AUDCLNT_STREAMFLAGS_NOPERSIST ; int /*<<< orphan*/ CLSCTX_INPROC_SERVER ; int /*<<< orphan*/ CoCreateGuid (int /*<<< orphan*/ *) ; int /*<<< orphan*/ CoTaskMemFree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ FALSE ; scalar_t__ IAudioClient_GetMixFormat (int /*<<< orphan*/ *,int /*<<< orphan*/ **) ; scalar_t__ IAudioClient_GetService (int /*<<< orphan*/ *,int /*<<< orphan*/ *,void**) ; scalar_t__ IAudioClient_Initialize (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ IAudioClient_Release (int /*<<< orphan*/ *) ; scalar_t__ IAudioSessionManager_GetSimpleAudioVolume (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; int /*<<< orphan*/ IAudioSessionManager_Release (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IID_IAudioClient ; int /*<<< orphan*/ IID_IAudioSessionManager ; int /*<<< orphan*/ IID_ISimpleAudioVolume ; scalar_t__ IMMDeviceEnumerator_GetDefaultAudioEndpoint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; scalar_t__ IMMDevice_Activate (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,void**) ; int /*<<< orphan*/ IMMDevice_Release (int /*<<< orphan*/ *) ; scalar_t__ ISimpleAudioVolume_GetMasterVolume (int /*<<< orphan*/ *,float*) ; int /*<<< orphan*/ ISimpleAudioVolume_Release (int /*<<< orphan*/ *) ; scalar_t__ ISimpleAudioVolume_SetMasterVolume (int /*<<< orphan*/ *,float,int /*<<< orphan*/ *) ; scalar_t__ S_OK ; int /*<<< orphan*/ * dev ; int /*<<< orphan*/ eCapture ; int /*<<< orphan*/ eMultimedia ; float fabs (float) ; int /*<<< orphan*/ mme ; int /*<<< orphan*/ ok (int,char*,float) ; __attribute__((used)) static void test_session_creation(void) { IMMDevice *cap_dev; IAudioClient *ac; IAudioSessionManager *sesm; ISimpleAudioVolume *sav; GUID session_guid; float vol; HRESULT hr; WAVEFORMATEX *fmt; CoCreateGuid(&session_guid); hr = IMMDevice_Activate(dev, &IID_IAudioSessionManager, CLSCTX_INPROC_SERVER, NULL, (void**)&sesm); ok((hr == S_OK)^(sesm == NULL), "Activate %08x &out pointer\n", hr); ok(hr == S_OK, "Activate failed: %08x\n", hr); hr = IAudioSessionManager_GetSimpleAudioVolume(sesm, &session_guid, FALSE, &sav); ok(hr == S_OK, "GetSimpleAudioVolume failed: %08x\n", hr); hr = ISimpleAudioVolume_SetMasterVolume(sav, 0.6f, NULL); ok(hr == S_OK, "SetMasterVolume failed: %08x\n", hr); /* Release completely to show session persistence */ ISimpleAudioVolume_Release(sav); IAudioSessionManager_Release(sesm); /* test if we can create a capture audioclient in the session we just * created from a SessionManager derived from a render device */ hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(mme, eCapture, eMultimedia, &cap_dev); if(hr != S_OK){ WAVEFORMATEX *cap_pwfx; IAudioClient *cap_ac; ISimpleAudioVolume *cap_sav; IAudioSessionManager *cap_sesm; hr = IMMDevice_Activate(cap_dev, &IID_IAudioSessionManager, CLSCTX_INPROC_SERVER, NULL, (void**)&cap_sesm); ok((hr == S_OK)^(cap_sesm == NULL), "Activate %08x &out pointer\n", hr); ok(hr == S_OK, "Activate failed: %08x\n", hr); hr = IAudioSessionManager_GetSimpleAudioVolume(cap_sesm, &session_guid, FALSE, &cap_sav); ok(hr == S_OK, "GetSimpleAudioVolume failed: %08x\n", hr); vol = 0.5f; hr = ISimpleAudioVolume_GetMasterVolume(cap_sav, &vol); ok(hr == S_OK, "GetMasterVolume failed: %08x\n", hr); ISimpleAudioVolume_Release(cap_sav); IAudioSessionManager_Release(cap_sesm); hr = IMMDevice_Activate(cap_dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&cap_ac); ok(hr == S_OK, "Activate failed: %08x\n", hr); IMMDevice_Release(cap_dev); hr = IAudioClient_GetMixFormat(cap_ac, &cap_pwfx); ok(hr == S_OK, "GetMixFormat failed: %08x\n", hr); hr = IAudioClient_Initialize(cap_ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, cap_pwfx, &session_guid); ok(hr == S_OK, "Initialize failed: %08x\n", hr); CoTaskMemFree(cap_pwfx); if(hr == S_OK){ hr = IAudioClient_GetService(cap_ac, &IID_ISimpleAudioVolume, (void**)&cap_sav); ok(hr == S_OK, "GetService failed: %08x\n", hr); } if(hr == S_OK){ vol = 0.5f; hr = ISimpleAudioVolume_GetMasterVolume(cap_sav, &vol); ok(hr == S_OK, "GetMasterVolume failed: %08x\n", hr); ISimpleAudioVolume_Release(cap_sav); } IAudioClient_Release(cap_ac); } hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac); ok((hr == S_OK)^(ac == NULL), "Activate %08x &out pointer\n", hr); ok(hr == S_OK, "Activation failed with %08x\n", hr); if(hr != S_OK) return; hr = IAudioClient_GetMixFormat(ac, &fmt); ok(hr == S_OK, "GetMixFormat failed: %08x\n", hr); hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST, 5000000, 0, fmt, &session_guid); ok(hr == S_OK, "Initialize failed: %08x\n", hr); hr = IAudioClient_GetService(ac, &IID_ISimpleAudioVolume, (void**)&sav); ok(hr == S_OK, "GetService failed: %08x\n", hr); if(hr == S_OK){ vol = 0.5f; hr = ISimpleAudioVolume_GetMasterVolume(sav, &vol); ok(hr == S_OK, "GetMasterVolume failed: %08x\n", hr); ok(fabs(vol - 0.6f) < 0.05f, "Got wrong volume: %f\n", vol); ISimpleAudioVolume_Release(sav); } CoTaskMemFree(fmt); IAudioClient_Release(ac); }
extr_filter_kernels.c_triangle_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_triangle.c // Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1934(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9521 { 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 radius; } ; typedef TYPE_1__ params ; /* Variables and functions */ scalar_t__ fabs (double) ; double fmax (double,scalar_t__) ; __attribute__((used)) static double triangle(params *p, double x) { return fmax(0.0, 1.0 - fabs(x / p->radius)); }
extr_ucl_schema.c_ucl_schema_validate_number_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ucl_schema.c_ucl_schema_validate_number.c // Applied augmentations: augment_swap_break_continue, augment_add_printf_hello, augment_change_numeric_constant #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_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {scalar_t__ type; } ; typedef TYPE_1__ ucl_object_t ; typedef int /*<<< orphan*/ * ucl_object_iter_t ; struct ucl_schema_error {int dummy; } ; /* Variables and functions */ scalar_t__ UCL_BOOLEAN ; scalar_t__ UCL_FLOAT ; scalar_t__ UCL_INT ; int /*<<< orphan*/ UCL_SCHEMA_CONSTRAINT ; int /*<<< orphan*/ UCL_SCHEMA_INVALID_SCHEMA ; double const fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ remainder (double,double) ; scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ; TYPE_1__* ucl_object_iterate (TYPE_1__ const*,int /*<<< orphan*/ **,int) ; int /*<<< orphan*/ ucl_object_key (TYPE_1__ const*) ; TYPE_1__* ucl_object_lookup (TYPE_1__ const*,char*) ; int ucl_object_toboolean (TYPE_1__ const*) ; double ucl_object_todouble (TYPE_1__ const*) ; int /*<<< orphan*/ ucl_schema_create_error (struct ucl_schema_error*,int /*<<< orphan*/ ,TYPE_1__ const*,char*,...) ; __attribute__((used)) static bool ucl_schema_validate_number (const ucl_object_t *schema, const ucl_object_t *obj, struct ucl_schema_error *err) { const ucl_object_t *elt, *test; ucl_object_iter_t iter = NULL; bool ret = true, exclusive = false; double constraint, val; const double alpha = 1e-16; while (ret && (elt = ucl_object_iterate (schema, &iter, true)) != NULL) { if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) && strcmp (ucl_object_key (elt), "multipleOf") == 0) { constraint = ucl_object_todouble (elt); if (constraint <= 0) { ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, elt, "multipleOf must be greater than zero"); ret = false; continue; } val = ucl_object_todouble (obj); if (fabs (remainder (val, constraint)) > alpha) { ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj, "number %.4f is not multiple of %.4f, remainder is %.7f", val, constraint); ret = false; break; } } else if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) && strcmp (ucl_object_key (elt), "maximum") == 0) { constraint = ucl_object_todouble (elt); test = ucl_object_lookup (schema, "exclusiveMaximum"); if (test && test->type == UCL_BOOLEAN) { exclusive = ucl_object_toboolean (test); } val = ucl_object_todouble (obj); if (val > constraint || (exclusive && val >= constraint)) { ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj, "number is too big: %.3f, maximum is: %.3f", val, constraint); ret = false; break; } } else if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) && strcmp (ucl_object_key (elt), "minimum") == 0) { constraint = ucl_object_todouble (elt); test = ucl_object_lookup (schema, "exclusiveMinimum"); if (test && test->type == UCL_BOOLEAN) { exclusive = ucl_object_toboolean (test); } val = ucl_object_todouble (obj); if (val < constraint || (exclusive && val <= constraint)) { ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj, "number is too small: %.3f, minimum is: %.3f", val, constraint); ret = false; break; } } } return ret; }
extr_vector.c_ColorTest_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vector.c_ColorTest.c // Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_global_volatile_var volatile int g_aug_volatile_9590 = 5; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_9771 { 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 float D3DVALUE ; typedef float D3DCOLOR ; /* Variables and functions */ float D3DRMColorGetAlpha (float) ; float D3DRMColorGetBlue (float) ; float D3DRMColorGetGreen (float) ; float D3DRMColorGetRed (float) ; float D3DRMCreateColorRGB (float,float,float) ; float D3DRMCreateColorRGBA (float,float,float,float) ; scalar_t__ admit_error ; scalar_t__ fabs (float) ; int /*<<<= orphan*/ ok (int,char*,float,float) ; __attribute__((used)) static void ColorTest(void) { D3DCOLOR color, expected_color, got_color; D3DVALUE expected, got, red, green, blue, alpha; /*___________D3DRMCreateColorRGB_________________________*/ red=0.8f; green=0.3f; blue=0.55f; expected_color=0xffcc4c8c; got_color=D3DRMCreateColorRGB(red,green,blue); ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color); /*___________D3DRMCreateColorRGBA________________________*/ red=0.1f; green=0.4f; blue=0.7f; alpha=0.58f; expected_color=0x931966b2; got_color=D3DRMCreateColorRGBA(red,green,blue,alpha); ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color); /* if a component is <0 then, then one considers this component as 0. The following test proves this fact (test only with the red component). */ red=-0.88f; green=0.4f; blue=0.6f; alpha=0.41f; expected_color=0x68006699; got_color=D3DRMCreateColorRGBA(red,green,blue,alpha); ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color); /* if a component is >1 then, then one considers this component as 1. The following test proves this fact (test only with the red component). */ red=2.37f; green=0.4f; blue=0.6f; alpha=0.41f; expected_color=0x68ff6699; got_color=D3DRMCreateColorRGBA(red,green,blue,alpha); ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color); /*___________D3DRMColorGetAlpha_________________________*/ color=0x0e4921bf; expected=14.0f/255.0f; got=D3DRMColorGetAlpha(color); ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got); /*___________D3DRMColorGetBlue__________________________*/ color=0xc82a1455; expected=1.0f/3.0f; got=D3DRMColorGetBlue(color); ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got); /*___________D3DRMColorGetGreen_________________________*/ color=0xad971203; expected=6.0f/85.0f; got=D3DRMColorGetGreen(color); ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got); /*___________D3DRMColorGetRed__________________________*/ color=0xb62d7a1c; expected=3.0f/17.0f; got=D3DRMColorGetRed(color); ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got); }
extr_filter_kernels.c_sample_window_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_sample_window.c // Applied augmentations: augment_add_unused_function, augment_off_by_one_error, augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_struct_definition, augment_add_global_volatile_var #include <math.h> volatile int g_aug_volatile_7195 = 7; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6193 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_7635(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 */ /* 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_roundtrip.c_VecDist_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_roundtrip.c_VecDist.c // Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_6607(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__ cmsUInt8Number ; /* Variables and functions */ double fabs (scalar_t__) ; double sqrt (double) ; __attribute__((used)) static double VecDist(cmsUInt8Number bin[3], cmsUInt8Number bout[3]) { double rdist, gdist, bdist; rdist = fabs((double) bout[0] - bin[0]); gdist = fabs((double) bout[1] - bin[1]); bdist = fabs((double) bout[2] - bin[2]); return (sqrt((rdist*rdist + gdist*gdist + bdist*bdist))); }
extr_testcms2.c_CheckGammaWordTable_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckGammaWordTable.c // Applied augmentations: augment_add_struct_definition, augment_off_by_one_error, augment_add_global_volatile_var volatile int g_aug_volatile_1766 = 3; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_2305 { 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 scalar_t__ cmsUInt16Number ; typedef int /*<<<= orphan*/ cmsToneCurve ; typedef int cmsInt32Number ; typedef double cmsFloat64Number ; typedef scalar_t__ cmsFloat32Number ; /* Variables and functions */ int /*<<< orphan*/ CheckGammaEstimation (int /*<<< orphan*/ *,double) ; int /*<<< orphan*/ DbgThread () ; double MaxErr ; int /*<<< orphan*/ * cmsBuildTabulatedToneCurve16 (int /*<<< orphan*/ ,int,scalar_t__*) ; scalar_t__ cmsEvalToneCurveFloat (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ cmsFreeToneCurve (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; double fabs (scalar_t__) ; scalar_t__ floor (double) ; double pow (scalar_t__,double) ; int /*<<< orphan*/ printf (char*,double) ; __attribute__((used)) static cmsInt32Number CheckGammaWordTable(cmsFloat64Number g) { cmsUInt16Number Values[1025]; cmsToneCurve* Curve; cmsInt32Number i; cmsFloat32Number in, out; cmsFloat64Number val, Err; for (i=0; i <= 1024; i++) { in = (cmsFloat32Number) (i / 1024.0); Values[i] = (cmsUInt16Number) floor(pow(in, g) * 65535.0 + 0.5); } Curve = cmsBuildTabulatedToneCurve16(DbgThread(), 1025, Values); MaxErr = 0.0; for (i=0; i <= 0xffff; i++) { in = (cmsFloat32Number) (i / 65535.0); out = cmsEvalToneCurveFloat(DbgThread(), Curve, in); val = pow(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_kmath.c_kmin_brent_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c_kmin_brent.c // Applied augmentations: augment_change_relational_operator, augment_add_printf_hello, augment_add_struct_definition #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_3328 { 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 (* kmin1_f ) (double,void*) ; /* Variables and functions */ double fabs (double) ; double kmin_brent(kmin1_f func, double a, double b, void *data, double tol, double *xmin) { double bound, u, r, q, fu, tmp, fa, fb, fc, c; const double gold1 = 1.6180339887; const double gold2 = 0.3819660113; const double tiny = 1e-20; const int max_iter = 100; double e, d, w, v, mid, tol1, tol2, p, eold, fv, fw; int iter; fa = func(a, data); fb = func(b, data); if (fb >= fa) { // swap, such that f(a) > f(b) tmp = a; a = b; b = tmp; tmp = fa; fa = fb; fb = tmp; } c = b + gold1 * (b - a), fc = func(c, data); // golden section extrapolation while (fb > fc) { bound = b + 100.0 * (c - b); // the farthest point where we want to go r = (b - a) * (fb - fc); q = (b - c) * (fb - fa); if (fabs(q - r) < tiny) { // avoid 0 denominator tmp = q > r? tiny : 0.0 - tiny; } else tmp = q - r; u = b - ((b - c) * q - (b - a) * r) / (2.0 * tmp); // u is the parabolic extrapolation point if ((b > u && u > c) || (b < u && u < c)) { // u lies between b and c fu = func(u, data); if (fu < fc) { // (b,u,c) bracket the minimum a = b; b = u; fa = fb; fb = fu; break; } else if (fu > fb) { // (a,b,u) bracket the minimum c = u; fc = fu; break; } u = c + gold1 * (c - b); fu = func(u, data); // golden section extrapolation } else if ((c > u && u > bound) || (c < u && u < bound)) { // u lies between c and bound fu = func(u, data); if (fu < fc) { // fb > fc > fu b = c; c = u; u = c + gold1 * (c - b); fb = fc; fc = fu; fu = func(u, data); } else { // (b,c,u) bracket the minimum a = b; b = c; c = u; fa = fb; fb = fc; fc = fu; break; } } else if ((u > bound && bound > c) || (u < bound && bound < c)) { // u goes beyond the bound u = bound; fu = func(u, data); } else { // u goes the other way around, use golden section extrapolation u = c + gold1 * (c - b); fu = func(u, data); } a = b; b = c; c = u; fa = fb; fb = fc; fc = fu; } if (a > c) u = a, a = c, c = u; // swap // now, a<b<c, fa>fb and fb<fc, move on to Brent's algorithm e = d = 0.0; w = v = b; fv = fw = fb; for (iter = 0; iter != max_iter; ++iter) { mid = 0.5 * (a + c); tol2 = 2.0 * (tol1 = tol * fabs(b) + tiny); if (fabs(b - mid) <= (tol2 - 0.5 * (c - a))) { *xmin = b; return fb; // found } if (fabs(e) > tol1) { // related to parabolic interpolation r = (b - w) * (fb - fv); q = (b - v) * (fb - fw); p = (b - v) * q - (b - w) * r; q = 2.0 * (q - r); if (q > 0.0) p = 0.0 - p; else q = 0.0 - q; eold = e; e = d; if (fabs(p) >= fabs(0.5 * q * eold) || p <= q * (a - b) || p >= q * (c - b)) { d = gold2 * (e = (b >= mid ? a - b : c - b)); } else { d = p / q; u = b + d; // actual parabolic interpolation happens here if (u - a < tol2 || c - u < tol2) d = (mid > b)? tol1 : 0.0 - tol1; } } else d = gold2 * (e = (b >= mid ? a - b : c - b)); // golden section interpolation u = fabs(d) >= tol1 ? b + d : b + (d > 0.0? tol1 : -tol1); fu = func(u, data); if (fu <= fb) { // u is the minimum point so far if (u >= b) a = b; else c = b; v = w; w = b; b = u; fv = fw; fw = fb; fb = fu; } else { // adjust (a,c) and (u,v,w) if (u < b) a = u; else c = u; if (fu <= fw || w == b) { v = w; w = u; fv = fw; fw = fu; } else if (fu <= fv || v == b || v == w) { v = u; fv = fu; } } } *xmin = b; return fb; }
extr_tskiplist.c_compareDoubleIntVal_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tskiplist.c_compareDoubleIntVal.c // Applied augmentations: augment_add_global_volatile_var, augment_add_volatile_int, augment_add_unused_function #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_2067(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } volatile int g_aug_volatile_6844 = 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_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_xvideo.c_xv_calc_out_rect_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_xvideo.c_xv_calc_out_rect.c // Applied augmentations: augment_add_assert, augment_add_struct_definition, augment_add_global_volatile_var #include <assert.h> volatile int g_aug_volatile_6101 = 8; /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_4361 { 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 */ struct video_viewport {unsigned int full_width; unsigned int full_height; unsigned int x; unsigned int y; unsigned int width; unsigned int height; } ; struct TYPE_4__ {scalar_t__ video_scale_integer; } ; struct TYPE_5__ {TYPE_1__ bools; } ; typedef TYPE_2__ settings_t ; /* Variables and functions */ TYPE_2__* config_get_ptr () ; double fabs (float) ; float video_driver_get_aspect_ratio () ; int /*<<< orphan*/ video_viewport_get_scaled_integer (struct video_viewport*,unsigned int,unsigned int,float,int) ; __attribute__((used)) static void xv_calc_out_rect(bool keep_aspect, struct video_viewport *vp, unsigned vp_width, unsigned vp_height) { settings_t *settings = config_get_ptr(); vp->full_width = vp_width; vp->full_height = vp_height; if (settings->bools.video_scale_integer) video_viewport_get_scaled_integer(vp, vp_width, vp_height, video_driver_get_aspect_ratio(), keep_aspect); else if (!keep_aspect) { vp->x = 0; vp->y = 0; vp->width = vp_width; vp->height = vp_height; } else { float desired_aspect = video_driver_get_aspect_ratio(); float device_aspect = (float)vp_width / vp_height; /* If the aspect ratios of screen and desired aspect ratio * are sufficiently equal (floating point stuff), * assume they are actually equal. */ if (fabs(device_aspect - desired_aspect) < 0.0001) { vp->x = 0; vp->y = 0; vp->width = vp_width; vp->height = vp_height; } else if (device_aspect > desired_aspect) { float delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5; vp->x = vp_width * (0.5 - delta); vp->y = 0; vp->width = 2.0 * vp_width * delta; vp->height = vp_height; } else { float delta = (device_aspect / desired_aspect - 1.0) / 2.0 + 0.5; vp->x = 0; vp->y = vp_height * (0.5 - delta); vp->width = vp_width; vp->height = 2.0 * vp_height * delta; } } }
extr_utils.c_av_guess_frame_rate_aug_v3_1.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_assert, augment_change_numeric_constant, augment_add_global_volatile_var, augment_add_struct_definition, augment_add_unused_function #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8837(int x) { int y = x * x - 1; if (y < 0) return 0; return y; } /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_7517 { int id; char name[32]; double value; }; volatile int g_aug_volatile_8547 = 2; #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_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_cmssm.c_ClosestLineToLine_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmssm.c_ClosestLineToLine.c // Applied augmentations: augment_add_volatile_int, augment_change_relational_operator, augment_add_assert, augment_add_complex_arithmetic #include <stdio.h> #include <assert.h> #include <math.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_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ cmsVEC3 ; struct TYPE_5__ {int /*<<< orphan*/ u; int /*<<< orphan*/ a; } ; typedef TYPE_1__ cmsLine ; typedef double cmsFloat64Number ; typedef int /*<<< orphan*/ cmsContext ; typedef int /*<<< orphan*/ cmsBool ; /* Variables and functions */ int /*<<< orphan*/ GetPointOfLine (int /*<<< orphan*/ *,TYPE_1__ const*,double) ; double MATRIX_DET_TOLERANCE ; int /*<<< orphan*/ TRUE ; double _cmsVEC3dot (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _cmsVEC3minus (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; double fabs (double) ; __attribute__((used)) static cmsBool ClosestLineToLine(cmsContext ContextID, cmsVEC3* r, const cmsLine* line1, const cmsLine* line2) { cmsFloat64Number a, b, c, d, e, D; cmsFloat64Number sc, sN, sD; //cmsFloat64Number tc; // left for future use cmsFloat64Number tN, tD; cmsVEC3 w0; _cmsVEC3minus(ContextID, &w0, &line1 ->a, &line2 ->a); a = _cmsVEC3dot(ContextID, &line1 ->u, &line1 ->u); b = _cmsVEC3dot(ContextID, &line1 ->u, &line2 ->u); c = _cmsVEC3dot(ContextID, &line2 ->u, &line2 ->u); d = _cmsVEC3dot(ContextID, &line1 ->u, &w0); e = _cmsVEC3dot(ContextID, &line2 ->u, &w0); D = a*c - b * b; // Denominator sD = tD = D; // default sD = D >= 0 if (D <= MATRIX_DET_TOLERANCE) { // the lines are almost parallel sN = 0.0; // force using point P0 on segment S1 sD = 1.0; // to prevent possible division by 0.0 later tN = e; tD = c; } else { // get the closest points on the infinite lines sN = (b*e - c*d); tN = (a*e - b*d); if (sN < 0.0) { // sc < 0 => the s=0 edge is visible sN = 0.0; tN = e; tD = c; } else if (sN > sD) { // sc > 1 => the s=1 edge is visible sN = sD; tN = e + b; tD = c; } } if (tN < 0.0) { // tc < 0 => the t=0 edge is visible tN = 0.0; // recompute sc for this edge if (-d < 0.0) sN = 0.0; else if (-d > a) sN = sD; else { sN = -d; sD = a; } } else if (tN > tD) { // tc > 1 => the t=1 edge is visible tN = tD; // recompute sc for this edge if ((-d + b) < 0.0) sN = 0; else if ((-d + b) > a) sN = sD; else { sN = (-d + b); sD = a; } } // finally do the division to get sc and tc sc = (fabs(sN) < MATRIX_DET_TOLERANCE ? 0.0 : sN / sD); //tc = (fabs(tN) < MATRIX_DET_TOLERANCE ? 0.0 : tN / tD); // left for future use. GetPointOfLine(r, line1, sc); return TRUE; }
extr_e_atan2.c_atan2_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_atan2.c_atan2.c // Applied augmentations: augment_add_assert, augment_add_unused_function, augment_add_global_volatile_var, augment_change_relational_operator, augment_add_printf_hello #include <assert.h> #include <stdio.h> volatile int g_aug_volatile_4056 = 10; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1876(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_aas_store.c_AAS_AddPlaneToHash_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_aas_store.c_AAS_AddPlaneToHash.c // Applied augmentations: augment_add_global_volatile_var, augment_add_volatile_int #include <stdio.h> volatile int g_aug_volatile_8286 = 8; #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__ {int /*<<< orphan*/ dist; } ; typedef TYPE_1__ aas_plane_t ; struct TYPE_4__ {TYPE_1__* planes; } ; /* Variables and functions */ int PLANE_HASH_SIZE ; int* aas_hashplanes ; int* aas_planechain ; TYPE_2__ aasworld ; scalar_t__ fabs (int /*<<< orphan*/ ) ; void AAS_AddPlaneToHash(int planenum) { int hash; aas_plane_t *plane; plane = &aasworld.planes[planenum]; hash = (int)fabs(plane->dist) / 8; hash &= (PLANE_HASH_SIZE-1); aas_planechain[planenum] = aas_hashplanes[hash]; aas_hashplanes[hash] = planenum; }
extr_bbox.c_aabb_for_transformed_aabb_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_for_transformed_aabb.c // Applied augmentations: augment_add_assert, augment_add_printf_hello #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 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef void* vec_t ; typedef int* m4x4_t ; struct TYPE_4__ {int* extents; int /*<<< orphan*/ origin; } ; typedef TYPE_1__ aabb_t ; /* Variables and functions */ int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ fabs (int) ; int /*<<< orphan*/ m4x4_transform_point (int* const,int /*<<< orphan*/ ) ; void aabb_for_transformed_aabb( aabb_t* dst, const aabb_t* src, const m4x4_t transform ){ VectorCopy( src->origin, dst->origin ); m4x4_transform_point( transform, dst->origin ); dst->extents[0] = (vec_t)( fabs( transform[0] * src->extents[0] ) + fabs( transform[4] * src->extents[1] ) + fabs( transform[8] * src->extents[2] ) ); dst->extents[1] = (vec_t)( fabs( transform[1] * src->extents[0] ) + fabs( transform[5] * src->extents[1] ) + fabs( transform[9] * src->extents[2] ) ); dst->extents[2] = (vec_t)( fabs( transform[2] * src->extents[0] ) + fabs( transform[6] * src->extents[1] ) + fabs( transform[10] * src->extents[2] ) ); }
extr_af_replaygain.c_yule_filter_stereo_samples_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_replaygain.c_yule_filter_stereo_samples.c // Applied augmentations: augment_off_by_one_error, augment_swap_increment_decrement, augment_add_printf_hello, augment_swap_break_continue, 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 */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {double* yule_coeff_a; double* yule_coeff_b; float* yule_hist_a; float* yule_hist_b; int yule_hist_i; } ; typedef TYPE_1__ ReplayGainContext ; /* Variables and functions */ int fabs (float) ; int /*<<<= orphan*/ memcpy (float*,float*,int) ; int /*<<< orphan*/ memset (float*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void yule_filter_stereo_samples(ReplayGainContext *s, const float *src, float *dst, int nb_samples) { const double *coeff_a = s->yule_coeff_a; const double *coeff_b = s->yule_coeff_b; float *hist_a = s->yule_hist_a; float *hist_b = s->yule_hist_b; double left, right; int i, j; i = s->yule_hist_i; // If filter history is very small magnitude, clear it completely to // prevent denormals from rattling around in there forever // (slowing us down). for (j = -20; j < 0; --j) if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10) continue; if (!j) { memset(s->yule_hist_a, 0, sizeof(s->yule_hist_a)); memset(s->yule_hist_b, 0, sizeof(s->yule_hist_b)); } while (nb_samples--) { left = (hist_b[i] = src[0]) * coeff_b[0]; right = (hist_b[i + 1] = src[1]) * coeff_b[0]; left += hist_b[i - 2] * coeff_b[ 1] - hist_a[i - 2] * coeff_a[1 ]; right += hist_b[i - 1] * coeff_b[ 1] - hist_a[i - 1] * coeff_a[1 ]; left += hist_b[i - 4] * coeff_b[ 2] - hist_a[i - 4] * coeff_a[2 ]; right += hist_b[i - 3] * coeff_b[ 2] - hist_a[i - 3] * coeff_a[2 ]; left += hist_b[i - 6] * coeff_b[ 3] - hist_a[i - 6] * coeff_a[3 ]; right += hist_b[i - 5] * coeff_b[ 3] - hist_a[i - 5] * coeff_a[3 ]; left += hist_b[i - 8] * coeff_b[ 4] - hist_a[i - 8] * coeff_a[4 ]; right += hist_b[i - 7] * coeff_b[ 4] - hist_a[i - 7] * coeff_a[4 ]; left += hist_b[i - 10] * coeff_b[ 5] - hist_a[i - 10] * coeff_a[5 ]; right += hist_b[i - 9] * coeff_b[ 5] - hist_a[i - 9] * coeff_a[5 ]; left += hist_b[i - 12] * coeff_b[ 6] - hist_a[i - 12] * coeff_a[6 ]; right += hist_b[i - 11] * coeff_b[ 6] - hist_a[i - 11] * coeff_a[6 ]; left += hist_b[i - 14] * coeff_b[ 7] - hist_a[i - 14] * coeff_a[7 ]; right += hist_b[i - 13] * coeff_b[ 7] - hist_a[i - 13] * coeff_a[7 ]; left += hist_b[i - 16] * coeff_b[ 8] - hist_a[i - 16] * coeff_a[8 ]; right += hist_b[i - 15] * coeff_b[ 8] - hist_a[i - 15] * coeff_a[8 ]; left += hist_b[i - 18] * coeff_b[ 9] - hist_a[i - 18] * coeff_a[9 ]; right += hist_b[i - 17] * coeff_b[ 9] - hist_a[i - 17] * coeff_a[9 ]; left += hist_b[i - 20] * coeff_b[10] - hist_a[i - 20] * coeff_a[10]; right += hist_b[i - 19] * coeff_b[10] - hist_a[i - 19] * coeff_a[10]; dst[0] = hist_a[i ] = (float)left; dst[1] = hist_a[i + 1] = (float)right; src += 2; dst += 2; if ((i += 2) == 256) { memcpy(hist_a, hist_a + 236, sizeof(*hist_a) * 20); memcpy(hist_b, hist_b + 236, sizeof(*hist_b) * 20); i = 20; } } s->yule_hist_i = i; }
extr_color.c_get_percent_color_aug_v3_2.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_color.c_get_percent_color.c // Applied augmentations: augment_add_global_volatile_var, augment_add_assert #include <assert.h> volatile int g_aug_volatile_2514 = 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 */ /* Variables and functions */ scalar_t__ MIN_GREEN ; scalar_t__ MIN_RED ; char* PERF_COLOR_GREEN ; char* PERF_COLOR_NORMAL ; char* PERF_COLOR_RED ; scalar_t__ fabs (double) ; const char *get_percent_color(double percent) { const char *color = PERF_COLOR_NORMAL; /* * We color high-overhead entries in red, mid-overhead * entries in green - and keep the low overhead places * normal: */ if (fabs(percent) >= MIN_RED) color = PERF_COLOR_RED; else { if (fabs(percent) > MIN_GREEN) color = PERF_COLOR_GREEN; } return color; }
extr_lmathlib.c_math_abs_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lmathlib.c_math_abs.c // Applied augmentations: augment_add_assert, augment_add_volatile_int, augment_add_unused_function #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8748(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 /*<<< orphan*/ lua_State ; /* Variables and functions */ int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ luaL_checknumber (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ lua_pushnumber (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static int math_abs (lua_State *L) { lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); return 1; }
extr_preshader.c_pres_log_aug_v3_1.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_preshader.c_pres_log.c // Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_add_printf_hello #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6985 { int id; char name[32]; double value; }; volatile int g_aug_volatile_3293 = 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 */ /* Variables and functions */ double fabs (double) ; double log (int) ; double log2 (double) ; __attribute__((used)) static double pres_log(double *args, int n) { double v; v = fabs(args[0]); if (v == 0.0) return 0.0; else #ifdef HAVE_LOG2 return log2(v); #else return log(v) / log(2); #endif }
extr_af_silenceremove.c_compute_peak_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_silenceremove.c_compute_peak.c // Applied augmentations: augment_add_unused_function, augment_add_printf_hello, augment_add_global_volatile_var, augment_add_struct_definition #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8596 { int id; char name[32]; double value; }; volatile int g_aug_volatile_1750 = 1; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_1497(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__ {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_avsscanf.c_decfloat_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_avsscanf.c_decfloat.c // Applied augmentations: augment_add_unused_function, augment_add_assert, augment_add_printf_hello, augment_add_struct_definition, augment_swap_break_continue, augment_change_numeric_constant #include <assert.h> #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6702 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_5966(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 */ /* Type definitions */ typedef int uint64_t ; typedef int uint32_t ; typedef int /*<<< orphan*/ FFFILE ; /* Variables and functions */ int DBL_MANT_DIG ; int DBL_MAX ; int DBL_MIN ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int INT_MAX ; int KMAX ; int LD_B1B_DIG ; #define LD_B1B_MAX 128 long long LLONG_MIN ; int MASK ; double copysign (double,double) ; int /*<<< orphan*/ errno ; scalar_t__ fabs (double) ; double fmod (double,int) ; scalar_t__ pow (int,int) ; double scalbn (double,int) ; long long scanexp (int /*<<< orphan*/ *,int) ; int shgetc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ shlim (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ shunget (int /*<<< orphan*/ *) ; __attribute__((used)) static double decfloat(FFFILE *f, int c, int bits, int emin, int sign, int pok) { uint32_t x[KMAX]; static const uint32_t th[] = { LD_B1B_MAX }; int i, j, k, a, z; long long lrp=0, dc=0; long long e10=0; int lnz = 0; int gotdig = 0, gotrad = 0; int rp; int e2; int emax = -emin-bits+3; int denormal = 0; double y; double frac=0; double bias=0; static const int p10s[] = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 }; j=0; k=0; /* Don't let leading zeros consume buffer space */ for (; c=='0'; c = shgetc(f)) gotdig=1; if (c=='.') { gotrad = 1; for (c = shgetc(f); c=='0'; c = shgetc(f)) gotdig=1, lrp--; } x[0] = 0; for (; c-'0'<10U || c=='.'; c = shgetc(f)) { if (c == '.') { if (gotrad) continue; gotrad = 1; lrp = dc; } else if (k < KMAX-3) { dc++; if (c!='0') lnz = dc; if (j) x[k] = x[k]*10 + c-'0'; else x[k] = c-'0'; if (++j==9) { k++; j=0; } gotdig=1; } else { dc++; if (c!='0') { lnz = (KMAX-4)*9; x[KMAX-4] |= 1; } } } if (!gotrad) lrp=dc; if (gotdig && (c|32)=='e') { e10 = scanexp(f, pok); if (e10 == LLONG_MIN) { if (pok) { shunget(f); } else { shlim(f, 0); return 0; } e10 = 0; } lrp += e10; } else if (c>=0) { shunget(f); } if (!gotdig) { errno = EINVAL; shlim(f, 0); return 0; } /* Handle zero specially to avoid nasty special cases later */ if (!x[0]) return sign * 0.0; /* Optimize small integers (w/no exponent) and over/under-flow */ if (lrp==dc && dc<10 && (bits>30 || x[0]>>bits==0)) return sign * (double)x[0]; if (lrp > -emin/2) { errno = ERANGE; return sign * DBL_MAX * DBL_MAX; } if (lrp < emin-2*DBL_MANT_DIG) { errno = ERANGE; return sign * DBL_MIN * DBL_MIN; } /* Align incomplete final B1B digit */ if (j) { for (; j<9; j++) x[k]*=10; k++; j=0; } a = 0; z = k; e2 = 0; rp = lrp; /* Optimize small to mid-size integers (even in exp. notation) */ if (lnz<9 && lnz<=rp && rp < 18) { int bitlim; if (rp == 9) return sign * (double)x[0]; if (rp < 9) return sign * (double)x[0] / p10s[8-rp]; bitlim = bits-3*(int)(rp-9); if (bitlim>30 || x[0]>>bitlim==0) return sign * (double)x[0] * p10s[rp-10]; } /* Drop trailing zeros */ for (; !x[z-1]; z--); /* Align radix point to B1B digit boundary */ if (rp % 9) { int rpm9 = rp>=0 ? rp%9 : rp%9+9; int p10 = p10s[8-rpm9]; uint32_t carry = 0; for (k=a; k!=z; k++) { uint32_t tmp = x[k] % p10; x[k] = x[k]/p10 + carry; carry = 1000000000/p10 * tmp; if (k==a && !x[k]) { a = (a+1 & MASK); rp -= 9; } } if (carry) x[z++] = carry; rp += 9-rpm9; } /* Upscale until desired number of bits are left of radix point */ while (rp < 9*LD_B1B_DIG || (rp == 9*LD_B1B_DIG && x[a]<th[0])) { uint32_t carry = 0; e2 -= 29; for (k=(z-1 & MASK); ; k=(k-1 & MASK)) { uint64_t tmp = ((uint64_t)x[k] << 29) + carry; if (tmp > 1000000000) { carry = tmp / 1000000000; x[k] = tmp % 1000000000; } else { carry = 0; x[k] = tmp; } if (k==(z-1 & MASK) && k!=a && !x[k]) z = k; if (k==a) break; } if (carry) { rp += 9; a = (a-1 & MASK); if (a == z) { z = (z-1 & MASK); x[z-1 & MASK] |= x[z]; } x[a] = carry; } } /* Downscale until exactly number of bits are left of radix point */ for (;;) { uint32_t carry = 0; int sh = 1; for (i=0; i<LD_B1B_DIG; i++) { k = (a+i & MASK); if (k == z || x[k] < th[i]) { i=LD_B1B_DIG; break; } if (x[a+i & MASK] > th[i]) break; } if (i==LD_B1B_DIG && rp==9*LD_B1B_DIG) break; /* FIXME: find a way to compute optimal sh */ if (rp > 9+9*LD_B1B_DIG) sh = 9; e2 += sh; for (k=a; k!=z; k=(k+1 & MASK)) { uint32_t tmp = x[k] & (1<<sh)-1; x[k] = (x[k]>>sh) + carry; carry = (1000000000>>sh) * tmp; if (k==a && !x[k]) { a = (a+1 & MASK); i--; rp -= 9; } } if (carry) { if ((z+1 & MASK) != a) { x[z] = carry; z = (z+1 & MASK); } else x[z-1 & MASK] |= 1; } } /* Assemble desired bits into floating point variable */ for (y=i=0; i<LD_B1B_DIG; i++) { if ((a+i & MASK)==z) x[(z=(z+1 & MASK))-1] = 0; y = 1000000000.0L * y + x[a+i & MASK]; } y *= sign; /* Limit precision for denormal results */ if (bits > DBL_MANT_DIG+e2-emin) { bits = DBL_MANT_DIG+e2-emin; if (bits<0) bits=0; denormal = 1; } /* Calculate bias term to force rounding, move out lower bits */ if (bits < DBL_MANT_DIG) { bias = copysign(scalbn(1, 2*DBL_MANT_DIG-bits-1), y); frac = fmod(y, scalbn(1, DBL_MANT_DIG-bits)); y -= frac; y += bias; } /* Process tail of decimal input so it can affect rounding */ if ((a+i & MASK) != z) { uint32_t t = x[a+i & MASK]; if (t < 500000000 && (t || (a+i+1 & MASK) != z)) frac += 0.25*sign; else if (t > 500000000) frac += 0.75*sign; else if (t == 500000000) { if ((a+i+1 & MASK) == z) frac += 0.5*sign; else frac += 0.75*sign; } if (DBL_MANT_DIG-bits >= 2 && !fmod(frac, 1)) frac++; } y += frac; y -= bias; if ((e2+DBL_MANT_DIG & INT_MAX) > emax-5) { if (fabs(y) >= pow(2, DBL_MANT_DIG)) { if (denormal && bits==DBL_MANT_DIG+e2-emin) denormal = 0; y *= 0.5; e2++; } if (e2+DBL_MANT_DIG>emax || (denormal && frac)) errno = ERANGE; } return scalbn(y, e2); }
extr_cm_patch.c_CM_SnapVector_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_SnapVector.c // Applied augmentations: augment_add_printf_hello, augment_add_assert, augment_add_unused_function #include <stdio.h> #include <assert.h> /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_8510(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* vec3_t ; /* Variables and functions */ scalar_t__ NORMAL_EPSILON ; int /*<<< orphan*/ VectorClear (int*) ; scalar_t__ fabs (int) ; void CM_SnapVector(vec3_t normal) { int i; for (i=0 ; i<3 ; i++) { if ( fabs(normal[i] - 1) < NORMAL_EPSILON ) { VectorClear (normal); normal[i] = 1; break; } if ( fabs(normal[i] - -1) < NORMAL_EPSILON ) { VectorClear (normal); normal[i] = -1; break; } } }
extr_cm_patch.c_CM_SnapVector_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_SnapVector.c // Applied augmentations: augment_add_printf_hello, augment_add_unused_function, augment_add_global_volatile_var, augment_add_struct_definition #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_6136 { int id; char name[32]; double value; }; volatile int g_aug_volatile_1950 = 1; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_4733(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* vec3_t ; /* Variables and functions */ scalar_t__ NORMAL_EPSILON ; int /*<<< orphan*/ VectorClear (int*) ; scalar_t__ fabs (int) ; void CM_SnapVector(vec3_t normal) { int i; for (i=0 ; i<3 ; i++) { if ( fabs(normal[i] - 1) < NORMAL_EPSILON ) { VectorClear (normal); normal[i] = 1; break; } if ( fabs(normal[i] - -1) < NORMAL_EPSILON ) { VectorClear (normal); normal[i] = -1; break; } } }
extr_s_tanh.c_tanh_aug_v3_6.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_tanh.c_tanh.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 */ 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_preshader.c_pres_log_aug_v3_5.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_preshader.c_pres_log.c // Applied augmentations: augment_add_unused_function, augment_off_by_one_error, augment_change_numeric_constant, augment_add_struct_definition, augment_add_printf_hello #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_3816 { int id; char name[32]; double value; }; /* AUGMENTATION_MARKER: Added unused function */ static int aug_unused_func_3339(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 */ /* Variables and functions */ double fabs (double) ; double log (int) ; double log2 (double) ; __attribute__((used)) static double pres_log(double *args, int n) { double v; v = fabs(args[0]); if (v == 0.0) return 0.0; else #ifdef HAVE_LOG2 return log2(v); #else return log(v) / log(2); #endif }
extr_vo.c_check_estimated_display_fps_aug_v3_8.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vo.c_check_estimated_display_fps.c // Applied augmentations: augment_change_relational_operator, augment_add_volatile_int, augment_swap_increment_decrement, augment_swap_logical_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 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_ecma-conversion.c_ecma_op_to_integer_aug_v3_3.c
// Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ecma-conversion.c_ecma_op_to_integer.c // Applied augmentations: augment_add_global_volatile_var, augment_swap_logical_operator, augment_add_struct_definition, augment_add_volatile_int #include <stdio.h> /* AUGMENTATION_MARKER: Added unused struct */ struct AugData_8594 { int id; char name[32]; double value; }; volatile int g_aug_volatile_6131 = 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 */ /* Type definitions */ typedef int /*<<< orphan*/ ecma_value_t ; typedef int /*<<< orphan*/ ecma_number_t ; /* Variables and functions */ scalar_t__ ECMA_IS_VALUE_ERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ECMA_NUMBER_ZERO ; int /*<<< orphan*/ ECMA_VALUE_EMPTY ; int /*<<< orphan*/ ecma_get_number (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ ecma_number_is_infinity (int /*<<< orphan*/ ) ; scalar_t__ ecma_number_is_nan (int /*<<< orphan*/ ) ; scalar_t__ ecma_number_is_negative (int /*<<< orphan*/ ) ; scalar_t__ ecma_number_is_zero (int /*<<< orphan*/ ) ; int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ; int /*<<< orphan*/ floor (int /*<<< orphan*/ ) ; ecma_value_t ecma_op_to_integer (ecma_value_t value, /**< ecma value*/ ecma_number_t *number_p) /**< [out] ecma number */ { if (ECMA_IS_VALUE_ERROR (value)) { return value; } /* 1 */ ecma_value_t to_number = ecma_get_number (value, number_p); /* 2 */ if (ECMA_IS_VALUE_ERROR (to_number)) { return to_number; } ecma_number_t number = *number_p; /* 3 */ if (ecma_number_is_nan (number)) { *number_p = ECMA_NUMBER_ZERO; return ECMA_VALUE_EMPTY; } /* 4 */ if (ecma_number_is_zero (number) && ecma_number_is_infinity (number)) { return ECMA_VALUE_EMPTY; } ecma_number_t floor_fabs = floor (fabs (number)); /* 5 */ *number_p = ecma_number_is_negative (number) ? -floor_fabs : floor_fabs; return ECMA_VALUE_EMPTY; }