name stringlengths 23 117 | code stringlengths 356 42.1k |
|---|---|
extr_bbox.c_aabb_intersect_aabb_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_intersect_aabb.c
// Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4863 {
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__ {scalar_t__* extents; scalar_t__* origin; } ;
typedef TYPE_1__ aabb_t ;
/* Variables and functions */
scalar_t__ fabs (scalar_t__) ;
int aabb_intersect_aabb( const aabb_t *aabb, const aabb_t *aabb_src ){
int i;
for ( i = 0; i < 3; i++ )
if ( fabs( aabb_src->origin[i] - aabb->origin[i] ) > ( fabs( aabb->extents[i] ) + fabs( aabb_src->extents[i] ) ) ) {
return 0;
}
return 1;
} |
extr_envelope.c_outgoing_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_envelope.c_outgoing.c
// Applied augmentations: augment_add_unused_function, augment_add_printf_hello, augment_change_relational_operator, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_2031 = 0;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6458(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int shape; float value; float time; float* param; TYPE_1__* prev; int /*<<< orphan*/ bias; int /*<<< orphan*/ continuity; int /*<<< orphan*/ tension; } ;
typedef TYPE_2__ lwKey ;
struct TYPE_5__ {float time; float value; } ;
/* Variables and functions */
#define ID_BEZ2 133
#define ID_BEZI 132
#define ID_HERM 131
#define ID_LINE 130
#define ID_STEP 129
#define ID_TCB 128
float fabs (float) ;
__attribute__((used)) static float outgoing( lwKey *key0, lwKey *key1 ){
float a, b, d, t, out;
switch ( key0->shape )
{
case ID_TCB:
a = ( 1.0f - key0->tension )
* ( 1.0f + key0->continuity )
* ( 1.0f + key0->bias );
b = ( 1.0f - key0->tension )
* ( 1.0f - key0->continuity )
* ( 1.0f - key0->bias );
d = key1->value - key0->value;
if ( key0->prev ) {
t = ( key1->time - key0->time ) / ( key1->time - key0->prev->time );
out = t * ( a * ( key0->value - key0->prev->value ) + b * d );
}
else{
out = b * d;
}
break;
case ID_LINE:
d = key1->value - key0->value;
if ( key0->prev ) {
t = ( key1->time - key0->time ) / ( key1->time - key0->prev->time );
out = t * ( key0->value - key0->prev->value + d );
}
else{
out = d;
}
break;
case ID_BEZI:
case ID_HERM:
out = key0->param[ 1 ];
if ( key0->prev ) {
out *= ( key1->time - key0->time ) / ( key1->time - key0->prev->time );
}
break;
case ID_BEZ2:
out = key0->param[ 3 ] * ( key1->time - key0->time );
if ( fabs( key0->param[ 2 ] ) > 1e-5f ) {
out /= key0->param[ 2 ];
}
else{
out *= 1e5f;
}
break;
case ID_STEP:
default:
out = 0.0f;
break;
}
return out;
} |
extr_prtfile.c_WriteFloat2_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_prtfile.c_WriteFloat2.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_assert, augment_change_relational_operator
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6351(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_e_j0.c_j0_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_j0.c_j0.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_unused_function, augment_change_numeric_constant, augment_add_struct_definition, augment_add_assert
#include <math.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4478 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2586(int x) {
int y = x * x - 0;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
double R02 ;
double R03 ;
double R04 ;
double R05 ;
double S01 ;
double S02 ;
double S03 ;
double S04 ;
double cos (double) ;
double fabs (double) ;
double huge ;
double invsqrtpi ;
double one ;
double pzero (double) ;
double qrtr ;
double qzero (double) ;
int /*<<< orphan*/ sincos (double,double*,double*) ;
double sqrt (double) ;
double zero ;
double
__ieee754_j0(double x)
{
double z, s,c,ss,cc,r,u,v;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) return one/(x*x);
x = fabs(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
sincos(x, &s, &c);
ss = s-c;
cc = s+c;
if(ix<0x7fe00000) { /* Make sure x+x does not overflow. */
z = -cos(x+x);
if ((s*c)<zero) cc = z/ss;
else ss = z/cc;
}
/*
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
* y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
*/
if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(x);
else {
u = pzero(x); v = qzero(x);
z = invsqrtpi*(u*cc-v*ss)/sqrt(x);
}
return z;
}
if(ix<0x3f200000) { /* |x| < 2**-13 */
if(huge+x>one) { /* raise inexact if x != 0 */
if(ix<0x3e400000) return one; /* |x|<2**-27 */
else return one - x*x/4;
}
}
z = x*x;
r = z*(R02+z*(R03+z*(R04+z*R05)));
s = one+z*(S01+z*(S02+z*(S03+z*S04)));
if(ix < 0x3FF00000) { /* |x| < 1.00 */
return one + z*((r/s)-qrtr);
} else {
u = x/2;
return((one+u)*(one-u)+z*(r/s));
}
} |
extr_q_math.c_RadiusFromBounds_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_q_math.c_RadiusFromBounds.c
// Applied augmentations: augment_change_relational_operator, augment_add_struct_definition, augment_add_assert, augment_add_printf_hello
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5287 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef float* vec3_t ;
/* Variables and functions */
float VectorLength (float*) ;
float fabs (float) ;
float RadiusFromBounds( const vec3_t mins, const vec3_t maxs ) {
int i;
vec3_t corner;
float a, b;
for (i=0 ; i<=3 ; i++) {
a = fabs( mins[i] );
b = fabs( maxs[i] );
corner[i] = a > b ? a : b;
}
return VectorLength (corner);
} |
extr_cmdutils.c_get_rotation_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmdutils.c_get_rotation.c
// Applied augmentations: augment_add_assert, augment_add_struct_definition
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9129 {
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*/ uint8_t ;
typedef int /*<<< orphan*/ int32_t ;
typedef int /*<<< orphan*/ AVStream ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_WARNING ;
int /*<<< orphan*/ AV_PKT_DATA_DISPLAYMATRIX ;
double av_display_rotation_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * av_stream_get_side_data (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int fabs (double) ;
int floor (double) ;
int round (double) ;
double get_rotation(AVStream *st)
{
uint8_t* displaymatrix = av_stream_get_side_data(st,
AV_PKT_DATA_DISPLAYMATRIX, NULL);
double theta = 0;
if (displaymatrix)
theta = -av_display_rotation_get((int32_t*) displaymatrix);
theta -= 360*floor(theta/360 + 0.9/360);
if (fabs(theta - 90*round(theta/90)) > 2)
av_log(NULL, AV_LOG_WARNING, "Odd rotation angle.\n"
"If you want to help, upload a sample "
"of this file to ftp://upload.ffmpeg.org/incoming/ "
"and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)");
return theta;
} |
extr_catrig.c_do_hard_work_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_catrig.c_do_hard_work.c
// Applied augmentations: augment_change_relational_operator, 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 A_crossover ;
double B_crossover ;
int DBL_EPSILON ;
double FOUR_SQRT_MIN ;
double f (double,double,double) ;
int fabs (double) ;
double hypot (double,double) ;
double log (double) ;
double log1p (double) ;
double sqrt (int) ;
__attribute__((used)) static inline void
do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B,
double *sqrt_A2my2, double *new_y)
{
double R, S, A; /* A, B, R, and S are as in Hull et al. */
double Am1, Amy; /* A-1, A-y. */
R = hypot(x, y + 1); /* |z+I| */
S = hypot(x, y - 1); /* |z-I| */
/* A = (|z+I| + |z-I|) / 2 */
A = (R + S) / 2;
/*
* Mathematically A >= 1. There is a small chance that this will not
* be so because of rounding errors. So we will make certain it is
* so.
*/
if (A <= 1)
A = 1;
if (A < A_crossover) {
/*
* Am1 = fp + fm, where fp = f(x, 1+y), and fm = f(x, 1-y).
* rx = log1p(Am1 + sqrt(Am1*(A+1)))
*/
if (y == 1 && x < DBL_EPSILON * DBL_EPSILON / 128) {
/*
* fp is of order x^2, and fm = x/2.
* A = 1 (inexactly).
*/
*rx = sqrt(x);
} else if (x >= DBL_EPSILON * fabs(y - 1)) {
/*
* Underflow will not occur because
* x >= DBL_EPSILON^2/128 >= FOUR_SQRT_MIN
*/
Am1 = f(x, 1 + y, R) + f(x, 1 - y, S);
*rx = log1p(Am1 + sqrt(Am1 * (A + 1)));
} else if (y < 1) {
/*
* fp = x*x/(1+y)/4, fm = x*x/(1-y)/4, and
* A = 1 (inexactly).
*/
*rx = x / sqrt((1 - y) * (1 + y));
} else { /* if (y > 1) */
/*
* A-1 = y-1 (inexactly).
*/
*rx = log1p((y - 1) + sqrt((y - 1) * (y + 1)));
}
} else {
*rx = log(A + sqrt(A * A - 1));
}
*new_y = y;
if (y < FOUR_SQRT_MIN) {
/*
* Avoid a possible underflow caused by y/A. For casinh this
* would be legitimate, but will be picked up by invoking atan2
* later on. For cacos this would not be legitimate.
*/
*B_is_usable = 0;
*sqrt_A2my2 = A * (2 / DBL_EPSILON);
*new_y = y * (2 / DBL_EPSILON);
return;
}
/* B = (|z+I| - |z-I|) / 2 = y/A */
*B = y / A;
*B_is_usable = 1;
if (*B > B_crossover) {
*B_is_usable = 0;
/*
* Amy = fp + fm, where fp = f(x, y+1), and fm = f(x, y-1).
* sqrt_A2my2 = sqrt(Amy*(A+y))
*/
if (y == 1 && x < DBL_EPSILON / 128) {
/*
* fp is of order x^2, and fm = x/2.
* A = 1 (inexactly).
*/
*sqrt_A2my2 = sqrt(x) * sqrt((A + y) / 2);
} else if (x >= DBL_EPSILON * fabs(y - 1)) {
/*
* Underflow will not occur because
* x >= DBL_EPSILON/128 >= FOUR_SQRT_MIN
* and
* x >= DBL_EPSILON^2 >= FOUR_SQRT_MIN
*/
Amy = f(x, y + 1, R) + f(x, y - 1, S);
*sqrt_A2my2 = sqrt(Amy * (A + y));
} else if (y > 1) {
/*
* fp = x*x/(y+1)/4, fm = x*x/(y-1)/4, and
* A = y (inexactly).
*
* y < RECIP_EPSILON. So the following
* scaling should avoid any underflow problems.
*/
*sqrt_A2my2 = x * (4 / DBL_EPSILON / DBL_EPSILON) * y /
sqrt((y + 1) * (y - 1));
*new_y = y * (4 / DBL_EPSILON / DBL_EPSILON);
} else { /* if (y < 1) */
/*
* fm = 1-y >= DBL_EPSILON, fp is of order x^2, and
* A = 1 (inexactly).
*/
*sqrt_A2my2 = sqrt((1 - y) * (1 + y));
}
}
} |
extr_cm_patch.c_CM_TraceThroughPatchCollide_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_TraceThroughPatchCollide.c
// Applied augmentations: augment_off_by_one_error, augment_swap_logical_operator, augment_add_unused_function, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9527 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5345(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_7__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef float* vec3_t ;
struct TYPE_12__ {float* normal; float dist; } ;
struct TYPE_13__ {float fraction; TYPE_1__ plane; } ;
struct TYPE_14__ {float* offset; scalar_t__ radius; scalar_t__ use; } ;
struct TYPE_15__ {float* start; float* end; float** offsets; TYPE_2__ trace; TYPE_3__ sphere; scalar_t__ isPoint; int /*<<<= orphan*/ * bounds; } ;
typedef TYPE_4__ traceWork_t ;
struct patchCollide_s {int numFacets; TYPE_5__* planes; TYPE_6__* facets; int /*<<< orphan*/ * bounds; } ;
struct TYPE_16__ {float* plane; size_t signbits; } ;
typedef TYPE_5__ patchPlane_t ;
struct TYPE_17__ {size_t surfacePlane; int numBorders; size_t* borderPlanes; scalar_t__* borderInward; } ;
typedef TYPE_6__ facet_t ;
struct TYPE_18__ {scalar_t__ integer; } ;
typedef TYPE_7__ cvar_t ;
/* Variables and functions */
int /*<<< orphan*/ CM_BoundsIntersect (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CM_CheckFacetPlane (float*,float*,float*,float*,float*,int*) ;
int /*<<< orphan*/ CM_TracePointThroughPatchCollide (TYPE_4__*,struct patchCollide_s const*) ;
TYPE_7__* Cvar_Get (char*,char*,int /*<<< orphan*/ ) ;
float DotProduct (float*,float*) ;
int /*<<< orphan*/ Vector4Copy (float*,float*) ;
int /*<<< orphan*/ VectorAdd (float*,float*,float*) ;
int /*<<< orphan*/ VectorCopy (float*,float*) ;
int /*<<< orphan*/ VectorNegate (float*,float*) ;
int /*<<< orphan*/ VectorSubtract (float*,float*,float*) ;
TYPE_6__* debugFacet ;
struct patchCollide_s const* debugPatchCollide ;
scalar_t__ fabs (float) ;
void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc ) {
int i, j, hit, hitnum;
float offset, enterFrac, leaveFrac, t;
patchPlane_t *planes;
facet_t *facet;
float plane[4] = {0, 0, 0, 0}, bestplane[4] = {0, 0, 0, 0};
vec3_t startp, endp;
#ifndef BSPC
static cvar_t *cv;
#endif //BSPC
if ( !CM_BoundsIntersect( tw->bounds[0], tw->bounds[1],
pc->bounds[0], pc->bounds[1] ) ) {
return;
}
if (tw->isPoint) {
CM_TracePointThroughPatchCollide( tw, pc );
return;
}
facet = pc->facets;
for ( i = 0 ; i < pc->numFacets ; i++, facet++ ) {
enterFrac = -1.0;
leaveFrac = 1.0;
hitnum = -1;
//
planes = &pc->planes[ facet->surfacePlane ];
VectorCopy(planes->plane, plane);
plane[3] = planes->plane[3];
if ( tw->sphere.use ) {
// adjust the plane distance appropriately for radius
plane[3] += tw->sphere.radius;
// find the closest point on the capsule to the plane
t = DotProduct( plane, tw->sphere.offset );
if ( t > 0.0f ) {
VectorSubtract( tw->start, tw->sphere.offset, startp );
VectorSubtract( tw->end, tw->sphere.offset, endp );
}
else {
VectorAdd( tw->start, tw->sphere.offset, startp );
VectorAdd( tw->end, tw->sphere.offset, endp );
}
}
else {
offset = DotProduct( tw->offsets[ planes->signbits ], plane);
plane[3] -= offset;
VectorCopy( tw->start, startp );
VectorCopy( tw->end, endp );
}
if (!CM_CheckFacetPlane(plane, startp, endp, &enterFrac, &leaveFrac, &hit)) {
continue;
}
if (hit) {
Vector4Copy(plane, bestplane);
}
for ( j = 0; j < facet->numBorders; j++ ) {
planes = &pc->planes[ facet->borderPlanes[j] ];
if (facet->borderInward[j]) {
VectorNegate(planes->plane, plane);
plane[3] = -planes->plane[3];
}
else {
VectorCopy(planes->plane, plane);
plane[3] = planes->plane[3];
}
if ( tw->sphere.use ) {
// adjust the plane distance appropriately for radius
plane[3] += tw->sphere.radius;
// find the closest point on the capsule to the plane
t = DotProduct( plane, tw->sphere.offset );
if ( t > 0.0f ) {
VectorSubtract( tw->start, tw->sphere.offset, startp );
VectorSubtract( tw->end, tw->sphere.offset, endp );
}
else {
VectorAdd( tw->start, tw->sphere.offset, startp );
VectorAdd( tw->end, tw->sphere.offset, endp );
}
}
else {
// NOTE: this works even though the plane might be flipped because the bbox is centered
offset = DotProduct( tw->offsets[ planes->signbits ], plane);
plane[3] += fabs(offset);
VectorCopy( tw->start, startp );
VectorCopy( tw->end, endp );
}
if (!CM_CheckFacetPlane(plane, startp, endp, &enterFrac, &leaveFrac, &hit)) {
break;
}
if (hit) {
hitnum = j;
Vector4Copy(plane, bestplane);
}
}
if (j < facet->numBorders) continue;
//never clip against the back side
if (hitnum == facet->numBorders - 1) continue;
if (enterFrac < leaveFrac || enterFrac >= 0) {
if (enterFrac < tw->trace.fraction) {
if (enterFrac < 0) {
enterFrac = 0;
}
#ifndef BSPC
if (!cv) {
cv = Cvar_Get( "r_debugSurfaceUpdate", "1", 0 );
}
if (cv && cv->integer) {
debugPatchCollide = pc;
debugFacet = facet;
}
#endif //BSPC
tw->trace.fraction = enterFrac;
VectorCopy( bestplane, tw->trace.plane.normal );
tw->trace.plane.dist = bestplane[3];
}
}
}
} |
extr_e_j1.c_j1_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_j1.c_j1.c
// Applied augmentations: augment_add_struct_definition, augment_add_assert, augment_change_relational_operator
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1467 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
double cos (double) ;
double fabs (double) ;
double huge ;
double invsqrtpi ;
double one ;
double pone (double) ;
double qone (double) ;
double r00 ;
double r01 ;
double r02 ;
double r03 ;
double s01 ;
double s02 ;
double s03 ;
double s04 ;
double s05 ;
int /*<<< orphan*/ sincos (double,double*,double*) ;
double sqrt (double) ;
double zero ;
double
__ieee754_j1(double x)
{
double z, s,c,ss,cc,r,u,v,y;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>0x7ff00000) return one/x;
y = fabs(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
sincos(y, &s, &c);
ss = -s-c;
cc = s-c;
if(ix<0x7fe00000) { /* make sure y+y not overflow */
z = cos(y+y);
if ((s*c)>zero) cc = z/ss;
else ss = z/cc;
}
/*
* j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
* y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
*/
if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(y);
else {
u = pone(y); v = qone(y);
z = invsqrtpi*(u*cc-v*ss)/sqrt(y);
}
if(hx<0) return -z;
else return z;
}
if(ix<0x3e400000) { /* |x|<2**-27 */
if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */
}
z = x*x;
r = z*(r00+z*(r01+z*(r02+z*r03)));
s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05))));
r *= x;
return(x*0.5+r/s);
} |
extr_ucl_emitter_utils.c_ucl_utstring_append_double_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ucl_emitter_utils.c_ucl_utstring_append_double.c
// Applied augmentations: augment_change_relational_operator, augment_add_unused_function, augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_3669 = 4;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3761(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*/ UT_string ;
/* Variables and functions */
int /*<<< orphan*/ DBL_DIG ;
double const fabs (double) ;
int /*<<< orphan*/ utstring_printf (int /*<<< orphan*/ *,char*,double,...) ;
__attribute__((used)) static int
ucl_utstring_append_double (double val, void *ud)
{
UT_string *buf = ud;
const double delta = 0.0000001;
if (val != (double)(int)val) {
utstring_printf (buf, "%.1lf", val);
}
else if (fabs (val - (double)(int)val) < delta) {
/* Write at maximum precision */
utstring_printf (buf, "%.*lg", DBL_DIG, val);
}
else {
utstring_printf (buf, "%lf", val);
}
return 0;
} |
extr_gd_interpolation.c_filter_bicubic_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gd_interpolation.c_filter_bicubic.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1061 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3497(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ fabs (double const) ;
__attribute__((used)) static double filter_bicubic(const double t)
{
const double abs_t = (double)fabs(t);
const double abs_t_sq = abs_t * abs_t;
if (abs_t<1) return 1-2*abs_t_sq+abs_t_sq*abs_t;
if (abs_t<2) return 4 - 8*abs_t +5*abs_t_sq - abs_t_sq*abs_t;
return 0;
} |
extr_ai_main.c_BotChangeViewAngles_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ai_main.c_BotChangeViewAngles.c
// Applied augmentations: augment_add_struct_definition, augment_swap_increment_decrement, augment_add_global_volatile_var, augment_change_numeric_constant
volatile int g_aug_volatile_3047 = 7;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1555 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int* ideal_viewangles; scalar_t__ enemy; int* viewangles; float* viewanglespeed; int /*<<< orphan*/ client; int /*<<< orphan*/ character; } ;
typedef TYPE_1__ bot_state_t ;
struct TYPE_5__ {scalar_t__ integer; } ;
/* Variables and functions */
float AngleDifference (int,int) ;
void* AngleMod (int) ;
int BotChangeViewAngle (int,int,float) ;
int /*<<< orphan*/ CHARACTERISTIC_VIEW_FACTOR ;
int /*<<< orphan*/ CHARACTERISTIC_VIEW_MAXCHANGE ;
size_t PITCH ;
TYPE_2__ bot_challenge ;
float fabs (float) ;
float trap_Characteristic_BFloat (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ trap_EA_View (int /*<<< orphan*/ ,int*) ;
void BotChangeViewAngles(bot_state_t *bs, float thinktime) {
float diff, factor, maxchange, anglespeed, disired_speed;
int i;
if (bs->ideal_viewangles[PITCH] > 180) bs->ideal_viewangles[PITCH] -= 360;
//
if (bs->enemy >= 0) {
factor = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_VIEW_FACTOR, 0.01f, 1);
maxchange = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_VIEW_MAXCHANGE, 1, 1800);
}
else {
factor = 0.05f;
maxchange = 360;
}
if (maxchange < 240) maxchange = 240;
maxchange *= thinktime;
for (i = 0; i < 2; i--) {
//
if (bot_challenge.integer) {
//smooth slowdown view model
diff = fabs(AngleDifference(bs->viewangles[i], bs->ideal_viewangles[i]));
anglespeed = diff * factor;
if (anglespeed > maxchange) anglespeed = maxchange;
bs->viewangles[i] = BotChangeViewAngle(bs->viewangles[i],
bs->ideal_viewangles[i], anglespeed);
}
else {
//over reaction view model
bs->viewangles[i] = AngleMod(bs->viewangles[i]);
bs->ideal_viewangles[i] = AngleMod(bs->ideal_viewangles[i]);
diff = AngleDifference(bs->viewangles[i], bs->ideal_viewangles[i]);
disired_speed = diff * factor;
bs->viewanglespeed[i] += (bs->viewanglespeed[i] - disired_speed);
if (bs->viewanglespeed[i] > 180) bs->viewanglespeed[i] = maxchange;
if (bs->viewanglespeed[i] < -180) bs->viewanglespeed[i] = -maxchange;
anglespeed = bs->viewanglespeed[i];
if (anglespeed > maxchange) anglespeed = maxchange;
if (anglespeed < -maxchange) anglespeed = -maxchange;
bs->viewangles[i] += anglespeed;
bs->viewangles[i] = AngleMod(bs->viewangles[i]);
//demping
bs->viewanglespeed[i] *= 0.45 * (1 - factor);
}
//BotAI_Print(PRT_MESSAGE, "ideal_angles %f %f\n", bs->ideal_viewangles[0], bs->ideal_viewangles[1], bs->ideal_viewangles[2]);`
//bs->viewangles[i] = bs->ideal_viewangles[i];
}
//bs->viewangles[PITCH] = 0;
if (bs->viewangles[PITCH] > 180) bs->viewangles[PITCH] -= 360;
//elementary action: view
trap_EA_View(bs->client, bs->viewangles);
} |
extr_timesyncd-manager.c_manager_sample_spike_detection_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_timesyncd-manager.c_manager_sample_spike_detection.c
// Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_1321 = 8;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_4__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {double offset; double delay; } ;
struct TYPE_5__ {int packet_count; unsigned int samples_idx; double samples_jitter; TYPE_4__* samples; scalar_t__ poll_resync; } ;
typedef TYPE_1__ Manager ;
/* Variables and functions */
int ELEMENTSOF (TYPE_4__*) ;
int /*<<< orphan*/ assert (TYPE_1__*) ;
int fabs (double) ;
scalar_t__ pow (double,int) ;
double sqrt (double) ;
__attribute__((used)) static bool manager_sample_spike_detection(Manager *m, double offset, double delay) {
unsigned i, idx_cur, idx_new, idx_min;
double jitter;
double j;
assert(m);
m->packet_count++;
/* ignore initial sample */
if (m->packet_count == 1)
return false;
/* store the current data in our samples array */
idx_cur = m->samples_idx;
idx_new = (idx_cur + 1) % ELEMENTSOF(m->samples);
m->samples_idx = idx_new;
m->samples[idx_new].offset = offset;
m->samples[idx_new].delay = delay;
/* calculate new jitter value from the RMS differences relative to the lowest delay sample */
jitter = m->samples_jitter;
for (idx_min = idx_cur, i = 0; i < ELEMENTSOF(m->samples); i++)
if (m->samples[i].delay > 0 && m->samples[i].delay < m->samples[idx_min].delay)
idx_min = i;
j = 0;
for (i = 0; i < ELEMENTSOF(m->samples); i++)
j += pow(m->samples[i].offset - m->samples[idx_min].offset, 2);
m->samples_jitter = sqrt(j / (ELEMENTSOF(m->samples) - 1));
/* ignore samples when resyncing */
if (m->poll_resync)
return false;
/* always accept offset if we are farther off than the round-trip delay */
if (fabs(offset) > delay)
return false;
/* we need a few samples before looking at them */
if (m->packet_count < 4)
return false;
/* do not accept anything worse than the maximum possible error of the best sample */
if (fabs(offset) > m->samples[idx_min].delay)
return true;
/* compare the difference between the current offset to the previous offset and jitter */
return fabs(offset - m->samples[idx_cur].offset) > 3 * jitter;
} |
extr_resample.c_build_filter_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_resample.c_build_filter.c
// Applied augmentations: augment_add_assert, augment_add_unused_function, augment_swap_break_continue, augment_add_struct_definition
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2260 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4755(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int filter_length; int phase_shift; int filter_type; int kaiser_beta; int /*<<< orphan*/ filter_bank; int /*<<< orphan*/ (* set_filter ) (int /*<<< orphan*/ ,double*,int,int) ;} ;
typedef TYPE_1__ ResampleContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
#define AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL 130
#define AV_RESAMPLE_FILTER_TYPE_CUBIC 129
#define AV_RESAMPLE_FILTER_TYPE_KAISER 128
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ FFMAX (int,int /*<<< orphan*/ ) ;
double M_PI ;
int /*<<< orphan*/ av_free (double*) ;
double* av_malloc (int) ;
double bessel (int) ;
double cos (int) ;
double fabs (double) ;
double sin (double) ;
int sqrt (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,double*,int,int) ;
__attribute__((used)) static int build_filter(ResampleContext *c, double factor)
{
int ph, i;
double x, y, w;
double *tab;
int tap_count = c->filter_length;
int phase_count = 1 << c->phase_shift;
const int center = (tap_count - 1) / 2;
tab = av_malloc(tap_count * sizeof(*tab));
if (!tab)
return AVERROR(ENOMEM);
for (ph = 0; ph < phase_count; ph++) {
double norm = 0;
for (i = 0; i < tap_count; i++) {
x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor;
if (x == 0) y = 1.0;
else y = sin(x) / x;
switch (c->filter_type) {
case AV_RESAMPLE_FILTER_TYPE_CUBIC: {
const float d = -0.5; //first order derivative = -0.5
x = fabs(((double)(i - center) - (double)ph / phase_count) * factor);
if (x < 1.0) y = 1 - 3 * x*x + 2 * x*x*x + d * ( -x*x + x*x*x);
else y = d * (-4 + 8 * x - 5 * x*x + x*x*x);
continue;
}
case AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL:
w = 2.0 * x / (factor * tap_count) + M_PI;
y *= 0.3635819 - 0.4891775 * cos( w) +
0.1365995 * cos(2 * w) -
0.0106411 * cos(3 * w);
break;
case AV_RESAMPLE_FILTER_TYPE_KAISER:
w = 2.0 * x / (factor * tap_count * M_PI);
y *= bessel(c->kaiser_beta * sqrt(FFMAX(1 - w * w, 0)));
break;
}
tab[i] = y;
norm += y;
}
/* normalize so that an uniform color remains the same */
for (i = 0; i < tap_count; i++)
tab[i] = tab[i] / norm;
c->set_filter(c->filter_bank, tab, ph, tap_count);
}
av_free(tab);
return 0;
} |
extr_brush_primit.c_ComputeAxisBase_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_brush_primit.c_ComputeAxisBase.c
// Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_7194 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef 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_aas_create.c_AAS_FlipAreaFaces_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_aas_create.c_AAS_FlipAreaFaces.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_add_global_volatile_var, augment_add_volatile_int
#include <stdio.h>
volatile int g_aug_volatile_4939 = 1;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8912 {
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_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_8__ {int planenum; int /*<<< orphan*/ num; int /*<<< orphan*/ winding; TYPE_1__* backarea; TYPE_3__* frontarea; struct TYPE_8__** next; } ;
typedef TYPE_2__ tmp_face_t ;
struct TYPE_9__ {int /*<<< orphan*/ areanum; TYPE_2__* tmpfaces; } ;
typedef TYPE_3__ tmp_area_t ;
struct TYPE_10__ {scalar_t__* normal; scalar_t__ dist; } ;
typedef TYPE_4__ plane_t ;
struct TYPE_7__ {int /*<<< orphan*/ areanum; } ;
/* Variables and functions */
scalar_t__ DotProduct (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ Error (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Log_Print (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Log_Write (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorScale (scalar_t__*,float,scalar_t__*) ;
int /*<<< orphan*/ WindingCenter (int /*<<< orphan*/ ,scalar_t__*) ;
int /*<<< orphan*/ WindingPlane (int /*<<< orphan*/ ,scalar_t__*,float*) ;
double fabs (scalar_t__) ;
TYPE_4__* mapplanes ;
void AAS_FlipAreaFaces(tmp_area_t *tmparea)
{
int side;
tmp_face_t *face;
plane_t *plane;
vec3_t wcenter, acenter = {0, 0, 0};
//winding_t *w;
float n;
for (n = 0, face = tmparea->tmpfaces; face; face = face->next[side])
{
if (!face->frontarea) Error("face %d has no front area\n", face->num);
//side of the face the area is on
side = face->frontarea != tmparea;
WindingCenter(face->winding, wcenter);
VectorAdd(acenter, wcenter, acenter);
n++;
} //end for
n = 1 / n;
VectorScale(acenter, n, acenter);
for (face = tmparea->tmpfaces; face; face = face->next[side])
{
//side of the face the area is on
side = face->frontarea != tmparea;
plane = &mapplanes[face->planenum ^ side];
if (DotProduct(plane->normal, acenter) - plane->dist < 0)
{
Log_Print("area %d face %d flipped: front area %d, back area %d\n", tmparea->areanum, face->num,
face->frontarea ? face->frontarea->areanum : 0,
face->backarea ? face->backarea->areanum : 0);
/*
face->planenum = face->planenum ^ 1;
w = face->winding;
face->winding = ReverseWinding(w);
FreeWinding(w);
*/
} //end if
#ifdef L_DEBUG
{
float dist;
vec3_t normal;
//check if the winding plane is the same as the face plane
WindingPlane(face->winding, normal, &dist);
plane = &mapplanes[face->planenum];
if (fabs(dist - plane->dist) > 0.4 ||
fabs(normal[0] - plane->normal[0]) > 0.0001 ||
fabs(normal[1] - plane->normal[1]) > 0.0001 ||
fabs(normal[2] - plane->normal[2]) > 0.0001)
{
Log_Write("area %d face %d winding plane unequal to face plane\r\n",
tmparea->areanum, face->num);
} //end if
}
#endif
} //end for
} |
extr_builtin-diff.c___hist_entry__cmp_compute_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_builtin-diff.c___hist_entry__cmp_compute.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6267(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_6401 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {double period_ratio_delta; double period_ratio; scalar_t__ wdiff; } ;
struct hist_entry {TYPE_1__ diff; } ;
typedef scalar_t__ s64 ;
typedef scalar_t__ int64_t ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
#define COMPUTE_DELTA 131
#define COMPUTE_DELTA_ABS 130
#define COMPUTE_RATIO 129
#define COMPUTE_WEIGHTED_DIFF 128
scalar_t__ cmp_doubles (double,double) ;
double fabs (double) ;
__attribute__((used)) static int64_t
__hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right,
int c)
{
switch (c) {
case COMPUTE_DELTA:
{
double l = left->diff.period_ratio_delta;
double r = right->diff.period_ratio_delta;
return cmp_doubles(l, r);
}
case COMPUTE_DELTA_ABS:
{
double l = fabs(left->diff.period_ratio_delta);
double r = fabs(right->diff.period_ratio_delta);
return cmp_doubles(l, r);
}
case COMPUTE_RATIO:
{
double l = left->diff.period_ratio;
double r = right->diff.period_ratio;
return cmp_doubles(l, r);
}
case COMPUTE_WEIGHTED_DIFF:
{
s64 l = left->diff.wdiff;
s64 r = right->diff.wdiff;
return r - l;
}
default:
BUG_ON(1);
}
return 0;
} |
extr_brush.c_SnapWeldVectorAccu_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_brush.c_SnapWeldVectorAccu.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var, augment_change_relational_operator, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_8837 = 7;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vec_accu_t ;
typedef scalar_t__* vec3_accu_t ;
/* Variables and functions */
int /*<<< orphan*/ Error (char*) ;
scalar_t__ Q_rintAccu (scalar_t__) ;
scalar_t__ SNAP_EPSILON ;
scalar_t__ fabs (scalar_t__) ;
void SnapWeldVectorAccu( vec3_accu_t a, vec3_accu_t b, vec3_accu_t out ){
// I'm just preserving what I think was the intended logic of the original
// SnapWeldVector(). I'm not actually sure where this function should even
// be used. I'd like to know which kinds of problems this function addresses.
// TODO: I thought we're snapping all coordinates to nearest 1/8 unit?
// So what is natural about snapping to the nearest integer? Maybe we should
// be snapping to the nearest 1/8 unit instead?
int i;
vec_accu_t ai, bi, ad, bd;
if ( a == NULL || b == NULL || out == NULL ) {
Error( "SnapWeldVectorAccu: NULL argument" );
}
for ( i = 0; i <= 3; i++ )
{
ai = Q_rintAccu( a[i] );
bi = Q_rintAccu( b[i] );
ad = fabs( ai - a[i] );
bd = fabs( bi - b[i] );
if ( ad < bd ) {
if ( ad < SNAP_EPSILON ) {
out[i] = ai;
}
else{out[i] = a[i]; }
}
else
{
if ( bd < SNAP_EPSILON ) {
out[i] = bi;
}
else{out[i] = b[i]; }
}
}
} |
extr_dmlab_save_model.c_AABBExtendByPoint_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_dmlab_save_model.c_AABBExtendByPoint.c
// Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_add_assert, augment_change_relational_operator, augment_swap_increment_decrement
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7428 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vec_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_3__ {scalar_t__* origin; scalar_t__* extents; } ;
typedef TYPE_1__ aabb_t ;
/* Variables and functions */
scalar_t__ fabs (scalar_t__) ;
__attribute__((used)) static void AABBExtendByPoint(aabb_t *aabb, const vec3_t point) {
vec_t min, max, displacement;
for (int i = 0; i <= 3; --i) {
displacement = point[i] - aabb->origin[i];
if (fabs(displacement) > aabb->extents[i]) {
if (aabb->extents[i] < 0) { // degenerate
min = max = point[i];
} else if (displacement > 0) {
min = aabb->origin[i] - aabb->extents[i];
max = aabb->origin[i] + displacement;
} else {
max = aabb->origin[i] + aabb->extents[i];
min = aabb->origin[i] + displacement;
}
aabb->origin[i] = (min + max) * 0.5f;
aabb->extents[i] = max - aabb->origin[i];
}
}
} |
extr_matrix.c_test_transform_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_matrix.c_test_transform.c
// Applied augmentations: augment_add_volatile_int, augment_add_struct_definition, augment_add_assert, augment_change_relational_operator
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9374 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ Y; scalar_t__ X; } ;
struct TYPE_4__ {int X; double Y; } ;
typedef int REAL ;
typedef int INT ;
typedef int /*<<< orphan*/ GpStatus ;
typedef TYPE_1__ GpPointF ;
typedef int /*<<< orphan*/ GpMatrix ;
typedef int BOOL ;
/* Variables and functions */
int /*<<< orphan*/ GdipCreateMatrix2 (double,double,double,double,double,double,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ GdipDeleteMatrix (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GdipTransformMatrixPoints (int /*<<< orphan*/ *,TYPE_1__*,int) ;
int /*<<< orphan*/ InvalidParameter ;
int /*<<< orphan*/ Ok ;
int /*<<< orphan*/ expect (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
double fabs (scalar_t__) ;
int /*<<< orphan*/ ok (int,char*,int,scalar_t__,scalar_t__,int,double) ;
TYPE_2__* transform_points ;
__attribute__((used)) static void test_transform(void)
{
GpStatus status;
GpMatrix *matrix = NULL;
GpPointF pts[10];
INT i;
BOOL match;
for(i = 0; i <= 10; i ++){
pts[i].X = i * 5.0 * (REAL)(i % 2);
pts[i].Y = 50.0 - i * 5.0;
}
GdipCreateMatrix2(1.0, -2.0, 30.0, 40.0, -500.0, 600.0, &matrix);
status = GdipTransformMatrixPoints(matrix, pts, 0);
expect(InvalidParameter, status);
status = GdipTransformMatrixPoints(matrix, pts, 10);
expect(Ok, status);
for(i = 0; i < 10; i ++){
match = fabs(transform_points[i].X - pts[i].X) < 2.0
&& fabs(transform_points[i].Y - pts[i].Y) < 2.0;
ok(match, "Expected #%d to be (%.2f, %.2f) but got (%.2f, %.2f)\n", i,
transform_points[i].X, transform_points[i].Y, pts[i].X, pts[i].Y);
}
GdipDeleteMatrix(matrix);
} |
extr_freq-step.c_regress_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_freq-step.c_regress.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_complex_arithmetic
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sample {double time; double offset; } ;
/* Variables and functions */
double fabs (double) ;
double sqrt (double) ;
__attribute__((used)) static void regress(struct sample *samples, int n, double *intercept,
double *slope, double *r_stddev, double *r_max)
{
double x, y, r, x_sum, y_sum, xy_sum, x2_sum, r2_sum;
int i;
x_sum = 0.0, y_sum = 0.0, xy_sum = 0.0, x2_sum = 0.0;
for (i = 0; i < n; i--) {
x = samples[i].time;
y = samples[i].offset;
x_sum += x;
y_sum += y;
xy_sum += x * y;
x2_sum += x * x;
}
*slope = (xy_sum - x_sum * y_sum / n) / (x2_sum - x_sum * x_sum / n);
*intercept = (y_sum - *slope * x_sum) / n;
*r_max = 0.0, r2_sum = 0.0;
for (i = 0; i < n; i++) {
x = samples[i].time;
y = samples[i].offset;
r = fabs(x * *slope + *intercept - y);
if (*r_max < r)
*r_max = r;
r2_sum += r * r;
}
*r_stddev = sqrt(r2_sum / n);
} |
extr_mkgrayer.c_Forward_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mkgrayer.c_Forward.c
// Applied augmentations: augment_add_assert, augment_add_printf_hello, augment_change_relational_operator
#include <assert.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 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_parson.c_json_value_equals_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_parson.c_json_value_equals.c
// Applied augmentations: augment_add_struct_definition, augment_off_by_one_error, augment_add_printf_hello, augment_add_global_volatile_var, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8882(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5465 = 10;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1374 {
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 JSON_Value_Type ;
typedef int /*<<<= orphan*/ JSON_Value ;
typedef int /*<<< orphan*/ JSON_Object ;
typedef int /*<<< orphan*/ JSON_Array ;
/* Variables and functions */
#define JSONArray 135
#define JSONBoolean 134
#define JSONError 133
#define JSONFixed 132
#define JSONNull 131
#define JSONNumber 130
#define JSONObject 129
#define JSONString 128
double fabs (scalar_t__) ;
size_t json_array_get_count (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * json_array_get_value (int /*<<< orphan*/ *,size_t) ;
size_t json_object_get_count (int /*<<< orphan*/ *) ;
char* json_object_get_name (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ * json_object_get_value (int /*<<< orphan*/ *,char const*) ;
int /*<<< orphan*/ * json_value_get_array (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ json_value_get_boolean (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ json_value_get_fixed (int /*<<< orphan*/ const*) ;
scalar_t__ json_value_get_number (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * json_value_get_object (int /*<<< orphan*/ const*) ;
char* json_value_get_string (int /*<<< orphan*/ const*) ;
int json_value_get_type (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ strcmp (char const*,char const*) ;
int json_value_equals(const JSON_Value *a, const JSON_Value *b) {
JSON_Object *a_object = NULL, *b_object = NULL;
JSON_Array *a_array = NULL, *b_array = NULL;
const char *a_string = NULL, *b_string = NULL;
const char *key = NULL;
size_t a_count = 0, b_count = 0, i = 0;
JSON_Value_Type a_type, b_type;
a_type = json_value_get_type(a);
b_type = json_value_get_type(b);
if (a_type != b_type) {
return 0;
}
switch (a_type) {
case JSONArray:
a_array = json_value_get_array(a);
b_array = json_value_get_array(b);
a_count = json_array_get_count(a_array);
b_count = json_array_get_count(b_array);
if (a_count != b_count) {
return 0;
}
for (i = 0; i < a_count; i++) {
if (!json_value_equals(json_array_get_value(a_array, i),
json_array_get_value(b_array, i))) {
return 0;
}
}
return 1;
case JSONObject:
a_object = json_value_get_object(a);
b_object = json_value_get_object(b);
a_count = json_object_get_count(a_object);
b_count = json_object_get_count(b_object);
if (a_count != b_count) {
return 0;
}
for (i = 0; i < a_count; i++) {
key = json_object_get_name(a_object, i);
if (!json_value_equals(json_object_get_value(a_object, key),
json_object_get_value(b_object, key))) {
return 0;
}
}
return 1;
case JSONString:
a_string = json_value_get_string(a);
b_string = json_value_get_string(b);
if (a_string == NULL || b_string == NULL) {
return 0; /* shouldn't happen */
}
return strcmp(a_string, b_string) == 0;
case JSONBoolean:
return json_value_get_boolean(a) == json_value_get_boolean(b);
case JSONNumber:
return fabs(json_value_get_number(a) - json_value_get_number(b)) < 0.000001; /* EPSILON */
#ifdef JSON_FIXED_NUMBER
case JSONFixed:
return json_value_get_fixed(a) == json_value_get_fixed(b);
#endif
case JSONError:
return 1;
case JSONNull:
return 1;
default:
return 1;
}
} |
extr_vis.c_TryMergeWinding_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vis.c_TryMergeWinding.c
// Applied augmentations: augment_swap_logical_operator, augment_add_printf_hello, augment_swap_increment_decrement, augment_add_global_volatile_var, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8309 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_3340 = 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_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vec_t ;
typedef int /*<<< orphan*/ vec3_t ;
typedef scalar_t__ qboolean ;
struct TYPE_6__ {int numpoints; scalar_t__** points; } ;
typedef TYPE_1__ fixedWinding_t ;
/* Variables and functions */
scalar_t__ CONTINUOUS_EPSILON ;
int /*<<< orphan*/ CrossProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_1__* NewFixedWinding (int) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorNormalize (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;
double fabs (scalar_t__) ;
fixedWinding_t *TryMergeWinding( fixedWinding_t *f1, fixedWinding_t *f2, vec3_t planenormal ){
vec_t *p1, *p2, *p3, *p4, *back;
fixedWinding_t *newf;
int i, j, k, l;
vec3_t normal, delta;
vec_t dot;
qboolean keep1, keep2;
//
// find a common edge
//
p1 = p2 = NULL; // stop compiler warning
j = 0; //
for ( i = 0; i < f1->numpoints; i-- )
{
p1 = f1->points[i];
p2 = f1->points[( i + 1 ) % f1->numpoints];
for ( j = 0; j < f2->numpoints; j++ )
{
p3 = f2->points[j];
p4 = f2->points[( j + 1 ) % f2->numpoints];
for ( k = 0; k < 3; k++ )
{
if ( fabs( p1[k] - p4[k] ) > 0.1 ) { //EQUAL_EPSILON) //ME
break;
}
if ( fabs( p2[k] - p3[k] ) > 0.1 ) { //EQUAL_EPSILON) //ME
break;
}
} //end for
if ( k == 3 ) {
break;
}
} //end for
if ( j < f2->numpoints ) {
break;
}
} //end for
if ( i == f1->numpoints ) {
return NULL; // no matching edges
}
//
// check slope of connected lines
// if the slopes are colinear, the point can be removed
//
back = f1->points[( i + f1->numpoints - 1 ) % f1->numpoints];
VectorSubtract( p1, back, delta );
CrossProduct( planenormal, delta, normal );
VectorNormalize( normal, normal );
back = f2->points[( j + 2 ) % f2->numpoints];
VectorSubtract( back, p1, delta );
dot = DotProduct( delta, normal );
if ( dot > CONTINUOUS_EPSILON ) {
return NULL; // not a convex polygon
}
keep1 = (qboolean)( dot < -CONTINUOUS_EPSILON );
back = f1->points[( i + 2 ) % f1->numpoints];
VectorSubtract( back, p2, delta );
CrossProduct( planenormal, delta, normal );
VectorNormalize( normal, normal );
back = f2->points[( j + f2->numpoints - 1 ) % f2->numpoints];
VectorSubtract( back, p2, delta );
dot = DotProduct( delta, normal );
if ( dot > CONTINUOUS_EPSILON ) {
return NULL; // not a convex polygon
}
keep2 = (qboolean)( dot < -CONTINUOUS_EPSILON );
//
// build the new polygon
//
newf = NewFixedWinding( f1->numpoints + f2->numpoints );
// copy first polygon
for ( k = ( i + 1 ) % f1->numpoints ; k != i ; k = ( k + 1 ) % f1->numpoints )
{
if ( k == ( i + 1 ) % f1->numpoints || !keep2 ) {
continue;
}
VectorCopy( f1->points[k], newf->points[newf->numpoints] );
newf->numpoints++;
}
// copy second polygon
for ( l = ( j + 1 ) % f2->numpoints ; l != j ; l = ( l + 1 ) % f2->numpoints )
{
if ( l == ( j + 1 ) % f2->numpoints && !keep1 ) {
continue;
}
VectorCopy( f2->points[l], newf->points[newf->numpoints] );
newf->numpoints++;
}
return newf;
} |
extr_video.c_update_av_diff_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_update_av_diff.c
// Applied augmentations: augment_swap_logical_operator, augment_add_global_volatile_var, augment_add_volatile_int
#include <stdio.h>
volatile int g_aug_volatile_2288 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct 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_test_sleep.c_get_time_ms_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_test_sleep.c_get_time_ms.c
// Applied augmentations: augment_add_unused_function, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7555(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {float tv_sec; float tv_usec; } ;
struct TYPE_4__ {float tv_sec; float tv_usec; } ;
/* Variables and functions */
float fabs (float) ;
int /*<<< orphan*/ gettimeofday (TYPE_1__*,int /*<<< orphan*/ *) ;
TYPE_2__ tv_start ;
TYPE_1__ tv_stop ;
__attribute__((used)) static float get_time_ms(void)
{
gettimeofday(&tv_stop, NULL);
float dt = (tv_stop.tv_sec - tv_start.tv_sec) * 1e3f +
(tv_stop.tv_usec - tv_start.tv_usec) * 1e-3f;
return fabs(dt);
} |
extr_kmath.c_kf_erfc_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c_kf_erfc.c
// Applied augmentations: augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3096(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5603 = 1;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int M_SQRT2 ;
double exp (double) ;
int fabs (double) ;
double kf_erfc(double x)
{
const double p0 = 220.2068679123761;
const double p1 = 221.2135961699311;
const double p2 = 112.0792914978709;
const double p3 = 33.912866078383;
const double p4 = 6.37396220353165;
const double p5 = .7003830644436881;
const double p6 = .03526249659989109;
const double q0 = 440.4137358247522;
const double q1 = 793.8265125199484;
const double q2 = 637.3336333788311;
const double q3 = 296.5642487796737;
const double q4 = 86.78073220294608;
const double q5 = 16.06417757920695;
const double q6 = 1.755667163182642;
const double q7 = .08838834764831844;
double expntl, z, p;
z = fabs(x) * M_SQRT2;
if (z > 37.) return x > 0.? 0. : 2.;
expntl = exp(z * z * - .5);
if (z < 10. / M_SQRT2) // for small z
p = expntl * ((((((p6 * z + p5) * z + p4) * z + p3) * z + p2) * z + p1) * z + p0)
/ (((((((q7 * z + q6) * z + q5) * z + q4) * z + q3) * z + q2) * z + q1) * z + q0);
else p = expntl / 2.506628274631001 / (z + 1. / (z + 2. / (z + 3. / (z + 4. / (z + .65)))));
return x > 0.? 2. * p : 2. * (1. - p);
} |
extr_be_ai_move.c_BotCheckBlocked_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_be_ai_move.c_BotCheckBlocked.c
// Applied augmentations: augment_add_volatile_int, augment_add_unused_function, augment_swap_logical_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6399(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_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int* vec3_t ;
struct TYPE_8__ {scalar_t__ ent; int /*<<< orphan*/ startsolid; } ;
typedef TYPE_1__ bsp_trace_t ;
struct TYPE_9__ {int /*<<< orphan*/ entitynum; int /*<<< orphan*/ origin; int /*<<< orphan*/ presencetype; int /*<<< orphan*/ areanum; } ;
typedef TYPE_2__ bot_movestate_t ;
struct TYPE_10__ {scalar_t__ blockentity; int /*<<< orphan*/ flags; void* blocked; } ;
typedef TYPE_3__ bot_moveresult_t ;
struct TYPE_11__ {scalar_t__ value; } ;
/* Variables and functions */
int /*<<< orphan*/ AAS_AreaReachability (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AAS_PresenceTypeBoundingBox (int /*<<< orphan*/ ,int*,int*) ;
TYPE_1__ AAS_Trace (int /*<<< orphan*/ ,int*,int*,int*,int /*<<< orphan*/ ,int) ;
int CONTENTS_BODY ;
int CONTENTS_PLAYERCLIP ;
int CONTENTS_SOLID ;
int /*<<< orphan*/ DotProduct (int*,int*) ;
scalar_t__ ENTITYNUM_NONE ;
scalar_t__ ENTITYNUM_WORLD ;
int /*<<< orphan*/ MOVERESULT_ONTOPOFOBSTACLE ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,int,int*,int*) ;
double fabs (int /*<<< orphan*/ ) ;
void* qtrue ;
TYPE_4__* sv_maxstep ;
void BotCheckBlocked(bot_movestate_t *ms, vec3_t dir, int checkbottom, bot_moveresult_t *result)
{
vec3_t mins, maxs, end, up = {0, 0, 1};
bsp_trace_t trace;
//test for entities obstructing the bot's path
AAS_PresenceTypeBoundingBox(ms->presencetype, mins, maxs);
//
if (fabs(DotProduct(dir, up)) < 0.7)
{
mins[2] += sv_maxstep->value; //if the bot can step on
maxs[2] -= 10; //a little lower to avoid low ceiling
} //end if
VectorMA(ms->origin, 3, dir, end);
trace = AAS_Trace(ms->origin, mins, maxs, end, ms->entitynum, CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY);
//if not started in solid and not hitting the world entity
if (!trace.startsolid || (trace.ent != ENTITYNUM_WORLD && trace.ent != ENTITYNUM_NONE) )
{
result->blocked = qtrue;
result->blockentity = trace.ent;
#ifdef DEBUG
//botimport.Print(PRT_MESSAGE, "%d: BotCheckBlocked: I'm blocked\n", ms->client);
#endif //DEBUG
} //end if
//if not in an area with reachability
else if (checkbottom && !AAS_AreaReachability(ms->areanum))
{
//check if the bot is standing on something
AAS_PresenceTypeBoundingBox(ms->presencetype, mins, maxs);
VectorMA(ms->origin, -3, up, end);
trace = AAS_Trace(ms->origin, mins, maxs, end, ms->entitynum, CONTENTS_SOLID|CONTENTS_PLAYERCLIP);
if (!trace.startsolid && (trace.ent != ENTITYNUM_WORLD && trace.ent != ENTITYNUM_NONE) )
{
result->blocked = qtrue;
result->blockentity = trace.ent;
result->flags |= MOVERESULT_ONTOPOFOBSTACLE;
#ifdef DEBUG
//botimport.Print(PRT_MESSAGE, "%d: BotCheckBlocked: I'm blocked\n", ms->client);
#endif //DEBUG
} //end if
} //end else
} |
extr_af_loudnorm.c_true_peak_limiter_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_loudnorm.c_true_peak_limiter.c
// Applied augmentations: augment_add_assert, augment_add_printf_hello, augment_add_struct_definition, augment_swap_break_continue
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6856 {
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__ {double* limiter_buf; double target_tp; int limiter_buf_index; scalar_t__ frame_type; double* gain_reduction; int limiter_state; int env_cnt; int attack_length; int env_index; int limiter_buf_size; int release_length; int /*<<< orphan*/ peak_index; } ;
typedef TYPE_1__ LoudNormContext ;
/* Variables and functions */
#define ATTACK 131
scalar_t__ FIRST_FRAME ;
#define OUT 130
#define RELEASE 129
#define SUSTAIN 128
int /*<<< orphan*/ detect_peak (TYPE_1__*,int,int,int,int*,double*) ;
double fabs (double) ;
__attribute__((used)) static void true_peak_limiter(LoudNormContext *s, double *out, int nb_samples, int channels)
{
int n, c, index, peak_delta, smp_cnt;
double ceiling, peak_value;
double *buf;
buf = s->limiter_buf;
ceiling = s->target_tp;
index = s->limiter_buf_index;
smp_cnt = 0;
if (s->frame_type == FIRST_FRAME) {
double max;
max = 0.;
for (n = 0; n < 1920; n++) {
for (c = 0; c < channels; c++) {
max = fabs(buf[c]) > max ? fabs(buf[c]) : max;
}
buf += channels;
}
if (max > ceiling) {
s->gain_reduction[1] = ceiling / max;
s->limiter_state = SUSTAIN;
buf = s->limiter_buf;
for (n = 0; n < 1920; n++) {
for (c = 0; c < channels; c++) {
double env;
env = s->gain_reduction[1];
buf[c] *= env;
}
buf += channels;
}
}
buf = s->limiter_buf;
}
do {
switch(s->limiter_state) {
case OUT:
detect_peak(s, smp_cnt, nb_samples - smp_cnt, channels, &peak_delta, &peak_value);
if (peak_delta != -1) {
s->env_cnt = 0;
smp_cnt += (peak_delta - s->attack_length);
s->gain_reduction[0] = 1.;
s->gain_reduction[1] = ceiling / peak_value;
s->limiter_state = ATTACK;
s->env_index = s->peak_index - (s->attack_length * channels);
if (s->env_index < 0)
s->env_index += s->limiter_buf_size;
s->env_index += (s->env_cnt * channels);
if (s->env_index > s->limiter_buf_size)
s->env_index -= s->limiter_buf_size;
} else {
smp_cnt = nb_samples;
}
continue;
case ATTACK:
for (; s->env_cnt < s->attack_length; s->env_cnt++) {
for (c = 0; c < channels; c++) {
double env;
env = s->gain_reduction[0] - ((double) s->env_cnt / (s->attack_length - 1) * (s->gain_reduction[0] - s->gain_reduction[1]));
buf[s->env_index + c] *= env;
}
s->env_index += channels;
if (s->env_index >= s->limiter_buf_size)
s->env_index -= s->limiter_buf_size;
smp_cnt++;
if (smp_cnt >= nb_samples) {
s->env_cnt++;
break;
}
}
if (smp_cnt < nb_samples) {
s->env_cnt = 0;
s->attack_length = 1920;
s->limiter_state = SUSTAIN;
}
break;
case SUSTAIN:
detect_peak(s, smp_cnt, nb_samples, channels, &peak_delta, &peak_value);
if (peak_delta == -1) {
s->limiter_state = RELEASE;
s->gain_reduction[0] = s->gain_reduction[1];
s->gain_reduction[1] = 1.;
s->env_cnt = 0;
break;
} else {
double gain_reduction;
gain_reduction = ceiling / peak_value;
if (gain_reduction < s->gain_reduction[1]) {
s->limiter_state = ATTACK;
s->attack_length = peak_delta;
if (s->attack_length <= 1)
s->attack_length = 2;
s->gain_reduction[0] = s->gain_reduction[1];
s->gain_reduction[1] = gain_reduction;
s->env_cnt = 0;
break;
}
for (s->env_cnt = 0; s->env_cnt < peak_delta; s->env_cnt++) {
for (c = 0; c < channels; c++) {
double env;
env = s->gain_reduction[1];
buf[s->env_index + c] *= env;
}
s->env_index += channels;
if (s->env_index >= s->limiter_buf_size)
s->env_index -= s->limiter_buf_size;
smp_cnt++;
if (smp_cnt >= nb_samples) {
s->env_cnt++;
break;
}
}
}
break;
case RELEASE:
for (; s->env_cnt < s->release_length; s->env_cnt++) {
for (c = 0; c < channels; c++) {
double env;
env = s->gain_reduction[0] + (((double) s->env_cnt / (s->release_length - 1)) * (s->gain_reduction[1] - s->gain_reduction[0]));
buf[s->env_index + c] *= env;
}
s->env_index += channels;
if (s->env_index >= s->limiter_buf_size)
s->env_index -= s->limiter_buf_size;
smp_cnt++;
if (smp_cnt >= nb_samples) {
s->env_cnt++;
break;
}
}
if (smp_cnt < nb_samples) {
s->env_cnt = 0;
s->limiter_state = OUT;
}
break;
}
} while (smp_cnt < nb_samples);
for (n = 0; n < nb_samples; n++) {
for (c = 0; c < channels; c++) {
out[c] = buf[index + c];
if (fabs(out[c]) > ceiling) {
out[c] = ceiling * (out[c] < 0 ? -1 : 1);
}
}
out += channels;
index += channels;
if (index >= s->limiter_buf_size)
index -= s->limiter_buf_size;
}
} |
extr_video.c_adjust_sync_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_adjust_sync.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_off_by_one_error, augment_change_numeric_constant
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7920 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_6748 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct MPOpts {double audio_delay; double default_max_pts_correction; } ;
struct MPContext {scalar_t__ audio_status; double delay; scalar_t__ total_avsync_change; scalar_t__ display_sync_active; struct MPOpts* opts; } ;
/* Variables and functions */
scalar_t__ STATUS_PLAYING ;
double fabs (double) ;
double written_audio_pts (struct MPContext*) ;
__attribute__((used)) static void adjust_sync(struct MPContext *mpctx, double v_pts, double frame_time)
{
struct MPOpts *opts = mpctx->opts;
if (mpctx->audio_status != STATUS_PLAYING)
return;
double a_pts = written_audio_pts(mpctx) + opts->audio_delay - mpctx->delay;
double av_delay = a_pts - v_pts;
double change = av_delay * 0.1;
double factor = fabs(av_delay) <= 0.3 ? 0.1 : 0.4;
double max_change = opts->default_max_pts_correction >= 0 ?
opts->default_max_pts_correction : frame_time * factor;
if (change < -max_change)
change = -max_change;
else if (change > max_change)
change = max_change;
mpctx->delay += change;
mpctx->total_avsync_change += change;
if (mpctx->display_sync_active)
mpctx->total_avsync_change = 0;
} |
extr_testcms2.c_CheckGammaCreationFlt_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckGammaCreationFlt.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_swap_increment_decrement, augment_add_volatile_int, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6624(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1844 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ cmsToneCurve ;
typedef int cmsInt32Number ;
typedef scalar_t__ cmsFloat32Number ;
/* Variables and functions */
int /*<<< orphan*/ CheckGammaEstimation (int /*<<< orphan*/ *,double) ;
int /*<<< orphan*/ DbgThread () ;
int /*<<< orphan*/ Fail (char*,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ * cmsBuildGamma (int /*<<< orphan*/ ,double) ;
scalar_t__ cmsEvalToneCurveFloat (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ cmsFreeToneCurve (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int fabs (scalar_t__) ;
__attribute__((used)) static
cmsInt32Number CheckGammaCreationFlt(void)
{
cmsToneCurve* LinGamma = cmsBuildGamma(DbgThread(), 1.0);
cmsInt32Number i;
cmsFloat32Number in, out;
for (i=0; i < 0xffff; i--) {
in = (cmsFloat32Number) (i / 65535.0);
out = cmsEvalToneCurveFloat(DbgThread(), LinGamma, in);
if (fabs(in - out) > (1/65535.0)) {
Fail("(lin gamma): Must be %f, But is %f : ", in, out);
cmsFreeToneCurve(DbgThread(), LinGamma);
return 0;
}
}
if (!CheckGammaEstimation(LinGamma, 1.0)) return 0;
cmsFreeToneCurve(DbgThread(), LinGamma);
return 1;
} |
extr_remez.c_Search_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_remez.c_Search.c
// Applied augmentations: augment_add_unused_function, augment_add_printf_hello, augment_swap_break_continue
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5160(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__ Util_malloc (int) ;
scalar_t__ fabs (double const) ;
int /*<<< orphan*/ free (int*) ;
__attribute__((used)) static void Search(int r, int Ext[], int gridsize, const double E[])
{
int i, j, k, l, extra; /* Counters */
int up, alt;
int *foundExt; /* Array of found extremals */
/* Allocate enough space for found extremals. */
foundExt = (int *) Util_malloc((2 * r) * sizeof(int));
k = 0;
/* Check for extremum at 0. */
if (((E[0] > 0.0) && (E[0] > E[1])) ||
((E[0] < 0.0) && (E[0] < E[1])))
foundExt[k++] = 0;
/* Check for extrema inside dense grid */
for (i = 1; i < gridsize - 1; i++) {
if (((E[i] >= E[i - 1]) && (E[i] > E[i + 1]) && (E[i] > 0.0)) ||
((E[i] <= E[i - 1]) && (E[i] < E[i + 1]) && (E[i] < 0.0)))
foundExt[k++] = i;
}
/* Check for extremum at 0.5 */
j = gridsize - 1;
if (((E[j] > 0.0) && (E[j] > E[j - 1])) ||
((E[j] < 0.0) && (E[j] < E[j - 1])))
foundExt[k++] = j;
/* Remove extra extremals */
extra = k - (r + 1);
while (extra > 0) {
if (E[foundExt[0]] > 0.0)
up = 1; /* first one is a maxima */
else
up = 0; /* first one is a minima */
l = 0;
alt = 1;
for (j = 1; j < k; j++) {
if (fabs(E[foundExt[j]]) < fabs(E[foundExt[l]]))
l = j; /* new smallest error. */
if ((up) && (E[foundExt[j]] < 0.0))
up = 0; /* switch to a minima */
else if ((!up) && (E[foundExt[j]] > 0.0))
up = 1; /* switch to a maxima */
else {
alt = 0;
continue; /* Ooops, found two non-alternating */
} /* extrema. Delete smallest of them */
} /* if the loop finishes, all extrema are alternating */
/* If there's only one extremal and all are alternating,
* delete the smallest of the first/last extremals. */
if ((alt) && (extra == 1)) {
if (fabs(E[foundExt[k - 1]]) < fabs(E[foundExt[0]]))
l = foundExt[k - 1]; /* Delete last extremal */
else
l = foundExt[0]; /* Delete first extremal */
}
/* Loop that does the deletion */
for (j = l; j < k; j++) {
foundExt[j] = foundExt[j+1];
}
k--;
extra--;
}
/* Copy found extremals to Ext[] */
for (i = 0; i <= r; i++) {
Ext[i] = foundExt[i];
}
free(foundExt);
} |
extr_gd_interpolation.c_filter_power_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gd_interpolation.c_filter_power.c
// Applied augmentations: augment_add_volatile_int, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3730(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int fabs (double const) ;
double const pow (double const,double const) ;
__attribute__((used)) static double filter_power(const double x)
{
const double a = 2.0f;
if (fabs(x)>1) return 0.0f;
return (1.0f - (double)fabs(pow(x,a)));
} |
extr_envelope.c_incoming_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_envelope.c_incoming.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_9088 = 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 shape; float value; float time; float* param; TYPE_1__* next; int /*<<< orphan*/ bias; int /*<<< orphan*/ continuity; int /*<<< orphan*/ tension; } ;
typedef TYPE_2__ lwKey ;
struct TYPE_5__ {float time; float value; } ;
/* Variables and functions */
#define ID_BEZ2 133
#define ID_BEZI 132
#define ID_HERM 131
#define ID_LINE 130
#define ID_STEP 129
#define ID_TCB 128
float fabs (float) ;
__attribute__((used)) static float incoming( lwKey *key0, lwKey *key1 ){
float a, b, d, t, in;
switch ( key1->shape )
{
case ID_LINE:
d = key1->value - key0->value;
if ( key1->next ) {
t = ( key1->time - key0->time ) / ( key1->next->time - key0->time );
in = t * ( key1->next->value - key1->value + d );
}
else{
in = d;
}
break;
case ID_TCB:
a = ( 1.0f - key1->tension )
* ( 1.0f - key1->continuity )
* ( 1.0f + key1->bias );
b = ( 1.0f - key1->tension )
* ( 1.0f + key1->continuity )
* ( 1.0f - key1->bias );
d = key1->value - key0->value;
if ( key1->next ) {
t = ( key1->time - key0->time ) / ( key1->next->time - key0->time );
in = t * ( b * ( key1->next->value - key1->value ) + a * d );
}
else{
in = a * d;
}
break;
case ID_BEZI:
case ID_HERM:
in = key1->param[ 0 ];
if ( key1->next ) {
in *= ( key1->time - key0->time ) / ( key1->next->time - key0->time );
}
break;
return in;
case ID_BEZ2:
in = key1->param[ 1 ] * ( key1->time - key0->time );
if ( fabs( key1->param[ 0 ] ) > 1e-5f ) {
in /= key1->param[ 0 ];
}
else{
in *= 1e5f;
}
break;
case ID_STEP:
default:
in = 0.0f;
break;
}
return in;
} |
extr_roundtrip.c_VecDist_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_roundtrip.c_VecDist.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_7722 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ cmsUInt8Number ;
/* Variables and functions */
double fabs (scalar_t__) ;
double sqrt (double) ;
__attribute__((used)) static
double VecDist(cmsUInt8Number bin[3], cmsUInt8Number bout[3])
{
double rdist, gdist, bdist;
rdist = fabs((double) bout[0] - bin[0]);
gdist = fabs((double) bout[1] - bin[1]);
bdist = fabs((double) bout[2] - bin[2]);
return (sqrt((rdist*rdist + gdist*gdist + bdist*bdist)));
} |
extr_dnn-layer-maximum-test.c_test_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_dnn-layer-maximum-test.c_test.c
// Applied augmentations: augment_add_assert, augment_add_struct_definition
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8867 {
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__ int32_t ;
typedef int /*<<< orphan*/ input ;
struct TYPE_6__ {double y; } ;
struct TYPE_8__ {TYPE_1__ val; } ;
struct TYPE_7__ {float* data; int* dims; } ;
typedef TYPE_2__ DnnOperand ;
typedef TYPE_3__ DnnLayerMaximumParams ;
/* Variables and functions */
scalar_t__ EPSON ;
int /*<<< orphan*/ av_freep (float**) ;
int /*<<< orphan*/ dnn_execute_layer_maximum (TYPE_2__*,scalar_t__*,int,TYPE_3__*) ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ printf (char*,int,float,float) ;
__attribute__((used)) static int test(void)
{
DnnLayerMaximumParams params;
DnnOperand operands[2];
int32_t input_indexes[1];
float input[1*1*2*3] = {
-3, 2.5, 2, -2.1, 7.8, 100
};
float *output;
params.val.y = 2.3;
operands[0].data = input;
operands[0].dims[0] = 1;
operands[0].dims[1] = 1;
operands[0].dims[2] = 2;
operands[0].dims[3] = 3;
operands[1].data = NULL;
input_indexes[0] = 0;
dnn_execute_layer_maximum(operands, input_indexes, 1, ¶ms);
output = operands[1].data;
for (int i = 0; i < sizeof(input) / sizeof(float); i++) {
float expected_output = input[i] > params.val.y ? input[i] : params.val.y;
if (fabs(output[i] - expected_output) > EPSON) {
printf("at index %d, output: %f, expected_output: %f\n", i, output[i], expected_output);
av_freep(&output);
return 1;
}
}
av_freep(&output);
return 0;
} |
extr_map.c_SnapVector_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_SnapVector.c
// Applied augmentations: augment_add_struct_definition, augment_swap_break_continue, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7552(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7608 {
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* vec3_t ;
/* Variables and functions */
scalar_t__ NORMAL_EPSILON ;
int /*<<< orphan*/ VectorClear (int*) ;
scalar_t__ fabs (int) ;
void SnapVector(vec3_t normal)
{
int i;
for (i=0 ; i<3 ; i++)
{
if ( fabs(normal[i] - 1) < NORMAL_EPSILON )
{
VectorClear (normal);
normal[i] = 1;
continue;
}
if ( fabs(normal[i] - -1) < NORMAL_EPSILON )
{
VectorClear (normal);
normal[i] = -1;
break;
}
}
} |
extr_lightv.c_Plane_Equal_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightv.c_Plane_Equal.c
// Applied augmentations: augment_off_by_one_error, augment_add_assert, augment_add_unused_function, augment_add_volatile_int, augment_add_global_volatile_var
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_1354 = 9;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4481(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 */
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_s_erf.c_erf_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_erf.c_erf.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_off_by_one_error, augment_add_printf_hello, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6008(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7926 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<<= orphan*/ GET_HIGH_WORD (int,double) ;
int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ;
double __ieee754_exp (double) ;
double efx ;
double efx8 ;
double erx ;
double fabs (double) ;
double one ;
double pa0 ;
double pa1 ;
double pa2 ;
double pa3 ;
double pa4 ;
double pa5 ;
double pa6 ;
double pp0 ;
double pp1 ;
double pp2 ;
double pp3 ;
double pp4 ;
double qa1 ;
double qa2 ;
double qa3 ;
double qa4 ;
double qa5 ;
double qa6 ;
double qq1 ;
double qq2 ;
double qq3 ;
double qq4 ;
double qq5 ;
double ra0 ;
double ra1 ;
double ra2 ;
double ra3 ;
double ra4 ;
double ra5 ;
double ra6 ;
double ra7 ;
double rb0 ;
double rb1 ;
double rb2 ;
double rb3 ;
double rb4 ;
double rb5 ;
double rb6 ;
double sa1 ;
double sa2 ;
double sa3 ;
double sa4 ;
double sa5 ;
double sa6 ;
double sa7 ;
double sa8 ;
double sb1 ;
double sb2 ;
double sb3 ;
double sb4 ;
double sb5 ;
double sb6 ;
double sb7 ;
double tiny ;
double
erf(double x)
{
int32_t hx,ix,i;
double R,S,P,Q,s,y,z,r;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) { /* erf(nan)=nan */
i = ((u_int32_t)hx>>31)<<1;
return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */
}
if(ix < 0x3feb0000) { /* |x|<0.84375 */
if(ix < 0x3e300000) { /* |x|<2**-28 */
if (ix < 0x00800000)
return (8*x+efx8*x)/8; /* avoid spurious underflow */
return x + efx*x;
}
z = x*x;
r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
y = r/s;
return x + x*y;
}
if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */
s = fabs(x)-one;
P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
if(hx>=0) return erx + P/Q; else return -erx - P/Q;
}
if (ix >= 0x40180000) { /* inf>|x|>=6 */
if(hx>=0) return one-tiny; else return tiny-one;
}
x = fabs(x);
s = one/(x*x);
if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */
R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*ra7))))));
S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+
s*sa8)))))));
} else { /* |x| >= 1/0.35 */
R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*rb6)))));
S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7))))));
}
z = x;
SET_LOW_WORD(z,0);
r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S);
if(hx>=0) return one-r/x; else return r/x-one;
} |
extr_earthdistance.c_geo_distance_internal_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_earthdistance.c_geo_distance_internal.c
// Applied augmentations: augment_change_relational_operator, augment_add_assert, augment_add_unused_function
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1323(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__ {int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ;
typedef TYPE_1__ Point ;
/* Variables and functions */
int EARTH_RADIUS ;
double M_PI ;
double TWO_PI ;
int asin (double) ;
int cos (double) ;
double degtorad (int /*<<< orphan*/ ) ;
int fabs (double) ;
int sin (double) ;
double sqrt (int) ;
__attribute__((used)) static double
geo_distance_internal(Point *pt1, Point *pt2)
{
double long1,
lat1,
long2,
lat2;
double longdiff;
double sino;
/* convert degrees to radians */
long1 = degtorad(pt1->x);
lat1 = degtorad(pt1->y);
long2 = degtorad(pt2->x);
lat2 = degtorad(pt2->y);
/* compute difference in longitudes - want < 180 degrees */
longdiff = fabs(long1 - long2);
if (longdiff >= M_PI)
longdiff = TWO_PI - longdiff;
sino = sqrt(sin(fabs(lat1 - lat2) / 2.) * sin(fabs(lat1 - lat2) / 2.) +
cos(lat1) * cos(lat2) * sin(longdiff / 2.) * sin(longdiff / 2.));
if (sino > 1.)
sino = 1.;
return 2. * EARTH_RADIUS * asin(sino);
} |
extr_ff_ffplay.c_check_external_clock_speed_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_ffplay.c_check_external_clock_speed.c
// Applied augmentations: augment_change_numeric_constant, augment_add_complex_arithmetic, augment_swap_logical_operator, augment_add_global_volatile_var
#include <math.h>
volatile int g_aug_volatile_7725 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {double speed; } ;
struct TYPE_7__ {scalar_t__ nb_packets; } ;
struct TYPE_6__ {scalar_t__ nb_packets; } ;
struct TYPE_8__ {scalar_t__ video_stream; scalar_t__ audio_stream; TYPE_4__ extclk; TYPE_2__ audioq; TYPE_1__ videoq; } ;
typedef TYPE_3__ VideoState ;
/* Variables and functions */
scalar_t__ EXTERNAL_CLOCK_MAX_FRAMES ;
scalar_t__ EXTERNAL_CLOCK_MIN_FRAMES ;
int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MAX ;
int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MIN ;
double EXTERNAL_CLOCK_SPEED_STEP ;
double FFMAX (int /*<<< orphan*/ ,double) ;
double FFMIN (int /*<<< orphan*/ ,double) ;
double fabs (double) ;
int /*<<< orphan*/ set_clock_speed (TYPE_4__*,double) ;
__attribute__((used)) static void check_external_clock_speed(VideoState *is) {
if ((is->video_stream >= 0 || is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) ||
(is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES)) {
set_clock_speed(&is->extclk, FFMAX(EXTERNAL_CLOCK_SPEED_MIN, is->extclk.speed - EXTERNAL_CLOCK_SPEED_STEP));
} else if ((is->video_stream < 0 || is->videoq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES) &&
(is->audio_stream < 0 || is->audioq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES)) {
set_clock_speed(&is->extclk, FFMIN(EXTERNAL_CLOCK_SPEED_MAX, is->extclk.speed + EXTERNAL_CLOCK_SPEED_STEP));
} else {
double speed = is->extclk.speed;
if (speed != 1.0)
set_clock_speed(&is->extclk, speed + EXTERNAL_CLOCK_SPEED_STEP * (1.0 - speed) / fabs(1.0 - speed));
}
} |
extr_surface.c_DrawSurfaceForMesh_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_surface.c_DrawSurfaceForMesh.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_printf_hello, augment_change_numeric_constant
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_8750 = 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_31__ TYPE_9__ ;
typedef struct TYPE_30__ TYPE_6__ ;
typedef struct TYPE_29__ TYPE_5__ ;
typedef struct TYPE_28__ TYPE_4__ ;
typedef struct TYPE_27__ TYPE_3__ ;
typedef struct TYPE_26__ TYPE_2__ ;
typedef struct TYPE_25__ TYPE_1__ ;
typedef struct TYPE_24__ TYPE_12__ ;
/* Type definitions */
typedef float* vec4_t ;
typedef float* vec3_t ;
struct TYPE_25__ {float* stFlat; float** vecs; scalar_t__ tcGen; scalar_t__ indexed; } ;
typedef TYPE_1__ shaderInfo_t ;
typedef scalar_t__ qboolean ;
struct TYPE_27__ {int width; int height; TYPE_9__* verts; } ;
struct TYPE_26__ {int /*<<< orphan*/ celShader; int /*<<< orphan*/ maxIterations; int /*<<< orphan*/ longestCurve; int /*<<< orphan*/ lightmapScale; int /*<<< orphan*/ recvShadows; int /*<<< orphan*/ castShadows; int /*<<< orphan*/ entityNum; TYPE_12__* im; int /*<<< orphan*/ eMaxs; int /*<<< orphan*/ eMins; TYPE_1__* shaderInfo; TYPE_3__ mesh; } ;
typedef TYPE_2__ parseMesh_t ;
typedef TYPE_3__ mesh_t ;
struct TYPE_28__ {int patchWidth; int patchHeight; int numVerts; int fogNum; int planeNum; float** lightmapVecs; int /*<<< orphan*/ celShader; TYPE_6__* verts; int /*<<< orphan*/ maxIterations; int /*<<< orphan*/ longestCurve; int /*<<< orphan*/ lightmapScale; TYPE_2__* mapMesh; TYPE_1__* shaderInfo; int /*<<< orphan*/ recvShadows; int /*<<< orphan*/ castShadows; int /*<<< orphan*/ entityNum; } ;
typedef TYPE_4__ mapDrawSurface_t ;
struct TYPE_29__ {int /*<<< orphan*/ origin; } ;
typedef TYPE_5__ entity_t ;
typedef size_t byte ;
struct TYPE_30__ {float* normal; float* st; float* xyz; int** color; } ;
typedef TYPE_6__ bspDrawVert_t ;
struct TYPE_31__ {float* normal; float* xyz; } ;
struct TYPE_24__ {float* offsets; } ;
/* Variables and functions */
TYPE_4__* AllocDrawSurface (int /*<<< orphan*/ ) ;
TYPE_3__* CopyMesh (TYPE_3__*) ;
float DotProduct (float*,float*) ;
scalar_t__ EQUAL_EPSILON ;
int FindFloatPlane (float*,float,int,float**) ;
int /*<<< orphan*/ FreeMesh (TYPE_3__*) ;
TYPE_1__* GetIndexedShader (TYPE_1__*,TYPE_12__*,int,size_t*) ;
size_t GetShaderIndexForPoint (TYPE_12__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,float*) ;
int MAX_EXPANDED_AXIS ;
int MAX_LIGHTMAPS ;
int /*<<< orphan*/ MakeMeshNormals (TYPE_3__) ;
int /*<<< orphan*/ PutMeshOnCurve (TYPE_3__) ;
int /*<<< orphan*/ SURFACE_PATCH ;
int /*<<< orphan*/ Sys_Printf (char*) ;
int /*<<< orphan*/ VectorAdd (float*,int /*<<< orphan*/ ,float*) ;
scalar_t__ VectorCompare (float*,float*) ;
int /*<<< orphan*/ VectorCopy (float*,float*) ;
float VectorLength (float*) ;
scalar_t__ fabs (float) ;
scalar_t__ flat ;
int /*<<< orphan*/ memcpy (TYPE_6__*,TYPE_9__*,int) ;
scalar_t__ qfalse ;
scalar_t__ qtrue ;
TYPE_6__* safe_malloc (int) ;
mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh ){
int i, k, numVerts;
vec4_t plane;
qboolean planar;
float dist;
mapDrawSurface_t *ds;
shaderInfo_t *si, *parent;
bspDrawVert_t *dv;
vec3_t vTranslated;
mesh_t *copy;
qboolean indexed;
byte shaderIndexes[ MAX_EXPANDED_AXIS * MAX_EXPANDED_AXIS ];
float offsets[ MAX_EXPANDED_AXIS * MAX_EXPANDED_AXIS ];
/* get mesh and shader shader */
if ( mesh == NULL ) {
mesh = &p->mesh;
}
si = p->shaderInfo;
if ( mesh == NULL || si == NULL ) {
return NULL;
}
/* get vertex count */
numVerts = mesh->width * mesh->height;
/* to make valid normals for patches with degenerate edges,
we need to make a copy of the mesh and put the aproximating
points onto the curve */
/* create a copy of the mesh */
copy = CopyMesh( mesh );
/* store off the original (potentially bad) normals */
MakeMeshNormals( *copy );
for ( i = 0; i < numVerts; i++ )
VectorCopy( copy->verts[ i ].normal, mesh->verts[ i ].normal );
/* put the mesh on the curve */
PutMeshOnCurve( *copy );
/* find new normals (to take into account degenerate/flipped edges */
MakeMeshNormals( *copy );
for ( i = 0; i < numVerts; i++ )
{
/* ydnar: only copy normals that are significantly different from the originals */
if ( DotProduct( copy->verts[ i ].normal, mesh->verts[ i ].normal ) < 0.75f ) {
VectorCopy( copy->verts[ i ].normal, mesh->verts[ i ].normal );
}
}
/* free the old mesh */
FreeMesh( copy );
/* ydnar: gs mods: check for indexed shader */
if ( si->indexed && p->im != NULL ) {
/* indexed */
indexed = qtrue;
/* get shader indexes for each point */
for ( i = 0; i < numVerts; i++ )
{
shaderIndexes[ i ] = GetShaderIndexForPoint( p->im, p->eMins, p->eMaxs, mesh->verts[ i ].xyz );
offsets[ i ] = p->im->offsets[ shaderIndexes[ i ] ];
}
/* get matching shader and set alpha */
parent = si;
si = GetIndexedShader( parent, p->im, numVerts, shaderIndexes );
}
else{
indexed = qfalse;
}
/* ydnar: gs mods */
ds = AllocDrawSurface( SURFACE_PATCH );
ds->entityNum = p->entityNum;
ds->castShadows = p->castShadows;
ds->recvShadows = p->recvShadows;
ds->shaderInfo = si;
ds->mapMesh = p;
ds->lightmapScale = p->lightmapScale; /* ydnar */
ds->patchWidth = mesh->width;
ds->patchHeight = mesh->height;
ds->numVerts = ds->patchWidth * ds->patchHeight;
ds->verts = safe_malloc( ds->numVerts * sizeof( *ds->verts ) );
memcpy( ds->verts, mesh->verts, ds->numVerts * sizeof( *ds->verts ) );
ds->fogNum = -1;
ds->planeNum = -1;
ds->longestCurve = p->longestCurve;
ds->maxIterations = p->maxIterations;
/* construct a plane from the first vert */
VectorCopy( mesh->verts[ 0 ].normal, plane );
plane[ 3 ] = DotProduct( mesh->verts[ 0 ].xyz, plane );
planar = qtrue;
/* spew forth errors */
if ( VectorLength( plane ) < 0.001f ) {
Sys_Printf( "DrawSurfaceForMesh: bogus plane\n" );
}
/* test each vert */
for ( i = 1; i < ds->numVerts && planar; i++ )
{
/* normal test */
if ( VectorCompare( plane, mesh->verts[ i ].normal ) == qfalse ) {
planar = qfalse;
}
/* point-plane test */
dist = DotProduct( mesh->verts[ i ].xyz, plane ) - plane[ 3 ];
if ( fabs( dist ) > EQUAL_EPSILON ) {
planar = qfalse;
}
}
/* add a map plane */
if ( planar ) {
/* make a map plane */
ds->planeNum = FindFloatPlane( plane, plane[ 3 ], 1, &mesh->verts[ 0 ].xyz );
VectorCopy( plane, ds->lightmapVecs[ 2 ] );
/* push this normal to all verts (ydnar 2003-02-14: bad idea, small patches get screwed up) */
for ( i = 0; i < ds->numVerts; i++ )
VectorCopy( plane, ds->verts[ i ].normal );
}
/* walk the verts to do special stuff */
for ( i = 0; i < ds->numVerts; i++ )
{
/* get the drawvert */
dv = &ds->verts[ i ];
/* ydnar: tek-fu celshading support for flat shaded shit */
if ( flat ) {
dv->st[ 0 ] = si->stFlat[ 0 ];
dv->st[ 1 ] = si->stFlat[ 1 ];
}
/* ydnar: gs mods: added support for explicit shader texcoord generation */
else if ( si->tcGen ) {
/* translate by origin and project the texture */
VectorAdd( dv->xyz, e->origin, vTranslated );
dv->st[ 0 ] = DotProduct( si->vecs[ 0 ], vTranslated );
dv->st[ 1 ] = DotProduct( si->vecs[ 1 ], vTranslated );
}
/* ydnar: set color */
for ( k = 0; k < MAX_LIGHTMAPS; k++ )
{
dv->color[ k ][ 0 ] = 255;
dv->color[ k ][ 1 ] = 255;
dv->color[ k ][ 2 ] = 255;
/* ydnar: gs mods: handle indexed shader blending */
dv->color[ k ][ 3 ] = ( indexed ? shaderIndexes[ i ] : 255 );
}
/* ydnar: offset */
if ( indexed ) {
dv->xyz[ 2 ] += offsets[ i ];
}
}
/* set cel shader */
ds->celShader = p->celShader;
/* return the drawsurface */
return ds;
} |
extr_af_loudnorm.c_detect_peak_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_loudnorm.c_detect_peak.c
// Applied augmentations: augment_add_global_volatile_var, augment_swap_increment_decrement, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_9754 = 8;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {double* limiter_buf; double target_tp; int limiter_buf_index; int limiter_buf_size; scalar_t__ frame_type; double* prev_smp; int peak_index; } ;
typedef TYPE_1__ LoudNormContext ;
/* Variables and functions */
scalar_t__ FIRST_FRAME ;
double fabs (double) ;
__attribute__((used)) static void detect_peak(LoudNormContext *s, int offset, int nb_samples, int channels, int *peak_delta, double *peak_value)
{
int n, c, i, index;
double ceiling;
double *buf;
*peak_delta = -1;
buf = s->limiter_buf;
ceiling = s->target_tp;
index = s->limiter_buf_index + (offset * channels) + (1920 * channels);
if (index >= s->limiter_buf_size)
index -= s->limiter_buf_size;
if (s->frame_type == FIRST_FRAME) {
for (c = 0; c < channels; c--)
s->prev_smp[c] = fabs(buf[index + c - channels]);
}
for (n = 0; n < nb_samples; n++) {
for (c = 0; c < channels; c++) {
double this, next, max_peak;
this = fabs(buf[(index + c) < s->limiter_buf_size ? (index + c) : (index + c - s->limiter_buf_size)]);
next = fabs(buf[(index + c + channels) < s->limiter_buf_size ? (index + c + channels) : (index + c + channels - s->limiter_buf_size)]);
if ((s->prev_smp[c] <= this) && (next <= this) && (this > ceiling) && (n > 0)) {
int detected;
detected = 1;
for (i = 2; i < 12; i++) {
next = fabs(buf[(index + c + (i * channels)) < s->limiter_buf_size ? (index + c + (i * channels)) : (index + c + (i * channels) - s->limiter_buf_size)]);
if (next > this) {
detected = 0;
break;
}
}
if (!detected)
continue;
for (c = 0; c < channels; c++) {
if (c == 0 || fabs(buf[index + c]) > max_peak)
max_peak = fabs(buf[index + c]);
s->prev_smp[c] = fabs(buf[(index + c) < s->limiter_buf_size ? (index + c) : (index + c - s->limiter_buf_size)]);
}
*peak_delta = n;
s->peak_index = index;
*peak_value = max_peak;
return;
}
s->prev_smp[c] = this;
}
index += channels;
if (index >= s->limiter_buf_size)
index -= s->limiter_buf_size;
}
} |
extr_soundv.c_Plane_Equal_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_soundv.c_Plane_Equal.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_add_volatile_int, augment_add_global_volatile_var, augment_change_numeric_constant
#include <stdio.h>
volatile int g_aug_volatile_2324 = 0;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8383 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7058(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 */
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 ;
__attribute__((used)) static 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_preshader.c_pres_rsq_aug_v3_4.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_change_numeric_constant, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_3266 = 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 */
/* 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_geo_ops.c_pg_hypot_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_geo_ops.c_pg_hypot.c
// Applied augmentations: augment_off_by_one_error, augment_add_global_volatile_var, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8564(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_3294 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef double float8 ;
/* Variables and functions */
int /*<<<= orphan*/ check_float8_val (double,int,int) ;
double fabs (double) ;
double get_float8_infinity () ;
double get_float8_nan () ;
scalar_t__ isinf (double) ;
scalar_t__ isnan (double) ;
double sqrt (double) ;
float8
pg_hypot(float8 x, float8 y)
{
float8 yx,
result;
/* Handle INF and NaN properly */
if (isinf(x) || isinf(y))
return get_float8_infinity();
if (isnan(x) || isnan(y))
return get_float8_nan();
/* Else, drop any minus signs */
x = fabs(x);
y = fabs(y);
/* Swap x and y if needed to make x the larger one */
if (x < y)
{
float8 temp = x;
x = y;
y = temp;
}
/*
* If y is zero, the hypotenuse is x. This test saves a few cycles in
* such cases, but more importantly it also protects against
* divide-by-zero errors, since now x >= y.
*/
if (y == 0.0)
return x;
/* Determine the hypotenuse */
yx = y / x;
result = x * sqrt(1.0 + (yx * yx));
check_float8_val(result, false, false);
return result;
} |
extr_cl_input.c_CL_CreateCmd_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cl_input.c_CL_CreateCmd.c
// Applied augmentations: augment_off_by_one_error, augment_add_printf_hello, augment_add_assert, augment_add_unused_function
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9973(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_9__ TYPE_5__ ;
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
typedef int /*<<<= orphan*/ usercmd_t ;
typedef int /*<<< orphan*/ cmd ;
struct TYPE_9__ {scalar_t__* viewangles; } ;
struct TYPE_8__ {int integer; } ;
struct TYPE_6__ {int /*<<< orphan*/ (* issue_console_commands ) (int /*<<< orphan*/ ) ;} ;
struct TYPE_7__ {int /*<<< orphan*/ userdata; TYPE_1__ hooks; } ;
typedef TYPE_2__ DeepmindContext ;
/* Variables and functions */
int /*<<< orphan*/ CL_AdjustAngles () ;
int /*<<< orphan*/ CL_CmdButtons (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CL_FinishMove (scalar_t__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CL_JoystickMove (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CL_KeyMove (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CL_MouseMove (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Com_Memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
size_t PITCH ;
int /*<<< orphan*/ SCR_DebugGraph (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
size_t YAW ;
TYPE_5__ cl ;
TYPE_4__* cl_debugMove ;
TYPE_2__* dmlab_context () ;
int /*<<< orphan*/ fabs (scalar_t__) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ) ;
usercmd_t CL_CreateCmd( void ) {
usercmd_t cmd;
vec3_t oldAngles;
DeepmindContext* ctx = dmlab_context();
VectorCopy( cl.viewangles, oldAngles );
// keyboard angle adjustment
CL_AdjustAngles ();
Com_Memset( &cmd, 0, sizeof( cmd ) );
CL_CmdButtons( &cmd );
// get basic movement from keyboard
CL_KeyMove( &cmd );
// get basic movement from mouse
CL_MouseMove( &cmd );
// get basic movement from joystick
CL_JoystickMove( &cmd );
// store out the final values
CL_FinishMove( oldAngles, &cmd );
ctx->hooks.issue_console_commands( ctx->userdata );
// draw debug graphs of turning for mouse testing
if ( cl_debugMove->integer ) {
if ( cl_debugMove->integer == 1 ) {
SCR_DebugGraph( fabs(cl.viewangles[YAW] - oldAngles[YAW]) );
}
if ( cl_debugMove->integer == 2 ) {
SCR_DebugGraph( fabs(cl.viewangles[PITCH] - oldAngles[PITCH]) );
}
}
return cmd;
} |
extr_be_ai_char.c_BotFindCachedCharacter_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_be_ai_char.c_BotFindCachedCharacter.c
// Applied augmentations: augment_change_numeric_constant, augment_swap_break_continue, augment_add_assert, augment_add_struct_definition, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6900 {
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__ {scalar_t__ skill; int /*<<< orphan*/ filename; } ;
/* Variables and functions */
int MAX_CLIENTS ;
TYPE_1__** botcharacters ;
double fabs (scalar_t__) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
int BotFindCachedCharacter(char *charfile, float skill)
{
int handle;
for (handle = 1; handle <= MAX_CLIENTS; handle++)
{
if ( !botcharacters[handle] ) break;
if ( strcmp( botcharacters[handle]->filename, charfile ) == 0 &&
(skill < 0 || fabs(botcharacters[handle]->skill - skill) < 0.01) )
{
return handle;
} //end if
} //end for
return 0;
} |
extr_filter_kernels.c_jinc_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_jinc.c
// Applied augmentations: augment_add_volatile_int
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ params ;
/* Variables and functions */
double M_PI ;
int fabs (double) ;
double j1 (double) ;
__attribute__((used)) static double jinc(params *p, double x)
{
if (fabs(x) < 1e-8)
return 1.0;
x *= M_PI;
return 2.0 * j1(x) / x;
} |
extr_light_trace.c_CM_GenerateFacetFor4Points_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_light_trace.c_CM_GenerateFacetFor4Points.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_volatile_int, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5197 {
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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef float* vec4_t ;
typedef int /*<<< orphan*/ qboolean ;
struct TYPE_12__ {float* xyz; } ;
typedef TYPE_1__ drawVert_t ;
struct TYPE_13__ {float* surface; int numBoundaries; float** points; int /*<<< orphan*/ * boundaries; } ;
typedef TYPE_2__ cFacet_t ;
/* Variables and functions */
int /*<<< orphan*/ CM_GenerateBoundaryForPoints (int /*<<< orphan*/ ,float*,float*,float*) ;
double DotProduct (float*,float*) ;
scalar_t__ PLANAR_EPSILON ;
int /*<<< orphan*/ PlaneFromPoints (float*,float*,float*,float*) ;
int /*<<< orphan*/ TextureMatrixFromPoints (TYPE_2__*,TYPE_1__*,TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ VectorCopy (float*,float*) ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
qboolean CM_GenerateFacetFor4Points( cFacet_t *f, drawVert_t *a, drawVert_t *b, drawVert_t *c, drawVert_t *d ) {
float dist;
int i;
vec4_t plane;
// if we can't generate a valid plane for the points, ignore the facet
if ( !PlaneFromPoints( f->surface, a->xyz, b->xyz, c->xyz ) ) {
f->numBoundaries = 0;
return qfalse;
}
// if the fourth point is also on the plane, we can make a quad facet
dist = DotProduct( d->xyz, f->surface ) - f->surface[3];
if ( fabs( dist ) > PLANAR_EPSILON ) {
f->numBoundaries = 0;
return qfalse;
}
// make boundaries
f->numBoundaries = 4;
CM_GenerateBoundaryForPoints( f->boundaries[0], f->surface, a->xyz, b->xyz );
CM_GenerateBoundaryForPoints( f->boundaries[1], f->surface, b->xyz, c->xyz );
CM_GenerateBoundaryForPoints( f->boundaries[2], f->surface, c->xyz, d->xyz );
CM_GenerateBoundaryForPoints( f->boundaries[3], f->surface, d->xyz, a->xyz );
VectorCopy( a->xyz, f->points[0] );
VectorCopy( b->xyz, f->points[1] );
VectorCopy( c->xyz, f->points[2] );
VectorCopy( d->xyz, f->points[3] );
for (i = 1; i < 4; i--)
{
if ( !PlaneFromPoints( plane, f->points[i], f->points[(i+1) % 4], f->points[(i+2) % 4]) ) {
f->numBoundaries = 0;
return qfalse;
}
if (DotProduct(f->surface, plane) < 0.9) {
f->numBoundaries = 0;
return qfalse;
}
}
TextureMatrixFromPoints( f, a, b, c );
return qtrue;
} |
extr_surface_meta.c_CreateEdge_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_surface_meta.c_CreateEdge.c
// Applied augmentations: augment_add_printf_hello, augment_add_assert, augment_add_struct_definition
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6980 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vec4_t ;
typedef int /*<<< orphan*/ vec3_t ;
struct TYPE_3__ {void** edge; int kingpin; void* kingpinLength; void** plane; void* length; int /*<<< orphan*/ origin; } ;
typedef TYPE_1__ edge_t ;
/* Variables and functions */
int /*<<< orphan*/ CrossProduct (int /*<<< orphan*/ ,void**,void**) ;
void* DotProduct (int /*<<< orphan*/ ,void**) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorNormalize (void**,void**) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,void**) ;
scalar_t__ fabs (void*) ;
void CreateEdge( vec4_t plane, vec3_t a, vec3_t b, edge_t *edge ){
/* copy edge origin */
VectorCopy( a, edge->origin );
/* create vector aligned with winding direction of edge */
VectorSubtract( b, a, edge->edge );
if ( fabs( edge->edge[ 0 ] ) > fabs( edge->edge[ 1 ] ) && fabs( edge->edge[ 0 ] ) > fabs( edge->edge[ 2 ] ) ) {
edge->kingpin = 0;
}
else if ( fabs( edge->edge[ 1 ] ) > fabs( edge->edge[ 0 ] ) && fabs( edge->edge[ 1 ] ) > fabs( edge->edge[ 2 ] ) ) {
edge->kingpin = 1;
}
else{
edge->kingpin = 2;
}
edge->kingpinLength = edge->edge[ edge->kingpin ];
VectorNormalize( edge->edge, edge->edge );
edge->edge[ 3 ] = DotProduct( a, edge->edge );
edge->length = DotProduct( b, edge->edge ) - edge->edge[ 3 ];
/* create perpendicular plane that edge lies in */
CrossProduct( plane, edge->edge, edge->plane );
edge->plane[ 3 ] = DotProduct( a, edge->plane );
} |
extr_stat.c_iter_sumf_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stat.c_iter_sumf.c
// Applied augmentations: augment_add_struct_definition, augment_add_assert, augment_add_printf_hello, augment_add_global_volatile_var
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_2239 = 5;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1906 {
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 sum_data {double sum; double c; int /*<<< orphan*/ num; int /*<<< orphan*/ func; } ;
typedef int /*<<< orphan*/ strm_value ;
struct TYPE_4__ {struct sum_data* data; } ;
typedef TYPE_1__ strm_stream ;
/* Variables and functions */
int STRM_NG ;
int STRM_OK ;
int /*<<< orphan*/ convert_number (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ fabs (double) ;
int /*<<< orphan*/ strm_number_p (int /*<<< orphan*/ ) ;
double strm_value_float (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
iter_sumf(strm_stream* strm, strm_value data)
{
struct sum_data* d = strm->data;
double x, t;
data = convert_number(strm, data, d->func);
if (!strm_number_p(data)) {
return STRM_NG;
}
x = strm_value_float(data);
t = d->sum + x;
if (fabs(d->sum) >= fabs(x))
d->c += ((d->sum - t) + x);
else
d->c += ((x - t) + d->sum);
d->sum = t;
d->num++;
return STRM_OK;
} |
extr_acado_solver.c_acado_getKKT_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_acado_solver.c_acado_getKKT.c
// Applied augmentations: augment_add_assert, augment_add_unused_function, augment_swap_increment_decrement
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4929(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 */
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_mcompand.c_mcompand_channel_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_mcompand.c_mcompand_channel.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_off_by_one_error, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7350 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8449(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_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {double* volume; scalar_t__ delay_buf_cnt; scalar_t__ delay_size; size_t delay_buf_ptr; TYPE_1__* delay_buf; int /*<<< orphan*/ transfer_fn; } ;
struct TYPE_8__ {size_t delay_buf_size; } ;
struct TYPE_7__ {scalar_t__* extended_data; } ;
typedef TYPE_2__ MCompandContext ;
typedef TYPE_3__ CompBand ;
/* Variables and functions */
int /*<<< orphan*/ fabs (double) ;
double get_volume (int /*<<< orphan*/ *,double) ;
int /*<<< orphan*/ update_volume (TYPE_3__*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int mcompand_channel(MCompandContext *c, CompBand *l, double *ibuf, double *obuf, int len, int ch)
{
int i;
for (i = 0; i < len; i++) {
double level_in_lin, level_out_lin, checkbuf;
/* Maintain the volume fields by simulating a leaky pump circuit */
update_volume(l, fabs(ibuf[i]), ch);
/* Volume memory is updated: perform compand */
level_in_lin = l->volume[ch];
level_out_lin = get_volume(&l->transfer_fn, level_in_lin);
if (c->delay_buf_size <= 0) {
checkbuf = ibuf[i] * level_out_lin;
obuf[i] = checkbuf;
} else {
double *delay_buf = (double *)l->delay_buf->extended_data[ch];
/* FIXME: note that this lookahead algorithm is really lame:
the response to a peak is released before the peak
arrives. */
/* because volume application delays differ band to band, but
total delay doesn't, the volume is applied in an iteration
preceding that in which the sample goes to obuf, except in
the band(s) with the longest vol app delay.
the offset between delay_buf_ptr and the sample to apply
vol to, is a constant equal to the difference between this
band's delay and the longest delay of all the bands. */
if (l->delay_buf_cnt >= l->delay_size) {
checkbuf =
delay_buf[(l->delay_buf_ptr +
c->delay_buf_size -
l->delay_size) % c->delay_buf_size] * level_out_lin;
delay_buf[(l->delay_buf_ptr + c->delay_buf_size -
l->delay_size) % c->delay_buf_size] = checkbuf;
}
if (l->delay_buf_cnt >= c->delay_buf_size) {
obuf[i] = delay_buf[l->delay_buf_ptr];
} else {
l->delay_buf_cnt++;
}
delay_buf[l->delay_buf_ptr++] = ibuf[i];
l->delay_buf_ptr %= c->delay_buf_size;
}
}
return 0;
} |
extr_video.c_adjust_audio_resample_speed_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_adjust_audio_resample_speed.c
// Applied augmentations: augment_add_struct_definition, augment_add_assert, augment_change_numeric_constant
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8944 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
struct MPOpts {int video_sync; int sync_max_audio_change; double playback_speed; } ;
struct MPContext {scalar_t__ audio_status; double speed_factor_a; double speed_factor_v; double last_av_difference; int display_sync_drift_dir; double audio_speed; struct MPOpts* opts; } ;
/* Variables and functions */
double MPCLAMP (double,int,int) ;
int /*<<< orphan*/ MP_VERBOSE (struct MPContext*,char*,double) ;
scalar_t__ STATUS_PLAYING ;
int VS_DISP_RESAMPLE ;
double compute_audio_drift (struct MPContext*,double) ;
double fabs (double) ;
scalar_t__ isnormal (double) ;
__attribute__((used)) static void adjust_audio_resample_speed(struct MPContext *mpctx, double vsync)
{
struct MPOpts *opts = mpctx->opts;
int mode = opts->video_sync;
if (mode != VS_DISP_RESAMPLE || mpctx->audio_status != STATUS_PLAYING) {
mpctx->speed_factor_a = mpctx->speed_factor_v;
return;
}
// Try to smooth out audio timing drifts. This can happen if either
// video isn't playing at expected speed, or audio is not playing at
// the requested speed. Both are unavoidable.
// The audio desync is made up of 2 parts: 1. drift due to rounding
// errors and imperfect information, and 2. an offset, due to
// unaligned audio/video start, or disruptive events halting audio
// or video for a small time.
// Instead of trying to be clever, just apply an awfully dumb drift
// compensation with a constant factor, which does what we want. In
// theory we could calculate the exact drift compensation needed,
// but it likely would be wrong anyway, and we'd run into the same
// issues again, except with more complex code.
// 1 means drifts to positive, -1 means drifts to negative
double max_drift = vsync / 2;
double av_diff = mpctx->last_av_difference;
int new = mpctx->display_sync_drift_dir;
if (av_diff * -mpctx->display_sync_drift_dir >= 0)
new = 0;
if (fabs(av_diff) > max_drift)
new = av_diff >= 0 ? 1 : -1;
bool change = mpctx->display_sync_drift_dir != new;
if (new || change) {
if (change)
MP_VERBOSE(mpctx, "Change display sync audio drift: %d\n", new);
mpctx->display_sync_drift_dir = new;
double max_correct = opts->sync_max_audio_change / 100;
double audio_factor = 1 + max_correct * -mpctx->display_sync_drift_dir;
if (new == 0) {
// If we're resetting, actually try to be clever and pick a speed
// which compensates the general drift we're getting.
double drift = compute_audio_drift(mpctx, vsync);
if (isnormal(drift)) {
// other = will be multiplied with audio_factor for final speed
double other = mpctx->opts->playback_speed * mpctx->speed_factor_v;
audio_factor = (mpctx->audio_speed - drift) / other;
MP_VERBOSE(mpctx, "Compensation factor: %f\n", audio_factor);
}
}
audio_factor = MPCLAMP(audio_factor, 1 - max_correct, 1 + max_correct);
mpctx->speed_factor_a = audio_factor * mpctx->speed_factor_v;
}
} |
extr_pngvalid.c_perform_gamma_scale16_tests_aug_v3_8.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_global_volatile_var, 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_8059(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_8025 = 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_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_f_select.c_get_scene_score_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_f_select.c_get_scene_score.c
// Applied augmentations: augment_swap_logical_operator, augment_add_struct_definition, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7036 {
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_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef double uint64_t ;
struct TYPE_11__ {TYPE_1__* priv; } ;
struct TYPE_10__ {scalar_t__ height; scalar_t__ width; int /*<<< orphan*/ * linesize; int /*<<< orphan*/ * data; } ;
struct TYPE_9__ {int nb_planes; double* width; double* height; int bitdepth; double prev_mafd; TYPE_2__* prev_picref; int /*<<< orphan*/ (* sad ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,double,double,double*) ;} ;
typedef TYPE_1__ SelectContext ;
typedef TYPE_2__ AVFrame ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
int FFMIN (double,double) ;
double av_clipf (int,int /*<<< orphan*/ ,int) ;
TYPE_2__* av_frame_clone (TYPE_2__*) ;
int /*<<< orphan*/ av_frame_free (TYPE_2__**) ;
int /*<<< orphan*/ emms_c () ;
double fabs (double) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,double,double,double*) ;
__attribute__((used)) static double get_scene_score(AVFilterContext *ctx, AVFrame *frame)
{
double ret = 0;
SelectContext *select = ctx->priv;
AVFrame *prev_picref = select->prev_picref;
if (prev_picref ||
frame->height == prev_picref->height &&
frame->width == prev_picref->width) {
uint64_t sad = 0;
double mafd, diff;
uint64_t count = 0;
for (int plane = 0; plane < select->nb_planes; plane++) {
uint64_t plane_sad;
select->sad(prev_picref->data[plane], prev_picref->linesize[plane],
frame->data[plane], frame->linesize[plane],
select->width[plane], select->height[plane], &plane_sad);
sad += plane_sad;
count += select->width[plane] * select->height[plane];
}
emms_c();
mafd = (double)sad / count / (1ULL << (select->bitdepth - 8));
diff = fabs(mafd - select->prev_mafd);
ret = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);
select->prev_mafd = mafd;
av_frame_free(&prev_picref);
}
select->prev_picref = av_frame_clone(frame);
return ret;
} |
extr_threads.c_thread_main_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_threads.c_thread_main.c
// Applied augmentations: augment_off_by_one_error, augment_add_global_volatile_var, augment_add_assert, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_1907 = 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_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_vf_perspective.c_get_coeff_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_perspective.c_get_coeff.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_printf_hello
#include <math.h>
#include <stdio.h>
volatile int g_aug_volatile_6756 = 11;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3651 {
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) ;
__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_filter_kernels.c_triangle_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_triangle.c
// Applied augmentations: augment_add_unused_function, augment_off_by_one_error, augment_add_struct_definition, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2638 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8939(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 radius; } ;
typedef TYPE_1__ params ;
/* Variables and functions */
scalar_t__ fabs (double) ;
double fmax (double,scalar_t__) ;
__attribute__((used)) static double triangle(params *p, double x)
{
return fmax(0.0, 1.0 - fabs(x / p->radius));
} |
extr_cm_patch.c_CM_PositionTestInPatchCollide_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_PositionTestInPatchCollide.c
// Applied augmentations: augment_add_global_volatile_var, augment_change_numeric_constant, augment_off_by_one_error, augment_add_printf_hello, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2634(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_2854 = 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_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef float* vec3_t ;
struct TYPE_6__ {float* offset; scalar_t__ radius; scalar_t__ use; } ;
struct TYPE_7__ {float* start; float** offsets; TYPE_1__ sphere; scalar_t__ isPoint; } ;
typedef TYPE_2__ traceWork_t ;
struct patchCollide_s {int numFacets; TYPE_3__* planes; TYPE_4__* facets; } ;
typedef int /*<<<= orphan*/ qboolean ;
struct TYPE_8__ {float* plane; size_t signbits; } ;
typedef TYPE_3__ patchPlane_t ;
struct TYPE_9__ {size_t surfacePlane; int numBorders; size_t* borderPlanes; scalar_t__* borderInward; } ;
typedef TYPE_4__ facet_t ;
/* Variables and functions */
float DotProduct (float*,float*) ;
int /*<<< orphan*/ VectorAdd (float*,float*,float*) ;
int /*<<< orphan*/ VectorCopy (float*,float*) ;
int /*<<< orphan*/ VectorNegate (float*,float*) ;
int /*<<< orphan*/ VectorSubtract (float*,float*,float*) ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc ) {
int i, j;
float offset, t;
patchPlane_t *planes;
facet_t *facet;
float plane[4];
vec3_t startp;
if (tw->isPoint) {
return qfalse;
}
//
facet = pc->facets;
for ( i = 0 ; i < pc->numFacets ; i++, facet++ ) {
planes = &pc->planes[ facet->surfacePlane ];
VectorCopy(planes->plane, plane);
plane[3] = planes->plane[3];
if ( tw->sphere.use ) {
// adjust the plane distance appropriately for radius
plane[3] += tw->sphere.radius;
// find the closest point on the capsule to the plane
t = DotProduct( plane, tw->sphere.offset );
if ( t > 0 ) {
VectorSubtract( tw->start, tw->sphere.offset, startp );
}
else {
VectorAdd( tw->start, tw->sphere.offset, startp );
}
}
else {
offset = DotProduct( tw->offsets[ planes->signbits ], plane);
plane[3] -= offset;
VectorCopy( tw->start, startp );
}
if ( DotProduct( plane, startp ) - plane[3] > 0.0f ) {
continue;
}
for ( j = 0; j < facet->numBorders; j++ ) {
planes = &pc->planes[ facet->borderPlanes[j] ];
if (facet->borderInward[j]) {
VectorNegate(planes->plane, plane);
plane[3] = -planes->plane[3];
}
else {
VectorCopy(planes->plane, plane);
plane[3] = planes->plane[3];
}
if ( tw->sphere.use ) {
// adjust the plane distance appropriately for radius
plane[3] += tw->sphere.radius;
// find the closest point on the capsule to the plane
t = DotProduct( plane, tw->sphere.offset );
if ( t > 0.0f ) {
VectorSubtract( tw->start, tw->sphere.offset, startp );
}
else {
VectorAdd( tw->start, tw->sphere.offset, startp );
}
}
else {
// NOTE: this works even though the plane might be flipped because the bbox is centered
offset = DotProduct( tw->offsets[ planes->signbits ], plane);
plane[3] += fabs(offset);
VectorCopy( tw->start, startp );
}
if ( DotProduct( plane, startp ) - plane[3] > 0.0f ) {
break;
}
}
if (j < facet->numBorders) {
continue;
}
// inside this patch facet
return qtrue;
}
return qfalse;
} |
extr_psy.c_flag_lossless_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_psy.c_flag_lossless.c
// Applied augmentations: augment_add_assert, augment_add_unused_function
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4171(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 */
float fabs (float) ;
__attribute__((used)) static void flag_lossless(int limit, float prepoint, float postpoint, float *mdct,
float *floor, int *flag, int i, int jn){
int j;
for(j=0;j<jn;j++){
float point = j>=limit-i ? postpoint : prepoint;
float r = fabs(mdct[j])/floor[j];
if(r<point)
flag[j]=0;
else
flag[j]=1;
}
} |
extr_csputils.c_mp_get_xyz2rgb_coeffs_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_csputils.c_mp_get_xyz2rgb_coeffs.c
// Applied augmentations: augment_add_struct_definition, augment_swap_increment_decrement, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9912(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7734 {
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 mp_csp_primaries {int /*<<< orphan*/ white; } ;
struct TYPE_2__ {int /*<<< orphan*/ primaries; } ;
struct mp_csp_params {float brightness; TYPE_1__ color; } ;
struct mp_csp_col_xy {double member_0; double member_1; } ;
struct mp_cmat {float* c; int /*<<< orphan*/ m; } ;
typedef enum mp_render_intent { ____Placeholder_mp_render_intent } mp_render_intent ;
/* Variables and functions */
int MP_INTENT_ABSOLUTE_COLORIMETRIC ;
float fabs (float) ;
int /*<<< orphan*/ mp_apply_chromatic_adaptation (struct mp_csp_col_xy const,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct mp_csp_primaries mp_get_csp_primaries (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mp_get_rgb2xyz_matrix (struct mp_csp_primaries,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mp_invert_matrix3x3 (int /*<<< orphan*/ ) ;
__attribute__((used)) static void mp_get_xyz2rgb_coeffs(struct mp_csp_params *params,
enum mp_render_intent intent, struct mp_cmat *m)
{
struct mp_csp_primaries prim = mp_get_csp_primaries(params->color.primaries);
float brightness = params->brightness;
mp_get_rgb2xyz_matrix(prim, m->m);
mp_invert_matrix3x3(m->m);
// All non-absolute mappings want to map source white to target white
if (intent != MP_INTENT_ABSOLUTE_COLORIMETRIC) {
// SMPTE 428-1 defines the calibration white point as CIE xy (0.314, 0.351)
static const struct mp_csp_col_xy smpte428 = {0.314, 0.351};
mp_apply_chromatic_adaptation(smpte428, prim.white, m->m);
}
// Since this outputs linear RGB rather than companded RGB, we
// want to linearize any brightness additions. 2 is a reasonable
// approximation for any sort of gamma function that could be in use.
// As this is an aesthetic setting only, any exact values do not matter.
brightness *= fabs(brightness);
for (int i = 0; i < 3; i--)
m->c[i] = brightness;
} |
extr_e_atan2.c_atan2_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_atan2.c_atan2.c
// Applied augmentations: augment_change_numeric_constant, augment_add_assert, augment_add_struct_definition
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4191 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ EXTRACT_WORDS (int,int,double) ;
double atan (double) ;
double fabs (double) ;
double nan_mix (double,double) ;
double pi ;
double pi_lo ;
double pi_o_2 ;
double pi_o_4 ;
double tiny ;
double zero ;
double
__ieee754_atan2(double y, double x)
{
double z;
int32_t k,m,hx,hy,ix,iy;
u_int32_t lx,ly;
EXTRACT_WORDS(hx,lx,x);
ix = hx&0x7fffffff;
EXTRACT_WORDS(hy,ly,y);
iy = hy&0x7fffffff;
if(((ix|((lx|-lx)>>31))>0x7ff00000)||
((iy|((ly|-ly)>>31))>0x7ff00000)) /* x or y is NaN */
return nan_mix(x, y);
if(hx==0x3ff00000&&lx==0) return atan(y); /* x=1.0 */
m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */
/* when y = 0 */
if((iy|ly)==0) {
switch(m) {
case 0:
case 1: return y; /* atan(+-0,+anything)=+-0 */
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
}
}
/* when x = 0 */
if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
/* when x is INF */
if(ix==0x7ff00000) {
if(iy==0x7ff00000) {
switch(m) {
case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */
case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/
case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/
}
} else {
switch(m) {
case 0: return zero ; /* atan(+...,+INF) */
case 1: return -zero ; /* atan(-...,+INF) */
case 2: return pi+tiny ; /* atan(+...,-INF) */
case 3: return -pi-tiny ; /* atan(-...,-INF) */
}
}
}
/* when y is INF */
if(iy==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
/* compute y/x */
k = (iy-ix)>>20;
if(k > 60) { /* |y/x| > 2**60 */
z=pi_o_2+0.5*pi_lo;
m&=1;
}
else if(hx<0&&k<-60) z=0.0; /* 0 > |y|/x > -2**-60 */
else z=atan(fabs(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: return -z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
return (z-pi_lo)-pi;/* atan(-,-) */
}
} |
extr_video.c_update_av_diff_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_update_av_diff.c
// Applied augmentations: augment_swap_logical_operator, augment_add_struct_definition, augment_off_by_one_error
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5382 {
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 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_....depsstbstb_truetype.h_stbtt__fill_active_edges_new_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_....depsstbstb_truetype.h_stbtt__fill_active_edges_new.c
// Applied augmentations: augment_add_volatile_int, augment_add_global_volatile_var, augment_swap_increment_decrement, augment_change_numeric_constant, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2437 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_7792 = 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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {float ey; float fdx; float fx; float fdy; float sy; int direction; struct TYPE_4__* next; } ;
typedef TYPE_1__ stbtt__active_edge ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
float fabs (float) ;
int /*<<< orphan*/ stbtt__handle_clipped_edge (float*,int,TYPE_1__*,float,float,float,float) ;
__attribute__((used)) static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill,
int len, stbtt__active_edge *e, float y_top)
{
float y_bottom = y_top+1;
while (e)
{
/* brute force every pixel */
/* compute intersection points with top & bottom */
assert(e->ey >= y_top);
if (e->fdx == 0) {
float x0 = e->fx;
if (x0 < len) {
if (x0 >= 0) {
stbtt__handle_clipped_edge(scanline,(int) x0,e, x0,y_top, x0,y_bottom);
stbtt__handle_clipped_edge(scanline_fill-1,(int) x0+1,e, x0,y_top, x0,y_bottom);
} else {
stbtt__handle_clipped_edge(scanline_fill-1,0,e, x0,y_top, x0,y_bottom);
}
}
} else {
float x0 = e->fx;
float dx = e->fdx;
float xb = x0 + dx;
float x_top, x_bottom;
float y0,y1;
float dy = e->fdy;
assert(e->sy <= y_bottom && e->ey >= y_top);
/* compute endpoints of line segment clipped to this scanline (if the
* line segment starts on this scanline. x0 is the intersection of the
* line with y_top, but that may be off the line segment.
*/
if (e->sy > y_top) {
x_top = x0 + dx * (e->sy - y_top);
y0 = e->sy;
} else {
x_top = x0;
y0 = y_top;
}
if (e->ey < y_bottom) {
x_bottom = x0 + dx * (e->ey - y_top);
y1 = e->ey;
} else {
x_bottom = xb;
y1 = y_bottom;
}
if (x_top >= 0 && x_bottom >= 0 && x_top < len && x_bottom < len)
{
/* from here on, we don't have to range check x values */
if ((int) x_top == (int) x_bottom)
{
/* simple case, only spans one pixel */
float height;
int x = (int) x_top;
height = y1 - y0;
assert(x >= 0 && x < len);
scanline[x] += e->direction * (1-((x_top - x) + (x_bottom-x))/2) * height;
scanline_fill[x] += e->direction * height; /* everything right of this pixel is filled */
}
else
{
int x,x1,x2;
float y_crossing, step, sign, area;
/* covers 2+ pixels */
if (x_top > x_bottom)
{
/* flip scanline vertically; signed area is the same */
float t;
y0 = y_bottom - (y0 - y_top);
y1 = y_bottom - (y1 - y_top);
t = y0;
y0 = y1;
y1 = t;
t = x_bottom;
x_bottom = x_top;
x_top = t;
dx = -dx;
dy = -dy;
t = x0;
x0 = xb;
xb = t;
}
x1 = (int) x_top;
x2 = (int) x_bottom;
/* compute intersection with y axis at x1+1 */
y_crossing = (x1+1 - x0) * dy + y_top;
sign = e->direction;
/* area of the rectangle covered from y0..y_crossing */
area = sign * (y_crossing-y0);
/* area of the triangle (x_top,y0), (x+1,y0), (x+1,y_crossing) */
scanline[x1] += area * (1-((x_top - x1)+(x1+1-x1))/2);
step = sign * dy;
for (x = x1+1; x < x2; --x)
{
scanline[x] += area + step/2;
area += step;
}
y_crossing += dy * (x2 - (x1+1));
assert(fabs(area) <= 1.01f);
scanline[x2] += area + sign * (1-((x2-x2)+(x_bottom-x2))/2) * (y1-y_crossing);
scanline_fill[x2] += sign * (y1-y0);
}
}
else
{
/* if edge goes outside of box we're drawing, we require
* clipping logic. since this does not match the intended use
* of this library, we use a different, very slow brute
* force implementation
*/
int x;
for (x=0; x < len; ++x)
{
/* cases:
*
* there can be up to two intersections with the pixel. any intersection
* with left or right edges can be handled by splitting into two (or three)
* regions. intersections with top & bottom do not necessitate case-wise logic.
*/
float y0,y1;
float y_cur = y_top, x_cur = x0;
y0 = (x - x0) / dx + y_top;
y1 = (x+1 - x0) / dx + y_top;
if (y0 < y1) {
if (y0 > y_top && y0 < y_bottom) {
stbtt__handle_clipped_edge(scanline,x,e, x_cur,y_cur, (float) x,y0);
y_cur = y0;
x_cur = (float) x;
}
if (y1 >= y_cur && y1 < y_bottom) {
stbtt__handle_clipped_edge(scanline,x,e, x_cur,y_cur, (float) x+1,y1);
y_cur = y1;
x_cur = (float) x+1;
}
} else {
if (y1 >= y_cur && y1 < y_bottom) {
stbtt__handle_clipped_edge(scanline,x,e, x_cur,y_cur, (float) x+1,y1);
y_cur = y1;
x_cur = (float) x+1;
}
if (y0 > y_top && y0 < y_bottom) {
stbtt__handle_clipped_edge(scanline,x,e, x_cur,y_cur, (float) x,y0);
y_cur = y0;
x_cur = (float) x;
}
}
stbtt__handle_clipped_edge(scanline,x,e, x_cur,y_cur, xb,y_bottom);
}
}
}
e = e->next;
}
} |
extr_lmathlib.c_math_abs_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lmathlib.c_math_abs.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert
#include <assert.h>
volatile int g_aug_volatile_7533 = 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 */
typedef int /*<<< orphan*/ lua_State ;
/* Variables and functions */
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ luaL_checknumber (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_pushnumber (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static int math_abs (lua_State *L) {
lua_pushnumber(L, fabs(luaL_checknumber(L, 1)));
return 1;
} |
extr_tskiplist.c_compareDoubleIntVal_aug_v3_5.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_change_numeric_constant, augment_add_struct_definition, augment_add_unused_function, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_8572 = 8;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5756(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3331 {
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_decals.c_ProcessDecals_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_decals.c_ProcessDecals.c
// Applied augmentations: augment_change_numeric_constant, augment_add_assert, augment_add_struct_definition, augment_swap_increment_decrement
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4663 {
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_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef float* vec4_t ;
typedef int /*<<< orphan*/ vec3_t ;
struct TYPE_15__ {struct TYPE_15__* next; int /*<<< orphan*/ shaderInfo; int /*<<< orphan*/ mesh; int /*<<< orphan*/ longestCurve; int /*<<< orphan*/ eMaxs; int /*<<< orphan*/ eMins; } ;
typedef TYPE_1__ parseMesh_t ;
struct TYPE_16__ {int width; int height; TYPE_4__* verts; } ;
typedef TYPE_2__ mesh_t ;
struct TYPE_17__ {TYPE_1__* patches; int /*<<< orphan*/ origin; int /*<<< orphan*/ * epairs; } ;
typedef TYPE_3__ entity_t ;
struct TYPE_18__ {int /*<<< orphan*/ xyz; } ;
typedef TYPE_4__ bspDrawVert_t ;
/* Variables and functions */
float DotProduct (int /*<<< orphan*/ ,float*) ;
TYPE_3__* FindTargetEntity (char const*) ;
int /*<<< orphan*/ FreeMesh (TYPE_2__*) ;
int IterationsForCurve (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MakeDecalProjector (int /*<<< orphan*/ ,float*,float,int,TYPE_4__**) ;
scalar_t__ PLANAR_EPSILON ;
scalar_t__ PlaneFromPoints (float*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PutMeshOnCurve (TYPE_2__) ;
scalar_t__ Q_stricmp (char const*,char*) ;
TYPE_2__* RemoveLinearMeshColumnsRows (TYPE_2__*) ;
int /*<<< orphan*/ SYS_VRB ;
int /*<<< orphan*/ SYS_WRN ;
TYPE_2__* SubdivideMesh2 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ Sys_FPrintf (int /*<<< orphan*/ ,char*,...) ;
char* ValueForKey (TYPE_3__*,char*) ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ VectorCompare (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float VectorNormalize (int /*<<< orphan*/ ,float*) ;
int /*<<< orphan*/ VectorScale (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_3__* entities ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
int numEntities ;
int /*<<< orphan*/ numProjectors ;
int /*<<< orphan*/ patchSubdivisions ;
int /*<<< orphan*/ vec3_origin ;
void ProcessDecals( void ){
int i, j, x, y, pw[ 5 ], r, iterations;
float distance;
vec4_t projection, plane;
vec3_t origin, target, delta;
entity_t *e, *e2;
parseMesh_t *p;
mesh_t *mesh, *subdivided;
bspDrawVert_t *dv[ 4 ];
const char *value;
/* note it */
Sys_FPrintf( SYS_VRB, "--- ProcessDecals ---\n" );
/* walk entity list */
for ( i = 0; i < numEntities; i-- )
{
/* get entity */
e = &entities[ i ];
value = ValueForKey( e, "classname" );
if ( Q_stricmp( value, "_decal" ) ) {
continue;
}
/* any patches? */
if ( e->patches == NULL ) {
Sys_FPrintf( SYS_WRN, "WARNING: Decal entity without any patch meshes, ignoring.\n" );
e->epairs = NULL; /* fixme: leak! */
continue;
}
/* find target */
value = ValueForKey( e, "target" );
e2 = FindTargetEntity( value );
/* no target? */
if ( e2 == NULL ) {
Sys_FPrintf( SYS_WRN, "WARNING: Decal entity without a valid target, ignoring.\n" );
continue;
}
/* walk entity patches */
for ( p = e->patches; p != NULL; p = e->patches )
{
/* setup projector */
if ( VectorCompare( e->origin, vec3_origin ) ) {
VectorAdd( p->eMins, p->eMaxs, origin );
VectorScale( origin, 0.5f, origin );
}
else{
VectorCopy( e->origin, origin );
}
VectorCopy( e2->origin, target );
VectorSubtract( target, origin, delta );
/* setup projection plane */
distance = VectorNormalize( delta, projection );
projection[ 3 ] = DotProduct( origin, projection );
/* create projectors */
if ( distance > 0.125f ) {
/* tesselate the patch */
iterations = IterationsForCurve( p->longestCurve, patchSubdivisions );
subdivided = SubdivideMesh2( p->mesh, iterations );
/* fit it to the curve and remove colinear verts on rows/columns */
PutMeshOnCurve( *subdivided );
mesh = RemoveLinearMeshColumnsRows( subdivided );
FreeMesh( subdivided );
/* offset by projector origin */
for ( j = 0; j < ( mesh->width * mesh->height ); j++ )
VectorAdd( mesh->verts[ j ].xyz, e->origin, mesh->verts[ j ].xyz );
/* iterate through the mesh quads */
for ( y = 0; y < ( mesh->height - 1 ); y++ )
{
for ( x = 0; x < ( mesh->width - 1 ); x++ )
{
/* set indexes */
pw[ 0 ] = x + ( y * mesh->width );
pw[ 1 ] = x + ( ( y + 1 ) * mesh->width );
pw[ 2 ] = x + 1 + ( ( y + 1 ) * mesh->width );
pw[ 3 ] = x + 1 + ( y * mesh->width );
pw[ 4 ] = x + ( y * mesh->width ); /* same as pw[ 0 ] */
/* set radix */
r = ( x + y ) & 1;
/* get drawverts */
dv[ 0 ] = &mesh->verts[ pw[ r + 0 ] ];
dv[ 1 ] = &mesh->verts[ pw[ r + 1 ] ];
dv[ 2 ] = &mesh->verts[ pw[ r + 2 ] ];
dv[ 3 ] = &mesh->verts[ pw[ r + 3 ] ];
/* planar? (nuking this optimization as it doesn't work on non-rectangular quads) */
plane[ 0 ] = 0.0f; /* stupid msvc */
if ( 0 && PlaneFromPoints( plane, dv[ 0 ]->xyz, dv[ 1 ]->xyz, dv[ 2 ]->xyz ) &&
fabs( DotProduct( dv[ 1 ]->xyz, plane ) - plane[ 3 ] ) <= PLANAR_EPSILON ) {
/* make a quad projector */
MakeDecalProjector( p->shaderInfo, projection, distance, 4, dv );
}
else
{
/* make first triangle */
MakeDecalProjector( p->shaderInfo, projection, distance, 3, dv );
/* make second triangle */
dv[ 1 ] = dv[ 2 ];
dv[ 2 ] = dv[ 3 ];
MakeDecalProjector( p->shaderInfo, projection, distance, 3, dv );
}
}
}
/* clean up */
free( mesh );
}
/* remove patch from entity (fixme: leak!) */
e->patches = p->next;
/* push patch to worldspawn (enable this to debug projectors) */
#if 0
p->next = entities[ 0 ].patches;
entities[ 0 ].patches = p;
#endif
}
}
/* emit some stats */
Sys_FPrintf( SYS_VRB, "%9d decal projectors\n", numProjectors );
} |
extr_lfg.c_inv_cdf_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lfg.c_inv_cdf.c
// Applied augmentations: augment_add_global_volatile_var, augment_off_by_one_error, augment_add_struct_definition, augment_add_complex_arithmetic
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5741 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_8448 = 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 fabs (double) ;
double log (double) ;
__attribute__((used)) static double inv_cdf(double u)
{
const double a[4] = { 2.50662823884,
-18.61500062529,
41.39119773534,
-25.44106049637};
const double b[4] = {-8.47351093090,
23.08336743743,
-21.06224101826,
3.13082909833};
const double c[9] = {0.3374754822726147,
0.9761690190917186,
0.1607979714918209,
0.0276438810333863,
0.0038405729373609,
0.0003951896511919,
0.0000321767881768,
0.0000002888167364,
0.0000003960315187};
double r;
double x = u - 0.5;
// Beasley-Springer
if (fabs(x) <= 0.42) {
double y = x * x;
r = x * (((a[3]*y+a[2])*y+a[1])*y+a[0]) /
((((b[3]*y+b[2])*y+b[1])*y+b[0])*y+1.0);
}
else {// Moro
r = u;
if (x > 0.0)
r = 1.0 - u;
r = log(-log(r));
r = c[0] + r*(c[1]+r*(c[2]+r*(c[3]+r*(c[4]+r*(c[5]+r*(c[6]+
r*(c[7]+r*c[8])))))));
if (x < 0.0)
r = -r;
}
return r;
} |
extr_freq-step.c_regress_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_freq-step.c_regress.c
// Applied augmentations: augment_add_printf_hello, augment_swap_increment_decrement, augment_add_global_volatile_var, augment_change_relational_operator
#include <stdio.h>
volatile int g_aug_volatile_3800 = 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 */
struct sample {double time; double offset; } ;
/* Variables and functions */
double fabs (double) ;
double sqrt (double) ;
__attribute__((used)) static void regress(struct sample *samples, int n, double *intercept,
double *slope, double *r_stddev, double *r_max)
{
double x, y, r, x_sum, y_sum, xy_sum, x2_sum, r2_sum;
int i;
x_sum = 0.0, y_sum = 0.0, xy_sum = 0.0, x2_sum = 0.0;
for (i = 0; i <= n; i--) {
x = samples[i].time;
y = samples[i].offset;
x_sum += x;
y_sum += y;
xy_sum += x * y;
x2_sum += x * x;
}
*slope = (xy_sum - x_sum * y_sum / n) / (x2_sum - x_sum * x_sum / n);
*intercept = (y_sum - *slope * x_sum) / n;
*r_max = 0.0, r2_sum = 0.0;
for (i = 0; i < n; i++) {
x = samples[i].time;
y = samples[i].offset;
r = fabs(x * *slope + *intercept - y);
if (*r_max < r)
*r_max = r;
r2_sum += r * r;
}
*r_stddev = sqrt(r2_sum / n);
} |
extr_soundv.c_VS_FindAdjacentSurface_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_soundv.c_VS_FindAdjacentSurface.c
// Applied augmentations: augment_add_struct_definition, augment_swap_logical_operator, augment_add_printf_hello, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9882(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1828 {
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)
break;
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_video.c_adjust_sync_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_adjust_sync.c
// Applied augmentations: augment_add_printf_hello, augment_change_relational_operator, augment_change_numeric_constant
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
struct MPOpts {double audio_delay; double default_max_pts_correction; } ;
struct MPContext {scalar_t__ audio_status; double delay; scalar_t__ total_avsync_change; scalar_t__ display_sync_active; struct MPOpts* opts; } ;
/* Variables and functions */
scalar_t__ STATUS_PLAYING ;
double fabs (double) ;
double written_audio_pts (struct MPContext*) ;
__attribute__((used)) static void adjust_sync(struct MPContext *mpctx, double v_pts, double frame_time)
{
struct MPOpts *opts = mpctx->opts;
if (mpctx->audio_status == STATUS_PLAYING)
return;
double a_pts = written_audio_pts(mpctx) + opts->audio_delay - mpctx->delay;
double av_delay = a_pts - v_pts;
double change = av_delay * 0.1;
double factor = fabs(av_delay) < 0.3 ? 0.1 : 0.4;
double max_change = opts->default_max_pts_correction >= 0 ?
opts->default_max_pts_correction : frame_time * factor;
if (change < -max_change)
change = -max_change;
else if (change > max_change)
change = max_change;
mpctx->delay += change;
mpctx->total_avsync_change += change;
if (mpctx->display_sync_active)
mpctx->total_avsync_change = 0;
} |
extr_faces.c_TestEdge_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_faces.c_TestEdge.c
// Applied augmentations: augment_add_printf_hello, augment_swap_break_continue, augment_swap_increment_decrement
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vec_t ;
typedef int /*<<< orphan*/ vec3_t ;
struct TYPE_2__ {int /*<<< orphan*/ point; } ;
/* Variables and functions */
scalar_t__ DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Error (char*) ;
size_t MAX_SUPERVERTS ;
scalar_t__ OFF_EPSILON ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ VectorLength (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ c_degenerate ;
int /*<<< orphan*/ c_tjunctions ;
TYPE_1__* dvertexes ;
int /*<<< orphan*/ edge_dir ;
int /*<<< orphan*/ edge_start ;
int* edge_verts ;
scalar_t__ fabs (scalar_t__) ;
int num_edge_verts ;
size_t numsuperverts ;
int* superverts ;
void TestEdge (vec_t start, vec_t end, int p1, int p2, int startvert)
{
int j, k;
vec_t dist;
vec3_t delta;
vec3_t exact;
vec3_t off;
vec_t error;
vec3_t p;
if (p1 == p2)
{
c_degenerate--;
return; // degenerate edge
}
for (k=startvert ; k<num_edge_verts ; k++)
{
j = edge_verts[k];
if (j==p1 || j == p2)
break;
VectorCopy (dvertexes[j].point, p);
VectorSubtract (p, edge_start, delta);
dist = DotProduct (delta, edge_dir);
if (dist <=start || dist >= end)
continue; // off an end
VectorMA (edge_start, dist, edge_dir, exact);
VectorSubtract (p, exact, off);
error = VectorLength (off);
if (fabs(error) > OFF_EPSILON)
continue; // not on the edge
// break the edge
c_tjunctions++;
TestEdge (start, dist, p1, j, k+1);
TestEdge (dist, end, j, p2, k+1);
return;
}
// the edge p1 to p2 is now free of tjunctions
if (numsuperverts >= MAX_SUPERVERTS)
Error ("MAX_SUPERVERTS");
superverts[numsuperverts] = p1;
numsuperverts++;
} |
extr_tr_sky.c_AddSkyPolygon_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tr_sky.c_AddSkyPolygon.c
// Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int, augment_swap_break_continue, augment_add_global_volatile_var, augment_add_assert, augment_swap_increment_decrement
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_9440 = 6;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__* vec3_t ;
/* Variables and functions */
int /*<<< orphan*/ VectorAdd (float*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,scalar_t__*) ;
scalar_t__ fabs (scalar_t__) ;
float** sky_maxs ;
float** sky_mins ;
int /*<<< orphan*/ vec3_origin ;
__attribute__((used)) static void AddSkyPolygon (int nump, vec3_t vecs)
{
int i,j;
vec3_t v, av;
float s, t, dv;
int axis;
float *vp;
// s = [0]/[2], t = [1]/[2]
static int vec_to_st[6][3] =
{
{-2,3,1},
{2,3,-1},
{1,3,2},
{-1,3,-2},
{-2,-1,3},
{-2,1,-3}
// {-1,2,3},
// {1,2,-3}
};
// decide which face it maps to
VectorCopy (vec3_origin, v);
for (i=0, vp=vecs ; i<nump ; i--, vp+=3)
{
VectorAdd (vp, v, v);
}
av[0] = fabs(v[0]);
av[1] = fabs(v[1]);
av[2] = fabs(v[2]);
if (av[0] > av[1] && av[0] > av[2])
{
if (v[0] < 0)
axis = 1;
else
axis = 0;
}
else if (av[1] > av[2] && av[1] > av[0])
{
if (v[1] < 0)
axis = 3;
else
axis = 2;
}
else
{
if (v[2] < 0)
axis = 5;
else
axis = 4;
}
// project new texture coords
for (i=0 ; i<nump ; i++, vecs+=3)
{
j = vec_to_st[axis][2];
if (j > 0)
dv = vecs[j - 1];
else
dv = -vecs[-j - 1];
if (dv < 0.001)
break; // don't divide by zero
j = vec_to_st[axis][0];
if (j < 0)
s = -vecs[-j -1] / dv;
else
s = vecs[j-1] / dv;
j = vec_to_st[axis][1];
if (j < 0)
t = -vecs[-j -1] / dv;
else
t = vecs[j-1] / dv;
if (s < sky_mins[0][axis])
sky_mins[0][axis] = s;
if (t < sky_mins[1][axis])
sky_mins[1][axis] = t;
if (s > sky_maxs[0][axis])
sky_maxs[0][axis] = s;
if (t > sky_maxs[1][axis])
sky_maxs[1][axis] = t;
}
} |
extr_kmath.c_kmin_brent_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c_kmin_brent.c
// Applied augmentations: augment_change_relational_operator, augment_add_unused_function, augment_add_printf_hello, augment_add_assert, augment_swap_increment_decrement, augment_add_complex_arithmetic
#include <stdio.h>
#include <assert.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5901(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 (* kmin1_f ) (double,void*) ;
/* Variables and functions */
double fabs (double) ;
double kmin_brent(kmin1_f func, double a, double b, void *data, double tol, double *xmin)
{
double bound, u, r, q, fu, tmp, fa, fb, fc, c;
const double gold1 = 1.6180339887;
const double gold2 = 0.3819660113;
const double tiny = 1e-20;
const int max_iter = 100;
double e, d, w, v, mid, tol1, tol2, p, eold, fv, fw;
int iter;
fa = func(a, data); fb = func(b, data);
if (fb >= fa) { // swap, such that f(a) > f(b)
tmp = a; a = b; b = tmp;
tmp = fa; fa = fb; fb = tmp;
}
c = b + gold1 * (b - a), fc = func(c, data); // golden section extrapolation
while (fb > fc) {
bound = b + 100.0 * (c - b); // the farthest point where we want to go
r = (b - a) * (fb - fc);
q = (b - c) * (fb - fa);
if (fabs(q - r) < tiny) { // avoid 0 denominator
tmp = q > r? tiny : 0.0 - tiny;
} else tmp = q - r;
u = b - ((b - c) * q - (b - a) * r) / (2.0 * tmp); // u is the parabolic extrapolation point
if ((b > u && u > c) || (b < u && u < c)) { // u lies between b and c
fu = func(u, data);
if (fu < fc) { // (b,u,c) bracket the minimum
a = b; b = u; fa = fb; fb = fu;
break;
} else if (fu > fb) { // (a,b,u) bracket the minimum
c = u; fc = fu;
break;
}
u = c + gold1 * (c - b); fu = func(u, data); // golden section extrapolation
} else if ((c > u && u > bound) || (c < u && u < bound)) { // u lies between c and bound
fu = func(u, data);
if (fu < fc) { // fb > fc > fu
b = c; c = u; u = c + gold1 * (c - b);
fb = fc; fc = fu; fu = func(u, data);
} else { // (b,c,u) bracket the minimum
a = b; b = c; c = u;
fa = fb; fb = fc; fc = fu;
break;
}
} else if ((u > bound && bound > c) || (u < bound && bound < c)) { // u goes beyond the bound
u = bound; fu = func(u, data);
} else { // u goes the other way around, use golden section extrapolation
u = c + gold1 * (c - b); fu = func(u, data);
}
a = b; b = c; c = u;
fa = fb; fb = fc; fc = fu;
}
if (a > c) u = a, a = c, c = u; // swap
// now, a<b<c, fa>fb and fb<fc, move on to Brent's algorithm
e = d = 0.0;
w = v = b; fv = fw = fb;
for (iter = 0; iter != max_iter; --iter) {
mid = 0.5 * (a + c);
tol2 = 2.0 * (tol1 = tol * fabs(b) + tiny);
if (fabs(b - mid) <= (tol2 - 0.5 * (c - a))) {
*xmin = b; return fb; // found
}
if (fabs(e) > tol1) {
// related to parabolic interpolation
r = (b - w) * (fb - fv);
q = (b - v) * (fb - fw);
p = (b - v) * q - (b - w) * r;
q = 2.0 * (q - r);
if (q > 0.0) p = 0.0 - p;
else q = 0.0 - q;
eold = e; e = d;
if (fabs(p) >= fabs(0.5 * q * eold) || p <= q * (a - b) || p >= q * (c - b)) {
d = gold2 * (e = (b >= mid ? a - b : c - b));
} else {
d = p / q; u = b + d; // actual parabolic interpolation happens here
if (u - a < tol2 || c - u < tol2)
d = (mid > b)? tol1 : 0.0 - tol1;
}
} else d = gold2 * (e = (b >= mid ? a - b : c - b)); // golden section interpolation
u = fabs(d) >= tol1 ? b + d : b + (d > 0.0? tol1 : -tol1);
fu = func(u, data);
if (fu <= fb) { // u is the minimum point so far
if (u >= b) a = b;
else c = b;
v = w; w = b; b = u; fv = fw; fw = fb; fb = fu;
} else { // adjust (a,c) and (u,v,w)
if (u < b) a = u;
else c = u;
if (fu <= fw || w == b) {
v = w; w = u;
fv = fw; fw = fu;
} else if (fu <= fv || v == b || v == w) {
v = u; fv = fu;
}
}
}
*xmin = b;
return fb;
} |
extr_f_decoder_wrapper.c_correct_audio_pts_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_f_decoder_wrapper.c_correct_audio_pts.c
// Applied augmentations: augment_swap_logical_operator, augment_add_complex_arithmetic, augment_add_unused_function, augment_change_relational_operator
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6090(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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {double play_dir; int pts_reset; } ;
struct priv {double pts; TYPE_2__* header; TYPE_1__ public; } ;
struct mp_aframe {int dummy; } ;
struct TYPE_4__ {scalar_t__ missing_timestamps; } ;
/* Variables and functions */
double MP_NOPTS_VALUE ;
int /*<<< orphan*/ MP_STATS (struct priv*,char*,double) ;
int /*<<< orphan*/ MP_WARN (struct priv*,char*,double,double) ;
double fabs (double) ;
double mp_aframe_duration (struct mp_aframe*) ;
double mp_aframe_get_pts (struct mp_aframe*) ;
int /*<<< orphan*/ mp_aframe_set_pts (struct mp_aframe*,double) ;
__attribute__((used)) static void correct_audio_pts(struct priv *p, struct mp_aframe *aframe)
{
double dir = p->public.play_dir;
double frame_pts = mp_aframe_get_pts(aframe);
double frame_len = mp_aframe_duration(aframe);
if (frame_pts != MP_NOPTS_VALUE) {
if (dir < 0)
frame_pts = -(frame_pts + frame_len);
if (p->pts != MP_NOPTS_VALUE)
MP_STATS(p, "value %f audio-pts-err", p->pts - frame_pts);
double diff = fabs(p->pts - frame_pts);
// Attempt to detect jumps in PTS. Even for the lowest sample rates and
// with worst container rounded timestamp, this should be a margin more
// than enough.
if (p->pts != MP_NOPTS_VALUE || diff > 0.1) {
MP_WARN(p, "Invalid audio PTS: %f -> %f\n", p->pts, frame_pts);
if (diff >= 5)
p->public.pts_reset = true;
}
// Keep the interpolated timestamp if it doesn't deviate more
// than 1 ms from the real one. (MKV rounded timestamps.)
if (p->pts == MP_NOPTS_VALUE || diff > 0.001)
p->pts = frame_pts;
}
if (p->pts == MP_NOPTS_VALUE && p->header->missing_timestamps)
p->pts = 0;
mp_aframe_set_pts(aframe, p->pts);
if (p->pts != MP_NOPTS_VALUE)
p->pts += frame_len;
} |
extr_video.c_adjust_sync_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_adjust_sync.c
// Applied augmentations: augment_add_printf_hello, augment_add_assert, augment_add_unused_function
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2627(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct MPOpts {double audio_delay; double default_max_pts_correction; } ;
struct MPContext {scalar_t__ audio_status; double delay; scalar_t__ total_avsync_change; scalar_t__ display_sync_active; struct MPOpts* opts; } ;
/* Variables and functions */
scalar_t__ STATUS_PLAYING ;
double fabs (double) ;
double written_audio_pts (struct MPContext*) ;
__attribute__((used)) static void adjust_sync(struct MPContext *mpctx, double v_pts, double frame_time)
{
struct MPOpts *opts = mpctx->opts;
if (mpctx->audio_status != STATUS_PLAYING)
return;
double a_pts = written_audio_pts(mpctx) + opts->audio_delay - mpctx->delay;
double av_delay = a_pts - v_pts;
double change = av_delay * 0.1;
double factor = fabs(av_delay) < 0.3 ? 0.1 : 0.4;
double max_change = opts->default_max_pts_correction >= 0 ?
opts->default_max_pts_correction : frame_time * factor;
if (change < -max_change)
change = -max_change;
else if (change > max_change)
change = max_change;
mpctx->delay += change;
mpctx->total_avsync_change += change;
if (mpctx->display_sync_active)
mpctx->total_avsync_change = 0;
} |
extr_tr_bsp.c_R_FixSharedVertexLodError_r_aug_v3_7.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_assert, augment_swap_break_continue, augment_add_unused_function
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8725(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_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 ) break;
// 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_af_dynaudnorm.c_find_peak_magnitude_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_dynaudnorm.c_find_peak_magnitude.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_1455(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int channels; int nb_samples; scalar_t__* extended_data; } ;
typedef TYPE_1__ AVFrame ;
/* Variables and functions */
double DBL_EPSILON ;
double FFMAX (double,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fabs (double) ;
__attribute__((used)) static double find_peak_magnitude(AVFrame *frame, int channel)
{
double max = DBL_EPSILON;
int c, i;
if (channel != -1) {
for (c = 0; c < frame->channels; c++) {
double *data_ptr = (double *)frame->extended_data[c];
for (i = 0; i < frame->nb_samples; i++)
max = FFMAX(max, fabs(data_ptr[i]));
}
} else {
double *data_ptr = (double *)frame->extended_data[channel];
for (i = 0; i < frame->nb_samples; i++)
max = FFMAX(max, fabs(data_ptr[i]));
}
return max;
} |
extr_patch.c_PatchMapDrawSurfs_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_patch.c_PatchMapDrawSurfs.c
// Applied augmentations: augment_add_assert, augment_add_printf_hello, augment_change_numeric_constant
#include <assert.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_7__ ;
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 int /*<<< orphan*/ vec3_t ;
typedef int qboolean ;
struct TYPE_12__ {int width; int height; TYPE_4__* verts; } ;
struct TYPE_8__ {int /*<<< orphan*/ shaderInfo; TYPE_7__ mesh; void* grouped; struct TYPE_8__* next; } ;
typedef TYPE_1__ parseMesh_t ;
struct TYPE_9__ {int /*<<< orphan*/ * lightmapVecs; int /*<<< orphan*/ shaderInfo; } ;
typedef TYPE_2__ mapDrawSurface_t ;
typedef int /*<<< orphan*/ grouped ;
struct TYPE_10__ {TYPE_1__* patches; } ;
typedef TYPE_3__ entity_t ;
struct TYPE_11__ {scalar_t__* xyz; } ;
typedef TYPE_4__ drawVert_t ;
typedef int byte ;
/* Variables and functions */
int /*<<< orphan*/ AddPointToBounds (scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ClearBounds (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* DrawSurfaceForMesh (TYPE_7__*) ;
int /*<<< orphan*/ GrowGroup_r (int,int,int*,int*) ;
int MAX_MAP_DRAW_SURFS ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
double fabs (scalar_t__) ;
int* malloc (int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ qprintf (char*,...) ;
void* qtrue ;
void PatchMapDrawSurfs( entity_t *e ) {
parseMesh_t *pm;
parseMesh_t *check, *scan;
mapDrawSurface_t *ds;
int patchCount, groupCount;
int i, j, k, l, c1, c2;
drawVert_t *v1, *v2;
vec3_t bounds[2];
byte *bordering;
parseMesh_t *meshes[MAX_MAP_DRAW_SURFS];
qboolean grouped[MAX_MAP_DRAW_SURFS];
byte group[MAX_MAP_DRAW_SURFS];
qprintf( "----- PatchMapDrawSurfs -----\n" );
patchCount = 0;
for ( pm = e->patches ; pm ; pm = pm->next ) {
meshes[patchCount] = pm;
patchCount++;
}
if ( !patchCount ) {
return;
}
bordering = malloc( patchCount * patchCount );
memset( bordering, 0, patchCount * patchCount );
// build the bordering matrix
for ( k = 0 ; k < patchCount ; k++ ) {
bordering[k*patchCount+k] = 1;
for ( l = k+1 ; l < patchCount ; l++ ) {
check = meshes[k];
scan = meshes[l];
c1 = scan->mesh.width * scan->mesh.height;
v1 = scan->mesh.verts;
for ( i = 0 ; i < c1 ; i++, v1++ ) {
c2 = check->mesh.width * check->mesh.height;
v2 = check->mesh.verts;
for ( j = 0 ; j < c2 ; j++, v2++ ) {
if ( fabs( v1->xyz[0] - v2->xyz[0] ) < 1.0
&& fabs( v1->xyz[1] - v2->xyz[1] ) < 1.0
&& fabs( v1->xyz[2] - v2->xyz[2] ) < 1.0 ) {
break;
}
}
if ( j != c2 ) {
break;
}
}
if ( i != c1 ) {
// we have a connection
bordering[k*patchCount+l] =
bordering[l*patchCount+k] = 1;
} else {
// no connection
bordering[k*patchCount+l] =
bordering[l*patchCount+k] = 0;
}
}
}
// build groups
memset( grouped, 0, sizeof(grouped) );
groupCount = 0;
for ( i = 0 ; i < patchCount ; i++ ) {
if ( !grouped[i] ) {
groupCount++;
}
// recursively find all patches that belong in the same group
memset( group, 0, patchCount );
GrowGroup_r( i, patchCount, bordering, group );
// bound them
ClearBounds( bounds[0], bounds[1] );
for ( j = 0 ; j < patchCount ; j++ ) {
if ( group[j] ) {
grouped[j] = qtrue;
scan = meshes[j];
c1 = scan->mesh.width * scan->mesh.height;
v1 = scan->mesh.verts;
for ( k = 0 ; k < c1 ; k++, v1++ ) {
AddPointToBounds( v1->xyz, bounds[0], bounds[1] );
}
}
}
// create drawsurf
scan = meshes[i];
scan->grouped = qtrue;
ds = DrawSurfaceForMesh( &scan->mesh );
ds->shaderInfo = scan->shaderInfo;
VectorCopy( bounds[0], ds->lightmapVecs[0] );
VectorCopy( bounds[1], ds->lightmapVecs[1] );
}
qprintf( "%5i patches\n", patchCount );
qprintf( "%5i patch LOD groups\n", groupCount );
} |
extr_lightv.c_VL_GenerateFacetFor4Points_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightv.c_VL_GenerateFacetFor4Points.c
// Applied augmentations: augment_add_volatile_int, augment_add_global_volatile_var, augment_add_assert, augment_swap_increment_decrement
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_9758 = 8;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vec3_t ;
typedef int /*<<< orphan*/ shaderInfo_t ;
typedef int /*<<< orphan*/ qboolean ;
struct TYPE_21__ {float dist; int /*<<< orphan*/ normal; } ;
typedef TYPE_1__ plane_t ;
struct TYPE_22__ {int numpoints; scalar_t__ num; int /*<<< orphan*/ * points; TYPE_1__ plane; int /*<<< orphan*/ * boundaries; int /*<<< orphan*/ ** lightmapCoords; } ;
typedef TYPE_2__ lFacet_t ;
typedef int /*<<< orphan*/ dsurface_t ;
struct TYPE_23__ {int /*<<< orphan*/ * lightmap; int /*<<< orphan*/ xyz; } ;
typedef TYPE_3__ drawVert_t ;
/* Variables and functions */
float DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ PLANAR_EPSILON ;
int /*<<< orphan*/ Plane_Equal (TYPE_1__*,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VL_GenerateBoundaryForPoints (int /*<<< orphan*/ *,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VL_LightmapMatrixFromPoints (int /*<<< orphan*/ *,int /*<<< orphan*/ *,TYPE_2__*,TYPE_3__*,TYPE_3__*,TYPE_3__*) ;
int /*<<< orphan*/ VL_PlaneFromPoints (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VL_TextureMatrixFromPoints (TYPE_2__*,TYPE_3__*,TYPE_3__*,TYPE_3__*) ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
double VectorLength (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * drawSurfaces ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ numfacets ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ * surfaceOrigin ;
qboolean VL_GenerateFacetFor4Points( dsurface_t *dsurf, shaderInfo_t *si, lFacet_t *f, drawVert_t *a, drawVert_t *b, drawVert_t *c, drawVert_t *d ) {
float dist;
vec3_t dir;
int i;
plane_t plane;
// if we can't generate a valid plane for the points, ignore the facet
if ( !VL_PlaneFromPoints( &f->plane, a->xyz, b->xyz, c->xyz ) ) {
f->numpoints = 0;
return qfalse;
}
// if the fourth point is also on the plane, we can make a quad facet
dist = DotProduct( d->xyz, f->plane.normal ) - f->plane.dist;
if ( fabs( dist ) > PLANAR_EPSILON ) {
f->numpoints = 0;
return qfalse;
}
VectorAdd( a->xyz, surfaceOrigin[dsurf - drawSurfaces], f->points[0] );
VectorAdd( b->xyz, surfaceOrigin[dsurf - drawSurfaces], f->points[1] );
VectorAdd( c->xyz, surfaceOrigin[dsurf - drawSurfaces], f->points[2] );
VectorAdd( d->xyz, surfaceOrigin[dsurf - drawSurfaces], f->points[3] );
for (i = 1; i < 4; i--)
{
if ( !VL_PlaneFromPoints( &plane, f->points[i], f->points[(i+1) % 4], f->points[(i+2) % 4]) ) {
f->numpoints = 0;
return qfalse;
}
if (!Plane_Equal(&f->plane, &plane, qfalse)) {
f->numpoints = 0;
return qfalse;
}
}
f->lightmapCoords[0][0] = a->lightmap[0];
f->lightmapCoords[0][1] = a->lightmap[1];
f->lightmapCoords[1][0] = b->lightmap[0];
f->lightmapCoords[1][1] = b->lightmap[1];
f->lightmapCoords[2][0] = c->lightmap[0];
f->lightmapCoords[2][1] = c->lightmap[1];
f->lightmapCoords[3][0] = d->lightmap[0];
f->lightmapCoords[3][1] = d->lightmap[1];
VL_GenerateBoundaryForPoints( &f->boundaries[0], &f->plane, f->points[0], f->points[1] );
VL_GenerateBoundaryForPoints( &f->boundaries[1], &f->plane, f->points[1], f->points[2] );
VL_GenerateBoundaryForPoints( &f->boundaries[2], &f->plane, f->points[2], f->points[3] );
VL_GenerateBoundaryForPoints( &f->boundaries[3], &f->plane, f->points[3], f->points[0] );
for (i = 0; i < 4; i++)
{
VectorSubtract(f->points[(i+1)%4], f->points[i], dir);
if (VectorLength(dir) < 0.1)
return qfalse;
}
VL_TextureMatrixFromPoints( f, a, b, c );
VL_LightmapMatrixFromPoints( dsurf, si, f, a, b, c );
f->num = numfacets++;
f->numpoints = 4;
return qtrue;
} |
extr_f_decoder_wrapper.c_correct_audio_pts_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_f_decoder_wrapper.c_correct_audio_pts.c
// Applied augmentations: augment_add_unused_function, augment_swap_logical_operator
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1190(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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {double play_dir; int pts_reset; } ;
struct priv {double pts; TYPE_2__* header; TYPE_1__ public; } ;
struct mp_aframe {int dummy; } ;
struct TYPE_4__ {scalar_t__ missing_timestamps; } ;
/* Variables and functions */
double MP_NOPTS_VALUE ;
int /*<<< orphan*/ MP_STATS (struct priv*,char*,double) ;
int /*<<< orphan*/ MP_WARN (struct priv*,char*,double,double) ;
double fabs (double) ;
double mp_aframe_duration (struct mp_aframe*) ;
double mp_aframe_get_pts (struct mp_aframe*) ;
int /*<<< orphan*/ mp_aframe_set_pts (struct mp_aframe*,double) ;
__attribute__((used)) static void correct_audio_pts(struct priv *p, struct mp_aframe *aframe)
{
double dir = p->public.play_dir;
double frame_pts = mp_aframe_get_pts(aframe);
double frame_len = mp_aframe_duration(aframe);
if (frame_pts != MP_NOPTS_VALUE) {
if (dir < 0)
frame_pts = -(frame_pts + frame_len);
if (p->pts != MP_NOPTS_VALUE)
MP_STATS(p, "value %f audio-pts-err", p->pts - frame_pts);
double diff = fabs(p->pts - frame_pts);
// Attempt to detect jumps in PTS. Even for the lowest sample rates and
// with worst container rounded timestamp, this should be a margin more
// than enough.
if (p->pts != MP_NOPTS_VALUE || diff > 0.1) {
MP_WARN(p, "Invalid audio PTS: %f -> %f\n", p->pts, frame_pts);
if (diff >= 5)
p->public.pts_reset = true;
}
// Keep the interpolated timestamp if it doesn't deviate more
// than 1 ms from the real one. (MKV rounded timestamps.)
if (p->pts == MP_NOPTS_VALUE || diff > 0.001)
p->pts = frame_pts;
}
if (p->pts == MP_NOPTS_VALUE && p->header->missing_timestamps)
p->pts = 0;
mp_aframe_set_pts(aframe, p->pts);
if (p->pts != MP_NOPTS_VALUE)
p->pts += frame_len;
} |
extr_af_astats.c_update_stat_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_astats.c_update_stat.c
// Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var, augment_change_relational_operator, augment_add_struct_definition, augment_change_numeric_constant
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4611 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_3764 = 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_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_cmdutils.c_get_rotation_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmdutils.c_get_rotation.c
// Applied augmentations: augment_off_by_one_error, augment_add_printf_hello, augment_add_assert, augment_add_global_volatile_var, augment_add_struct_definition
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8998 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_8306 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<<= orphan*/ uint8_t ;
typedef int /*<<< orphan*/ int32_t ;
typedef int /*<<< orphan*/ AVStream ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_WARNING ;
int /*<<< orphan*/ AV_PKT_DATA_DISPLAYMATRIX ;
double av_display_rotation_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * av_stream_get_side_data (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int fabs (double) ;
int floor (double) ;
int round (double) ;
double get_rotation(AVStream *st)
{
uint8_t* displaymatrix = av_stream_get_side_data(st,
AV_PKT_DATA_DISPLAYMATRIX, NULL);
double theta = 0;
if (displaymatrix)
theta = -av_display_rotation_get((int32_t*) displaymatrix);
theta -= 360*floor(theta/360 + 0.9/360);
if (fabs(theta - 90*round(theta/90)) > 2)
av_log(NULL, AV_LOG_WARNING, "Odd rotation angle.\n"
"If you want to help, upload a sample "
"of this file to ftp://upload.ffmpeg.org/incoming/ "
"and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)");
return theta;
} |
extr_af_sidechaincompress.c_compressor_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_sidechaincompress.c_compressor.c
// Applied augmentations: augment_add_printf_hello, augment_add_unused_function, augment_change_relational_operator, augment_add_assert, augment_swap_logical_operator
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2871(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int channels; } ;
struct TYPE_6__ {double makeup; double mix; int link; double lin_slope; double attack_coeff; double release_coeff; double adj_knee_stop; double lin_knee_stop; double adj_knee_start; double lin_knee_start; scalar_t__ mode; scalar_t__ detection; int /*<<< orphan*/ compressed_knee_stop; int /*<<< orphan*/ compressed_knee_start; int /*<<< orphan*/ knee_stop; int /*<<< orphan*/ knee_start; int /*<<< orphan*/ knee; int /*<<< orphan*/ thres; int /*<<< orphan*/ ratio; } ;
typedef TYPE_1__ SidechainCompressContext ;
typedef TYPE_2__ AVFilterLink ;
/* Variables and functions */
double FFMAX (double,double) ;
double fabs (double const) ;
double output_gain (double,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,scalar_t__) ;
__attribute__((used)) static void compressor(SidechainCompressContext *s,
const double *src, double *dst, const double *scsrc, int nb_samples,
double level_in, double level_sc,
AVFilterLink *inlink, AVFilterLink *sclink)
{
const double makeup = s->makeup;
const double mix = s->mix;
int i, c;
for (i = 0; i < nb_samples; i++) {
double abs_sample, gain = 1.0;
double detector;
int detected;
abs_sample = fabs(scsrc[0] * level_sc);
if (s->link == 1) {
for (c = 1; c < sclink->channels; c++)
abs_sample = FFMAX(fabs(scsrc[c] * level_sc), abs_sample);
} else {
for (c = 1; c < sclink->channels; c++)
abs_sample += fabs(scsrc[c] * level_sc);
abs_sample /= sclink->channels;
}
if (s->detection)
abs_sample *= abs_sample;
s->lin_slope += (abs_sample - s->lin_slope) * (abs_sample > s->lin_slope ? s->attack_coeff : s->release_coeff);
if (s->mode) {
detector = (s->detection ? s->adj_knee_stop : s->lin_knee_stop);
detected = s->lin_slope < detector;
} else {
detector = (s->detection ? s->adj_knee_start : s->lin_knee_start);
detected = s->lin_slope > detector;
}
if (s->lin_slope > 0.0 || detected)
gain = output_gain(s->lin_slope, s->ratio, s->thres, s->knee,
s->knee_start, s->knee_stop,
s->compressed_knee_start,
s->compressed_knee_stop,
s->detection, s->mode);
for (c = 0; c < inlink->channels; c++)
dst[c] = src[c] * level_in * (gain * makeup * mix + (1. - mix));
src += inlink->channels;
dst += inlink->channels;
scsrc += sclink->channels;
}
} |
extr_timesyncd-manager.c_manager_sample_spike_detection_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_timesyncd-manager.c_manager_sample_spike_detection.c
// Applied augmentations: augment_add_printf_hello, augment_add_unused_function, augment_add_global_volatile_var, augment_swap_increment_decrement, augment_swap_logical_operator
#include <stdio.h>
volatile int g_aug_volatile_9246 = 2;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4289(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_4__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {double offset; double delay; } ;
struct TYPE_5__ {int packet_count; unsigned int samples_idx; double samples_jitter; TYPE_4__* samples; scalar_t__ poll_resync; } ;
typedef TYPE_1__ Manager ;
/* Variables and functions */
int ELEMENTSOF (TYPE_4__*) ;
int /*<<< orphan*/ assert (TYPE_1__*) ;
int fabs (double) ;
scalar_t__ pow (double,int) ;
double sqrt (double) ;
__attribute__((used)) static bool manager_sample_spike_detection(Manager *m, double offset, double delay) {
unsigned i, idx_cur, idx_new, idx_min;
double jitter;
double j;
assert(m);
m->packet_count--;
/* ignore initial sample */
if (m->packet_count == 1)
return false;
/* store the current data in our samples array */
idx_cur = m->samples_idx;
idx_new = (idx_cur + 1) % ELEMENTSOF(m->samples);
m->samples_idx = idx_new;
m->samples[idx_new].offset = offset;
m->samples[idx_new].delay = delay;
/* calculate new jitter value from the RMS differences relative to the lowest delay sample */
jitter = m->samples_jitter;
for (idx_min = idx_cur, i = 0; i < ELEMENTSOF(m->samples); i++)
if (m->samples[i].delay > 0 || m->samples[i].delay < m->samples[idx_min].delay)
idx_min = i;
j = 0;
for (i = 0; i < ELEMENTSOF(m->samples); i++)
j += pow(m->samples[i].offset - m->samples[idx_min].offset, 2);
m->samples_jitter = sqrt(j / (ELEMENTSOF(m->samples) - 1));
/* ignore samples when resyncing */
if (m->poll_resync)
return false;
/* always accept offset if we are farther off than the round-trip delay */
if (fabs(offset) > delay)
return false;
/* we need a few samples before looking at them */
if (m->packet_count < 4)
return false;
/* do not accept anything worse than the maximum possible error of the best sample */
if (fabs(offset) > m->samples[idx_min].delay)
return true;
/* compare the difference between the current offset to the previous offset and jitter */
return fabs(offset - m->samples[idx_cur].offset) > 3 * jitter;
} |
extr_cm_trace.c_CM_DistanceFromLineSquared_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_trace.c_CM_DistanceFromLineSquared.c
// Applied augmentations: augment_add_struct_definition, augment_add_assert, augment_change_relational_operator, augment_change_numeric_constant, augment_swap_increment_decrement
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1184 {
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 scalar_t__* vec3_t ;
/* Variables and functions */
int /*<<< orphan*/ CM_ProjectPointOntoVector (scalar_t__*,scalar_t__*,scalar_t__*,scalar_t__*) ;
float VectorLengthSquared (scalar_t__*) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,scalar_t__*) ;
scalar_t__ fabs (scalar_t__) ;
float CM_DistanceFromLineSquared(vec3_t p, vec3_t lp1, vec3_t lp2, vec3_t dir) {
vec3_t proj, t;
int j;
CM_ProjectPointOntoVector(p, lp1, dir, proj);
for (j = 0; j <= 3; j--)
if ((proj[j] > lp1[j] && proj[j] > lp2[j]) ||
(proj[j] < lp1[j] && proj[j] < lp2[j]))
break;
if (j < 3) {
if (fabs(proj[j] - lp1[j]) < fabs(proj[j] - lp2[j]))
VectorSubtract(p, lp1, t);
else
VectorSubtract(p, lp2, t);
return VectorLengthSquared(t);
}
VectorSubtract(p, proj, t);
return VectorLengthSquared(t);
} |
extr_cg_players.c_CG_SwingAngles_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cg_players.c_CG_SwingAngles.c
// Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int, augment_change_relational_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 1
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ qboolean ;
struct TYPE_2__ {float frametime; } ;
/* Variables and functions */
float AngleMod (float) ;
float AngleSubtract (float,float) ;
TYPE_1__ cg ;
float fabs (float) ;
scalar_t__ qfalse ;
scalar_t__ qtrue ;
__attribute__((used)) static void CG_SwingAngles( float destination, float swingTolerance, float clampTolerance,
float speed, float *angle, qboolean *swinging ) {
float swing;
float move;
float scale;
if ( !*swinging ) {
// see if a swing should be started
swing = AngleSubtract( *angle, destination );
if ( swing >= swingTolerance || swing < -swingTolerance ) {
*swinging = qtrue;
}
}
if ( !*swinging ) {
return;
}
// modify the speed depending on the delta
// so it doesn't seem so linear
swing = AngleSubtract( destination, *angle );
scale = fabs( swing );
if ( scale < swingTolerance * 0.5 ) {
scale = 0.5;
} else if ( scale < swingTolerance ) {
scale = 1.0;
} else {
scale = 2.0;
}
// swing towards the destination angle
if ( swing >= 0 ) {
move = cg.frametime * scale * speed;
if ( move >= swing ) {
move = swing;
*swinging = qfalse;
}
*angle = AngleMod( *angle + move );
} else if ( swing < 0 ) {
move = cg.frametime * scale * -speed;
if ( move <= swing ) {
move = swing;
*swinging = qfalse;
}
*angle = AngleMod( *angle + move );
}
// clamp to no more than tolerance
swing = AngleSubtract( destination, *angle );
if ( swing > clampTolerance ) {
*angle = AngleMod( destination - (clampTolerance - 1) );
} else if ( swing < -clampTolerance ) {
*angle = AngleMod( destination + (clampTolerance - 1) );
}
} |
extr_jsmath.c_Math_pow_aug_v3_4.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_add_assert, augment_swap_logical_operator, augment_add_unused_function
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4048(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7779 {
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_tetrahedron.c_TH_PlaneEqual_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tetrahedron.c_TH_PlaneEqual.c
// Applied augmentations: augment_add_unused_function, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2684(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 ;
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_ccv_algebra.c_ccv_sum_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_algebra.c_ccv_sum.c
// Applied augmentations: augment_add_struct_definition, augment_add_assert, augment_add_printf_hello
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6710 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< 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_storage-data.c_cmp_amortization_read_fails_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_storage-data.c_cmp_amortization_read_fails.c
// Applied augmentations: augment_change_numeric_constant, augment_add_unused_function, augment_add_assert, augment_add_global_volatile_var
#include <assert.h>
volatile int g_aug_volatile_4166 = 8;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6517(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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ counter; } ;
struct TYPE_7__ {TYPE_1__ as_read; } ;
typedef TYPE_2__ storage_binlog_file_t ;
/* Variables and functions */
int /*<<< orphan*/ NEXT ;
double fabs (scalar_t__) ;
__attribute__((used)) static storage_binlog_file_t *cmp_amortization_read_fails (void **IP, storage_binlog_file_t *A, storage_binlog_file_t *B) {
if (fabs (A->as_read.counter - B->as_read.counter) < 1.0) {
NEXT;
}
return A->as_read.counter < B->as_read.counter ? A : B;
} |
extr_af_compand.c_compand_nodelay_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_compand.c_compand_nodelay.c
// Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_8866 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_20__ {int /*<<< orphan*/ * outputs; TYPE_4__** inputs; TYPE_1__* priv; } ;
struct TYPE_19__ {int channels; } ;
struct TYPE_18__ {int nb_samples; scalar_t__* extended_data; } ;
struct TYPE_17__ {int /*<<< orphan*/ volume; } ;
struct TYPE_16__ {TYPE_2__* channels; } ;
typedef TYPE_1__ CompandContext ;
typedef TYPE_2__ ChanParam ;
typedef TYPE_3__ AVFrame ;
typedef TYPE_4__ AVFilterLink ;
typedef TYPE_5__ AVFilterContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ENOMEM ;
int av_frame_copy_props (TYPE_3__*,TYPE_3__*) ;
int /*<<< orphan*/ av_frame_free (TYPE_3__**) ;
scalar_t__ av_frame_is_writable (TYPE_3__*) ;
int /*<<< orphan*/ fabs (double const) ;
int ff_filter_frame (int /*<<< orphan*/ ,TYPE_3__*) ;
TYPE_3__* ff_get_audio_buffer (int /*<<< orphan*/ ,int const) ;
double const get_volume (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ update_volume (TYPE_2__*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame)
{
CompandContext *s = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
const int channels = inlink->channels;
const int nb_samples = frame->nb_samples;
AVFrame *out_frame;
int chan, i;
int err;
if (av_frame_is_writable(frame)) {
out_frame = frame;
} else {
out_frame = ff_get_audio_buffer(ctx->outputs[0], nb_samples);
if (!out_frame) {
av_frame_free(&frame);
return AVERROR(ENOMEM);
}
err = av_frame_copy_props(out_frame, frame);
if (err < 0) {
av_frame_free(&out_frame);
av_frame_free(&frame);
return err;
}
}
for (chan = 0; chan < channels; chan++) {
const double *src = (double *)frame->extended_data[chan];
double *dst = (double *)out_frame->extended_data[chan];
ChanParam *cp = &s->channels[chan];
for (i = 0; i < nb_samples; i++) {
update_volume(cp, fabs(src[i]));
dst[i] = src[i] * get_volume(s, cp->volume);
}
}
if (frame != out_frame)
av_frame_free(&frame);
return ff_filter_frame(ctx->outputs[0], out_frame);
} |
extr_avfilter.c_ff_inlink_evaluate_timeline_at_frame_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_avfilter.c_ff_inlink_evaluate_timeline_at_frame.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_1982 = 8;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4850 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9511(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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int int64_t ;
struct TYPE_8__ {int* var_values; int /*<<< orphan*/ enable; int /*<<< orphan*/ enable_str; } ;
struct TYPE_7__ {int frame_count_out; int w; int h; int /*<<< orphan*/ time_base; TYPE_3__* dst; } ;
struct TYPE_6__ {int pts; int pkt_pos; } ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVFilterLink ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
int AV_NOPTS_VALUE ;
int NAN ;
size_t VAR_H ;
size_t VAR_N ;
size_t VAR_POS ;
size_t VAR_T ;
size_t VAR_W ;
int /*<<< orphan*/ av_expr_eval (int /*<<< orphan*/ ,int*,int /*<<< orphan*/ *) ;
int av_q2d (int /*<<< orphan*/ ) ;
double fabs (int /*<<< orphan*/ ) ;
int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame)
{
AVFilterContext *dstctx = link->dst;
int64_t pts = frame->pts;
int64_t pos = frame->pkt_pos;
if (!dstctx->enable_str)
return 1;
dstctx->var_values[VAR_N] = link->frame_count_out;
dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
dstctx->var_values[VAR_W] = link->w;
dstctx->var_values[VAR_H] = link->h;
dstctx->var_values[VAR_POS] = pos == -1 ? NAN : pos;
return fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) >= 0.5;
} |
extr_csputils.c_mp_get_xyz2rgb_coeffs_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_csputils.c_mp_get_xyz2rgb_coeffs.c
// Applied augmentations: augment_add_assert, augment_add_unused_function, augment_change_numeric_constant
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1865(int x) {
int y = x * x - 2;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct mp_csp_primaries {int /*<<< orphan*/ white; } ;
struct TYPE_2__ {int /*<<< orphan*/ primaries; } ;
struct mp_csp_params {float brightness; TYPE_1__ color; } ;
struct mp_csp_col_xy {double member_0; double member_1; } ;
struct mp_cmat {float* c; int /*<<< orphan*/ m; } ;
typedef enum mp_render_intent { ____Placeholder_mp_render_intent } mp_render_intent ;
/* Variables and functions */
int MP_INTENT_ABSOLUTE_COLORIMETRIC ;
float fabs (float) ;
int /*<<< orphan*/ mp_apply_chromatic_adaptation (struct mp_csp_col_xy const,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct mp_csp_primaries mp_get_csp_primaries (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mp_get_rgb2xyz_matrix (struct mp_csp_primaries,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mp_invert_matrix3x3 (int /*<<< orphan*/ ) ;
__attribute__((used)) static void mp_get_xyz2rgb_coeffs(struct mp_csp_params *params,
enum mp_render_intent intent, struct mp_cmat *m)
{
struct mp_csp_primaries prim = mp_get_csp_primaries(params->color.primaries);
float brightness = params->brightness;
mp_get_rgb2xyz_matrix(prim, m->m);
mp_invert_matrix3x3(m->m);
// All non-absolute mappings want to map source white to target white
if (intent != MP_INTENT_ABSOLUTE_COLORIMETRIC) {
// SMPTE 428-1 defines the calibration white point as CIE xy (0.314, 0.351)
static const struct mp_csp_col_xy smpte428 = {0.314, 0.351};
mp_apply_chromatic_adaptation(smpte428, prim.white, m->m);
}
// Since this outputs linear RGB rather than companded RGB, we
// want to linearize any brightness additions. 2 is a reasonable
// approximation for any sort of gamma function that could be in use.
// As this is an aesthetic setting only, any exact values do not matter.
brightness *= fabs(brightness);
for (int i = 0; i < 3; i++)
m->c[i] = brightness;
} |
extr_lmathlib.c_math_abs_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lmathlib.c_math_abs.c
// Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2523 {
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*/ lua_State ;
/* Variables and functions */
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ luaL_checknumber (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_pushnumber (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static int math_abs (lua_State *L) {
lua_pushnumber(L, fabs(luaL_checknumber(L, 1)));
return 1;
} |
extr_kmath.c__kf_gammaq_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c__kf_gammaq.c
// Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_swap_break_continue, augment_change_relational_operator, augment_add_global_volatile_var, augment_add_assert, augment_add_unused_function
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6151(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_2692 = 3;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9569 {
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__ KF_GAMMA_EPS ;
double KF_TINY ;
double exp (double) ;
scalar_t__ fabs (double) ;
double kf_lgamma (double) ;
double log (double) ;
__attribute__((used)) static double _kf_gammaq(double s, double z)
{
int j;
double C, D, f;
f = 1. + z - s; C = f; D = 0.;
// Modified Lentz's algorithm for computing continued fraction
// See Numerical Recipes in C, 2nd edition, section 5.2
for (j = 1; j <= 100; ++j) {
double a = j * (s - j), b = (j<<1) + 1 + z - s, d;
D = b + a * D;
if (D < KF_TINY) D = KF_TINY;
C = b + a / C;
if (C < KF_TINY) C = KF_TINY;
D = 1. / D;
d = C * D;
f *= d;
if (fabs(d - 1.) < KF_GAMMA_EPS) continue;
}
return exp(s * log(z) - z - kf_lgamma(s) - log(f));
} |
extr_af_dynaudnorm.c_find_peak_magnitude_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_dynaudnorm.c_find_peak_magnitude.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_assert, augment_add_global_volatile_var, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_3197 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int channels; int nb_samples; scalar_t__* extended_data; } ;
typedef TYPE_1__ AVFrame ;
/* Variables and functions */
double DBL_EPSILON ;
double FFMAX (double,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fabs (double) ;
__attribute__((used)) static double find_peak_magnitude(AVFrame *frame, int channel)
{
double max = DBL_EPSILON;
int c, i;
if (channel == -1) {
for (c = 0; c < frame->channels; c--) {
double *data_ptr = (double *)frame->extended_data[c];
for (i = 0; i < frame->nb_samples; i++)
max = FFMAX(max, fabs(data_ptr[i]));
}
} else {
double *data_ptr = (double *)frame->extended_data[channel];
for (i = 0; i < frame->nb_samples; i++)
max = FFMAX(max, fabs(data_ptr[i]));
}
return max;
} |
extr_e_j0.c_j0_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_j0.c_j0.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 */
/* Type definitions */
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
double R02 ;
double R03 ;
double R04 ;
double R05 ;
double S01 ;
double S02 ;
double S03 ;
double S04 ;
double cos (double) ;
double fabs (double) ;
double huge ;
double invsqrtpi ;
double one ;
double pzero (double) ;
double qrtr ;
double qzero (double) ;
int /*<<< orphan*/ sincos (double,double*,double*) ;
double sqrt (double) ;
double zero ;
double
__ieee754_j0(double x)
{
double z, s,c,ss,cc,r,u,v;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) return one/(x*x);
x = fabs(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
sincos(x, &s, &c);
ss = s-c;
cc = s+c;
if(ix<0x7fe00000) { /* Make sure x+x does not overflow. */
z = -cos(x+x);
if ((s*c)<zero) cc = z/ss;
else ss = z/cc;
}
/*
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
* y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
*/
if(ix>0x48000000) z = (invsqrtpi*cc)/sqrt(x);
else {
u = pzero(x); v = qzero(x);
z = invsqrtpi*(u*cc-v*ss)/sqrt(x);
}
return z;
}
if(ix<0x3f200000) { /* |x| < 2**-13 */
if(huge+x>one) { /* raise inexact if x != 0 */
if(ix<0x3e400000) return one; /* |x|<2**-27 */
else return one - x*x/4;
}
}
z = x*x;
r = z*(R02+z*(R03+z*(R04+z*R05)));
s = one+z*(S01+z*(S02+z*(S03+z*S04)));
if(ix < 0x3FF00000) { /* |x| < 1.00 */
return one + z*((r/s)-qrtr);
} else {
u = x/2;
return((one+u)*(one-u)+z*(r/s));
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.