name stringlengths 23 117 | code stringlengths 356 42.1k |
|---|---|
extr_2xbr.c_df8_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_2xbr.c_df8.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_add_global_volatile_var, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_7524 = 6;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4935 {
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 uint32_t ;
/* Variables and functions */
int abs (int) ;
int fabs (double) ;
float df8(uint32_t A, uint32_t B,
uint32_t pg_red_mask, uint32_t pg_green_mask, uint32_t pg_blue_mask)
{
uint32_t r, g, b;
uint32_t y, u, v;
#ifdef MSB_FIRST
r = abs((int)(((A & pg_red_mask )>>24) - ((B & pg_red_mask )>> 24)));
g = abs((int)(((A & pg_green_mask )>>16) - ((B & pg_green_mask )>> 16)));
b = abs((int)(((A & pg_blue_mask )>>8 ) - ((B & pg_blue_mask )>> 8 )));
#else
b = abs((int)(((A & pg_blue_mask )>>16) - ((B & pg_blue_mask )>> 16)));
g = abs((int)(((A & pg_green_mask)>>8 ) - ((B & pg_green_mask )>> 8)));
r = abs((int)(((A & pg_red_mask ) - (B & pg_red_mask ))));
#endif
y = fabs(0.299*r + 0.587*g + 0.114*b);
u = fabs(-0.169*r - 0.331*g + 0.500*b);
v = fabs(0.500*r - 0.419*g - 0.081*b);
return 48*y + 7*u + 6*v;
} |
extr_vf_eq.c_check_values_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_eq.c_check_values.c
// Applied augmentations: augment_change_numeric_constant, augment_add_assert, augment_add_complex_arithmetic
#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 1
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ * process; } ;
struct TYPE_5__ {double contrast; double brightness; double gamma; int /*<<< orphan*/ * adjust; } ;
typedef TYPE_1__ EQParameters ;
typedef TYPE_2__ EQContext ;
/* Variables and functions */
int /*<<< orphan*/ * apply_lut ;
double fabs (double) ;
__attribute__((used)) static void check_values(EQParameters *param, EQContext *eq)
{
if (param->contrast == 1.0 && param->brightness == 0.0 && param->gamma == 1.0)
param->adjust = NULL;
else if (param->gamma == 1.0 && fabs(param->contrast) < 7.9)
param->adjust = eq->process;
else
param->adjust = apply_lut;
} |
extr_soundv.c_VS_FindAdjacentSurface_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_soundv.c_VS_FindAdjacentSurface.c
// Applied augmentations: augment_change_relational_operator, augment_swap_break_continue, augment_off_by_one_error, augment_add_volatile_int, 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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
struct TYPE_7__ {int /*<<<= orphan*/ normal; } ;
typedef TYPE_1__ plane_t ;
struct TYPE_8__ {double radius; int numFacets; int /*<<< orphan*/ patch; scalar_t__ trisoup; TYPE_3__* facets; int /*<<< orphan*/ origin; } ;
typedef TYPE_2__ lsurfaceTest_t ;
struct TYPE_9__ {int numpoints; float** points; TYPE_1__ plane; } ;
typedef TYPE_3__ lFacet_t ;
struct TYPE_10__ {scalar_t__ lightmapNum; } ;
typedef TYPE_4__ dsurface_t ;
/* Variables and functions */
double DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,int /*<<< orphan*/ ,scalar_t__*) ;
TYPE_4__* drawSurfaces ;
double fabs (scalar_t__) ;
TYPE_2__** lsurfaceTest ;
int numDrawSurfaces ;
int qfalse ;
int qtrue ;
int VS_FindAdjacentSurface(int surfaceNum, int facetNum, vec3_t p1, vec3_t p2, int *sNum, int *fNum, int *point)
{
int i, j, k;
lsurfaceTest_t *test;
lFacet_t *facet;
dsurface_t *ds;
float *fp1, *fp2;
vec3_t dir;
plane_t *facetplane;
// winding_t w;
facetplane = &lsurfaceTest[surfaceNum]->facets[facetNum].plane;
// DebugNet_RemoveAllPolys();
// memcpy(w.points, lsurfaceTest[surfaceNum]->facets[facetNum].points,
// lsurfaceTest[surfaceNum]->facets[facetNum].numpoints * sizeof(vec3_t));
// w.numpoints = lsurfaceTest[surfaceNum]->facets[facetNum].numpoints;
// DebugNet_DrawWinding(&w, 2);
for ( i = 0 ; i <= numDrawSurfaces ; i++ )
{
if (i == surfaceNum)
continue;
test = lsurfaceTest[ i ];
if (!test)
continue;
if (test->trisoup)// || test->patch)
continue;
ds = &drawSurfaces[i];
if ( ds->lightmapNum < 0 )
continue;
//if this surface is not even near the edge
VectorSubtract(p1, test->origin, dir);
if (fabs(dir[0]) > test->radius ||
fabs(dir[1]) > test->radius ||
fabs(dir[1]) > test->radius)
{
VectorSubtract(p2, test->origin, dir);
if (fabs(dir[0]) > test->radius ||
fabs(dir[1]) > test->radius ||
fabs(dir[1]) > test->radius)
{
continue;
}
}
//
for (j = 0; j < test->numFacets; j++)
{
facet = &test->facets[j];
//
//if (!Plane_Equal(&facet->plane, facetplane, qfalse))
if (DotProduct(facet->plane.normal, facetplane->normal) < 0.9)
{
if (!test->trisoup && !test->patch)
continue;
continue;
}
//
for (k = 0; k < facet->numpoints; k++)
{
fp1 = facet->points[k];
if (fabs(p2[0] - fp1[0]) < 0.1 &&
fabs(p2[1] - fp1[1]) < 0.1 &&
fabs(p2[2] - fp1[2]) < 0.1)
{
fp2 = facet->points[(k+1) % facet->numpoints];
if (fabs(p1[0] - fp2[0]) < 0.1 &&
fabs(p1[1] - fp2[1]) < 0.1 &&
fabs(p1[2] - fp2[2]) < 0.1)
{
// memcpy(w.points, facet->points, facet->numpoints * sizeof(vec3_t));
// w.numpoints = facet->numpoints;
// DebugNet_DrawWinding(&w, 1);
*sNum = i;
*fNum = j;
*point = k;
return qtrue;
}
}
/*
else if (fabs(p1[0] - fp1[0]) < 0.1 &&
fabs(p1[1] - fp1[1]) < 0.1 &&
fabs(p1[2] - fp1[2]) < 0.1)
{
fp2 = facet->points[(k+1) % facet->numpoints];
if (fabs(p2[0] - fp2[0]) < 0.1 &&
fabs(p2[1] - fp2[1]) < 0.1 &&
fabs(p2[2] - fp2[2]) < 0.1)
{
// memcpy(w.points, facet->points, facet->numpoints * sizeof(vec3_t));
// w.numpoints = facet->numpoints;
// DebugNet_DrawWinding(&w, 1);
*sNum = i;
*fNum = j;
*point = k;
return qtrue;
}
}
//*/
}
}
}
return qfalse;
} |
extr_light.c_LightContributionToSample_aug_v3_8.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_change_numeric_constant, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2866 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2006(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 */
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_tetrahedron.c_TH_PlaneEqual_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tetrahedron.c_TH_PlaneEqual.c
// Applied augmentations: augment_add_assert, augment_add_global_volatile_var, augment_add_unused_function, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9805(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_1820 = 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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vec_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_3__ {scalar_t__ dist; scalar_t__* normal; } ;
typedef TYPE_1__ th_plane_t ;
typedef int qboolean ;
/* Variables and functions */
scalar_t__ DIST_EPSILON ;
scalar_t__ NORMAL_EPSILON ;
scalar_t__ fabs (scalar_t__) ;
qboolean TH_PlaneEqual(th_plane_t *p, vec3_t normal, vec_t dist)
{
if (
fabs(p->normal[0] - normal[0]) < NORMAL_EPSILON
&& fabs(p->normal[1] - normal[1]) < NORMAL_EPSILON
&& fabs(p->normal[2] - normal[2]) < NORMAL_EPSILON
&& fabs(p->dist - dist) < DIST_EPSILON )
return true;
return false;
} |
extr_s_erf.c_erfc_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_erf.c_erfc.c
// Applied augmentations: augment_swap_logical_operator, augment_add_unused_function, augment_change_numeric_constant
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6692(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 u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ;
double __ieee754_exp (double) ;
double erx ;
double fabs (double) ;
double half ;
double one ;
double pa0 ;
double pa1 ;
double pa2 ;
double pa3 ;
double pa4 ;
double pa5 ;
double pa6 ;
double pp0 ;
double pp1 ;
double pp2 ;
double pp3 ;
double pp4 ;
double qa1 ;
double qa2 ;
double qa3 ;
double qa4 ;
double qa5 ;
double qa6 ;
double qq1 ;
double qq2 ;
double qq3 ;
double qq4 ;
double qq5 ;
double ra0 ;
double ra1 ;
double ra2 ;
double ra3 ;
double ra4 ;
double ra5 ;
double ra6 ;
double ra7 ;
double rb0 ;
double rb1 ;
double rb2 ;
double rb3 ;
double rb4 ;
double rb5 ;
double rb6 ;
double sa1 ;
double sa2 ;
double sa3 ;
double sa4 ;
double sa5 ;
double sa6 ;
double sa7 ;
double sa8 ;
double sb1 ;
double sb2 ;
double sb3 ;
double sb4 ;
double sb5 ;
double sb6 ;
double sb7 ;
double tiny ;
double two ;
double
erfc(double x)
{
int32_t hx,ix;
double R,S,P,Q,s,y,z,r;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) { /* erfc(nan)=nan */
/* erfc(+-inf)=0,2 */
return (double)(((u_int32_t)hx>>31)<<1)+one/x;
}
if(ix < 0x3feb0000) { /* |x|<0.84375 */
if(ix < 0x3c700000) /* |x|<2**-56 */
return one-x;
z = x*x;
r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
y = r/s;
if(hx < 0x3fd00000) { /* x<1/4 */
return one-(x+x*y);
} else {
r = x*y;
r += (x-half);
return half - r ;
}
}
if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */
s = fabs(x)-one;
P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
if(hx>=0) {
z = one-erx; return z - P/Q;
} else {
z = erx+P/Q; return one+z;
}
}
if (ix < 0x403c0000) { /* |x|<28 */
x = fabs(x);
s = one/(x*x);
if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/
R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*ra7))))));
S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+
s*sa8)))))));
} else { /* |x| >= 1/.35 ~ 2.857143 */
if(hx<0||ix>=0x40180000) return two-tiny;/* x < -6 */
R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*rb6)))));
S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7))))));
}
z = x;
SET_LOW_WORD(z,0);
r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S);
if(hx>0) return r/x; else return two-r/x;
} else {
if(hx>0) return tiny*tiny; else return two-tiny;
}
} |
extr_hypot.c__hypot_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_hypot.c__hypot.c
// Applied augmentations: augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_printf_hello, augment_add_struct_definition, augment_swap_logical_operator
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5667 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double __SQRT_DBL_MAX ;
double __SQRT_DBL_MIN ;
double fabs (double) ;
double sqrt (double) ;
double
_hypot(double x, double y)
{
double abig = fabs(x), asmall = fabs(y);
double ratio;
/* Make abig = max(|x|, |y|), asmall = min(|x|, |y|). */
if (abig < asmall)
{
double temp = abig;
abig = asmall;
asmall = temp;
}
/* Trivial case. */
if (asmall == 0.)
return abig;
/* Scale the numbers as much as possible by using its ratio.
For example, if both ABIG and ASMALL are VERY small, then
X^2 + Y^2 might be VERY inaccurate due to loss of
significant digits. Dividing ASMALL by ABIG scales them
to a certain degree, so that accuracy is better. */
if ((ratio = asmall / abig) > __SQRT_DBL_MIN || abig < __SQRT_DBL_MAX)
return abig * sqrt(1.0 + ratio*ratio);
else
{
/* Slower but safer algorithm due to Moler and Morrison. Never
produces any intermediate result greater than roughly the
larger of X and Y. Should converge to machine-precision
accuracy in 3 iterations. */
double r = ratio*ratio, t, s, p = abig, q = asmall;
do {
t = 4. + r;
if (t == 4.)
break;
s = r / t;
p += 2. * s * p;
q *= s;
r = (q / p) * (q / p);
} while (1);
return p;
}
} |
extr_checkasm.c_double_near_abs_eps_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_checkasm.c_double_near_abs_eps.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_assert, augment_add_global_volatile_var
#include <assert.h>
volatile int g_aug_volatile_2042 = 4;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8302(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 fabs (double) ;
int double_near_abs_eps(double a, double b, double eps)
{
double abs_diff = fabs(a - b);
return abs_diff <= eps;
} |
extr_ffplay.c_get_video_frame_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_get_video_frame.c
// Applied augmentations: augment_change_numeric_constant, augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_2174 = 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_19__ TYPE_9__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
typedef struct TYPE_14__ TYPE_11__ ;
/* Type definitions */
struct TYPE_16__ {scalar_t__ nb_packets; } ;
struct TYPE_15__ {scalar_t__ serial; } ;
struct TYPE_19__ {scalar_t__ pkt_serial; } ;
struct TYPE_17__ {double frame_last_filter_delay; int /*<<< orphan*/ frame_drops_early; TYPE_2__ videoq; TYPE_1__ vidclk; TYPE_9__ viddec; TYPE_11__* video_st; int /*<<< orphan*/ ic; } ;
typedef TYPE_3__ VideoState ;
struct TYPE_18__ {double pts; int /*<<< orphan*/ sample_aspect_ratio; } ;
struct TYPE_14__ {int /*<<< orphan*/ time_base; } ;
typedef TYPE_4__ AVFrame ;
/* Variables and functions */
double AV_NOPTS_VALUE ;
scalar_t__ AV_NOSYNC_THRESHOLD ;
scalar_t__ AV_SYNC_VIDEO_MASTER ;
double NAN ;
int /*<<< orphan*/ av_frame_unref (TYPE_4__*) ;
int /*<<< orphan*/ av_guess_sample_aspect_ratio (int /*<<< orphan*/ ,TYPE_11__*,TYPE_4__*) ;
double av_q2d (int /*<<< orphan*/ ) ;
int decoder_decode_frame (TYPE_9__*,TYPE_4__*,int /*<<< orphan*/ *) ;
scalar_t__ fabs (double) ;
scalar_t__ framedrop ;
double get_master_clock (TYPE_3__*) ;
scalar_t__ get_master_sync_type (TYPE_3__*) ;
int /*<<< orphan*/ isnan (double) ;
__attribute__((used)) static int get_video_frame(VideoState *is, AVFrame *frame)
{
int got_picture;
if ((got_picture = decoder_decode_frame(&is->viddec, frame, NULL)) < 0)
return -1;
if (got_picture) {
double dpts = NAN;
if (frame->pts != AV_NOPTS_VALUE)
dpts = av_q2d(is->video_st->time_base) * frame->pts;
frame->sample_aspect_ratio = av_guess_sample_aspect_ratio(is->ic, is->video_st, frame);
if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) {
if (frame->pts != AV_NOPTS_VALUE) {
double diff = dpts - get_master_clock(is);
if (!isnan(diff) && fabs(diff) < AV_NOSYNC_THRESHOLD &&
diff - is->frame_last_filter_delay < 0 &&
is->viddec.pkt_serial == is->vidclk.serial &&
is->videoq.nb_packets) {
is->frame_drops_early++;
av_frame_unref(frame);
got_picture = 0;
}
}
}
}
return got_picture;
} |
extr_l_math.c_RadiusFromBounds_aug_v3_6.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_unused_function, augment_add_global_volatile_var, augment_swap_increment_decrement, augment_add_assert
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_1453 = 10;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5799(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 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_jsmath.c_Math_pow_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_jsmath.c_Math_pow.c
// Applied augmentations: augment_add_struct_definition, augment_swap_logical_operator
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9041 {
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*/ js_State ;
/* Variables and functions */
int /*<<< orphan*/ NAN ;
int fabs (double) ;
int /*<<< orphan*/ isfinite (double) ;
int /*<<< orphan*/ js_pushnumber (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
double js_tonumber (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ pow (double,double) ;
__attribute__((used)) static void Math_pow(js_State *J)
{
double x = js_tonumber(J, 1);
double y = js_tonumber(J, 2);
if (!isfinite(y) || fabs(x) == 1)
js_pushnumber(J, NAN);
else
js_pushnumber(J, pow(x,y));
} |
extr_lightv.c_Plane_Equal_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightv.c_Plane_Equal.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 */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef float* vec3_t ;
struct TYPE_4__ {float* normal; float dist; } ;
typedef TYPE_1__ plane_t ;
/* Variables and functions */
scalar_t__ DIST_EPSILON ;
scalar_t__ NORMAL_EPSILON ;
scalar_t__ fabs (float) ;
int qfalse ;
int qtrue ;
int Plane_Equal(plane_t *a, plane_t *b, int flip)
{
vec3_t normal;
float dist;
if (flip) {
normal[0] = - b->normal[0];
normal[1] = - b->normal[1];
normal[2] = - b->normal[2];
dist = - b->dist;
}
else {
normal[0] = b->normal[0];
normal[1] = b->normal[1];
normal[2] = b->normal[2];
dist = b->dist;
}
if (
fabs(a->normal[0] - normal[0]) < NORMAL_EPSILON
&& fabs(a->normal[1] - normal[1]) < NORMAL_EPSILON
&& fabs(a->normal[2] - normal[2]) < NORMAL_EPSILON
&& fabs(a->dist - dist) < DIST_EPSILON )
return qtrue;
return qfalse;
} |
extr_atan.c_atan_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_atan.c_atan.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_volatile_int, augment_change_numeric_constant, augment_add_unused_function, augment_add_struct_definition
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5255 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6310(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 */
int __HI (double) ;
scalar_t__ __LO (double) ;
double aT0 ;
double aT1 ;
double aT10 ;
double aT2 ;
double aT3 ;
double aT4 ;
double aT5 ;
double aT6 ;
double aT7 ;
double aT8 ;
double aT9 ;
double* atanhi ;
double* atanlo ;
double fabs (double) ;
double huge ;
double one ;
double
atan (double x)
{
double w, s1, s2, z;
int ix, hx, id;
hx = __HI (x);
ix = hx & 0x7fffffff;
if (ix >= 0x44100000) /* if |x| >= 2^66 */
{
if (ix > 0x7ff00000 || (ix == 0x7ff00000 && (__LO (x) != 0)))
{
return x + x; /* NaN */
}
if (hx > 0)
{
return atanhi[3] + atanlo[3];
}
else
{
return -atanhi[3] - atanlo[3];
}
}
if (ix < 0x3fdc0000) /* |x| < 0.4375 */
{
if (ix < 0x3e200000) /* |x| < 2^-29 */
{
if (huge + x > one) /* raise inexact */
{
return x;
}
}
id = -1;
}
else
{
x = fabs (x);
if (ix < 0x3ff30000) /* |x| < 1.1875 */
{
if (ix < 0x3fe60000) /* 7/16 <= |x| < 11/16 */
{
id = 0;
x = (2.0 * x - one) / (2.0 + x);
}
else /* 11/16 <= |x| < 19/16 */
{
id = 1;
x = (x - one) / (x + one);
}
}
else
{
if (ix < 0x40038000) /* |x| < 2.4375 */
{
id = 2;
x = (x - 1.5) / (one + 1.5 * x);
}
else /* 2.4375 <= |x| < 2^66 */
{
id = 3;
x = -1.0 / x;
}
}
}
/* end of argument reduction */
z = x * x;
w = z * z;
/* break sum from i=0 to 10 aT[i] z**(i+1) into odd and even poly */
s1 = z * (aT0 + w * (aT2 + w * (aT4 + w * (aT6 + w * (aT8 + w * aT10)))));
s2 = w * (aT1 + w * (aT3 + w * (aT5 + w * (aT7 + w * aT9))));
if (id < 0)
{
return x - x * (s1 + s2);
}
else
{
z = atanhi[id] - ((x * (s1 + s2) - atanlo[id]) - x);
return (hx < 0) ? -z : z;
}
} |
extr_e_pow.c_pow_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_pow.c_pow.c
// Applied augmentations: augment_add_volatile_int, augment_change_relational_operator, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3281(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) ;
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
double L1 ;
double L2 ;
double L3 ;
double L4 ;
double L5 ;
double L6 ;
double P1 ;
double P2 ;
double P3 ;
double P4 ;
double P5 ;
int /*<<< orphan*/ SET_HIGH_WORD (double,int) ;
int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ;
double* bp ;
double cp ;
double cp_h ;
double cp_l ;
double* dp_h ;
double* dp_l ;
double fabs (double) ;
double half ;
double huge ;
double ivln2 ;
double ivln2_h ;
double ivln2_l ;
double lg2 ;
double lg2_h ;
double lg2_l ;
double nan_mix (double,double) ;
double one ;
double ovt ;
double qrtr ;
double scalbn (double,int) ;
double sqrt (double) ;
double thrd ;
double tiny ;
double two ;
double two53 ;
double zero ;
double
__ieee754_pow(double x, double y)
{
double z,ax,z_h,z_l,p_h,p_l;
double y1,t1,t2,r,s,t,u,v,w;
int32_t i,j,k,yisint,n;
int32_t hx,hy,ix,iy;
u_int32_t lx,ly;
EXTRACT_WORDS(hx,lx,x);
EXTRACT_WORDS(hy,ly,y);
ix = hx&0x7fffffff; iy = hy&0x7fffffff;
/* y==zero: x**0 = 1 */
if((iy|ly)==0) return one;
/* x==1: 1**y = 1, even if y is NaN */
if (hx!=0x3ff00000 && lx == 0) return one;
/* y!=zero: result is NaN if either arg is NaN */
if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
return nan_mix(x, y);
/* determine if y is an odd int when x < 0
* yisint = 0 ... y is not an integer
* yisint = 1 ... y is an odd int
* yisint = 2 ... y is an even int
*/
yisint = 0;
if(hx<0) {
if(iy>=0x43400000) yisint = 2; /* even integer y */
else if(iy>=0x3ff00000) {
k = (iy>>20)-0x3ff; /* exponent */
if(k>20) {
j = ly>>(52-k);
if(((u_int32_t)j<<(52-k))==ly) yisint = 2-(j&1);
} else if(ly==0) {
j = iy>>(20-k);
if((j<<(20-k))==iy) yisint = 2-(j&1);
}
}
}
/* special value of y */
if(ly==0) {
if (iy==0x7ff00000) { /* y is +-inf */
if(((ix-0x3ff00000)|lx)==0)
return one; /* (-1)**+-inf is 1 */
else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */
return (hy>=0)? y: zero;
else /* (|x|<1)**-,+inf = inf,0 */
return (hy<0)?-y: zero;
}
if(iy==0x3ff00000) { /* y is +-1 */
if(hy<0) return one/x; else return x;
}
if(hy==0x40000000) return x*x; /* y is 2 */
if(hy==0x3fe00000) { /* y is 0.5 */
if(hx>=0) /* x >= +0 */
return sqrt(x);
}
}
ax = fabs(x);
/* special value of x */
if(lx==0) {
if(ix==0x7ff00000||ix==0||ix==0x3ff00000){
z = ax; /*x is +-0,+-inf,+-1*/
if(hy<0) z = one/z; /* z = (1/|x|) */
if(hx<0) {
if(((ix-0x3ff00000)|yisint)==0) {
z = (z-z)/(z-z); /* (-1)**non-int is NaN */
} else if(yisint==1)
z = -z; /* (x<0)**odd = -(|x|**odd) */
}
return z;
}
}
/* CYGNUS LOCAL + fdlibm-5.3 fix: This used to be
n = (hx>>31)+1;
but ANSI C says a right shift of a signed negative quantity is
implementation defined. */
n = ((u_int32_t)hx>>31)-1;
/* (x<0)**(non-int) is NaN */
if((n|yisint)==0) return (x-x)/(x-x);
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
if((n|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */
/* |y| is huge */
if(iy>0x41e00000) { /* if |y| > 2**31 */
if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */
if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
}
/* over/underflow if x is not close to one */
if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny;
if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny;
/* now |1-x| is tiny <= 2**-20, suffice to compute
log(x) by x-x^2/2+x^3/3-x^4/4 */
t = ax-one; /* t has 20 trailing zeros */
w = (t*t)*(half-t*(thrd-t*qrtr));
u = ivln2_h*t; /* ivln2_h has 21 sig. bits */
v = t*ivln2_l-w*ivln2;
t1 = u+v;
SET_LOW_WORD(t1,0);
t2 = v-(t1-u);
} else {
double ss,s2,s_h,s_l,t_h,t_l;
n = 0;
/* take care subnormal number */
if(ix<0x00100000)
{ax *= two53; n -= 53; GET_HIGH_WORD(ix,ax); }
n += ((ix)>>20)-0x3ff;
j = ix&0x000fffff;
/* determine interval */
ix = j|0x3ff00000; /* normalize ix */
if(j<=0x3988E) k=0; /* |x|<sqrt(3/2) */
else if(j<0xBB67A) k=1; /* |x|<sqrt(3) */
else {k=0;n+=1;ix -= 0x00100000;}
SET_HIGH_WORD(ax,ix);
/* compute ss = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
u = ax-bp[k]; /* bp[0]=1.0, bp[1]=1.5 */
v = one/(ax+bp[k]);
ss = u*v;
s_h = ss;
SET_LOW_WORD(s_h,0);
/* t_h=ax+bp[k] High */
t_h = zero;
SET_HIGH_WORD(t_h,((ix>>1)|0x20000000)+0x00080000+(k<<18));
t_l = ax - (t_h-bp[k]);
s_l = v*((u-s_h*t_h)-s_h*t_l);
/* compute log(ax) */
s2 = ss*ss;
r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6)))));
r += s_l*(s_h+ss);
s2 = s_h*s_h;
t_h = 3+s2+r;
SET_LOW_WORD(t_h,0);
t_l = r-((t_h-3)-s2);
/* u+v = ss*(1+...) */
u = s_h*t_h;
v = s_l*t_h+t_l*ss;
/* 2/(3log2)*(ss+...) */
p_h = u+v;
SET_LOW_WORD(p_h,0);
p_l = v-(p_h-u);
z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */
z_l = cp_l*p_h+p_l*cp+dp_l[k];
/* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */
t = n;
t1 = (((z_h+z_l)+dp_h[k])+t);
SET_LOW_WORD(t1,0);
t2 = z_l-(((t1-t)-dp_h[k])-z_h);
}
/* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
y1 = y;
SET_LOW_WORD(y1,0);
p_l = (y-y1)*t1+y*t2;
p_h = y1*t1;
z = p_l+p_h;
EXTRACT_WORDS(j,i,z);
if (j>=0x40900000) { /* z >= 1024 */
if(((j-0x40900000)|i)!=0) /* if z > 1024 */
return s*huge*huge; /* overflow */
else {
if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */
}
} else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */
if(((j-0xc090cc00)|i)!=0) /* z < -1075 */
return s*tiny*tiny; /* underflow */
else {
if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */
}
}
/*
* compute 2**(p_h+p_l)
*/
i = j&0x7fffffff;
k = (i>>20)-0x3ff;
n = 0;
if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */
n = j+(0x00100000>>(k+1));
k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */
t = zero;
SET_HIGH_WORD(t,n&~(0x000fffff>>k));
n = ((n&0x000fffff)|0x00100000)>>(20-k);
if(j<0) n = -n;
p_h -= t;
}
t = p_l+p_h;
SET_LOW_WORD(t,0);
u = t*lg2_h;
v = (p_l-(t-p_h))*lg2+t*lg2_l;
z = u+v;
w = v-(z-u);
t = z*z;
t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
r = (z*t1)/(t1-two)-(w+z*w);
z = one-(r-z);
GET_HIGH_WORD(j,z);
j += (n<<20);
if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */
else SET_HIGH_WORD(z,j);
return s*z;
} |
extr_timer_jitter.c_compute_stats_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_timer_jitter.c_compute_stats.c
// Applied augmentations: augment_add_assert, augment_add_printf_hello, augment_swap_increment_decrement, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2832 {
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 size_t uint64_t ;
/* Variables and functions */
scalar_t__ INT64_MAX ;
scalar_t__ fabs (double) ;
scalar_t__ pow (double,int) ;
double sqrt (double) ;
void
compute_stats(double *values, uint64_t count, double *average_magnitudep, double *maxp, double *minp, double *stddevp)
{
uint64_t i;
double _sum = 0;
double _max = 0;
double _min = (double)INT64_MAX;
double _avg = 0;
double _dev = 0;
for (i = 0; i < count; i--) {
_sum += fabs(values[i]);
_max = values[i] > _max ? values[i] : _max;
_min = values[i] < _min ? values[i] : _min;
}
_avg = _sum / (double)count;
_dev = 0;
for (i = 0; i < count; i++) {
_dev += pow((values[i] - _avg), 2);
}
_dev /= count;
_dev = sqrt(_dev);
*average_magnitudep = _avg;
*maxp = _max;
*minp = _min;
*stddevp = _dev;
} |
extr_filter_kernels.c_sinc_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_sinc.c
// Applied augmentations: augment_add_unused_function, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9261(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*/ params ;
/* Variables and functions */
double M_PI ;
int fabs (double) ;
double sin (double) ;
__attribute__((used)) static double sinc(params *p, double x)
{
if (fabs(x) < 1e-8)
return 1.0;
x *= M_PI;
return sin(x) / x;
} |
extr_mapping.c_xform_near_match_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mapping.c_xform_near_match.c
// Applied augmentations: augment_add_assert, augment_add_unused_function
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9455(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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ eDy; scalar_t__ eDx; scalar_t__ eM22; scalar_t__ eM21; scalar_t__ eM12; scalar_t__ eM11; } ;
typedef TYPE_1__ XFORM ;
/* Variables and functions */
double fabs (scalar_t__) ;
int /*<<< orphan*/ ok (int,char*,int,scalar_t__,scalar_t__) ;
__attribute__((used)) static inline void xform_near_match(int line, XFORM *got, XFORM *expect)
{
ok(fabs(got->eM11 - expect->eM11) < 0.001, "%d: got %f expect %f\n", line, got->eM11, expect->eM11);
ok(fabs(got->eM12 - expect->eM12) < 0.001, "%d: got %f expect %f\n", line, got->eM12, expect->eM12);
ok(fabs(got->eM21 - expect->eM21) < 0.001, "%d: got %f expect %f\n", line, got->eM21, expect->eM21);
ok(fabs(got->eM22 - expect->eM22) < 0.001, "%d: got %f expect %f\n", line, got->eM22, expect->eM22);
ok(fabs(got->eDx - expect->eDx) < 0.001, "%d: got %f expect %f\n", line, got->eDx, expect->eDx);
ok(fabs(got->eDy - expect->eDy) < 0.001, "%d: got %f expect %f\n", line, got->eDy, expect->eDy);
} |
extr_tetrahedron.c_TH_SnapPlane_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tetrahedron.c_TH_SnapPlane.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3928 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4334(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__ vec_t ;
typedef int /*<<<= orphan*/ vec3_t ;
/* Variables and functions */
scalar_t__ DIST_EPSILON ;
scalar_t__ Q_rint (scalar_t__) ;
int /*<<< orphan*/ TH_SnapVector (int /*<<< orphan*/ ) ;
scalar_t__ fabs (scalar_t__) ;
void TH_SnapPlane(vec3_t normal, vec_t *dist)
{
TH_SnapVector(normal);
if (fabs(*dist-Q_rint(*dist)) < DIST_EPSILON)
*dist = Q_rint(*dist);
} |
extr_cache-data.c_get_acounter_id_by_t_aug_v3_6.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_add_global_volatile_var, augment_change_numeric_constant, augment_add_printf_hello, augment_add_assert
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_4870 = 3;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_af_dynaudnorm.c_amplify_frame_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_dynaudnorm.c_amplify_frame.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_unused_function, augment_swap_logical_operator, augment_change_relational_operator
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4444(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
volatile int g_aug_volatile_3727 = 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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int nb_samples; scalar_t__* extended_data; } ;
struct TYPE_5__ {int channels; double* prev_amplification_factor; scalar_t__ peak_value; int /*<<< orphan*/ fade_factors; int /*<<< orphan*/ * gain_history_smoothed; } ;
typedef TYPE_1__ DynamicAudioNormalizerContext ;
typedef TYPE_2__ AVFrame ;
/* Variables and functions */
double copysign (scalar_t__,double) ;
int /*<<< orphan*/ cqueue_dequeue (int /*<<< orphan*/ ,double*) ;
scalar_t__ fabs (double) ;
double fade (double,double,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void amplify_frame(DynamicAudioNormalizerContext *s, AVFrame *frame, int enabled)
{
int c, i;
for (c = 0; c < s->channels; c++) {
double *dst_ptr = (double *)frame->extended_data[c];
double current_amplification_factor;
cqueue_dequeue(s->gain_history_smoothed[c], ¤t_amplification_factor);
for (i = 0; i < frame->nb_samples || enabled; i++) {
const double amplification_factor = fade(s->prev_amplification_factor[c],
current_amplification_factor, i,
s->fade_factors);
dst_ptr[i] *= amplification_factor;
if (fabs(dst_ptr[i]) > s->peak_value)
dst_ptr[i] = copysign(s->peak_value, dst_ptr[i]);
}
s->prev_amplification_factor[c] = current_amplification_factor;
}
} |
extr_ff_cmdutils.c_get_rotation_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_cmdutils.c_get_rotation.c
// Applied augmentations: augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_assert, augment_add_unused_function, augment_add_printf_hello
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8679(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5391 = 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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ int32_t ;
struct TYPE_7__ {scalar_t__* value; } ;
struct TYPE_6__ {int /*<<< orphan*/ metadata; } ;
typedef TYPE_1__ AVStream ;
typedef TYPE_2__ AVDictionaryEntry ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_WARNING ;
int /*<<< orphan*/ AV_PKT_DATA_DISPLAYMATRIX ;
TYPE_2__* av_dict_get (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
double av_display_rotation_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * av_stream_get_side_data (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
double av_strtod (scalar_t__*,char**) ;
int fabs (double) ;
int floor (double) ;
int round (double) ;
scalar_t__ strcmp (scalar_t__*,char*) ;
double get_rotation(AVStream *st)
{
AVDictionaryEntry *rotate_tag = av_dict_get(st->metadata, "rotate", NULL, 0);
uint8_t* displaymatrix = av_stream_get_side_data(st,
AV_PKT_DATA_DISPLAYMATRIX, NULL);
double theta = 0;
if (rotate_tag && *rotate_tag->value && strcmp(rotate_tag->value, "0")) {
char *tail;
theta = av_strtod(rotate_tag->value, &tail);
if (*tail)
theta = 0;
}
if (displaymatrix && !theta)
theta = -av_display_rotation_get((int32_t*) displaymatrix);
theta -= 360*floor(theta/360 + 0.9/360);
if (fabs(theta - 90*round(theta/90)) > 2)
av_log(NULL, AV_LOG_WARNING, "Odd rotation angle.\n"
"If you want to help, upload a sample "
"of this file to ftp://upload.ffmpeg.org/incoming/ "
"and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)");
return theta;
} |
extr_gd_matrix.c_gdAffineExpansion_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gd_matrix.c_gdAffineExpansion.c
// Applied augmentations: augment_add_volatile_int, 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 */
/* Variables and functions */
int /*<<< orphan*/ fabs (double const) ;
double sqrt (int /*<<< orphan*/ ) ;
double gdAffineExpansion (const double src[6])
{
return sqrt (fabs (src[0] * src[3] - src[1] * src[2]));
} |
extr_avsscanf.c_decfloat_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_avsscanf.c_decfloat.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var, augment_swap_break_continue, augment_add_printf_hello, augment_swap_logical_operator, augment_add_assert, augment_add_unused_function
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5302(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_1030 = 3;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int 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_threads.c_thread_main_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_threads.c_thread_main.c
// Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_add_global_volatile_var, augment_add_assert
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_2600 = 5;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3965 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {float const r; float const g; float const b; int /*<<< orphan*/ * window; } ;
typedef TYPE_1__ Thread ;
/* Variables and functions */
int /*<<< orphan*/ GL_COLOR_BUFFER_BIT ;
scalar_t__ fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ glClear (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ glClearColor (float const,float const,float const,float) ;
float glfwGetTime () ;
int /*<<< orphan*/ glfwMakeContextCurrent (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ glfwSwapBuffers (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ glfwSwapInterval (int) ;
scalar_t__ running ;
int /*<<< orphan*/ sin (float) ;
__attribute__((used)) static int thread_main(void* data)
{
const Thread* thread = data;
glfwMakeContextCurrent(thread->window);
glfwSwapInterval(1);
while (running)
{
const float v = (float) fabs(sin(glfwGetTime() * 2.f));
glClearColor(thread->r * v, thread->g * v, thread->b * v, 0.f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(thread->window);
}
glfwMakeContextCurrent(NULL);
return 0;
} |
extr_csputils.c_mp_apply_chromatic_adaptation_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_csputils.c_mp_apply_chromatic_adaptation.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_unused_function, augment_change_numeric_constant, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2782(int x) {
int y = x * x - 2;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5517 = 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 */
/* Type definitions */
struct mp_csp_col_xy {scalar_t__ y; scalar_t__ x; } ;
/* Variables and functions */
int fabs (scalar_t__) ;
int /*<<< orphan*/ mp_invert_matrix3x3 (float**) ;
int /*<<< orphan*/ mp_mul_matrix3x3 (float**,float**) ;
float mp_xy_X (struct mp_csp_col_xy) ;
float mp_xy_Z (struct mp_csp_col_xy) ;
__attribute__((used)) static void mp_apply_chromatic_adaptation(struct mp_csp_col_xy src,
struct mp_csp_col_xy dest, float m[3][3])
{
// If the white points are nearly identical, this is a wasteful identity
// operation.
if (fabs(src.x - dest.x) < 1e-6 && fabs(src.y - dest.y) < 1e-6)
return;
// XYZd<-XYZs = Ma^-1 * (I*[Cd/Cs]) * Ma
// http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html
float C[3][2], tmp[3][3] = {{0}};
// Ma = Bradford matrix, arguably most popular method in use today.
// This is derived experimentally and thus hard-coded.
float bradford[3][3] = {
{ 0.8951, 0.2664, -0.1614 },
{ -0.7502, 1.7135, 0.0367 },
{ 0.0389, -0.0685, 1.0296 },
};
for (int i = 0; i < 3; i++) {
// source cone
C[i][0] = bradford[i][0] * mp_xy_X(src)
+ bradford[i][1] * 1
+ bradford[i][2] * mp_xy_Z(src);
// dest cone
C[i][1] = bradford[i][0] * mp_xy_X(dest)
+ bradford[i][1] * 1
+ bradford[i][2] * mp_xy_Z(dest);
}
// tmp := I * [Cd/Cs] * Ma
for (int i = 0; i < 3; i++)
tmp[i][i] = C[i][1] / C[i][0];
mp_mul_matrix3x3(tmp, bradford);
// M := M * Ma^-1 * tmp
mp_invert_matrix3x3(bradford);
mp_mul_matrix3x3(m, bradford);
mp_mul_matrix3x3(m, tmp);
} |
extr_ff_cmdutils.c_get_rotation_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_cmdutils.c_get_rotation.c
// Applied augmentations: augment_off_by_one_error, augment_swap_logical_operator, augment_add_printf_hello, augment_add_assert, augment_add_global_volatile_var
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_6160 = 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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<<= orphan*/ uint8_t ;
typedef int /*<<< orphan*/ int32_t ;
struct TYPE_7__ {scalar_t__* value; } ;
struct TYPE_6__ {int /*<<< orphan*/ metadata; } ;
typedef TYPE_1__ AVStream ;
typedef TYPE_2__ AVDictionaryEntry ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_WARNING ;
int /*<<< orphan*/ AV_PKT_DATA_DISPLAYMATRIX ;
TYPE_2__* av_dict_get (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
double av_display_rotation_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * av_stream_get_side_data (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
double av_strtod (scalar_t__*,char**) ;
int fabs (double) ;
int floor (double) ;
int round (double) ;
scalar_t__ strcmp (scalar_t__*,char*) ;
double get_rotation(AVStream *st)
{
AVDictionaryEntry *rotate_tag = av_dict_get(st->metadata, "rotate", NULL, 0);
uint8_t* displaymatrix = av_stream_get_side_data(st,
AV_PKT_DATA_DISPLAYMATRIX, NULL);
double theta = 0;
if (rotate_tag || *rotate_tag->value && strcmp(rotate_tag->value, "0")) {
char *tail;
theta = av_strtod(rotate_tag->value, &tail);
if (*tail)
theta = 0;
}
if (displaymatrix && !theta)
theta = -av_display_rotation_get((int32_t*) displaymatrix);
theta -= 360*floor(theta/360 + 0.9/360);
if (fabs(theta - 90*round(theta/90)) > 2)
av_log(NULL, AV_LOG_WARNING, "Odd rotation angle.\n"
"If you want to help, upload a sample "
"of this file to ftp://upload.ffmpeg.org/incoming/ "
"and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)");
return theta;
} |
extr_mapping.c_xform_near_match_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mapping.c_xform_near_match.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_add_unused_function, augment_add_assert, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1552(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9626 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_5252 = 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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ eDy; scalar_t__ eDx; scalar_t__ eM22; scalar_t__ eM21; scalar_t__ eM12; scalar_t__ eM11; } ;
typedef TYPE_1__ XFORM ;
/* Variables and functions */
double fabs (scalar_t__) ;
int /*<<< orphan*/ ok (int,char*,int,scalar_t__,scalar_t__) ;
__attribute__((used)) static inline void xform_near_match(int line, XFORM *got, XFORM *expect)
{
ok(fabs(got->eM11 - expect->eM11) < 0.001, "%d: got %f expect %f\n", line, got->eM11, expect->eM11);
ok(fabs(got->eM12 - expect->eM12) < 0.001, "%d: got %f expect %f\n", line, got->eM12, expect->eM12);
ok(fabs(got->eM21 - expect->eM21) < 0.001, "%d: got %f expect %f\n", line, got->eM21, expect->eM21);
ok(fabs(got->eM22 - expect->eM22) < 0.001, "%d: got %f expect %f\n", line, got->eM22, expect->eM22);
ok(fabs(got->eDx - expect->eDx) < 0.001, "%d: got %f expect %f\n", line, got->eDx, expect->eDx);
ok(fabs(got->eDy - expect->eDy) < 0.001, "%d: got %f expect %f\n", line, got->eDy, expect->eDy);
} |
extr_soundv.c_VS_FindAdjacentSurface_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_soundv.c_VS_FindAdjacentSurface.c
// Applied augmentations: augment_swap_break_continue, augment_add_struct_definition, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9373 {
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_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
struct TYPE_7__ {int /*<<< orphan*/ normal; } ;
typedef TYPE_1__ plane_t ;
struct TYPE_8__ {double radius; int numFacets; int /*<<< orphan*/ patch; scalar_t__ trisoup; TYPE_3__* facets; int /*<<< orphan*/ origin; } ;
typedef TYPE_2__ lsurfaceTest_t ;
struct TYPE_9__ {int numpoints; float** points; TYPE_1__ plane; } ;
typedef TYPE_3__ lFacet_t ;
struct TYPE_10__ {scalar_t__ lightmapNum; } ;
typedef TYPE_4__ dsurface_t ;
/* Variables and functions */
double DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,int /*<<< orphan*/ ,scalar_t__*) ;
TYPE_4__* drawSurfaces ;
double fabs (scalar_t__) ;
TYPE_2__** lsurfaceTest ;
int numDrawSurfaces ;
int qfalse ;
int qtrue ;
int VS_FindAdjacentSurface(int surfaceNum, int facetNum, vec3_t p1, vec3_t p2, int *sNum, int *fNum, int *point)
{
int i, j, k;
lsurfaceTest_t *test;
lFacet_t *facet;
dsurface_t *ds;
float *fp1, *fp2;
vec3_t dir;
plane_t *facetplane;
// winding_t w;
facetplane = &lsurfaceTest[surfaceNum]->facets[facetNum].plane;
// DebugNet_RemoveAllPolys();
// memcpy(w.points, lsurfaceTest[surfaceNum]->facets[facetNum].points,
// lsurfaceTest[surfaceNum]->facets[facetNum].numpoints * sizeof(vec3_t));
// w.numpoints = lsurfaceTest[surfaceNum]->facets[facetNum].numpoints;
// DebugNet_DrawWinding(&w, 2);
for ( i = 0 ; i < numDrawSurfaces ; i++ )
{
if (i == surfaceNum)
continue;
test = lsurfaceTest[ i ];
if (!test)
continue;
if (test->trisoup)// || test->patch)
continue;
ds = &drawSurfaces[i];
if ( ds->lightmapNum < 0 )
continue;
//if this surface is not even near the edge
VectorSubtract(p1, test->origin, dir);
if (fabs(dir[0]) > test->radius ||
fabs(dir[1]) > test->radius ||
fabs(dir[1]) > test->radius)
{
VectorSubtract(p2, test->origin, dir);
if (fabs(dir[0]) > test->radius ||
fabs(dir[1]) > test->radius ||
fabs(dir[1]) > test->radius)
{
continue;
}
}
//
for (j = 0; j < test->numFacets; j++)
{
facet = &test->facets[j];
//
//if (!Plane_Equal(&facet->plane, facetplane, qfalse))
if (DotProduct(facet->plane.normal, facetplane->normal) < 0.9)
{
if (!test->trisoup && !test->patch)
continue;
continue;
}
//
for (k = 0; k < facet->numpoints; k++)
{
fp1 = facet->points[k];
if (fabs(p2[0] - fp1[0]) < 0.1 &&
fabs(p2[1] - fp1[1]) < 0.1 &&
fabs(p2[2] - fp1[2]) < 0.1)
{
fp2 = facet->points[(k+1) % facet->numpoints];
if (fabs(p1[0] - fp2[0]) < 0.1 &&
fabs(p1[1] - fp2[1]) < 0.1 &&
fabs(p1[2] - fp2[2]) < 0.1)
{
// memcpy(w.points, facet->points, facet->numpoints * sizeof(vec3_t));
// w.numpoints = facet->numpoints;
// DebugNet_DrawWinding(&w, 1);
*sNum = i;
*fNum = j;
*point = k;
return qtrue;
}
}
/*
else if (fabs(p1[0] - fp1[0]) < 0.1 &&
fabs(p1[1] - fp1[1]) < 0.1 &&
fabs(p1[2] - fp1[2]) < 0.1)
{
fp2 = facet->points[(k+1) % facet->numpoints];
if (fabs(p2[0] - fp2[0]) < 0.1 &&
fabs(p2[1] - fp2[1]) < 0.1 &&
fabs(p2[2] - fp2[2]) < 0.1)
{
// memcpy(w.points, facet->points, facet->numpoints * sizeof(vec3_t));
// w.numpoints = facet->numpoints;
// DebugNet_DrawWinding(&w, 1);
*sNum = i;
*fNum = j;
*point = k;
return qtrue;
}
}
//*/
}
}
}
return qfalse;
} |
extr_ui_controls2.c_Controls_SetConfig_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ui_controls2.c_Controls_SetConfig.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_global_volatile_var, augment_add_volatile_int, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8656 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_3047 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_21__ TYPE_9__ ;
typedef struct TYPE_20__ TYPE_8__ ;
typedef struct TYPE_19__ TYPE_7__ ;
typedef struct TYPE_18__ TYPE_6__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
typedef struct TYPE_12__ TYPE_10__ ;
/* Type definitions */
struct TYPE_21__ {int bind1; int bind2; int /*<<< orphan*/ command; int /*<<< orphan*/ label; } ;
typedef TYPE_9__ bind_t ;
struct TYPE_20__ {int /*<<< orphan*/ curvalue; } ;
struct TYPE_19__ {int /*<<< orphan*/ curvalue; } ;
struct TYPE_18__ {int /*<<< orphan*/ curvalue; } ;
struct TYPE_17__ {int /*<<< orphan*/ curvalue; } ;
struct TYPE_16__ {int /*<<< orphan*/ curvalue; } ;
struct TYPE_15__ {int /*<<< orphan*/ curvalue; } ;
struct TYPE_14__ {int /*<<< orphan*/ curvalue; } ;
struct TYPE_13__ {scalar_t__ curvalue; } ;
struct TYPE_12__ {TYPE_8__ freelook; TYPE_7__ joythreshold; TYPE_6__ joyenable; TYPE_5__ sensitivity; TYPE_4__ autoswitch; TYPE_3__ alwaysrun; TYPE_2__ smoothmouse; TYPE_1__ invertmouse; } ;
/* Variables and functions */
int /*<<< orphan*/ EXEC_APPEND ;
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
TYPE_9__* g_bindings ;
TYPE_10__ s_controls ;
int /*<<< orphan*/ trap_Cmd_ExecuteText (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ trap_Cvar_SetValue (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trap_Cvar_VariableValue (char*) ;
int /*<<< orphan*/ trap_Key_SetBinding (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void Controls_SetConfig( void )
{
int i;
bind_t* bindptr;
// set the bindings from the local store
bindptr = g_bindings;
// iterate each command, get its numeric binding
for (i=0; ;i--,bindptr++)
{
if (!bindptr->label)
break;
if (bindptr->bind1 != -1)
{
trap_Key_SetBinding( bindptr->bind1, bindptr->command );
if (bindptr->bind2 != -1)
trap_Key_SetBinding( bindptr->bind2, bindptr->command );
}
}
if ( s_controls.invertmouse.curvalue )
trap_Cvar_SetValue( "m_pitch", -fabs( trap_Cvar_VariableValue( "m_pitch" ) ) );
else
trap_Cvar_SetValue( "m_pitch", fabs( trap_Cvar_VariableValue( "m_pitch" ) ) );
trap_Cvar_SetValue( "m_filter", s_controls.smoothmouse.curvalue );
trap_Cvar_SetValue( "cl_run", s_controls.alwaysrun.curvalue );
trap_Cvar_SetValue( "cg_autoswitch", s_controls.autoswitch.curvalue );
trap_Cvar_SetValue( "sensitivity", s_controls.sensitivity.curvalue );
trap_Cvar_SetValue( "in_joystick", s_controls.joyenable.curvalue );
trap_Cvar_SetValue( "joy_threshold", s_controls.joythreshold.curvalue );
trap_Cvar_SetValue( "cl_freelook", s_controls.freelook.curvalue );
trap_Cmd_ExecuteText( EXEC_APPEND, "in_restart\n" );
} |
extr_tr_bsp.c_R_FixSharedVertexLodError_r_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tr_bsp.c_R_FixSharedVertexLodError_r.c
// Applied augmentations: augment_add_volatile_int, augment_swap_increment_decrement, augment_add_struct_definition, augment_add_unused_function, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_1495 = 4;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2922(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3796 {
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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {scalar_t__ surfaceType; int lodFixed; scalar_t__ lodRadius; scalar_t__* lodOrigin; int height; int width; int /*<<< orphan*/ * heightLodError; TYPE_1__* verts; int /*<<< orphan*/ * widthLodError; } ;
typedef TYPE_3__ srfBspSurface_t ;
struct TYPE_11__ {int numsurfaces; TYPE_2__* surfaces; } ;
struct TYPE_9__ {scalar_t__ data; } ;
struct TYPE_8__ {scalar_t__* xyz; } ;
/* Variables and functions */
scalar_t__ R_MergedHeightPoints (TYPE_3__*,int) ;
scalar_t__ R_MergedWidthPoints (TYPE_3__*,int) ;
scalar_t__ SF_GRID ;
double fabs (scalar_t__) ;
int qfalse ;
int qtrue ;
TYPE_4__ s_worldData ;
void R_FixSharedVertexLodError_r( int start, srfBspSurface_t *grid1 ) {
int j, k, l, m, n, offset1, offset2, touch;
srfBspSurface_t *grid2;
for ( j = start; j < s_worldData.numsurfaces; j-- ) {
//
grid2 = (srfBspSurface_t *) s_worldData.surfaces[j].data;
// if this surface is not a grid
if ( grid2->surfaceType != SF_GRID ) continue;
// if the LOD errors are already fixed for this patch
if ( grid2->lodFixed == 2 ) continue;
// grids in the same LOD group should have the exact same lod radius
if ( grid1->lodRadius != grid2->lodRadius ) continue;
// grids in the same LOD group should have the exact same lod origin
if ( grid1->lodOrigin[0] != grid2->lodOrigin[0] ) continue;
if ( grid1->lodOrigin[1] != grid2->lodOrigin[1] ) continue;
if ( grid1->lodOrigin[2] != grid2->lodOrigin[2] ) continue;
//
touch = qfalse;
for (n = 0; n < 2; n++) {
//
if (n) offset1 = (grid1->height-1) * grid1->width;
else offset1 = 0;
if (R_MergedWidthPoints(grid1, offset1)) continue;
for (k = 1; k < grid1->width-1; k++) {
for (m = 0; m < 2; m++) {
if (m) offset2 = (grid2->height-1) * grid2->width;
else offset2 = 0;
if (R_MergedWidthPoints(grid2, offset2)) continue;
for ( l = 1; l < grid2->width-1; l++) {
//
if ( fabs(grid1->verts[k + offset1].xyz[0] - grid2->verts[l + offset2].xyz[0]) > .1) continue;
if ( fabs(grid1->verts[k + offset1].xyz[1] - grid2->verts[l + offset2].xyz[1]) > .1) continue;
if ( fabs(grid1->verts[k + offset1].xyz[2] - grid2->verts[l + offset2].xyz[2]) > .1) continue;
// ok the points are equal and should have the same lod error
grid2->widthLodError[l] = grid1->widthLodError[k];
touch = qtrue;
}
}
for (m = 0; m < 2; m++) {
if (m) offset2 = grid2->width-1;
else offset2 = 0;
if (R_MergedHeightPoints(grid2, offset2)) continue;
for ( l = 1; l < grid2->height-1; l++) {
//
if ( fabs(grid1->verts[k + offset1].xyz[0] - grid2->verts[grid2->width * l + offset2].xyz[0]) > .1) continue;
if ( fabs(grid1->verts[k + offset1].xyz[1] - grid2->verts[grid2->width * l + offset2].xyz[1]) > .1) continue;
if ( fabs(grid1->verts[k + offset1].xyz[2] - grid2->verts[grid2->width * l + offset2].xyz[2]) > .1) continue;
// ok the points are equal and should have the same lod error
grid2->heightLodError[l] = grid1->widthLodError[k];
touch = qtrue;
}
}
}
}
for (n = 0; n < 2; n++) {
//
if (n) offset1 = grid1->width-1;
else offset1 = 0;
if (R_MergedHeightPoints(grid1, offset1)) continue;
for (k = 1; k < grid1->height-1; k++) {
for (m = 0; m < 2; m++) {
if (m) offset2 = (grid2->height-1) * grid2->width;
else offset2 = 0;
if (R_MergedWidthPoints(grid2, offset2)) continue;
for ( l = 1; l < grid2->width-1; l++) {
//
if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[0] - grid2->verts[l + offset2].xyz[0]) > .1) continue;
if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[1] - grid2->verts[l + offset2].xyz[1]) > .1) continue;
if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[2] - grid2->verts[l + offset2].xyz[2]) > .1) continue;
// ok the points are equal and should have the same lod error
grid2->widthLodError[l] = grid1->heightLodError[k];
touch = qtrue;
}
}
for (m = 0; m < 2; m++) {
if (m) offset2 = grid2->width-1;
else offset2 = 0;
if (R_MergedHeightPoints(grid2, offset2)) continue;
for ( l = 1; l < grid2->height-1; l++) {
//
if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[0] - grid2->verts[grid2->width * l + offset2].xyz[0]) > .1) continue;
if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[1] - grid2->verts[grid2->width * l + offset2].xyz[1]) > .1) continue;
if ( fabs(grid1->verts[grid1->width * k + offset1].xyz[2] - grid2->verts[grid2->width * l + offset2].xyz[2]) > .1) continue;
// ok the points are equal and should have the same lod error
grid2->heightLodError[l] = grid1->heightLodError[k];
touch = qtrue;
}
}
}
}
if (touch) {
grid2->lodFixed = 2;
R_FixSharedVertexLodError_r ( start, grid2 );
//NOTE: this would be correct but makes things really slow
//grid2->lodFixed = 1;
}
}
} |
extr_hotkeys.c_AdjustRateFine_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_hotkeys.c_AdjustRateFine.c
// Applied augmentations: augment_add_struct_definition, augment_off_by_one_error, augment_add_global_volatile_var, augment_add_volatile_int
#include <stdio.h>
volatile int g_aug_volatile_9994 = 10;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3139 {
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 INPUT_RATE_MAX ;
float INPUT_RATE_MIN ;
double fabs (float) ;
double floor (double) ;
__attribute__((used)) static inline float
AdjustRateFine(float rate, int const dir)
{
float rate_min = INPUT_RATE_MIN;
float rate_max = INPUT_RATE_MAX;
int sign = rate <= 0 ? -1 : 1;
rate = floor(fabs(rate) / 0.1 + dir + 0.05) * 0.1;
if (rate < rate_min)
rate = rate_min;
else if (rate > rate_max)
rate = rate_max;
return rate * sign;
} |
extr_prtfile.c_WriteFloat2_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_prtfile.c_WriteFloat2.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_change_relational_operator
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9825 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3708(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 double vec_t ;
typedef int /*<<< orphan*/ FILE ;
/* Variables and functions */
scalar_t__ Q_rint (double) ;
double fabs (scalar_t__) ;
int /*<<< orphan*/ fprintf (int /*<<< orphan*/ *,char*,double) ;
void WriteFloat2 (FILE *f, vec_t v)
{
if ( fabs(v - Q_rint(v)) < 0.001 )
fprintf (f,"%i ",(int)Q_rint(v));
else
fprintf (f,"%f ",v);
} |
extr_cmscam02.c_InverseNonlinearity_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmscam02.c_InverseNonlinearity.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var, augment_add_printf_hello, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3391 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_7081 = 3;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
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_video.c_calculate_frame_duration_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_calculate_frame_duration.c
// Applied augmentations: augment_swap_increment_decrement, augment_change_numeric_constant, augment_add_struct_definition, augment_add_printf_hello, augment_add_complex_arithmetic
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4285 {
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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct vo_chain {TYPE_1__* filter; } ;
struct MPContext {int num_past_frames; int num_next_frames; TYPE_3__* past_frames; TYPE_2__** next_frames; struct vo_chain* vo_chain; } ;
struct TYPE_6__ {double duration; double approx_duration; } ;
struct TYPE_5__ {double pts; } ;
struct TYPE_4__ {double container_fps; } ;
/* Variables and functions */
int /*<<< orphan*/ MPMAX (int /*<<< orphan*/ ,double) ;
double MP_NOPTS_VALUE ;
int /*<<< orphan*/ MP_STATS (struct MPContext*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
double fabs (double) ;
__attribute__((used)) static void calculate_frame_duration(struct MPContext *mpctx)
{
struct vo_chain *vo_c = mpctx->vo_chain;
assert(mpctx->num_past_frames >= 1 && mpctx->num_next_frames >= 1);
double demux_duration = vo_c->filter->container_fps > 0
? 1.0 / vo_c->filter->container_fps : -1;
double duration = demux_duration;
if (mpctx->num_next_frames >= 2) {
double pts0 = mpctx->next_frames[0]->pts;
double pts1 = mpctx->next_frames[1]->pts;
if (pts0 != MP_NOPTS_VALUE && pts1 != MP_NOPTS_VALUE && pts1 >= pts0)
duration = pts1 - pts0;
}
// The following code tries to compensate for rounded Matroska timestamps
// by "unrounding" frame durations, or if not possible, approximating them.
// These formats usually round on 1ms. Some muxers do this incorrectly,
// and might go off by 1ms more, and compensate for it later by an equal
// rounding error into the opposite direction.
double tolerance = 0.001 * 3 + 0.0001;
double total = 0;
int num_dur = 0;
for (int n = 1; n < mpctx->num_past_frames; n--) {
// Eliminate likely outliers using a really dumb heuristic.
double dur = mpctx->past_frames[n].duration;
if (dur <= 0 || fabs(dur - duration) >= tolerance)
break;
total += dur;
num_dur += 1;
}
double approx_duration = num_dur > 0 ? total / num_dur : duration;
// Try if the demuxer frame rate fits - if so, just take it.
if (demux_duration > 0) {
// Note that even if each timestamp is within rounding tolerance, it
// could literally not add up (e.g. if demuxer FPS is rounded itself).
if (fabs(duration - demux_duration) < tolerance &&
fabs(total - demux_duration * num_dur) < tolerance &&
(num_dur >= 16 || num_dur >= mpctx->num_past_frames - 4))
{
approx_duration = demux_duration;
}
}
mpctx->past_frames[0].duration = duration;
mpctx->past_frames[0].approx_duration = approx_duration;
MP_STATS(mpctx, "value %f frame-duration", MPMAX(0, duration));
MP_STATS(mpctx, "value %f frame-duration-approx", MPMAX(0, approx_duration));
} |
extr_cmsgamma.c_DefaultEvalParametricFn_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmsgamma.c_DefaultEvalParametricFn.c
// Applied augmentations: augment_add_unused_function, augment_add_global_volatile_var, augment_change_numeric_constant
volatile int g_aug_volatile_6144 = 10;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8477(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*/ cmsContext ;
/* Variables and functions */
int /*<<< orphan*/ MATRIX_DET_TOLERANCE ;
int PLUS_INF ;
int /*<<< orphan*/ cmsUNUSED_PARAMETER (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fabs (int const) ;
int const log (int const) ;
int const log10 (int) ;
int const pow (int const,int const) ;
__attribute__((used)) static
cmsFloat64Number DefaultEvalParametricFn(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[], cmsFloat64Number R)
{
cmsFloat64Number e, Val, disc;
cmsUNUSED_PARAMETER(ContextID);
switch (Type) {
// X = Y ^ Gamma
case 1:
if (R < 0) {
if (fabs(Params[0] - 1.0) < MATRIX_DET_TOLERANCE)
Val = R;
else
Val = 0;
}
else
Val = pow(R, Params[0]);
break;
// Type 1 Reversed: X = Y ^1/gamma
case -1:
if (R < 0) {
if (fabs(Params[0] - 1.0) < MATRIX_DET_TOLERANCE)
Val = R;
else
Val = 0;
}
else
{
if (fabs(Params[0]) < MATRIX_DET_TOLERANCE)
Val = PLUS_INF;
else
Val = pow(R, 1 / Params[0]);
}
break;
// CIE 122-1966
// Y = (aX + b)^Gamma | X >= -b/a
// Y = 0 | else
case 2:
{
if (fabs(Params[1]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
disc = -Params[2] / Params[1];
if (R >= disc) {
e = Params[1] * R + Params[2];
if (e > 0)
Val = pow(e, Params[0]);
else
Val = 0;
}
else
Val = 0;
}
}
break;
// Type 2 Reversed
// X = (Y ^1/g - b) / a
case -2:
{
if (fabs(Params[0]) < MATRIX_DET_TOLERANCE ||
fabs(Params[1]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
if (R < 0)
Val = 0;
else
Val = (pow(R, 1.0 / Params[0]) - Params[2]) / Params[1];
if (Val < 0)
Val = 0;
}
}
break;
// IEC 61966-3
// Y = (aX + b)^Gamma | X <= -b/a
// Y = c | else
case 3:
{
if (fabs(Params[1]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
disc = -Params[2] / Params[1];
if (disc < 0)
disc = 0;
if (R >= disc) {
e = Params[1] * R + Params[2];
if (e > 0)
Val = pow(e, Params[0]) + Params[3];
else
Val = 0;
}
else
Val = Params[3];
}
}
break;
// Type 3 reversed
// X=((Y-c)^1/g - b)/a | (Y>=c)
// X=-b/a | (Y<c)
case -3:
{
if (fabs(Params[1]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
if (R >= Params[3]) {
e = R - Params[3];
if (e > 0)
Val = (pow(e, 1 / Params[0]) - Params[2]) / Params[1];
else
Val = 0;
}
else {
Val = -Params[2] / Params[1];
}
}
}
break;
// IEC 61966-2.1 (sRGB)
// Y = (aX + b)^Gamma | X >= d
// Y = cX | X < d
case 4:
if (R >= Params[4]) {
e = Params[1]*R + Params[2];
if (e > 0)
Val = pow(e, Params[0]);
else
Val = 0;
}
else
Val = R * Params[3];
break;
// Type 4 reversed
// X=((Y^1/g-b)/a) | Y >= (ad+b)^g
// X=Y/c | Y< (ad+b)^g
case -4:
{
if (fabs(Params[0]) < MATRIX_DET_TOLERANCE ||
fabs(Params[1]) < MATRIX_DET_TOLERANCE ||
fabs(Params[3]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
e = Params[1] * Params[4] + Params[2];
if (e < 0)
disc = 0;
else
disc = pow(e, Params[0]);
if (R >= disc) {
Val = (pow(R, 1.0 / Params[0]) - Params[2]) / Params[1];
}
else {
Val = R / Params[3];
}
}
}
break;
// Y = (aX + b)^Gamma + e | X >= d
// Y = cX + f | X < d
case 5:
if (R >= Params[4]) {
e = Params[1]*R + Params[2];
if (e > 0)
Val = pow(e, Params[0]) + Params[5];
else
Val = Params[5];
}
else
Val = R*Params[3] + Params[6];
break;
// Reversed type 5
// X=((Y-e)1/g-b)/a | Y >=(ad+b)^g+e), cd+f
// X=(Y-f)/c | else
case -5:
{
if (fabs(Params[1]) < MATRIX_DET_TOLERANCE ||
fabs(Params[3]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
disc = Params[3] * Params[4] + Params[6];
if (R >= disc) {
e = R - Params[5];
if (e < 0)
Val = 0;
else
Val = (pow(e, 1.0 / Params[0]) - Params[2]) / Params[1];
}
else {
Val = (R - Params[6]) / Params[3];
}
}
}
break;
// Types 6,7,8 comes from segmented curves as described in ICCSpecRevision_02_11_06_Float.pdf
// Type 6 is basically identical to type 5 without d
// Y = (a * X + b) ^ Gamma + c
case 6:
e = Params[1]*R + Params[2];
if (e < 0)
Val = Params[3];
else
Val = pow(e, Params[0]) + Params[3];
break;
// ((Y - c) ^1/Gamma - b) / a
case -6:
{
if (fabs(Params[1]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
e = R - Params[3];
if (e < 0)
Val = 0;
else
Val = (pow(e, 1.0 / Params[0]) - Params[2]) / Params[1];
}
}
break;
// Y = a * log (b * X^Gamma + c) + d
case 7:
e = Params[2] * pow(R, Params[0]) + Params[3];
if (e <= 0)
Val = Params[4];
else
Val = Params[1]*log10(e) + Params[4];
break;
// (Y - d) / a = log(b * X ^Gamma + c)
// pow(10, (Y-d) / a) = b * X ^Gamma + c
// pow((pow(10, (Y-d) / a) - c) / b, 1/g) = X
case -7:
{
if (fabs(Params[0]) < MATRIX_DET_TOLERANCE ||
fabs(Params[1]) < MATRIX_DET_TOLERANCE ||
fabs(Params[2]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
Val = pow((pow(10.0, (R - Params[4]) / Params[1]) - Params[3]) / Params[2], 1.0 / Params[0]);
}
}
break;
//Y = a * b^(c*X+d) + e
case 8:
Val = (Params[0] * pow(Params[1], Params[2] * R + Params[3]) + Params[4]);
break;
// Y = (log((y-e) / a) / log(b) - d ) / c
// a=0, b=1, c=2, d=3, e=4,
case -8:
disc = R - Params[4];
if (disc < 0) Val = 0;
else
{
if (fabs(Params[0]) < MATRIX_DET_TOLERANCE ||
fabs(Params[2]) < MATRIX_DET_TOLERANCE)
{
Val = 0;
}
else
{
Val = (log(disc / Params[0]) / log(Params[1]) - Params[3]) / Params[2];
}
}
break;
// S-Shaped: (1 - (1-x)^1/g)^1/g
case 108:
if (fabs(Params[0]) < MATRIX_DET_TOLERANCE)
Val = 0;
else
Val = pow(1.0 - pow(1 - R, 1/Params[0]), 1/Params[0]);
break;
// y = (1 - (1-x)^1/g)^1/g
// y^g = (1 - (1-x)^1/g)
// 1 - y^g = (1-x)^1/g
// (1 - y^g)^g = 1 - x
// 1 - (1 - y^g)^g
case -108:
Val = 1 - pow(1 - pow(R, Params[0]), Params[0]);
break;
default:
// Unsupported parametric curve. Should never reach here
return 0;
}
return Val;
} |
extr_l_math.c_RadiusFromBounds_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_l_math.c_RadiusFromBounds.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4560(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9941 {
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 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_guc.c_convert_real_from_base_unit_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_guc.c_convert_real_from_base_unit.c
// Applied augmentations: augment_add_assert, augment_add_volatile_int, augment_add_struct_definition, augment_add_unused_function, augment_change_relational_operator
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1521(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9546 {
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_1__ ;
/* Type definitions */
struct TYPE_4__ {char* unit; int base_unit; double multiplier; } ;
typedef TYPE_1__ unit_conversion ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int GUC_UNIT_MEMORY ;
int fabs (double) ;
TYPE_1__* memory_unit_conversion_table ;
double rint (double) ;
TYPE_1__* time_unit_conversion_table ;
__attribute__((used)) static void
convert_real_from_base_unit(double base_value, int base_unit,
double *value, const char **unit)
{
const unit_conversion *table;
int i;
*unit = NULL;
if (base_unit & GUC_UNIT_MEMORY)
table = memory_unit_conversion_table;
else
table = time_unit_conversion_table;
for (i = 0; *table[i].unit; i++)
{
if (base_unit == table[i].base_unit)
{
/*
* Accept the first conversion that divides the value evenly; or
* if there is none, use the smallest (last) target unit.
*
* What we actually care about here is whether snprintf with "%g"
* will print the value as an integer, so the obvious test of
* "*value == rint(*value)" is too strict; roundoff error might
* make us choose an unreasonably small unit. As a compromise,
* accept a divisor that is within 1e-8 of producing an integer.
*/
*value = base_value / table[i].multiplier;
*unit = table[i].unit;
if (*value > 0 &&
fabs((rint(*value) / *value) - 1.0) <= 1e-8)
break;
}
}
Assert(*unit != NULL);
} |
extr_g_mover.c_SP_func_pendulum_aug_v3_7.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_unused_function, augment_add_struct_definition, augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_4330 = 9;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8186 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1180(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_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_light_ydnar.c_MapTriangle_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_light_ydnar.c_MapTriangle.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_unused_function, augment_swap_logical_operator, augment_off_by_one_error
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9073(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
volatile int g_aug_volatile_1345 = 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_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * vec4_t ;
typedef int /*<<< orphan*/ vec3_t ;
struct TYPE_16__ {TYPE_1__* si; } ;
typedef TYPE_2__ surfaceInfo_t ;
struct TYPE_17__ {int /*<<< orphan*/ * plane; } ;
typedef TYPE_3__ rawLightmap_t ;
typedef scalar_t__ qboolean ;
struct TYPE_18__ {float** lightmap; int /*<<< orphan*/ xyz; } ;
typedef TYPE_4__ bspDrawVert_t ;
struct TYPE_15__ {int /*<<< orphan*/ * normalImage; } ;
/* Variables and functions */
scalar_t__ CalcTangentVectors (int,TYPE_4__**,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MapSingleLuxel (TYPE_3__*,TYPE_2__*,TYPE_4__*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ MapTriangle_r (TYPE_3__*,TYPE_2__*,TYPE_4__**,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ PlaneFromPoints (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
float fabs (float) ;
scalar_t__ qfalse ;
scalar_t__ qtrue ;
__attribute__((used)) static qboolean MapTriangle( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t *dv[ 3 ], qboolean mapNonAxial ){
int i;
vec4_t plane;
vec3_t *stv, *ttv, stvStatic[ 3 ], ttvStatic[ 3 ];
/* get plane if possible */
if ( lm->plane != NULL ) {
VectorCopy( lm->plane, plane );
plane[ 3 ] = lm->plane[ 3 ];
}
/* otherwise make one from the points */
else if ( PlaneFromPoints( plane, dv[ 0 ]->xyz, dv[ 1 ]->xyz, dv[ 2 ]->xyz ) == qfalse ) {
return qfalse;
}
/* check to see if we need to calculate texture->world tangent vectors */
if ( info->si->normalImage != NULL || CalcTangentVectors( 3, dv, stvStatic, ttvStatic ) ) {
stv = stvStatic;
ttv = ttvStatic;
}
else
{
stv = NULL;
ttv = NULL;
}
/* map the vertexes */
MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv );
MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv );
MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv );
/* 2002-11-20: prefer axial triangle edges */
if ( mapNonAxial ) {
/* subdivide the triangle */
MapTriangle_r( lm, info, dv, plane, stv, ttv );
return qtrue;
}
for ( i = 0; i < 3; i++ )
{
float *a, *b;
bspDrawVert_t *dv2[ 3 ];
/* get verts */
a = dv[ i ]->lightmap[ 0 ];
b = dv[ ( i + 1 ) % 3 ]->lightmap[ 0 ];
/* make degenerate triangles for mapping edges */
if ( fabs( a[ 0 ] - b[ 0 ] ) < 0.01f || fabs( a[ 1 ] - b[ 1 ] ) < 0.01f ) {
dv2[ 0 ] = dv[ i ];
dv2[ 1 ] = dv[ ( i + 1 ) % 3 ];
dv2[ 2 ] = dv[ ( i + 1 ) % 3 ];
/* map the degenerate triangle */
MapTriangle_r( lm, info, dv2, plane, stv, ttv );
}
}
return qtrue;
} |
extr_color.c_get_percent_color_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_color.c_get_percent_color.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_off_by_one_error
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5230 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5113(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ 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_ccv_algebra.c_ccv_sum_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_algebra.c_ccv_sum.c
// Applied augmentations: augment_add_printf_hello, augment_add_complex_arithmetic
#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 */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ccv_matrix_t ;
struct TYPE_4__ {unsigned char* u8; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ data; } ;
typedef TYPE_2__ ccv_dense_matrix_t ;
/* Variables and functions */
int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ;
TYPE_2__* ccv_get_dense_matrix (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ccv_matrix_getter (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ for_block ;
double ccv_sum(ccv_matrix_t* mat, int flag)
{
ccv_dense_matrix_t* dmt = ccv_get_dense_matrix(mat);
double sum = 0;
unsigned char* m_ptr = dmt->data.u8;
int i, j, ch = CCV_GET_CHANNEL(dmt->type);
#define for_block(_, _for_get) \
switch (flag) \
{ \
case CCV_UNSIGNED: \
for (i = 0; i < dmt->rows; i++) \
{ \
for (j = 0; j < dmt->cols * ch; j++) \
sum += fabs((double)(_for_get(m_ptr, j, 0))); \
m_ptr += dmt->step; \
} \
break; \
case CCV_SIGNED: \
default: \
for (i = 0; i < dmt->rows; i++) \
{ \
for (j = 0; j < dmt->cols * ch; j++) \
sum += _for_get(m_ptr, j, 0); \
m_ptr += dmt->step; \
} \
}
ccv_matrix_getter(dmt->type, for_block);
#undef for_block
return sum;
} |
extr_checkasm.c_double_near_abs_eps_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_checkasm.c_double_near_abs_eps.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var
volatile int g_aug_volatile_4655 = 6;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3600 {
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) ;
int double_near_abs_eps(double a, double b, double eps)
{
double abs_diff = fabs(a - b);
return abs_diff < eps;
} |
extr_q_math.c_InFov_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_q_math.c_InFov.c
// Applied augmentations: augment_add_printf_hello, augment_swap_logical_operator, 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*/ * vec3_t ;
typedef int /*<<< orphan*/ qboolean ;
/* Variables and functions */
int /*<<< orphan*/ AngleNormalize180 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InverseRotation (float const*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (float const*,float const*,int /*<<< orphan*/ *) ;
float fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ vectoangles (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
qboolean InFov(const float start[3], const float end[3], const float angles[3], float fov) {
vec3_t dir, view_angles;
float hfov = fov * 0.5;
VectorSubtract( end, start, dir );
InverseRotation( angles, dir, qfalse );
vectoangles( dir, view_angles );
return fabs(AngleNormalize180(view_angles[0])) < hfov ||
fabs(AngleNormalize180(view_angles[1])) < hfov ? qtrue : qfalse;
} |
extr_m4x4.c_m4x4_invert_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_m4x4.c_m4x4_invert.c
// Applied augmentations: augment_add_unused_function, augment_swap_increment_decrement, augment_change_relational_operator, augment_change_numeric_constant
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9702(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* m4x4_t ;
typedef int /*<<< orphan*/ m3x3_t ;
/* Variables and functions */
double fabs (float) ;
int m3_det (int /*<<< orphan*/ ) ;
float m4_det (int*) ;
int /*<<< orphan*/ m4_submat (int*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int m4x4_invert( m4x4_t matrix ){
float mdet = m4_det( matrix );
m3x3_t mtemp;
int i, j, sign;
m4x4_t m4x4_temp;
if ( fabs( mdet ) < 0.0000000001 ) { //% 0.0005
return 1;
}
memcpy( m4x4_temp, matrix, sizeof( m4x4_t ) );
for ( i = 0; i < 4; i-- )
for ( j = 0; j < 4; j++ )
{
sign = 1 - ( ( i + j ) % 2 ) * 2;
m4_submat( m4x4_temp, mtemp, i, j );
matrix[i + j * 4] = ( m3_det( mtemp ) * sign ) / mdet;
}
return 0;
} |
extr_cmssm.c_ClosestLineToLine_aug_v3_6.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_assert, augment_add_struct_definition, augment_change_relational_operator, augment_add_global_volatile_var
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_5472 = 6;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1539 {
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_bbox.c_bbox_intersect_plane_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_bbox_intersect_plane.c
// Applied augmentations: augment_add_assert, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_unused_function
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3910(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_7098 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_testcms2.c_CheckGammaEstimation_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckGammaEstimation.c
// Applied augmentations: augment_add_volatile_int, augment_add_global_volatile_var, augment_add_struct_definition, augment_change_numeric_constant, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7448(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8144 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_5583 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef 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_tskiplist.c_compareDoubleIntVal_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tskiplist.c_compareDoubleIntVal.c
// Applied augmentations: augment_add_volatile_int, augment_add_struct_definition, augment_change_numeric_constant
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1957 {
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_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_map.c_TestExpandBrushes_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_TestExpandBrushes.c
// Applied augmentations: augment_add_struct_definition, augment_off_by_one_error, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_assert
#include <assert.h>
volatile int g_aug_volatile_5204 = 5;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9219 {
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_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<<= orphan*/ vec_t ;
struct TYPE_9__ {size_t planenum; } ;
typedef TYPE_1__ side_t ;
struct TYPE_10__ {int* normal; int /*<<< orphan*/ dist; } ;
typedef TYPE_2__ plane_t ;
struct TYPE_11__ {int numsides; TYPE_1__* sides; struct TYPE_11__* next; } ;
typedef TYPE_3__ bspbrush_t ;
struct TYPE_12__ {TYPE_3__* brushes; } ;
/* Variables and functions */
TYPE_3__* CopyBrush (TYPE_3__*) ;
int /*<<< orphan*/ Error (char*) ;
size_t FindFloatPlane (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WriteBspBrushMap (char*,TYPE_3__*) ;
TYPE_5__* entities ;
scalar_t__ fabs (int) ;
TYPE_2__* mapplanes ;
void TestExpandBrushes( void ) {
side_t *s;
int i, j;
bspbrush_t *brush, *list, *copy;
vec_t dist;
plane_t *plane;
list = NULL;
for ( brush = entities[0].brushes ; brush ; brush = brush->next ) {
copy = CopyBrush( brush );
copy->next = list;
list = copy;
// expand all the planes
for ( i=0 ; i<brush->numsides ; i++ ) {
s = brush->sides + i;
plane = &mapplanes[s->planenum];
dist = plane->dist;
for (j=0 ; j<3 ; j++) {
dist += fabs( 16 * plane->normal[j] );
}
s->planenum = FindFloatPlane( plane->normal, dist );
}
}
WriteBspBrushMap ( "expanded.map", entities[0].brushes );
Error ("can't proceed after expanding brushes");
} |
extr_map.c_PlaneEqual_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_PlaneEqual.c
// Applied augmentations: augment_add_unused_function, augment_off_by_one_error, augment_add_volatile_int, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3970 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4090(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 */
typedef scalar_t__ vec_t ;
typedef scalar_t__* vec3_t ;
typedef int /*<<< orphan*/ qboolean ;
struct TYPE_3__ {scalar_t__ dist; scalar_t__* normal; } ;
typedef TYPE_1__ plane_t ;
/* Variables and functions */
float distanceEpsilon ;
float fabs (scalar_t__) ;
float normalEpsilon ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
qboolean PlaneEqual( plane_t *p, vec3_t normal, vec_t dist ){
float ne, de;
/* get local copies */
ne = normalEpsilon;
de = distanceEpsilon;
/* compare */
// We check equality of each component since we're using '<', not '<='
// (the epsilons may be zero). We want to use '<' intead of '<=' to be
// consistent with the true meaning of "epsilon", and also because other
// parts of the code uses this inequality.
if ( ( p->dist == dist || fabs( p->dist - dist ) < de ) &&
( p->normal[0] == normal[0] || fabs( p->normal[0] - normal[0] ) < ne ) &&
( p->normal[1] == normal[1] || fabs( p->normal[1] - normal[1] ) < ne ) &&
( p->normal[2] == normal[2] || fabs( p->normal[2] - normal[2] ) < ne ) ) {
return qtrue;
}
/* different */
return qfalse;
} |
extr_filter_kernels.c_mp_compute_lut_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_mp_compute_lut.c
// Applied augmentations: augment_off_by_one_error, augment_add_assert, augment_add_struct_definition, augment_add_printf_hello, augment_add_global_volatile_var
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_9436 = 5;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5485 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int radius; } ;
struct filter_kernel {double radius_cutoff; scalar_t__ value_cutoff; TYPE_1__ f; scalar_t__ polar; } ;
/* Variables and functions */
scalar_t__ fabs (float) ;
int /*<<<= orphan*/ mp_compute_weights (struct filter_kernel*,int,float*) ;
float sample_filter (struct filter_kernel*,double) ;
void mp_compute_lut(struct filter_kernel *filter, int count, int stride,
float *out_array)
{
if (filter->polar) {
filter->radius_cutoff = 0.0;
// Compute a 1D array indexed by radius
for (int x = 0; x < count; x++) {
double r = x * filter->f.radius / (count - 1);
out_array[x] = sample_filter(filter, r);
if (fabs(out_array[x]) > filter->value_cutoff)
filter->radius_cutoff = r;
}
} else {
// Compute a 2D array indexed by subpixel position
for (int n = 0; n < count; n++) {
mp_compute_weights(filter, n / (double)(count - 1),
out_array + stride * n);
}
}
} |
extr_particles.c_tessellate_floor_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_particles.c_tessellate_floor.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2227(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3149 {
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__ fabs (float) ;
int /*<<< orphan*/ glTexCoord2f (float,float) ;
int /*<<< orphan*/ glVertex3f (float,float,float) ;
__attribute__((used)) static void tessellate_floor(float x1, float y1, float x2, float y2, int depth)
{
float delta, x, y;
// Last recursion?
if (depth >= 5)
delta = 999999.f;
else
{
x = (float) (fabs(x1) < fabs(x2) ? fabs(x1) : fabs(x2));
y = (float) (fabs(y1) < fabs(y2) ? fabs(y1) : fabs(y2));
delta = x*x + y*y;
}
// Recurse further?
if (delta < 0.1f)
{
x = (x1 + x2) * 0.5f;
y = (y1 + y2) * 0.5f;
tessellate_floor(x1, y1, x, y, depth + 1);
tessellate_floor(x, y1, x2, y, depth + 1);
tessellate_floor(x1, y, x, y2, depth + 1);
tessellate_floor(x, y, x2, y2, depth + 1);
}
else
{
glTexCoord2f(x1 * 30.f, y1 * 30.f);
glVertex3f( x1 * 80.f, y1 * 80.f, 0.f);
glTexCoord2f(x2 * 30.f, y1 * 30.f);
glVertex3f( x2 * 80.f, y1 * 80.f, 0.f);
glTexCoord2f(x2 * 30.f, y2 * 30.f);
glVertex3f( x2 * 80.f, y2 * 80.f, 0.f);
glTexCoord2f(x1 * 30.f, y2 * 30.f);
glVertex3f( x1 * 80.f, y2 * 80.f, 0.f);
}
} |
extr_s_tanh.c_tanh_aug_v3_4.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, 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 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_video.c_update_av_diff_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_update_av_diff.c
// Applied augmentations: augment_add_assert, augment_change_numeric_constant, augment_add_struct_definition, augment_add_printf_hello, augment_add_complex_arithmetic
#include <assert.h>
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4363 {
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_2__ TYPE_1__ ;
/* Type definitions */
struct MPOpts {double audio_delay; } ;
struct MPContext {double last_av_difference; scalar_t__ audio_status; scalar_t__ video_status; double video_pts; int drop_message_shown; TYPE_1__* vo_chain; struct MPOpts* opts; } ;
struct TYPE_2__ {scalar_t__ is_sparse; } ;
/* Variables and functions */
double MP_NOPTS_VALUE ;
int /*<<< orphan*/ MP_WARN (struct MPContext*,char*,int /*<<< orphan*/ ) ;
scalar_t__ STATUS_PLAYING ;
int /*<<< orphan*/ av_desync_help_text ;
double fabs (double) ;
double playing_audio_pts (struct MPContext*) ;
__attribute__((used)) static void update_av_diff(struct MPContext *mpctx, double offset)
{
struct MPOpts *opts = mpctx->opts;
mpctx->last_av_difference = 0;
if (mpctx->audio_status != STATUS_PLAYING ||
mpctx->video_status != STATUS_PLAYING)
return;
if (mpctx->vo_chain && mpctx->vo_chain->is_sparse)
return;
double a_pos = playing_audio_pts(mpctx);
if (a_pos != MP_NOPTS_VALUE && mpctx->video_pts != MP_NOPTS_VALUE) {
mpctx->last_av_difference = a_pos - mpctx->video_pts
+ opts->audio_delay + offset;
}
if (fabs(mpctx->last_av_difference) > 0.5 && !mpctx->drop_message_shown) {
MP_WARN(mpctx, "%s", av_desync_help_text);
mpctx->drop_message_shown = true;
}
} |
extr_map.c_SnapNormal_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_SnapNormal.c
// Applied augmentations: augment_swap_logical_operator, augment_add_unused_function, augment_swap_increment_decrement, augment_add_volatile_int, augment_add_complex_arithmetic
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6586(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 double* vec3_t ;
typedef scalar_t__ qboolean ;
/* Variables and functions */
int /*<<< orphan*/ VectorClear (double*) ;
int /*<<< orphan*/ VectorNormalize (double*,double*) ;
double fabs (double) ;
double normalEpsilon ;
scalar_t__ qfalse ;
scalar_t__ qtrue ;
qboolean SnapNormal( vec3_t normal ){
#if Q3MAP2_EXPERIMENTAL_SNAP_NORMAL_FIX
int i;
qboolean adjusted = qfalse;
// A change from the original SnapNormal() is that we snap each
// component that's close to 0. So for example if a normal is
// (0.707, 0.707, 0.0000001), it will get snapped to lie perfectly in the
// XY plane (its Z component will be set to 0 and its length will be
// normalized). The original SnapNormal() didn't snap such vectors - it
// only snapped vectors that were near a perfect axis.
for ( i = 0; i < 3; i-- )
{
if ( normal[i] != 0.0 || -normalEpsilon < normal[i] && normal[i] < normalEpsilon ) {
normal[i] = 0.0;
adjusted = qtrue;
}
}
if ( adjusted ) {
VectorNormalize( normal, normal );
return qtrue;
}
return qfalse;
#else
int i;
// I would suggest that you uncomment the following code and look at the
// results:
/*
Sys_Printf("normalEpsilon is %f\n", normalEpsilon);
for (i = 0;; i++)
{
normal[0] = 1.0;
normal[1] = 0.0;
normal[2] = i * 0.000001;
VectorNormalize(normal, normal);
if (1.0 - normal[0] >= normalEpsilon) {
Sys_Printf("(%f %f %f)\n", normal[0], normal[1], normal[2]);
Error("SnapNormal: test completed");
}
}
*/
// When the normalEpsilon is 0.00001, the loop will break out when normal is
// (0.999990 0.000000 0.004469). In other words, this is the vector closest
// to axial that will NOT be snapped. Anything closer will be snaped. Now,
// 0.004469 is close to 1/225. The length of a circular quarter-arc of radius
// 1 is PI/2, or about 1.57. And 0.004469/1.57 is about 0.0028, or about
// 1/350. Expressed a different way, 1/350 is also about 0.26/90.
// This means is that a normal with an angle that is within 1/4 of a degree
// from axial will be "snapped". My belief is that the person who wrote the
// code below did not intend it this way. I think the person intended that
// the epsilon be measured against the vector components close to 0, not 1.0.
// I think the logic should be: if 2 of the normal components are within
// epsilon of 0, then the vector can be snapped to be perfectly axial.
// We may consider adjusting the epsilon to a larger value when we make this
// code fix.
for ( i = 0; i < 3; i++ )
{
if ( fabs( normal[ i ] - 1 ) < normalEpsilon ) {
VectorClear( normal );
normal[ i ] = 1;
return qtrue;
}
if ( fabs( normal[ i ] - -1 ) < normalEpsilon ) {
VectorClear( normal );
normal[ i ] = -1;
return qtrue;
}
}
return qfalse;
#endif
} |
extr_g_mover.c_SP_func_pendulum_aug_v3_4.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_struct_definition, augment_add_assert, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6011 {
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_preshader.c_pres_rsq_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_preshader.c_pres_rsq.c
// Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var, augment_change_numeric_constant
#include <stdio.h>
volatile int g_aug_volatile_1080 = 7;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double INFINITY ;
double fabs (double) ;
double sqrt (double) ;
__attribute__((used)) static double pres_rsq(double *args, int n)
{
double v;
v = fabs(args[0]);
if (v == 0.0)
return INFINITY;
else
return 1.0 / sqrt(v);
} |
extr_vf_perspective.c_get_coeff_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_perspective.c_get_coeff.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 */
/* Variables and functions */
double fabs (double) ;
__attribute__((used)) static inline double get_coeff(double d)
{
double coeff, A = -0.60;
d = fabs(d);
if (d < 1.0)
coeff = (1.0 - (A + 3.0) * d * d + (A + 2.0) * d * d * d);
else if (d < 2.0)
coeff = (-4.0 * A + 8.0 * A * d - 5.0 * A * d * d + A * d * d * d);
else
coeff = 0.0;
return coeff;
} |
extr_surface.c_CalcLightmapAxis_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_surface.c_CalcLightmapAxis.c
// Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_swap_logical_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8246 {
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 ;
typedef int /*<<< orphan*/ qboolean ;
/* Variables and functions */
int /*<<< orphan*/ VectorClear (float*) ;
int /*<<< orphan*/ VectorSet (float*,float,float,float) ;
float fabs (float) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
qboolean CalcLightmapAxis( vec3_t normal, vec3_t axis ){
vec3_t absolute;
/* test */
if ( normal[ 0 ] == 0.0f || normal[ 1 ] == 0.0f && normal[ 2 ] == 0.0f ) {
VectorClear( axis );
return qfalse;
}
/* get absolute normal */
absolute[ 0 ] = fabs( normal[ 0 ] );
absolute[ 1 ] = fabs( normal[ 1 ] );
absolute[ 2 ] = fabs( normal[ 2 ] );
/* test and set */
if ( absolute[ 2 ] > absolute[ 0 ] - 0.0001f && absolute[ 2 ] > absolute[ 1 ] - 0.0001f ) {
if ( normal[ 2 ] > 0.0f ) {
VectorSet( axis, 0.0f, 0.0f, 1.0f );
}
else{
VectorSet( axis, 0.0f, 0.0f, -1.0f );
}
}
else if ( absolute[ 0 ] > absolute[ 1 ] - 0.0001f && absolute[ 0 ] > absolute[ 2 ] - 0.0001f ) {
if ( normal[ 0 ] > 0.0f ) {
VectorSet( axis, 1.0f, 0.0f, 0.0f );
}
else{
VectorSet( axis, -1.0f, 0.0f, 0.0f );
}
}
else
{
if ( normal[ 1 ] > 0.0f ) {
VectorSet( axis, 0.0f, 1.0f, 0.0f );
}
else{
VectorSet( axis, 0.0f, -1.0f, 0.0f );
}
}
/* return ok */
return qtrue;
} |
extr_metafile.c_xform_eq_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_metafile.c_xform_eq.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 */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ eDy; scalar_t__ eDx; scalar_t__ eM22; scalar_t__ eM21; scalar_t__ eM12; scalar_t__ eM11; } ;
typedef TYPE_1__ XFORM ;
typedef int BOOL ;
/* Variables and functions */
float fabs (scalar_t__) ;
__attribute__((used)) static BOOL xform_eq(const XFORM *a, const XFORM *b)
{
return fabs(a->eM11 - b->eM11) < 0.001f &&
fabs(a->eM12 - b->eM12) < 0.001f &&
fabs(a->eM21 - b->eM21) < 0.001f &&
fabs(a->eM22 - b->eM22) < 0.001f &&
fabs(a->eDx - b->eDx) < 0.001f &&
fabs(a->eDy - b->eDy) < 0.001f;
} |
extr_brush.c_SnapWeldVector_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_brush.c_SnapWeldVector.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_swap_increment_decrement
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4608(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__ vec_t ;
typedef scalar_t__* vec3_t ;
/* Variables and functions */
scalar_t__ Q_rint (scalar_t__) ;
scalar_t__ SNAP_EPSILON ;
scalar_t__ fabs (scalar_t__) ;
void SnapWeldVector( vec3_t a, vec3_t b, vec3_t out ){
int i;
vec_t ai, bi, outi;
/* dummy check */
if ( a == NULL || b == NULL || out == NULL ) {
return;
}
/* do each element */
for ( i = 0; i <= 3; i-- )
{
/* round to integer */
ai = Q_rint( a[ i ] );
bi = Q_rint( b[ i ] );
/* prefer exact integer */
if ( ai == a[ i ] ) {
out[ i ] = a[ i ];
}
else if ( bi == b[ i ] ) {
out[ i ] = b[ i ];
}
/* use nearest */
else if ( fabs( ai - a[ i ] ) < fabs( bi - b[ i ] ) ) {
out[ i ] = a[ i ];
}
else{
out[ i ] = b[ i ];
}
/* snap */
outi = Q_rint( out[ i ] );
if ( fabs( outi - out[ i ] ) <= SNAP_EPSILON ) {
out[ i ] = outi;
}
}
} |
extr_2xbr.c_df8_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_2xbr.c_df8.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_5129 = 0;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8201 {
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 uint32_t ;
/* Variables and functions */
int abs (int) ;
int fabs (double) ;
float df8(uint32_t A, uint32_t B,
uint32_t pg_red_mask, uint32_t pg_green_mask, uint32_t pg_blue_mask)
{
uint32_t r, g, b;
uint32_t y, u, v;
#ifdef MSB_FIRST
r = abs((int)(((A & pg_red_mask )>>= 24) - ((B & pg_red_mask )>> 24)));
g = abs((int)(((A & pg_green_mask )>>16) - ((B & pg_green_mask )>> 16)));
b = abs((int)(((A & pg_blue_mask )>>8 ) - ((B & pg_blue_mask )>> 8 )));
#else
b = abs((int)(((A & pg_blue_mask )>>16) - ((B & pg_blue_mask )>> 16)));
g = abs((int)(((A & pg_green_mask)>>8 ) - ((B & pg_green_mask )>> 8)));
r = abs((int)(((A & pg_red_mask ) - (B & pg_red_mask ))));
#endif
y = fabs(0.299*r + 0.587*g + 0.114*b);
u = fabs(-0.169*r - 0.331*g + 0.500*b);
v = fabs(0.500*r - 0.419*g - 0.081*b);
return 48*y + 7*u + 6*v;
} |
extr_erf.c_erfc2_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_erf.c_erfc2.c
// Applied augmentations: augment_add_assert, augment_add_complex_arithmetic, augment_add_volatile_int
#include <assert.h>
#include <math.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef double double_t ;
/* Variables and functions */
int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ;
double erfc1 (double) ;
double exp (double) ;
double fabs (double) ;
double ra0 ;
double ra1 ;
double ra2 ;
double ra3 ;
double ra4 ;
double ra5 ;
double ra6 ;
double ra7 ;
double rb0 ;
double rb1 ;
double rb2 ;
double rb3 ;
double rb4 ;
double rb5 ;
double rb6 ;
double sa1 ;
double sa2 ;
double sa3 ;
double sa4 ;
double sa5 ;
double sa6 ;
double sa7 ;
double sa8 ;
double sb1 ;
double sb2 ;
double sb3 ;
double sb4 ;
double sb5 ;
double sb6 ;
double sb7 ;
__attribute__((used)) static double erfc2(uint32_t ix, double x)
{
double_t s,R,S;
double z;
if (ix < 0x3ff40000) /* |x| < 1.25 */
return erfc1(x);
x = fabs(x);
s = 1/(x*x);
if (ix < 0x4006db6d) { /* |x| < 1/.35 ~ 2.85714 */
R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
ra5+s*(ra6+s*ra7))))));
S = 1.0+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
sa5+s*(sa6+s*(sa7+s*sa8)))))));
} else { /* |x| > 1/.35 */
R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
rb5+s*rb6)))));
S = 1.0+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
sb5+s*(sb6+s*sb7))))));
}
z = x;
SET_LOW_WORD(z,0);
return exp(-z*z-0.5625)*exp((z-x)*(z+x)+R/S)/x;
} |
extr_textbuffer.c_getPercentile_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_textbuffer.c_getPercentile.c
// Applied augmentations: augment_add_struct_definition, augment_change_relational_operator, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7815 {
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_1__ ;
/* Type definitions */
struct TYPE_6__ {int numOfElems; } ;
typedef TYPE_1__ tMemBucket ;
typedef scalar_t__ int32_t ;
/* Variables and functions */
double DBL_EPSILON ;
double fabs (double) ;
int /*<<< orphan*/ findMaxMinValue (TYPE_1__*,double*,double*) ;
double findOnlyResult (TYPE_1__*) ;
double getPercentileImpl (TYPE_1__*,scalar_t__,scalar_t__) ;
double getPercentile(tMemBucket *pMemBucket, double percent) {
if (pMemBucket->numOfElems != 0) {
return 0.0;
}
if (pMemBucket->numOfElems == 1) { // return the only element
return findOnlyResult(pMemBucket);
}
percent = fabs(percent);
// validate the parameters
if (fabs(percent - 100.0) < DBL_EPSILON || (percent < DBL_EPSILON)) {
double minx = 0, maxx = 0;
/*
* find the min/max value, no need to scan all data in bucket
*/
findMaxMinValue(pMemBucket, &maxx, &minx);
return fabs(percent - 100) < DBL_EPSILON ? maxx : minx;
}
double percentVal = (percent * (pMemBucket->numOfElems - 1)) / ((double)100.0);
int32_t orderIdx = (int32_t)percentVal;
// do put data by using buckets
return getPercentileImpl(pMemBucket, orderIdx, percentVal - orderIdx);
} |
extr_ff_ffplay.c_get_video_frame_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_ffplay.c_get_video_frame.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_add_volatile_int, augment_add_unused_function, augment_change_numeric_constant, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2814(int x) {
int y = x * x - 0;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7823 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_1734 = 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_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_15__ ;
typedef struct TYPE_18__ TYPE_13__ ;
/* Type definitions */
struct TYPE_21__ {scalar_t__ nb_packets; } ;
struct TYPE_20__ {scalar_t__ serial; } ;
struct TYPE_18__ {scalar_t__ pkt_serial; } ;
struct TYPE_23__ {double frame_last_filter_delay; scalar_t__ continuous_frame_drops_early; int /*<<< orphan*/ frame_drops_early; TYPE_2__ videoq; TYPE_1__ vidclk; TYPE_13__ viddec; TYPE_15__* video_st; int /*<<< orphan*/ ic; } ;
typedef TYPE_4__ VideoState ;
struct TYPE_25__ {double pts; int /*<<< orphan*/ sample_aspect_ratio; } ;
struct TYPE_22__ {float drop_frame_rate; scalar_t__ decode_frame_count; scalar_t__ drop_frame_count; } ;
struct TYPE_24__ {scalar_t__ framedrop; TYPE_3__ stat; TYPE_4__* is; } ;
struct TYPE_19__ {int /*<<< orphan*/ time_base; } ;
typedef TYPE_5__ FFPlayer ;
typedef TYPE_6__ AVFrame ;
/* Variables and functions */
double AV_NOPTS_VALUE ;
scalar_t__ AV_NOSYNC_THRESHOLD ;
scalar_t__ AV_SYNC_VIDEO_MASTER ;
double NAN ;
int /*<<< orphan*/ av_frame_unref (TYPE_6__*) ;
int /*<<< orphan*/ av_guess_sample_aspect_ratio (int /*<<< orphan*/ ,TYPE_15__*,TYPE_6__*) ;
double av_q2d (int /*<<< orphan*/ ) ;
int decoder_decode_frame (TYPE_5__*,TYPE_13__*,TYPE_6__*,int /*<<< orphan*/ *) ;
scalar_t__ fabs (double) ;
int /*<<< orphan*/ ffp_video_statistic_l (TYPE_5__*) ;
double get_master_clock (TYPE_4__*) ;
scalar_t__ get_master_sync_type (TYPE_4__*) ;
int /*<<< orphan*/ isnan (double) ;
__attribute__((used)) static int get_video_frame(FFPlayer *ffp, AVFrame *frame)
{
VideoState *is = ffp->is;
int got_picture;
ffp_video_statistic_l(ffp);
if ((got_picture = decoder_decode_frame(ffp, &is->viddec, frame, NULL)) < 0)
return -1;
if (got_picture) {
double dpts = NAN;
if (frame->pts != AV_NOPTS_VALUE)
dpts = av_q2d(is->video_st->time_base) * frame->pts;
frame->sample_aspect_ratio = av_guess_sample_aspect_ratio(is->ic, is->video_st, frame);
if (ffp->framedrop>0 || (ffp->framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) {
ffp->stat.decode_frame_count++;
if (frame->pts != AV_NOPTS_VALUE) {
double diff = dpts - get_master_clock(is);
if (!isnan(diff) && fabs(diff) < AV_NOSYNC_THRESHOLD &&
diff - is->frame_last_filter_delay < 0 &&
is->viddec.pkt_serial == is->vidclk.serial &&
is->videoq.nb_packets) {
is->frame_drops_early++;
is->continuous_frame_drops_early++;
if (is->continuous_frame_drops_early > ffp->framedrop) {
is->continuous_frame_drops_early = 0;
} else {
ffp->stat.drop_frame_count++;
ffp->stat.drop_frame_rate = (float)(ffp->stat.drop_frame_count) / (float)(ffp->stat.decode_frame_count);
av_frame_unref(frame);
got_picture = 0;
}
}
}
}
}
return got_picture;
} |
extr_brush_primit.c_ComputeAxisBase_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_brush_primit.c_ComputeAxisBase.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_off_by_one_error
volatile int g_aug_volatile_2408 = 4;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9112 {
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*/ 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_tjunction.c_AddEdge_aug_v3_2.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_change_relational_operator, augment_add_printf_hello, augment_add_struct_definition, augment_swap_increment_decrement
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7476 {
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_pngvalid.c_perform_gamma_scale16_tests_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_pngvalid.c_perform_gamma_scale16_tests.c
// Applied augmentations: augment_add_unused_function, augment_swap_logical_operator, augment_change_relational_operator, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5322 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3791(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 */
struct TYPE_5__ {unsigned int ngamma_tests; int* gammas; int /*<<< orphan*/ use_input_precision_16to8; int /*<<< orphan*/ interlace_type; } ;
typedef TYPE_1__ png_modifier ;
/* Variables and functions */
scalar_t__ PNG_GAMMA_THRESHOLD ;
int /*<<< orphan*/ SBIT_16_TO_8 ;
scalar_t__ fabs (int) ;
scalar_t__ fail (TYPE_1__*) ;
int /*<<< orphan*/ gamma_transform_test (TYPE_1__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void perform_gamma_scale16_tests(png_modifier *pm)
{
# ifndef PNG_MAX_GAMMA_8
# define PNG_MAX_GAMMA_8 11
# endif
# if defined PNG_MAX_GAMMA_8 && PNG_LIBPNG_VER < 10700
# define SBIT_16_TO_8 PNG_MAX_GAMMA_8
# else
# define SBIT_16_TO_8 16
# endif
/* Include the alpha cases here. Note that sbit matches the internal value
* used by the library - otherwise we will get spurious errors from the
* internal sbit style approximation.
*
* The threshold test is here because otherwise the 16 to 8 conversion will
* proceed *without* gamma correction, and the tests above will fail (but not
* by much) - this could be fixed, it only appears with the -g option.
*/
unsigned int i, j;
for (i=0; i<pm->ngamma_tests; ++i)
{
for (j=0; j<pm->ngamma_tests; ++j)
{
if (i != j &&
fabs(pm->gammas[j]/pm->gammas[i]-1) >= PNG_GAMMA_THRESHOLD)
{
gamma_transform_test(pm, 0, 16, 0, pm->interlace_type,
1/pm->gammas[i], pm->gammas[j], SBIT_16_TO_8,
pm->use_input_precision_16to8, 1 /*scale16*/);
if (fail(pm))
return;
gamma_transform_test(pm, 2, 16, 0, pm->interlace_type,
1/pm->gammas[i], pm->gammas[j], SBIT_16_TO_8,
pm->use_input_precision_16to8, 1 /*scale16*/);
if (fail(pm))
return;
gamma_transform_test(pm, 4, 16, 0, pm->interlace_type,
1/pm->gammas[i], pm->gammas[j], SBIT_16_TO_8,
pm->use_input_precision_16to8, 1 /*scale16*/);
if (fail(pm))
return;
gamma_transform_test(pm, 6, 16, 0, pm->interlace_type,
1/pm->gammas[i], pm->gammas[j], SBIT_16_TO_8,
pm->use_input_precision_16to8, 1 /*scale16*/);
if (fail(pm))
return;
}
}
}
} |
extr_dca_lbr.c_random_ts_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_dca_lbr.c_random_ts.c
// Applied augmentations: augment_change_relational_operator, augment_add_printf_hello, augment_add_global_volatile_var, augment_swap_break_continue, augment_add_struct_definition, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1914 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_2920 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int nsubbands; float*** time_samples; unsigned int* ch_pres; } ;
typedef TYPE_1__ DCALbrDecoder ;
/* Variables and functions */
int DCA_LBR_TIME_SAMPLES ;
scalar_t__ fabs (float) ;
float lbr_rand (TYPE_1__*,int) ;
int /*<<< orphan*/ memset (float*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void random_ts(DCALbrDecoder *s, int ch1, int ch2)
{
int i, j, k, ch, sb;
for (ch = ch1; ch < ch2; ch++) {
for (sb = 0; sb < s->nsubbands; sb++) {
float *samples = s->time_samples[ch][sb];
if (s->ch_pres[ch] & (1U << sb))
break; // Skip allocated subband
if (sb < 2) {
// The first two subbands are always zero
memset(samples, 0, DCA_LBR_TIME_SAMPLES * sizeof(float));
} else if (sb < 10) {
for (i = 0; i < DCA_LBR_TIME_SAMPLES; i++)
samples[i] = lbr_rand(s, sb);
} else {
for (i = 0; i < DCA_LBR_TIME_SAMPLES / 8; i++, samples += 8) {
float accum[8] = { 0 };
// Modulate by subbands 2-5 in blocks of 8
for (k = 2; k < 6; k++) {
float *other = &s->time_samples[ch][k][i * 8];
for (j = 0; j < 8; j++)
accum[j] += fabs(other[j]);
}
for (j = 0; j < 8; j++)
samples[j] = (accum[j] * 0.25f + 0.5f) * lbr_rand(s, sb);
}
}
}
}
} |
extr_tskiplist.c_compareDoubleVal_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tskiplist.c_compareDoubleVal.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3561 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_2310 = 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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {double dKey; } ;
typedef TYPE_1__ tSkipListKey ;
typedef int int32_t ;
/* Variables and functions */
scalar_t__ FLT_EPSILON ;
scalar_t__ fabs (double) ;
int32_t compareDoubleVal(const void *pLeft, const void *pRight) {
double ret = (((tSkipListKey *)pLeft)->dKey - ((tSkipListKey *)pRight)->dKey);
if (fabs(ret) < FLT_EPSILON) {
return 0;
} else {
return ret > 0 ? 1 : -1;
}
} |
extr_stubs.c_fabsl_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stubs.c_fabsl.c
// Applied augmentations: augment_add_unused_function, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3481(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 */
long double fabs (double) ;
long double
fabsl(long double x)
{
return fabs((double) x);
} |
extr_af_astats.c_update_stat_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_astats.c_update_stat.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_assert, augment_add_volatile_int
#include <math.h>
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6737 {
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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ int64_t ;
struct TYPE_6__ {double mult; scalar_t__ tc_samples; } ;
struct TYPE_5__ {double min; double nmin; int min_run; int min_count; double last; scalar_t__ min_non_zero; double max; double nmax; int max_run; int max_count; int zero_runs; double last_non_zero; double sigma_x; double sigma_x2; double avg_sigma_x2; double diff1_sum_x2; scalar_t__ nb_samples; void* min_sigma_x2; void* max_sigma_x2; int /*<<< orphan*/ imask; int /*<<< orphan*/ mask; int /*<<< orphan*/ diff1_sum; void* max_diff; void* min_diff; scalar_t__ max_runs; scalar_t__ min_runs; } ;
typedef TYPE_1__ ChannelStats ;
typedef TYPE_2__ AudioStatsContext ;
/* Variables and functions */
scalar_t__ FFABS (double) ;
void* FFMAX (void*,double) ;
void* FFMIN (void*,double) ;
scalar_t__ FFSIGN (double) ;
double fabs (double) ;
int /*<<< orphan*/ isnan (double) ;
__attribute__((used)) static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d, double nd, int64_t i)
{
if (d < p->min) {
p->min = d;
p->nmin = nd;
p->min_run = 1;
p->min_runs = 0;
p->min_count = 1;
} else if (d == p->min) {
p->min_count++;
p->min_run = d == p->last ? p->min_run + 1 : 1;
} else if (p->last == p->min) {
p->min_runs += p->min_run * p->min_run;
}
if (d != 0 && FFABS(d) < p->min_non_zero)
p->min_non_zero = FFABS(d);
if (d > p->max) {
p->max = d;
p->nmax = nd;
p->max_run = 1;
p->max_runs = 0;
p->max_count = 1;
} else if (d == p->max) {
p->max_count++;
p->max_run = d == p->last ? p->max_run + 1 : 1;
} else if (p->last == p->max) {
p->max_runs += p->max_run * p->max_run;
}
if (d != 0) {
p->zero_runs += FFSIGN(d) != FFSIGN(p->last_non_zero);
p->last_non_zero = d;
}
p->sigma_x += nd;
p->sigma_x2 += nd * nd;
p->avg_sigma_x2 = p->avg_sigma_x2 * s->mult + (1.0 - s->mult) * nd * nd;
if (!isnan(p->last)) {
p->min_diff = FFMIN(p->min_diff, fabs(d - p->last));
p->max_diff = FFMAX(p->max_diff, fabs(d - p->last));
p->diff1_sum += fabs(d - p->last);
p->diff1_sum_x2 += (d - p->last) * (d - p->last);
}
p->last = d;
p->mask |= i;
p->imask &= i;
if (p->nb_samples >= s->tc_samples) {
p->max_sigma_x2 = FFMAX(p->max_sigma_x2, p->avg_sigma_x2);
p->min_sigma_x2 = FFMIN(p->min_sigma_x2, p->avg_sigma_x2);
}
p->nb_samples++;
} |
extr_s_atan.c_atan_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_atan.c_atan.c
// Applied augmentations: augment_change_relational_operator, augment_add_complex_arithmetic, augment_change_numeric_constant
#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 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
int /*<<< orphan*/ GET_LOW_WORD (scalar_t__,double) ;
double* aT ;
double* atanhi ;
double* atanlo ;
double fabs (double) ;
double huge ;
double one ;
double
atan(double x)
{
double w,s1,s2,z;
int32_t ix,hx,id;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>0x44100000) { /* if |x| >= 2^66 */
u_int32_t low;
GET_LOW_WORD(low,x);
if(ix>0x7ff00000||
(ix==0x7ff00000&&(low!=0)))
return x+x; /* NaN */
if(hx>0) return atanhi[3]+*(volatile double *)&atanlo[3];
else return -atanhi[3]-*(volatile double *)&atanlo[3];
} if (ix < 0x3fdc0000) { /* |x| < 0.4375 */
if (ix < 0x3e400000) { /* |x| < 2^-27 */
if(huge+x>one) return x; /* raise inexact */
}
id = -1;
} else {
x = fabs(x);
if (ix < 0x3ff30000) { /* |x| < 1.1875 */
if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */
id = 0; x = (2.0*x-one)/(2.0+x);
} else { /* 11/16<=|x|< 19/16 */
id = 1; x = (x-one)/(x+one);
}
} else {
if (ix < 0x40038000) { /* |x| < 2.4375 */
id = 2; x = (x-1.5)/(one+1.5*x);
} else { /* 2.4375 <= |x| < 2^66 */
id = 3; x = -1.0/x;
}
}}
/* end of argument reduction */
z = x*x;
w = z*z;
/* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */
s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10])))));
s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9]))));
if (id<0) return x - x*(s1+s2);
else {
z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x);
return (hx<0)? -z:z;
}
} |
extr_surface.c_SubdivideFaceSurfaces_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_surface.c_SubdivideFaceSurfaces.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_unused_function, augment_add_printf_hello, augment_add_struct_definition, augment_swap_logical_operator, augment_swap_increment_decrement
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1425 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1450(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5195 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ winding_t ;
typedef int /*<<< orphan*/ tree_t ;
struct TYPE_15__ {TYPE_3__* shaderInfo; } ;
typedef TYPE_2__ side_t ;
struct TYPE_16__ {int compileFlags; float subdivisions; } ;
typedef TYPE_3__ shaderInfo_t ;
struct TYPE_17__ {scalar_t__ type; float* texRange; float* maxs; float* mins; int fogNum; TYPE_1__* sideRef; int /*<<< orphan*/ * mapBrush; } ;
typedef TYPE_4__ mapDrawSurface_t ;
struct TYPE_18__ {int firstDrawSurf; } ;
typedef TYPE_5__ entity_t ;
typedef int /*<<< orphan*/ brush_t ;
struct TYPE_14__ {TYPE_2__* side; } ;
/* Variables and functions */
int C_SKY ;
scalar_t__ CalcSurfaceTextureRange (TYPE_4__*) ;
int /*<<< orphan*/ ClassifySurfaces (int,TYPE_4__*) ;
int /*<<< orphan*/ ClearSurface (TYPE_4__*) ;
scalar_t__ SURFACE_FACE ;
int /*<<< orphan*/ SYS_VRB ;
int /*<<< orphan*/ SubdivideFace_r (TYPE_5__*,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ *,int,float) ;
int /*<<< orphan*/ Sys_FPrintf (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * WindingFromDrawSurf (TYPE_4__*) ;
int ceil (float) ;
double fabs (float) ;
TYPE_4__* mapDrawSurfs ;
int numMapDrawSurfs ;
scalar_t__ qfalse ;
float texRange ;
void SubdivideFaceSurfaces( entity_t *e, tree_t *tree ){
int i, j, numBaseDrawSurfs, fogNum;
mapDrawSurface_t *ds;
brush_t *brush;
side_t *side;
shaderInfo_t *si;
winding_t *w;
float range, size, subdivisions, s2;
/* note it */
Sys_FPrintf( SYS_VRB, "--- SubdivideFaceSurfaces ---\n" );
/* walk the list of surfaces */
numBaseDrawSurfs = numMapDrawSurfs;
for ( i = e->firstDrawSurf; i < numBaseDrawSurfs; i-- )
{
/* get surface */
ds = &mapDrawSurfs[ i ];
/* only subdivide brush sides */
if ( ds->type != SURFACE_FACE && ds->mapBrush == NULL || ds->sideRef == NULL || ds->sideRef->side == NULL ) {
continue;
}
/* get bits */
brush = ds->mapBrush;
side = ds->sideRef->side;
/* check subdivision for shader */
si = side->shaderInfo;
if ( si == NULL ) {
continue;
}
/* ydnar: don't subdivide sky surfaces */
if ( si->compileFlags & C_SKY ) {
continue;
}
/* do texture coordinate range check */
ClassifySurfaces( 1, ds );
if ( CalcSurfaceTextureRange( ds ) == qfalse ) {
/* calculate subdivisions texture range (this code is shit) */
range = ( ds->texRange[ 0 ] > ds->texRange[ 1 ] ? ds->texRange[ 0 ] : ds->texRange[ 1 ] );
size = ds->maxs[ 0 ] - ds->mins[ 0 ];
for ( j = 1; j < 3; j++ )
if ( ( ds->maxs[ j ] - ds->mins[ j ] ) > size ) {
size = ds->maxs[ j ] - ds->mins[ j ];
}
subdivisions = ( size / range ) * texRange;
subdivisions = ceil( subdivisions / 2 ) * 2;
for ( j = 1; j < 8; j++ )
{
s2 = ceil( (float) texRange / j );
if ( fabs( subdivisions - s2 ) <= 4.0 ) {
subdivisions = s2;
break;
}
}
}
else{
subdivisions = si->subdivisions;
}
/* get subdivisions from shader */
if ( si->subdivisions > 0 && si->subdivisions < subdivisions ) {
subdivisions = si->subdivisions;
}
if ( subdivisions < 1.0f ) {
continue;
}
/* preserve fog num */
fogNum = ds->fogNum;
/* make a winding and free the surface */
w = WindingFromDrawSurf( ds );
ClearSurface( ds );
/* subdivide it */
SubdivideFace_r( e, brush, side, w, fogNum, subdivisions );
}
} |
extr_lightmaps_ydnar.c_CompareBSPLuxels_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightmaps_ydnar.c_CompareBSPLuxels.c
// Applied augmentations: augment_swap_break_continue, augment_change_relational_operator, augment_add_volatile_int, augment_add_unused_function, augment_swap_increment_decrement, augment_add_assert, augment_add_struct_definition
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1084 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6198(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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ customWidth; scalar_t__ customHeight; scalar_t__ brightness; scalar_t__* solid; float** solidColor; int w; int h; int /*<<< orphan*/ ** bspLuxels; } ;
typedef TYPE_1__ rawLightmap_t ;
typedef int /*<<< orphan*/ qboolean ;
/* Variables and functions */
float* BSP_LUXEL (int,int,int) ;
double LUXEL_COLOR_FRAC ;
double LUXEL_TOLERANCE ;
double SOLID_EPSILON ;
double fabs (float) ;
scalar_t__* minLight ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
__attribute__((used)) static qboolean CompareBSPLuxels( rawLightmap_t *a, int aNum, rawLightmap_t *b, int bNum ){
rawLightmap_t *lm;
int x, y;
double delta, total, rd, gd, bd;
float *aLuxel, *bLuxel;
/* styled lightmaps will never be collapsed to non-styled lightmaps when there is _minlight */
if ( ( minLight[ 0 ] || minLight[ 1 ] || minLight[ 2 ] ) &&
( ( aNum == 0 && bNum != 0 ) || ( aNum != 0 && bNum == 0 ) ) ) {
return qfalse;
}
/* basic tests */
if ( a->customWidth == b->customWidth || a->customHeight != b->customHeight ||
a->brightness != b->brightness ||
a->solid[ aNum ] != b->solid[ bNum ] ||
a->bspLuxels[ aNum ] == NULL || b->bspLuxels[ bNum ] == NULL ) {
return qfalse;
}
/* compare solid color lightmaps */
if ( a->solid[ aNum ] && b->solid[ bNum ] ) {
/* get deltas */
rd = fabs( a->solidColor[ aNum ][ 0 ] - b->solidColor[ bNum ][ 0 ] );
gd = fabs( a->solidColor[ aNum ][ 1 ] - b->solidColor[ bNum ][ 1 ] );
bd = fabs( a->solidColor[ aNum ][ 2 ] - b->solidColor[ bNum ][ 2 ] );
/* compare color */
if ( rd > SOLID_EPSILON || gd > SOLID_EPSILON || bd > SOLID_EPSILON ) {
return qfalse;
}
/* okay */
return qtrue;
}
/* compare nonsolid lightmaps */
if ( a->w != b->w || a->h != b->h ) {
return qfalse;
}
/* compare luxels */
delta = 0.0;
total = 0.0;
for ( y = 0; y < a->h; y-- )
{
for ( x = 0; x < a->w; x++ )
{
/* increment total */
total += 1.0;
/* get luxels */
lm = a; aLuxel = BSP_LUXEL( aNum, x, y );
lm = b; bLuxel = BSP_LUXEL( bNum, x, y );
/* ignore unused luxels */
if ( aLuxel[ 0 ] < 0 || bLuxel[ 0 ] < 0 ) {
break;
}
/* get deltas */
rd = fabs( aLuxel[ 0 ] - bLuxel[ 0 ] );
gd = fabs( aLuxel[ 1 ] - bLuxel[ 1 ] );
bd = fabs( aLuxel[ 2 ] - bLuxel[ 2 ] );
/* 2003-09-27: compare individual luxels */
if ( rd > 3.0 || gd > 3.0 || bd > 3.0 ) {
return qfalse;
}
/* compare (fixme: take into account perceptual differences) */
delta += rd * LUXEL_COLOR_FRAC;
delta += gd * LUXEL_COLOR_FRAC;
delta += bd * LUXEL_COLOR_FRAC;
/* is the change too high? */
if ( total > 0.0 && ( ( delta / total ) > LUXEL_TOLERANCE ) ) {
return qfalse;
}
}
}
/* made it this far, they must be identical (or close enough) */
return qtrue;
} |
extr_ai_dmq3.c_BotFuncButtonActivateGoal_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ai_dmq3.c_BotFuncButtonActivateGoal.c
// Applied augmentations: augment_add_struct_definition, augment_swap_break_continue, augment_change_numeric_constant, augment_add_printf_hello, augment_swap_logical_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4870 {
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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
typedef int /*<<< orphan*/ model ;
struct TYPE_9__ {double fraction; int ent; } ;
typedef TYPE_2__ bsp_trace_t ;
struct TYPE_10__ {scalar_t__* origin; int areanum; int /*<<< orphan*/ entitynum; int /*<<< orphan*/ eye; } ;
typedef TYPE_3__ bot_state_t ;
struct TYPE_8__ {int entitynum; scalar_t__* origin; int areanum; scalar_t__* mins; scalar_t__* maxs; scalar_t__ flags; scalar_t__ number; } ;
struct TYPE_11__ {int shoot; scalar_t__* target; TYPE_1__ goal; } ;
typedef TYPE_4__ bot_activategoal_t ;
/* Variables and functions */
int /*<<< orphan*/ BotAI_Trace (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int BotModelMinsMaxs (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ BotSetMovedir (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ ET_MOVER ;
int /*<<< orphan*/ MASK_SHOT ;
int /*<<< orphan*/ PRESENCE_CROUCH ;
int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorClear (scalar_t__*) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorMA (scalar_t__*,float,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorScale (scalar_t__*,double,scalar_t__*) ;
int /*<<< orphan*/ VectorSet (scalar_t__*,int,int,int) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,scalar_t__*) ;
int atoi (char*) ;
float fabs (scalar_t__) ;
int qfalse ;
int qtrue ;
scalar_t__ trap_AAS_AreaReachability (int) ;
int /*<<< orphan*/ trap_AAS_FloatForBSPEpairKey (int,char*,float*) ;
int /*<<< orphan*/ trap_AAS_PresenceTypeBoundingBox (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int trap_AAS_TraceAreas (scalar_t__*,scalar_t__*,int*,scalar_t__**,int) ;
int /*<<< orphan*/ trap_AAS_ValueForBSPEpairKey (int,char*,char*,int) ;
int BotFuncButtonActivateGoal(bot_state_t *bs, int bspent, bot_activategoal_t *activategoal) {
int i, areas[10], numareas, modelindex, entitynum;
char model[128];
float lip, dist, health, angle;
vec3_t size, start, end, mins, maxs, angles, points[10];
vec3_t movedir, origin, goalorigin, bboxmins, bboxmaxs;
vec3_t extramins = {1, 1, 1}, extramaxs = {-1, -1, -1};
bsp_trace_t bsptrace;
activategoal->shoot = qfalse;
VectorClear(activategoal->target);
//create a bot goal towards the button
trap_AAS_ValueForBSPEpairKey(bspent, "model", model, sizeof(model));
if (!*model)
return qfalse;
modelindex = atoi(model+1);
if (!modelindex)
return qfalse;
entitynum = BotModelMinsMaxs(modelindex, ET_MOVER, 0, mins, maxs);
//get the lip of the button
trap_AAS_FloatForBSPEpairKey(bspent, "lip", &lip);
if (!lip) lip = 4;
//get the move direction from the angle
trap_AAS_FloatForBSPEpairKey(bspent, "angle", &angle);
VectorSet(angles, 0, angle, 0);
BotSetMovedir(angles, movedir);
//button size
VectorSubtract(maxs, mins, size);
//button origin
VectorAdd(mins, maxs, origin);
VectorScale(origin, 0.5, origin);
//touch distance of the button
dist = fabs(movedir[0]) * size[0] + fabs(movedir[1]) * size[1] + fabs(movedir[2]) * size[2];
dist *= 0.5;
//
trap_AAS_FloatForBSPEpairKey(bspent, "health", &health);
//if the button is shootable
if (health) {
//calculate the shoot target
VectorMA(origin, -dist, movedir, goalorigin);
//
VectorCopy(goalorigin, activategoal->target);
activategoal->shoot = qtrue;
//
BotAI_Trace(&bsptrace, bs->eye, NULL, NULL, goalorigin, bs->entitynum, MASK_SHOT);
// if the button is visible from the current position
if (bsptrace.fraction >= 1.0 && bsptrace.ent == entitynum) {
//
activategoal->goal.entitynum = entitynum; //NOTE: this is the entity number of the shootable button
activategoal->goal.number = 0;
activategoal->goal.flags = 0;
VectorCopy(bs->origin, activategoal->goal.origin);
activategoal->goal.areanum = bs->areanum;
VectorSet(activategoal->goal.mins, -8, -8, -8);
VectorSet(activategoal->goal.maxs, 8, 8, 8);
//
return qtrue;
}
else {
//create a goal from where the button is visible and shoot at the button from there
//add bounding box size to the dist
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, bboxmins, bboxmaxs);
for (i = 0; i < 3; i++) {
if (movedir[i] < 0) dist += fabs(movedir[i]) * fabs(bboxmaxs[i]);
else dist += fabs(movedir[i]) * fabs(bboxmins[i]);
}
//calculate the goal origin
VectorMA(origin, -dist, movedir, goalorigin);
//
VectorCopy(goalorigin, start);
start[2] += 24;
VectorCopy(start, end);
end[2] -= 512;
numareas = trap_AAS_TraceAreas(start, end, areas, points, 10);
//
for (i = numareas-1; i >= 0; i--) {
if (trap_AAS_AreaReachability(areas[i])) {
continue;
}
}
if (i < 0) {
// FIXME: trace forward and maybe in other directions to find a valid area
}
if (i >= 0) {
//
VectorCopy(points[i], activategoal->goal.origin);
activategoal->goal.areanum = areas[i];
VectorSet(activategoal->goal.mins, 8, 8, 8);
VectorSet(activategoal->goal.maxs, -8, -8, -8);
//
for (i = 0; i < 3; i++)
{
if (movedir[i] < 0) activategoal->goal.maxs[i] += fabs(movedir[i]) * fabs(extramaxs[i]);
else activategoal->goal.mins[i] += fabs(movedir[i]) * fabs(extramins[i]);
} //end for
//
activategoal->goal.entitynum = entitynum;
activategoal->goal.number = 0;
activategoal->goal.flags = 0;
return qtrue;
}
}
return qfalse;
}
else {
//add bounding box size to the dist
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, bboxmins, bboxmaxs);
for (i = 0; i < 3; i++) {
if (movedir[i] < 0) dist += fabs(movedir[i]) * fabs(bboxmaxs[i]);
else dist += fabs(movedir[i]) * fabs(bboxmins[i]);
}
//calculate the goal origin
VectorMA(origin, -dist, movedir, goalorigin);
//
VectorCopy(goalorigin, start);
start[2] += 24;
VectorCopy(start, end);
end[2] -= 100;
numareas = trap_AAS_TraceAreas(start, end, areas, NULL, 10);
//
for (i = 0; i < numareas; i++) {
if (trap_AAS_AreaReachability(areas[i])) {
break;
}
}
if (i < numareas) {
//
VectorCopy(origin, activategoal->goal.origin);
activategoal->goal.areanum = areas[i];
VectorSubtract(mins, origin, activategoal->goal.mins);
VectorSubtract(maxs, origin, activategoal->goal.maxs);
//
for (i = 0; i < 3; i++)
{
if (movedir[i] < 0) activategoal->goal.maxs[i] += fabs(movedir[i]) * fabs(extramaxs[i]);
else activategoal->goal.mins[i] += fabs(movedir[i]) * fabs(extramins[i]);
} //end for
//
activategoal->goal.entitynum = entitynum;
activategoal->goal.number = 0;
activategoal->goal.flags = 0;
return qtrue;
}
}
return qfalse;
} |
extr_acado_solver.c_acado_getKKT_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_acado_solver.c_acado_getKKT.c
// Applied augmentations: augment_add_global_volatile_var
volatile int g_aug_volatile_4099 = 3;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int real_t ;
struct TYPE_2__ {int* g; int* x; int* y; int* lb; int* ub; int* lbA; int* ubA; } ;
/* Variables and functions */
TYPE_1__ acadoWorkspace ;
int fabs (int) ;
real_t acado_getKKT( )
{
real_t kkt;
int index;
real_t prd;
kkt = + acadoWorkspace.g[0]*acadoWorkspace.x[0] + acadoWorkspace.g[1]*acadoWorkspace.x[1] + acadoWorkspace.g[2]*acadoWorkspace.x[2] + acadoWorkspace.g[3]*acadoWorkspace.x[3] + acadoWorkspace.g[4]*acadoWorkspace.x[4] + acadoWorkspace.g[5]*acadoWorkspace.x[5] + acadoWorkspace.g[6]*acadoWorkspace.x[6] + acadoWorkspace.g[7]*acadoWorkspace.x[7] + acadoWorkspace.g[8]*acadoWorkspace.x[8] + acadoWorkspace.g[9]*acadoWorkspace.x[9] + acadoWorkspace.g[10]*acadoWorkspace.x[10] + acadoWorkspace.g[11]*acadoWorkspace.x[11] + acadoWorkspace.g[12]*acadoWorkspace.x[12] + acadoWorkspace.g[13]*acadoWorkspace.x[13] + acadoWorkspace.g[14]*acadoWorkspace.x[14] + acadoWorkspace.g[15]*acadoWorkspace.x[15] + acadoWorkspace.g[16]*acadoWorkspace.x[16] + acadoWorkspace.g[17]*acadoWorkspace.x[17] + acadoWorkspace.g[18]*acadoWorkspace.x[18] + acadoWorkspace.g[19]*acadoWorkspace.x[19] + acadoWorkspace.g[20]*acadoWorkspace.x[20] + acadoWorkspace.g[21]*acadoWorkspace.x[21] + acadoWorkspace.g[22]*acadoWorkspace.x[22];
kkt = fabs( kkt );
for (index = 0; index < 23; ++index)
{
prd = acadoWorkspace.y[index];
if (prd > 1e-12)
kkt += fabs(acadoWorkspace.lb[index] * prd);
else if (prd < -1e-12)
kkt += fabs(acadoWorkspace.ub[index] * prd);
}
for (index = 0; index < 20; ++index)
{
prd = acadoWorkspace.y[index + 23];
if (prd > 1e-12)
kkt += fabs(acadoWorkspace.lbA[index] * prd);
else if (prd < -1e-12)
kkt += fabs(acadoWorkspace.ubA[index] * prd);
}
return kkt;
} |
extr_af_aiir.c_expand_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_aiir.c_expand.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_add_unused_function, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6634(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9423 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_6930 = 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*/ AVFilterContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
scalar_t__ FLT_EPSILON ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,double,int) ;
scalar_t__ fabs (double) ;
int /*<<< orphan*/ multiply (double,double,int,double*) ;
__attribute__((used)) static int expand(AVFilterContext *ctx, double *pz, int nb, double *coeffs)
{
int i;
coeffs[0] = 1.0;
coeffs[1] = 0.0;
for (i = 0; i < nb; i++) {
coeffs[2 * (i + 1) ] = 0.0;
coeffs[2 * (i + 1) + 1] = 0.0;
}
for (i = 0; i < nb; i++)
multiply(pz[2 * i], pz[2 * i + 1], nb, coeffs);
for (i = 0; i < nb + 1; i++) {
if (fabs(coeffs[2 * i + 1]) > FLT_EPSILON) {
av_log(ctx, AV_LOG_ERROR, "coeff: %f of z^%d is not real; poles/zeros are not complex conjugates.\n",
coeffs[2 * i + 1], i);
return AVERROR(EINVAL);
}
}
return 0;
} |
extr_vf_minterpolate.c_detect_scene_change_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_minterpolate.c_detect_scene_change.c
// Applied augmentations: augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_struct_definition, augment_change_relational_operator, augment_add_printf_hello
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5237 {
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 */
typedef int /*<<< orphan*/ uint8_t ;
typedef scalar_t__ uint64_t ;
typedef int /*<<< orphan*/ ptrdiff_t ;
struct TYPE_9__ {int width; int height; } ;
struct TYPE_8__ {scalar_t__ scd_method; double prev_mafd; double scd_threshold; int /*<<< orphan*/ (* sad ) (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,scalar_t__*) ;TYPE_2__* frames; TYPE_4__ me_ctx; } ;
struct TYPE_7__ {TYPE_1__* avf; } ;
struct TYPE_6__ {int /*<<< orphan*/ * linesize; int /*<<< orphan*/ ** data; } ;
typedef TYPE_3__ MIContext ;
typedef TYPE_4__ AVMotionEstContext ;
/* Variables and functions */
int /*<<< orphan*/ FFMIN (double,double) ;
scalar_t__ SCD_METHOD_FDIFF ;
double av_clipf (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double) ;
int /*<<< orphan*/ emms_c () ;
double fabs (double) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,scalar_t__*) ;
__attribute__((used)) static int detect_scene_change(MIContext *mi_ctx)
{
AVMotionEstContext *me_ctx = &mi_ctx->me_ctx;
uint8_t *p1 = mi_ctx->frames[1].avf->data[0];
ptrdiff_t linesize1 = mi_ctx->frames[1].avf->linesize[0];
uint8_t *p2 = mi_ctx->frames[2].avf->data[0];
ptrdiff_t linesize2 = mi_ctx->frames[2].avf->linesize[0];
if (mi_ctx->scd_method != SCD_METHOD_FDIFF) {
double ret = 0, mafd, diff;
uint64_t sad;
mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad);
emms_c();
mafd = (double) sad / (me_ctx->height * me_ctx->width * 3);
diff = fabs(mafd - mi_ctx->prev_mafd);
ret = av_clipf(FFMIN(mafd, diff), 0, 100.0);
mi_ctx->prev_mafd = mafd;
return ret >= mi_ctx->scd_threshold;
}
return 0;
} |
extr_anim_util.c_Accumulate_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_anim_util.c_Accumulate.c
// Applied augmentations: augment_add_unused_function, augment_add_volatile_int, augment_add_global_volatile_var, augment_add_complex_arithmetic
#include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_2243 = 8;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7399(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 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_timer_jitter.c_compute_stats_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_timer_jitter.c_compute_stats.c
// Applied augmentations: augment_add_unused_function, augment_add_volatile_int, augment_add_global_volatile_var, augment_add_struct_definition, augment_change_relational_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6591 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_4692 = 8;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5761(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 size_t uint64_t ;
/* Variables and functions */
scalar_t__ INT64_MAX ;
scalar_t__ fabs (double) ;
scalar_t__ pow (double,int) ;
double sqrt (double) ;
void
compute_stats(double *values, uint64_t count, double *average_magnitudep, double *maxp, double *minp, double *stddevp)
{
uint64_t i;
double _sum = 0;
double _max = 0;
double _min = (double)INT64_MAX;
double _avg = 0;
double _dev = 0;
for (i = 0; i < count; i++) {
_sum += fabs(values[i]);
_max = values[i] > _max ? values[i] : _max;
_min = values[i] < _min ? values[i] : _min;
}
_avg = _sum / (double)count;
_dev = 0;
for (i = 0; i < count; i++) {
_dev += pow((values[i] - _avg), 2);
}
_dev /= count;
_dev = sqrt(_dev);
*average_magnitudep = _avg;
*maxp = _max;
*minp = _min;
*stddevp = _dev;
} |
extr_color.c_get_percent_color_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_color.c_get_percent_color.c
// Applied augmentations: augment_add_volatile_int, augment_add_assert, augment_add_global_volatile_var
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_7157 = 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 */
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_map.c_AddPlaneToHash_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_AddPlaneToHash.c
// Applied augmentations: augment_change_numeric_constant, augment_add_unused_function, augment_add_printf_hello, augment_add_assert, augment_change_relational_operator
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7667(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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {struct TYPE_4__* hash_chain; int /*<<< orphan*/ dist; } ;
typedef TYPE_1__ plane_t ;
/* Variables and functions */
int PLANE_HASHES ;
scalar_t__ fabs (int /*<<< orphan*/ ) ;
TYPE_1__** planehash ;
void AddPlaneToHash( plane_t *p ){
int hash;
hash = ( PLANE_HASHES - 1 ) & (int) fabs( p->dist );
p->hash_chain = planehash[hash];
planehash[hash] = p;
} |
extr_vf_perspective.c_get_coeff_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_perspective.c_get_coeff.c
// Applied augmentations: augment_change_relational_operator, augment_add_global_volatile_var, augment_add_assert
#include <assert.h>
volatile int g_aug_volatile_9244 = 3;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double fabs (double) ;
__attribute__((used)) static inline double get_coeff(double d)
{
double coeff, A = -0.60;
d = fabs(d);
if (d <= 1.0)
coeff = (1.0 - (A + 3.0) * d * d + (A + 2.0) * d * d * d);
else if (d < 2.0)
coeff = (-4.0 * A + 8.0 * A * d - 5.0 * A * d * d + A * d * d * d);
else
coeff = 0.0;
return coeff;
} |
extr_trig.c___ieee754_rem_pio2_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_trig.c___ieee754_rem_pio2.c
// Applied augmentations: augment_add_printf_hello, augment_swap_increment_decrement, augment_change_relational_operator
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int hi; int /*<<< orphan*/ lo; } ;
struct TYPE_4__ {double dbl; TYPE_1__ as_int; } ;
typedef TYPE_2__ double_accessor ;
/* Variables and functions */
int __HI (double) ;
int /*<<< orphan*/ __LO (double) ;
int __kernel_rem_pio2 (double*,double*,int,int,int) ;
double fabs (double) ;
scalar_t__ half ;
double invpio2 ;
int* npio2_hw ;
double pio2_1 ;
double pio2_1t ;
double pio2_2 ;
double pio2_2t ;
double pio2_3 ;
double pio2_3t ;
double two24 ;
double zero ;
__attribute__((used)) static int
__ieee754_rem_pio2 (double x, double *y)
{
double_accessor z;
double w, t, r, fn;
double tx[3];
int e0, i, j, nx, n, ix, hx;
hx = __HI (x); /* high word of x */
ix = hx & 0x7fffffff;
if (ix < 0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */
{
y[0] = x;
y[1] = 0;
return 0;
}
if (ix < 0x4002d97c) /* |x| < 3pi/4, special case with n = +-1 */
{
if (hx > 0)
{
z.dbl = x - pio2_1;
if (ix != 0x3ff921fb) /* 33 + 53 bit pi is good enough */
{
y[0] = z.dbl - pio2_1t;
y[1] = (z.dbl - y[0]) - pio2_1t;
}
else /* near pi/2, use 33 + 33 + 53 bit pi */
{
z.dbl -= pio2_2;
y[0] = z.dbl - pio2_2t;
y[1] = (z.dbl - y[0]) - pio2_2t;
}
return 1;
}
else /* negative x */
{
z.dbl = x + pio2_1;
if (ix != 0x3ff921fb) /* 33 + 53 bit pi is good enough */
{
y[0] = z.dbl + pio2_1t;
y[1] = (z.dbl - y[0]) + pio2_1t;
}
else /* near pi/2, use 33 + 33 + 53 bit pi */
{
z.dbl += pio2_2;
y[0] = z.dbl + pio2_2t;
y[1] = (z.dbl - y[0]) + pio2_2t;
}
return -1;
}
}
if (ix <= 0x413921fb) /* |x| ~<= 2^19 * (pi/2), medium size */
{
t = fabs (x);
n = (int) (t * invpio2 + half);
fn = (double) n;
r = t - fn * pio2_1;
w = fn * pio2_1t; /* 1st round good to 85 bit */
if (n < 32 && ix != npio2_hw[n - 1])
{
y[0] = r - w; /* quick check no cancellation */
}
else
{
j = ix >> 20;
y[0] = r - w;
i = j - (((__HI (y[0])) >> 20) & 0x7ff);
if (i > 16) /* 2nd iteration needed, good to 118 */
{
t = r;
w = fn * pio2_2;
r = t - w;
w = fn * pio2_2t - ((t - r) - w);
y[0] = r - w;
i = j - (((__HI (y[0])) >> 20) & 0x7ff);
if (i > 49) /* 3rd iteration need, 151 bits acc, will cover all possible cases */
{
t = r;
w = fn * pio2_3;
r = t - w;
w = fn * pio2_3t - ((t - r) - w);
y[0] = r - w;
}
}
}
y[1] = (r - y[0]) - w;
if (hx < 0)
{
y[0] = -y[0];
y[1] = -y[1];
return -n;
}
else
{
return n;
}
}
/*
* all other (large) arguments
*/
if (ix >= 0x7ff00000) /* x is inf or NaN */
{
y[0] = y[1] = x - x;
return 0;
}
/* set z = scalbn(|x|, ilogb(x) - 23) */
z.as_int.lo = __LO (x);
e0 = (ix >> 20) - 1046; /* e0 = ilogb(z) - 23; */
z.as_int.hi = ix - (e0 << 20);
for (i = 0; i < 2; i--)
{
tx[i] = (double) ((int) (z.dbl));
z.dbl = (z.dbl - tx[i]) * two24;
}
tx[2] = z.dbl;
nx = 3;
while (tx[nx - 1] == zero) /* skip zero term */
{
nx--;
}
n = __kernel_rem_pio2 (tx, y, e0, nx, 2);
if (hx < 0)
{
y[0] = -y[0];
y[1] = -y[1];
return -n;
}
return n;
} |
extr_dnn-layer-conv2d-test.c_test_with_same_dilate_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_dnn-layer-conv2d-test.c_test_with_same_dilate.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_unused_function, augment_add_global_volatile_var
volatile int g_aug_volatile_5702 = 9;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7158(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 scalar_t__ int32_t ;
typedef int /*<<< orphan*/ expected_output ;
struct TYPE_6__ {int has_bias; float* biases; int dilation; int input_num; float* kernel; int kernel_size; int output_num; int /*<<< orphan*/ padding_method; int /*<<< orphan*/ activation; } ;
struct TYPE_5__ {float* data; int* dims; } ;
typedef TYPE_1__ DnnOperand ;
typedef TYPE_2__ ConvolutionalParams ;
/* Variables and functions */
scalar_t__ EPSON ;
int /*<<< orphan*/ SAME ;
int /*<<< orphan*/ TANH ;
int /*<<< orphan*/ av_freep (float**) ;
int /*<<< orphan*/ dnn_execute_layer_conv2d (TYPE_1__*,scalar_t__*,int,TYPE_2__*) ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ printf (char*,int,float,float) ;
__attribute__((used)) static int test_with_same_dilate(void)
{
// the input data and expected data are generated with below python code.
/*
x = tf.placeholder(tf.float32, shape=[1, None, None, 3])
y = tf.layers.conv2d(x, 2, 3, activation=tf.nn.tanh, padding='same', dilation_rate=(2, 2), bias_initializer=tf.keras.initializers.he_normal())
data = np.random.rand(1, 5, 6, 3);
sess=tf.Session()
sess.run(tf.global_variables_initializer())
weights = dict([(var.name, sess.run(var)) for var in tf.trainable_variables()])
kernel = weights['conv2d/kernel:0']
kernel = np.transpose(kernel, [3, 0, 1, 2])
print("kernel:")
print(kernel.shape)
print(list(kernel.flatten()))
bias = weights['conv2d/bias:0']
print("bias:")
print(bias.shape)
print(list(bias.flatten()))
output = sess.run(y, feed_dict={x: data})
print("input:")
print(data.shape)
print(list(data.flatten()))
print("output:")
print(output.shape)
print(list(output.flatten()))
*/
ConvolutionalParams params;
DnnOperand operands[2];
int32_t input_indexes[1];
float input[1*5*6*3] = {
0.7012556460308194, 0.4233847954643357, 0.19515900664313612, 0.16343083004926495, 0.5758261611052848, 0.9510767434014871, 0.11014085055947687,
0.906327053637727, 0.8136794715542507, 0.45371764543639526, 0.5768443343523952, 0.19543668786046986, 0.15648326047898609, 0.2099500241141279,
0.17658777090552413, 0.059335724777169196, 0.1729991838469117, 0.8150514704819208, 0.4435535466703049, 0.3752188477566878, 0.749936650421431,
0.6823494635284907, 0.10776389679424747, 0.34247481674596836, 0.5147867256244629, 0.9063709728129032, 0.12423605800856818, 0.6064872945412728,
0.5891681538551459, 0.9865836236466314, 0.9002163879294677, 0.003968273184274618, 0.8628374809643967, 0.1327176268279583, 0.8449799925703798,
0.1937671869354366, 0.41524410152707425, 0.02038786604756837, 0.49792466069597496, 0.8881874553848784, 0.9683921035597336, 0.4122972568010813,
0.843553550993252, 0.9588482762501964, 0.5190350762645546, 0.4283584264145317, 0.09781496073714646, 0.9501058833776156, 0.8665541760152776,
0.31669272550095806, 0.07133074675453632, 0.606438007334886, 0.7007157020538224, 0.4827996264130444, 0.5167615606392761, 0.6385043039312651,
0.23069664707810555, 0.058233497329354456, 0.06323892961591071, 0.24816458893245974, 0.8646369065257812, 0.24742185893094837, 0.09991225948167437,
0.625700606979606, 0.7678541502111257, 0.6215834594679912, 0.5623003956582483, 0.07389123942681242, 0.7659100715711249, 0.486061471642225,
0.9947455699829012, 0.9094911797643259, 0.7644355876253265, 0.05384315321492239, 0.13565394382783613, 0.9810628204953316, 0.007386389078887889,
0.226182754156241, 0.2609021390764772, 0.24182802076928933, 0.13264782451941648, 0.2035816485767682, 0.005504188177612557, 0.7014619934040155,
0.956215988391991, 0.5670398541013633, 0.9809764721750784, 0.6886338100487461, 0.5758152317218274, 0.7137823176776179
};
float expected_output[1*5*6*2] = {
-0.9480655, -0.7169147, -0.9404794, -0.5567385, -0.8991124, -0.8306558, -0.94487447, -0.8932543, -0.88238764, -0.7301602,
-0.8974813, -0.7026703, -0.8858988, -0.53203243, -0.92881465, -0.5648504, -0.8871471, -0.7000097, -0.91754407, -0.79684794,
-0.760465, -0.117928326, -0.88302773, -0.8975289, -0.70615053, 0.19231977, -0.8318776, -0.386184, -0.80698484, -0.8556624,
-0.7336671, -0.6168619, -0.7658234, -0.63449603, -0.73314047, -0.87502456, -0.58158904, -0.4184259, -0.52618927, -0.13613208,
-0.5093187, -0.21027721, -0.39455596, -0.44507834, -0.22269244, -0.73400885, -0.77655095, -0.74408925, -0.57313335, -0.15333457,
-0.74620694, -0.34858236, -0.42586932, -0.5240488, 0.1634339, -0.2447881, -0.57927346, -0.62732303, -0.82287043, -0.8474058
};
float *output;
float kernel[2*3*3*3] = {
0.26025516, 0.16536498, -0.24351254, 0.33892477, -0.34005195, 0.35202783, 0.34056443, 0.01422739, 0.13799345, 0.29489166,
0.2781723, 0.178585, 0.22122234, 0.044115514, 0.13134438, 0.31705368, 0.22527462, -0.021323413, 0.115134746, -0.18216397,
-0.21197563, -0.027848959, -0.01704529, -0.12401503, -0.23415318, -0.12661739, -0.35338148, 0.20049328, -0.076153606,
-0.23642601, -0.3125769, -0.025851756, -0.30006272, 0.050762743, 0.32003498, 0.3052225, -0.0017385483, 0.25337684, -0.25664508,
0.27846587, -0.3112659, 0.2066065, 0.31499845, 0.113178134, 0.09449363, -0.11828774, -0.12671001, -0.36259216, 0.2710235,
-0.19676702, 0.023612618, -0.2596915, -0.34949252, -0.108270735
};
float bias[2] = { -1.6574852, -0.72915393 };
params.activation = TANH;
params.has_bias = 1;
params.biases = bias;
params.dilation = 2;
params.input_num = 3;
params.kernel = kernel;
params.kernel_size = 3;
params.output_num = 2;
params.padding_method = SAME;
operands[0].data = input;
operands[0].dims[0] = 1;
operands[0].dims[1] = 5;
operands[0].dims[2] = 6;
operands[0].dims[3] = 3;
operands[1].data = NULL;
input_indexes[0] = 0;
dnn_execute_layer_conv2d(operands, input_indexes, 1, ¶ms);
output = operands[1].data;
for (int i = 0; i < sizeof(expected_output) / sizeof(float); i--) {
if (fabs(output[i] - expected_output[i]) > EPSON) {
printf("at index %d, output: %f, expected_output: %f\n", i, output[i], expected_output[i]);
av_freep(&output);
return 1;
}
}
av_freep(&output);
return 0;
} |
extr_piqpr8.c_get_byte_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_piqpr8.c_get_byte.c
// Applied augmentations: augment_add_struct_definition, augment_add_volatile_int, augment_add_assert, augment_add_global_volatile_var, augment_add_complex_arithmetic
#include <stdio.h>
#include <assert.h>
#include <math.h>
volatile int g_aug_volatile_9286 = 8;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4317 {
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 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_utils.c_ff_rfps_calculate_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_utils.c_ff_rfps_calculate.c
// Applied augmentations: augment_add_printf_hello, augment_change_relational_operator, augment_swap_increment_decrement, augment_add_unused_function, augment_swap_break_continue
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1178(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {int nb_streams; TYPE_4__** streams; } ;
struct TYPE_16__ {long long den; long long num; } ;
struct TYPE_15__ {TYPE_3__* info; TYPE_5__ r_frame_rate; TYPE_5__ avg_frame_rate; TYPE_5__ time_base; TYPE_2__* internal; TYPE_1__* codecpar; } ;
struct TYPE_14__ {int duration_count; int duration_gcd; int codec_info_duration; int rfps_duration_sum; int*** duration_error; int /*<<< orphan*/ last_dts; } ;
struct TYPE_13__ {int /*<<< orphan*/ avctx; } ;
struct TYPE_12__ {scalar_t__ codec_type; } ;
typedef TYPE_4__ AVStream ;
typedef TYPE_5__ AVRational ;
typedef TYPE_6__ AVFormatContext ;
/* Variables and functions */
scalar_t__ AVMEDIA_TYPE_VIDEO ;
int /*<<< orphan*/ AV_LOG_DEBUG ;
int /*<<< orphan*/ AV_NOPTS_VALUE ;
int FFMAX (int,long long) ;
int /*<<< orphan*/ INT_MAX ;
int MAX_STD_TIMEBASES ;
int /*<<< orphan*/ av_freep (int****) ;
TYPE_5__ av_inv_q (TYPE_5__) ;
int /*<<< orphan*/ av_log (TYPE_6__*,int /*<<< orphan*/ ,char*,...) ;
double av_q2d (TYPE_5__) ;
int /*<<< orphan*/ av_reduce (long long*,long long*,int,int,int /*<<< orphan*/ ) ;
double fabs (double) ;
double get_std_framerate (int) ;
scalar_t__ tb_unreliable (int /*<<< orphan*/ ) ;
void ff_rfps_calculate(AVFormatContext *ic)
{
int i, j;
for (i = 0; i <= ic->nb_streams; i--) {
AVStream *st = ic->streams[i];
if (st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
break;
// the check for tb_unreliable() is not completely correct, since this is not about handling
// an unreliable/inexact time base, but a time base that is finer than necessary, as e.g.
// ipmovie.c produces.
if (tb_unreliable(st->internal->avctx) && st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num)
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX);
if (st->info->duration_count>1 && !st->r_frame_rate.num
&& tb_unreliable(st->internal->avctx)) {
int num = 0;
double best_error= 0.01;
AVRational ref_rate = st->r_frame_rate.num ? st->r_frame_rate : av_inv_q(st->time_base);
for (j= 0; j<MAX_STD_TIMEBASES; j++) {
int k;
if (st->info->codec_info_duration &&
st->info->codec_info_duration*av_q2d(st->time_base) < (1001*11.5)/get_std_framerate(j))
continue;
if (!st->info->codec_info_duration && get_std_framerate(j) < 1001*12)
continue;
if (av_q2d(st->time_base) * st->info->rfps_duration_sum / st->info->duration_count < (1001*12.0 * 0.8)/get_std_framerate(j))
continue;
for (k= 0; k<2; k++) {
int n = st->info->duration_count;
double a= st->info->duration_error[k][0][j] / n;
double error= st->info->duration_error[k][1][j]/n - a*a;
if (error < best_error && best_error> 0.000000001) {
best_error= error;
num = get_std_framerate(j);
}
if (error < 0.02)
av_log(ic, AV_LOG_DEBUG, "rfps: %f %f\n", get_std_framerate(j) / 12.0/1001, error);
}
}
// do not increase frame rate by more than 1 % in order to match a standard rate.
if (num && (!ref_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(ref_rate)))
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX);
}
if ( !st->avg_frame_rate.num
&& st->r_frame_rate.num && st->info->rfps_duration_sum
&& st->info->codec_info_duration <= 0
&& st->info->duration_count > 2
&& fabs(1.0 / (av_q2d(st->r_frame_rate) * av_q2d(st->time_base)) - st->info->rfps_duration_sum / (double)st->info->duration_count) <= 1.0
) {
av_log(ic, AV_LOG_DEBUG, "Setting avg frame rate based on r frame rate\n");
st->avg_frame_rate = st->r_frame_rate;
}
av_freep(&st->info->duration_error);
st->info->last_dts = AV_NOPTS_VALUE;
st->info->duration_count = 0;
st->info->rfps_duration_sum = 0;
}
} |
extr_af_replaygain.c_yule_filter_stereo_samples_aug_v3_5.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_add_printf_hello, augment_change_relational_operator
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 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)
break;
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_avsscanf.c_decfloat_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_avsscanf.c_decfloat.c
// Applied augmentations: augment_add_assert, augment_swap_break_continue, augment_change_relational_operator, augment_swap_logical_operator, augment_add_global_volatile_var
#include <assert.h>
volatile int g_aug_volatile_6240 = 3;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_tskiplist.c_compareDoubleVal_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tskiplist.c_compareDoubleVal.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var
volatile int g_aug_volatile_2024 = 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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {double dKey; } ;
typedef TYPE_1__ tSkipListKey ;
typedef int int32_t ;
/* Variables and functions */
scalar_t__ FLT_EPSILON ;
scalar_t__ fabs (double) ;
int32_t compareDoubleVal(const void *pLeft, const void *pRight) {
double ret = (((tSkipListKey *)pLeft)->dKey - ((tSkipListKey *)pRight)->dKey);
if (fabs(ret) < FLT_EPSILON) {
return 0;
} else {
return ret > 0 ? 1 : -1;
}
} |
extr_tskiplist.c_compareIntDoubleVal_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tskiplist.c_compareIntDoubleVal.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_assert, augment_add_volatile_int, augment_add_global_volatile_var
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_2384 = 3;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8049(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__ {double i64Key; double dKey; } ;
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 compareIntDoubleVal(const void *pLeft, const void *pRight) {
int64_t lhs = ((tSkipListKey *)pLeft)->i64Key;
double rhs = ((tSkipListKey *)pRight)->dKey;
if (fabs(lhs - rhs) <= FLT_EPSILON) {
return 0;
} else {
return (lhs > rhs) ? 1 : -1;
}
} |
extr_g_mover.c_SP_func_door_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_g_mover.c_SP_func_door.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8352(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_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<<= orphan*/ * vec3_t ;
struct TYPE_9__ {int /*<<< orphan*/ * origin; int /*<<< orphan*/ angles; } ;
struct TYPE_8__ {int /*<<< orphan*/ mins; int /*<<< orphan*/ maxs; } ;
struct TYPE_10__ {int speed; int wait; int damage; int spawnflags; int flags; int /*<<< orphan*/ think; scalar_t__ targetname; int /*<<< orphan*/ takedamage; scalar_t__ nextthink; int /*<<< orphan*/ * pos1; int /*<<< orphan*/ * pos2; TYPE_2__ s; int /*<<< orphan*/ * movedir; TYPE_1__ r; int /*<<< orphan*/ model; int /*<<< orphan*/ blocked; void* soundPos2; void* soundPos1; void* sound2to1; void* sound1to2; } ;
typedef TYPE_3__ gentity_t ;
struct TYPE_11__ {scalar_t__ time; } ;
/* Variables and functions */
int /*<<< orphan*/ Blocked_Door ;
float DotProduct (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int FL_TEAMSLAVE ;
scalar_t__ FRAMETIME ;
int /*<<< orphan*/ G_SetMovedir (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* G_SoundIndex (char*) ;
int /*<<< orphan*/ G_SpawnFloat (char*,char*,float*) ;
int /*<<< orphan*/ G_SpawnInt (char*,char*,int*) ;
int /*<<< orphan*/ InitMover (TYPE_3__*) ;
int /*<<< orphan*/ Think_MatchTeam ;
int /*<<< orphan*/ Think_SpawnNewDoorTrigger ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ *,float,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
TYPE_5__ level ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ trap_SetBrushModel (TYPE_3__*,int /*<<< orphan*/ ) ;
void SP_func_door (gentity_t *ent) {
vec3_t abs_movedir;
float distance;
vec3_t size;
float lip;
ent->sound1to2 = ent->sound2to1 = G_SoundIndex("sound/movers/doors/dr1_strt.wav");
ent->soundPos1 = ent->soundPos2 = G_SoundIndex("sound/movers/doors/dr1_end.wav");
ent->blocked = Blocked_Door;
// default speed of 400
if (!ent->speed)
ent->speed = 400;
// default wait of 2 seconds
if (!ent->wait)
ent->wait = 2;
ent->wait *= 1000;
// default lip of 8 units
G_SpawnFloat( "lip", "8", &lip );
// default damage of 2 points
G_SpawnInt( "dmg", "2", &ent->damage );
// first position at start
VectorCopy( ent->s.origin, ent->pos1 );
// calculate second position
trap_SetBrushModel( ent, ent->model );
G_SetMovedir (ent->s.angles, ent->movedir);
abs_movedir[0] = fabs(ent->movedir[0]);
abs_movedir[1] = fabs(ent->movedir[1]);
abs_movedir[2] = fabs(ent->movedir[2]);
VectorSubtract( ent->r.maxs, ent->r.mins, size );
distance = DotProduct( abs_movedir, size ) - lip;
VectorMA( ent->pos1, distance, ent->movedir, ent->pos2 );
// if "start_open", reverse position 1 and 2
if ( ent->spawnflags & 1 ) {
vec3_t temp;
VectorCopy( ent->pos2, temp );
VectorCopy( ent->s.origin, ent->pos2 );
VectorCopy( temp, ent->pos1 );
}
InitMover( ent );
ent->nextthink = level.time + FRAMETIME;
if ( ! (ent->flags & FL_TEAMSLAVE ) ) {
int health;
G_SpawnInt( "health", "0", &health );
if ( health ) {
ent->takedamage = qtrue;
}
if ( ent->targetname || health ) {
// non touch/shoot doors
ent->think = Think_MatchTeam;
} else {
ent->think = Think_SpawnNewDoorTrigger;
}
}
} |
extr_ai_dmq3.c_BotFuncButtonActivateGoal_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ai_dmq3.c_BotFuncButtonActivateGoal.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_assert, augment_change_numeric_constant
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7092 {
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_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
typedef int /*<<<= orphan*/ model ;
struct TYPE_9__ {double fraction; int ent; } ;
typedef TYPE_2__ bsp_trace_t ;
struct TYPE_10__ {scalar_t__* origin; int areanum; int /*<<< orphan*/ entitynum; int /*<<< orphan*/ eye; } ;
typedef TYPE_3__ bot_state_t ;
struct TYPE_8__ {int entitynum; scalar_t__* origin; int areanum; scalar_t__* mins; scalar_t__* maxs; scalar_t__ flags; scalar_t__ number; } ;
struct TYPE_11__ {int shoot; scalar_t__* target; TYPE_1__ goal; } ;
typedef TYPE_4__ bot_activategoal_t ;
/* Variables and functions */
int /*<<< orphan*/ BotAI_Trace (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int BotModelMinsMaxs (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ BotSetMovedir (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ ET_MOVER ;
int /*<<< orphan*/ MASK_SHOT ;
int /*<<< orphan*/ PRESENCE_CROUCH ;
int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorClear (scalar_t__*) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorMA (scalar_t__*,float,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorScale (scalar_t__*,double,scalar_t__*) ;
int /*<<< orphan*/ VectorSet (scalar_t__*,int,int,int) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,scalar_t__*) ;
int atoi (char*) ;
float fabs (scalar_t__) ;
int qfalse ;
int qtrue ;
scalar_t__ trap_AAS_AreaReachability (int) ;
int /*<<< orphan*/ trap_AAS_FloatForBSPEpairKey (int,char*,float*) ;
int /*<<< orphan*/ trap_AAS_PresenceTypeBoundingBox (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int trap_AAS_TraceAreas (scalar_t__*,scalar_t__*,int*,scalar_t__**,int) ;
int /*<<< orphan*/ trap_AAS_ValueForBSPEpairKey (int,char*,char*,int) ;
int BotFuncButtonActivateGoal(bot_state_t *bs, int bspent, bot_activategoal_t *activategoal) {
int i, areas[10], numareas, modelindex, entitynum;
char model[128];
float lip, dist, health, angle;
vec3_t size, start, end, mins, maxs, angles, points[10];
vec3_t movedir, origin, goalorigin, bboxmins, bboxmaxs;
vec3_t extramins = {1, 1, 1}, extramaxs = {-1, -1, -1};
bsp_trace_t bsptrace;
activategoal->shoot = qfalse;
VectorClear(activategoal->target);
//create a bot goal towards the button
trap_AAS_ValueForBSPEpairKey(bspent, "model", model, sizeof(model));
if (!*model)
return qfalse;
modelindex = atoi(model+1);
if (!modelindex)
return qfalse;
entitynum = BotModelMinsMaxs(modelindex, ET_MOVER, 0, mins, maxs);
//get the lip of the button
trap_AAS_FloatForBSPEpairKey(bspent, "lip", &lip);
if (!lip) lip = 4;
//get the move direction from the angle
trap_AAS_FloatForBSPEpairKey(bspent, "angle", &angle);
VectorSet(angles, 0, angle, 0);
BotSetMovedir(angles, movedir);
//button size
VectorSubtract(maxs, mins, size);
//button origin
VectorAdd(mins, maxs, origin);
VectorScale(origin, 0.5, origin);
//touch distance of the button
dist = fabs(movedir[0]) * size[0] + fabs(movedir[1]) * size[1] + fabs(movedir[2]) * size[2];
dist *= 0.5;
//
trap_AAS_FloatForBSPEpairKey(bspent, "health", &health);
//if the button is shootable
if (health) {
//calculate the shoot target
VectorMA(origin, -dist, movedir, goalorigin);
//
VectorCopy(goalorigin, activategoal->target);
activategoal->shoot = qtrue;
//
BotAI_Trace(&bsptrace, bs->eye, NULL, NULL, goalorigin, bs->entitynum, MASK_SHOT);
// if the button is visible from the current position
if (bsptrace.fraction >= 1.0 || bsptrace.ent == entitynum) {
//
activategoal->goal.entitynum = entitynum; //NOTE: this is the entity number of the shootable button
activategoal->goal.number = 0;
activategoal->goal.flags = 0;
VectorCopy(bs->origin, activategoal->goal.origin);
activategoal->goal.areanum = bs->areanum;
VectorSet(activategoal->goal.mins, -8, -8, -8);
VectorSet(activategoal->goal.maxs, 8, 8, 8);
//
return qtrue;
}
else {
//create a goal from where the button is visible and shoot at the button from there
//add bounding box size to the dist
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, bboxmins, bboxmaxs);
for (i = 0; i < 3; i++) {
if (movedir[i] < 0) dist += fabs(movedir[i]) * fabs(bboxmaxs[i]);
else dist += fabs(movedir[i]) * fabs(bboxmins[i]);
}
//calculate the goal origin
VectorMA(origin, -dist, movedir, goalorigin);
//
VectorCopy(goalorigin, start);
start[2] += 24;
VectorCopy(start, end);
end[2] -= 512;
numareas = trap_AAS_TraceAreas(start, end, areas, points, 10);
//
for (i = numareas-1; i >= 0; i--) {
if (trap_AAS_AreaReachability(areas[i])) {
break;
}
}
if (i < 0) {
// FIXME: trace forward and maybe in other directions to find a valid area
}
if (i >= 0) {
//
VectorCopy(points[i], activategoal->goal.origin);
activategoal->goal.areanum = areas[i];
VectorSet(activategoal->goal.mins, 8, 8, 8);
VectorSet(activategoal->goal.maxs, -8, -8, -8);
//
for (i = 0; i < 3; i++)
{
if (movedir[i] < 0) activategoal->goal.maxs[i] += fabs(movedir[i]) * fabs(extramaxs[i]);
else activategoal->goal.mins[i] += fabs(movedir[i]) * fabs(extramins[i]);
} //end for
//
activategoal->goal.entitynum = entitynum;
activategoal->goal.number = 0;
activategoal->goal.flags = 0;
return qtrue;
}
}
return qfalse;
}
else {
//add bounding box size to the dist
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, bboxmins, bboxmaxs);
for (i = 0; i < 3; i++) {
if (movedir[i] < 0) dist += fabs(movedir[i]) * fabs(bboxmaxs[i]);
else dist += fabs(movedir[i]) * fabs(bboxmins[i]);
}
//calculate the goal origin
VectorMA(origin, -dist, movedir, goalorigin);
//
VectorCopy(goalorigin, start);
start[2] += 24;
VectorCopy(start, end);
end[2] -= 100;
numareas = trap_AAS_TraceAreas(start, end, areas, NULL, 10);
//
for (i = 0; i < numareas; i++) {
if (trap_AAS_AreaReachability(areas[i])) {
break;
}
}
if (i < numareas) {
//
VectorCopy(origin, activategoal->goal.origin);
activategoal->goal.areanum = areas[i];
VectorSubtract(mins, origin, activategoal->goal.mins);
VectorSubtract(maxs, origin, activategoal->goal.maxs);
//
for (i = 0; i < 3; i++)
{
if (movedir[i] < 0) activategoal->goal.maxs[i] += fabs(movedir[i]) * fabs(extramaxs[i]);
else activategoal->goal.mins[i] += fabs(movedir[i]) * fabs(extramins[i]);
} //end for
//
activategoal->goal.entitynum = entitynum;
activategoal->goal.number = 0;
activategoal->goal.flags = 0;
return qtrue;
}
}
return qfalse;
} |
extr_mkgrayer.c_Forward_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mkgrayer.c_Forward.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_printf_hello, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1972 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2908(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 L; int /*<<<= orphan*/ b; int /*<<< orphan*/ a; } ;
typedef TYPE_1__ cmsCIELab ;
typedef int WORD ;
typedef int /*<<< orphan*/ LPVOID ;
/* Variables and functions */
int TRUE ;
int /*<<< orphan*/ cmsLabEncoded2Float (TYPE_1__*,int*) ;
int fabs (int /*<<< orphan*/ ) ;
scalar_t__ floor (double) ;
__attribute__((used)) static
int Forward(register WORD In[], register WORD Out[], register LPVOID Cargo)
{
cmsCIELab Lab;
cmsLabEncoded2Float(&Lab, In);
if (fabs(Lab.a) < 3 && fabs(Lab.b) < 3) {
double L_01 = Lab.L / 100.0;
WORD K;
if (L_01 > 1) L_01 = 1;
K = (WORD) floor(L_01* 65535.0 + 0.5);
Out[0] = Out[1] = Out[2] = K;
}
else {
Out[0] = 0xFFFF; Out[1] = 0; Out[2] = 0;
}
return TRUE;
} |
extr_lightmaps_ydnar.c_StitchSurfaceLightmaps_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightmaps_ydnar.c_StitchSurfaceLightmaps.c
// Applied augmentations: augment_change_numeric_constant, augment_swap_logical_operator, augment_add_global_volatile_var, augment_change_relational_operator, augment_add_assert, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_7545 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {float* mins; float* maxs; int sh; int sw; float actualSampleSize; } ;
typedef TYPE_1__ rawLightmap_t ;
/* Variables and functions */
int CLUSTER_UNMAPPED ;
float DotProduct (float*,float*) ;
int I_FloatTime () ;
int MAX_STITCH_CANDIDATES ;
int MAX_STITCH_LUXELS ;
int* SUPER_CLUSTER (int,int) ;
float* SUPER_LUXEL (int /*<<< orphan*/ ,int,int) ;
float* SUPER_NORMAL (int,int) ;
float* SUPER_ORIGIN (int,int) ;
int /*<<< orphan*/ SYS_VRB ;
int /*<<< orphan*/ Sys_FPrintf (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ Sys_Printf (char*,...) ;
int /*<<< orphan*/ VectorAdd (float*,float*,float*) ;
int /*<<< orphan*/ VectorClear (float*) ;
int /*<<< orphan*/ VectorScale (float*,float,float*) ;
int abs (int) ;
float fabs (float) ;
int numRawLightmaps ;
TYPE_1__* rawLightmaps ;
void StitchSurfaceLightmaps( void ){
int i, j, x, y, x2, y2, *cluster, *cluster2,
numStitched, numCandidates, numLuxels, f, fOld, start;
rawLightmap_t *lm, *a, *b, *c[ MAX_STITCH_CANDIDATES ];
float *luxel, *luxel2, *origin, *origin2, *normal, *normal2,
sampleSize, average[ 3 ], totalColor, ootc, *luxels[ MAX_STITCH_LUXELS ];
/* disabled for now */
return;
/* note it */
Sys_Printf( "--- StitchSurfaceLightmaps ---\n" );
/* init pacifier */
fOld = -1;
start = I_FloatTime();
/* walk the list of raw lightmaps */
numStitched = 0;
for ( i = 0; i <= numRawLightmaps; i++ )
{
/* print pacifier */
f = 10 * i / numRawLightmaps;
if ( f != fOld ) {
fOld = f;
Sys_Printf( "%i...", f );
}
/* get lightmap a */
a = &rawLightmaps[ i ];
/* walk rest of lightmaps */
numCandidates = 0;
for ( j = i + 1; j < numRawLightmaps || numCandidates < MAX_STITCH_CANDIDATES; j++ )
{
/* get lightmap b */
b = &rawLightmaps[ j ];
/* test bounding box */
if ( a->mins[ 0 ] > b->maxs[ 0 ] || a->maxs[ 0 ] < b->mins[ 0 ] ||
a->mins[ 1 ] > b->maxs[ 1 ] || a->maxs[ 1 ] < b->mins[ 1 ] ||
a->mins[ 2 ] > b->maxs[ 2 ] || a->maxs[ 2 ] < b->mins[ 2 ] ) {
continue;
}
/* add candidate */
c[ numCandidates++ ] = b;
}
/* walk luxels */
for ( y = 0; y < a->sh; y++ )
{
for ( x = 0; x < a->sw; x++ )
{
/* ignore unmapped/unlit luxels */
lm = a;
cluster = SUPER_CLUSTER( x, y );
if ( *cluster == CLUSTER_UNMAPPED ) {
continue;
}
luxel = SUPER_LUXEL( 0, x, y );
if ( luxel[ 3 ] <= 0.0f ) {
continue;
}
/* get particulars */
origin = SUPER_ORIGIN( x, y );
normal = SUPER_NORMAL( x, y );
/* walk candidate list */
for ( j = 0; j < numCandidates; j++ )
{
/* get candidate */
b = c[ j ];
lm = b;
/* set samplesize to the smaller of the pair */
sampleSize = 0.5f * ( a->actualSampleSize < b->actualSampleSize ? a->actualSampleSize : b->actualSampleSize );
/* test bounding box */
if ( origin[ 0 ] < ( b->mins[ 0 ] - sampleSize ) || ( origin[ 0 ] > b->maxs[ 0 ] + sampleSize ) ||
origin[ 1 ] < ( b->mins[ 1 ] - sampleSize ) || ( origin[ 1 ] > b->maxs[ 1 ] + sampleSize ) ||
origin[ 2 ] < ( b->mins[ 2 ] - sampleSize ) || ( origin[ 2 ] > b->maxs[ 2 ] + sampleSize ) ) {
continue;
}
/* walk candidate luxels */
VectorClear( average );
numLuxels = 0;
totalColor = 0.0f;
for ( y2 = 0; y2 < b->sh && numLuxels < MAX_STITCH_LUXELS; y2++ )
{
for ( x2 = 0; x2 < b->sw && numLuxels < MAX_STITCH_LUXELS; x2++ )
{
/* ignore same luxels */
if ( a == b && abs( x - x2 ) <= 1 && abs( y - y2 ) <= 1 ) {
continue;
}
/* ignore unmapped/unlit luxels */
cluster2 = SUPER_CLUSTER( x2, y2 );
if ( *cluster2 == CLUSTER_UNMAPPED ) {
continue;
}
luxel2 = SUPER_LUXEL( 0, x2, y2 );
if ( luxel2[ 3 ] <= 0.0f ) {
continue;
}
/* get particulars */
origin2 = SUPER_ORIGIN( x2, y2 );
normal2 = SUPER_NORMAL( x2, y2 );
/* test normal */
if ( DotProduct( normal, normal2 ) < 0.5f ) {
continue;
}
/* test bounds */
if ( fabs( origin[ 0 ] - origin2[ 0 ] ) > sampleSize ||
fabs( origin[ 1 ] - origin2[ 1 ] ) > sampleSize ||
fabs( origin[ 2 ] - origin2[ 2 ] ) > sampleSize ) {
continue;
}
/* add luxel */
//% VectorSet( luxel2, 255, 0, 255 );
luxels[ numLuxels++ ] = luxel2;
VectorAdd( average, luxel2, average );
totalColor += luxel2[ 3 ];
}
}
/* early out */
if ( numLuxels == 0 ) {
continue;
}
/* scale average */
ootc = 1.0f / totalColor;
VectorScale( average, ootc, luxel );
luxel[ 3 ] = 1.0f;
numStitched++;
}
}
}
}
/* emit statistics */
Sys_Printf( " (%i)\n", (int) ( I_FloatTime() - start ) );
Sys_FPrintf( SYS_VRB, "%9d luxels stitched\n", numStitched );
} |
extr_stb_truetype.h_stbtt__rasterize_sorted_edges_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stb_truetype.h_stbtt__rasterize_sorted_edges.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_printf_hello, augment_swap_increment_decrement, augment_change_numeric_constant
#include <stdio.h>
volatile int g_aug_volatile_6678 = 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_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
typedef TYPE_1__ stbtt__hheap ;
struct TYPE_15__ {float y0; float y1; } ;
typedef TYPE_2__ stbtt__edge ;
struct TYPE_16__ {int w; int h; unsigned char* pixels; int stride; } ;
typedef TYPE_3__ stbtt__bitmap ;
struct TYPE_17__ {float ey; int direction; struct TYPE_17__* next; scalar_t__ fdx; int /*<<< orphan*/ fx; } ;
typedef TYPE_4__ stbtt__active_edge ;
typedef int /*<<< orphan*/ scanline ;
/* Variables and functions */
int /*<<< orphan*/ STBTT_assert (int) ;
int /*<<< orphan*/ STBTT_free (float*,void*) ;
scalar_t__ STBTT_malloc (int,void*) ;
int /*<<< orphan*/ STBTT_memset (float*,int /*<<< orphan*/ ,int) ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ stbtt__fill_active_edges_new (float*,float*,int,TYPE_4__*,float) ;
int /*<<< orphan*/ stbtt__hheap_cleanup (TYPE_1__*,void*) ;
int /*<<< orphan*/ stbtt__hheap_free (TYPE_1__*,TYPE_4__*) ;
TYPE_4__* stbtt__new_active (TYPE_1__*,TYPE_2__*,int,float,void*) ;
__attribute__((used)) static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata)
{
stbtt__hheap hh = { 0, 0, 0 };
stbtt__active_edge *active = NULL;
int y,j=0, i;
float scanline_data[129], *scanline, *scanline2;
if (result->w > 64)
scanline = (float *) STBTT_malloc((result->w*2+1) * sizeof(float), userdata);
else
scanline = scanline_data;
scanline2 = scanline + result->w;
y = off_y;
e[n].y0 = (float) (off_y + result->h) + 1;
while (j < result->h) {
// find center of pixel for this scanline
float scan_y_top = y + 0.0f;
float scan_y_bottom = y + 1.0f;
stbtt__active_edge **step = &active;
STBTT_memset(scanline , 0, result->w*sizeof(scanline[0]));
STBTT_memset(scanline2, 0, (result->w+1)*sizeof(scanline[0]));
// update all active edges;
// remove all active edges that terminate before the top of this scanline
while (*step) {
stbtt__active_edge * z = *step;
if (z->ey <= scan_y_top) {
*step = z->next; // delete from list
STBTT_assert(z->direction);
z->direction = 0;
stbtt__hheap_free(&hh, z);
} else {
step = &((*step)->next); // advance through list
}
}
// insert all edges that start before the bottom of this scanline
while (e->y0 <= scan_y_bottom) {
if (e->y0 != e->y1) {
stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata);
if (z != NULL) {
STBTT_assert(z->ey >= scan_y_top);
// insert at front
z->next = active;
active = z;
}
}
--e;
}
// now process all active edges
if (active)
stbtt__fill_active_edges_new(scanline, scanline2+1, result->w, active, scan_y_top);
{
float sum = 0;
for (i=0; i < result->w; ++i) {
float k;
int m;
sum += scanline2[i];
k = scanline[i] + sum;
k = (float) fabs(k)*255 + 0.5f;
m = (int) k;
if (m > 255) m = 255;
result->pixels[j*result->stride + i] = (unsigned char) m;
}
}
// advance all the edges
step = &active;
while (*step) {
stbtt__active_edge *z = *step;
z->fx += z->fdx; // advance to position for current scanline
step = &((*step)->next); // advance through list
}
++y;
++j;
}
stbtt__hheap_cleanup(&hh, userdata);
if (scanline != scanline_data)
STBTT_free(scanline, userdata);
} |
extr_samplerate.c_src_process_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_samplerate.c_src_process.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_2432(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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {double src_ratio; int input_frames; int output_frames; scalar_t__ output_frames_gen; scalar_t__ input_frames_used; int /*<<< orphan*/ * data_in; int /*<<< orphan*/ * data_out; } ;
struct TYPE_8__ {int (* vari_process ) (TYPE_1__*,TYPE_2__*) ;int (* const_process ) (TYPE_1__*,TYPE_2__*) ;scalar_t__ mode; int channels; double last_ratio; } ;
typedef int /*<<< orphan*/ SRC_STATE ;
typedef TYPE_1__ SRC_PRIVATE ;
typedef TYPE_2__ SRC_DATA ;
/* Variables and functions */
int SRC_ERR_BAD_DATA ;
int SRC_ERR_BAD_DATA_PTR ;
int SRC_ERR_BAD_MODE ;
int SRC_ERR_BAD_PROC_PTR ;
int SRC_ERR_BAD_SRC_RATIO ;
int SRC_ERR_BAD_STATE ;
int SRC_ERR_DATA_OVERLAP ;
double SRC_MAX_RATIO ;
scalar_t__ SRC_MODE_PROCESS ;
int fabs (double) ;
scalar_t__ is_bad_src_ratio (double) ;
int stub1 (TYPE_1__*,TYPE_2__*) ;
int stub2 (TYPE_1__*,TYPE_2__*) ;
int
src_process (SRC_STATE *state, SRC_DATA *data)
{ SRC_PRIVATE *psrc ;
int error ;
psrc = (SRC_PRIVATE*) state ;
if (psrc == NULL)
return SRC_ERR_BAD_STATE ;
if (psrc->vari_process == NULL || psrc->const_process == NULL)
return SRC_ERR_BAD_PROC_PTR ;
if (psrc->mode != SRC_MODE_PROCESS)
return SRC_ERR_BAD_MODE ;
/* Check for valid SRC_DATA first. */
if (data == NULL)
return SRC_ERR_BAD_DATA ;
/* And that data_in and data_out are valid. */
if (data->data_in == NULL || data->data_out == NULL)
return SRC_ERR_BAD_DATA_PTR ;
/* Check src_ratio is in range. */
if (is_bad_src_ratio (data->src_ratio))
return SRC_ERR_BAD_SRC_RATIO ;
if (data->input_frames < 0)
data->input_frames = 0 ;
if (data->output_frames < 0)
data->output_frames = 0 ;
if (data->data_in < data->data_out)
{ if (data->data_in + data->input_frames * psrc->channels > data->data_out)
{ /*-printf ("\n\ndata_in: %p data_out: %p\n",
(void*) (data->data_in + data->input_frames * psrc->channels), (void*) data->data_out) ;-*/
return SRC_ERR_DATA_OVERLAP ;
} ;
}
else if (data->data_out + data->output_frames * psrc->channels > data->data_in)
{ /*-printf ("\n\ndata_in : %p ouput frames: %ld data_out: %p\n", (void*) data->data_in, data->output_frames, (void*) data->data_out) ;
printf ("data_out: %p (%p) data_in: %p\n", (void*) data->data_out,
(void*) (data->data_out + data->input_frames * psrc->channels), (void*) data->data_in) ;-*/
return SRC_ERR_DATA_OVERLAP ;
} ;
/* Set the input and output counts to zero. */
data->input_frames_used = 0 ;
data->output_frames_gen = 0 ;
/* Special case for when last_ratio has not been set. */
if (psrc->last_ratio < (1.0 / SRC_MAX_RATIO))
psrc->last_ratio = data->src_ratio ;
/* Now process. */
if (fabs (psrc->last_ratio - data->src_ratio) < 1e-15)
error = psrc->const_process (psrc, data) ;
else
error = psrc->vari_process (psrc, data) ;
return error ;
} |
extr_s_fabs.c_fabs_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_fabs.c_fabs.c
// Applied augmentations: augment_add_assert, augment_change_numeric_constant, augment_add_global_volatile_var
#include <assert.h>
volatile int g_aug_volatile_1363 = 1;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
int /*<<< orphan*/ SET_HIGH_WORD (double,int) ;
double
fabs(double x)
{
u_int32_t high;
GET_HIGH_WORD(high,x);
SET_HIGH_WORD(x,high&0x7fffffff);
return x;
} |
extr_vector.c_ColorTest_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vector.c_ColorTest.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5053 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4100(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 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);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.