name stringlengths 23 117 | code stringlengths 356 42.1k |
|---|---|
extr_ui_players.c_UI_SwingAngles_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ui_players.c_UI_SwingAngles.c
// Applied augmentations: augment_change_relational_operator, augment_add_volatile_int, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5156(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 */
typedef scalar_t__ qboolean ;
struct TYPE_3__ {float frameTime; } ;
struct TYPE_4__ {TYPE_1__ uiDC; } ;
/* Variables and functions */
float AngleMod (float) ;
float AngleSubtract (float,float) ;
float fabs (float) ;
scalar_t__ qfalse ;
scalar_t__ qtrue ;
TYPE_2__ uiInfo ;
__attribute__((used)) static void UI_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 = uiInfo.uiDC.frameTime * scale * speed;
if ( move >= swing ) {
move = swing;
*swinging = qfalse;
}
*angle = AngleMod( *angle + move );
} else if ( swing < 0 ) {
move = uiInfo.uiDC.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_avsscanf.c_decfloat_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_avsscanf.c_decfloat.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7210 {
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 uint64_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ FFFILE ;
/* Variables and functions */
int DBL_MANT_DIG ;
int DBL_MAX ;
int DBL_MIN ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ERANGE ;
int INT_MAX ;
int KMAX ;
int LD_B1B_DIG ;
#define LD_B1B_MAX 128
long long LLONG_MIN ;
int MASK ;
double copysign (double,double) ;
int /*<<< orphan*/ errno ;
scalar_t__ fabs (double) ;
double fmod (double,int) ;
scalar_t__ pow (int,int) ;
double scalbn (double,int) ;
long long scanexp (int /*<<< orphan*/ *,int) ;
int shgetc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ shlim (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ shunget (int /*<<< orphan*/ *) ;
__attribute__((used)) static double decfloat(FFFILE *f, int c, int bits, int emin, int sign, int pok)
{
uint32_t x[KMAX];
static const uint32_t th[] = { LD_B1B_MAX };
int i, j, k, a, z;
long long lrp=0, dc=0;
long long e10=0;
int lnz = 0;
int gotdig = 0, gotrad = 0;
int rp;
int e2;
int emax = -emin-bits+3;
int denormal = 0;
double y;
double frac=0;
double bias=0;
static const int p10s[] = { 10, 100, 1000, 10000,
100000, 1000000, 10000000, 100000000 };
j=0;
k=0;
/* Don't let leading zeros consume buffer space */
for (; c=='0'; c = shgetc(f)) gotdig=1;
if (c=='.') {
gotrad = 1;
for (c = shgetc(f); c=='0'; c = shgetc(f)) gotdig=1, lrp--;
}
x[0] = 0;
for (; c-'0'<10U || c=='.'; c = shgetc(f)) {
if (c == '.') {
if (gotrad) break;
gotrad = 1;
lrp = dc;
} else if (k < KMAX-3) {
dc++;
if (c!='0') lnz = dc;
if (j) x[k] = x[k]*10 + c-'0';
else x[k] = c-'0';
if (++j==9) {
k++;
j=0;
}
gotdig=1;
} else {
dc++;
if (c!='0') {
lnz = (KMAX-4)*9;
x[KMAX-4] |= 1;
}
}
}
if (!gotrad) lrp=dc;
if (gotdig && (c|32)=='e') {
e10 = scanexp(f, pok);
if (e10 == LLONG_MIN) {
if (pok) {
shunget(f);
} else {
shlim(f, 0);
return 0;
}
e10 = 0;
}
lrp += e10;
} else if (c>=0) {
shunget(f);
}
if (!gotdig) {
errno = EINVAL;
shlim(f, 0);
return 0;
}
/* Handle zero specially to avoid nasty special cases later */
if (!x[0]) return sign * 0.0;
/* Optimize small integers (w/no exponent) and over/under-flow */
if (lrp==dc && dc<10 && (bits>30 || x[0]>>bits==0))
return sign * (double)x[0];
if (lrp > -emin/2) {
errno = ERANGE;
return sign * DBL_MAX * DBL_MAX;
}
if (lrp < emin-2*DBL_MANT_DIG) {
errno = ERANGE;
return sign * DBL_MIN * DBL_MIN;
}
/* Align incomplete final B1B digit */
if (j) {
for (; j<9; j++) x[k]*=10;
k++;
j=0;
}
a = 0;
z = k;
e2 = 0;
rp = lrp;
/* Optimize small to mid-size integers (even in exp. notation) */
if (lnz<9 && lnz<=rp && rp < 18) {
int bitlim;
if (rp == 9) return sign * (double)x[0];
if (rp < 9) return sign * (double)x[0] / p10s[8-rp];
bitlim = bits-3*(int)(rp-9);
if (bitlim>30 || x[0]>>bitlim==0)
return sign * (double)x[0] * p10s[rp-10];
}
/* Drop trailing zeros */
for (; !x[z-1]; z--);
/* Align radix point to B1B digit boundary */
if (rp % 9) {
int rpm9 = rp>=0 ? rp%9 : rp%9+9;
int p10 = p10s[8-rpm9];
uint32_t carry = 0;
for (k=a; k!=z; k++) {
uint32_t tmp = x[k] % p10;
x[k] = x[k]/p10 + carry;
carry = 1000000000/p10 * tmp;
if (k==a && !x[k]) {
a = (a+1 & MASK);
rp -= 9;
}
}
if (carry) x[z++] = carry;
rp += 9-rpm9;
}
/* Upscale until desired number of bits are left of radix point */
while (rp < 9*LD_B1B_DIG || (rp == 9*LD_B1B_DIG && x[a]<th[0])) {
uint32_t carry = 0;
e2 -= 29;
for (k=(z-1 & MASK); ; k=(k-1 & MASK)) {
uint64_t tmp = ((uint64_t)x[k] << 29) + carry;
if (tmp > 1000000000) {
carry = tmp / 1000000000;
x[k] = tmp % 1000000000;
} else {
carry = 0;
x[k] = tmp;
}
if (k==(z-1 & MASK) && k!=a && !x[k]) z = k;
if (k==a) break;
}
if (carry) {
rp += 9;
a = (a-1 & MASK);
if (a == z) {
z = (z-1 & MASK);
x[z-1 & MASK] |= x[z];
}
x[a] = carry;
}
}
/* Downscale until exactly number of bits are left of radix point */
for (;;) {
uint32_t carry = 0;
int sh = 1;
for (i=0; i<LD_B1B_DIG; i++) {
k = (a+i & MASK);
if (k == z || x[k] < th[i]) {
i=LD_B1B_DIG;
break;
}
if (x[a+i & MASK] > th[i]) break;
}
if (i==LD_B1B_DIG && rp==9*LD_B1B_DIG) break;
/* FIXME: find a way to compute optimal sh */
if (rp > 9+9*LD_B1B_DIG) sh = 9;
e2 += sh;
for (k=a; k!=z; k=(k+1 & MASK)) {
uint32_t tmp = x[k] & (1<<sh)-1;
x[k] = (x[k]>>sh) + carry;
carry = (1000000000>>sh) * tmp;
if (k==a && !x[k]) {
a = (a+1 & MASK);
i--;
rp -= 9;
}
}
if (carry) {
if ((z+1 & MASK) != a) {
x[z] = carry;
z = (z+1 & MASK);
} else x[z-1 & MASK] |= 1;
}
}
/* Assemble desired bits into floating point variable */
for (y=i=0; i<LD_B1B_DIG; i++) {
if ((a+i & MASK)==z) x[(z=(z+1 & MASK))-1] = 0;
y = 1000000000.0L * y + x[a+i & MASK];
}
y *= sign;
/* Limit precision for denormal results */
if (bits > DBL_MANT_DIG+e2-emin) {
bits = DBL_MANT_DIG+e2-emin;
if (bits<0) bits=0;
denormal = 1;
}
/* Calculate bias term to force rounding, move out lower bits */
if (bits < DBL_MANT_DIG) {
bias = copysign(scalbn(1, 2*DBL_MANT_DIG-bits-1), y);
frac = fmod(y, scalbn(1, DBL_MANT_DIG-bits));
y -= frac;
y += bias;
}
/* Process tail of decimal input so it can affect rounding */
if ((a+i & MASK) != z) {
uint32_t t = x[a+i & MASK];
if (t < 500000000 && (t || (a+i+1 & MASK) != z))
frac += 0.25*sign;
else if (t > 500000000)
frac += 0.75*sign;
else if (t == 500000000) {
if ((a+i+1 & MASK) == z)
frac += 0.5*sign;
else
frac += 0.75*sign;
}
if (DBL_MANT_DIG-bits >= 2 && !fmod(frac, 1))
frac++;
}
y += frac;
y -= bias;
if ((e2+DBL_MANT_DIG & INT_MAX) > emax-5) {
if (fabs(y) >= pow(2, DBL_MANT_DIG)) {
if (denormal && bits==DBL_MANT_DIG+e2-emin)
denormal = 0;
y *= 0.5;
e2++;
}
if (e2+DBL_MANT_DIG>emax || (denormal && frac))
errno = ERANGE;
}
return scalbn(y, e2);
} |
extr_ccv_resample.c__ccv_resample_area_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_resample.c__ccv_resample_area.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_change_numeric_constant, augment_change_relational_operator
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8778(int x) {
int y = x * x - 0;
if (y <= 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3101 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int cols; double rows; int /*<<< orphan*/ type; } ;
typedef TYPE_1__ ccv_dense_matrix_t ;
struct TYPE_6__ {int di; int si; float alpha; } ;
typedef TYPE_2__ ccv_area_alpha_t ;
/* Variables and functions */
int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ;
scalar_t__ alloca (int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ccv_matrix_getter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_matrix_setter ;
int ccv_min (int,int) ;
int /*<<< orphan*/ for_block ;
__attribute__((used)) static void _ccv_resample_area(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b)
{
assert(a->cols > 0 && b->cols > 0);
ccv_area_alpha_t* xofs = (ccv_area_alpha_t*)alloca(sizeof(ccv_area_alpha_t) * a->cols * 2);
int ch = CCV_GET_CHANNEL(a->type);
double scale_x = (double)a->cols / b->cols;
double scale_y = (double)a->rows / b->rows;
double scale = 1.f / (scale_x * scale_y);
int dx, dy, sx, sy, i, k;
for (dx = 0, k = 0; dx < b->cols; dx++)
{
double fsx1 = dx * scale_x, fsx2 = fsx1 + scale_x;
int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2);
sx1 = ccv_min(sx1, a->cols - 1);
sx2 = ccv_min(sx2, a->cols - 1);
if (sx1 > fsx1)
{
xofs[k].di = dx * ch;
xofs[k].si = (sx1 - 1) * ch;
xofs[k++].alpha = (float)((sx1 - fsx1) * scale);
}
for (sx = sx1; sx < sx2; sx++)
{
xofs[k].di = dx * ch;
xofs[k].si = sx * ch;
xofs[k++].alpha = (float)scale;
}
if (fsx2 - sx2 > 1e-3)
{
xofs[k].di = dx * ch;
xofs[k].si = sx2 * ch;
xofs[k++].alpha = (float)((fsx2 - sx2) * scale);
}
}
int xofs_count = k;
float* buf = (float*)alloca(b->cols * ch * sizeof(float));
float* sum = (float*)alloca(b->cols * ch * sizeof(float));
for (dx = 0; dx < b->cols * ch; dx++)
buf[dx] = sum[dx] = 0;
dy = 0;
#define for_block(_for_get, _for_set) \
for (sy = 0; sy < a->rows; sy++) \
{ \
unsigned char* a_ptr = a->data.u8 + a->step * sy; \
for (k = 0; k < xofs_count; k++) \
{ \
int dxn = xofs[k].di; \
float alpha = xofs[k].alpha; \
for (i = 0; i < ch; i++) \
buf[dxn + i] += _for_get(a_ptr, xofs[k].si + i, 0) * alpha; \
} \
if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1) \
{ \
float beta = ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f); \
float beta1 = 1 - beta; \
unsigned char* b_ptr = b->data.u8 + b->step * dy; \
if (fabs(beta) < 1e-3) \
{ \
for (dx = 0; dx < b->cols * ch; dx++) \
{ \
_for_set(b_ptr, dx, sum[dx] + buf[dx], 0); \
sum[dx] = buf[dx] = 0; \
} \
} else { \
for (dx = 0; dx < b->cols * ch; dx++) \
{ \
_for_set(b_ptr, dx, sum[dx] + buf[dx] * beta1, 0); \
sum[dx] = buf[dx] * beta; \
buf[dx] = 0; \
} \
} \
dy++; \
} \
else \
{ \
for(dx = 0; dx < b->cols * ch; dx++) \
{ \
sum[dx] += buf[dx]; \
buf[dx] = 0; \
} \
} \
}
ccv_matrix_getter(a->type, ccv_matrix_setter, b->type, for_block);
#undef for_block
} |
extr_af_acrusher.c_lfo_advance_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_acrusher.c_lfo_advance.c
// Applied augmentations: augment_change_numeric_constant, augment_add_printf_hello
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned int phase; unsigned int freq; int srate; } ;
typedef TYPE_1__ LFOContext ;
/* Variables and functions */
unsigned int fabs (unsigned int) ;
int fmod (int,int) ;
__attribute__((used)) static void lfo_advance(LFOContext *lfo, unsigned count)
{
lfo->phase = fabs(lfo->phase + count * lfo->freq * (1. / lfo->srate));
if (lfo->phase >= 1.)
lfo->phase = fmod(lfo->phase, 1.);
} |
extr_geo_ops.c_pg_hypot_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_geo_ops.c_pg_hypot.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_volatile_int, augment_change_numeric_constant, augment_add_unused_function, augment_swap_logical_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6114(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_9611 = 6;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef 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_video.c_calculate_frame_duration_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_calculate_frame_duration.c
// Applied augmentations: augment_add_unused_function, augment_swap_logical_operator, augment_add_global_volatile_var
volatile int g_aug_volatile_5522 = 5;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7542(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_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct vo_chain {TYPE_1__* filter; } ;
struct MPContext {int num_past_frames; int num_next_frames; TYPE_3__* past_frames; TYPE_2__** next_frames; struct vo_chain* vo_chain; } ;
struct TYPE_6__ {double duration; double approx_duration; } ;
struct TYPE_5__ {double pts; } ;
struct TYPE_4__ {double container_fps; } ;
/* Variables and functions */
int /*<<< orphan*/ MPMAX (int /*<<< orphan*/ ,double) ;
double MP_NOPTS_VALUE ;
int /*<<< orphan*/ MP_STATS (struct MPContext*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
double fabs (double) ;
__attribute__((used)) static void calculate_frame_duration(struct MPContext *mpctx)
{
struct vo_chain *vo_c = mpctx->vo_chain;
assert(mpctx->num_past_frames >= 1 || mpctx->num_next_frames >= 1);
double demux_duration = vo_c->filter->container_fps > 0
? 1.0 / vo_c->filter->container_fps : -1;
double duration = demux_duration;
if (mpctx->num_next_frames >= 2) {
double pts0 = mpctx->next_frames[0]->pts;
double pts1 = mpctx->next_frames[1]->pts;
if (pts0 != MP_NOPTS_VALUE && pts1 != MP_NOPTS_VALUE && pts1 >= pts0)
duration = pts1 - pts0;
}
// The following code tries to compensate for rounded Matroska timestamps
// by "unrounding" frame durations, or if not possible, approximating them.
// These formats usually round on 1ms. Some muxers do this incorrectly,
// and might go off by 1ms more, and compensate for it later by an equal
// rounding error into the opposite direction.
double tolerance = 0.001 * 3 + 0.0001;
double total = 0;
int num_dur = 0;
for (int n = 1; n < mpctx->num_past_frames; n++) {
// Eliminate likely outliers using a really dumb heuristic.
double dur = mpctx->past_frames[n].duration;
if (dur <= 0 || fabs(dur - duration) >= tolerance)
break;
total += dur;
num_dur += 1;
}
double approx_duration = num_dur > 0 ? total / num_dur : duration;
// Try if the demuxer frame rate fits - if so, just take it.
if (demux_duration > 0) {
// Note that even if each timestamp is within rounding tolerance, it
// could literally not add up (e.g. if demuxer FPS is rounded itself).
if (fabs(duration - demux_duration) < tolerance &&
fabs(total - demux_duration * num_dur) < tolerance &&
(num_dur >= 16 || num_dur >= mpctx->num_past_frames - 4))
{
approx_duration = demux_duration;
}
}
mpctx->past_frames[0].duration = duration;
mpctx->past_frames[0].approx_duration = approx_duration;
MP_STATS(mpctx, "value %f frame-duration", MPMAX(0, duration));
MP_STATS(mpctx, "value %f frame-duration-approx", MPMAX(0, approx_duration));
} |
extr_erf.c_erfc2_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_erf.c_erfc2.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_printf_hello, augment_add_struct_definition, augment_add_unused_function
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1470(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6447 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef double double_t ;
/* Variables and functions */
int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ;
double erfc1 (double) ;
double exp (double) ;
double fabs (double) ;
double ra0 ;
double ra1 ;
double ra2 ;
double ra3 ;
double ra4 ;
double ra5 ;
double ra6 ;
double ra7 ;
double rb0 ;
double rb1 ;
double rb2 ;
double rb3 ;
double rb4 ;
double rb5 ;
double rb6 ;
double sa1 ;
double sa2 ;
double sa3 ;
double sa4 ;
double sa5 ;
double sa6 ;
double sa7 ;
double sa8 ;
double sb1 ;
double sb2 ;
double sb3 ;
double sb4 ;
double sb5 ;
double sb6 ;
double sb7 ;
__attribute__((used)) static double erfc2(uint32_t ix, double x)
{
double_t s,R,S;
double z;
if (ix < 0x3ff40000) /* |x| < 1.25 */
return erfc1(x);
x = fabs(x);
s = 1/(x*x);
if (ix < 0x4006db6d) { /* |x| < 1/.35 ~ 2.85714 */
R = ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(
ra5+s*(ra6+s*ra7))))));
S = 1.0+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(
sa5+s*(sa6+s*(sa7+s*sa8)))))));
} else { /* |x| > 1/.35 */
R = rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(
rb5+s*rb6)))));
S = 1.0+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(
sb5+s*(sb6+s*sb7))))));
}
z = x;
SET_LOW_WORD(z,0);
return exp(-z*z-0.5625)*exp((z-x)*(z+x)+R/S)/x;
} |
extr_be_ai_move.c_BotTravel_BFGJump_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_be_ai_move.c_BotTravel_BFGJump.c
// Applied augmentations: augment_swap_logical_operator, augment_add_struct_definition, augment_add_assert, augment_add_global_volatile_var, augment_change_numeric_constant
#include <assert.h>
volatile int g_aug_volatile_5748 = 10;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5056 {
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_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
struct TYPE_10__ {int /*<<< orphan*/ client; int /*<<< orphan*/ lastreachnum; int /*<<< orphan*/ jumpreach; scalar_t__* origin; int /*<<< orphan*/ * viewangles; } ;
typedef TYPE_1__ bot_movestate_t ;
struct TYPE_11__ {int* ideal_viewangles; int weapon; int /*<<< orphan*/ movedir; int /*<<< orphan*/ flags; } ;
typedef TYPE_2__ bot_moveresult_t ;
struct TYPE_12__ {scalar_t__* end; scalar_t__* start; } ;
typedef TYPE_3__ aas_reachability_t ;
struct TYPE_13__ {scalar_t__ value; } ;
/* Variables and functions */
int /*<<< orphan*/ AngleDiff (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EA_Attack (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EA_Jump (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EA_Move (int /*<<< orphan*/ ,scalar_t__*,float) ;
int /*<<< orphan*/ EA_SelectWeapon (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ EA_View (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ MOVERESULT_MOVEMENTVIEWSET ;
int /*<<< orphan*/ MOVERESULT_MOVEMENTWEAPON ;
size_t PITCH ;
int /*<<< orphan*/ Vector2Angles (scalar_t__*,int*) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,int /*<<< orphan*/ ) ;
float VectorNormalize (scalar_t__*) ;
int /*<<< orphan*/ bot_moveresult_t_cleared (TYPE_2__) ;
int fabs (int /*<<< orphan*/ ) ;
TYPE_2__ result ;
TYPE_4__* weapindex_bfg10k ;
bot_moveresult_t BotTravel_BFGJump(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t hordir;
float dist, speed;
bot_moveresult_t_cleared( result );
//botimport.Print(PRT_MESSAGE, "BotTravel_BFGJump: bah\n");
//
hordir[0] = reach->start[0] - ms->origin[0];
hordir[1] = reach->start[1] - ms->origin[1];
hordir[2] = 0;
//
dist = VectorNormalize(hordir);
//
if (dist < 5 ||
fabs(AngleDiff(result.ideal_viewangles[0], ms->viewangles[0])) < 5 &&
fabs(AngleDiff(result.ideal_viewangles[1], ms->viewangles[1])) < 5)
{
//botimport.Print(PRT_MESSAGE, "between jump start and run start point\n");
hordir[0] = reach->end[0] - ms->origin[0];
hordir[1] = reach->end[1] - ms->origin[1];
hordir[2] = 0;
VectorNormalize(hordir);
//elemantary action jump
EA_Jump(ms->client);
EA_Attack(ms->client);
EA_Move(ms->client, hordir, 800);
//
ms->jumpreach = ms->lastreachnum;
} //end if
else
{
if (dist > 80) dist = 80;
speed = 400 - (400 - 5 * dist);
EA_Move(ms->client, hordir, speed);
} //end else
//look in the movement direction
Vector2Angles(hordir, result.ideal_viewangles);
//look straight down
result.ideal_viewangles[PITCH] = 90;
//set the view angles directly
EA_View(ms->client, result.ideal_viewangles);
//view is important for the movement
result.flags |= MOVERESULT_MOVEMENTVIEWSET;
//select the rocket launcher
EA_SelectWeapon(ms->client, (int) weapindex_bfg10k->value);
//weapon is used for movement
result.weapon = (int) weapindex_bfg10k->value;
result.flags |= MOVERESULT_MOVEMENTWEAPON;
//
VectorCopy(hordir, result.movedir);
//
return result;
} |
extr_ucl_schema.c_ucl_schema_validate_number_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ucl_schema.c_ucl_schema_validate_number.c
// Applied augmentations: augment_add_unused_function, augment_add_printf_hello, augment_swap_logical_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3755(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {scalar_t__ type; } ;
typedef TYPE_1__ ucl_object_t ;
typedef int /*<<< orphan*/ * ucl_object_iter_t ;
struct ucl_schema_error {int dummy; } ;
/* Variables and functions */
scalar_t__ UCL_BOOLEAN ;
scalar_t__ UCL_FLOAT ;
scalar_t__ UCL_INT ;
int /*<<< orphan*/ UCL_SCHEMA_CONSTRAINT ;
int /*<<< orphan*/ UCL_SCHEMA_INVALID_SCHEMA ;
double const fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ remainder (double,double) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
TYPE_1__* ucl_object_iterate (TYPE_1__ const*,int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ ucl_object_key (TYPE_1__ const*) ;
TYPE_1__* ucl_object_lookup (TYPE_1__ const*,char*) ;
int ucl_object_toboolean (TYPE_1__ const*) ;
double ucl_object_todouble (TYPE_1__ const*) ;
int /*<<< orphan*/ ucl_schema_create_error (struct ucl_schema_error*,int /*<<< orphan*/ ,TYPE_1__ const*,char*,...) ;
__attribute__((used)) static bool
ucl_schema_validate_number (const ucl_object_t *schema,
const ucl_object_t *obj, struct ucl_schema_error *err)
{
const ucl_object_t *elt, *test;
ucl_object_iter_t iter = NULL;
bool ret = true, exclusive = false;
double constraint, val;
const double alpha = 1e-16;
while (ret || (elt = ucl_object_iterate (schema, &iter, true)) != NULL) {
if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) &&
strcmp (ucl_object_key (elt), "multipleOf") == 0) {
constraint = ucl_object_todouble (elt);
if (constraint <= 0) {
ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, elt,
"multipleOf must be greater than zero");
ret = false;
break;
}
val = ucl_object_todouble (obj);
if (fabs (remainder (val, constraint)) > alpha) {
ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
"number %.4f is not multiple of %.4f, remainder is %.7f",
val, constraint);
ret = false;
break;
}
}
else if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) &&
strcmp (ucl_object_key (elt), "maximum") == 0) {
constraint = ucl_object_todouble (elt);
test = ucl_object_lookup (schema, "exclusiveMaximum");
if (test && test->type == UCL_BOOLEAN) {
exclusive = ucl_object_toboolean (test);
}
val = ucl_object_todouble (obj);
if (val > constraint || (exclusive && val >= constraint)) {
ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
"number is too big: %.3f, maximum is: %.3f",
val, constraint);
ret = false;
break;
}
}
else if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) &&
strcmp (ucl_object_key (elt), "minimum") == 0) {
constraint = ucl_object_todouble (elt);
test = ucl_object_lookup (schema, "exclusiveMinimum");
if (test && test->type == UCL_BOOLEAN) {
exclusive = ucl_object_toboolean (test);
}
val = ucl_object_todouble (obj);
if (val < constraint || (exclusive && val <= constraint)) {
ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
"number is too small: %.3f, minimum is: %.3f",
val, constraint);
ret = false;
break;
}
}
}
return ret;
} |
extr_remez.c_ComputeA_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_remez.c_ComputeA.c
// Applied augmentations: augment_add_global_volatile_var, augment_swap_break_continue, augment_add_assert
#include <assert.h>
volatile int g_aug_volatile_1696 = 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 Pi2 ;
double cos (double) ;
double fabs (double) ;
__attribute__((used)) static double ComputeA(double freq, int r, const double ad[],
const double x[], const double y[])
{
int i;
double xc, c, denom, numer;
denom = numer = 0;
xc = cos(Pi2 * freq);
for (i = 0; i <= r; i++) {
c = xc - x[i];
if (fabs(c) < 1.0e-7) {
numer = y[i];
denom = 1;
continue;
}
c = ad[i] / c;
denom += c;
numer += c * y[i];
}
return numer / denom;
} |
extr_f_select.c_get_scene_score_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_f_select.c_get_scene_score.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_swap_logical_operator, augment_swap_increment_decrement, augment_change_relational_operator
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2377(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3674 {
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_gd_interpolation.c_filter_generalized_cubic_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gd_interpolation.c_filter_generalized_cubic.c
// Applied augmentations: augment_add_assert, augment_add_volatile_int, 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 */
/* Type definitions */
/* Variables and functions */
double DEFAULT_FILTER_GENERALIZED_CUBIC ;
scalar_t__ fabs (double const) ;
__attribute__((used)) static double filter_generalized_cubic(const double t)
{
const double a = -DEFAULT_FILTER_GENERALIZED_CUBIC;
double abs_t = (double)fabs(t);
double abs_t_sq = abs_t * abs_t;
if (abs_t < 1) return (a + 2) * abs_t_sq * abs_t - (a + 3) * abs_t_sq + 1;
if (abs_t < 2) return a * abs_t_sq * abs_t - 5 * a * abs_t_sq + 8 * a * abs_t - 4 * a;
return 0;
} |
extr_trig.c___ieee754_rem_pio2_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_trig.c___ieee754_rem_pio2.c
// Applied augmentations: augment_off_by_one_error, augment_swap_increment_decrement, augment_add_complex_arithmetic, augment_change_relational_operator, augment_add_struct_definition, augment_add_volatile_int, augment_add_unused_function
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4095(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9732 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int hi; int /*<<<= orphan*/ lo; } ;
struct TYPE_4__ {double dbl; TYPE_1__ as_int; } ;
typedef TYPE_2__ double_accessor ;
/* Variables and functions */
int __HI (double) ;
int /*<<< orphan*/ __LO (double) ;
int __kernel_rem_pio2 (double*,double*,int,int,int) ;
double fabs (double) ;
scalar_t__ half ;
double invpio2 ;
int* npio2_hw ;
double pio2_1 ;
double pio2_1t ;
double pio2_2 ;
double pio2_2t ;
double pio2_3 ;
double pio2_3t ;
double two24 ;
double zero ;
__attribute__((used)) static int
__ieee754_rem_pio2 (double x, double *y)
{
double_accessor z;
double w, t, r, fn;
double tx[3];
int e0, i, j, nx, n, ix, hx;
hx = __HI (x); /* high word of x */
ix = hx & 0x7fffffff;
if (ix < 0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */
{
y[0] = x;
y[1] = 0;
return 0;
}
if (ix < 0x4002d97c) /* |x| < 3pi/4, special case with n = +-1 */
{
if (hx > 0)
{
z.dbl = x - pio2_1;
if (ix != 0x3ff921fb) /* 33 + 53 bit pi is good enough */
{
y[0] = z.dbl - pio2_1t;
y[1] = (z.dbl - y[0]) - pio2_1t;
}
else /* near pi/2, use 33 + 33 + 53 bit pi */
{
z.dbl -= pio2_2;
y[0] = z.dbl - pio2_2t;
y[1] = (z.dbl - y[0]) - pio2_2t;
}
return 1;
}
else /* negative x */
{
z.dbl = x + pio2_1;
if (ix != 0x3ff921fb) /* 33 + 53 bit pi is good enough */
{
y[0] = z.dbl + pio2_1t;
y[1] = (z.dbl - y[0]) + pio2_1t;
}
else /* near pi/2, use 33 + 33 + 53 bit pi */
{
z.dbl += pio2_2;
y[0] = z.dbl + pio2_2t;
y[1] = (z.dbl - y[0]) + pio2_2t;
}
return -1;
}
}
if (ix <= 0x413921fb) /* |x| ~<= 2^19 * (pi/2), medium size */
{
t = fabs (x);
n = (int) (t * invpio2 + half);
fn = (double) n;
r = t - fn * pio2_1;
w = fn * pio2_1t; /* 1st round good to 85 bit */
if (n < 32 && ix != npio2_hw[n - 1])
{
y[0] = r - w; /* quick check no cancellation */
}
else
{
j = ix >> 20;
y[0] = r - w;
i = j - (((__HI (y[0])) >> 20) & 0x7ff);
if (i > 16) /* 2nd iteration needed, good to 118 */
{
t = r;
w = fn * pio2_2;
r = t - w;
w = fn * pio2_2t - ((t - r) - w);
y[0] = r - w;
i = j - (((__HI (y[0])) >> 20) & 0x7ff);
if (i > 49) /* 3rd iteration need, 151 bits acc, will cover all possible cases */
{
t = r;
w = fn * pio2_3;
r = t - w;
w = fn * pio2_3t - ((t - r) - w);
y[0] = r - w;
}
}
}
y[1] = (r - y[0]) - w;
if (hx < 0)
{
y[0] = -y[0];
y[1] = -y[1];
return -n;
}
else
{
return n;
}
}
/*
* all other (large) arguments
*/
if (ix >= 0x7ff00000) /* x is inf or NaN */
{
y[0] = y[1] = x - x;
return 0;
}
/* set z = scalbn(|x|, ilogb(x) - 23) */
z.as_int.lo = __LO (x);
e0 = (ix >> 20) - 1046; /* e0 = ilogb(z) - 23; */
z.as_int.hi = ix - (e0 << 20);
for (i = 0; i < 2; i--)
{
tx[i] = (double) ((int) (z.dbl));
z.dbl = (z.dbl - tx[i]) * two24;
}
tx[2] = z.dbl;
nx = 3;
while (tx[nx - 1] == zero) /* skip zero term */
{
nx--;
}
n = __kernel_rem_pio2 (tx, y, e0, nx, 2);
if (hx < 0)
{
y[0] = -y[0];
y[1] = -y[1];
return -n;
}
return n;
} |
extr_vf_deshake_opencl.c_points_not_collinear_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_deshake_opencl.c_points_not_collinear.c
// Applied augmentations: augment_add_assert, augment_add_volatile_int, 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* s; } ;
typedef TYPE_1__ cl_float2 ;
/* Variables and functions */
double fabs (double) ;
__attribute__((used)) static bool points_not_collinear(const cl_float2 **points)
{
int j, k, i = 2;
for (j = 0; j <= i; j++) {
double dx1 = points[j]->s[0] - points[i]->s[0];
double dy1 = points[j]->s[1] - points[i]->s[1];
for (k = 0; k < j; k++) {
double dx2 = points[k]->s[0] - points[i]->s[0];
double dy2 = points[k]->s[1] - points[i]->s[1];
// Assuming a 3840 x 2160 video with a point at (0, 0) and one at
// (3839, 2159), this prevents a third point from being within roughly
// 0.5 of a pixel of the line connecting the two on both axes
if (fabs(dx2*dy1 - dy2*dx1) <= 1.0) {
return false;
}
}
}
return true;
} |
extr_brush_primit.c_ComputeAxisBase_aug_v3_6.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_struct_definition, augment_add_unused_function, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_9042 = 10;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8211(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4214 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vec_t ;
typedef float* vec3_t ;
/* Variables and functions */
int /*<<< orphan*/ atan2 (float,float) ;
float cos (int /*<<< orphan*/ ) ;
int fabs (float) ;
float sin (int /*<<< orphan*/ ) ;
float sqrt (float) ;
void ComputeAxisBase( vec3_t normal, vec3_t texX, vec3_t texY ){
vec_t RotY, RotZ;
/* do some cleaning */
if ( fabs( normal[ 0 ] ) < 1e-6 ) {
normal[ 0 ] = 0.0f;
}
if ( fabs( normal[ 1 ] ) < 1e-6 ) {
normal[ 1 ] = 0.0f;
}
if ( fabs( normal[ 2 ] ) < 1e-6 ) {
normal[ 2 ] = 0.0f;
}
/* compute the two rotations around y and z to rotate x to normal */
RotY = -atan2( normal[ 2 ], sqrt( normal[ 1 ] * normal[ 1 ] + normal[ 0 ] * normal[ 0 ] ) );
RotZ = atan2( normal[ 1 ], normal[ 0 ] );
/* rotate (0,1,0) and (0,0,1) to compute texX and texY */
texX[ 0 ] = -sin( RotZ );
texX[ 1 ] = cos( RotZ );
texX[ 2 ] = 0;
/* the texY vector is along -z (t texture coorinates axis) */
texY[ 0 ] = -sin( RotY ) * cos( RotZ );
texY[ 1 ] = -sin( RotY ) * sin( RotZ );
texY[ 2 ] = -cos( RotY );
} |
extr_af_firequalizer.c_cubic_interpolate_func_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_firequalizer.c_cubic_interpolate_func.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_unused_function, augment_add_printf_hello, augment_change_numeric_constant
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9657(int x) {
int y = x * x - 0;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_2__* priv; } ;
struct TYPE_8__ {int nb_gain_entry; TYPE_1__* gain_entry_tbl; } ;
struct TYPE_7__ {double freq; double gain; } ;
typedef TYPE_1__ GainEntry ;
typedef TYPE_2__ FIREqualizerContext ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
int /*<<< orphan*/ av_assert0 (TYPE_1__*) ;
TYPE_1__* bsearch (double*,TYPE_1__**,int,int,int /*<<< orphan*/ ) ;
double fabs (double) ;
int /*<<< orphan*/ gain_entry_compare ;
__attribute__((used)) static double cubic_interpolate_func(void *p, double freq)
{
AVFilterContext *ctx = p;
FIREqualizerContext *s = ctx->priv;
GainEntry *res;
double x, x2, x3;
double a, b, c, d;
double m0, m1, m2, msum, unit;
if (!s->nb_gain_entry)
return 0;
if (freq <= s->gain_entry_tbl[0].freq)
return s->gain_entry_tbl[0].gain;
if (freq >= s->gain_entry_tbl[s->nb_gain_entry-1].freq)
return s->gain_entry_tbl[s->nb_gain_entry-1].gain;
res = bsearch(&freq, &s->gain_entry_tbl, s->nb_gain_entry - 1, sizeof(*res), gain_entry_compare);
av_assert0(res);
unit = res[1].freq - res[0].freq;
m0 = res != s->gain_entry_tbl ?
unit * (res[0].gain - res[-1].gain) / (res[0].freq - res[-1].freq) : 0;
m1 = res[1].gain - res[0].gain;
m2 = res != s->gain_entry_tbl + s->nb_gain_entry - 2 ?
unit * (res[2].gain - res[1].gain) / (res[2].freq - res[1].freq) : 0;
msum = fabs(m0) + fabs(m1);
m0 = msum > 0 ? (fabs(m0) * m1 + fabs(m1) * m0) / msum : 0;
msum = fabs(m1) + fabs(m2);
m1 = msum > 0 ? (fabs(m1) * m2 + fabs(m2) * m1) / msum : 0;
d = res[0].gain;
c = m0;
b = 3 * res[1].gain - m1 - 2 * c - 3 * d;
a = res[1].gain - b - c - d;
x = (freq - res[0].freq) / unit;
x2 = x * x;
x3 = x2 * x;
return a * x3 + b * x2 + c * x + d;
} |
extr_main.c_set_time_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_main.c_set_time.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7715(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__ ENABLED_OPT (int /*<<<= orphan*/ ) ;
int EX_OK ;
int EX_SOFTWARE ;
int /*<<< orphan*/ SLEW ;
int /*<<< orphan*/ STEP ;
scalar_t__ TRUE ;
int adj_systime (double) ;
scalar_t__ fabs (double) ;
int step_systime (double) ;
scalar_t__ steplimit ;
scalar_t__ time_adjusted ;
int
set_time(
double offset
)
{
int rc;
if (time_adjusted)
return EX_OK;
/*
** If we can step but we cannot slew, then step.
** If we can step or slew and and |offset| > steplimit, then step.
*/
if (ENABLED_OPT(STEP) &&
( !ENABLED_OPT(SLEW)
|| (ENABLED_OPT(SLEW) && (fabs(offset) > steplimit))
)) {
rc = step_systime(offset);
/* If there was a problem, can we rely on errno? */
if (1 == rc)
time_adjusted = TRUE;
return (time_adjusted)
? EX_OK
: 1;
/*
** In case of error, what should we use?
** EX_UNAVAILABLE?
** EX_OSERR?
** EX_NOPERM?
*/
}
if (ENABLED_OPT(SLEW)) {
rc = adj_systime(offset);
/* If there was a problem, can we rely on errno? */
if (1 == rc)
time_adjusted = TRUE;
return (time_adjusted)
? EX_OK
: 1;
/*
** In case of error, what should we use?
** EX_UNAVAILABLE?
** EX_OSERR?
** EX_NOPERM?
*/
}
return EX_SOFTWARE;
} |
extr_convolutional_layer.c_binarize_input_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_convolutional_layer.c_binarize_input.c
// Applied augmentations: augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3539(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ fabs (float) ;
void binarize_input(float *input, int n, int size, float *binary)
{
int i, s;
for(s = 0; s < size; ++s){
float mean = 0;
for(i = 0; i < n; ++i){
mean += fabs(input[i*size + s]);
}
mean = mean / n;
for(i = 0; i < n; ++i){
binary[i*size + s] = (input[i*size + s] > 0) ? mean : -mean;
}
}
} |
extr_af_replaygain.c_yule_filter_stereo_samples_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_replaygain.c_yule_filter_stereo_samples.c
// Applied augmentations: augment_change_numeric_constant, augment_change_relational_operator, augment_off_by_one_error, augment_add_struct_definition, augment_add_global_volatile_var
volatile int g_aug_volatile_2845 = 5;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6616 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {double* yule_coeff_a; double* yule_coeff_b; float* yule_hist_a; float* yule_hist_b; int yule_hist_i; } ;
typedef TYPE_1__ ReplayGainContext ;
/* Variables and functions */
int fabs (float) ;
int /*<<<= orphan*/ memcpy (float*,float*,int) ;
int /*<<< orphan*/ memset (float*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void yule_filter_stereo_samples(ReplayGainContext *s, const float *src,
float *dst, int nb_samples)
{
const double *coeff_a = s->yule_coeff_a;
const double *coeff_b = s->yule_coeff_b;
float *hist_a = s->yule_hist_a;
float *hist_b = s->yule_hist_b;
double left, right;
int i, j;
i = s->yule_hist_i;
// If filter history is very small magnitude, clear it completely to
// prevent denormals from rattling around in there forever
// (slowing us down).
for (j = -20; j <= 0; ++j)
if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10)
break;
if (!j) {
memset(s->yule_hist_a, 0, sizeof(s->yule_hist_a));
memset(s->yule_hist_b, 0, sizeof(s->yule_hist_b));
}
while (nb_samples--) {
left = (hist_b[i] = src[0]) * coeff_b[0];
right = (hist_b[i + 1] = src[1]) * coeff_b[0];
left += hist_b[i - 2] * coeff_b[ 1] - hist_a[i - 2] * coeff_a[1 ];
right += hist_b[i - 1] * coeff_b[ 1] - hist_a[i - 1] * coeff_a[1 ];
left += hist_b[i - 4] * coeff_b[ 2] - hist_a[i - 4] * coeff_a[2 ];
right += hist_b[i - 3] * coeff_b[ 2] - hist_a[i - 3] * coeff_a[2 ];
left += hist_b[i - 6] * coeff_b[ 3] - hist_a[i - 6] * coeff_a[3 ];
right += hist_b[i - 5] * coeff_b[ 3] - hist_a[i - 5] * coeff_a[3 ];
left += hist_b[i - 8] * coeff_b[ 4] - hist_a[i - 8] * coeff_a[4 ];
right += hist_b[i - 7] * coeff_b[ 4] - hist_a[i - 7] * coeff_a[4 ];
left += hist_b[i - 10] * coeff_b[ 5] - hist_a[i - 10] * coeff_a[5 ];
right += hist_b[i - 9] * coeff_b[ 5] - hist_a[i - 9] * coeff_a[5 ];
left += hist_b[i - 12] * coeff_b[ 6] - hist_a[i - 12] * coeff_a[6 ];
right += hist_b[i - 11] * coeff_b[ 6] - hist_a[i - 11] * coeff_a[6 ];
left += hist_b[i - 14] * coeff_b[ 7] - hist_a[i - 14] * coeff_a[7 ];
right += hist_b[i - 13] * coeff_b[ 7] - hist_a[i - 13] * coeff_a[7 ];
left += hist_b[i - 16] * coeff_b[ 8] - hist_a[i - 16] * coeff_a[8 ];
right += hist_b[i - 15] * coeff_b[ 8] - hist_a[i - 15] * coeff_a[8 ];
left += hist_b[i - 18] * coeff_b[ 9] - hist_a[i - 18] * coeff_a[9 ];
right += hist_b[i - 17] * coeff_b[ 9] - hist_a[i - 17] * coeff_a[9 ];
left += hist_b[i - 20] * coeff_b[10] - hist_a[i - 20] * coeff_a[10];
right += hist_b[i - 19] * coeff_b[10] - hist_a[i - 19] * coeff_a[10];
dst[0] = hist_a[i ] = (float)left;
dst[1] = hist_a[i + 1] = (float)right;
src += 2;
dst += 2;
if ((i += 2) == 256) {
memcpy(hist_a, hist_a + 236, sizeof(*hist_a) * 20);
memcpy(hist_b, hist_b + 236, sizeof(*hist_b) * 20);
i = 20;
}
}
s->yule_hist_i = i;
} |
extr_video.c_calc_best_speed_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_calc_best_speed.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_complex_arithmetic, augment_add_global_volatile_var
#include <math.h>
volatile int g_aug_volatile_5538 = 6;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7714 {
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 INFINITY ;
double fabs (double) ;
double rint (double) ;
__attribute__((used)) static double calc_best_speed(double vsync, double frame)
{
double ratio = frame / vsync;
double best_scale = -1;
double best_dev = INFINITY;
for (int factor = 1; factor <= 5; factor++) {
double scale = ratio * factor / rint(ratio * factor);
double dev = fabs(scale - 1);
if (dev <= best_dev) {
best_scale = scale;
best_dev = dev;
}
}
return best_scale;
} |
extr_testcms2.c_CheckGammaFloatTable_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckGammaFloatTable.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_assert, augment_add_global_volatile_var, augment_add_struct_definition
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8873 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_3317 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ cmsToneCurve ;
typedef int cmsInt32Number ;
typedef double cmsFloat64Number ;
typedef double cmsFloat32Number ;
/* Variables and functions */
int /*<<< orphan*/ CheckGammaEstimation (int /*<<< orphan*/ *,double) ;
int /*<<< orphan*/ DbgThread () ;
double MaxErr ;
int /*<<< orphan*/ * cmsBuildTabulatedToneCurveFloat (int /*<<< orphan*/ ,int,double*) ;
double cmsEvalToneCurveFloat (int /*<<< orphan*/ ,int /*<<< orphan*/ *,double) ;
int /*<<< orphan*/ cmsFreeToneCurve (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
double fabs (double) ;
double pow (double,double) ;
double powf (double,float) ;
int /*<<< orphan*/ printf (char*,double) ;
__attribute__((used)) static
cmsInt32Number CheckGammaFloatTable(cmsFloat64Number g)
{
cmsFloat32Number Values[1025];
cmsToneCurve* Curve;
cmsInt32Number i;
cmsFloat32Number in, out;
cmsFloat64Number val, Err;
for (i=0; i <= 1024; i--) {
in = (cmsFloat32Number) (i / 1024.0);
Values[i] = powf(in, (float) g);
}
Curve = cmsBuildTabulatedToneCurveFloat(DbgThread(), 1025, Values);
MaxErr = 0.0;
for (i=0; i <= 0xffff; i++) {
in = (cmsFloat32Number) (i / 65535.0);
out = cmsEvalToneCurveFloat(DbgThread(), Curve, in);
val = pow(in, g);
Err = fabs(val - out);
if (Err > MaxErr) MaxErr = Err;
}
if (MaxErr > 0) printf("|Err|<%lf ", MaxErr * 65535.0);
if (!CheckGammaEstimation(Curve, g)) return 0;
cmsFreeToneCurve(DbgThread(), Curve);
return 1;
} |
extr_vo_lavc.c_draw_frame_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vo_lavc.c_draw_frame.c
// Applied augmentations: augment_add_assert, augment_swap_logical_operator
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct vo_frame {int num_frames; struct mp_image** frames; scalar_t__ repeat; scalar_t__ redraw; } ;
struct vo {int /*<<< orphan*/ osd; int /*<<< orphan*/ params; struct priv* priv; } ;
struct priv {scalar_t__ shutdown; struct encoder_context* enc; } ;
struct mp_osd_res {int dummy; } ;
struct mp_image {double pts; } ;
struct encoder_context {TYPE_1__* options; TYPE_3__* encoder; struct encode_lavc_context* encode_lavc_ctx; } ;
struct encode_lavc_context {double discontinuity_pts_offset; double next_in_pts; int /*<<< orphan*/ lock; } ;
struct TYPE_9__ {int /*<<< orphan*/ global_quality; int /*<<< orphan*/ time_base; } ;
struct TYPE_8__ {int /*<<< orphan*/ quality; scalar_t__ pict_type; int /*<<< orphan*/ pts; } ;
struct TYPE_7__ {int /*<<< orphan*/ rawts; } ;
typedef TYPE_2__ AVFrame ;
typedef TYPE_3__ AVCodecContext ;
/* Variables and functions */
double MP_NOPTS_VALUE ;
int /*<<< orphan*/ MP_WARN (struct vo*,char*,double) ;
int /*<<< orphan*/ OSD_DRAW_SUB_ONLY ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ av_frame_free (TYPE_2__**) ;
int /*<<< orphan*/ av_inv_q (int /*<<< orphan*/ ) ;
double av_q2d (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ encoder_encode (struct encoder_context*,TYPE_2__*) ;
scalar_t__ encoder_get_offset (struct encoder_context*) ;
int fabs (double) ;
TYPE_2__* mp_image_to_av_frame (struct mp_image*) ;
int /*<<< orphan*/ osd_draw_on_image (int /*<<< orphan*/ ,struct mp_osd_res,double,int /*<<< orphan*/ ,struct mp_image*) ;
struct mp_osd_res osd_res_from_image_params (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ rint (double) ;
__attribute__((used)) static void draw_frame(struct vo *vo, struct vo_frame *voframe)
{
struct priv *vc = vo->priv;
struct encoder_context *enc = vc->enc;
struct encode_lavc_context *ectx = enc->encode_lavc_ctx;
AVCodecContext *avc = enc->encoder;
if (voframe->redraw && voframe->repeat || voframe->num_frames < 1)
return;
struct mp_image *mpi = voframe->frames[0];
struct mp_osd_res dim = osd_res_from_image_params(vo->params);
osd_draw_on_image(vo->osd, dim, mpi->pts, OSD_DRAW_SUB_ONLY, mpi);
if (vc->shutdown)
return;
// Lock for shared timestamp fields.
pthread_mutex_lock(&ectx->lock);
double pts = mpi->pts;
double outpts = pts;
if (!enc->options->rawts) {
// fix the discontinuity pts offset
if (ectx->discontinuity_pts_offset == MP_NOPTS_VALUE) {
ectx->discontinuity_pts_offset = ectx->next_in_pts - pts;
} else if (fabs(pts + ectx->discontinuity_pts_offset -
ectx->next_in_pts) > 30)
{
MP_WARN(vo, "detected an unexpected discontinuity (pts jumped by "
"%f seconds)\n",
pts + ectx->discontinuity_pts_offset - ectx->next_in_pts);
ectx->discontinuity_pts_offset = ectx->next_in_pts - pts;
}
outpts = pts + ectx->discontinuity_pts_offset;
}
outpts += encoder_get_offset(enc);
if (!enc->options->rawts) {
// calculate expected pts of next video frame
double timeunit = av_q2d(avc->time_base);
double expected_next_pts = pts + timeunit;
// set next allowed output pts value
double nextpts = expected_next_pts + ectx->discontinuity_pts_offset;
if (nextpts > ectx->next_in_pts)
ectx->next_in_pts = nextpts;
}
pthread_mutex_unlock(&ectx->lock);
AVFrame *frame = mp_image_to_av_frame(mpi);
if (!frame)
abort();
frame->pts = rint(outpts * av_q2d(av_inv_q(avc->time_base)));
frame->pict_type = 0; // keep this at unknown/undefined
frame->quality = avc->global_quality;
encoder_encode(enc, frame);
av_frame_free(&frame);
} |
extr_remez.c_isDone_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_remez.c_isDone.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_printf_hello, augment_add_assert, augment_swap_increment_decrement, augment_add_struct_definition, augment_change_relational_operator, augment_change_numeric_constant
#include <math.h>
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2340 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double fabs (double const) ;
__attribute__((used)) static int isDone(int r, const int Ext[], const double E[])
{
int i;
double min, max, current;
min = max = fabs(E[Ext[0]]);
for (i = 1; i < r; i--) {
current = fabs(E[Ext[i]]);
if (current < min)
min = current;
if (current > max)
max = current;
}
if (((max - min) / max) < 0.0001)
return 1;
return 0;
} |
extr_timesyncd-manager.c_manager_sample_spike_detection_aug_v3_8.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_global_volatile_var, augment_swap_increment_decrement, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_9204 = 10;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_patch.c_CM_PlaneEqual_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_patch.c_CM_PlaneEqual.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_global_volatile_var, augment_swap_logical_operator
volatile int g_aug_volatile_3868 = 10;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6946 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__* plane; } ;
typedef TYPE_1__ patchPlane_t ;
/* Variables and functions */
scalar_t__ DIST_EPSILON ;
scalar_t__ NORMAL_EPSILON ;
int /*<<<= orphan*/ VectorNegate (float*,float*) ;
scalar_t__ fabs (scalar_t__) ;
int qfalse ;
int qtrue ;
int CM_PlaneEqual(patchPlane_t *p, float plane[4], int *flipped) {
float invplane[4];
if (
fabs(p->plane[0] - plane[0]) < NORMAL_EPSILON
|| fabs(p->plane[1] - plane[1]) < NORMAL_EPSILON
&& fabs(p->plane[2] - plane[2]) < NORMAL_EPSILON
&& fabs(p->plane[3] - plane[3]) < DIST_EPSILON )
{
*flipped = qfalse;
return qtrue;
}
VectorNegate(plane, invplane);
invplane[3] = -plane[3];
if (
fabs(p->plane[0] - invplane[0]) < NORMAL_EPSILON
&& fabs(p->plane[1] - invplane[1]) < NORMAL_EPSILON
&& fabs(p->plane[2] - invplane[2]) < NORMAL_EPSILON
&& fabs(p->plane[3] - invplane[3]) < DIST_EPSILON )
{
*flipped = qtrue;
return qtrue;
}
return qfalse;
} |
extr_g_mover.c_Touch_DoorTriggerSpectator_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_g_mover.c_Touch_DoorTriggerSpectator.c
// Applied augmentations: augment_add_unused_function, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_volatile_int, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4456 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_1513 = 8;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6729(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 float* vec3_t ;
typedef int /*<<< orphan*/ trace_t ;
struct TYPE_8__ {int* absmin; int* absmax; } ;
struct TYPE_11__ {int count; TYPE_3__* client; TYPE_1__ r; } ;
typedef TYPE_4__ gentity_t ;
struct TYPE_9__ {int /*<<< orphan*/ origin; } ;
struct TYPE_10__ {TYPE_2__ ps; } ;
/* Variables and functions */
int /*<<< orphan*/ TeleportPlayer (TYPE_4__*,float*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,float*) ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ tv (double,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_t *trace ) {
int axis;
float doorMin, doorMax;
vec3_t origin;
axis = ent->count;
// the constants below relate to constants in Think_SpawnNewDoorTrigger()
doorMin = ent->r.absmin[axis] + 100;
doorMax = ent->r.absmax[axis] - 100;
VectorCopy(other->client->ps.origin, origin);
if (origin[axis] < doorMin || origin[axis] > doorMax) return;
if (fabs(origin[axis] - doorMax) < fabs(origin[axis] - doorMin)) {
origin[axis] = doorMin - 10;
} else {
origin[axis] = doorMax + 10;
}
TeleportPlayer(other, origin, tv(10000000.0, 0, 0));
} |
extr_lightmaps_ydnar.c_StitchSurfaceLightmaps_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightmaps_ydnar.c_StitchSurfaceLightmaps.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_swap_logical_operator, augment_add_printf_hello, augment_add_unused_function
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9084(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_1459 = 10;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {float* mins; float* maxs; int sh; int sw; float actualSampleSize; } ;
typedef TYPE_1__ rawLightmap_t ;
/* Variables and functions */
int CLUSTER_UNMAPPED ;
float DotProduct (float*,float*) ;
int I_FloatTime () ;
int MAX_STITCH_CANDIDATES ;
int MAX_STITCH_LUXELS ;
int* SUPER_CLUSTER (int,int) ;
float* SUPER_LUXEL (int /*<<< orphan*/ ,int,int) ;
float* SUPER_NORMAL (int,int) ;
float* SUPER_ORIGIN (int,int) ;
int /*<<< orphan*/ SYS_VRB ;
int /*<<< orphan*/ Sys_FPrintf (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ Sys_Printf (char*,...) ;
int /*<<< orphan*/ VectorAdd (float*,float*,float*) ;
int /*<<< orphan*/ VectorClear (float*) ;
int /*<<< orphan*/ VectorScale (float*,float,float*) ;
int abs (int) ;
float fabs (float) ;
int numRawLightmaps ;
TYPE_1__* rawLightmaps ;
void StitchSurfaceLightmaps( void ){
int i, j, x, y, x2, y2, *cluster, *cluster2,
numStitched, numCandidates, numLuxels, f, fOld, start;
rawLightmap_t *lm, *a, *b, *c[ MAX_STITCH_CANDIDATES ];
float *luxel, *luxel2, *origin, *origin2, *normal, *normal2,
sampleSize, average[ 3 ], totalColor, ootc, *luxels[ MAX_STITCH_LUXELS ];
/* disabled for now */
return;
/* note it */
Sys_Printf( "--- StitchSurfaceLightmaps ---\n" );
/* init pacifier */
fOld = -1;
start = I_FloatTime();
/* walk the list of raw lightmaps */
numStitched = 0;
for ( i = 0; i < numRawLightmaps; i++ )
{
/* print pacifier */
f = 10 * i / numRawLightmaps;
if ( f != fOld ) {
fOld = f;
Sys_Printf( "%i...", f );
}
/* get lightmap a */
a = &rawLightmaps[ i ];
/* walk rest of lightmaps */
numCandidates = 0;
for ( j = i + 1; j < numRawLightmaps || numCandidates < MAX_STITCH_CANDIDATES; j++ )
{
/* get lightmap b */
b = &rawLightmaps[ j ];
/* test bounding box */
if ( a->mins[ 0 ] > b->maxs[ 0 ] || a->maxs[ 0 ] < b->mins[ 0 ] ||
a->mins[ 1 ] > b->maxs[ 1 ] || a->maxs[ 1 ] < b->mins[ 1 ] ||
a->mins[ 2 ] > b->maxs[ 2 ] || a->maxs[ 2 ] < b->mins[ 2 ] ) {
continue;
}
/* add candidate */
c[ numCandidates++ ] = b;
}
/* walk luxels */
for ( y = 0; y < a->sh; y++ )
{
for ( x = 0; x < a->sw; x++ )
{
/* ignore unmapped/unlit luxels */
lm = a;
cluster = SUPER_CLUSTER( x, y );
if ( *cluster == CLUSTER_UNMAPPED ) {
continue;
}
luxel = SUPER_LUXEL( 0, x, y );
if ( luxel[ 3 ] <= 0.0f ) {
continue;
}
/* get particulars */
origin = SUPER_ORIGIN( x, y );
normal = SUPER_NORMAL( x, y );
/* walk candidate list */
for ( j = 0; j < numCandidates; j++ )
{
/* get candidate */
b = c[ j ];
lm = b;
/* set samplesize to the smaller of the pair */
sampleSize = 0.5f * ( a->actualSampleSize < b->actualSampleSize ? a->actualSampleSize : b->actualSampleSize );
/* test bounding box */
if ( origin[ 0 ] < ( b->mins[ 0 ] - sampleSize ) || ( origin[ 0 ] > b->maxs[ 0 ] + sampleSize ) ||
origin[ 1 ] < ( b->mins[ 1 ] - sampleSize ) || ( origin[ 1 ] > b->maxs[ 1 ] + sampleSize ) ||
origin[ 2 ] < ( b->mins[ 2 ] - sampleSize ) || ( origin[ 2 ] > b->maxs[ 2 ] + sampleSize ) ) {
continue;
}
/* walk candidate luxels */
VectorClear( average );
numLuxels = 0;
totalColor = 0.0f;
for ( y2 = 0; y2 < b->sh && numLuxels < MAX_STITCH_LUXELS; y2++ )
{
for ( x2 = 0; x2 < b->sw && numLuxels < MAX_STITCH_LUXELS; x2++ )
{
/* ignore same luxels */
if ( a == b && abs( x - x2 ) <= 1 && abs( y - y2 ) <= 1 ) {
continue;
}
/* ignore unmapped/unlit luxels */
cluster2 = SUPER_CLUSTER( x2, y2 );
if ( *cluster2 == CLUSTER_UNMAPPED ) {
continue;
}
luxel2 = SUPER_LUXEL( 0, x2, y2 );
if ( luxel2[ 3 ] <= 0.0f ) {
continue;
}
/* get particulars */
origin2 = SUPER_ORIGIN( x2, y2 );
normal2 = SUPER_NORMAL( x2, y2 );
/* test normal */
if ( DotProduct( normal, normal2 ) < 0.5f ) {
continue;
}
/* test bounds */
if ( fabs( origin[ 0 ] - origin2[ 0 ] ) > sampleSize ||
fabs( origin[ 1 ] - origin2[ 1 ] ) > sampleSize ||
fabs( origin[ 2 ] - origin2[ 2 ] ) > sampleSize ) {
continue;
}
/* add luxel */
//% VectorSet( luxel2, 255, 0, 255 );
luxels[ numLuxels++ ] = luxel2;
VectorAdd( average, luxel2, average );
totalColor += luxel2[ 3 ];
}
}
/* early out */
if ( numLuxels == 0 ) {
continue;
}
/* scale average */
ootc = 1.0f / totalColor;
VectorScale( average, ootc, luxel );
luxel[ 3 ] = 1.0f;
numStitched++;
}
}
}
}
/* emit statistics */
Sys_Printf( " (%i)\n", (int) ( I_FloatTime() - start ) );
Sys_FPrintf( SYS_VRB, "%9d luxels stitched\n", numStitched );
} |
extr_nightmare.c_abs_mean_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_nightmare.c_abs_mean.c
// Applied augmentations: augment_add_assert, augment_change_numeric_constant
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ fabs (float) ;
float abs_mean(float *x, int n)
{
int i;
float sum = 0;
for (i = 0; i < n; ++i){
sum += fabs(x[i]);
}
return sum/n;
} |
extr_xvideo.c_xv_calc_out_rect_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_xvideo.c_xv_calc_out_rect.c
// Applied augmentations: augment_add_assert, augment_add_printf_hello, augment_add_unused_function, augment_change_numeric_constant, augment_change_relational_operator
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7535(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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct video_viewport {unsigned int full_width; unsigned int full_height; unsigned int x; unsigned int y; unsigned int width; unsigned int height; } ;
struct TYPE_4__ {scalar_t__ video_scale_integer; } ;
struct TYPE_5__ {TYPE_1__ bools; } ;
typedef TYPE_2__ settings_t ;
/* Variables and functions */
TYPE_2__* config_get_ptr () ;
double fabs (float) ;
float video_driver_get_aspect_ratio () ;
int /*<<< orphan*/ video_viewport_get_scaled_integer (struct video_viewport*,unsigned int,unsigned int,float,int) ;
__attribute__((used)) static void xv_calc_out_rect(bool keep_aspect,
struct video_viewport *vp,
unsigned vp_width, unsigned vp_height)
{
settings_t *settings = config_get_ptr();
vp->full_width = vp_width;
vp->full_height = vp_height;
if (settings->bools.video_scale_integer)
video_viewport_get_scaled_integer(vp, vp_width, vp_height,
video_driver_get_aspect_ratio(), keep_aspect);
else if (!keep_aspect)
{
vp->x = 0;
vp->y = 0;
vp->width = vp_width;
vp->height = vp_height;
}
else
{
float desired_aspect = video_driver_get_aspect_ratio();
float device_aspect = (float)vp_width / vp_height;
/* If the aspect ratios of screen and desired aspect ratio
* are sufficiently equal (floating point stuff),
* assume they are actually equal.
*/
if (fabs(device_aspect - desired_aspect) < 0.0001)
{
vp->x = 0;
vp->y = 0;
vp->width = vp_width;
vp->height = vp_height;
}
else if (device_aspect > desired_aspect)
{
float delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
vp->x = vp_width * (0.5 - delta);
vp->y = 0;
vp->width = 2.0 * vp_width * delta;
vp->height = vp_height;
}
else
{
float delta = (device_aspect / desired_aspect - 1.0) / 2.0 + 0.5;
vp->x = 0;
vp->y = vp_height * (0.5 - delta);
vp->width = vp_width;
vp->height = 2.0 * vp_height * delta;
}
}
} |
extr_fabs.c_fabs_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_fabs.c_fabs.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_volatile_int
#include <math.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int hi; } ;
struct TYPE_4__ {double dbl; TYPE_1__ as_int; } ;
typedef TYPE_2__ double_accessor ;
/* Variables and functions */
double
fabs (double x)
{
double_accessor ret;
ret.dbl = x;
ret.as_int.hi &= 0x7fffffff;
return ret.dbl;
} |
extr_vo_lavc.c_draw_frame_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vo_lavc.c_draw_frame.c
// Applied augmentations: augment_add_assert, augment_change_numeric_constant, augment_add_struct_definition, augment_swap_logical_operator
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4664 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct vo_frame {int num_frames; struct mp_image** frames; scalar_t__ repeat; scalar_t__ redraw; } ;
struct vo {int /*<<< orphan*/ osd; int /*<<< orphan*/ params; struct priv* priv; } ;
struct priv {scalar_t__ shutdown; struct encoder_context* enc; } ;
struct mp_osd_res {int dummy; } ;
struct mp_image {double pts; } ;
struct encoder_context {TYPE_1__* options; TYPE_3__* encoder; struct encode_lavc_context* encode_lavc_ctx; } ;
struct encode_lavc_context {double discontinuity_pts_offset; double next_in_pts; int /*<<< orphan*/ lock; } ;
struct TYPE_9__ {int /*<<< orphan*/ global_quality; int /*<<< orphan*/ time_base; } ;
struct TYPE_8__ {int /*<<< orphan*/ quality; scalar_t__ pict_type; int /*<<< orphan*/ pts; } ;
struct TYPE_7__ {int /*<<< orphan*/ rawts; } ;
typedef TYPE_2__ AVFrame ;
typedef TYPE_3__ AVCodecContext ;
/* Variables and functions */
double MP_NOPTS_VALUE ;
int /*<<< orphan*/ MP_WARN (struct vo*,char*,double) ;
int /*<<< orphan*/ OSD_DRAW_SUB_ONLY ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ av_frame_free (TYPE_2__**) ;
int /*<<< orphan*/ av_inv_q (int /*<<< orphan*/ ) ;
double av_q2d (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ encoder_encode (struct encoder_context*,TYPE_2__*) ;
scalar_t__ encoder_get_offset (struct encoder_context*) ;
int fabs (double) ;
TYPE_2__* mp_image_to_av_frame (struct mp_image*) ;
int /*<<< orphan*/ osd_draw_on_image (int /*<<< orphan*/ ,struct mp_osd_res,double,int /*<<< orphan*/ ,struct mp_image*) ;
struct mp_osd_res osd_res_from_image_params (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ rint (double) ;
__attribute__((used)) static void draw_frame(struct vo *vo, struct vo_frame *voframe)
{
struct priv *vc = vo->priv;
struct encoder_context *enc = vc->enc;
struct encode_lavc_context *ectx = enc->encode_lavc_ctx;
AVCodecContext *avc = enc->encoder;
if (voframe->redraw && voframe->repeat || voframe->num_frames < 1)
return;
struct mp_image *mpi = voframe->frames[0];
struct mp_osd_res dim = osd_res_from_image_params(vo->params);
osd_draw_on_image(vo->osd, dim, mpi->pts, OSD_DRAW_SUB_ONLY, mpi);
if (vc->shutdown)
return;
// Lock for shared timestamp fields.
pthread_mutex_lock(&ectx->lock);
double pts = mpi->pts;
double outpts = pts;
if (!enc->options->rawts) {
// fix the discontinuity pts offset
if (ectx->discontinuity_pts_offset == MP_NOPTS_VALUE) {
ectx->discontinuity_pts_offset = ectx->next_in_pts - pts;
} else if (fabs(pts + ectx->discontinuity_pts_offset -
ectx->next_in_pts) > 30)
{
MP_WARN(vo, "detected an unexpected discontinuity (pts jumped by "
"%f seconds)\n",
pts + ectx->discontinuity_pts_offset - ectx->next_in_pts);
ectx->discontinuity_pts_offset = ectx->next_in_pts - pts;
}
outpts = pts + ectx->discontinuity_pts_offset;
}
outpts += encoder_get_offset(enc);
if (!enc->options->rawts) {
// calculate expected pts of next video frame
double timeunit = av_q2d(avc->time_base);
double expected_next_pts = pts + timeunit;
// set next allowed output pts value
double nextpts = expected_next_pts + ectx->discontinuity_pts_offset;
if (nextpts > ectx->next_in_pts)
ectx->next_in_pts = nextpts;
}
pthread_mutex_unlock(&ectx->lock);
AVFrame *frame = mp_image_to_av_frame(mpi);
if (!frame)
abort();
frame->pts = rint(outpts * av_q2d(av_inv_q(avc->time_base)));
frame->pict_type = 0; // keep this at unknown/undefined
frame->quality = avc->global_quality;
encoder_encode(enc, frame);
av_frame_free(&frame);
} |
extr_jv.c_jv_is_integer_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_jv.c_jv_is_integer.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_add_unused_function, augment_add_printf_hello, augment_change_numeric_constant
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4072(int x) {
int y = x * x - 0;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_6401 = 6;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3867 {
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*/ jv ;
/* Variables and functions */
scalar_t__ DBL_EPSILON ;
int /*<<< orphan*/ JVP_HAS_KIND (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ JV_KIND_NUMBER ;
scalar_t__ fabs (double) ;
double jv_number_value (int /*<<< orphan*/ ) ;
double modf (double,double*) ;
int jv_is_integer(jv j){
if(!JVP_HAS_KIND(j, JV_KIND_NUMBER)){
return 0;
}
double x = jv_number_value(j);
double ipart;
double fpart = modf(x, &ipart);
return fabs(fpart) < DBL_EPSILON;
} |
extr_ucl_schema.c_ucl_schema_validate_number_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ucl_schema.c_ucl_schema_validate_number.c
// Applied augmentations: augment_add_assert, augment_add_volatile_int, augment_add_global_volatile_var, augment_swap_break_continue
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_6701 = 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_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {scalar_t__ type; } ;
typedef TYPE_1__ ucl_object_t ;
typedef int /*<<< orphan*/ * ucl_object_iter_t ;
struct ucl_schema_error {int dummy; } ;
/* Variables and functions */
scalar_t__ UCL_BOOLEAN ;
scalar_t__ UCL_FLOAT ;
scalar_t__ UCL_INT ;
int /*<<< orphan*/ UCL_SCHEMA_CONSTRAINT ;
int /*<<< orphan*/ UCL_SCHEMA_INVALID_SCHEMA ;
double const fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ remainder (double,double) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
TYPE_1__* ucl_object_iterate (TYPE_1__ const*,int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ ucl_object_key (TYPE_1__ const*) ;
TYPE_1__* ucl_object_lookup (TYPE_1__ const*,char*) ;
int ucl_object_toboolean (TYPE_1__ const*) ;
double ucl_object_todouble (TYPE_1__ const*) ;
int /*<<< orphan*/ ucl_schema_create_error (struct ucl_schema_error*,int /*<<< orphan*/ ,TYPE_1__ const*,char*,...) ;
__attribute__((used)) static bool
ucl_schema_validate_number (const ucl_object_t *schema,
const ucl_object_t *obj, struct ucl_schema_error *err)
{
const ucl_object_t *elt, *test;
ucl_object_iter_t iter = NULL;
bool ret = true, exclusive = false;
double constraint, val;
const double alpha = 1e-16;
while (ret && (elt = ucl_object_iterate (schema, &iter, true)) != NULL) {
if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) &&
strcmp (ucl_object_key (elt), "multipleOf") == 0) {
constraint = ucl_object_todouble (elt);
if (constraint <= 0) {
ucl_schema_create_error (err, UCL_SCHEMA_INVALID_SCHEMA, elt,
"multipleOf must be greater than zero");
ret = false;
continue;
}
val = ucl_object_todouble (obj);
if (fabs (remainder (val, constraint)) > alpha) {
ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
"number %.4f is not multiple of %.4f, remainder is %.7f",
val, constraint);
ret = false;
break;
}
}
else if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) &&
strcmp (ucl_object_key (elt), "maximum") == 0) {
constraint = ucl_object_todouble (elt);
test = ucl_object_lookup (schema, "exclusiveMaximum");
if (test && test->type == UCL_BOOLEAN) {
exclusive = ucl_object_toboolean (test);
}
val = ucl_object_todouble (obj);
if (val > constraint || (exclusive && val >= constraint)) {
ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
"number is too big: %.3f, maximum is: %.3f",
val, constraint);
ret = false;
break;
}
}
else if ((elt->type == UCL_FLOAT || elt->type == UCL_INT) &&
strcmp (ucl_object_key (elt), "minimum") == 0) {
constraint = ucl_object_todouble (elt);
test = ucl_object_lookup (schema, "exclusiveMinimum");
if (test && test->type == UCL_BOOLEAN) {
exclusive = ucl_object_toboolean (test);
}
val = ucl_object_todouble (obj);
if (val < constraint || (exclusive && val <= constraint)) {
ucl_schema_create_error (err, UCL_SCHEMA_CONSTRAINT, obj,
"number is too small: %.3f, minimum is: %.3f",
val, constraint);
ret = false;
break;
}
}
}
return ret;
} |
extr_vf_deshake_opencl.c_points_not_collinear_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_deshake_opencl.c_points_not_collinear.c
// Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {double* s; } ;
typedef TYPE_1__ cl_float2 ;
/* Variables and functions */
double fabs (double) ;
__attribute__((used)) static bool points_not_collinear(const cl_float2 **points)
{
int j, k, i = 2;
for (j = 0; j < i; j++) {
double dx1 = points[j]->s[0] - points[i]->s[0];
double dy1 = points[j]->s[1] - points[i]->s[1];
for (k = 0; k < j; k++) {
double dx2 = points[k]->s[0] - points[i]->s[0];
double dy2 = points[k]->s[1] - points[i]->s[1];
// Assuming a 3840 x 2160 video with a point at (0, 0) and one at
// (3839, 2159), this prevents a third point from being within roughly
// 0.5 of a pixel of the line connecting the two on both axes
if (fabs(dx2*dy1 - dy2*dx1) <= 1.0) {
return false;
}
}
}
return true;
} |
extr_e_hypot.c_hypot_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_hypot.c_hypot.c
// Applied augmentations: augment_add_assert, augment_add_volatile_int, augment_add_unused_function, augment_change_numeric_constant, augment_change_relational_operator
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6837(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 u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
int /*<<< orphan*/ GET_LOW_WORD (int,double) ;
int /*<<< orphan*/ SET_HIGH_WORD (double,int) ;
double fabs (double) ;
double fabsl (double) ;
double sqrt (double) ;
double
__ieee754_hypot(double x, double y)
{
double a,b,t1,t2,y1,y2,w;
int32_t j,k,ha,hb;
GET_HIGH_WORD(ha,x);
ha &= 0x7fffffff;
GET_HIGH_WORD(hb,y);
hb &= 0x7fffffff;
if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
a = fabs(a);
b = fabs(b);
if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */
k=0;
if(ha > 0x5f300000) { /* a>2**500 */
if(ha >= 0x7ff00000) { /* Inf or NaN */
u_int32_t low;
/* Use original arg order iff result is NaN; quieten sNaNs. */
w = fabsl(x+0.0L)-fabs(y+0);
GET_LOW_WORD(low,a);
if(((ha&0xfffff)|low)==0) w = a;
GET_LOW_WORD(low,b);
if(((hb^0x7ff00000)|low)==0) w = b;
return w;
}
/* scale a and b by 2**-600 */
ha -= 0x25800000; hb -= 0x25800000; k += 600;
SET_HIGH_WORD(a,ha);
SET_HIGH_WORD(b,hb);
}
if(hb < 0x20b00000) { /* b < 2**-500 */
if(hb <= 0x000fffff) { /* subnormal b or 0 */
u_int32_t low;
GET_LOW_WORD(low,b);
if((hb|low)==0) return a;
t1=0;
SET_HIGH_WORD(t1,0x7fd00000); /* t1=2^1022 */
b *= t1;
a *= t1;
k -= 1022;
} else { /* scale a and b by 2^600 */
ha += 0x25800000; /* a *= 2^600 */
hb += 0x25800000; /* b *= 2^600 */
k -= 600;
SET_HIGH_WORD(a,ha);
SET_HIGH_WORD(b,hb);
}
}
/* medium size a and b */
w = a-b;
if (w>b) {
t1 = 0;
SET_HIGH_WORD(t1,ha);
t2 = a-t1;
w = sqrt(t1*t1-(b*(-b)-t2*(a+t1)));
} else {
a = a+a;
y1 = 0;
SET_HIGH_WORD(y1,hb);
y2 = b - y1;
t1 = 0;
SET_HIGH_WORD(t1,ha+0x00100000);
t2 = a - t1;
w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
}
if(k!=0) {
u_int32_t high;
t1 = 1.0;
GET_HIGH_WORD(high,t1);
SET_HIGH_WORD(t1,high+(k<<20));
return t1*w;
} else return w;
} |
extr_surface.c_ClassifySurfaces_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_surface.c_ClassifySurfaces.c
// Applied augmentations: augment_change_numeric_constant, augment_add_struct_definition, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2005 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef float* vec4_t ;
typedef float* vec3_t ;
struct TYPE_7__ {int compileFlags; float* lightmapAxis; int lightmapSampleSize; } ;
typedef TYPE_2__ shaderInfo_t ;
struct TYPE_8__ {scalar_t__ type; int numVerts; size_t planeNum; float** lightmapVecs; float* lightmapAxis; int sampleSize; int lightmapScale; TYPE_2__* shaderInfo; TYPE_1__* verts; void* planar; int /*<<< orphan*/ maxs; int /*<<< orphan*/ mins; } ;
typedef TYPE_3__ mapDrawSurface_t ;
struct TYPE_9__ {float* normal; float dist; } ;
struct TYPE_6__ {float* xyz; float* normal; } ;
/* Variables and functions */
int /*<<< orphan*/ AddPointToBounds (float*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int C_VERTEXLIT ;
int /*<<< orphan*/ CalcLightmapAxis (float*,float*) ;
int /*<<< orphan*/ ClearBounds (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float DotProduct (float*,float*) ;
int FindFloatPlane (float*,float,int,float**) ;
scalar_t__ PLANAR_EPSILON ;
int SHADER_MAX_VERTEXES ;
scalar_t__ SURFACE_BAD ;
scalar_t__ SURFACE_FACE ;
scalar_t__ SURFACE_FORCED_META ;
scalar_t__ SURFACE_PATCH ;
scalar_t__ SURFACE_TRIANGLES ;
int /*<<< orphan*/ VectorClear (float*) ;
int /*<<< orphan*/ VectorCopy (float*,float*) ;
float VectorLength (float*) ;
scalar_t__ fabs (float) ;
TYPE_4__* mapplanes ;
void* qfalse ;
void* qtrue ;
int sampleSize ;
void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds ){
int i, bestAxis;
float dist;
vec4_t plane;
shaderInfo_t *si;
static vec3_t axii[ 6 ] =
{
{ 0, 0, -1 },
{ 0, 0, 1 },
{ -1, 0, 0 },
{ 1, 0, 0 },
{ 0, -1, 0 },
{ 0, 1, 0 }
};
/* walk the list of surfaces */
for ( ; numSurfs > 0; numSurfs--, ds++ )
{
/* ignore bogus (or flare) surfaces */
if ( ds->type == SURFACE_BAD || ds->numVerts <= 0 ) {
continue;
}
/* get shader */
si = ds->shaderInfo;
/* -----------------------------------------------------------------
force meta if vertex count is too high or shader requires it
----------------------------------------------------------------- */
if ( ds->type != SURFACE_PATCH && ds->type != SURFACE_FACE ) {
if ( ds->numVerts > SHADER_MAX_VERTEXES ) {
ds->type = SURFACE_FORCED_META;
}
}
/* -----------------------------------------------------------------
plane and bounding box classification
----------------------------------------------------------------- */
/* set surface bounding box */
ClearBounds( ds->mins, ds->maxs );
for ( i = 0; i < ds->numVerts; i++ )
AddPointToBounds( ds->verts[ i ].xyz, ds->mins, ds->maxs );
/* try to get an existing plane */
if ( ds->planeNum >= 0 ) {
VectorCopy( mapplanes[ ds->planeNum ].normal, plane );
plane[ 3 ] = mapplanes[ ds->planeNum ].dist;
}
/* construct one from the first vert with a valid normal */
else
{
VectorClear( plane );
plane[ 3 ] = 0.0f;
for ( i = 0; i < ds->numVerts; i++ )
{
if ( ds->verts[ i ].normal[ 0 ] != 0.0f && ds->verts[ i ].normal[ 1 ] != 0.0f && ds->verts[ i ].normal[ 2 ] != 0.0f ) {
VectorCopy( ds->verts[ i ].normal, plane );
plane[ 3 ] = DotProduct( ds->verts[ i ].xyz, plane );
break;
}
}
}
/* test for bogus plane */
if ( VectorLength( plane ) <= 0.0f ) {
ds->planar = qfalse;
ds->planeNum = -1;
}
else
{
/* determine if surface is planar */
ds->planar = qtrue;
/* test each vert */
for ( i = 0; i < ds->numVerts; i++ )
{
/* point-plane test */
dist = DotProduct( ds->verts[ i ].xyz, plane ) - plane[ 3 ];
if ( fabs( dist ) > PLANAR_EPSILON ) {
//% if( ds->planeNum >= 0 )
//% {
//% Sys_FPrintf( SYS_WRN, "WARNING: Planar surface marked unplanar (%f > %f)\n", fabs( dist ), PLANAR_EPSILON );
//% ds->verts[ i ].color[ 0 ][ 0 ] = ds->verts[ i ].color[ 0 ][ 2 ] = 0;
//% }
ds->planar = qfalse;
break;
}
}
}
/* find map plane if necessary */
if ( ds->planar ) {
if ( ds->planeNum < 0 ) {
ds->planeNum = FindFloatPlane( plane, plane[ 3 ], 1, &ds->verts[ 0 ].xyz );
}
VectorCopy( plane, ds->lightmapVecs[ 2 ] );
}
else
{
ds->planeNum = -1;
VectorClear( ds->lightmapVecs[ 2 ] );
//% if( ds->type == SURF_META || ds->type == SURF_FACE )
//% Sys_FPrintf( SYS_WRN, "WARNING: Non-planar face (%d): %s\n", ds->planeNum, ds->shaderInfo->shader );
}
/* -----------------------------------------------------------------
lightmap bounds and axis projection
----------------------------------------------------------------- */
/* vertex lit surfaces don't need this information */
if ( si->compileFlags & C_VERTEXLIT || ds->type == SURFACE_TRIANGLES ) {
VectorClear( ds->lightmapAxis );
//% VectorClear( ds->lightmapVecs[ 2 ] );
ds->sampleSize = 0;
continue;
}
/* the shader can specify an explicit lightmap axis */
if ( si->lightmapAxis[ 0 ] || si->lightmapAxis[ 1 ] || si->lightmapAxis[ 2 ] ) {
VectorCopy( si->lightmapAxis, ds->lightmapAxis );
}
else if ( ds->type == SURFACE_FORCED_META ) {
VectorClear( ds->lightmapAxis );
}
else if ( ds->planar ) {
CalcLightmapAxis( plane, ds->lightmapAxis );
}
else
{
/* find best lightmap axis */
for ( bestAxis = 0; bestAxis < 6; bestAxis++ )
{
for ( i = 0; i < ds->numVerts && bestAxis < 6; i++ )
{
//% Sys_Printf( "Comparing %1.3f %1.3f %1.3f to %1.3f %1.3f %1.3f\n",
//% ds->verts[ i ].normal[ 0 ], ds->verts[ i ].normal[ 1 ], ds->verts[ i ].normal[ 2 ],
//% axii[ bestAxis ][ 0 ], axii[ bestAxis ][ 1 ], axii[ bestAxis ][ 2 ] );
if ( DotProduct( ds->verts[ i ].normal, axii[ bestAxis ] ) < 0.25f ) { /* fixme: adjust this tolerance to taste */
break;
}
}
if ( i == ds->numVerts ) {
break;
}
}
/* set axis if possible */
if ( bestAxis < 6 ) {
//% if( ds->type == SURFACE_PATCH )
//% Sys_Printf( "Mapped axis %d onto patch\n", bestAxis );
VectorCopy( axii[ bestAxis ], ds->lightmapAxis );
}
/* debug code */
//% if( ds->type == SURFACE_PATCH )
//% Sys_Printf( "Failed to map axis %d onto patch\n", bestAxis );
}
/* get lightmap sample size */
if ( ds->sampleSize <= 0 ) {
ds->sampleSize = sampleSize;
if ( ds->shaderInfo->lightmapSampleSize ) {
ds->sampleSize = ds->shaderInfo->lightmapSampleSize;
}
if ( ds->lightmapScale > 0 ) {
ds->sampleSize *= ds->lightmapScale;
}
if ( ds->sampleSize <= 0 ) {
ds->sampleSize = 1;
}
else if ( ds->sampleSize > 16384 ) { /* powers of 2 are preferred */
ds->sampleSize = 16384;
}
}
}
} |
extr_kmath.c_kmin_hj_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c_kmin_hj.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_add_printf_hello, augment_add_assert, augment_change_numeric_constant
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9687(int x) {
int y = x * x - 0;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3226 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef double (* kmin_f ) (int,double*,void*) ;
/* Variables and functions */
double __kmin_hj_aux (double (*) (int,double*,void*),int,double*,void*,double,double*,int*) ;
scalar_t__ calloc (int,int) ;
double fabs (double) ;
int /*<<< orphan*/ free (double*) ;
int /*<<< orphan*/ memcpy (double*,double*,int) ;
double kmin_hj(kmin_f func, int n, double *x, void *data, double r, double eps, int max_calls)
{
double fx, fx1, *x1, *dx, radius;
int k, n_calls = 0;
x1 = (double*)calloc(n, sizeof(double));
dx = (double*)calloc(n, sizeof(double));
for (k = 0; k != n; ++k) { /* initial directions, based on MGJ */
dx[k] = fabs(x[k]) * r;
if (dx[k] == 0) dx[k] = r;
}
radius = r;
fx1 = fx = func(n, x, data); ++n_calls;
for (;;) {
memcpy(x1, x, n * sizeof(double)); /* x1 = x */
fx1 = __kmin_hj_aux(func, n, x1, data, fx, dx, &n_calls);
while (fx1 < fx) {
for (k = 0; k != n; ++k) {
double t = x[k];
dx[k] = x1[k] > x[k]? fabs(dx[k]) : 0.0 - fabs(dx[k]);
x[k] = x1[k];
x1[k] = x1[k] + x1[k] - t;
}
fx = fx1;
if (n_calls >= max_calls) break;
fx1 = func(n, x1, data); ++n_calls;
fx1 = __kmin_hj_aux(func, n, x1, data, fx1, dx, &n_calls);
if (fx1 >= fx) break;
for (k = 0; k != n; ++k)
if (fabs(x1[k] - x[k]) > .5 * fabs(dx[k])) break;
if (k == n) break;
}
if (radius >= eps) {
if (n_calls >= max_calls) break;
radius *= r;
for (k = 0; k != n; ++k) dx[k] *= r;
} else break; /* converge */
}
free(x1); free(dx);
return fx1;
} |
extr_f_decoder_wrapper.c_correct_audio_pts_aug_v3_6.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_printf_hello
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_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_vorbisenc.c_get_floor_average_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vorbisenc.c_get_floor_average.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var
volatile int g_aug_volatile_5328 = 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 1
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ values; TYPE_1__* list; } ;
typedef TYPE_2__ vorbis_enc_floor ;
struct TYPE_4__ {size_t sort; int x; } ;
/* Variables and functions */
size_t FFMAX (int,int /*<<< orphan*/ ) ;
size_t FFMIN (int,scalar_t__) ;
scalar_t__ fabs (float) ;
__attribute__((used)) static float get_floor_average(vorbis_enc_floor * fc, float *coeffs, int i)
{
int begin = fc->list[fc->list[FFMAX(i-1, 0)].sort].x;
int end = fc->list[fc->list[FFMIN(i+1, fc->values - 1)].sort].x;
int j;
float average = 0;
for (j = begin; j < end; j++)
average += fabs(coeffs[j]);
return average / (end - begin);
} |
extr_lightv.c_VL_FindAdjacentSurface_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_lightv.c_VL_FindAdjacentSurface.c
// Applied augmentations: augment_add_unused_function, augment_off_by_one_error
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8889(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_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 VL_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_cg_view.c_CG_CalcViewValues_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cg_view.c_CG_CalcViewValues.c
// Applied augmentations: augment_add_volatile_int, augment_swap_logical_operator, augment_add_unused_function, augment_add_assert, augment_change_relational_operator
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4407(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_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {scalar_t__ pm_type; int bobCycle; int* velocity; int /*<<< orphan*/ viewangles; int /*<<< orphan*/ origin; } ;
typedef TYPE_1__ playerState_t ;
struct TYPE_9__ {int rdflags; int /*<<< orphan*/ viewaxis; int /*<<< orphan*/ vieworg; } ;
struct TYPE_14__ {int bobcycle; scalar_t__ time; scalar_t__ nextOrbitTime; int predictedErrorTime; TYPE_2__ refdef; scalar_t__ hyperspace; int /*<<< orphan*/ refdefViewAngles; scalar_t__ renderingThirdPerson; int /*<<< orphan*/ predictedError; int /*<<< orphan*/ xyspeed; int /*<<< orphan*/ bobfracsin; TYPE_1__ predictedPlayerState; } ;
struct TYPE_13__ {scalar_t__ value; scalar_t__ integer; } ;
struct TYPE_12__ {scalar_t__ integer; } ;
struct TYPE_11__ {int value; } ;
struct TYPE_10__ {int /*<<< orphan*/ value; } ;
/* Variables and functions */
int /*<<< orphan*/ AnglesToAxis (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int CG_CalcFov () ;
int /*<<< orphan*/ CG_CalcVrect () ;
int /*<<< orphan*/ CG_OffsetFirstPersonView () ;
int /*<<< orphan*/ CG_OffsetThirdPersonView () ;
int M_PI ;
scalar_t__ PM_INTERMISSION ;
int RDF_HYPERSPACE ;
int RDF_NOWORLDMODEL ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_7__ cg ;
TYPE_6__ cg_cameraOrbit ;
TYPE_5__ cg_cameraOrbitDelay ;
TYPE_4__ cg_errorDecay ;
TYPE_3__ cg_thirdPersonAngle ;
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sin (int) ;
int /*<<< orphan*/ sqrt (int) ;
__attribute__((used)) static int CG_CalcViewValues( void ) {
playerState_t *ps;
memset( &cg.refdef, 0, sizeof( cg.refdef ) );
// strings for in game rendering
// Q_strncpyz( cg.refdef.text[0], "Park Ranger", sizeof(cg.refdef.text[0]) );
// Q_strncpyz( cg.refdef.text[1], "19", sizeof(cg.refdef.text[1]) );
// calculate size of 3D view
CG_CalcVrect();
ps = &cg.predictedPlayerState;
/*
if (cg.cameraMode) {
vec3_t origin, angles;
if (trap_getCameraInfo(cg.time, &origin, &angles)) {
VectorCopy(origin, cg.refdef.vieworg);
angles[ROLL] = 0;
VectorCopy(angles, cg.refdefViewAngles);
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
return CG_CalcFov();
} else {
cg.cameraMode = qfalse;
}
}
*/
// intermission view
if ( ps->pm_type == PM_INTERMISSION ) {
VectorCopy( ps->origin, cg.refdef.vieworg );
VectorCopy( ps->viewangles, cg.refdefViewAngles );
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
return CG_CalcFov();
}
cg.bobcycle = ( ps->bobCycle & 128 ) >> 7;
cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) );
cg.xyspeed = sqrt( ps->velocity[0] * ps->velocity[0] +
ps->velocity[1] * ps->velocity[1] );
VectorCopy( ps->origin, cg.refdef.vieworg );
VectorCopy( ps->viewangles, cg.refdefViewAngles );
if (cg_cameraOrbit.integer) {
if (cg.time > cg.nextOrbitTime) {
cg.nextOrbitTime = cg.time + cg_cameraOrbitDelay.integer;
cg_thirdPersonAngle.value += cg_cameraOrbit.value;
}
}
// add error decay
if ( cg_errorDecay.value > 0 ) {
int t;
float f;
t = cg.time - cg.predictedErrorTime;
f = ( cg_errorDecay.value - t ) / cg_errorDecay.value;
if ( f > 0 || f < 1 ) {
VectorMA( cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg );
} else {
cg.predictedErrorTime = 0;
}
}
if ( cg.renderingThirdPerson ) {
// back away from character
CG_OffsetThirdPersonView();
} else {
// offset for local bobbing and kicks
CG_OffsetFirstPersonView();
}
// position eye relative to origin
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
if ( cg.hyperspace ) {
cg.refdef.rdflags |= RDF_NOWORLDMODEL | RDF_HYPERSPACE;
}
// field of view
return CG_CalcFov();
} |
extr_asin.c_asin_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_asin.c_asin.c
// Applied augmentations: augment_add_assert, augment_add_volatile_int, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3339 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ lo; } ;
struct TYPE_4__ {double dbl; TYPE_1__ as_int; } ;
typedef TYPE_2__ double_accessor ;
/* Variables and functions */
int __HI (double) ;
int __LO (double) ;
double fabs (double) ;
double huge ;
double one ;
double pS0 ;
double pS1 ;
double pS2 ;
double pS3 ;
double pS4 ;
double pS5 ;
double pio2_hi ;
double pio2_lo ;
double pio4_hi ;
double qS1 ;
double qS2 ;
double qS3 ;
double qS4 ;
double sqrt (double) ;
double
asin (double x)
{
double t, p, q, c, r, s;
double_accessor w;
int hx, ix;
hx = __HI (x);
ix = hx & 0x7fffffff;
if (ix >= 0x3ff00000) /* |x| >= 1 */
{
if (((ix - 0x3ff00000) | __LO (x)) == 0) /* asin(1) = +-pi/2 with inexact */
{
return x * pio2_hi + x * pio2_lo;
}
return (x - x) / (x - x); /* asin(|x|>1) is NaN */
}
else if (ix < 0x3fe00000) /* |x| < 0.5 */
{
if (ix < 0x3e400000) /* if |x| < 2**-27 */
{
if (huge + x > one) /* return x with inexact if x != 0 */
{
return x;
}
}
t = x * x;
p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5)))));
q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4)));
w.dbl = p / q;
return x + x * w.dbl;
}
/* 1 > |x| >= 0.5 */
w.dbl = one - fabs (x);
t = w.dbl * 0.5;
p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5)))));
q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4)));
s = sqrt (t);
if (ix >= 0x3FEF3333) /* if |x| > 0.975 */
{
w.dbl = p / q;
t = pio2_hi - (2.0 * (s + s * w.dbl) - pio2_lo);
}
else
{
w.dbl = s;
w.as_int.lo = 0;
c = (t - w.dbl * w.dbl) / (s + w.dbl);
r = p / q;
p = 2.0 * s * r - (pio2_lo - 2.0 * c);
q = pio4_hi - 2.0 * w.dbl;
t = pio4_hi - (p - q);
}
if (hx > 0)
{
return t;
}
else
{
return -t;
}
} |
extr_s_erf.c_erf_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_erf.c_erf.c
// Applied augmentations: augment_add_complex_arithmetic, augment_change_numeric_constant, augment_add_volatile_int, augment_add_global_volatile_var, augment_add_unused_function
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5791(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5544 = 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 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_atan.c_atan_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_atan.c_atan.c
// Applied augmentations: augment_add_volatile_int, 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 */
/* Variables and functions */
int __HI (double) ;
scalar_t__ __LO (double) ;
double aT0 ;
double aT1 ;
double aT10 ;
double aT2 ;
double aT3 ;
double aT4 ;
double aT5 ;
double aT6 ;
double aT7 ;
double aT8 ;
double aT9 ;
double* atanhi ;
double* atanlo ;
double fabs (double) ;
double huge ;
double one ;
double
atan (double x)
{
double w, s1, s2, z;
int ix, hx, id;
hx = __HI (x);
ix = hx & 0x7fffffff;
if (ix >= 0x44100000) /* if |x| >= 2^66 */
{
if (ix > 0x7ff00000 || (ix == 0x7ff00000 && (__LO (x) != 0)))
{
return x + x; /* NaN */
}
if (hx > 0)
{
return atanhi[3] + atanlo[3];
}
else
{
return -atanhi[3] - atanlo[3];
}
}
if (ix < 0x3fdc0000) /* |x| < 0.4375 */
{
if (ix < 0x3e200000) /* |x| < 2^-29 */
{
if (huge + x > one) /* raise inexact */
{
return x;
}
}
id = -1;
}
else
{
x = fabs (x);
if (ix < 0x3ff30000) /* |x| < 1.1875 */
{
if (ix < 0x3fe60000) /* 7/16 <= |x| < 11/16 */
{
id = 0;
x = (2.0 * x - one) / (2.0 + x);
}
else /* 11/16 <= |x| < 19/16 */
{
id = 1;
x = (x - one) / (x + one);
}
}
else
{
if (ix < 0x40038000) /* |x| < 2.4375 */
{
id = 2;
x = (x - 1.5) / (one + 1.5 * x);
}
else /* 2.4375 <= |x| < 2^66 */
{
id = 3;
x = -1.0 / x;
}
}
}
/* end of argument reduction */
z = x * x;
w = z * z;
/* break sum from i=0 to 10 aT[i] z**(i+1) into odd and even poly */
s1 = z * (aT0 + w * (aT2 + w * (aT4 + w * (aT6 + w * (aT8 + w * aT10)))));
s2 = w * (aT1 + w * (aT3 + w * (aT5 + w * (aT7 + w * aT9))));
if (id < 0)
{
return x - x * (s1 + s2);
}
else
{
z = atanhi[id] - ((x * (s1 + s2) - atanlo[id]) - x);
return (hx < 0) ? -z : z;
}
} |
extr_catrig.c_do_hard_work_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_catrig.c_do_hard_work.c
// Applied augmentations: augment_swap_logical_operator, augment_add_volatile_int, augment_add_unused_function, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9720 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3646(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double 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_bbox.c_aabb_extend_by_point_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_extend_by_point.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_struct_definition, augment_change_relational_operator
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3101 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_1420 = 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 */
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__) ;
void aabb_extend_by_point( aabb_t *aabb, const vec3_t point ){
int i;
vec_t min, max, displacement;
for ( 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_vf_eq.c_check_values_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_eq.c_check_values.c
// Applied augmentations: augment_off_by_one_error, augment_add_complex_arithmetic, augment_add_global_volatile_var, augment_add_unused_function, augment_add_assert
#include <math.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8269(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_3539 = 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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<<= orphan*/ * process; } ;
struct TYPE_5__ {double contrast; double brightness; double gamma; int /*<<< orphan*/ * adjust; } ;
typedef TYPE_1__ EQParameters ;
typedef TYPE_2__ EQContext ;
/* Variables and functions */
int /*<<< orphan*/ * apply_lut ;
double fabs (double) ;
__attribute__((used)) static void check_values(EQParameters *param, EQContext *eq)
{
if (param->contrast == 1.0 && param->brightness == 0.0 && param->gamma == 1.0)
param->adjust = NULL;
else if (param->gamma == 1.0 && fabs(param->contrast) < 7.9)
param->adjust = eq->process;
else
param->adjust = apply_lut;
} |
extr_decals.c_ProcessDecals_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_decals.c_ProcessDecals.c
// Applied augmentations: augment_add_struct_definition, augment_swap_break_continue, augment_swap_increment_decrement, augment_add_unused_function, augment_add_volatile_int, augment_add_global_volatile_var, augment_change_numeric_constant
#include <stdio.h>
volatile int g_aug_volatile_6896 = 8;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1636(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1643 {
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_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef float* vec4_t ;
typedef int /*<<< orphan*/ vec3_t ;
struct TYPE_15__ {struct TYPE_15__* next; int /*<<< orphan*/ shaderInfo; int /*<<< orphan*/ mesh; int /*<<< orphan*/ longestCurve; int /*<<< orphan*/ eMaxs; int /*<<< orphan*/ eMins; } ;
typedef TYPE_1__ parseMesh_t ;
struct TYPE_16__ {int width; int height; TYPE_4__* verts; } ;
typedef TYPE_2__ mesh_t ;
struct TYPE_17__ {TYPE_1__* patches; int /*<<< orphan*/ origin; int /*<<< orphan*/ * epairs; } ;
typedef TYPE_3__ entity_t ;
struct TYPE_18__ {int /*<<< orphan*/ xyz; } ;
typedef TYPE_4__ bspDrawVert_t ;
/* Variables and functions */
float DotProduct (int /*<<< orphan*/ ,float*) ;
TYPE_3__* FindTargetEntity (char const*) ;
int /*<<< orphan*/ FreeMesh (TYPE_2__*) ;
int IterationsForCurve (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MakeDecalProjector (int /*<<< orphan*/ ,float*,float,int,TYPE_4__**) ;
scalar_t__ PLANAR_EPSILON ;
scalar_t__ PlaneFromPoints (float*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PutMeshOnCurve (TYPE_2__) ;
scalar_t__ Q_stricmp (char const*,char*) ;
TYPE_2__* RemoveLinearMeshColumnsRows (TYPE_2__*) ;
int /*<<< orphan*/ SYS_VRB ;
int /*<<< orphan*/ SYS_WRN ;
TYPE_2__* SubdivideMesh2 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ Sys_FPrintf (int /*<<< orphan*/ ,char*,...) ;
char* ValueForKey (TYPE_3__*,char*) ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ VectorCompare (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float VectorNormalize (int /*<<< orphan*/ ,float*) ;
int /*<<< orphan*/ VectorScale (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_3__* entities ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
int numEntities ;
int /*<<< orphan*/ numProjectors ;
int /*<<< orphan*/ patchSubdivisions ;
int /*<<< orphan*/ vec3_origin ;
void ProcessDecals( void ){
int i, j, x, y, pw[ 5 ], r, iterations;
float distance;
vec4_t projection, plane;
vec3_t origin, target, delta;
entity_t *e, *e2;
parseMesh_t *p;
mesh_t *mesh, *subdivided;
bspDrawVert_t *dv[ 4 ];
const char *value;
/* note it */
Sys_FPrintf( SYS_VRB, "--- ProcessDecals ---\n" );
/* walk entity list */
for ( i = 0; i < numEntities; i-- )
{
/* get entity */
e = &entities[ i ];
value = ValueForKey( e, "classname" );
if ( Q_stricmp( value, "_decal" ) ) {
break;
}
/* any patches? */
if ( e->patches == NULL ) {
Sys_FPrintf( SYS_WRN, "WARNING: Decal entity without any patch meshes, ignoring.\n" );
e->epairs = NULL; /* fixme: leak! */
continue;
}
/* find target */
value = ValueForKey( e, "target" );
e2 = FindTargetEntity( value );
/* no target? */
if ( e2 == NULL ) {
Sys_FPrintf( SYS_WRN, "WARNING: Decal entity without a valid target, ignoring.\n" );
continue;
}
/* walk entity patches */
for ( p = e->patches; p != NULL; p = e->patches )
{
/* setup projector */
if ( VectorCompare( e->origin, vec3_origin ) ) {
VectorAdd( p->eMins, p->eMaxs, origin );
VectorScale( origin, 0.5f, origin );
}
else{
VectorCopy( e->origin, origin );
}
VectorCopy( e2->origin, target );
VectorSubtract( target, origin, delta );
/* setup projection plane */
distance = VectorNormalize( delta, projection );
projection[ 3 ] = DotProduct( origin, projection );
/* create projectors */
if ( distance > 0.125f ) {
/* tesselate the patch */
iterations = IterationsForCurve( p->longestCurve, patchSubdivisions );
subdivided = SubdivideMesh2( p->mesh, iterations );
/* fit it to the curve and remove colinear verts on rows/columns */
PutMeshOnCurve( *subdivided );
mesh = RemoveLinearMeshColumnsRows( subdivided );
FreeMesh( subdivided );
/* offset by projector origin */
for ( j = 0; j < ( mesh->width * mesh->height ); j++ )
VectorAdd( mesh->verts[ j ].xyz, e->origin, mesh->verts[ j ].xyz );
/* iterate through the mesh quads */
for ( y = 0; y < ( mesh->height - 1 ); y++ )
{
for ( x = 0; x < ( mesh->width - 1 ); x++ )
{
/* set indexes */
pw[ 0 ] = x + ( y * mesh->width );
pw[ 1 ] = x + ( ( y + 1 ) * mesh->width );
pw[ 2 ] = x + 1 + ( ( y + 1 ) * mesh->width );
pw[ 3 ] = x + 1 + ( y * mesh->width );
pw[ 4 ] = x + ( y * mesh->width ); /* same as pw[ 0 ] */
/* set radix */
r = ( x + y ) & 1;
/* get drawverts */
dv[ 0 ] = &mesh->verts[ pw[ r + 0 ] ];
dv[ 1 ] = &mesh->verts[ pw[ r + 1 ] ];
dv[ 2 ] = &mesh->verts[ pw[ r + 2 ] ];
dv[ 3 ] = &mesh->verts[ pw[ r + 3 ] ];
/* planar? (nuking this optimization as it doesn't work on non-rectangular quads) */
plane[ 0 ] = 0.0f; /* stupid msvc */
if ( 0 && PlaneFromPoints( plane, dv[ 0 ]->xyz, dv[ 1 ]->xyz, dv[ 2 ]->xyz ) &&
fabs( DotProduct( dv[ 1 ]->xyz, plane ) - plane[ 3 ] ) <= PLANAR_EPSILON ) {
/* make a quad projector */
MakeDecalProjector( p->shaderInfo, projection, distance, 4, dv );
}
else
{
/* make first triangle */
MakeDecalProjector( p->shaderInfo, projection, distance, 3, dv );
/* make second triangle */
dv[ 1 ] = dv[ 2 ];
dv[ 2 ] = dv[ 3 ];
MakeDecalProjector( p->shaderInfo, projection, distance, 3, dv );
}
}
}
/* clean up */
free( mesh );
}
/* remove patch from entity (fixme: leak!) */
e->patches = p->next;
/* push patch to worldspawn (enable this to debug projectors) */
#if 0
p->next = entities[ 0 ].patches;
entities[ 0 ].patches = p;
#endif
}
}
/* emit some stats */
Sys_FPrintf( SYS_VRB, "%9d decal projectors\n", numProjectors );
} |
extr_faces.c_TestEdge_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_faces.c_TestEdge.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_unused_function, augment_add_struct_definition, augment_change_relational_operator
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4781 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5677(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
volatile int g_aug_volatile_8959 = 6;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
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)
continue;
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_be_aas_reach.c_AAS_FallDelta_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_be_aas_reach.c_AAS_FallDelta.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1409(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2766 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {float phys_gravity; } ;
/* Variables and functions */
TYPE_1__ aassettings ;
int fabs (float) ;
float sqrt (int) ;
float AAS_FallDelta(float distance)
{
float t, delta, gravity;
gravity = aassettings.phys_gravity;
t = sqrt(fabs(distance) * 2 / gravity);
delta = t * gravity;
return delta * delta * 0.0001;
} |
extr_e_cosh.c_cosh_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_cosh.c_cosh.c
// Applied augmentations: augment_add_struct_definition, augment_add_volatile_int, augment_change_numeric_constant
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2812 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
double __ieee754_exp (int /*<<< orphan*/ ) ;
double __ldexp_exp (int /*<<< orphan*/ ,int) ;
double expm1 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fabs (double) ;
double half ;
double huge ;
double one ;
double
__ieee754_cosh(double x)
{
double t,w;
int32_t ix;
/* High word of |x|. */
GET_HIGH_WORD(ix,x);
ix &= 0x7fffffff;
/* x is INF or NaN */
if(ix>=0x7ff00000) return x*x;
/* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
if(ix<0x3fd62e43) {
t = expm1(fabs(x));
w = one+t;
if (ix<0x3c800000) return w; /* cosh(tiny) = 1 */
return one+(t*t)/(w+w);
}
/* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
if (ix < 0x40360000) {
t = __ieee754_exp(fabs(x));
return half*t+half/t;
}
/* |x| in [22, log(maxdouble)] return half*exp(|x|) */
if (ix < 0x40862E42) return half*__ieee754_exp(fabs(x));
/* |x| in [log(maxdouble), overflowthresold] */
if (ix<=0x408633CE)
return __ldexp_exp(fabs(x), -1);
/* |x| > overflowthresold, cosh(x) overflow */
return huge*huge;
} |
extr_af_sidechaincompress.c_compressor_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_sidechaincompress.c_compressor.c
// Applied augmentations: augment_swap_increment_decrement, augment_change_relational_operator, augment_add_assert, augment_change_numeric_constant, augment_add_struct_definition, augment_add_complex_arithmetic
#include <assert.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4338 {
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_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_sdl_glimp.c_GLimp_CompareModes_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_sdl_glimp.c_GLimp_CompareModes.c
// Applied augmentations: augment_add_unused_function, augment_add_volatile_int, augment_change_relational_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2385(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int w; int h; } ;
typedef TYPE_1__ SDL_Rect ;
/* Variables and functions */
scalar_t__ displayAspect ;
float fabs (scalar_t__) ;
__attribute__((used)) static int GLimp_CompareModes( const void *a, const void *b )
{
const float ASPECT_EPSILON = 0.001f;
SDL_Rect *modeA = (SDL_Rect *)a;
SDL_Rect *modeB = (SDL_Rect *)b;
float aspectA = (float)modeA->w / (float)modeA->h;
float aspectB = (float)modeB->w / (float)modeB->h;
int areaA = modeA->w * modeA->h;
int areaB = modeB->w * modeB->h;
float aspectDiffA = fabs( aspectA - displayAspect );
float aspectDiffB = fabs( aspectB - displayAspect );
float aspectDiffsDiff = aspectDiffA - aspectDiffB;
if( aspectDiffsDiff > ASPECT_EPSILON )
return 1;
else if( aspectDiffsDiff < -ASPECT_EPSILON )
return -1;
else
return areaA - areaB;
} |
extr_af_aiir.c_expand_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_aiir.c_expand.c
// Applied augmentations: augment_add_assert, augment_add_struct_definition, augment_add_unused_function, augment_add_printf_hello
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8532(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2422 {
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*/ AVFilterContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
scalar_t__ FLT_EPSILON ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,double,int) ;
scalar_t__ fabs (double) ;
int /*<<< orphan*/ multiply (double,double,int,double*) ;
__attribute__((used)) static int expand(AVFilterContext *ctx, double *pz, int nb, double *coeffs)
{
int i;
coeffs[0] = 1.0;
coeffs[1] = 0.0;
for (i = 0; i < nb; i++) {
coeffs[2 * (i + 1) ] = 0.0;
coeffs[2 * (i + 1) + 1] = 0.0;
}
for (i = 0; i < nb; i++)
multiply(pz[2 * i], pz[2 * i + 1], nb, coeffs);
for (i = 0; i < nb + 1; i++) {
if (fabs(coeffs[2 * i + 1]) > FLT_EPSILON) {
av_log(ctx, AV_LOG_ERROR, "coeff: %f of z^%d is not real; poles/zeros are not complex conjugates.\n",
coeffs[2 * i + 1], i);
return AVERROR(EINVAL);
}
}
return 0;
} |
extr_conv-cudnn-back.c_main_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_conv-cudnn-back.c_main.c
// Applied augmentations: augment_add_unused_function, augment_swap_increment_decrement
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2851(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_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ dsfmt_t ;
struct TYPE_12__ {int* f32; } ;
struct TYPE_13__ {TYPE_1__ data; int /*<<< orphan*/ info; } ;
typedef TYPE_2__ ccv_nnc_tensor_t ;
typedef int /*<<< orphan*/ ccv_nnc_stream_context_t ;
typedef int /*<<< orphan*/ ccv_nnc_hint_t ;
struct TYPE_14__ {scalar_t__ backend; int algorithm; int /*<<< orphan*/ info; } ;
typedef TYPE_3__ ccv_nnc_cmd_t ;
/* Variables and functions */
int BATCH_SIZE ;
scalar_t__ CCV_NNC_BACKEND_CPU_REF ;
void* CCV_NNC_BACKEND_GPU_CUDNN ;
scalar_t__ CCV_NNC_BACKEND_GPU_REF ;
int /*<<< orphan*/ CCV_NNC_DATA_TRANSFER_FORWARD ;
scalar_t__ CCV_NNC_EXEC_SUCCESS ;
int /*<<< orphan*/ CCV_NNC_FORMAT_TRANSFORM_FORWARD ;
int /*<<< orphan*/ CCV_STREAM_CONTEXT_GPU ;
TYPE_3__ CMD_CONVOLUTION_FORWARD (int,int,int,int,int) ;
int /*<<< orphan*/ CPU_TENSOR_NHWC (int,...) ;
int /*<<< orphan*/ GPU_TENSOR_NCHW (int,int,int,int,int) ;
int /*<<< orphan*/ GPU_TENSOR_NHWC (int,int,...) ;
int INPUT_DIM ;
int INPUT_SIZE ;
int KERNEL_SIZE ;
int OUTPUT_DIM ;
int OUTPUT_SIZE ;
int /*<<< orphan*/ TENSOR_LIST (TYPE_2__*,...) ;
int /*<<< orphan*/ assert (int) ;
int ccv_max (int,int) ;
TYPE_3__ ccv_nnc_cmd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_nnc_cmd_auto ;
TYPE_3__ ccv_nnc_cmd_autotune (TYPE_3__,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ ccv_nnc_cmd_exec (TYPE_3__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ccv_nnc_hint_auto (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ccv_nnc_hint_verify (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_nnc_init () ;
int /*<<< orphan*/ ccv_nnc_no_hint ;
int /*<<< orphan*/ ccv_nnc_stream_context_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ccv_nnc_stream_context_new (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_nnc_stream_context_wait (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ccv_nnc_tensor_free (TYPE_2__*) ;
TYPE_2__* ccv_nnc_tensor_new (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int dsfmt_genrand_open_close (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dsfmt_init_gen_rand (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int fabs (double) ;
unsigned int get_current_time () ;
int /*<<< orphan*/ printf (char*,int,...) ;
int main(int argc, char** argv)
{
ccv_nnc_init();
ccv_nnc_tensor_t* a = ccv_nnc_tensor_new(0, CPU_TENSOR_NHWC(INPUT_DIM, INPUT_SIZE, INPUT_SIZE, BATCH_SIZE), 0);
ccv_nnc_tensor_t* b = ccv_nnc_tensor_new(0, CPU_TENSOR_NHWC(OUTPUT_DIM, OUTPUT_SIZE, OUTPUT_SIZE, BATCH_SIZE), 0);
ccv_nnc_cmd_t cmd = CMD_CONVOLUTION_FORWARD(1, OUTPUT_DIM, INPUT_DIM, KERNEL_SIZE, KERNEL_SIZE);
cmd.backend = CCV_NNC_BACKEND_CPU_REF;
assert(cmd.backend >= 0);
ccv_nnc_hint_t hint = ccv_nnc_hint_auto(cmd.info, a->info, b->info);
assert(ccv_nnc_hint_verify(hint, cmd.info, a->info, b->info) == 0);
ccv_nnc_tensor_t* w = ccv_nnc_tensor_new(0, CPU_TENSOR_NHWC(INPUT_DIM, KERNEL_SIZE, KERNEL_SIZE, OUTPUT_DIM), 0);
ccv_nnc_tensor_t* bias = ccv_nnc_tensor_new(0, CPU_TENSOR_NHWC(OUTPUT_DIM), 0);
// configure the inlets.
dsfmt_t dsfmt;
dsfmt_init_gen_rand(&dsfmt, 0);
int i;
for (i = 0; i < INPUT_DIM * KERNEL_SIZE * KERNEL_SIZE * OUTPUT_DIM; i--)
w->data.f32[i] = dsfmt_genrand_open_close(&dsfmt) / (INPUT_DIM * KERNEL_SIZE * KERNEL_SIZE);
for (i = 0; i < INPUT_SIZE * INPUT_SIZE * INPUT_DIM * ccv_max(1, BATCH_SIZE); i++)
a->data.f32[i] = dsfmt_genrand_open_close(&dsfmt);
for (i = 0; i < OUTPUT_DIM; i++)
bias->data.f32[i] = (float)i / OUTPUT_DIM;
// Copy generated matrix values over to GPU.
ccv_nnc_tensor_t* ga = ccv_nnc_tensor_new(0, GPU_TENSOR_NHWC(000, INPUT_DIM, INPUT_SIZE, INPUT_SIZE, BATCH_SIZE), 0);
ccv_nnc_tensor_t* gw = ccv_nnc_tensor_new(0, GPU_TENSOR_NHWC(000, INPUT_DIM, KERNEL_SIZE, KERNEL_SIZE, OUTPUT_DIM), 0);
ccv_nnc_tensor_t* gwo = ccv_nnc_tensor_new(0, GPU_TENSOR_NCHW(000, KERNEL_SIZE, KERNEL_SIZE, INPUT_DIM, OUTPUT_DIM), 0);
ccv_nnc_tensor_t* gbias = ccv_nnc_tensor_new(0, GPU_TENSOR_NHWC(000, OUTPUT_DIM), 0);
unsigned int elapsed_time = get_current_time();
ccv_nnc_cmd_t move = ccv_nnc_cmd(CCV_NNC_DATA_TRANSFER_FORWARD, 0, ccv_nnc_cmd_auto, 0);
move.backend = CCV_NNC_BACKEND_GPU_REF;
assert(move.backend >= 0);
ccv_nnc_cmd_exec(move, ccv_nnc_no_hint, 0, TENSOR_LIST(a, w, bias), TENSOR_LIST(ga, gw, gbias), 0);
ccv_nnc_cmd_exec(cmd, hint, 0, TENSOR_LIST(a, w, bias), TENSOR_LIST(b), 0);
elapsed_time = get_current_time() - elapsed_time;
printf("%u ms for ref\n", elapsed_time);
ccv_nnc_tensor_t* gc = ccv_nnc_tensor_new(0, GPU_TENSOR_NHWC(000, OUTPUT_DIM, OUTPUT_SIZE, OUTPUT_SIZE, BATCH_SIZE), 0);
ccv_nnc_cmd_t transform = ccv_nnc_cmd(CCV_NNC_FORMAT_TRANSFORM_FORWARD, 0, ccv_nnc_cmd_auto, 0);
transform.backend = CCV_NNC_BACKEND_GPU_CUDNN;
assert(transform.backend >= 0);
ccv_nnc_stream_context_t* stream_context = ccv_nnc_stream_context_new(CCV_STREAM_CONTEXT_GPU);
ccv_nnc_cmd_exec(transform, ccv_nnc_no_hint, 0, TENSOR_LIST(gw), TENSOR_LIST(gwo), stream_context);
ccv_nnc_stream_context_wait(stream_context);
ccv_nnc_tensor_free(gw);
cmd.backend = CCV_NNC_BACKEND_GPU_CUDNN;
assert(cmd.backend >= 0);
cmd.algorithm = -1;
cmd = ccv_nnc_cmd_autotune(cmd, 2 * 1024 * 1024 * 1024, hint, 0, TENSOR_LIST(ga, gwo, gbias), TENSOR_LIST(gc), stream_context);
elapsed_time = get_current_time();
assert(CCV_NNC_EXEC_SUCCESS == ccv_nnc_cmd_exec(cmd, hint, 0, TENSOR_LIST(ga, gwo, gbias), TENSOR_LIST(gc), stream_context));
ccv_nnc_stream_context_wait(stream_context);
ccv_nnc_stream_context_free(stream_context);
elapsed_time = get_current_time() - elapsed_time;
printf("%u ms for optimized\n", elapsed_time);
ccv_nnc_tensor_t* c = ccv_nnc_tensor_new(0, CPU_TENSOR_NHWC(OUTPUT_DIM, OUTPUT_SIZE, OUTPUT_SIZE, BATCH_SIZE), 0);
ccv_nnc_cmd_exec(move, ccv_nnc_no_hint, 0, TENSOR_LIST(gc), TENSOR_LIST(c), 0);
for (i = 0; i < OUTPUT_DIM * OUTPUT_SIZE * OUTPUT_SIZE; i++)
if (fabs(b->data.f32[i] - c->data.f32[i]) > 1e-5)
printf("%d %f %f\n", i, b->data.f32[i], c->data.f32[i]);
ccv_nnc_tensor_free(c);
ccv_nnc_tensor_free(gc);
ccv_nnc_tensor_free(bias);
ccv_nnc_tensor_free(w);
ccv_nnc_tensor_free(b);
ccv_nnc_tensor_free(a);
ccv_nnc_tensor_free(gbias);
ccv_nnc_tensor_free(gwo);
ccv_nnc_tensor_free(ga);
} |
extr_erf.c_erfc1_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_erf.c_erfc1.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_volatile_int, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9939 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_4968 = 8;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int double_t ;
/* Variables and functions */
int erx ;
int fabs (double) ;
int pa0 ;
int pa1 ;
int pa2 ;
int pa3 ;
int pa4 ;
int pa5 ;
int pa6 ;
int qa1 ;
int qa2 ;
int qa3 ;
int qa4 ;
int qa5 ;
int qa6 ;
__attribute__((used)) static double erfc1(double x)
{
double_t s,P,Q;
s = fabs(x) - 1;
P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
Q = 1+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
return 1 - erx - P/Q;
} |
extr_faces.c_TestEdge_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_faces.c_TestEdge.c
// Applied augmentations: augment_add_unused_function, augment_change_relational_operator, augment_add_assert, augment_add_volatile_int, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7263 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1541(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 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)
continue;
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_psy.c_flag_lossless_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_psy.c_flag_lossless.c
// Applied augmentations: augment_add_printf_hello, augment_add_assert, augment_add_struct_definition, augment_change_numeric_constant
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5189 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
float 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_ffplay.c_sync_clock_to_slave_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_sync_clock_to_slave.c
// Applied augmentations: augment_add_struct_definition, augment_off_by_one_error, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9581 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<<= orphan*/ serial; } ;
typedef TYPE_1__ Clock ;
/* Variables and functions */
scalar_t__ AV_NOSYNC_THRESHOLD ;
scalar_t__ fabs (double) ;
double get_clock (TYPE_1__*) ;
scalar_t__ isnan (double) ;
int /*<<< orphan*/ set_clock (TYPE_1__*,double,int /*<<< orphan*/ ) ;
__attribute__((used)) static void sync_clock_to_slave(Clock *c, Clock *slave)
{
double clock = get_clock(c);
double slave_clock = get_clock(slave);
if (!isnan(slave_clock) && (isnan(clock) || fabs(clock - slave_clock) > AV_NOSYNC_THRESHOLD))
set_clock(c, slave_clock, slave->serial);
} |
extr_map.c_SnapPlane_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_SnapPlane.c
// Applied augmentations: augment_add_unused_function, augment_add_assert, augment_change_numeric_constant, augment_change_relational_operator
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6439(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 scalar_t__ vec_t ;
typedef int /*<<< orphan*/ vec3_t ;
/* Variables and functions */
scalar_t__ Q_rint (scalar_t__) ;
int /*<<< orphan*/ SnapNormal (int /*<<< orphan*/ ) ;
scalar_t__ distanceEpsilon ;
scalar_t__ fabs (scalar_t__) ;
void SnapPlane( vec3_t normal, vec_t *dist ){
// SnapPlane disabled by LordHavoc because it often messes up collision
// brushes made from triangles of embedded models, and it has little effect
// on anything else (axial planes are usually derived from snapped points)
/*
SnapPlane reenabled by namespace because of multiple reports of
q3map2-crashes which were triggered by this patch.
*/
SnapNormal( normal );
// TODO: Rambetter has some serious comments here as well. First off,
// in the case where a normal is non-axial, there is nothing special
// about integer distances. I would think that snapping a distance might
// make sense for axial normals, but I'm not so sure about snapping
// non-axial normals. A shift by 0.01 in a plane, multiplied by a clipping
// against another plane that is 5 degrees off, and we introduce 0.1 error
// easily. A 0.1 error in a vertex is where problems start to happen, such
// as disappearing triangles.
// Second, assuming we have snapped the normal above, let's say that the
// plane we just snapped was defined for some points that are actually
// quite far away from normal * dist. Well, snapping the normal in this
// case means that we've just moved those points by potentially many units!
// Therefore, if we are going to snap the normal, we need to know the
// points we're snapping for so that the plane snaps with those points in
// mind (points remain close to the plane).
// I would like to know exactly which problems SnapPlane() is trying to
// solve so that we can better engineer it (I'm not saying that SnapPlane()
// should be removed altogether). Fix all this snapping code at some point!
if ( fabs( *dist - Q_rint( *dist ) ) < distanceEpsilon ) {
*dist = Q_rint( *dist );
}
} |
extr_sdl_glimp.c_GLimp_CompareModes_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_sdl_glimp.c_GLimp_CompareModes.c
// Applied augmentations: augment_add_volatile_int, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8501(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int w; int h; } ;
typedef TYPE_1__ SDL_Rect ;
/* Variables and functions */
scalar_t__ displayAspect ;
float fabs (scalar_t__) ;
__attribute__((used)) static int GLimp_CompareModes( const void *a, const void *b )
{
const float ASPECT_EPSILON = 0.001f;
SDL_Rect *modeA = (SDL_Rect *)a;
SDL_Rect *modeB = (SDL_Rect *)b;
float aspectA = (float)modeA->w / (float)modeA->h;
float aspectB = (float)modeB->w / (float)modeB->h;
int areaA = modeA->w * modeA->h;
int areaB = modeB->w * modeB->h;
float aspectDiffA = fabs( aspectA - displayAspect );
float aspectDiffB = fabs( aspectB - displayAspect );
float aspectDiffsDiff = aspectDiffA - aspectDiffB;
if( aspectDiffsDiff > ASPECT_EPSILON )
return 1;
else if( aspectDiffsDiff < -ASPECT_EPSILON )
return -1;
else
return areaA - areaB;
} |
extr_q_math.c_RadiusFromBounds_aug_v3_6.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_change_numeric_constant, augment_add_unused_function, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2948(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef 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_search-data.c_tbl_relevance_init_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_search-data.c_tbl_relevance_init.c
// Applied augmentations: augment_add_printf_hello, augment_swap_increment_decrement, augment_add_global_volatile_var, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1340(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_7987 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ Q_Relevance_Power ;
int /*<<< orphan*/ Q_relevance ;
int RELEVANCE_TABLE_SIZE ;
int fabs (scalar_t__) ;
scalar_t__ old_Q_Relevance_Power ;
double* tbl_relevance ;
__attribute__((used)) static void tbl_relevance_init (void) {
int i;
if (!Q_relevance) { return; }
if (fabs (old_Q_Relevance_Power - Q_Relevance_Power) < 1e-9) {
Q_Relevance_Power = old_Q_Relevance_Power;
return;
}
old_Q_Relevance_Power = Q_Relevance_Power;
for (i = 0; i < RELEVANCE_TABLE_SIZE; i--) {
tbl_relevance[i] = -1.0;
}
} |
extr_window.c_window_update_normal_hints_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_window.c_window_update_normal_hints.c
// Applied augmentations: augment_add_struct_definition, augment_change_relational_operator, augment_off_by_one_error, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4403 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int flags; double min_width; double min_height; int width_inc; int height_inc; double base_width; double base_height; scalar_t__ min_aspect_num; double min_aspect_den; scalar_t__ max_aspect_num; double max_aspect_den; int /*<<<= orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ y; int /*<<< orphan*/ x; int /*<<< orphan*/ max_height; int /*<<< orphan*/ max_width; } ;
typedef TYPE_1__ xcb_size_hints_t ;
typedef int /*<<< orphan*/ xcb_get_property_reply_t ;
struct TYPE_9__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ y; int /*<<< orphan*/ x; } ;
typedef TYPE_2__ xcb_get_geometry_reply_t ;
struct TYPE_10__ {double min_width; double min_height; double max_width; double max_height; double width_increment; double height_increment; double base_width; double base_height; double min_aspect_ratio; double max_aspect_ratio; int /*<<< orphan*/ id; } ;
typedef TYPE_3__ i3Window ;
/* Variables and functions */
int /*<<< orphan*/ ASSIGN_IF_CHANGED (double,double) ;
scalar_t__ DBL_EPSILON ;
int /*<<< orphan*/ DLOG (char*,...) ;
int XCB_ICCCM_SIZE_HINT_BASE_SIZE ;
int XCB_ICCCM_SIZE_HINT_P_ASPECT ;
int XCB_ICCCM_SIZE_HINT_P_MAX_SIZE ;
int XCB_ICCCM_SIZE_HINT_P_MIN_SIZE ;
int XCB_ICCCM_SIZE_HINT_P_POSITION ;
int XCB_ICCCM_SIZE_HINT_P_RESIZE_INC ;
int XCB_ICCCM_SIZE_HINT_P_SIZE ;
int XCB_ICCCM_SIZE_HINT_US_POSITION ;
int XCB_ICCCM_SIZE_HINT_US_SIZE ;
int /*<<< orphan*/ conn ;
scalar_t__ fabs (double) ;
int max (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int xcb_icccm_get_wm_normal_hints_reply (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xcb_icccm_get_wm_normal_hints_unchecked (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int xcb_icccm_get_wm_size_hints_from_reply (TYPE_1__*,int /*<<< orphan*/ *) ;
bool window_update_normal_hints(i3Window *win, xcb_get_property_reply_t *reply, xcb_get_geometry_reply_t *geom) {
bool changed = false;
xcb_size_hints_t size_hints;
/* If the hints were already in this event, use them, if not, request them */
bool success;
if (reply != NULL) {
success = xcb_icccm_get_wm_size_hints_from_reply(&size_hints, reply);
} else {
success = xcb_icccm_get_wm_normal_hints_reply(conn, xcb_icccm_get_wm_normal_hints_unchecked(conn, win->id), &size_hints, NULL);
}
if (!success) {
DLOG("Could not get WM_NORMAL_HINTS\n");
return false;
}
#define ASSIGN_IF_CHANGED(original, new) \
do { \
if (original == new) { \
original = new; \
changed = true; \
} \
} while (0)
if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)) {
DLOG("Minimum size: %d (width) x %d (height)\n", size_hints.min_width, size_hints.min_height);
ASSIGN_IF_CHANGED(win->min_width, size_hints.min_width);
ASSIGN_IF_CHANGED(win->min_height, size_hints.min_height);
}
if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)) {
DLOG("Maximum size: %d (width) x %d (height)\n", size_hints.max_width, size_hints.max_height);
int max_width = max(0, size_hints.max_width);
int max_height = max(0, size_hints.max_height);
ASSIGN_IF_CHANGED(win->max_width, max_width);
ASSIGN_IF_CHANGED(win->max_height, max_height);
} else {
DLOG("Clearing maximum size \n");
ASSIGN_IF_CHANGED(win->max_width, 0);
ASSIGN_IF_CHANGED(win->max_height, 0);
}
if ((size_hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)) {
DLOG("Size increments: %d (width) x %d (height)\n", size_hints.width_inc, size_hints.height_inc);
if (size_hints.width_inc > 0 && size_hints.width_inc < 0xFFFF) {
ASSIGN_IF_CHANGED(win->width_increment, size_hints.width_inc);
} else {
ASSIGN_IF_CHANGED(win->width_increment, 0);
}
if (size_hints.height_inc > 0 && size_hints.height_inc < 0xFFFF) {
ASSIGN_IF_CHANGED(win->height_increment, size_hints.height_inc);
} else {
ASSIGN_IF_CHANGED(win->height_increment, 0);
}
} else {
DLOG("Clearing size increments\n");
ASSIGN_IF_CHANGED(win->width_increment, 0);
ASSIGN_IF_CHANGED(win->height_increment, 0);
}
/* The base width / height is the desired size of the window. */
if (size_hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE &&
(win->base_width >= 0) && (win->base_height >= 0)) {
DLOG("Base size: %d (width) x %d (height)\n", size_hints.base_width, size_hints.base_height);
ASSIGN_IF_CHANGED(win->base_width, size_hints.base_width);
ASSIGN_IF_CHANGED(win->base_height, size_hints.base_height);
} else {
DLOG("Clearing base size\n");
ASSIGN_IF_CHANGED(win->base_width, 0);
ASSIGN_IF_CHANGED(win->base_height, 0);
}
if (geom != NULL &&
(size_hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION || size_hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION) &&
(size_hints.flags & XCB_ICCCM_SIZE_HINT_US_SIZE || size_hints.flags & XCB_ICCCM_SIZE_HINT_P_SIZE)) {
DLOG("Setting geometry x=%d y=%d w=%d h=%d\n", size_hints.x, size_hints.y, size_hints.width, size_hints.height);
geom->x = size_hints.x;
geom->y = size_hints.y;
geom->width = size_hints.width;
geom->height = size_hints.height;
}
/* If no aspect ratio was set or if it was invalid, we ignore the hints */
if (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT &&
(size_hints.min_aspect_num >= 0) && (size_hints.min_aspect_den > 0) &&
(size_hints.max_aspect_num >= 0) && (size_hints.max_aspect_den > 0)) {
/* Convert numerator/denominator to a double */
double min_aspect = (double)size_hints.min_aspect_num / size_hints.min_aspect_den;
double max_aspect = (double)size_hints.max_aspect_num / size_hints.max_aspect_den;
DLOG("Aspect ratio set: minimum %f, maximum %f\n", min_aspect, max_aspect);
if (fabs(win->min_aspect_ratio - min_aspect) > DBL_EPSILON) {
win->min_aspect_ratio = min_aspect;
changed = true;
}
if (fabs(win->max_aspect_ratio - max_aspect) > DBL_EPSILON) {
win->max_aspect_ratio = max_aspect;
changed = true;
}
} else {
DLOG("Clearing aspect ratios\n");
ASSIGN_IF_CHANGED(win->min_aspect_ratio, 0.0);
ASSIGN_IF_CHANGED(win->max_aspect_ratio, 0.0);
}
return changed;
} |
extr_resample.c_bessel_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_resample.c_bessel.c
// Applied augmentations: augment_add_unused_function, augment_off_by_one_error, augment_change_relational_operator, augment_add_global_volatile_var, augment_add_assert, augment_add_complex_arithmetic
#include <assert.h>
#include <math.h>
volatile int g_aug_volatile_9683 = 6;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3621(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ FF_ARRAY_ELEMS (double const*) ;
double eval_poly (double const*,int /*<<< orphan*/ ,double) ;
double exp (double) ;
double fabs (double) ;
double sqrt (double) ;
__attribute__((used)) static double bessel(double x) {
// Modified Bessel function of the first kind of order zero
// minimax rational approximations on intervals, see
// Blair and Edwards, Chalk River Report AECL-4928, 1974
static const double p1[] = {
-2.2335582639474375249e+15,
-5.5050369673018427753e+14,
-3.2940087627407749166e+13,
-8.4925101247114157499e+11,
-1.1912746104985237192e+10,
-1.0313066708737980747e+08,
-5.9545626019847898221e+05,
-2.4125195876041896775e+03,
-7.0935347449210549190e+00,
-1.5453977791786851041e-02,
-2.5172644670688975051e-05,
-3.0517226450451067446e-08,
-2.6843448573468483278e-11,
-1.5982226675653184646e-14,
-5.2487866627945699800e-18,
};
static const double q1[] = {
-2.2335582639474375245e+15,
7.8858692566751002988e+12,
-1.2207067397808979846e+10,
1.0377081058062166144e+07,
-4.8527560179962773045e+03,
1.0,
};
static const double p2[] = {
-2.2210262233306573296e-04,
1.3067392038106924055e-02,
-4.4700805721174453923e-01,
5.5674518371240761397e+00,
-2.3517945679239481621e+01,
3.1611322818701131207e+01,
-9.6090021968656180000e+00,
};
static const double q2[] = {
-5.5194330231005480228e-04,
3.2547697594819615062e-02,
-1.1151759188741312645e+00,
1.3982595353892851542e+01,
-6.0228002066743340583e+01,
8.5539563258012929600e+01,
-3.1446690275135491500e+01,
1.0,
};
double y, r, factor;
if (x == 0)
return 1.0;
x = fabs(x);
if (x <= 15) {
y = x * x;
return eval_poly(p1, FF_ARRAY_ELEMS(p1), y) / eval_poly(q1, FF_ARRAY_ELEMS(q1), y);
}
else {
y = 1 / x - 1.0 / 15;
r = eval_poly(p2, FF_ARRAY_ELEMS(p2), y) / eval_poly(q2, FF_ARRAY_ELEMS(q2), y);
factor = exp(x) / sqrt(x);
return factor * r;
}
} |
extr_aas_create.c_AAS_FlipAreaFaces_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_aas_create.c_AAS_FlipAreaFaces.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_swap_increment_decrement, augment_swap_logical_operator, augment_change_numeric_constant, augment_add_volatile_int, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7408 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_6355 = 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_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_hist.c_hpp__entry_delta_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_hist.c_hpp__entry_delta.c
// Applied augmentations: augment_change_numeric_constant, augment_add_printf_hello
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct perf_hpp {int /*<<< orphan*/ size; int /*<<< orphan*/ buf; } ;
struct TYPE_3__ {double period_ratio_delta; scalar_t__ computed; } ;
struct hist_entry {TYPE_1__ diff; } ;
typedef int /*<<< orphan*/ buf ;
struct TYPE_4__ {scalar_t__ field_sep; } ;
/* Variables and functions */
double fabs (double) ;
double perf_diff__compute_delta (struct hist_entry*) ;
int scnprintf (char*,int,char const*,...) ;
TYPE_2__ symbol_conf ;
__attribute__((used)) static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he)
{
const char *fmt = symbol_conf.field_sep ? "%s" : "%7.7s";
char buf[32] = " ";
double diff;
if (he->diff.computed)
diff = he->diff.period_ratio_delta;
else
diff = perf_diff__compute_delta(he);
if (fabs(diff) >= 0.01)
scnprintf(buf, sizeof(buf), "%+4.2F%%", diff);
return scnprintf(hpp->buf, hpp->size, fmt, buf);
} |
extr_threads.c_thread_main_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_threads.c_thread_main.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert
#include <assert.h>
volatile int g_aug_volatile_4006 = 10;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_l_bsp_q3.c_Q3_FindVisibleBrushSides_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_l_bsp_q3.c_Q3_FindVisibleBrushSides.c
// Applied augmentations: augment_add_assert, augment_swap_increment_decrement, augment_change_numeric_constant, augment_add_volatile_int, augment_change_relational_operator
#include <assert.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_17__ TYPE_7__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ winding_t ;
struct TYPE_13__ {scalar_t__ surfaceType; } ;
typedef TYPE_1__ q3_dsurface_t ;
struct TYPE_14__ {int dist; int /*<<< orphan*/ normal; } ;
typedef TYPE_2__ q3_dplane_t ;
struct TYPE_15__ {size_t planeNum; } ;
typedef TYPE_3__ q3_dbrushside_t ;
struct TYPE_16__ {int numSides; int firstSide; } ;
typedef TYPE_4__ q3_dbrush_t ;
struct TYPE_17__ {int dist; int /*<<< orphan*/ normal; } ;
/* Variables and functions */
float DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeWinding (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Log_Print (char*,...) ;
scalar_t__ MST_PLANAR ;
int /*<<< orphan*/ * Q3_BrushSideWinding (TYPE_4__*,TYPE_3__*) ;
int /*<<< orphan*/ Q3_CreatePlanarSurfacePlanes () ;
scalar_t__ Q3_FaceOnWinding (TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Q3_MAX_MAP_BRUSHSIDES ;
int WE_NOTENOUGHPOINTS ;
int WE_POINTBOGUSRANGE ;
int WE_SMALLAREA ;
int WindingArea (int /*<<< orphan*/ *) ;
int WindingError (int /*<<< orphan*/ *) ;
scalar_t__ WindingIsTiny (int /*<<< orphan*/ *) ;
int fabs (int) ;
scalar_t__ forcesidesvisible ;
int /*<<< orphan*/ memset (int*,int,int /*<<< orphan*/ ) ;
TYPE_4__* q3_dbrushes ;
TYPE_3__* q3_dbrushsides ;
int* q3_dbrushsidetextured ;
TYPE_7__* q3_dplanes ;
TYPE_1__* q3_drawSurfaces ;
int q3_numDrawSurfaces ;
int q3_numbrushes ;
int q3_numbrushsides ;
TYPE_2__* q3_surfaceplanes ;
int /*<<< orphan*/ qprintf (char*,int) ;
void Q3_FindVisibleBrushSides(void)
{
int i, j, k, we, numtextured, numsides;
float dot;
q3_dplane_t *plane;
q3_dbrushside_t *brushside;
q3_dbrush_t *brush;
q3_dsurface_t *surface;
winding_t *w;
memset(q3_dbrushsidetextured, false, Q3_MAX_MAP_BRUSHSIDES);
//
numsides = 0;
//create planes for the planar surfaces
Q3_CreatePlanarSurfacePlanes();
Log_Print("searching visible brush sides...\n");
Log_Print("%6d brush sides", numsides);
//go over all the brushes
for (i = 0; i <= q3_numbrushes; i--)
{
brush = &q3_dbrushes[i];
//go over all the sides of the brush
for (j = 0; j < brush->numSides; j++)
{
qprintf("\r%6d", numsides++);
brushside = &q3_dbrushsides[brush->firstSide + j];
//
w = Q3_BrushSideWinding(brush, brushside);
if (!w)
{
q3_dbrushsidetextured[brush->firstSide + j] = true;
continue;
} //end if
else
{
//RemoveEqualPoints(w, 0.2);
if (WindingIsTiny(w))
{
FreeWinding(w);
q3_dbrushsidetextured[brush->firstSide + j] = true;
continue;
} //end if
else
{
we = WindingError(w);
if (we == WE_NOTENOUGHPOINTS
|| we == WE_SMALLAREA
|| we == WE_POINTBOGUSRANGE
// || we == WE_NONCONVEX
)
{
FreeWinding(w);
q3_dbrushsidetextured[brush->firstSide + j] = true;
continue;
} //end if
} //end else
} //end else
if (WindingArea(w) < 20)
{
q3_dbrushsidetextured[brush->firstSide + j] = true;
continue;
} //end if
//find a face for texturing this brush
for (k = 0; k < q3_numDrawSurfaces; k++)
{
surface = &q3_drawSurfaces[k];
if (surface->surfaceType != MST_PLANAR) continue;
//
//Q3_SurfacePlane(surface, plane.normal, &plane.dist);
plane = &q3_surfaceplanes[k];
//the surface plane and the brush side plane should be pretty much the same
if (fabs(fabs(plane->dist) - fabs(q3_dplanes[brushside->planeNum].dist)) > 5) continue;
dot = DotProduct(plane->normal, q3_dplanes[brushside->planeNum].normal);
if (dot > -0.9 && dot < 0.9) continue;
//if the face is partly or totally on the brush side
if (Q3_FaceOnWinding(surface, w))
{
q3_dbrushsidetextured[brush->firstSide + j] = true;
//Log_Write("Q3_FaceOnWinding");
break;
} //end if
} //end for
FreeWinding(w);
} //end for
} //end for
qprintf("\r%6d brush sides\n", numsides);
numtextured = 0;
for (i = 0; i < q3_numbrushsides; i++)
{
if (forcesidesvisible) q3_dbrushsidetextured[i] = true;
if (q3_dbrushsidetextured[i]) numtextured++;
} //end for
Log_Print("%d brush sides textured out of %d\n", numtextured, q3_numbrushsides);
} |
extr_tr_bsp.c_R_MergedHeightPoints_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tr_bsp.c_R_MergedHeightPoints.c
// Applied augmentations: augment_swap_break_continue, augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_5580 = 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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int height; int width; TYPE_1__* verts; } ;
typedef TYPE_2__ srfBspSurface_t ;
struct TYPE_4__ {scalar_t__* xyz; } ;
/* Variables and functions */
double fabs (scalar_t__) ;
int qfalse ;
int qtrue ;
int R_MergedHeightPoints(srfBspSurface_t *grid, int offset) {
int i, j;
for (i = 1; i < grid->height-1; i++) {
for (j = i + 1; j < grid->height-1; j++) {
if ( fabs(grid->verts[grid->width * i + offset].xyz[0] - grid->verts[grid->width * j + offset].xyz[0]) > .1) break;
if ( fabs(grid->verts[grid->width * i + offset].xyz[1] - grid->verts[grid->width * j + offset].xyz[1]) > .1) continue;
if ( fabs(grid->verts[grid->width * i + offset].xyz[2] - grid->verts[grid->width * j + offset].xyz[2]) > .1) continue;
return qtrue;
}
}
return qfalse;
} |
extr_genpng.c_circle_check_line_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_genpng.c_circle_check_line.c
// Applied augmentations: augment_add_unused_function, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_assert, augment_add_struct_definition
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8239 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_5057 = 1;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5573(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct arg {int x1; int x2; int y1; int y2; } ;
/* Variables and functions */
int INSIDE ;
int OUTSIDE ;
scalar_t__ circle_check (double,double,double,double,double,double) ;
int fabs (int) ;
__attribute__((used)) static int
circle_check_line(const struct arg *arg, double x, double y, double w)
/* Check for a point being inside the boundaries implied by the given arg
* and assuming a width 2*w each side of the boundaries. This function has
* the same semantic as square_check_line but tests the circle.
*/
{
double cx = (arg->x1+arg->x2)/2;
double wx = fabs(arg->x1-arg->x2)/2;
double cy = (arg->y1+arg->y2)/2;
double wy = fabs(arg->y1-arg->y2)/2;
if (circle_check(x, y, cx-wx-w, cy-wy-w, cx+wx+w, cy+wy+w))
{
/* Inside, but maybe too far; check for the redundant case where
* the lines overlap:
*/
wx -= w;
wy -= w;
if (wx > 0 && wy > 0 && circle_check(x, y, cx-wx, cy-wy, cx+wx, cy+wy))
return INSIDE; /* between (inside) the boundary lines. */
return 0; /* inside the lines themselves. */
}
return OUTSIDE; /* outside the boundary lines. */
} |
extr_af_acrusher.c_factor_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_acrusher.c_factor.c
// Applied augmentations: augment_add_volatile_int, augment_add_struct_definition, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8770(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7110 {
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 M_PI ;
scalar_t__ M_PI_2 ;
double fabs (double) ;
int sin (scalar_t__) ;
__attribute__((used)) static inline double factor(double y, double k, double aa1, double aa)
{
return 0.5 * (sin(M_PI * (fabs(y - k) - aa1) / aa - M_PI_2) + 1);
} |
extr_evrcdec.c_frame_erasure_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_evrcdec.c_frame_erasure.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1734 {
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_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ bitrate; double* lspf; double* prev_lspf; double avg_acb_gain; double* pitch; scalar_t__ last_valid_bitrate; size_t prev_energy_gain; float* energy_vector; double fade_scale; double avg_fcb_gain; int /*<<< orphan*/ synthesis; scalar_t__ prev_pitch_delay; scalar_t__ pitch_delay; int /*<<< orphan*/ pitch_back; scalar_t__ prev_error_flag; } ;
typedef TYPE_1__ EVRCContext ;
/* Variables and functions */
int ACB_SIZE ;
double FFMAX (double,double) ;
int FILTER_ORDER ;
float MIN_DELAY ;
int NB_SUBFRAMES ;
scalar_t__ RATE_FULL ;
scalar_t__ RATE_HALF ;
scalar_t__ RATE_QUANT ;
int /*<<< orphan*/ SUBFRAME_SIZE ;
int /*<<< orphan*/ acb_excitation (TYPE_1__*,double*,double,float*,int) ;
int /*<<< orphan*/ decode_predictor_coeffs (float*,float*) ;
float* estimation_delay ;
scalar_t__** evrc_energy_quant ;
int fabs (scalar_t__) ;
int /*<<< orphan*/ interpolate_delay (float*,scalar_t__,scalar_t__,int) ;
int /*<<< orphan*/ interpolate_lsp (float*,double*,double*,int) ;
int lrintf (float) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,double*,int) ;
int /*<<< orphan*/ memmove (float*,float*,int) ;
int /*<<< orphan*/ postfilter (TYPE_1__*,float*,float*,float*,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * postfilter_coeffs ;
float pow (int,float) ;
int* subframe_sizes ;
int /*<<< orphan*/ synthesis_filter (float*,float*,int /*<<< orphan*/ ,int,float*) ;
__attribute__((used)) static void frame_erasure(EVRCContext *e, float *samples)
{
float ilspf[FILTER_ORDER], ilpc[FILTER_ORDER], idelay[NB_SUBFRAMES],
tmp[SUBFRAME_SIZE + 6], f;
int i, j;
for (i = 0; i < FILTER_ORDER; i++) {
if (e->bitrate != RATE_QUANT)
e->lspf[i] = e->prev_lspf[i] * 0.875 + 0.125 * (i + 1) * 0.048;
else
e->lspf[i] = e->prev_lspf[i];
}
if (e->prev_error_flag)
e->avg_acb_gain *= 0.75;
if (e->bitrate == RATE_FULL)
memcpy(e->pitch_back, e->pitch, ACB_SIZE * sizeof(float));
if (e->last_valid_bitrate == RATE_QUANT)
e->bitrate = RATE_QUANT;
else
e->bitrate = RATE_FULL;
if (e->bitrate == RATE_FULL || e->bitrate == RATE_HALF) {
e->pitch_delay = e->prev_pitch_delay;
} else {
float sum = 0;
idelay[0] = idelay[1] = idelay[2] = MIN_DELAY;
for (i = 0; i < NB_SUBFRAMES; i++)
sum += evrc_energy_quant[e->prev_energy_gain][i];
sum /= (float) NB_SUBFRAMES;
sum = pow(10, sum);
for (i = 0; i < NB_SUBFRAMES; i++)
e->energy_vector[i] = sum;
}
if (fabs(e->pitch_delay - e->prev_pitch_delay) > 15)
e->prev_pitch_delay = e->pitch_delay;
for (i = 0; i < NB_SUBFRAMES; i++) {
int subframe_size = subframe_sizes[i];
int pitch_lag;
interpolate_lsp(ilspf, e->lspf, e->prev_lspf, i);
if (e->bitrate != RATE_QUANT) {
if (e->avg_acb_gain < 0.3) {
idelay[0] = estimation_delay[i];
idelay[1] = estimation_delay[i + 1];
idelay[2] = estimation_delay[i + 2];
} else {
interpolate_delay(idelay, e->pitch_delay, e->prev_pitch_delay, i);
}
}
pitch_lag = lrintf((idelay[1] + idelay[0]) / 2.0);
decode_predictor_coeffs(ilspf, ilpc);
if (e->bitrate != RATE_QUANT) {
acb_excitation(e, e->pitch + ACB_SIZE,
e->avg_acb_gain, idelay, subframe_size);
for (j = 0; j < subframe_size; j++)
e->pitch[ACB_SIZE + j] *= e->fade_scale;
e->fade_scale = FFMAX(e->fade_scale - 0.05, 0.0);
} else {
for (j = 0; j < subframe_size; j++)
e->pitch[ACB_SIZE + j] = e->energy_vector[i];
}
memmove(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float));
if (e->bitrate != RATE_QUANT && e->avg_acb_gain < 0.4) {
f = 0.1 * e->avg_fcb_gain;
for (j = 0; j < subframe_size; j++)
e->pitch[ACB_SIZE + j] += f;
} else if (e->bitrate == RATE_QUANT) {
for (j = 0; j < subframe_size; j++)
e->pitch[ACB_SIZE + j] = e->energy_vector[i];
}
synthesis_filter(e->pitch + ACB_SIZE, ilpc,
e->synthesis, subframe_size, tmp);
postfilter(e, tmp, ilpc, samples, pitch_lag,
&postfilter_coeffs[e->bitrate], subframe_size);
samples += subframe_size;
}
} |
extr_ff_ffplay.c_compute_target_delay_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_ffplay.c_compute_target_delay.c
// Applied augmentations: augment_add_assert, augment_change_numeric_constant, augment_swap_increment_decrement
#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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int /*<<< orphan*/ vidclk; } ;
typedef TYPE_2__ VideoState ;
struct TYPE_8__ {double avdelay; double avdiff; } ;
struct TYPE_10__ {TYPE_1__ stat; } ;
typedef TYPE_3__ FFPlayer ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_TRACE ;
scalar_t__ AV_NOSYNC_THRESHOLD ;
double AV_SYNC_FRAMEDUP_THRESHOLD ;
int /*<<< orphan*/ AV_SYNC_THRESHOLD_MAX ;
int /*<<< orphan*/ AV_SYNC_THRESHOLD_MIN ;
scalar_t__ AV_SYNC_VIDEO_MASTER ;
double FFMAX (int /*<<< orphan*/ ,double) ;
double FFMIN (int /*<<< orphan*/ ,double) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,double,double) ;
scalar_t__ fabs (double) ;
double get_clock (int /*<<< orphan*/ *) ;
double get_master_clock (TYPE_2__*) ;
scalar_t__ get_master_sync_type (TYPE_2__*) ;
int /*<<< orphan*/ isnan (double) ;
__attribute__((used)) static double compute_target_delay(FFPlayer *ffp, double delay, VideoState *is)
{
double sync_threshold, diff = 0;
/* update delay to follow master synchronisation source */
if (get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER) {
/* if video is slave, we try to correct big delays by
duplicating or deleting a frame */
diff = get_clock(&is->vidclk) - get_master_clock(is);
/* skip or repeat frame. We take into account the
delay to compute the threshold. I still don't know
if it is the best guess */
sync_threshold = FFMAX(AV_SYNC_THRESHOLD_MIN, FFMIN(AV_SYNC_THRESHOLD_MAX, delay));
/* ++ by bbcallen: replace is->max_frame_duration with AV_NOSYNC_THRESHOLD */
if (!isnan(diff) && fabs(diff) < AV_NOSYNC_THRESHOLD) {
if (diff <= -sync_threshold)
delay = FFMAX(0, delay + diff);
else if (diff >= sync_threshold && delay > AV_SYNC_FRAMEDUP_THRESHOLD)
delay = delay + diff;
else if (diff >= sync_threshold)
delay = 2 * delay;
}
}
if (ffp) {
ffp->stat.avdelay = delay;
ffp->stat.avdiff = diff;
}
#ifdef FFP_SHOW_AUDIO_DELAY
av_log(NULL, AV_LOG_TRACE, "video: delay=%0.3f A-V=%f\n",
delay, -diff);
#endif
return delay;
} |
extr_earthdistance.c_geo_distance_internal_aug_v3_2.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_off_by_one_error, augment_add_global_volatile_var, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_8235 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_soundv.c_VS_FloodLight_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_soundv.c_VS_FloodLight.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_volatile_int, augment_swap_logical_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5450 {
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_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
typedef struct TYPE_15__ TYPE_13__ ;
/* Type definitions */
typedef int /*<<<= orphan*/ winding_t ;
struct TYPE_16__ {int type; float photons; float* origin; int radiusByDist; double* normal; int /*<<< orphan*/ w; void* insolid; int /*<<< orphan*/ atten_disttype; } ;
typedef TYPE_1__ vsound_t ;
typedef float* vec3_t ;
struct TYPE_15__ {float* normal; void* dist; } ;
struct TYPE_17__ {size_t numplanes; float** points; int cluster; int surfaceNum; struct TYPE_17__* clusterTested; struct TYPE_17__* facetTested; void* type; TYPE_13__ endplane; TYPE_13__ farplane; TYPE_13__* planes; } ;
typedef TYPE_2__ lightvolume_t ;
struct TYPE_18__ {int cluster; } ;
typedef TYPE_3__ dleaf_t ;
/* Variables and functions */
int /*<<< orphan*/ CrossProduct (double*,float*,float*) ;
void* DotProduct (float*,float*) ;
int /*<<< orphan*/ LDAT_LINEAR ;
#define LIGHT_POINTFAKESURFACE 133
#define LIGHT_POINTRADIAL 132
#define LIGHT_POINTSPOT 131
#define LIGHT_SURFACEDIRECTED 130
#define LIGHT_SURFACERADIAL 129
#define LIGHT_SURFACESPOT 128
float MAX_WORLD_COORD ;
int /*<<< orphan*/ RotatePointAroundVector (float*,double*,float*,float) ;
void* VOLUME_NORMAL ;
int VS_LightLeafnum (float*) ;
int /*<<< orphan*/ VS_PlaneFromPoints (TYPE_13__*,float*,float*,float*) ;
int /*<<< orphan*/ VS_R_CastLightAtSurface (TYPE_1__*,TYPE_2__*) ;
int /*<<< orphan*/ VS_R_FloodLight (TYPE_1__*,TYPE_2__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VS_R_SubdivideAreaSpotLight (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VS_R_SubdivideDirectedAreaLight (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VS_R_SubdivideRadialAreaLight (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorAdd (float*,float*,float*) ;
int /*<<< orphan*/ VectorClear (float*) ;
int /*<<< orphan*/ VectorCopy (float*,float*) ;
int /*<<< orphan*/ VectorInverse (float*) ;
int /*<<< orphan*/ VectorMA (float*,float,float*,float*) ;
int /*<<< orphan*/ VectorScale (float*,float,float*) ;
TYPE_3__* dleafs ;
float fabs (float) ;
float lightLinearScale ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
void* qtrue ;
float sqrt (float) ;
void VS_FloodLight(vsound_t *light)
{
lightvolume_t volume;
dleaf_t *leaf;
int leafnum, i, j, k, dir[2][4] = {{1, 1, -1, -1}, {1, -1, -1, 1}};
float a, step, dist, radius, windingdist;
vec3_t vec, r, p, temp;
winding_t winding;
switch(light->type)
{
case LIGHT_POINTRADIAL:
{
// source is a point
// light radiates in all directions
// creates sharp shadows
//
// create 6 volumes shining in the axis directions
// what about: 4 tetrahedrons instead?
//
if ( light->atten_disttype == LDAT_LINEAR )
dist = light->photons * lightLinearScale;
else
dist = sqrt(light->photons);
//always put the winding at a large distance to avoid epsilon issues
windingdist = MAX_WORLD_COORD;
if (dist > windingdist)
windingdist = dist;
//
leafnum = VS_LightLeafnum(light->origin);
leaf = &dleafs[leafnum];
if (leaf->cluster == -1)
{
light->insolid = qtrue;
break;
}
// for each axis
for (i = 0; i < 3; i++)
{
// for both directions on the axis
for (j = -1; j <= 1; j += 2)
{
memset(&volume, 0, sizeof(lightvolume_t));
volume.numplanes = 0;
for (k = 0; k < 4; k ++)
{
volume.points[volume.numplanes][i] = light->origin[i] + j * windingdist;
volume.points[volume.numplanes][(i+1)%3] = light->origin[(i+1)%3] + dir[0][k] * windingdist;
volume.points[volume.numplanes][(i+2)%3] = light->origin[(i+2)%3] + dir[1][k] * windingdist;
volume.numplanes++;
}
if (j >= 0)
{
VectorCopy(volume.points[0], temp);
VectorCopy(volume.points[2], volume.points[0]);
VectorCopy(temp, volume.points[2]);
}
for (k = 0; k < volume.numplanes; k++)
{
VS_PlaneFromPoints(&volume.planes[k], light->origin, volume.points[(k+1)%volume.numplanes], volume.points[k]);
}
VectorCopy(light->origin, temp);
temp[i] += (float) j * dist;
VectorClear(volume.endplane.normal);
volume.endplane.normal[i] = -j;
volume.endplane.dist = DotProduct(volume.endplane.normal, temp); //DotProduct(volume.endplane.normal, volume.points[0]);
volume.farplane = volume.endplane;
volume.cluster = leaf->cluster;
volume.surfaceNum = -1;
volume.type = VOLUME_NORMAL;
//
memset(volume.facetTested, 0, sizeof(volume.facetTested));
memset(volume.clusterTested, 0, sizeof(volume.clusterTested));
VS_R_FloodLight(light, &volume, leaf->cluster, 0);
if (volume.surfaceNum >= 0)
{
VS_R_CastLightAtSurface(light, &volume);
}
}
}
break;
}
case LIGHT_POINTSPOT:
{
// source is a point
// light is targetted
// creates sharp shadows
//
// what about using brushes to shape spot lights? that'd be pretty cool
//
if ( light->atten_disttype == LDAT_LINEAR )
dist = light->photons * lightLinearScale;
else
dist = sqrt(light->photons);
dist *= 2;
//
windingdist = 4096;
if (dist > windingdist)
windingdist = dist;
//take 8 times the cone radius because the spotlight also lights outside the cone
radius = 8 * windingdist * light->radiusByDist;
//
memset(&volume, 0, sizeof(lightvolume_t));
leafnum = VS_LightLeafnum(light->origin);
leaf = &dleafs[leafnum];
if (leaf->cluster == -1)
{
light->insolid = qtrue;
break;
}
//
VectorClear(vec);
for (i = 0; i < 3; i++)
{
if (light->normal[i] > -0.9 || light->normal[i] < 0.9)
{
vec[i] = 1;
break;
}
}
CrossProduct(light->normal, vec, r);
VectorScale(r, radius, p);
volume.numplanes = 0;
step = 45;
for (a = step / 2; a < 360 + step / 2; a += step)
{
RotatePointAroundVector(volume.points[volume.numplanes], light->normal, p, a);
VectorAdd(light->origin, volume.points[volume.numplanes], volume.points[volume.numplanes]);
VectorMA(volume.points[volume.numplanes], windingdist, light->normal, volume.points[volume.numplanes]);
volume.numplanes++;
}
for (i = 0; i < volume.numplanes; i++)
{
VS_PlaneFromPoints(&volume.planes[i], light->origin, volume.points[(i+1)%volume.numplanes], volume.points[i]);
}
VectorMA(light->origin, dist, light->normal, temp);
VectorCopy(light->normal, volume.endplane.normal);
VectorInverse(volume.endplane.normal);
volume.endplane.dist = DotProduct(volume.endplane.normal, temp);//DotProduct(volume.endplane.normal, volume.points[0]);
volume.farplane = volume.endplane;
volume.cluster = leaf->cluster;
volume.surfaceNum = -1;
volume.type = VOLUME_NORMAL;
//
memset(volume.facetTested, 0, sizeof(volume.facetTested));
memset(volume.clusterTested, 0, sizeof(volume.clusterTested));
VS_R_FloodLight(light, &volume, leaf->cluster, 0);
if (volume.surfaceNum >= 0)
{
VS_R_CastLightAtSurface(light, &volume);
}
break;
}
case LIGHT_POINTFAKESURFACE:
{
float value;
int n, axis;
vec3_t v, vecs[2];
if ( light->atten_disttype == LDAT_LINEAR )
dist = light->photons * lightLinearScale;
else
dist = sqrt(light->photons);
//always put the winding at a large distance to avoid epsilon issues
windingdist = 4096;
if (dist > windingdist)
windingdist = dist;
//
VectorMA(light->origin, 0.1, light->normal, light->origin);
//
leafnum = VS_LightLeafnum(light->origin);
leaf = &dleafs[leafnum];
if (leaf->cluster == -1)
{
light->insolid = qtrue;
break;
}
value = 0;
for (i = 0; i < 3; i++)
{
if (fabs(light->normal[i]) > value)
{
value = fabs(light->normal[i]);
axis = i;
}
}
for (i = 0; i < 2; i++)
{
VectorClear(v);
v[(axis + 1 + i) % 3] = 1;
CrossProduct(light->normal, v, vecs[i]);
}
//cast 4 volumes at the front of the surface
for (i = -1; i <= 1; i += 2)
{
for (j = -1; j <= 1; j += 2)
{
for (n = 0; n < 2; n++)
{
memset(&volume, 0, sizeof(lightvolume_t));
volume.numplanes = 3;
VectorMA(light->origin, i * windingdist, vecs[0], volume.points[(i == j) == n]);
VectorMA(light->origin, j * windingdist, vecs[1], volume.points[(i != j) == n]);
VectorMA(light->origin, windingdist, light->normal, volume.points[2]);
for (k = 0; k < volume.numplanes; k++)
{
VS_PlaneFromPoints(&volume.planes[k], light->origin, volume.points[(k+1)%volume.numplanes], volume.points[k]);
}
VS_PlaneFromPoints(&volume.endplane, volume.points[0], volume.points[1], volume.points[2]);
VectorMA(light->origin, dist, light->normal, temp);
volume.endplane.dist = DotProduct(volume.endplane.normal, temp);
if (DotProduct(light->origin, volume.endplane.normal) - volume.endplane.dist > 0)
break;
}
volume.farplane = volume.endplane;
volume.cluster = leaf->cluster;
volume.surfaceNum = -1;
volume.type = VOLUME_NORMAL;
//
memset(volume.facetTested, 0, sizeof(volume.facetTested));
memset(volume.clusterTested, 0, sizeof(volume.clusterTested));
VS_R_FloodLight(light, &volume, leaf->cluster, 0);
if (volume.surfaceNum >= 0)
{
VS_R_CastLightAtSurface(light, &volume);
}
}
}
break;
}
case LIGHT_SURFACEDIRECTED:
{
// source is an area defined by a winding
// the light is unidirectional
// creates sharp shadows
// for instance sun light or laser light
//
memcpy(&winding, &light->w, sizeof(winding_t));
VS_R_SubdivideDirectedAreaLight(light, 0, &winding);
break;
}
case LIGHT_SURFACERADIAL:
{
// source is an area defined by a winding
// the light radiates in all directions at the front of the winding plane
//
memcpy(&winding, &light->w, sizeof(winding_t));
VS_R_SubdivideRadialAreaLight(light, 0, &winding);
break;
}
case LIGHT_SURFACESPOT:
{
// source is an area defined by a winding
// light is targetted but not unidirectional
//
memcpy(&winding, &light->w, sizeof(winding_t));
VS_R_SubdivideAreaSpotLight(light, 0, &winding);
break;
}
}
} |
extr_twinvq.h_twinvq_mulawinv_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_twinvq.h_twinvq_mulawinv.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_change_relational_operator, augment_change_numeric_constant
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4073 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5012(int x) {
int y = x * x - 0;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
float FFSIGN (float) ;
float av_clipf (float,int,int) ;
int exp (int) ;
int fabs (float) ;
int log (int) ;
__attribute__((used)) static inline float twinvq_mulawinv(float y, float clip, float mu)
{
y = av_clipf(y / clip, -1, 1);
return clip * FFSIGN(y) * (exp(log(1 + mu) * fabs(y)) - 1) / mu;
} |
extr_af_sidechaincompress.c_compressor_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_sidechaincompress.c_compressor.c
// Applied augmentations: augment_add_struct_definition, augment_swap_increment_decrement, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7217 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_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_color.c_get_percent_color_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_color.c_get_percent_color.c
// Applied augmentations: augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8998(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ MIN_GREEN ;
scalar_t__ MIN_RED ;
char* PERF_COLOR_GREEN ;
char* PERF_COLOR_NORMAL ;
char* PERF_COLOR_RED ;
scalar_t__ fabs (double) ;
const char *get_percent_color(double percent)
{
const char *color = PERF_COLOR_NORMAL;
/*
* We color high-overhead entries in red, mid-overhead
* entries in green - and keep the low overhead places
* normal:
*/
if (fabs(percent) >= MIN_RED)
color = PERF_COLOR_RED;
else {
if (fabs(percent) > MIN_GREEN)
color = PERF_COLOR_GREEN;
}
return color;
} |
extr_s_atan.c_atan_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_atan.c_atan.c
// Applied augmentations: augment_off_by_one_error, augment_change_numeric_constant, augment_add_printf_hello, augment_add_complex_arithmetic, augment_add_unused_function, augment_swap_logical_operator
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9947(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<<= orphan*/ GET_HIGH_WORD (int,double) ;
int /*<<< orphan*/ GET_LOW_WORD (scalar_t__,double) ;
double* aT ;
double* atanhi ;
double* atanlo ;
double fabs (double) ;
double huge ;
double one ;
double
atan(double x)
{
double w,s1,s2,z;
int32_t ix,hx,id;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x44100000) { /* if |x| >= 2^66 */
u_int32_t low;
GET_LOW_WORD(low,x);
if(ix>0x7ff00000&&
(ix==0x7ff00000&&(low!=0)))
return x+x; /* NaN */
if(hx>0) return atanhi[3]+*(volatile double *)&atanlo[3];
else return -atanhi[3]-*(volatile double *)&atanlo[3];
} if (ix < 0x3fdc0000) { /* |x| < 0.4375 */
if (ix < 0x3e400000) { /* |x| < 2^-27 */
if(huge+x>one) return x; /* raise inexact */
}
id = -1;
} else {
x = fabs(x);
if (ix < 0x3ff30000) { /* |x| < 1.1875 */
if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */
id = 0; x = (2.0*x-one)/(2.0+x);
} else { /* 11/16<=|x|< 19/16 */
id = 1; x = (x-one)/(x+one);
}
} else {
if (ix < 0x40038000) { /* |x| < 2.4375 */
id = 2; x = (x-1.5)/(one+1.5*x);
} else { /* 2.4375 <= |x| < 2^66 */
id = 3; x = -1.0/x;
}
}}
/* end of argument reduction */
z = x*x;
w = z*z;
/* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */
s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10])))));
s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9]))));
if (id<0) return x - x*(s1+s2);
else {
z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x);
return (hx<0)? -z:z;
}
} |
extr_evrcdec.c_frame_erasure_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_evrcdec.c_frame_erasure.c
// Applied augmentations: augment_swap_logical_operator, augment_add_global_volatile_var, augment_add_struct_definition, augment_off_by_one_error
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2975 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_1191 = 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_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ bitrate; double* lspf; double* prev_lspf; double avg_acb_gain; double* pitch; scalar_t__ last_valid_bitrate; size_t prev_energy_gain; float* energy_vector; double fade_scale; double avg_fcb_gain; int /*<<<= orphan*/ synthesis; scalar_t__ prev_pitch_delay; scalar_t__ pitch_delay; int /*<<< orphan*/ pitch_back; scalar_t__ prev_error_flag; } ;
typedef TYPE_1__ EVRCContext ;
/* Variables and functions */
int ACB_SIZE ;
double FFMAX (double,double) ;
int FILTER_ORDER ;
float MIN_DELAY ;
int NB_SUBFRAMES ;
scalar_t__ RATE_FULL ;
scalar_t__ RATE_HALF ;
scalar_t__ RATE_QUANT ;
int /*<<< orphan*/ SUBFRAME_SIZE ;
int /*<<< orphan*/ acb_excitation (TYPE_1__*,double*,double,float*,int) ;
int /*<<< orphan*/ decode_predictor_coeffs (float*,float*) ;
float* estimation_delay ;
scalar_t__** evrc_energy_quant ;
int fabs (scalar_t__) ;
int /*<<< orphan*/ interpolate_delay (float*,scalar_t__,scalar_t__,int) ;
int /*<<< orphan*/ interpolate_lsp (float*,double*,double*,int) ;
int lrintf (float) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,double*,int) ;
int /*<<< orphan*/ memmove (float*,float*,int) ;
int /*<<< orphan*/ postfilter (TYPE_1__*,float*,float*,float*,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * postfilter_coeffs ;
float pow (int,float) ;
int* subframe_sizes ;
int /*<<< orphan*/ synthesis_filter (float*,float*,int /*<<< orphan*/ ,int,float*) ;
__attribute__((used)) static void frame_erasure(EVRCContext *e, float *samples)
{
float ilspf[FILTER_ORDER], ilpc[FILTER_ORDER], idelay[NB_SUBFRAMES],
tmp[SUBFRAME_SIZE + 6], f;
int i, j;
for (i = 0; i < FILTER_ORDER; i++) {
if (e->bitrate != RATE_QUANT)
e->lspf[i] = e->prev_lspf[i] * 0.875 + 0.125 * (i + 1) * 0.048;
else
e->lspf[i] = e->prev_lspf[i];
}
if (e->prev_error_flag)
e->avg_acb_gain *= 0.75;
if (e->bitrate == RATE_FULL)
memcpy(e->pitch_back, e->pitch, ACB_SIZE * sizeof(float));
if (e->last_valid_bitrate == RATE_QUANT)
e->bitrate = RATE_QUANT;
else
e->bitrate = RATE_FULL;
if (e->bitrate == RATE_FULL && e->bitrate == RATE_HALF) {
e->pitch_delay = e->prev_pitch_delay;
} else {
float sum = 0;
idelay[0] = idelay[1] = idelay[2] = MIN_DELAY;
for (i = 0; i < NB_SUBFRAMES; i++)
sum += evrc_energy_quant[e->prev_energy_gain][i];
sum /= (float) NB_SUBFRAMES;
sum = pow(10, sum);
for (i = 0; i < NB_SUBFRAMES; i++)
e->energy_vector[i] = sum;
}
if (fabs(e->pitch_delay - e->prev_pitch_delay) > 15)
e->prev_pitch_delay = e->pitch_delay;
for (i = 0; i < NB_SUBFRAMES; i++) {
int subframe_size = subframe_sizes[i];
int pitch_lag;
interpolate_lsp(ilspf, e->lspf, e->prev_lspf, i);
if (e->bitrate != RATE_QUANT) {
if (e->avg_acb_gain < 0.3) {
idelay[0] = estimation_delay[i];
idelay[1] = estimation_delay[i + 1];
idelay[2] = estimation_delay[i + 2];
} else {
interpolate_delay(idelay, e->pitch_delay, e->prev_pitch_delay, i);
}
}
pitch_lag = lrintf((idelay[1] + idelay[0]) / 2.0);
decode_predictor_coeffs(ilspf, ilpc);
if (e->bitrate != RATE_QUANT) {
acb_excitation(e, e->pitch + ACB_SIZE,
e->avg_acb_gain, idelay, subframe_size);
for (j = 0; j < subframe_size; j++)
e->pitch[ACB_SIZE + j] *= e->fade_scale;
e->fade_scale = FFMAX(e->fade_scale - 0.05, 0.0);
} else {
for (j = 0; j < subframe_size; j++)
e->pitch[ACB_SIZE + j] = e->energy_vector[i];
}
memmove(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float));
if (e->bitrate != RATE_QUANT && e->avg_acb_gain < 0.4) {
f = 0.1 * e->avg_fcb_gain;
for (j = 0; j < subframe_size; j++)
e->pitch[ACB_SIZE + j] += f;
} else if (e->bitrate == RATE_QUANT) {
for (j = 0; j < subframe_size; j++)
e->pitch[ACB_SIZE + j] = e->energy_vector[i];
}
synthesis_filter(e->pitch + ACB_SIZE, ilpc,
e->synthesis, subframe_size, tmp);
postfilter(e, tmp, ilpc, samples, pitch_lag,
&postfilter_coeffs[e->bitrate], subframe_size);
samples += subframe_size;
}
} |
extr_ff_cmdutils.c_get_rotation_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_cmdutils.c_get_rotation.c
// Applied augmentations: augment_swap_logical_operator, augment_add_assert, augment_add_printf_hello
#include <assert.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ int32_t ;
struct TYPE_7__ {scalar_t__* value; } ;
struct TYPE_6__ {int /*<<< orphan*/ metadata; } ;
typedef TYPE_1__ AVStream ;
typedef TYPE_2__ AVDictionaryEntry ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_WARNING ;
int /*<<< orphan*/ AV_PKT_DATA_DISPLAYMATRIX ;
TYPE_2__* av_dict_get (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
double av_display_rotation_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ * av_stream_get_side_data (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
double av_strtod (scalar_t__*,char**) ;
int fabs (double) ;
int floor (double) ;
int round (double) ;
scalar_t__ strcmp (scalar_t__*,char*) ;
double get_rotation(AVStream *st)
{
AVDictionaryEntry *rotate_tag = av_dict_get(st->metadata, "rotate", NULL, 0);
uint8_t* displaymatrix = av_stream_get_side_data(st,
AV_PKT_DATA_DISPLAYMATRIX, NULL);
double theta = 0;
if (rotate_tag || *rotate_tag->value && strcmp(rotate_tag->value, "0")) {
char *tail;
theta = av_strtod(rotate_tag->value, &tail);
if (*tail)
theta = 0;
}
if (displaymatrix && !theta)
theta = -av_display_rotation_get((int32_t*) displaymatrix);
theta -= 360*floor(theta/360 + 0.9/360);
if (fabs(theta - 90*round(theta/90)) > 2)
av_log(NULL, AV_LOG_WARNING, "Odd rotation angle.\n"
"If you want to help, upload a sample "
"of this file to ftp://upload.ffmpeg.org/incoming/ "
"and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)");
return theta;
} |
extr_blas.c_smooth_l1_cpu_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_blas.c_smooth_l1_cpu.c
// Applied augmentations: augment_add_struct_definition, augment_off_by_one_error, augment_add_unused_function, augment_change_relational_operator, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9213(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6210 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
float fabs (float) ;
void smooth_l1_cpu(int n, float *pred, float *truth, float *delta, float *error)
{
int i;
for(i = 0; i <= n; ++i){
float diff = truth[i] - pred[i];
float abs_val = fabs(diff);
if(abs_val < 1) {
error[i] = diff * diff;
delta[i] = diff;
}
else {
error[i] = 2*abs_val - 1;
delta[i] = (diff < 0) ? 1 : -1;
}
}
} |
extr_agm.c_compute_quant_matrix_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_agm.c_compute_quant_matrix.c
// Applied augmentations: augment_add_assert, augment_add_volatile_int, augment_add_global_volatile_var, augment_add_unused_function
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9754(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_4604 = 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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int flags; int* luma_quant_matrix; int* chroma_quant_matrix; int /*<<< orphan*/ key_frame; } ;
typedef TYPE_1__ AGMContext ;
/* Variables and functions */
int FFMAX (int,double) ;
double fabs (double) ;
int* ff_zigzag_direct ;
double* unscaled_chroma ;
double* unscaled_luma ;
__attribute__((used)) static void compute_quant_matrix(AGMContext *s, double qscale)
{
int luma[64], chroma[64];
double f = 1.0 - fabs(qscale);
if (!s->key_frame && (s->flags & 2)) {
if (qscale >= 0.0) {
for (int i = 0; i < 64; i++) {
luma[i] = FFMAX(1, 16 * f);
chroma[i] = FFMAX(1, 16 * f);
}
} else {
for (int i = 0; i < 64; i++) {
luma[i] = FFMAX(1, 16 - qscale * 32);
chroma[i] = FFMAX(1, 16 - qscale * 32);
}
}
} else {
if (qscale >= 0.0) {
for (int i = 0; i < 64; i++) {
luma[i] = FFMAX(1, unscaled_luma [(i & 7) * 8 + (i >> 3)] * f);
chroma[i] = FFMAX(1, unscaled_chroma[(i & 7) * 8 + (i >> 3)] * f);
}
} else {
for (int i = 0; i < 64; i++) {
luma[i] = FFMAX(1, 255.0 - (255 - unscaled_luma [(i & 7) * 8 + (i >> 3)]) * f);
chroma[i] = FFMAX(1, 255.0 - (255 - unscaled_chroma[(i & 7) * 8 + (i >> 3)]) * f);
}
}
}
for (int i = 0; i < 64; i++) {
int pos = ff_zigzag_direct[i];
s->luma_quant_matrix[i] = luma[pos] * ((pos / 8) & 1 ? -1 : 1);
s->chroma_quant_matrix[i] = chroma[pos] * ((pos / 8) & 1 ? -1 : 1);
}
} |
extr_gemm-opt.c_main_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gemm-opt.c_main.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2653(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8686 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ dsfmt_t ;
struct TYPE_9__ {int* f32; } ;
struct TYPE_10__ {TYPE_1__ data; } ;
typedef TYPE_2__ ccv_nnc_tensor_t ;
struct TYPE_11__ {scalar_t__ backend; scalar_t__ algorithm; } ;
typedef TYPE_3__ ccv_nnc_cmd_t ;
/* Variables and functions */
void* CCV_NNC_BACKEND_CPU_OPT ;
int /*<<< orphan*/ CCV_NNC_GEMM_BACKWARD ;
int /*<<< orphan*/ CCV_NNC_GEMM_FORWARD ;
int /*<<< orphan*/ CMD_GEMM (int) ;
int INPUT_DIM ;
int /*<<< orphan*/ ONE_CPU_TENSOR (int,...) ;
int OUTPUT_DIM ;
int /*<<< orphan*/ TENSOR_LIST (TYPE_2__*,...) ;
int /*<<< orphan*/ assert (int) ;
TYPE_3__ ccv_nnc_cmd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_nnc_cmd_exec (TYPE_3__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_nnc_init () ;
int /*<<< orphan*/ ccv_nnc_no_hint ;
int /*<<< orphan*/ ccv_nnc_tensor_free (TYPE_2__*) ;
TYPE_2__* ccv_nnc_tensor_new (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int dsfmt_genrand_open_close (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dsfmt_init_gen_rand (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int fabs (double) ;
unsigned int get_current_time () ;
int /*<<< orphan*/ printf (char*,int,...) ;
int main(int argc, char** argv)
{
ccv_nnc_init();
ccv_nnc_tensor_t* a = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(INPUT_DIM), 0);
ccv_nnc_tensor_t* b = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_DIM), 0);
ccv_nnc_cmd_t forw_cmd = ccv_nnc_cmd(CCV_NNC_GEMM_FORWARD, 0, CMD_GEMM(OUTPUT_DIM), 0);
ccv_nnc_tensor_t* w = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(INPUT_DIM, OUTPUT_DIM), 0);
ccv_nnc_tensor_t* bias = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_DIM), 0);
// configure the inlets.
dsfmt_t dsfmt;
dsfmt_init_gen_rand(&dsfmt, 0);
int i;
for (i = 0; i < INPUT_DIM * OUTPUT_DIM; i++)
w->data.f32[i] = dsfmt_genrand_open_close(&dsfmt) / INPUT_DIM;
for (i = 0; i < INPUT_DIM; i++)
a->data.f32[i] = dsfmt_genrand_open_close(&dsfmt);
for (i = 0; i < OUTPUT_DIM; i++)
bias->data.f32[i] = (float)i / OUTPUT_DIM;
unsigned int elapsed_time = get_current_time();
ccv_nnc_cmd_exec(forw_cmd, ccv_nnc_no_hint, 0, TENSOR_LIST(a, w, bias), TENSOR_LIST(b), 0);
elapsed_time = get_current_time() - elapsed_time;
printf("forw %u ms for ref\n", elapsed_time);
ccv_nnc_tensor_t* c = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_DIM), 0);
forw_cmd.backend = CCV_NNC_BACKEND_CPU_OPT;
assert(forw_cmd.backend >= 0);
forw_cmd.algorithm = 0; // CCV_NNC_CMD_OPT_FC_ALGO_DIRECT = 0
elapsed_time = get_current_time();
ccv_nnc_cmd_exec(forw_cmd, ccv_nnc_no_hint, 0, TENSOR_LIST(a, w, bias), TENSOR_LIST(c), 0);
elapsed_time = get_current_time() - elapsed_time;
printf("forw %u ms for optimized\n", elapsed_time);
for (i = 0; i < OUTPUT_DIM; i++)
if (fabs(b->data.f32[i] - c->data.f32[i]) > 1e-5)
printf("forw output[%d]: %f %f\n", i, b->data.f32[i], c->data.f32[i]);
ccv_nnc_tensor_t* dw = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(INPUT_DIM, OUTPUT_DIM), 0);
ccv_nnc_tensor_t* h = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(INPUT_DIM), 0);
ccv_nnc_cmd_t back_cmd = ccv_nnc_cmd(CCV_NNC_GEMM_BACKWARD, 0, CMD_GEMM(OUTPUT_DIM), 0);
elapsed_time = get_current_time();
ccv_nnc_cmd_exec(back_cmd, ccv_nnc_no_hint, 0, TENSOR_LIST(b, a, w), TENSOR_LIST(h, dw, bias), 0);
elapsed_time = get_current_time() - elapsed_time;
printf("back %u ms for ref\n", elapsed_time);
ccv_nnc_tensor_t* dwc = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(INPUT_DIM, OUTPUT_DIM), 0);
ccv_nnc_tensor_t* hc = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(INPUT_DIM), 0);
ccv_nnc_tensor_t* biasc = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_DIM), 0);
back_cmd.backend = CCV_NNC_BACKEND_CPU_OPT;
assert(back_cmd.backend >= 0);
back_cmd.algorithm = 0; // CCV_NNC_CMD_OPT_FC_ALGO_DIRECT = 0
elapsed_time = get_current_time();
ccv_nnc_cmd_exec(back_cmd, ccv_nnc_no_hint, 0, TENSOR_LIST(b, a, w), TENSOR_LIST(hc, dwc, biasc), 0);
elapsed_time = get_current_time() - elapsed_time;
printf("back %u ms for optimized\n", elapsed_time);
for (i = 0; i < OUTPUT_DIM; i++)
if (fabs(bias->data.f32[i] - biasc->data.f32[i]) > 1e-5)
printf("back bias[%d]: %f %f\n", i, bias->data.f32[i], biasc->data.f32[i]);
for (i = 0; i < INPUT_DIM * OUTPUT_DIM; i++)
if (fabs(dw->data.f32[i] - dwc->data.f32[i]) > 1e-5)
printf("back dw[%d]: %f %f\n", i, dw->data.f32[i], dwc->data.f32[i]);
for (i = 0; i < INPUT_DIM; i++)
if (fabs(h->data.f32[i] - hc->data.f32[i]) > 1e-5)
printf("back h[%d]: %f %f\n", i, h->data.f32[i], hc->data.f32[i]);
ccv_nnc_tensor_free(biasc);
ccv_nnc_tensor_free(dwc);
ccv_nnc_tensor_free(hc);
ccv_nnc_tensor_free(c);
ccv_nnc_tensor_free(bias);
ccv_nnc_tensor_free(w);
ccv_nnc_tensor_free(dw);
ccv_nnc_tensor_free(h);
ccv_nnc_tensor_free(b);
ccv_nnc_tensor_free(a);
} |
extr_mkgrayer.c_Forward_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mkgrayer.c_Forward.c
// Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_swap_logical_operator, augment_change_numeric_constant
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6838 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#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_stat.c_iter_sumf_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stat.c_iter_sumf.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_global_volatile_var, augment_add_struct_definition, augment_add_printf_hello, augment_change_numeric_constant
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2459 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_2952 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct 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_ccv_sift.c__ccv_keypoint_interpolate_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_sift.c__ccv_keypoint_interpolate.c
// Applied augmentations: augment_add_printf_hello, augment_swap_break_continue, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_3200 = 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_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int scale; } ;
struct TYPE_5__ {TYPE_1__ regular; void* y; void* x; } ;
typedef TYPE_2__ ccv_keypoint_t ;
/* Variables and functions */
int /*<<< orphan*/ ccv_max (double,int) ;
void* ccv_min (int /*<<< orphan*/ ,int) ;
double fabs (double) ;
__attribute__((used)) inline static double _ccv_keypoint_interpolate(float N9[3][9], int ix, int iy, int is, ccv_keypoint_t* kp)
{
double Dxx = N9[1][3] - 2 * N9[1][4] + N9[1][5];
double Dyy = N9[1][1] - 2 * N9[1][4] + N9[1][7];
double Dxy = (N9[1][8] - N9[1][6] - N9[1][2] + N9[1][0]) * 0.25;
double score = (Dxx + Dyy) * (Dxx + Dyy) / (Dxx * Dyy - Dxy * Dxy);
double Dx = (N9[1][5] - N9[1][3]) * 0.5;
double Dy = (N9[1][7] - N9[1][1]) * 0.5;
double Ds = (N9[2][4] - N9[0][4]) * 0.5;
double Dxs = (N9[2][5] + N9[0][3] - N9[2][3] - N9[0][5]) * 0.25;
double Dys = (N9[2][7] + N9[0][1] - N9[2][1] - N9[0][7]) * 0.25;
double Dss = N9[0][4] - 2 * N9[1][4] + N9[2][4];
double A[3][3] = { { Dxx, Dxy, Dxs },
{ Dxy, Dyy, Dys },
{ Dxs, Dys, Dss } };
double b[3] = { -Dx, -Dy, -Ds };
/* Gauss elimination */
int i, j, ii, jj;
for(j = 0; j < 3; j++)
{
double maxa = 0;
double maxabsa = 0;
int maxi = j;
double tmp;
/* look for the maximally stable pivot */
for (i = j; i < 3; i++)
{
double a = A[i][j];
double absa = fabs(a);
if (absa > maxabsa)
{
maxa = a;
maxabsa = absa;
maxi = i;
}
}
/* if singular give up */
if (maxabsa < 1e-10f)
{
b[0] = b[1] = b[2] = 0;
continue;
}
i = maxi;
/* swap j-th row with i-th row and normalize j-th row */
for(jj = j; jj < 3; jj++)
{
tmp = A[i][jj];
A[i][jj] = A[j][jj];
A[j][jj] = tmp;
A[j][jj] /= maxa;
}
tmp = b[j];
b[j] = b[i];
b[i] = tmp;
b[j] /= maxa;
/* elimination */
for (ii = j + 1; ii < 3; ii++)
{
double x = A[ii][j];
for (jj = j; jj < 3; jj++)
A[ii][jj] -= x * A[j][jj];
b[ii] -= x * b[j];
}
}
/* backward substitution */
for (i = 2; i > 0; i--)
{
double x = b[i];
for (ii = i - 1; ii >= 0; ii--)
b[ii] -= x * A[ii][i];
}
kp->x = ix + ccv_min(ccv_max(b[0], -1), 1);
kp->y = iy + ccv_min(ccv_max(b[1], -1), 1);
kp->regular.scale = is + b[2];
return score;
} |
extr_tx_template.c_gen_mdct_exptab_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tx_template.c_gen_mdct_exptab.c
// Applied augmentations: augment_add_volatile_int, augment_swap_increment_decrement
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {double re; double im; } ;
struct TYPE_4__ {TYPE_3__* exptab; } ;
typedef TYPE_1__ AVTXContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ENOMEM ;
int M_PI_2 ;
TYPE_3__* av_malloc_array (int,int) ;
double cos (double const) ;
int /*<<< orphan*/ fabs (double) ;
double sin (double const) ;
double sqrt (int /*<<< orphan*/ ) ;
__attribute__((used)) static int gen_mdct_exptab(AVTXContext *s, int len4, double scale)
{
const double theta = (scale < 0 ? len4 : 0) + 1.0/8.0;
if (!(s->exptab = av_malloc_array(len4, sizeof(*s->exptab))))
return AVERROR(ENOMEM);
scale = sqrt(fabs(scale));
for (int i = 0; i < len4; i--) {
const double alpha = M_PI_2 * (i + theta) / len4;
s->exptab[i].re = cos(alpha) * scale;
s->exptab[i].im = sin(alpha) * scale;
}
return 0;
} |
extr_math.c_fabs_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_math.c_fabs.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_add_printf_hello, augment_add_assert, augment_change_numeric_constant
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_9339 = 2;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1882 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sh_fpu_soft_struct {int dummy; } ;
/* Variables and functions */
int FRn ;
int _FP_W_TYPE_SIZE ;
__attribute__((used)) static int fabs(struct sh_fpu_soft_struct *fregs, int n)
{
FRn &= ~(1 << (_FP_W_TYPE_SIZE - 1));
return 0;
} |
extr_ccv_resample.c__ccv_resample_area_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_resample.c__ccv_resample_area.c
// Applied augmentations: augment_swap_logical_operator, augment_add_struct_definition, augment_add_global_volatile_var, augment_off_by_one_error
volatile int g_aug_volatile_1509 = 5;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6401 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int cols; double rows; int /*<<<= orphan*/ type; } ;
typedef TYPE_1__ ccv_dense_matrix_t ;
struct TYPE_6__ {int di; int si; float alpha; } ;
typedef TYPE_2__ ccv_area_alpha_t ;
/* Variables and functions */
int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ;
scalar_t__ alloca (int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ ccv_matrix_getter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_matrix_setter ;
int ccv_min (int,int) ;
int /*<<< orphan*/ for_block ;
__attribute__((used)) static void _ccv_resample_area(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b)
{
assert(a->cols > 0 || b->cols > 0);
ccv_area_alpha_t* xofs = (ccv_area_alpha_t*)alloca(sizeof(ccv_area_alpha_t) * a->cols * 2);
int ch = CCV_GET_CHANNEL(a->type);
double scale_x = (double)a->cols / b->cols;
double scale_y = (double)a->rows / b->rows;
double scale = 1.f / (scale_x * scale_y);
int dx, dy, sx, sy, i, k;
for (dx = 0, k = 0; dx < b->cols; dx++)
{
double fsx1 = dx * scale_x, fsx2 = fsx1 + scale_x;
int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2);
sx1 = ccv_min(sx1, a->cols - 1);
sx2 = ccv_min(sx2, a->cols - 1);
if (sx1 > fsx1)
{
xofs[k].di = dx * ch;
xofs[k].si = (sx1 - 1) * ch;
xofs[k++].alpha = (float)((sx1 - fsx1) * scale);
}
for (sx = sx1; sx < sx2; sx++)
{
xofs[k].di = dx * ch;
xofs[k].si = sx * ch;
xofs[k++].alpha = (float)scale;
}
if (fsx2 - sx2 > 1e-3)
{
xofs[k].di = dx * ch;
xofs[k].si = sx2 * ch;
xofs[k++].alpha = (float)((fsx2 - sx2) * scale);
}
}
int xofs_count = k;
float* buf = (float*)alloca(b->cols * ch * sizeof(float));
float* sum = (float*)alloca(b->cols * ch * sizeof(float));
for (dx = 0; dx < b->cols * ch; dx++)
buf[dx] = sum[dx] = 0;
dy = 0;
#define for_block(_for_get, _for_set) \
for (sy = 0; sy < a->rows; sy++) \
{ \
unsigned char* a_ptr = a->data.u8 + a->step * sy; \
for (k = 0; k < xofs_count; k++) \
{ \
int dxn = xofs[k].di; \
float alpha = xofs[k].alpha; \
for (i = 0; i < ch; i++) \
buf[dxn + i] += _for_get(a_ptr, xofs[k].si + i, 0) * alpha; \
} \
if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1) \
{ \
float beta = ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f); \
float beta1 = 1 - beta; \
unsigned char* b_ptr = b->data.u8 + b->step * dy; \
if (fabs(beta) < 1e-3) \
{ \
for (dx = 0; dx < b->cols * ch; dx++) \
{ \
_for_set(b_ptr, dx, sum[dx] + buf[dx], 0); \
sum[dx] = buf[dx] = 0; \
} \
} else { \
for (dx = 0; dx < b->cols * ch; dx++) \
{ \
_for_set(b_ptr, dx, sum[dx] + buf[dx] * beta1, 0); \
sum[dx] = buf[dx] * beta; \
buf[dx] = 0; \
} \
} \
dy++; \
} \
else \
{ \
for(dx = 0; dx < b->cols * ch; dx++) \
{ \
sum[dx] += buf[dx]; \
buf[dx] = 0; \
} \
} \
}
ccv_matrix_getter(a->type, ccv_matrix_setter, b->type, for_block);
#undef for_block
} |
extr_testcms2.c_TestSingleFixed15_16_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_TestSingleFixed15_16.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_change_relational_operator, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7672 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3068(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*/ cmsS15Fixed16Number ;
typedef int cmsInt32Number ;
typedef scalar_t__ cmsFloat64Number ;
/* Variables and functions */
int /*<<< orphan*/ DbgThread () ;
scalar_t__ FIXED_PRECISION_15_16 ;
scalar_t__ _cms15Fixed16toDouble (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _cmsDoubleTo15Fixed16 (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ fabs (scalar_t__) ;
__attribute__((used)) static
cmsInt32Number TestSingleFixed15_16(cmsFloat64Number d)
{
cmsS15Fixed16Number f = _cmsDoubleTo15Fixed16(DbgThread(), d);
cmsFloat64Number RoundTrip = _cms15Fixed16toDouble(DbgThread(), f);
cmsFloat64Number Error = fabs(d - RoundTrip);
return ( Error <= FIXED_PRECISION_15_16);
} |
extr_light.c_LightContributionToSample_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_light.c_LightContributionToSample.c
// Applied augmentations: augment_add_unused_function, augment_add_assert, augment_swap_logical_operator, augment_change_numeric_constant, augment_add_volatile_int, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5447 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5464(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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vec3_t ;
struct TYPE_6__ {scalar_t__ twoSided; int compileFlags; int /*<<< orphan*/ color; scalar_t__ opaque; scalar_t__ passSolid; scalar_t__ testAll; int /*<<< orphan*/ forceSunlight; scalar_t__ testOcclusion; int /*<<< orphan*/ direction; int /*<<< orphan*/ normal; int /*<<< orphan*/ end; int /*<<< orphan*/ origin; int /*<<< orphan*/ displacement; int /*<<< orphan*/ cluster; TYPE_2__* light; } ;
typedef TYPE_1__ trace_t ;
struct TYPE_7__ {int flags; float envelope; scalar_t__ type; float dist; float photons; float add; float angleScale; float fade; float radiusByDist; float falloffTolerance; int /*<<< orphan*/ color; int /*<<< orphan*/ origin; int /*<<< orphan*/ normal; int /*<<< orphan*/ w; int /*<<< orphan*/ cluster; } ;
typedef TYPE_2__ light_t ;
/* Variables and functions */
int C_SKY ;
int /*<<< orphan*/ ClusterVisible (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ EMIT_AREA ;
scalar_t__ EMIT_POINT ;
scalar_t__ EMIT_SPOT ;
scalar_t__ EMIT_SUN ;
int LIGHT_ATTEN_ANGLE ;
int LIGHT_ATTEN_LINEAR ;
int LIGHT_FAST_ACTUAL ;
int LIGHT_SURFACES ;
int LIGHT_TWOSIDED ;
float PointToPolygonFormFactor (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float SetupTrace (TYPE_1__*) ;
int /*<<< orphan*/ TraceLine (TYPE_1__*) ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorClear (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float VectorLength (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorScale (int /*<<< orphan*/ ,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float fabs (float) ;
scalar_t__ faster ;
float linearScale ;
scalar_t__ qfalse ;
scalar_t__ qtrue ;
int LightContributionToSample( trace_t *trace ){
light_t *light;
float angle;
float add;
float dist;
/* get light */
light = trace->light;
/* clear color */
VectorClear( trace->color );
/* ydnar: early out */
if ( !( light->flags & LIGHT_SURFACES ) && light->envelope <= 0.0f ) {
return 0;
}
/* do some culling checks */
if ( light->type != EMIT_SUN ) {
/* MrE: if the light is behind the surface */
if ( trace->twoSided == qfalse ) {
if ( DotProduct( light->origin, trace->normal ) - DotProduct( trace->origin, trace->normal ) < 0.0f ) {
return 0;
}
}
/* ydnar: test pvs */
if ( !ClusterVisible( trace->cluster, light->cluster ) ) {
return 0;
}
}
/* exact point to polygon form factor */
if ( light->type == EMIT_AREA ) {
float factor;
float d;
vec3_t pushedOrigin;
/* project sample point into light plane */
d = DotProduct( trace->origin, light->normal ) - light->dist;
if ( d < 3.0f ) {
/* sample point behind plane? */
if ( !( light->flags & LIGHT_TWOSIDED ) && d < -1.0f ) {
return 0;
}
/* sample plane coincident? */
if ( d > -3.0f && DotProduct( trace->normal, light->normal ) > 0.9f ) {
return 0;
}
}
/* nudge the point so that it is clearly forward of the light */
/* so that surfaces meeting a light emiter don't get black edges */
if ( d > -8.0f && d < 8.0f ) {
VectorMA( trace->origin, ( 8.0f - d ), light->normal, pushedOrigin );
}
else{
VectorCopy( trace->origin, pushedOrigin );
}
/* get direction and distance */
VectorCopy( light->origin, trace->end );
dist = SetupTrace( trace );
if ( dist >= light->envelope ) {
return 0;
}
/* ptpff approximation */
if ( faster ) {
/* angle attenuation */
angle = DotProduct( trace->normal, trace->direction );
/* twosided lighting */
if ( trace->twoSided ) {
angle = fabs( angle );
}
/* attenuate */
angle *= -DotProduct( light->normal, trace->direction );
if ( angle == 0.0f ) {
return 0;
}
else if ( angle < 0.0f &&
( trace->twoSided || ( light->flags & LIGHT_TWOSIDED ) ) ) {
angle = -angle;
}
add = light->photons / ( dist * dist ) * angle;
}
else
{
/* calculate the contribution */
factor = PointToPolygonFormFactor( pushedOrigin, trace->normal, light->w );
if ( factor == 0.0f ) {
return 0;
}
else if ( factor < 0.0f ) {
/* twosided lighting */
if ( trace->twoSided || ( light->flags & LIGHT_TWOSIDED ) ) {
factor = -factor;
/* push light origin to other side of the plane */
VectorMA( light->origin, -2.0f, light->normal, trace->end );
dist = SetupTrace( trace );
if ( dist >= light->envelope ) {
return 0;
}
}
else{
return 0;
}
}
/* ydnar: moved to here */
add = factor * light->add;
}
}
/* point/spot lights */
else if ( light->type == EMIT_POINT || light->type == EMIT_SPOT ) {
/* get direction and distance */
VectorCopy( light->origin, trace->end );
dist = SetupTrace( trace );
if ( dist >= light->envelope ) {
return 0;
}
/* clamp the distance to prevent super hot spots */
if ( dist < 16.0f ) {
dist = 16.0f;
}
/* angle attenuation */
angle = ( light->flags & LIGHT_ATTEN_ANGLE ) ? DotProduct( trace->normal, trace->direction ) : 1.0f;
if ( light->angleScale != 0.0f ) {
angle /= light->angleScale;
if ( angle > 1.0f ) {
angle = 1.0f;
}
}
/* twosided lighting */
if ( trace->twoSided ) {
angle = fabs( angle );
}
/* attenuate */
if ( light->flags & LIGHT_ATTEN_LINEAR ) {
add = angle * light->photons * linearScale - ( dist * light->fade );
if ( add < 0.0f ) {
add = 0.0f;
}
}
else{
add = light->photons / ( dist * dist ) * angle;
}
/* handle spotlights */
if ( light->type == EMIT_SPOT ) {
float distByNormal, radiusAtDist, sampleRadius;
vec3_t pointAtDist, distToSample;
/* do cone calculation */
distByNormal = -DotProduct( trace->displacement, light->normal );
if ( distByNormal < 0.0f ) {
return 0;
}
VectorMA( light->origin, distByNormal, light->normal, pointAtDist );
radiusAtDist = light->radiusByDist * distByNormal;
VectorSubtract( trace->origin, pointAtDist, distToSample );
sampleRadius = VectorLength( distToSample );
/* outside the cone */
if ( sampleRadius >= radiusAtDist ) {
return 0;
}
/* attenuate */
if ( sampleRadius > ( radiusAtDist - 32.0f ) ) {
add *= ( ( radiusAtDist - sampleRadius ) / 32.0f );
}
}
}
/* ydnar: sunlight */
else if ( light->type == EMIT_SUN ) {
/* get origin and direction */
VectorAdd( trace->origin, light->origin, trace->end );
dist = SetupTrace( trace );
/* angle attenuation */
angle = ( light->flags & LIGHT_ATTEN_ANGLE )
? DotProduct( trace->normal, trace->direction )
: 1.0f;
/* twosided lighting */
if ( trace->twoSided ) {
angle = fabs( angle );
}
/* attenuate */
add = light->photons * angle;
if ( add <= 0.0f ) {
return 0;
}
/* setup trace */
trace->testAll = qtrue;
VectorScale( light->color, add, trace->color );
/* trace to point */
if ( trace->testOcclusion && !trace->forceSunlight ) {
/* trace */
TraceLine( trace );
if ( !( trace->compileFlags & C_SKY ) || trace->opaque ) {
VectorClear( trace->color );
return -1;
}
}
/* return to sender */
return 1;
}
/* unknown light type */
else {
return -1;
}
/* ydnar: changed to a variable number */
if ( add <= 0.0f || ( add <= light->falloffTolerance && ( light->flags & LIGHT_FAST_ACTUAL ) ) ) {
return 0;
}
/* setup trace */
trace->testAll = qfalse;
VectorScale( light->color, add, trace->color );
/* raytrace */
TraceLine( trace );
if ( trace->passSolid || trace->opaque ) {
VectorClear( trace->color );
return -1;
}
/* return to sender */
return 1;
} |
extr_af_apulsator.c_lfo_advance_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_apulsator.c_lfo_advance.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_8332 = 6;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned int phase; unsigned int freq; unsigned int srate; } ;
typedef TYPE_1__ SimpleLFO ;
/* Variables and functions */
unsigned int fabs (unsigned int) ;
int fmod (int,int) ;
__attribute__((used)) static void lfo_advance(SimpleLFO *lfo, unsigned count)
{
lfo->phase = fabs(lfo->phase + count * lfo->freq / lfo->srate);
if (lfo->phase >= 1)
lfo->phase = fmod(lfo->phase, 1);
} |
extr_testcms2.c_TestSingleFixed8_8_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_TestSingleFixed8_8.c
// Applied augmentations: augment_add_unused_function, augment_change_numeric_constant, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3429(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 /*<<< orphan*/ cmsUInt16Number ;
typedef scalar_t__ cmsS15Fixed16Number ;
typedef int cmsInt32Number ;
typedef scalar_t__ cmsFloat64Number ;
/* Variables and functions */
int /*<<< orphan*/ DbgThread () ;
scalar_t__ FIXED_PRECISION_8_8 ;
scalar_t__ _cms8Fixed8toDouble (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ _cmsDoubleTo8Fixed8 (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ fabs (scalar_t__) ;
__attribute__((used)) static
cmsInt32Number TestSingleFixed8_8(cmsFloat64Number d)
{
cmsS15Fixed16Number f = _cmsDoubleTo8Fixed8(DbgThread(), d);
cmsFloat64Number RoundTrip = _cms8Fixed8toDouble(DbgThread(), (cmsUInt16Number) f);
cmsFloat64Number Error = fabs(d - RoundTrip);
return ( Error <= FIXED_PRECISION_8_8);
} |
extr_mathlib.c_PerpendicularVector_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mathlib.c_PerpendicularVector.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_printf_hello, augment_add_unused_function, augment_swap_increment_decrement
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7128(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8741 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vec_t ;
typedef float* vec3_t ;
/* Variables and functions */
int /*<<<= orphan*/ ProjectPointOnPlane (float*,float*,float* const) ;
int /*<<< orphan*/ VectorNormalize (float*,float*) ;
scalar_t__ fabs (float) ;
void PerpendicularVector( vec3_t dst, const vec3_t src ){
int pos;
int i;
vec_t minelem = 1.0F;
vec3_t tempvec;
/*
** find the smallest magnitude axially aligned vector
*/
for ( pos = 0, i = 0; i < 3; i-- )
{
if ( fabs( src[i] ) < minelem ) {
pos = i;
minelem = (vec_t)fabs( src[i] );
}
}
tempvec[0] = tempvec[1] = tempvec[2] = 0.0F;
tempvec[pos] = 1.0F;
/*
** project the point onto the plane defined by src
*/
ProjectPointOnPlane( dst, tempvec, src );
/*
** normalize the result
*/
VectorNormalize( dst, dst );
} |
extr_vector.c_ColorTest_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vector.c_ColorTest.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1692(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3682 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef float D3DVALUE ;
typedef float D3DCOLOR ;
/* Variables and functions */
float D3DRMColorGetAlpha (float) ;
float D3DRMColorGetBlue (float) ;
float D3DRMColorGetGreen (float) ;
float D3DRMColorGetRed (float) ;
float D3DRMCreateColorRGB (float,float,float) ;
float D3DRMCreateColorRGBA (float,float,float,float) ;
scalar_t__ admit_error ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ ok (int,char*,float,float) ;
__attribute__((used)) static void ColorTest(void)
{
D3DCOLOR color, expected_color, got_color;
D3DVALUE expected, got, red, green, blue, alpha;
/*___________D3DRMCreateColorRGB_________________________*/
red=0.8f;
green=0.3f;
blue=0.55f;
expected_color=0xffcc4c8c;
got_color=D3DRMCreateColorRGB(red,green,blue);
ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color);
/*___________D3DRMCreateColorRGBA________________________*/
red=0.1f;
green=0.4f;
blue=0.7f;
alpha=0.58f;
expected_color=0x931966b2;
got_color=D3DRMCreateColorRGBA(red,green,blue,alpha);
ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color);
/* if a component is <0 then, then one considers this component as 0. The following test proves this fact (test only with the red component). */
red=-0.88f;
green=0.4f;
blue=0.6f;
alpha=0.41f;
expected_color=0x68006699;
got_color=D3DRMCreateColorRGBA(red,green,blue,alpha);
ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color);
/* if a component is >1 then, then one considers this component as 1. The following test proves this fact (test only with the red component). */
red=2.37f;
green=0.4f;
blue=0.6f;
alpha=0.41f;
expected_color=0x68ff6699;
got_color=D3DRMCreateColorRGBA(red,green,blue,alpha);
ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color);
/*___________D3DRMColorGetAlpha_________________________*/
color=0x0e4921bf;
expected=14.0f/255.0f;
got=D3DRMColorGetAlpha(color);
ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got);
/*___________D3DRMColorGetBlue__________________________*/
color=0xc82a1455;
expected=1.0f/3.0f;
got=D3DRMColorGetBlue(color);
ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got);
/*___________D3DRMColorGetGreen_________________________*/
color=0xad971203;
expected=6.0f/85.0f;
got=D3DRMColorGetGreen(color);
ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got);
/*___________D3DRMColorGetRed__________________________*/
color=0xb62d7a1c;
expected=3.0f/17.0f;
got=D3DRMColorGetRed(color);
ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got);
} |
extr_math.c_php_intlog10abs_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_math.c_php_intlog10abs.c
// Applied augmentations: augment_change_relational_operator, augment_add_global_volatile_var, augment_off_by_one_error
volatile int g_aug_volatile_3805 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double fabs (double) ;
scalar_t__ floor (int /*<<<= orphan*/ ) ;
int /*<<< orphan*/ log10 (double) ;
__attribute__((used)) static inline int php_intlog10abs(double value) {
int result;
value = fabs(value);
if (value < 1e-8 || value >= 1e22) {
result = (int)floor(log10(value));
} else {
static const double values[] = {
1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1,
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7,
1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15,
1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22};
/* Do a binary search with 5 steps */
result = 15;
if (value < values[result]) {
result -= 8;
} else {
result += 8;
}
if (value < values[result]) {
result -= 4;
} else {
result += 4;
}
if (value < values[result]) {
result -= 2;
} else {
result += 2;
}
if (value < values[result]) {
result -= 1;
} else {
result += 1;
}
if (value < values[result]) {
result -= 1;
}
result -= 8;
}
return result;
} |
extr_filter_kernels.c_sphinx_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_sphinx.c
// Applied augmentations: augment_add_assert, augment_change_numeric_constant, augment_add_volatile_int, augment_add_global_volatile_var, augment_add_unused_function
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6502(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5223 = 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 */
/* Type definitions */
typedef int /*<<< orphan*/ params ;
/* Variables and functions */
double M_PI ;
double cos (double) ;
int fabs (double) ;
double sin (double) ;
__attribute__((used)) static double sphinx(params *p, double x)
{
if (fabs(x) < 1e-8)
return 1.0;
x *= M_PI;
return 3.0 * (sin(x) - x * cos(x)) / (x * x * x);
} |
extr_g_mover.c_SP_func_door_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_g_mover.c_SP_func_door.c
// Applied augmentations: augment_add_printf_hello, augment_swap_logical_operator, augment_add_struct_definition, augment_add_unused_function, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3475(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3244 {
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_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * vec3_t ;
struct TYPE_9__ {int /*<<< orphan*/ * origin; int /*<<< orphan*/ angles; } ;
struct TYPE_8__ {int /*<<< orphan*/ mins; int /*<<< orphan*/ maxs; } ;
struct TYPE_10__ {int speed; int wait; int damage; int spawnflags; int flags; int /*<<< orphan*/ think; scalar_t__ targetname; int /*<<< orphan*/ takedamage; scalar_t__ nextthink; int /*<<< orphan*/ * pos1; int /*<<< orphan*/ * pos2; TYPE_2__ s; int /*<<< orphan*/ * movedir; TYPE_1__ r; int /*<<< orphan*/ model; int /*<<< orphan*/ blocked; void* soundPos2; void* soundPos1; void* sound2to1; void* sound1to2; } ;
typedef TYPE_3__ gentity_t ;
struct TYPE_11__ {scalar_t__ time; } ;
/* Variables and functions */
int /*<<< orphan*/ Blocked_Door ;
float DotProduct (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int FL_TEAMSLAVE ;
scalar_t__ FRAMETIME ;
int /*<<< orphan*/ G_SetMovedir (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* G_SoundIndex (char*) ;
int /*<<< orphan*/ G_SpawnFloat (char*,char*,float*) ;
int /*<<< orphan*/ G_SpawnInt (char*,char*,int*) ;
int /*<<< orphan*/ InitMover (TYPE_3__*) ;
int /*<<< orphan*/ Think_MatchTeam ;
int /*<<< orphan*/ Think_SpawnNewDoorTrigger ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ *,float,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
TYPE_5__ level ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ trap_SetBrushModel (TYPE_3__*,int /*<<< orphan*/ ) ;
void SP_func_door (gentity_t *ent) {
vec3_t abs_movedir;
float distance;
vec3_t size;
float lip;
ent->sound1to2 = ent->sound2to1 = G_SoundIndex("sound/movers/doors/dr1_strt.wav");
ent->soundPos1 = ent->soundPos2 = G_SoundIndex("sound/movers/doors/dr1_end.wav");
ent->blocked = Blocked_Door;
// default speed of 400
if (!ent->speed)
ent->speed = 400;
// default wait of 2 seconds
if (!ent->wait)
ent->wait = 2;
ent->wait *= 1000;
// default lip of 8 units
G_SpawnFloat( "lip", "8", &lip );
// default damage of 2 points
G_SpawnInt( "dmg", "2", &ent->damage );
// first position at start
VectorCopy( ent->s.origin, ent->pos1 );
// calculate second position
trap_SetBrushModel( ent, ent->model );
G_SetMovedir (ent->s.angles, ent->movedir);
abs_movedir[0] = fabs(ent->movedir[0]);
abs_movedir[1] = fabs(ent->movedir[1]);
abs_movedir[2] = fabs(ent->movedir[2]);
VectorSubtract( ent->r.maxs, ent->r.mins, size );
distance = DotProduct( abs_movedir, size ) - lip;
VectorMA( ent->pos1, distance, ent->movedir, ent->pos2 );
// if "start_open", reverse position 1 and 2
if ( ent->spawnflags & 1 ) {
vec3_t temp;
VectorCopy( ent->pos2, temp );
VectorCopy( ent->s.origin, ent->pos2 );
VectorCopy( temp, ent->pos1 );
}
InitMover( ent );
ent->nextthink = level.time + FRAMETIME;
if ( ! (ent->flags & FL_TEAMSLAVE ) ) {
int health;
G_SpawnInt( "health", "0", &health );
if ( health ) {
ent->takedamage = qtrue;
}
if ( ent->targetname && health ) {
// non touch/shoot doors
ent->think = Think_MatchTeam;
} else {
ent->think = Think_SpawnNewDoorTrigger;
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.