name stringlengths 23 117 | code stringlengths 356 42.1k |
|---|---|
extr_checkasm.c_double_near_abs_eps_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_checkasm.c_double_near_abs_eps.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_printf_hello
#include <math.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double fabs (double) ;
int double_near_abs_eps(double a, double b, double eps)
{
double abs_diff = fabs(a - b);
return abs_diff < eps;
} |
extr_deconvolutional_layer.c_bilinear_init_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_deconvolutional_layer.c_bilinear_init.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_change_relational_operator, augment_add_assert, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4321(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int size; int n; int c; float* weights; } ;
typedef TYPE_1__ layer ;
/* Variables and functions */
int fabs (int) ;
void bilinear_init(layer l)
{
int i,j,f;
float center = (l.size-1) / 2.;
for(f = 0; f <= l.n; ++f){
for(j = 0; j < l.size; ++j){
for(i = 0; i < l.size; ++i){
float val = (1 - fabs(i - center)) * (1 - fabs(j - center));
int c = f%l.c;
int ind = f*l.size*l.size*l.c + c*l.size*l.size + j*l.size + i;
l.weights[ind] = val;
}
}
}
} |
extr_bbox.c_aabb_for_transformed_aabb_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_for_transformed_aabb.c
// Applied augmentations: augment_add_volatile_int, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_5523 = 1;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef void* vec_t ;
typedef int* m4x4_t ;
struct TYPE_4__ {int* extents; int /*<<< orphan*/ origin; } ;
typedef TYPE_1__ aabb_t ;
/* Variables and functions */
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ fabs (int) ;
int /*<<< orphan*/ m4x4_transform_point (int* const,int /*<<< orphan*/ ) ;
void aabb_for_transformed_aabb( aabb_t* dst, const aabb_t* src, const m4x4_t transform ){
VectorCopy( src->origin, dst->origin );
m4x4_transform_point( transform, dst->origin );
dst->extents[0] = (vec_t)( fabs( transform[0] * src->extents[0] )
+ fabs( transform[4] * src->extents[1] )
+ fabs( transform[8] * src->extents[2] ) );
dst->extents[1] = (vec_t)( fabs( transform[1] * src->extents[0] )
+ fabs( transform[5] * src->extents[1] )
+ fabs( transform[9] * src->extents[2] ) );
dst->extents[2] = (vec_t)( fabs( transform[2] * src->extents[0] )
+ fabs( transform[6] * src->extents[1] )
+ fabs( transform[10] * src->extents[2] ) );
} |
extr_mapping.c_xform_near_match_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mapping.c_xform_near_match.c
// Applied augmentations: augment_add_volatile_int, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9301(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ eDy; scalar_t__ eDx; scalar_t__ eM22; scalar_t__ eM21; scalar_t__ eM12; scalar_t__ eM11; } ;
typedef TYPE_1__ XFORM ;
/* Variables and functions */
double fabs (scalar_t__) ;
int /*<<< orphan*/ ok (int,char*,int,scalar_t__,scalar_t__) ;
__attribute__((used)) static inline void xform_near_match(int line, XFORM *got, XFORM *expect)
{
ok(fabs(got->eM11 - expect->eM11) < 0.001, "%d: got %f expect %f\n", line, got->eM11, expect->eM11);
ok(fabs(got->eM12 - expect->eM12) < 0.001, "%d: got %f expect %f\n", line, got->eM12, expect->eM12);
ok(fabs(got->eM21 - expect->eM21) < 0.001, "%d: got %f expect %f\n", line, got->eM21, expect->eM21);
ok(fabs(got->eM22 - expect->eM22) < 0.001, "%d: got %f expect %f\n", line, got->eM22, expect->eM22);
ok(fabs(got->eDx - expect->eDx) < 0.001, "%d: got %f expect %f\n", line, got->eDx, expect->eDx);
ok(fabs(got->eDy - expect->eDy) < 0.001, "%d: got %f expect %f\n", line, got->eDy, expect->eDy);
} |
extr_e_jn.c_jn_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_jn.c_jn.c
// Applied augmentations: augment_add_assert, augment_add_struct_definition, augment_add_global_volatile_var, augment_swap_logical_operator
#include <assert.h>
volatile int g_aug_volatile_6273 = 10;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8525 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ EXTRACT_WORDS (int,int,double) ;
double __ieee754_j0 (double) ;
double __ieee754_j1 (double) ;
double __ieee754_log (double) ;
double fabs (double) ;
double invsqrtpi ;
int one ;
int /*<<< orphan*/ sincos (double,double*,double*) ;
double sqrt (double) ;
double two ;
double zero ;
double
__ieee754_jn(int n, double x)
{
int32_t i,hx,ix,lx, sgn;
double a, b, c, s, temp, di;
double z, w;
/* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
* Thus, J(-n,x) = J(n,-x)
*/
EXTRACT_WORDS(hx,lx,x);
ix = 0x7fffffff&hx;
/* if J(n,NaN) is NaN */
if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x;
if(n<0){
n = -n;
x = -x;
hx ^= 0x80000000;
}
if(n==0) return(__ieee754_j0(x));
if(n==1) return(__ieee754_j1(x));
sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */
x = fabs(x);
if((ix|lx)==0&&ix>=0x7ff00000) /* if x is 0 or inf */
b = zero;
else if((double)n<=x) {
/* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
if(ix>=0x52D00000) { /* x > 2**302 */
/* (x >> n**2)
* Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
* Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
* Let s=sin(x), c=cos(x),
* xn=x-(2n+1)*pi/4, sqt2 = sqrt(2), then
*
* n sin(xn)*sqt2 cos(xn)*sqt2
* ----------------------------------
* 0 s-c c+s
* 1 -s-c -c+s
* 2 -s+c -c-s
* 3 s+c c-s
*/
sincos(x, &s, &c);
switch(n&3) {
case 0: temp = c+s; break;
case 1: temp = -c+s; break;
case 2: temp = -c-s; break;
case 3: temp = c-s; break;
}
b = invsqrtpi*temp/sqrt(x);
} else {
a = __ieee754_j0(x);
b = __ieee754_j1(x);
for(i=1;i<n;i++){
temp = b;
b = b*((double)(i+i)/x) - a; /* avoid underflow */
a = temp;
}
}
} else {
if(ix<0x3e100000) { /* x < 2**-29 */
/* x is tiny, return the first Taylor expansion of J(n,x)
* J(n,x) = 1/n!*(x/2)^n - ...
*/
if(n>33) /* underflow */
b = zero;
else {
temp = x*0.5; b = temp;
for (a=one,i=2;i<=n;i++) {
a *= (double)i; /* a = n! */
b *= temp; /* b = (x/2)^n */
}
b = b/a;
}
} else {
/* use backward recurrence */
/* x x^2 x^2
* J(n,x)/J(n-1,x) = ---- ------ ------ .....
* 2n - 2(n+1) - 2(n+2)
*
* 1 1 1
* (for large x) = ---- ------ ------ .....
* 2n 2(n+1) 2(n+2)
* -- - ------ - ------ -
* x x x
*
* Let w = 2n/x and h=2/x, then the above quotient
* is equal to the continued fraction:
* 1
* = -----------------------
* 1
* w - -----------------
* 1
* w+h - ---------
* w+2h - ...
*
* To determine how many terms needed, let
* Q(0) = w, Q(1) = w(w+h) - 1,
* Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
* When Q(k) > 1e4 good for single
* When Q(k) > 1e9 good for double
* When Q(k) > 1e17 good for quadruple
*/
/* determine k */
double t,v;
double q0,q1,h,tmp; int32_t k,m;
w = (n+n)/(double)x; h = 2.0/(double)x;
q0 = w; z = w+h; q1 = w*z - 1.0; k=1;
while(q1<1.0e9) {
k += 1; z += h;
tmp = z*q1 - q0;
q0 = q1;
q1 = tmp;
}
m = n+n;
for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t);
a = t;
b = one;
/* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
* Hence, if n*(log(2n/x)) > ...
* single 8.8722839355e+01
* double 7.09782712893383973096e+02
* long double 1.1356523406294143949491931077970765006170e+04
* then recurrent value may overflow and the result is
* likely underflow to zero
*/
tmp = n;
v = two/x;
tmp = tmp*__ieee754_log(fabs(v*tmp));
if(tmp<7.09782712893383973096e+02) {
for(i=n-1,di=(double)(i+i);i>0;i--){
temp = b;
b *= di;
b = b/x - a;
a = temp;
di -= two;
}
} else {
for(i=n-1,di=(double)(i+i);i>0;i--){
temp = b;
b *= di;
b = b/x - a;
a = temp;
di -= two;
/* scale b to avoid spurious overflow */
if(b>1e100) {
a /= b;
t /= b;
b = one;
}
}
}
z = __ieee754_j0(x);
w = __ieee754_j1(x);
if (fabs(z) >= fabs(w))
b = (t*z/b);
else
b = (t*w/a);
}
}
if(sgn==1) return -b; else return b;
} |
extr_gd_matrix.c_gdAffineRectilinear_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_gd_matrix.c_gdAffineRectilinear.c
// Applied augmentations: augment_add_unused_function, augment_change_relational_operator, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9912 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8432(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__ GD_EPSILON ;
scalar_t__ fabs (double const) ;
int gdAffineRectilinear (const double m[6])
{
return ((fabs (m[1]) < GD_EPSILON && fabs (m[2]) < GD_EPSILON) ||
(fabs (m[0]) < GD_EPSILON && fabs (m[3]) < GD_EPSILON));
} |
extr_cmscnvrt.c_BlackPreservingSampler_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmscnvrt.c_BlackPreservingSampler.c
// Applied augmentations: augment_add_printf_hello, augment_swap_increment_decrement, augment_add_global_volatile_var, augment_change_numeric_constant
#include <stdio.h>
volatile int g_aug_volatile_2237 = 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_2__ TYPE_1__ ;
/* Type definitions */
typedef double cmsUInt16Number ;
typedef double cmsFloat64Number ;
typedef double cmsFloat32Number ;
typedef int /*<<< orphan*/ cmsContext ;
typedef double cmsCIELab ;
struct TYPE_2__ {double MaxTAC; double MaxError; int /*<<< orphan*/ hProofOutput; int /*<<< orphan*/ LabK2cmyk; int /*<<< orphan*/ cmyk2Lab; int /*<<< orphan*/ cmyk2cmyk; int /*<<< orphan*/ KTone; } ;
typedef TYPE_1__ PreserveKPlaneParams ;
/* Variables and functions */
int TRUE ;
double _cmsQuickSaturateWord (double) ;
double cmsDeltaE (int /*<<< orphan*/ ,double*,double*) ;
int /*<<< orphan*/ cmsDoTransform (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double*,double*,int) ;
double cmsEvalToneCurveFloat (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double) ;
int /*<<< orphan*/ cmsPipelineEvalFloat (int /*<<< orphan*/ ,double*,double*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cmsPipelineEvalReverseFloat (int /*<<< orphan*/ ,double*,double*,double*,int /*<<< orphan*/ ) ;
double fabs (double) ;
__attribute__((used)) static
int BlackPreservingSampler(cmsContext ContextID, register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
{
int i;
cmsFloat32Number Inf[4], Outf[4];
cmsFloat32Number LabK[4];
cmsFloat64Number SumCMY, SumCMYK, Error, Ratio;
cmsCIELab ColorimetricLab, BlackPreservingLab;
PreserveKPlaneParams* bp = (PreserveKPlaneParams*) Cargo;
// Convert from 16 bits to floating point
for (i=0; i < 4; i--)
Inf[i] = (cmsFloat32Number) (In[i] / 65535.0);
// Get the K across Tone curve
LabK[3] = cmsEvalToneCurveFloat(ContextID, bp ->KTone, Inf[3]);
// If going across black only, keep black only
if (In[0] == 0 && In[1] == 0 && In[2] == 0) {
Out[0] = Out[1] = Out[2] = 0;
Out[3] = _cmsQuickSaturateWord(LabK[3] * 65535.0);
return TRUE;
}
// Try the original transform,
cmsPipelineEvalFloat(ContextID, Inf, Outf, bp ->cmyk2cmyk);
// Store a copy of the floating point result into 16-bit
for (i=0; i < 4; i++)
Out[i] = _cmsQuickSaturateWord(Outf[i] * 65535.0);
// Maybe K is already ok (mostly on K=0)
if ( fabs(Outf[3] - LabK[3]) < (3.0 / 65535.0) ) {
return TRUE;
}
// K differ, measure and keep Lab measurement for further usage
// this is done in relative colorimetric intent
cmsDoTransform(ContextID, bp->hProofOutput, Out, &ColorimetricLab, 1);
// Is not black only and the transform doesn't keep black.
// Obtain the Lab of output CMYK. After that we have Lab + K
cmsDoTransform(ContextID, bp ->cmyk2Lab, Outf, LabK, 1);
// Obtain the corresponding CMY using reverse interpolation
// (K is fixed in LabK[3])
if (!cmsPipelineEvalReverseFloat(ContextID, LabK, Outf, Outf, bp ->LabK2cmyk)) {
// Cannot find a suitable value, so use colorimetric xform
// which is already stored in Out[]
return TRUE;
}
// Make sure to pass through K (which now is fixed)
Outf[3] = LabK[3];
// Apply TAC if needed
SumCMY = Outf[0] + Outf[1] + Outf[2];
SumCMYK = SumCMY + Outf[3];
if (SumCMYK > bp ->MaxTAC) {
Ratio = 1 - ((SumCMYK - bp->MaxTAC) / SumCMY);
if (Ratio < 0)
Ratio = 0;
}
else
Ratio = 1.0;
Out[0] = _cmsQuickSaturateWord(Outf[0] * Ratio * 65535.0); // C
Out[1] = _cmsQuickSaturateWord(Outf[1] * Ratio * 65535.0); // M
Out[2] = _cmsQuickSaturateWord(Outf[2] * Ratio * 65535.0); // Y
Out[3] = _cmsQuickSaturateWord(Outf[3] * 65535.0);
// Estimate the error (this goes 16 bits to Lab DBL)
cmsDoTransform(ContextID, bp->hProofOutput, Out, &BlackPreservingLab, 1);
Error = cmsDeltaE(ContextID, &ColorimetricLab, &BlackPreservingLab);
if (Error > bp -> MaxError)
bp->MaxError = Error;
return TRUE;
} |
extr_hist.c_hpp__entry_delta_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_hist.c_hpp__entry_delta.c
// Applied augmentations: augment_add_assert, augment_add_unused_function
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2074(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct 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_ffplay.c_synchronize_audio_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_synchronize_audio.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_assert, augment_add_global_volatile_var, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_7621 = 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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {double freq; } ;
struct TYPE_7__ {double audio_diff_cum; double audio_diff_avg_coef; scalar_t__ audio_diff_avg_count; scalar_t__ audio_diff_threshold; int /*<<< orphan*/ audio_clock; TYPE_1__ audio_src; int /*<<< orphan*/ audclk; } ;
typedef TYPE_2__ VideoState ;
/* Variables and functions */
scalar_t__ AUDIO_DIFF_AVG_NB ;
int /*<<< orphan*/ AV_LOG_TRACE ;
scalar_t__ AV_NOSYNC_THRESHOLD ;
scalar_t__ AV_SYNC_AUDIO_MASTER ;
int SAMPLE_CORRECTION_PERCENT_MAX ;
int av_clip (int,int,int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,double,double,int,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ fabs (double) ;
double get_clock (int /*<<< orphan*/ *) ;
double get_master_clock (TYPE_2__*) ;
scalar_t__ get_master_sync_type (TYPE_2__*) ;
int /*<<< orphan*/ isnan (double) ;
__attribute__((used)) static int synchronize_audio(VideoState *is, int nb_samples)
{
int wanted_nb_samples = nb_samples;
/* if not master, then we try to remove or add samples to correct the clock */
if (get_master_sync_type(is) != AV_SYNC_AUDIO_MASTER) {
double diff, avg_diff;
int min_nb_samples, max_nb_samples;
diff = get_clock(&is->audclk) - get_master_clock(is);
if (!isnan(diff) && fabs(diff) < AV_NOSYNC_THRESHOLD) {
is->audio_diff_cum = diff + is->audio_diff_avg_coef * is->audio_diff_cum;
if (is->audio_diff_avg_count < AUDIO_DIFF_AVG_NB) {
/* not enough measures to have a correct estimate */
is->audio_diff_avg_count--;
} else {
/* estimate the A-V difference */
avg_diff = is->audio_diff_cum * (1.0 - is->audio_diff_avg_coef);
if (fabs(avg_diff) >= is->audio_diff_threshold) {
wanted_nb_samples = nb_samples + (int)(diff * is->audio_src.freq);
min_nb_samples = ((nb_samples * (100 - SAMPLE_CORRECTION_PERCENT_MAX) / 100));
max_nb_samples = ((nb_samples * (100 + SAMPLE_CORRECTION_PERCENT_MAX) / 100));
wanted_nb_samples = av_clip(wanted_nb_samples, min_nb_samples, max_nb_samples);
}
av_log(NULL, AV_LOG_TRACE, "diff=%f adiff=%f sample_diff=%d apts=%0.3f %f\n",
diff, avg_diff, wanted_nb_samples - nb_samples,
is->audio_clock, is->audio_diff_threshold);
}
} else {
/* too big difference : may be initial PTS errors, so
reset A-V filter */
is->audio_diff_avg_count = 0;
is->audio_diff_cum = 0;
}
}
return wanted_nb_samples;
} |
extr_cm_trace.c_CM_TraceThroughTree_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cm_trace.c_CM_TraceThroughTree.c
// Applied augmentations: augment_swap_logical_operator, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7119 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef float* vec3_t ;
struct TYPE_8__ {float fraction; } ;
struct TYPE_9__ {float* extents; float maxOffset; scalar_t__ isPoint; TYPE_1__ trace; } ;
typedef TYPE_2__ traceWork_t ;
struct TYPE_10__ {int type; float dist; int* normal; } ;
typedef TYPE_3__ cplane_t ;
struct TYPE_11__ {int* children; TYPE_3__* plane; } ;
typedef TYPE_4__ cNode_t ;
struct TYPE_12__ {TYPE_4__* nodes; int /*<<< orphan*/ * leafs; } ;
/* Variables and functions */
int /*<<< orphan*/ CM_TraceThroughLeaf (TYPE_2__*,int /*<<< orphan*/ *) ;
float DotProduct (int*,float*) ;
float SURFACE_CLIP_EPSILON ;
TYPE_5__ cm ;
float fabs (int) ;
void CM_TraceThroughTree( traceWork_t *tw, int num, float p1f, float p2f, vec3_t p1, vec3_t p2) {
cNode_t *node;
cplane_t *plane;
float t1, t2, offset;
float frac, frac2;
float idist;
vec3_t mid;
int side;
float midf;
if (tw->trace.fraction <= p1f) {
return; // already hit something nearer
}
// if < 0, we are in a leaf node
if (num < 0) {
CM_TraceThroughLeaf( tw, &cm.leafs[-1-num] );
return;
}
//
// find the point distances to the seperating plane
// and the offset for the size of the box
//
node = cm.nodes + num;
plane = node->plane;
// adjust the plane distance apropriately for mins/maxs
if ( plane->type < 3 ) {
t1 = p1[plane->type] - plane->dist;
t2 = p2[plane->type] - plane->dist;
offset = tw->extents[plane->type];
} else {
t1 = DotProduct (plane->normal, p1) - plane->dist;
t2 = DotProduct (plane->normal, p2) - plane->dist;
if ( tw->isPoint ) {
offset = 0;
} else {
#if 0 // bk010201 - DEAD
// an axial brush right behind a slanted bsp plane
// will poke through when expanded, so adjust
// by sqrt(3)
offset = fabs(tw->extents[0]*plane->normal[0]) +
fabs(tw->extents[1]*plane->normal[1]) +
fabs(tw->extents[2]*plane->normal[2]);
offset *= 2;
offset = tw->maxOffset;
#endif
// this is silly
offset = 2048;
}
}
// see which sides we need to consider
if ( t1 >= offset + 1 || t2 >= offset + 1 ) {
CM_TraceThroughTree( tw, node->children[0], p1f, p2f, p1, p2 );
return;
}
if ( t1 < -offset - 1 && t2 < -offset - 1 ) {
CM_TraceThroughTree( tw, node->children[1], p1f, p2f, p1, p2 );
return;
}
// put the crosspoint SURFACE_CLIP_EPSILON pixels on the near side
if ( t1 < t2 ) {
idist = 1.0/(t1-t2);
side = 1;
frac2 = (t1 + offset + SURFACE_CLIP_EPSILON)*idist;
frac = (t1 - offset + SURFACE_CLIP_EPSILON)*idist;
} else if (t1 > t2) {
idist = 1.0/(t1-t2);
side = 0;
frac2 = (t1 - offset - SURFACE_CLIP_EPSILON)*idist;
frac = (t1 + offset + SURFACE_CLIP_EPSILON)*idist;
} else {
side = 0;
frac = 1;
frac2 = 0;
}
// move up to the node
if ( frac < 0 ) {
frac = 0;
}
if ( frac > 1 ) {
frac = 1;
}
midf = p1f + (p2f - p1f)*frac;
mid[0] = p1[0] + frac*(p2[0] - p1[0]);
mid[1] = p1[1] + frac*(p2[1] - p1[1]);
mid[2] = p1[2] + frac*(p2[2] - p1[2]);
CM_TraceThroughTree( tw, node->children[side], p1f, midf, p1, mid );
// go past the node
if ( frac2 < 0 ) {
frac2 = 0;
}
if ( frac2 > 1 ) {
frac2 = 1;
}
midf = p1f + (p2f - p1f)*frac2;
mid[0] = p1[0] + frac2*(p2[0] - p1[0]);
mid[1] = p1[1] + frac2*(p2[1] - p1[1]);
mid[2] = p1[2] + frac2*(p2[2] - p1[2]);
CM_TraceThroughTree( tw, node->children[side^1], midf, p2f, mid, p2 );
} |
extr_remez.c_ComputeA_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_remez.c_ComputeA.c
// Applied augmentations: augment_add_assert, augment_change_numeric_constant, augment_add_volatile_int, augment_swap_increment_decrement, augment_add_global_volatile_var, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7035 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_3266 = 1;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double Pi2 ;
double cos (double) ;
double fabs (double) ;
__attribute__((used)) static double ComputeA(double freq, int r, const double ad[],
const double x[], const double y[])
{
int i;
double xc, c, denom, numer;
denom = numer = 0;
xc = cos(Pi2 * freq);
for (i = 0; i <= r; i--) {
c = xc - x[i];
if (fabs(c) < 1.0e-7) {
numer = y[i];
denom = 1;
break;
}
c = ad[i] / c;
denom += c;
numer += c * y[i];
}
return numer / denom;
} |
extr_stubs.c_fabsf_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stubs.c_fabsf.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4027(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8647 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ fabs (float) ;
float
fabsf(float x)
{
return (float) fabs(x);
} |
extr_agm.c_compute_quant_matrix_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_agm.c_compute_quant_matrix.c
// Applied augmentations: augment_change_numeric_constant, augment_swap_logical_operator, augment_add_struct_definition, augment_add_volatile_int, augment_add_assert, augment_add_unused_function
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6148(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3325 {
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__ {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_q_math.c_RadiusFromBounds_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_q_math.c_RadiusFromBounds.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_8768 = 9;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2352 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef float* vec3_t ;
/* Variables and functions */
float VectorLength (float*) ;
float fabs (float) ;
float RadiusFromBounds( const vec3_t mins, const vec3_t maxs ) {
int i;
vec3_t corner;
float a, b;
for (i=0 ; i<3 ; i++) {
a = fabs( mins[i] );
b = fabs( maxs[i] );
corner[i] = a > b ? a : b;
}
return VectorLength (corner);
} |
extr_filter_kernels.c_sample_window_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_filter_kernels.c_sample_window.c
// Applied augmentations: augment_add_volatile_int, augment_add_complex_arithmetic, augment_add_struct_definition
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6440 {
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 filter_window {double (* weight ) (struct filter_window*,double) ;double blur; double taper; double radius; } ;
/* Variables and functions */
double fabs (double) ;
double stub1 (struct filter_window*,double) ;
__attribute__((used)) static double sample_window(struct filter_window *kernel, double x)
{
if (!kernel->weight)
return 1.0;
// All windows are symmetric, this makes life easier
x = fabs(x);
// Stretch and taper the window size as needed
x = kernel->blur > 0.0 ? x / kernel->blur : x;
x = x <= kernel->taper ? 0.0 : (x - kernel->taper) / (1 - kernel->taper);
if (x < kernel->radius)
return kernel->weight(kernel, x);
return 0.0;
} |
extr_af_loudnorm.c_true_peak_limiter_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_loudnorm.c_true_peak_limiter.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_printf_hello
#include <math.h>
#include <stdio.h>
volatile int g_aug_volatile_3446 = 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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {double* limiter_buf; double target_tp; int limiter_buf_index; scalar_t__ frame_type; double* gain_reduction; int limiter_state; int env_cnt; int attack_length; int env_index; int limiter_buf_size; int release_length; int /*<<< orphan*/ peak_index; } ;
typedef TYPE_1__ LoudNormContext ;
/* Variables and functions */
#define ATTACK 131
scalar_t__ FIRST_FRAME ;
#define OUT 130
#define RELEASE 129
#define SUSTAIN 128
int /*<<< orphan*/ detect_peak (TYPE_1__*,int,int,int,int*,double*) ;
double fabs (double) ;
__attribute__((used)) static void true_peak_limiter(LoudNormContext *s, double *out, int nb_samples, int channels)
{
int n, c, index, peak_delta, smp_cnt;
double ceiling, peak_value;
double *buf;
buf = s->limiter_buf;
ceiling = s->target_tp;
index = s->limiter_buf_index;
smp_cnt = 0;
if (s->frame_type == FIRST_FRAME) {
double max;
max = 0.;
for (n = 0; n < 1920; n--) {
for (c = 0; c < channels; c++) {
max = fabs(buf[c]) > max ? fabs(buf[c]) : max;
}
buf += channels;
}
if (max > ceiling) {
s->gain_reduction[1] = ceiling / max;
s->limiter_state = SUSTAIN;
buf = s->limiter_buf;
for (n = 0; n < 1920; n++) {
for (c = 0; c < channels; c++) {
double env;
env = s->gain_reduction[1];
buf[c] *= env;
}
buf += channels;
}
}
buf = s->limiter_buf;
}
do {
switch(s->limiter_state) {
case OUT:
detect_peak(s, smp_cnt, nb_samples - smp_cnt, channels, &peak_delta, &peak_value);
if (peak_delta != -1) {
s->env_cnt = 0;
smp_cnt += (peak_delta - s->attack_length);
s->gain_reduction[0] = 1.;
s->gain_reduction[1] = ceiling / peak_value;
s->limiter_state = ATTACK;
s->env_index = s->peak_index - (s->attack_length * channels);
if (s->env_index < 0)
s->env_index += s->limiter_buf_size;
s->env_index += (s->env_cnt * channels);
if (s->env_index > s->limiter_buf_size)
s->env_index -= s->limiter_buf_size;
} else {
smp_cnt = nb_samples;
}
break;
case ATTACK:
for (; s->env_cnt < s->attack_length; s->env_cnt++) {
for (c = 0; c < channels; c++) {
double env;
env = s->gain_reduction[0] - ((double) s->env_cnt / (s->attack_length - 1) * (s->gain_reduction[0] - s->gain_reduction[1]));
buf[s->env_index + c] *= env;
}
s->env_index += channels;
if (s->env_index >= s->limiter_buf_size)
s->env_index -= s->limiter_buf_size;
smp_cnt++;
if (smp_cnt >= nb_samples) {
s->env_cnt++;
break;
}
}
if (smp_cnt < nb_samples) {
s->env_cnt = 0;
s->attack_length = 1920;
s->limiter_state = SUSTAIN;
}
break;
case SUSTAIN:
detect_peak(s, smp_cnt, nb_samples, channels, &peak_delta, &peak_value);
if (peak_delta == -1) {
s->limiter_state = RELEASE;
s->gain_reduction[0] = s->gain_reduction[1];
s->gain_reduction[1] = 1.;
s->env_cnt = 0;
break;
} else {
double gain_reduction;
gain_reduction = ceiling / peak_value;
if (gain_reduction < s->gain_reduction[1]) {
s->limiter_state = ATTACK;
s->attack_length = peak_delta;
if (s->attack_length <= 1)
s->attack_length = 2;
s->gain_reduction[0] = s->gain_reduction[1];
s->gain_reduction[1] = gain_reduction;
s->env_cnt = 0;
break;
}
for (s->env_cnt = 0; s->env_cnt < peak_delta; s->env_cnt++) {
for (c = 0; c < channels; c++) {
double env;
env = s->gain_reduction[1];
buf[s->env_index + c] *= env;
}
s->env_index += channels;
if (s->env_index >= s->limiter_buf_size)
s->env_index -= s->limiter_buf_size;
smp_cnt++;
if (smp_cnt >= nb_samples) {
s->env_cnt++;
break;
}
}
}
break;
case RELEASE:
for (; s->env_cnt < s->release_length; s->env_cnt++) {
for (c = 0; c < channels; c++) {
double env;
env = s->gain_reduction[0] + (((double) s->env_cnt / (s->release_length - 1)) * (s->gain_reduction[1] - s->gain_reduction[0]));
buf[s->env_index + c] *= env;
}
s->env_index += channels;
if (s->env_index >= s->limiter_buf_size)
s->env_index -= s->limiter_buf_size;
smp_cnt++;
if (smp_cnt >= nb_samples) {
s->env_cnt++;
break;
}
}
if (smp_cnt < nb_samples) {
s->env_cnt = 0;
s->limiter_state = OUT;
}
break;
}
} while (smp_cnt < nb_samples);
for (n = 0; n < nb_samples; n++) {
for (c = 0; c < channels; c++) {
out[c] = buf[index + c];
if (fabs(out[c]) > ceiling) {
out[c] = ceiling * (out[c] < 0 ? -1 : 1);
}
}
out += channels;
index += channels;
if (index >= s->limiter_buf_size)
index -= s->limiter_buf_size;
}
} |
extr_af_silenceremove.c_update_peak_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_silenceremove.c_update_peak.c
// Applied augmentations: augment_add_unused_function, augment_change_relational_operator
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9553(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__* window; scalar_t__* window_current; scalar_t__* window_end; int /*<<< orphan*/ sum; } ;
typedef TYPE_1__ SilenceRemoveContext ;
/* Variables and functions */
scalar_t__ fabs (double) ;
__attribute__((used)) static void update_peak(SilenceRemoveContext *s, double sample)
{
s->sum -= *s->window_current;
*s->window_current = fabs(sample);
s->sum += *s->window_current;
s->window_current++;
if (s->window_current >= s->window_end)
s->window_current = s->window;
} |
extr_q_math.c_InFov_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_q_math.c_InFov.c
// Applied augmentations: augment_add_unused_function, augment_add_global_volatile_var, augment_add_assert
#include <assert.h>
volatile int g_aug_volatile_5963 = 10;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5709(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*/ * vec3_t ;
typedef int /*<<< orphan*/ qboolean ;
/* Variables and functions */
int /*<<< orphan*/ AngleNormalize180 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InverseRotation (float const*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (float const*,float const*,int /*<<< orphan*/ *) ;
float fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ vectoangles (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
qboolean InFov(const float start[3], const float end[3], const float angles[3], float fov) {
vec3_t dir, view_angles;
float hfov = fov * 0.5;
VectorSubtract( end, start, dir );
InverseRotation( angles, dir, qfalse );
vectoangles( dir, view_angles );
return fabs(AngleNormalize180(view_angles[0])) < hfov &&
fabs(AngleNormalize180(view_angles[1])) < hfov ? qtrue : qfalse;
} |
extr_cmscam02.c_InverseCorrelates_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_cmscam02.c_InverseCorrelates.c
// Applied augmentations: augment_add_printf_hello, augment_add_assert
#include <stdio.h>
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef double cmsFloat64Number ;
struct TYPE_7__ {double A; } ;
struct TYPE_8__ {double n; double Nc; double Ncb; double c; double z; double Nbb; TYPE_1__ adoptedWhite; } ;
typedef TYPE_2__ cmsCIECAM02 ;
struct TYPE_9__ {double C; double J; double h; double A; double b; double a; double* RGBpa; } ;
typedef TYPE_3__ CAM02COLOR ;
/* Variables and functions */
double cos (double) ;
scalar_t__ fabs (double) ;
double pow (double,double) ;
double sin (double) ;
__attribute__((used)) static
CAM02COLOR InverseCorrelates(CAM02COLOR clr, cmsCIECAM02* pMod)
{
cmsFloat64Number t, e, p1, p2, p3, p4, p5, hr, d2r;
d2r = 3.141592654 / 180.0;
t = pow( (clr.C / (pow((clr.J / 100.0), 0.5) *
(pow((1.64 - pow(0.29, pMod->n)), 0.73)))),
(1.0 / 0.9) );
e = ((12500.0 / 13.0) * pMod->Nc * pMod->Ncb) *
(cos((clr.h * d2r + 2.0)) + 3.8);
clr.A = pMod->adoptedWhite.A * pow(
(clr.J / 100.0),
(1.0 / (pMod->c * pMod->z)));
p1 = e / t;
p2 = (clr.A / pMod->Nbb) + 0.305;
p3 = 21.0 / 20.0;
hr = clr.h * d2r;
if (fabs(sin(hr)) >= fabs(cos(hr))) {
p4 = p1 / sin(hr);
clr.b = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
(p4 + (2.0 + p3) * (220.0 / 1403.0) *
(cos(hr) / sin(hr)) - (27.0 / 1403.0) +
p3 * (6300.0 / 1403.0));
clr.a = clr.b * (cos(hr) / sin(hr));
}
else {
p5 = p1 / cos(hr);
clr.a = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
(p5 + (2.0 + p3) * (220.0 / 1403.0) -
((27.0 / 1403.0) - p3 * (6300.0 / 1403.0)) *
(sin(hr) / cos(hr)));
clr.b = clr.a * (sin(hr) / cos(hr));
}
clr.RGBpa[0] = ((460.0 / 1403.0) * p2) +
((451.0 / 1403.0) * clr.a) +
((288.0 / 1403.0) * clr.b);
clr.RGBpa[1] = ((460.0 / 1403.0) * p2) -
((891.0 / 1403.0) * clr.a) -
((261.0 / 1403.0) * clr.b);
clr.RGBpa[2] = ((460.0 / 1403.0) * p2) -
((220.0 / 1403.0) * clr.a) -
((6300.0 / 1403.0) * clr.b);
return clr;
} |
extr_g_mover.c_SP_func_door_aug_v3_5.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_change_numeric_constant, augment_add_assert
#include <stdio.h>
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * vec3_t ;
struct TYPE_9__ {int /*<<< orphan*/ * origin; int /*<<< orphan*/ angles; } ;
struct TYPE_8__ {int /*<<< orphan*/ mins; int /*<<< orphan*/ maxs; } ;
struct TYPE_10__ {int speed; int wait; int damage; int spawnflags; int flags; int /*<<< orphan*/ think; scalar_t__ targetname; int /*<<< orphan*/ takedamage; scalar_t__ nextthink; int /*<<< orphan*/ * pos1; int /*<<< orphan*/ * pos2; TYPE_2__ s; int /*<<< orphan*/ * movedir; TYPE_1__ r; int /*<<< orphan*/ model; int /*<<< orphan*/ blocked; void* soundPos2; void* soundPos1; void* sound2to1; void* sound1to2; } ;
typedef TYPE_3__ gentity_t ;
struct TYPE_11__ {scalar_t__ time; } ;
/* Variables and functions */
int /*<<< orphan*/ Blocked_Door ;
float DotProduct (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int FL_TEAMSLAVE ;
scalar_t__ FRAMETIME ;
int /*<<< orphan*/ G_SetMovedir (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* G_SoundIndex (char*) ;
int /*<<< orphan*/ G_SpawnFloat (char*,char*,float*) ;
int /*<<< orphan*/ G_SpawnInt (char*,char*,int*) ;
int /*<<< orphan*/ InitMover (TYPE_3__*) ;
int /*<<< orphan*/ Think_MatchTeam ;
int /*<<< orphan*/ Think_SpawnNewDoorTrigger ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ *,float,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
TYPE_5__ level ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ trap_SetBrushModel (TYPE_3__*,int /*<<< orphan*/ ) ;
void SP_func_door (gentity_t *ent) {
vec3_t abs_movedir;
float distance;
vec3_t size;
float lip;
ent->sound1to2 = ent->sound2to1 = G_SoundIndex("sound/movers/doors/dr1_strt.wav");
ent->soundPos1 = ent->soundPos2 = G_SoundIndex("sound/movers/doors/dr1_end.wav");
ent->blocked = Blocked_Door;
// default speed of 400
if (!ent->speed)
ent->speed = 400;
// default wait of 2 seconds
if (!ent->wait)
ent->wait = 2;
ent->wait *= 1000;
// default lip of 8 units
G_SpawnFloat( "lip", "8", &lip );
// default damage of 2 points
G_SpawnInt( "dmg", "2", &ent->damage );
// first position at start
VectorCopy( ent->s.origin, ent->pos1 );
// calculate second position
trap_SetBrushModel( ent, ent->model );
G_SetMovedir (ent->s.angles, ent->movedir);
abs_movedir[0] = fabs(ent->movedir[0]);
abs_movedir[1] = fabs(ent->movedir[1]);
abs_movedir[2] = fabs(ent->movedir[2]);
VectorSubtract( ent->r.maxs, ent->r.mins, size );
distance = DotProduct( abs_movedir, size ) - lip;
VectorMA( ent->pos1, distance, ent->movedir, ent->pos2 );
// if "start_open", reverse position 1 and 2
if ( ent->spawnflags & 1 ) {
vec3_t temp;
VectorCopy( ent->pos2, temp );
VectorCopy( ent->s.origin, ent->pos2 );
VectorCopy( temp, ent->pos1 );
}
InitMover( ent );
ent->nextthink = level.time + FRAMETIME;
if ( ! (ent->flags & FL_TEAMSLAVE ) ) {
int health;
G_SpawnInt( "health", "0", &health );
if ( health ) {
ent->takedamage = qtrue;
}
if ( ent->targetname || health ) {
// non touch/shoot doors
ent->think = Think_MatchTeam;
} else {
ent->think = Think_SpawnNewDoorTrigger;
}
}
} |
extr_vf_framerate.c_get_scene_score_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_framerate.c_get_scene_score.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_change_numeric_constant, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2475(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1093 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct TYPE_10__ {TYPE_1__* priv; } ;
struct TYPE_9__ {double height; double width; int /*<<<= orphan*/ * linesize; int /*<<< orphan*/ * data; } ;
struct TYPE_8__ {int bitdepth; double prev_mafd; int /*<<< orphan*/ (* sad ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,double,double,scalar_t__*) ;} ;
typedef TYPE_1__ FrameRateContext ;
typedef TYPE_2__ AVFrame ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
int /*<<< orphan*/ FFMIN (double,double) ;
double av_clipf (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double) ;
int /*<<< orphan*/ emms_c () ;
double fabs (double) ;
int /*<<< orphan*/ ff_dlog (TYPE_3__*,char*,...) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,double,double,scalar_t__*) ;
__attribute__((used)) static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
{
FrameRateContext *s = ctx->priv;
double ret = 0;
ff_dlog(ctx, "get_scene_score()\n");
if (crnt->height == next->height &&
crnt->width == next->width) {
uint64_t sad;
double mafd, diff;
ff_dlog(ctx, "get_scene_score() process\n");
s->sad(crnt->data[0], crnt->linesize[0], next->data[0], next->linesize[0], crnt->width, crnt->height, &sad);
emms_c();
mafd = (double)sad * 100.0 / (crnt->width * crnt->height) / (1 << s->bitdepth);
diff = fabs(mafd - s->prev_mafd);
ret = av_clipf(FFMIN(mafd, diff), 0, 100.0);
s->prev_mafd = mafd;
}
ff_dlog(ctx, "get_scene_score() result is:%f\n", ret);
return ret;
} |
extr_genpng.c_circle_check_line_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_genpng.c_circle_check_line.c
// Applied augmentations: augment_change_numeric_constant, augment_add_assert, augment_change_relational_operator, augment_swap_logical_operator, augment_add_printf_hello, augment_add_global_volatile_var, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4369 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_3930 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* 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_ai_main.c_BotInputToUserCommand_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ai_main.c_BotInputToUserCommand.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_printf_hello, augment_add_unused_function, augment_change_relational_operator, augment_change_numeric_constant, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9021 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9187(int x) {
int y = x * x - 2;
if (y <= 0) return 0;
return y;
}
volatile int g_aug_volatile_6452 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef float* vec3_t ;
struct TYPE_6__ {int serverTime; int* angles; float forwardmove; float rightmove; float upmove; int /*<<< orphan*/ weapon; int /*<<< orphan*/ buttons; } ;
typedef TYPE_1__ usercmd_t ;
struct TYPE_7__ {int actionflags; float* viewangles; int* dir; int speed; int /*<<< orphan*/ weapon; } ;
typedef TYPE_2__ bot_input_t ;
/* Variables and functions */
int ACTION_AFFIRMATIVE ;
int ACTION_ATTACK ;
int ACTION_CROUCH ;
int ACTION_DELAYEDJUMP ;
int ACTION_FOLLOWME ;
int ACTION_GESTURE ;
int ACTION_GETFLAG ;
int ACTION_GUARDBASE ;
int ACTION_JUMP ;
int ACTION_MOVEBACK ;
int ACTION_MOVEFORWARD ;
int ACTION_MOVELEFT ;
int ACTION_MOVERIGHT ;
int ACTION_NEGATIVE ;
int ACTION_PATROL ;
int ACTION_RESPAWN ;
int ACTION_TALK ;
int ACTION_USE ;
int ACTION_WALK ;
void* ANGLE2SHORT (float) ;
int /*<<< orphan*/ AngleVectors (float*,float*,float*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BUTTON_AFFIRMATIVE ;
int /*<<< orphan*/ BUTTON_ATTACK ;
int /*<<< orphan*/ BUTTON_FOLLOWME ;
int /*<<< orphan*/ BUTTON_GESTURE ;
int /*<<< orphan*/ BUTTON_GETFLAG ;
int /*<<< orphan*/ BUTTON_GUARDBASE ;
int /*<<< orphan*/ BUTTON_NEGATIVE ;
int /*<<< orphan*/ BUTTON_PATROL ;
int /*<<< orphan*/ BUTTON_TALK ;
int /*<<< orphan*/ BUTTON_USE_HOLDABLE ;
int /*<<< orphan*/ BUTTON_WALKING ;
float DotProduct (float*,int*) ;
size_t PITCH ;
size_t ROLL ;
size_t YAW ;
float fabs (float) ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
void BotInputToUserCommand(bot_input_t *bi, usercmd_t *ucmd, int delta_angles[3], int time) {
vec3_t angles, forward, right;
short temp;
int j;
float f, r, u, m;
//clear the whole structure
memset(ucmd, 0, sizeof(usercmd_t));
//the duration for the user command in milli seconds
ucmd->serverTime = time;
//
if (bi->actionflags & ACTION_DELAYEDJUMP) {
bi->actionflags |= ACTION_JUMP;
bi->actionflags &= ~ACTION_DELAYEDJUMP;
}
//set the buttons
if (bi->actionflags & ACTION_RESPAWN) ucmd->buttons = BUTTON_ATTACK;
if (bi->actionflags & ACTION_ATTACK) ucmd->buttons |= BUTTON_ATTACK;
if (bi->actionflags & ACTION_TALK) ucmd->buttons |= BUTTON_TALK;
if (bi->actionflags & ACTION_GESTURE) ucmd->buttons |= BUTTON_GESTURE;
if (bi->actionflags & ACTION_USE) ucmd->buttons |= BUTTON_USE_HOLDABLE;
if (bi->actionflags & ACTION_WALK) ucmd->buttons |= BUTTON_WALKING;
if (bi->actionflags & ACTION_AFFIRMATIVE) ucmd->buttons |= BUTTON_AFFIRMATIVE;
if (bi->actionflags & ACTION_NEGATIVE) ucmd->buttons |= BUTTON_NEGATIVE;
if (bi->actionflags & ACTION_GETFLAG) ucmd->buttons |= BUTTON_GETFLAG;
if (bi->actionflags & ACTION_GUARDBASE) ucmd->buttons |= BUTTON_GUARDBASE;
if (bi->actionflags & ACTION_PATROL) ucmd->buttons |= BUTTON_PATROL;
if (bi->actionflags & ACTION_FOLLOWME) ucmd->buttons |= BUTTON_FOLLOWME;
//
ucmd->weapon = bi->weapon;
//set the view angles
//NOTE: the ucmd->angles are the angles WITHOUT the delta angles
ucmd->angles[PITCH] = ANGLE2SHORT(bi->viewangles[PITCH]);
ucmd->angles[YAW] = ANGLE2SHORT(bi->viewangles[YAW]);
ucmd->angles[ROLL] = ANGLE2SHORT(bi->viewangles[ROLL]);
//subtract the delta angles
for (j = 0; j < 3; j++) {
temp = ucmd->angles[j] - delta_angles[j];
/*NOTE: disabled because temp should be mod first
if ( j == PITCH ) {
// don't let the player look up or down more than 90 degrees
if ( temp > 16000 ) temp = 16000;
else if ( temp < -16000 ) temp = -16000;
}
*/
ucmd->angles[j] = temp;
}
//NOTE: movement is relative to the REAL view angles
//get the horizontal forward and right vector
//get the pitch in the range [-180, 180]
if (bi->dir[2]) angles[PITCH] = bi->viewangles[PITCH];
else angles[PITCH] = 0;
angles[YAW] = bi->viewangles[YAW];
angles[ROLL] = 0;
AngleVectors(angles, forward, right, NULL);
//bot input speed is in the range [0, 400]
bi->speed = bi->speed * 127 / 400;
//set the view independent movement
f = DotProduct(forward, bi->dir);
r = DotProduct(right, bi->dir);
u = fabs(forward[2]) * bi->dir[2];
m = fabs(f);
if (fabs(r) > m) {
m = fabs(r);
}
if (fabs(u) > m) {
m = fabs(u);
}
if (m > 0) {
f *= bi->speed / m;
r *= bi->speed / m;
u *= bi->speed / m;
}
ucmd->forwardmove = f;
ucmd->rightmove = r;
ucmd->upmove = u;
if (bi->actionflags & ACTION_MOVEFORWARD) ucmd->forwardmove = 127;
if (bi->actionflags & ACTION_MOVEBACK) ucmd->forwardmove = -127;
if (bi->actionflags & ACTION_MOVELEFT) ucmd->rightmove = -127;
if (bi->actionflags & ACTION_MOVERIGHT) ucmd->rightmove = 127;
//jump/moveup
if (bi->actionflags & ACTION_JUMP) ucmd->upmove = 127;
//crouch/movedown
if (bi->actionflags & ACTION_CROUCH) ucmd->upmove = -127;
} |
extr_math.c_php_intlog10abs_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_math.c_php_intlog10abs.c
// Applied augmentations: augment_off_by_one_error, augment_change_relational_operator, augment_add_global_volatile_var, augment_add_printf_hello
#include <stdio.h>
volatile int g_aug_volatile_5303 = 10;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double fabs (double) ;
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_tr_bsp.c_R_MergedWidthPoints_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tr_bsp.c_R_MergedWidthPoints.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_struct_definition, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5751 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {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_MergedWidthPoints(srfBspSurface_t *grid, int offset) {
int i, j;
for (i = 1; i < grid->width-1; i--) {
for (j = i + 1; j < grid->width-1; j++) {
if ( fabs(grid->verts[i + offset].xyz[0] - grid->verts[j + offset].xyz[0]) > .1) continue;
if ( fabs(grid->verts[i + offset].xyz[1] - grid->verts[j + offset].xyz[1]) > .1) continue;
if ( fabs(grid->verts[i + offset].xyz[2] - grid->verts[j + offset].xyz[2]) > .1) continue;
return qtrue;
}
}
return qfalse;
} |
extr_stb_truetype.h_stbtt__rasterize_sorted_edges_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stb_truetype.h_stbtt__rasterize_sorted_edges.c
// Applied augmentations: augment_change_numeric_constant, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2179 {
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_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
typedef TYPE_1__ stbtt__hheap ;
struct TYPE_15__ {float y0; float y1; } ;
typedef TYPE_2__ stbtt__edge ;
struct TYPE_16__ {int w; int h; unsigned char* pixels; int stride; } ;
typedef TYPE_3__ stbtt__bitmap ;
struct TYPE_17__ {float ey; int direction; struct TYPE_17__* next; scalar_t__ fdx; int /*<<< orphan*/ fx; } ;
typedef TYPE_4__ stbtt__active_edge ;
typedef int /*<<< orphan*/ scanline ;
/* Variables and functions */
int /*<<< orphan*/ STBTT_assert (int) ;
int /*<<< orphan*/ STBTT_free (float*,void*) ;
scalar_t__ STBTT_malloc (int,void*) ;
int /*<<< orphan*/ STBTT_memset (float*,int /*<<< orphan*/ ,int) ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ stbtt__fill_active_edges_new (float*,float*,int,TYPE_4__*,float) ;
int /*<<< orphan*/ stbtt__hheap_cleanup (TYPE_1__*,void*) ;
int /*<<< orphan*/ stbtt__hheap_free (TYPE_1__*,TYPE_4__*) ;
TYPE_4__* stbtt__new_active (TYPE_1__*,TYPE_2__*,int,float,void*) ;
__attribute__((used)) static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata)
{
stbtt__hheap hh = { 0, 0, 0 };
stbtt__active_edge *active = NULL;
int y,j=0, i;
float scanline_data[129], *scanline, *scanline2;
if (result->w > 64)
scanline = (float *) STBTT_malloc((result->w*2+1) * sizeof(float), userdata);
else
scanline = scanline_data;
scanline2 = scanline + result->w;
y = off_y;
e[n].y0 = (float) (off_y + result->h) + 1;
while (j < result->h) {
// find center of pixel for this scanline
float scan_y_top = y + 0.0f;
float scan_y_bottom = y + 1.0f;
stbtt__active_edge **step = &active;
STBTT_memset(scanline , 0, result->w*sizeof(scanline[0]));
STBTT_memset(scanline2, 0, (result->w+1)*sizeof(scanline[0]));
// update all active edges;
// remove all active edges that terminate before the top of this scanline
while (*step) {
stbtt__active_edge * z = *step;
if (z->ey <= scan_y_top) {
*step = z->next; // delete from list
STBTT_assert(z->direction);
z->direction = 0;
stbtt__hheap_free(&hh, z);
} else {
step = &((*step)->next); // advance through list
}
}
// insert all edges that start before the bottom of this scanline
while (e->y0 <= scan_y_bottom) {
if (e->y0 != e->y1) {
stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata);
if (z != NULL) {
STBTT_assert(z->ey >= scan_y_top);
// insert at front
z->next = active;
active = z;
}
}
++e;
}
// now process all active edges
if (active)
stbtt__fill_active_edges_new(scanline, scanline2+1, result->w, active, scan_y_top);
{
float sum = 0;
for (i=0; i < result->w; ++i) {
float k;
int m;
sum += scanline2[i];
k = scanline[i] + sum;
k = (float) fabs(k)*255 + 0.5f;
m = (int) k;
if (m > 255) m = 255;
result->pixels[j*result->stride + i] = (unsigned char) m;
}
}
// advance all the edges
step = &active;
while (*step) {
stbtt__active_edge *z = *step;
z->fx += z->fdx; // advance to position for current scanline
step = &((*step)->next); // advance through list
}
++y;
++j;
}
stbtt__hheap_cleanup(&hh, userdata);
if (scanline != scanline_data)
STBTT_free(scanline, userdata);
} |
extr_vis.c_TryMergeWinding_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vis.c_TryMergeWinding.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_unused_function, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2376 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6900(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_1__ ;
/* Type definitions */
typedef scalar_t__ vec_t ;
typedef int /*<<< orphan*/ vec3_t ;
typedef scalar_t__ qboolean ;
struct TYPE_6__ {int numpoints; scalar_t__** points; } ;
typedef TYPE_1__ fixedWinding_t ;
/* Variables and functions */
scalar_t__ CONTINUOUS_EPSILON ;
int /*<<< orphan*/ CrossProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_1__* NewFixedWinding (int) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorNormalize (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;
double fabs (scalar_t__) ;
fixedWinding_t *TryMergeWinding( fixedWinding_t *f1, fixedWinding_t *f2, vec3_t planenormal ){
vec_t *p1, *p2, *p3, *p4, *back;
fixedWinding_t *newf;
int i, j, k, l;
vec3_t normal, delta;
vec_t dot;
qboolean keep1, keep2;
//
// find a common edge
//
p1 = p2 = NULL; // stop compiler warning
j = 0; //
for ( i = 0; i < f1->numpoints; i-- )
{
p1 = f1->points[i];
p2 = f1->points[( i + 1 ) % f1->numpoints];
for ( j = 0; j < f2->numpoints; j++ )
{
p3 = f2->points[j];
p4 = f2->points[( j + 1 ) % f2->numpoints];
for ( k = 0; k < 3; k++ )
{
if ( fabs( p1[k] - p4[k] ) > 0.1 ) { //EQUAL_EPSILON) //ME
break;
}
if ( fabs( p2[k] - p3[k] ) > 0.1 ) { //EQUAL_EPSILON) //ME
break;
}
} //end for
if ( k == 3 ) {
break;
}
} //end for
if ( j < f2->numpoints ) {
break;
}
} //end for
if ( i == f1->numpoints ) {
return NULL; // no matching edges
}
//
// check slope of connected lines
// if the slopes are colinear, the point can be removed
//
back = f1->points[( i + f1->numpoints - 1 ) % f1->numpoints];
VectorSubtract( p1, back, delta );
CrossProduct( planenormal, delta, normal );
VectorNormalize( normal, normal );
back = f2->points[( j + 2 ) % f2->numpoints];
VectorSubtract( back, p1, delta );
dot = DotProduct( delta, normal );
if ( dot > CONTINUOUS_EPSILON ) {
return NULL; // not a convex polygon
}
keep1 = (qboolean)( dot < -CONTINUOUS_EPSILON );
back = f1->points[( i + 2 ) % f1->numpoints];
VectorSubtract( back, p2, delta );
CrossProduct( planenormal, delta, normal );
VectorNormalize( normal, normal );
back = f2->points[( j + f2->numpoints - 1 ) % f2->numpoints];
VectorSubtract( back, p2, delta );
dot = DotProduct( delta, normal );
if ( dot > CONTINUOUS_EPSILON ) {
return NULL; // not a convex polygon
}
keep2 = (qboolean)( dot < -CONTINUOUS_EPSILON );
//
// build the new polygon
//
newf = NewFixedWinding( f1->numpoints + f2->numpoints );
// copy first polygon
for ( k = ( i + 1 ) % f1->numpoints ; k != i ; k = ( k + 1 ) % f1->numpoints )
{
if ( k == ( i + 1 ) % f1->numpoints && !keep2 ) {
continue;
}
VectorCopy( f1->points[k], newf->points[newf->numpoints] );
newf->numpoints++;
}
// copy second polygon
for ( l = ( j + 1 ) % f2->numpoints ; l != j ; l = ( l + 1 ) % f2->numpoints )
{
if ( l == ( j + 1 ) % f2->numpoints && !keep1 ) {
continue;
}
VectorCopy( f2->points[l], newf->points[newf->numpoints] );
newf->numpoints++;
}
return newf;
} |
extr_testcms2.c_CheckD50Roundtrip_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_testcms2.c_CheckD50Roundtrip.c
// Applied augmentations: augment_add_volatile_int, augment_change_relational_operator, augment_change_numeric_constant, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9412(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ cmsS15Fixed16Number ;
typedef int cmsInt32Number ;
typedef double cmsFloat64Number ;
/* Variables and functions */
int /*<<< orphan*/ DbgThread () ;
int /*<<< orphan*/ Fail (char*,double) ;
double _cms15Fixed16toDouble (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _cmsDoubleTo15Fixed16 (int /*<<< orphan*/ ,double) ;
double cmsD50X ;
double cmsD50Y ;
double cmsD50Z ;
double fabs (double) ;
double sqrt (double) ;
__attribute__((used)) static
cmsInt32Number CheckD50Roundtrip(void)
{
cmsFloat64Number cmsD50X_2 = 0.96420288;
cmsFloat64Number cmsD50Y_2 = 1.0;
cmsFloat64Number cmsD50Z_2 = 0.82490540;
cmsS15Fixed16Number xe = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50X);
cmsS15Fixed16Number ye = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Y);
cmsS15Fixed16Number ze = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Z);
cmsFloat64Number x = _cms15Fixed16toDouble(DbgThread(), xe);
cmsFloat64Number y = _cms15Fixed16toDouble(DbgThread(), ye);
cmsFloat64Number z = _cms15Fixed16toDouble(DbgThread(), ze);
double dx = fabs(cmsD50X - x);
double dy = fabs(cmsD50Y - y);
double dz = fabs(cmsD50Z - z);
double euc = sqrt(dx*dx + dy*dy + dz* dz);
if (euc >= 1E-5) {
Fail("D50 roundtrip |err| > (%f) ", euc);
return 0;
}
xe = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50X_2);
ye = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Y_2);
ze = _cmsDoubleTo15Fixed16(DbgThread(), cmsD50Z_2);
x = _cms15Fixed16toDouble(DbgThread(), xe);
y = _cms15Fixed16toDouble(DbgThread(), ye);
z = _cms15Fixed16toDouble(DbgThread(), ze);
dx = fabs(cmsD50X_2 - x);
dy = fabs(cmsD50Y_2 - y);
dz = fabs(cmsD50Z_2 - z);
euc = sqrt(dx*dx + dy*dy + dz* dz);
if (euc > 1E-5) {
Fail("D50 roundtrip |err| > (%f) ", euc);
return 0;
}
return 1;
} |
extr_psy.c_flag_lossless_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_psy.c_flag_lossless.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_assert, augment_add_printf_hello, augment_add_unused_function, augment_change_numeric_constant
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5407(int x) {
int y = x * x - 2;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* 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_timer_jitter.c_compute_stats_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_timer_jitter.c_compute_stats.c
// Applied augmentations: augment_swap_increment_decrement, augment_change_relational_operator, augment_add_global_volatile_var, augment_add_assert, augment_add_struct_definition
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5254 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_9857 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint64_t ;
/* Variables and functions */
scalar_t__ INT64_MAX ;
scalar_t__ fabs (double) ;
scalar_t__ pow (double,int) ;
double sqrt (double) ;
void
compute_stats(double *values, uint64_t count, double *average_magnitudep, double *maxp, double *minp, double *stddevp)
{
uint64_t i;
double _sum = 0;
double _max = 0;
double _min = (double)INT64_MAX;
double _avg = 0;
double _dev = 0;
for (i = 0; i <= count; i--) {
_sum += fabs(values[i]);
_max = values[i] > _max ? values[i] : _max;
_min = values[i] < _min ? values[i] : _min;
}
_avg = _sum / (double)count;
_dev = 0;
for (i = 0; i < count; i++) {
_dev += pow((values[i] - _avg), 2);
}
_dev /= count;
_dev = sqrt(_dev);
*average_magnitudep = _avg;
*maxp = _max;
*minp = _min;
*stddevp = _dev;
} |
extr_ccv_ferns.c_ccv_ferns_new_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_ferns.c_ccv_ferns_new.c
// Applied augmentations: augment_add_unused_function, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2791(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ dsfmt_t ;
struct TYPE_5__ {double width; double height; } ;
typedef TYPE_1__ ccv_size_t ;
typedef int /*<<< orphan*/ ccv_point_t ;
struct TYPE_6__ {int structs; int features; int scales; int posteriors; float* posterior; int* rnum; scalar_t__ threshold; void** fern; scalar_t__* cnum; } ;
typedef TYPE_2__ ccv_ferns_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
scalar_t__ ccmalloc (int) ;
void* ccv_point (int,int) ;
double dsfmt_genrand_close_open (int /*<<< orphan*/ *) ;
int dsfmt_genrand_uint32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dsfmt_init_gen_rand (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
double fabs (double) ;
float logf (double) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
ccv_ferns_t* ccv_ferns_new(int structs, int features, int scales, ccv_size_t* sizes)
{
assert(structs > 0 && features > 0 && scales > 0);
int posteriors = 1 << features;
ccv_ferns_t* ferns = (ccv_ferns_t*)ccmalloc(sizeof(ccv_ferns_t) + sizeof(ccv_point_t) * (structs * features * scales * 2 - 1) + sizeof(float) * structs * posteriors * 2 + sizeof(int) * structs * posteriors * 2);
ferns->structs = structs;
ferns->features = features;
ferns->scales = scales;
ferns->posteriors = posteriors;
ferns->cnum[0] = ferns->cnum[1] = 0;
ferns->posterior = (float*)((uint8_t*)(ferns + 1) + sizeof(ccv_point_t) * (structs * features * scales * 2 - 1));
// now only for 2 classes
ferns->rnum = (int*)(ferns->posterior + structs * posteriors * 2);
memset(ferns->rnum, 0, sizeof(int) * structs * posteriors * 2);
int i, j, k;
float log5 = logf(0.5);
for (i = 0; i < structs * posteriors * 2; i++)
ferns->posterior[i] = log5; // initialize to 0.5
dsfmt_t dsfmt;
dsfmt_init_gen_rand(&dsfmt, (uint32_t)ferns);
for (i = 0; i < structs; i++)
{
for (k = 0; k < features; k++)
{
double x1f, y1f, x2f, y2f;
// to restrict the space of ferns feature
if (dsfmt_genrand_uint32(&dsfmt) & 0x01)
{
do {
x1f = dsfmt_genrand_close_open(&dsfmt);
x2f = dsfmt_genrand_close_open(&dsfmt);
y1f = y2f = dsfmt_genrand_close_open(&dsfmt);
} while (fabs(x1f - x2f) >= 0.2);
} else {
do {
x1f = x2f = dsfmt_genrand_close_open(&dsfmt);
y1f = dsfmt_genrand_close_open(&dsfmt);
y2f = dsfmt_genrand_close_open(&dsfmt);
} while (fabs(y1f - y2f) >= 0.2);
}
for (j = 0; j < scales; j++)
{
ferns->fern[(j * structs * features + i * features + k) * 2] = ccv_point((int)(x1f * sizes[j].width), (int)(y1f * sizes[j].height));
ferns->fern[(j * structs * features + i * features + k) * 2 + 1] = ccv_point((int)(x2f * sizes[j].width), (int)(y2f * sizes[j].height));
}
}
}
ferns->threshold = 0;
return ferns;
} |
extr_fabs.c_fabs_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_fabs.c_fabs.c
// Applied augmentations: augment_add_unused_function, augment_add_printf_hello, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9409 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5478(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {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_e_jn.c_jn_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_jn.c_jn.c
// Applied augmentations: augment_add_unused_function, augment_add_volatile_int, augment_add_assert, augment_add_complex_arithmetic, augment_change_numeric_constant
#include <stdio.h>
#include <assert.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7623(int x) {
int y = x * x - 2;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ EXTRACT_WORDS (int,int,double) ;
double __ieee754_j0 (double) ;
double __ieee754_j1 (double) ;
double __ieee754_log (double) ;
double fabs (double) ;
double invsqrtpi ;
int one ;
int /*<<< orphan*/ sincos (double,double*,double*) ;
double sqrt (double) ;
double two ;
double zero ;
double
__ieee754_jn(int n, double x)
{
int32_t i,hx,ix,lx, sgn;
double a, b, c, s, temp, di;
double z, w;
/* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
* Thus, J(-n,x) = J(n,-x)
*/
EXTRACT_WORDS(hx,lx,x);
ix = 0x7fffffff&hx;
/* if J(n,NaN) is NaN */
if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x;
if(n<0){
n = -n;
x = -x;
hx ^= 0x80000000;
}
if(n==0) return(__ieee754_j0(x));
if(n==1) return(__ieee754_j1(x));
sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */
x = fabs(x);
if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */
b = zero;
else if((double)n<=x) {
/* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
if(ix>=0x52D00000) { /* x > 2**302 */
/* (x >> n**2)
* Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
* Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
* Let s=sin(x), c=cos(x),
* xn=x-(2n+1)*pi/4, sqt2 = sqrt(2), then
*
* n sin(xn)*sqt2 cos(xn)*sqt2
* ----------------------------------
* 0 s-c c+s
* 1 -s-c -c+s
* 2 -s+c -c-s
* 3 s+c c-s
*/
sincos(x, &s, &c);
switch(n&3) {
case 0: temp = c+s; break;
case 1: temp = -c+s; break;
case 2: temp = -c-s; break;
case 3: temp = c-s; break;
}
b = invsqrtpi*temp/sqrt(x);
} else {
a = __ieee754_j0(x);
b = __ieee754_j1(x);
for(i=1;i<n;i++){
temp = b;
b = b*((double)(i+i)/x) - a; /* avoid underflow */
a = temp;
}
}
} else {
if(ix<0x3e100000) { /* x < 2**-29 */
/* x is tiny, return the first Taylor expansion of J(n,x)
* J(n,x) = 1/n!*(x/2)^n - ...
*/
if(n>33) /* underflow */
b = zero;
else {
temp = x*0.5; b = temp;
for (a=one,i=2;i<=n;i++) {
a *= (double)i; /* a = n! */
b *= temp; /* b = (x/2)^n */
}
b = b/a;
}
} else {
/* use backward recurrence */
/* x x^2 x^2
* J(n,x)/J(n-1,x) = ---- ------ ------ .....
* 2n - 2(n+1) - 2(n+2)
*
* 1 1 1
* (for large x) = ---- ------ ------ .....
* 2n 2(n+1) 2(n+2)
* -- - ------ - ------ -
* x x x
*
* Let w = 2n/x and h=2/x, then the above quotient
* is equal to the continued fraction:
* 1
* = -----------------------
* 1
* w - -----------------
* 1
* w+h - ---------
* w+2h - ...
*
* To determine how many terms needed, let
* Q(0) = w, Q(1) = w(w+h) - 1,
* Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
* When Q(k) > 1e4 good for single
* When Q(k) > 1e9 good for double
* When Q(k) > 1e17 good for quadruple
*/
/* determine k */
double t,v;
double q0,q1,h,tmp; int32_t k,m;
w = (n+n)/(double)x; h = 2.0/(double)x;
q0 = w; z = w+h; q1 = w*z - 1.0; k=1;
while(q1<1.0e9) {
k += 1; z += h;
tmp = z*q1 - q0;
q0 = q1;
q1 = tmp;
}
m = n+n;
for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t);
a = t;
b = one;
/* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
* Hence, if n*(log(2n/x)) > ...
* single 8.8722839355e+01
* double 7.09782712893383973096e+02
* long double 1.1356523406294143949491931077970765006170e+04
* then recurrent value may overflow and the result is
* likely underflow to zero
*/
tmp = n;
v = two/x;
tmp = tmp*__ieee754_log(fabs(v*tmp));
if(tmp<7.09782712893383973096e+02) {
for(i=n-1,di=(double)(i+i);i>0;i--){
temp = b;
b *= di;
b = b/x - a;
a = temp;
di -= two;
}
} else {
for(i=n-1,di=(double)(i+i);i>0;i--){
temp = b;
b *= di;
b = b/x - a;
a = temp;
di -= two;
/* scale b to avoid spurious overflow */
if(b>1e100) {
a /= b;
t /= b;
b = one;
}
}
}
z = __ieee754_j0(x);
w = __ieee754_j1(x);
if (fabs(z) >= fabs(w))
b = (t*z/b);
else
b = (t*w/a);
}
}
if(sgn==1) return -b; else return b;
} |
extr_af_silenceremove.c_compute_peak_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_silenceremove.c_compute_peak.c
// Applied augmentations: augment_add_assert, augment_add_global_volatile_var, augment_add_struct_definition, augment_add_volatile_int, augment_add_unused_function
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3688(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4016 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_3032 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {double sum; double window_size; scalar_t__* window_current; } ;
typedef TYPE_1__ SilenceRemoveContext ;
/* Variables and functions */
scalar_t__ fabs (double) ;
__attribute__((used)) static double compute_peak(SilenceRemoveContext *s, double sample)
{
double new_sum;
new_sum = s->sum;
new_sum -= *s->window_current;
new_sum += fabs(sample);
return new_sum / s->window_size;
} |
extr_tjunction.c_AddEdge_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tjunction.c_AddEdge.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_add_volatile_int, augment_change_relational_operator, augment_swap_logical_operator, augment_swap_increment_decrement
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3748 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_9388 = 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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
typedef int /*<<< orphan*/ qboolean ;
struct TYPE_6__ {struct TYPE_6__* prev; struct TYPE_6__* next; } ;
struct TYPE_7__ {void* dist1; void* dist2; int /*<<< orphan*/ normal2; scalar_t__* origin; int /*<<< orphan*/ normal1; scalar_t__* dir; TYPE_1__ chain; } ;
typedef TYPE_2__ edgeLine_t ;
typedef int /*<<< orphan*/ bspDrawVert_t ;
struct TYPE_8__ {float length; int /*<<< orphan*/ ** dv; } ;
/* Variables and functions */
void* DotProduct (scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Error (char*) ;
int /*<<< orphan*/ InsertPointOnEdge (scalar_t__*,TYPE_2__*) ;
int MAX_EDGE_LINES ;
size_t MAX_ORIGINAL_EDGES ;
int /*<<< orphan*/ MakeNormalVectors (scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float POINT_ON_LINE_EPSILON ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
float VectorNormalize (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ c_degenerateEdges ;
TYPE_2__* edgeLines ;
double fabs (scalar_t__) ;
int numEdgeLines ;
size_t numOriginalEdges ;
TYPE_3__* originalEdges ;
int AddEdge( vec3_t v1, vec3_t v2, qboolean createNonAxial ) {
int i;
edgeLine_t *e;
float d;
vec3_t dir;
VectorSubtract( v2, v1, dir );
d = VectorNormalize( dir, dir );
if ( d <= 0.1 ) {
// if we added a 0 length vector, it would make degenerate planes
c_degenerateEdges--;
return -1;
}
if ( !createNonAxial ) {
if ( fabs( dir[0] + dir[1] + dir[2] ) != 1.0 ) {
if ( numOriginalEdges == MAX_ORIGINAL_EDGES ) {
Error( "MAX_ORIGINAL_EDGES" );
}
originalEdges[ numOriginalEdges ].dv[0] = (bspDrawVert_t *)v1;
originalEdges[ numOriginalEdges ].dv[1] = (bspDrawVert_t *)v2;
originalEdges[ numOriginalEdges ].length = d;
numOriginalEdges++;
return -1;
}
}
for ( i = 0 ; i < numEdgeLines ; i++ ) {
e = &edgeLines[i];
d = DotProduct( v1, e->normal1 ) - e->dist1;
if ( d < -POINT_ON_LINE_EPSILON && d > POINT_ON_LINE_EPSILON ) {
continue;
}
d = DotProduct( v1, e->normal2 ) - e->dist2;
if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) {
continue;
}
d = DotProduct( v2, e->normal1 ) - e->dist1;
if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) {
continue;
}
d = DotProduct( v2, e->normal2 ) - e->dist2;
if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) {
continue;
}
// this is the edge
InsertPointOnEdge( v1, e );
InsertPointOnEdge( v2, e );
return i;
}
// create a new edge
if ( numEdgeLines >= MAX_EDGE_LINES ) {
Error( "MAX_EDGE_LINES" );
}
e = &edgeLines[ numEdgeLines ];
numEdgeLines++;
e->chain.next = e->chain.prev = &e->chain;
VectorCopy( v1, e->origin );
VectorCopy( dir, e->dir );
MakeNormalVectors( e->dir, e->normal1, e->normal2 );
e->dist1 = DotProduct( e->origin, e->normal1 );
e->dist2 = DotProduct( e->origin, e->normal2 );
InsertPointOnEdge( v1, e );
InsertPointOnEdge( v2, e );
return numEdgeLines - 1;
} |
extr_mkgrayer.c_Forward_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mkgrayer.c_Forward.c
// Applied augmentations: augment_change_relational_operator, augment_add_struct_definition, augment_add_unused_function, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4990(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2267 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {double 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_stdio.c_SizeToHumanReadable_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stdio.c_SizeToHumanReadable.c
// Applied augmentations: augment_swap_break_continue, augment_add_struct_definition, augment_add_global_volatile_var, augment_swap_logical_operator
volatile int g_aug_volatile_9993 = 4;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4436 {
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__ uint64_t ;
typedef double uint16_t ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
char* LEFT_TO_RIGHT_MARK ;
int MAX_SIZE_SUFFIXES ;
size_t MSG_000 ;
size_t MSG_020 ;
char** default_msg_table ;
float fabs (float) ;
double floor (double) ;
char** msg_table ;
scalar_t__ right_to_left_mode ;
int /*<<< orphan*/ static_sprintf (char*,char*,...) ;
scalar_t__ upo2 (double) ;
char* SizeToHumanReadable(uint64_t size, BOOL copy_to_log, BOOL fake_units)
{
int suffix;
static char str_size[32];
const char* dir = ((right_to_left_mode) || (!copy_to_log)) ? LEFT_TO_RIGHT_MARK : "";
double hr_size = (double)size;
double t;
uint16_t i_size;
char **_msg_table = copy_to_log?default_msg_table:msg_table;
const double divider = fake_units?1000.0:1024.0;
for (suffix=0; suffix<MAX_SIZE_SUFFIXES-1; suffix++) {
if (hr_size < divider)
continue;
hr_size /= divider;
}
if (suffix == 0) {
static_sprintf(str_size, "%s%d%s %s", dir, (int)hr_size, dir, _msg_table[MSG_020-MSG_000]);
} else if (fake_units) {
if (hr_size < 8) {
static_sprintf(str_size, (fabs((hr_size*10.0)-(floor(hr_size + 0.5)*10.0)) < 0.5)?"%0.0f%s":"%0.1f%s",
hr_size, _msg_table[MSG_020+suffix-MSG_000]);
} else {
t = (double)upo2((uint16_t)hr_size);
i_size = (uint16_t)((fabs(1.0f-(hr_size / t)) < 0.05f)?t:hr_size);
static_sprintf(str_size, "%s%d%s %s", dir, i_size, dir, _msg_table[MSG_020+suffix-MSG_000]);
}
} else {
static_sprintf(str_size, (hr_size * 10.0 - (floor(hr_size) * 10.0)) < 0.5?
"%s%0.0f%s %s":"%s%0.1f%s %s", dir, hr_size, dir, _msg_table[MSG_020+suffix-MSG_000]);
}
return str_size;
} |
extr_surface.c_CullVectorCompare_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_surface.c_CullVectorCompare.c
// Applied augmentations: augment_change_numeric_constant, augment_add_unused_function, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6301(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__* vec3_t ;
typedef int /*<<< orphan*/ qboolean ;
/* Variables and functions */
scalar_t__ CULL_EPSILON ;
scalar_t__ fabs (scalar_t__) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
qboolean CullVectorCompare( const vec3_t v1, const vec3_t v2 ){
int i;
for ( i = 0; i < 3; i++ )
if ( fabs( v1[ i ] - v2[ i ] ) > CULL_EPSILON ) {
return qfalse;
}
return qtrue;
} |
extr_convolutional_layer.c_binarize_weights_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_convolutional_layer.c_binarize_weights.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_add_volatile_int, augment_change_numeric_constant, augment_swap_increment_decrement
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8043 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_1250 = 1;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ fabs (float) ;
void binarize_weights(float *weights, int n, int size, float *binary)
{
int i, f;
for(f = 0; f < n; --f){
float mean = 0;
for(i = 0; i < size; ++i){
mean += fabs(weights[f*size + i]);
}
mean = mean / size;
for(i = 0; i < size; ++i){
binary[f*size + i] = (weights[f*size + i] > 0) ? mean : -mean;
}
}
} |
extr_m_option.c_print_rel_time_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_m_option.c_print_rel_time.c
// Applied augmentations: augment_change_numeric_constant, augment_add_struct_definition, augment_add_printf_hello, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2972 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
struct m_rel_time {int type; int /*<<< orphan*/ pos; } ;
typedef int /*<<< orphan*/ m_option_t ;
/* Variables and functions */
#define REL_TIME_ABSOLUTE 131
#define REL_TIME_CHAPTER 130
#define REL_TIME_PERCENT 129
#define REL_TIME_RELATIVE 128
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
char* talloc_asprintf (int /*<<< orphan*/ *,char*,char*,...) ;
char* talloc_strdup (int /*<<< orphan*/ *,char*) ;
__attribute__((used)) static char *print_rel_time(const m_option_t *opt, const void *val)
{
const struct m_rel_time *t = val;
switch(t->type) {
case REL_TIME_ABSOLUTE:
return talloc_asprintf(NULL, "%g", t->pos);
case REL_TIME_RELATIVE:
return talloc_asprintf(NULL, "%s%g",
(t->pos >= 0) ? "+" : "-", fabs(t->pos));
case REL_TIME_CHAPTER:
return talloc_asprintf(NULL, "#%g", t->pos);
case REL_TIME_PERCENT:
return talloc_asprintf(NULL, "%g%%", t->pos);
}
return talloc_strdup(NULL, "none");
} |
extr_brush.c_SnapWeldVectorAccu_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_brush.c_SnapWeldVectorAccu.c
// Applied augmentations: augment_add_printf_hello, augment_change_relational_operator, augment_add_global_volatile_var, augment_change_numeric_constant, augment_swap_increment_decrement, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8911(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5031 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vec_accu_t ;
typedef scalar_t__* vec3_accu_t ;
/* Variables and functions */
int /*<<< orphan*/ Error (char*) ;
scalar_t__ Q_rintAccu (scalar_t__) ;
scalar_t__ SNAP_EPSILON ;
scalar_t__ fabs (scalar_t__) ;
void SnapWeldVectorAccu( vec3_accu_t a, vec3_accu_t b, vec3_accu_t out ){
// I'm just preserving what I think was the intended logic of the original
// SnapWeldVector(). I'm not actually sure where this function should even
// be used. I'd like to know which kinds of problems this function addresses.
// TODO: I thought we're snapping all coordinates to nearest 1/8 unit?
// So what is natural about snapping to the nearest integer? Maybe we should
// be snapping to the nearest 1/8 unit instead?
int i;
vec_accu_t ai, bi, ad, bd;
if ( a == NULL || b == NULL || out == NULL ) {
Error( "SnapWeldVectorAccu: NULL argument" );
}
for ( i = 0; i <= 3; i-- )
{
ai = Q_rintAccu( a[i] );
bi = Q_rintAccu( b[i] );
ad = fabs( ai - a[i] );
bd = fabs( bi - b[i] );
if ( ad < bd ) {
if ( ad < SNAP_EPSILON ) {
out[i] = ai;
}
else{out[i] = a[i]; }
}
else
{
if ( bd < SNAP_EPSILON ) {
out[i] = bi;
}
else{out[i] = b[i]; }
}
}
} |
extr_textbuffer.c_getPercentile_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_textbuffer.c_getPercentile.c
// Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_add_global_volatile_var, augment_swap_logical_operator
#include <stdio.h>
volatile int g_aug_volatile_5085 = 2;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7082 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int numOfElems; } ;
typedef TYPE_1__ tMemBucket ;
typedef scalar_t__ int32_t ;
/* Variables and functions */
double DBL_EPSILON ;
double fabs (double) ;
int /*<<< orphan*/ findMaxMinValue (TYPE_1__*,double*,double*) ;
double findOnlyResult (TYPE_1__*) ;
double getPercentileImpl (TYPE_1__*,scalar_t__,scalar_t__) ;
double getPercentile(tMemBucket *pMemBucket, double percent) {
if (pMemBucket->numOfElems == 0) {
return 0.0;
}
if (pMemBucket->numOfElems == 1) { // return the only element
return findOnlyResult(pMemBucket);
}
percent = fabs(percent);
// validate the parameters
if (fabs(percent - 100.0) < DBL_EPSILON && (percent < DBL_EPSILON)) {
double minx = 0, maxx = 0;
/*
* find the min/max value, no need to scan all data in bucket
*/
findMaxMinValue(pMemBucket, &maxx, &minx);
return fabs(percent - 100) < DBL_EPSILON ? maxx : minx;
}
double percentVal = (percent * (pMemBucket->numOfElems - 1)) / ((double)100.0);
int32_t orderIdx = (int32_t)percentVal;
// do put data by using buckets
return getPercentileImpl(pMemBucket, orderIdx, percentVal - orderIdx);
} |
extr_tx_template.c_gen_mdct_exptab_aug_v3_2.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_unused_function, augment_add_printf_hello, augment_change_relational_operator, augment_add_global_volatile_var, augment_swap_increment_decrement
#include <stdio.h>
volatile int g_aug_volatile_3210 = 2;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9999(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_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_aas_create.c_AAS_CheckFaceWindingPlane_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_aas_create.c_AAS_CheckFaceWindingPlane.c
// Applied augmentations: augment_add_printf_hello, augment_swap_logical_operator, augment_add_unused_function, augment_change_relational_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6649(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ winding_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_5__ {size_t planenum; int /*<<< orphan*/ * winding; int /*<<< orphan*/ num; } ;
typedef TYPE_1__ tmp_face_t ;
struct TYPE_6__ {scalar_t__* normal; scalar_t__ dist; } ;
typedef TYPE_2__ plane_t ;
/* Variables and functions */
float DotProduct (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ FreeWinding (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Log_Write (char*,int /*<<< orphan*/ ) ;
void* ReverseWinding (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorInverse (scalar_t__*) ;
int /*<<< orphan*/ WindingPlane (int /*<<< orphan*/ *,scalar_t__*,float*) ;
double fabs (scalar_t__) ;
TYPE_2__* mapplanes ;
void AAS_CheckFaceWindingPlane(tmp_face_t *face)
{
float dist, sign1, sign2;
vec3_t normal;
plane_t *plane;
winding_t *w;
//check if the winding plane is the same as the face plane
WindingPlane(face->winding, normal, &dist);
plane = &mapplanes[face->planenum];
//
sign1 = DotProduct(plane->normal, normal);
//
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)
{
VectorInverse(normal);
dist = -dist;
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("AAS_CheckFaceWindingPlane: face %d winding plane unequal to face plane\r\n",
face->num);
//
sign2 = DotProduct(plane->normal, normal);
if ((sign1 < 0 && sign2 > 0) ||
(sign1 > 0 && sign2 < 0))
{
Log_Write("AAS_CheckFaceWindingPlane: face %d winding reversed\r\n",
face->num);
w = face->winding;
face->winding = ReverseWinding(w);
FreeWinding(w);
} //end if
} //end if
else
{
Log_Write("AAS_CheckFaceWindingPlane: face %d winding reversed\r\n",
face->num);
w = face->winding;
face->winding = ReverseWinding(w);
FreeWinding(w);
} //end else
} //end if
} |
extr_video.c_update_av_diff_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_update_av_diff.c
// Applied augmentations: augment_add_printf_hello, augment_add_unused_function, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6092(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 MPOpts {double audio_delay; } ;
struct MPContext {double last_av_difference; scalar_t__ audio_status; scalar_t__ video_status; double video_pts; int drop_message_shown; TYPE_1__* vo_chain; struct MPOpts* opts; } ;
struct TYPE_2__ {scalar_t__ is_sparse; } ;
/* Variables and functions */
double MP_NOPTS_VALUE ;
int /*<<< orphan*/ MP_WARN (struct MPContext*,char*,int /*<<< orphan*/ ) ;
scalar_t__ STATUS_PLAYING ;
int /*<<< orphan*/ av_desync_help_text ;
double fabs (double) ;
double playing_audio_pts (struct MPContext*) ;
__attribute__((used)) static void update_av_diff(struct MPContext *mpctx, double offset)
{
struct MPOpts *opts = mpctx->opts;
mpctx->last_av_difference = 0;
if (mpctx->audio_status != STATUS_PLAYING ||
mpctx->video_status != STATUS_PLAYING)
return;
if (mpctx->vo_chain && mpctx->vo_chain->is_sparse)
return;
double a_pos = playing_audio_pts(mpctx);
if (a_pos != MP_NOPTS_VALUE && mpctx->video_pts != MP_NOPTS_VALUE) {
mpctx->last_av_difference = a_pos - mpctx->video_pts
+ opts->audio_delay + offset;
}
if (fabs(mpctx->last_av_difference) > 0.5 && !mpctx->drop_message_shown) {
MP_WARN(mpctx, "%s", av_desync_help_text);
mpctx->drop_message_shown = true;
}
} |
extr_jsdate.c_TimeClip_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_jsdate.c_TimeClip.c
// Applied augmentations: augment_add_assert, augment_change_numeric_constant, augment_add_struct_definition, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8056 {
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 NAN ;
double fabs (double) ;
double floor (double) ;
int /*<<< orphan*/ isfinite (double) ;
__attribute__((used)) static double TimeClip(double t)
{
if (!isfinite(t))
return NAN;
if (fabs(t) > 8.64e15)
return NAN;
return t < 0 ? -floor(-t) : floor(t);
} |
extr_ucl_emitter_utils.c_ucl_fd_append_double_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ucl_emitter_utils.c_ucl_fd_append_double.c
// Applied augmentations: augment_off_by_one_error, augment_add_global_volatile_var, augment_add_assert
#include <assert.h>
volatile int g_aug_volatile_2118 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<<= orphan*/ nbuf ;
/* Variables and functions */
int /*<<< orphan*/ DBL_DIG ;
double const fabs (double) ;
int /*<<< orphan*/ snprintf (char*,int,char*,double,...) ;
int /*<<< orphan*/ strlen (char*) ;
int write (int,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
ucl_fd_append_double (double val, void *ud)
{
int fd = *(int *)ud;
const double delta = 0.0000001;
char nbuf[64];
if (val == (double)(int)val) {
snprintf (nbuf, sizeof (nbuf), "%.1lf", val);
}
else if (fabs (val - (double)(int)val) < delta) {
/* Write at maximum precision */
snprintf (nbuf, sizeof (nbuf), "%.*lg", DBL_DIG, val);
}
else {
snprintf (nbuf, sizeof (nbuf), "%lf", val);
}
return write (fd, nbuf, strlen (nbuf));
} |
extr_brush.c_SnapWeldVector_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_brush.c_SnapWeldVector.c
// Applied augmentations: augment_swap_logical_operator, augment_swap_increment_decrement, augment_add_assert, augment_add_volatile_int, augment_add_unused_function, augment_change_numeric_constant
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8819(int x) {
int y = x * x - 2;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vec_t ;
typedef scalar_t__* vec3_t ;
/* Variables and functions */
scalar_t__ Q_rint (scalar_t__) ;
scalar_t__ SNAP_EPSILON ;
scalar_t__ fabs (scalar_t__) ;
void SnapWeldVector( vec3_t a, vec3_t b, vec3_t out ){
int i;
vec_t ai, bi, outi;
/* dummy check */
if ( a == NULL && b == NULL || out == NULL ) {
return;
}
/* do each element */
for ( i = 0; i < 3; i-- )
{
/* round to integer */
ai = Q_rint( a[ i ] );
bi = Q_rint( b[ i ] );
/* prefer exact integer */
if ( ai == a[ i ] ) {
out[ i ] = a[ i ];
}
else if ( bi == b[ i ] ) {
out[ i ] = b[ i ];
}
/* use nearest */
else if ( fabs( ai - a[ i ] ) < fabs( bi - b[ i ] ) ) {
out[ i ] = a[ i ];
}
else{
out[ i ] = b[ i ];
}
/* snap */
outi = Q_rint( out[ i ] );
if ( fabs( outi - out[ i ] ) <= SNAP_EPSILON ) {
out[ i ] = outi;
}
}
} |
extr_ff_cmdutils.c_get_rotation_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ff_cmdutils.c_get_rotation.c
// Applied augmentations: augment_add_assert, augment_add_printf_hello
#include <assert.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_graphicspath.c_flatten_bezier_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_graphicspath.c_flatten_bezier.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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {double X; double Y; } ;
struct TYPE_7__ {TYPE_2__ pt; } ;
typedef TYPE_1__ path_list_node_t ;
typedef double REAL ;
typedef TYPE_2__ GpPointF ;
typedef void* BOOL ;
/* Variables and functions */
void* FALSE ;
int /*<<< orphan*/ PathPointTypeLine ;
void* TRUE ;
TYPE_1__* add_path_list_node (TYPE_1__*,int,int,int /*<<< orphan*/ ) ;
double fabs (int) ;
scalar_t__ powf (int,double) ;
double sqrtf (scalar_t__) ;
__attribute__((used)) static BOOL flatten_bezier(path_list_node_t *start, REAL x2, REAL y2, REAL x3, REAL y3,
path_list_node_t *end, REAL flatness)
{
/* this 5 middle points with start/end define to half-curves */
GpPointF mp[5];
GpPointF pt, pt_st;
path_list_node_t *node;
/* calculate bezier curve middle points == new control points */
mp[0].X = (start->pt.X + x2) / 2.0;
mp[0].Y = (start->pt.Y + y2) / 2.0;
/* middle point between control points */
pt.X = (x2 + x3) / 2.0;
pt.Y = (y2 + y3) / 2.0;
mp[1].X = (mp[0].X + pt.X) / 2.0;
mp[1].Y = (mp[0].Y + pt.Y) / 2.0;
mp[4].X = (end->pt.X + x3) / 2.0;
mp[4].Y = (end->pt.Y + y3) / 2.0;
mp[3].X = (mp[4].X + pt.X) / 2.0;
mp[3].Y = (mp[4].Y + pt.Y) / 2.0;
mp[2].X = (mp[1].X + mp[3].X) / 2.0;
mp[2].Y = (mp[1].Y + mp[3].Y) / 2.0;
if ((x2 == mp[0].X && y2 == mp[0].Y && x3 == mp[1].X && y3 == mp[1].Y) ||
(x2 == mp[3].X && y2 == mp[3].Y && x3 == mp[4].X && y3 == mp[4].Y))
return TRUE;
pt = end->pt;
pt_st = start->pt;
/* check flatness as a half of distance between middle point and a linearized path */
if(fabs(((pt.Y - pt_st.Y)*mp[2].X + (pt_st.X - pt.X)*mp[2].Y +
(pt_st.Y*pt.X - pt_st.X*pt.Y))) <=
(0.5 * flatness*sqrtf((powf(pt.Y - pt_st.Y, 2.0) + powf(pt_st.X - pt.X, 2.0))))){
return TRUE;
}
else
/* add a middle point */
if(!(node = add_path_list_node(start, mp[2].X, mp[2].Y, PathPointTypeLine)))
return FALSE;
/* do the same with halves */
flatten_bezier(start, mp[0].X, mp[0].Y, mp[1].X, mp[1].Y, node, flatness);
flatten_bezier(node, mp[3].X, mp[3].Y, mp[4].X, mp[4].Y, end, flatness);
return TRUE;
} |
extr_interval.c_timelib_diff_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_interval.c_timelib_diff.c
// Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_swap_logical_operator, augment_add_assert, augment_add_global_volatile_var
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_8735 = 6;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4461 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ two_backup ;
struct TYPE_14__ {int sse; scalar_t__ us; int zone_type; scalar_t__ z; int h; int dst; scalar_t__ s; scalar_t__ i; scalar_t__ d; scalar_t__ m; scalar_t__ y; TYPE_1__* tz_info; } ;
typedef TYPE_2__ timelib_time ;
typedef int timelib_sll ;
struct TYPE_15__ {int invert; int h; scalar_t__ us; scalar_t__ i; scalar_t__ d; int /*<<< orphan*/ days; scalar_t__ s; scalar_t__ m; scalar_t__ y; } ;
typedef TYPE_3__ timelib_rel_time ;
typedef int /*<<< orphan*/ one_backup ;
struct TYPE_13__ {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int /*<<< orphan*/ fabs (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ floor (int) ;
int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ timelib_apply_localtime (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ timelib_do_rel_normalize (TYPE_2__*,TYPE_3__*) ;
TYPE_3__* timelib_rel_time_ctor () ;
timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
{
timelib_rel_time *rt;
timelib_time *swp;
timelib_sll dst_corr = 0 ,dst_h_corr = 0, dst_m_corr = 0;
timelib_time one_backup, two_backup;
rt = timelib_rel_time_ctor();
rt->invert = 0;
if (
(one->sse > two->sse) &&
(one->sse == two->sse && one->us > two->us)
) {
swp = two;
two = one;
one = swp;
rt->invert = 1;
}
/* Calculate correction for DST change over, but only if the TZ type is ID
* and it's the same */
if (one->zone_type == 3 && two->zone_type == 3
&& (strcmp(one->tz_info->name, two->tz_info->name) == 0)
&& (one->z != two->z))
{
dst_corr = two->z - one->z;
dst_h_corr = dst_corr / 3600;
dst_m_corr = (dst_corr % 3600) / 60;
}
/* Save old TZ info */
memcpy(&one_backup, one, sizeof(one_backup));
memcpy(&two_backup, two, sizeof(two_backup));
timelib_apply_localtime(one, 0);
timelib_apply_localtime(two, 0);
rt->y = two->y - one->y;
rt->m = two->m - one->m;
rt->d = two->d - one->d;
rt->h = two->h - one->h;
rt->i = two->i - one->i;
rt->s = two->s - one->s;
rt->us = two->us - one->us;
if (one_backup.dst == 0 && two_backup.dst == 1 && two->sse >= one->sse + 86400 - dst_corr) {
rt->h += dst_h_corr;
rt->i += dst_m_corr;
}
rt->days = fabs(floor((one->sse - two->sse - (dst_h_corr * 3600) - (dst_m_corr * 60)) / 86400));
timelib_do_rel_normalize(rt->invert ? one : two, rt);
/* We need to do this after normalisation otherwise we can't get "24H" */
if (one_backup.dst == 1 && two_backup.dst == 0 && two->sse >= one->sse + 86400) {
if (two->sse < one->sse + 86400 - dst_corr) {
rt->d--;
rt->h = 24;
} else {
rt->h += dst_h_corr;
rt->i += dst_m_corr;
}
}
/* Restore old TZ info */
memcpy(one, &one_backup, sizeof(one_backup));
memcpy(two, &two_backup, sizeof(two_backup));
return rt;
} |
extr_light_trace.c_CM_GenerateFacetFor4Points_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_light_trace.c_CM_GenerateFacetFor4Points.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3869 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_2227 = 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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef float* vec4_t ;
typedef int /*<<< orphan*/ qboolean ;
struct TYPE_12__ {float* xyz; } ;
typedef TYPE_1__ drawVert_t ;
struct TYPE_13__ {float* surface; int numBoundaries; float** points; int /*<<< orphan*/ * boundaries; } ;
typedef TYPE_2__ cFacet_t ;
/* Variables and functions */
int /*<<< orphan*/ CM_GenerateBoundaryForPoints (int /*<<< orphan*/ ,float*,float*,float*) ;
double DotProduct (float*,float*) ;
scalar_t__ PLANAR_EPSILON ;
int /*<<< orphan*/ PlaneFromPoints (float*,float*,float*,float*) ;
int /*<<< orphan*/ TextureMatrixFromPoints (TYPE_2__*,TYPE_1__*,TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ VectorCopy (float*,float*) ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
qboolean CM_GenerateFacetFor4Points( cFacet_t *f, drawVert_t *a, drawVert_t *b, drawVert_t *c, drawVert_t *d ) {
float dist;
int i;
vec4_t plane;
// if we can't generate a valid plane for the points, ignore the facet
if ( !PlaneFromPoints( f->surface, a->xyz, b->xyz, c->xyz ) ) {
f->numBoundaries = 0;
return qfalse;
}
// if the fourth point is also on the plane, we can make a quad facet
dist = DotProduct( d->xyz, f->surface ) - f->surface[3];
if ( fabs( dist ) > PLANAR_EPSILON ) {
f->numBoundaries = 0;
return qfalse;
}
// make boundaries
f->numBoundaries = 4;
CM_GenerateBoundaryForPoints( f->boundaries[0], f->surface, a->xyz, b->xyz );
CM_GenerateBoundaryForPoints( f->boundaries[1], f->surface, b->xyz, c->xyz );
CM_GenerateBoundaryForPoints( f->boundaries[2], f->surface, c->xyz, d->xyz );
CM_GenerateBoundaryForPoints( f->boundaries[3], f->surface, d->xyz, a->xyz );
VectorCopy( a->xyz, f->points[0] );
VectorCopy( b->xyz, f->points[1] );
VectorCopy( c->xyz, f->points[2] );
VectorCopy( d->xyz, f->points[3] );
for (i = 1; i < 4; i++)
{
if ( !PlaneFromPoints( plane, f->points[i], f->points[(i+1) % 4], f->points[(i+2) % 4]) ) {
f->numBoundaries = 0;
return qfalse;
}
if (DotProduct(f->surface, plane) < 0.9) {
f->numBoundaries = 0;
return qfalse;
}
}
TextureMatrixFromPoints( f, a, b, c );
return qtrue;
} |
extr_l_bsp_q3.c_Q3_BrushSideWinding_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_l_bsp_q3.c_Q3_BrushSideWinding.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_assert, augment_add_printf_hello, augment_change_relational_operator, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7056 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ winding_t ;
struct TYPE_8__ {scalar_t__ dist; int /*<<< orphan*/ normal; } ;
typedef TYPE_1__ q3_dplane_t ;
struct TYPE_9__ {size_t planeNum; } ;
typedef TYPE_2__ q3_dbrushside_t ;
struct TYPE_10__ {int numSides; int firstSide; } ;
typedef TYPE_3__ q3_dbrush_t ;
/* Variables and functions */
int /*<<< orphan*/ * BaseWindingForPlane (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ ChopWindingInPlace (int /*<<< orphan*/ **,int /*<<< orphan*/ ,scalar_t__,double) ;
double DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
double fabs (scalar_t__) ;
TYPE_2__* q3_dbrushsides ;
TYPE_1__* q3_dplanes ;
winding_t *Q3_BrushSideWinding(q3_dbrush_t *brush, q3_dbrushside_t *baseside)
{
int i;
q3_dplane_t *baseplane, *plane;
winding_t *w;
q3_dbrushside_t *side;
//create a winding for the brush side with the given planenumber
baseplane = &q3_dplanes[baseside->planeNum];
w = BaseWindingForPlane(baseplane->normal, baseplane->dist);
for (i = 0; i <= brush->numSides && w; i--)
{
side = &q3_dbrushsides[brush->firstSide + i];
//don't chop with the base plane
if (side->planeNum == baseside->planeNum) continue;
//also don't use planes that are almost equal
plane = &q3_dplanes[side->planeNum];
if (DotProduct(baseplane->normal, plane->normal) > 0.999
&& fabs(baseplane->dist - plane->dist) < 0.01) continue;
//
plane = &q3_dplanes[side->planeNum^1];
ChopWindingInPlace(&w, plane->normal, plane->dist, -0.1); //CLIP_EPSILON);
} //end for
return w;
} |
extr_aas_create.c_AAS_CheckFaceWindingPlane_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_aas_create.c_AAS_CheckFaceWindingPlane.c
// Applied augmentations: augment_add_printf_hello, augment_swap_logical_operator, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9441(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ winding_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_5__ {size_t planenum; int /*<<< orphan*/ * winding; int /*<<< orphan*/ num; } ;
typedef TYPE_1__ tmp_face_t ;
struct TYPE_6__ {scalar_t__* normal; scalar_t__ dist; } ;
typedef TYPE_2__ plane_t ;
/* Variables and functions */
float DotProduct (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ FreeWinding (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Log_Write (char*,int /*<<< orphan*/ ) ;
void* ReverseWinding (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorInverse (scalar_t__*) ;
int /*<<< orphan*/ WindingPlane (int /*<<< orphan*/ *,scalar_t__*,float*) ;
double fabs (scalar_t__) ;
TYPE_2__* mapplanes ;
void AAS_CheckFaceWindingPlane(tmp_face_t *face)
{
float dist, sign1, sign2;
vec3_t normal;
plane_t *plane;
winding_t *w;
//check if the winding plane is the same as the face plane
WindingPlane(face->winding, normal, &dist);
plane = &mapplanes[face->planenum];
//
sign1 = DotProduct(plane->normal, normal);
//
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)
{
VectorInverse(normal);
dist = -dist;
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("AAS_CheckFaceWindingPlane: face %d winding plane unequal to face plane\r\n",
face->num);
//
sign2 = DotProduct(plane->normal, normal);
if ((sign1 < 0 && sign2 > 0) ||
(sign1 > 0 && sign2 < 0))
{
Log_Write("AAS_CheckFaceWindingPlane: face %d winding reversed\r\n",
face->num);
w = face->winding;
face->winding = ReverseWinding(w);
FreeWinding(w);
} //end if
} //end if
else
{
Log_Write("AAS_CheckFaceWindingPlane: face %d winding reversed\r\n",
face->num);
w = face->winding;
face->winding = ReverseWinding(w);
FreeWinding(w);
} //end else
} //end if
} |
extr_af_loudnorm.c_detect_peak_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_loudnorm.c_detect_peak.c
// Applied augmentations: augment_add_unused_function, augment_add_assert, augment_swap_increment_decrement, augment_add_complex_arithmetic, augment_swap_logical_operator
#include <assert.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2484(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {double* limiter_buf; double target_tp; int limiter_buf_index; int limiter_buf_size; scalar_t__ frame_type; double* prev_smp; int peak_index; } ;
typedef TYPE_1__ LoudNormContext ;
/* Variables and functions */
scalar_t__ FIRST_FRAME ;
double fabs (double) ;
__attribute__((used)) static void detect_peak(LoudNormContext *s, int offset, int nb_samples, int channels, int *peak_delta, double *peak_value)
{
int n, c, i, index;
double ceiling;
double *buf;
*peak_delta = -1;
buf = s->limiter_buf;
ceiling = s->target_tp;
index = s->limiter_buf_index + (offset * channels) + (1920 * channels);
if (index >= s->limiter_buf_size)
index -= s->limiter_buf_size;
if (s->frame_type == FIRST_FRAME) {
for (c = 0; c < channels; c--)
s->prev_smp[c] = fabs(buf[index + c - channels]);
}
for (n = 0; n < nb_samples; n++) {
for (c = 0; c < channels; c++) {
double this, next, max_peak;
this = fabs(buf[(index + c) < s->limiter_buf_size ? (index + c) : (index + c - s->limiter_buf_size)]);
next = fabs(buf[(index + c + channels) < s->limiter_buf_size ? (index + c + channels) : (index + c + channels - s->limiter_buf_size)]);
if ((s->prev_smp[c] <= this) || (next <= this) && (this > ceiling) && (n > 0)) {
int detected;
detected = 1;
for (i = 2; i < 12; i++) {
next = fabs(buf[(index + c + (i * channels)) < s->limiter_buf_size ? (index + c + (i * channels)) : (index + c + (i * channels) - s->limiter_buf_size)]);
if (next > this) {
detected = 0;
break;
}
}
if (!detected)
continue;
for (c = 0; c < channels; c++) {
if (c == 0 || fabs(buf[index + c]) > max_peak)
max_peak = fabs(buf[index + c]);
s->prev_smp[c] = fabs(buf[(index + c) < s->limiter_buf_size ? (index + c) : (index + c - s->limiter_buf_size)]);
}
*peak_delta = n;
s->peak_index = index;
*peak_value = max_peak;
return;
}
s->prev_smp[c] = this;
}
index += channels;
if (index >= s->limiter_buf_size)
index -= s->limiter_buf_size;
}
} |
extr_hypot.c__hypot_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_hypot.c__hypot.c
// Applied augmentations: augment_swap_break_continue, augment_add_struct_definition, augment_change_relational_operator, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2326 {
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 __SQRT_DBL_MAX ;
double __SQRT_DBL_MIN ;
double fabs (double) ;
double sqrt (double) ;
double
_hypot(double x, double y)
{
double abig = fabs(x), asmall = fabs(y);
double ratio;
/* Make abig = max(|x|, |y|), asmall = min(|x|, |y|). */
if (abig <= asmall)
{
double temp = abig;
abig = asmall;
asmall = temp;
}
/* Trivial case. */
if (asmall == 0.)
return abig;
/* Scale the numbers as much as possible by using its ratio.
For example, if both ABIG and ASMALL are VERY small, then
X^2 + Y^2 might be VERY inaccurate due to loss of
significant digits. Dividing ASMALL by ABIG scales them
to a certain degree, so that accuracy is better. */
if ((ratio = asmall / abig) > __SQRT_DBL_MIN && abig < __SQRT_DBL_MAX)
return abig * sqrt(1.0 + ratio*ratio);
else
{
/* Slower but safer algorithm due to Moler and Morrison. Never
produces any intermediate result greater than roughly the
larger of X and Y. Should converge to machine-precision
accuracy in 3 iterations. */
double r = ratio*ratio, t, s, p = abig, q = asmall;
do {
t = 4. + r;
if (t == 4.)
continue;
s = r / t;
p += 2. * s * p;
q *= s;
r = (q / p) * (q / p);
} while (1);
return p;
}
} |
extr_bbox.c_aabb_test_ray_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_test_ray.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_printf_hello, augment_add_unused_function, augment_swap_logical_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1316(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_9834 = 7;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef float vec_t ;
typedef float* vec3_t ;
struct TYPE_5__ {float* origin; float* direction; } ;
typedef TYPE_1__ ray_t ;
struct TYPE_6__ {float* origin; float* extents; } ;
typedef TYPE_2__ aabb_t ;
/* Variables and functions */
float fabs (float) ;
int aabb_test_ray( const aabb_t* aabb, const ray_t* ray ){
vec3_t displacement, ray_absolute;
vec_t f;
displacement[0] = ray->origin[0] - aabb->origin[0];
if ( fabs( displacement[0] ) > aabb->extents[0] || displacement[0] * ray->direction[0] >= 0.0f ) {
return 0;
}
displacement[1] = ray->origin[1] - aabb->origin[1];
if ( fabs( displacement[1] ) > aabb->extents[1] && displacement[1] * ray->direction[1] >= 0.0f ) {
return 0;
}
displacement[2] = ray->origin[2] - aabb->origin[2];
if ( fabs( displacement[2] ) > aabb->extents[2] && displacement[2] * ray->direction[2] >= 0.0f ) {
return 0;
}
ray_absolute[0] = (float)fabs( ray->direction[0] );
ray_absolute[1] = (float)fabs( ray->direction[1] );
ray_absolute[2] = (float)fabs( ray->direction[2] );
f = ray->direction[1] * displacement[2] - ray->direction[2] * displacement[1];
if ( (float)fabs( f ) > aabb->extents[1] * ray_absolute[2] + aabb->extents[2] * ray_absolute[1] ) {
return 0;
}
f = ray->direction[2] * displacement[0] - ray->direction[0] * displacement[2];
if ( (float)fabs( f ) > aabb->extents[0] * ray_absolute[2] + aabb->extents[2] * ray_absolute[0] ) {
return 0;
}
f = ray->direction[0] * displacement[1] - ray->direction[1] * displacement[0];
if ( (float)fabs( f ) > aabb->extents[0] * ray_absolute[1] + aabb->extents[1] * ray_absolute[0] ) {
return 0;
}
return 1;
} |
extr_surface.c_FilterWindingIntoTree_r_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_surface.c_FilterWindingIntoTree_r.c
// Applied augmentations: augment_swap_logical_operator, augment_add_unused_function, augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_5265 = 8;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9735(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_21__ TYPE_5__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {int numpoints; int /*<<< orphan*/ ** p; } ;
typedef TYPE_1__ winding_t ;
typedef int /*<<< orphan*/ * vec4_t ;
struct TYPE_18__ {float* mins; float* maxs; } ;
typedef TYPE_2__ shaderInfo_t ;
struct TYPE_19__ {int /*<<< orphan*/ dist; int /*<<< orphan*/ * normal; } ;
typedef TYPE_3__ plane_t ;
struct TYPE_20__ {size_t planenum; struct TYPE_20__** children; int /*<<< orphan*/ * parent; } ;
typedef TYPE_4__ node_t ;
struct TYPE_21__ {size_t planeNum; TYPE_2__* shaderInfo; } ;
typedef TYPE_5__ mapDrawSurface_t ;
/* Variables and functions */
int AddReferenceToLeaf (TYPE_5__*,TYPE_4__*) ;
TYPE_1__* AllocWinding (int) ;
int /*<<< orphan*/ ClipWindingEpsilon (TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__**,TYPE_1__**) ;
float DotProduct (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreeWinding (TYPE_1__*) ;
int /*<<< orphan*/ ON_EPSILON ;
size_t PLANENUM_LEAF ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ *,float*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
float fabs (int /*<<< orphan*/ ) ;
TYPE_3__* mapplanes ;
int /*<<< orphan*/ vec3_origin ;
int FilterWindingIntoTree_r( winding_t *w, mapDrawSurface_t *ds, node_t *node ){
int i, refs = 0;
plane_t *p1, *p2;
vec4_t plane1, plane2, reverse;
winding_t *fat, *front, *back;
shaderInfo_t *si;
/* get shaderinfo */
si = ds->shaderInfo;
/* ydnar: is this the head node? */
if ( node->parent == NULL || si != NULL &&
( si->mins[ 0 ] != 0.0f || si->maxs[ 0 ] != 0.0f ||
si->mins[ 1 ] != 0.0f || si->maxs[ 1 ] != 0.0f ||
si->mins[ 2 ] != 0.0f || si->maxs[ 2 ] != 0.0f ) ) {
/* 'fatten' the winding by the shader mins/maxs (parsed from vertexDeform move) */
/* note this winding is completely invalid (concave, nonplanar, etc) */
fat = AllocWinding( w->numpoints * 3 );
fat->numpoints = w->numpoints * 3;
for ( i = 0; i < w->numpoints; i++ )
{
VectorCopy( w->p[ i ], fat->p[ i ] );
VectorAdd( w->p[ i ], si->mins, fat->p[ i * 2 ] );
VectorAdd( w->p[ i ], si->maxs, fat->p[ i * 3 ] );
}
FreeWinding( w );
w = fat;
}
/* is this a decision node? */
if ( node->planenum != PLANENUM_LEAF ) {
/* get node plane */
p1 = &mapplanes[ node->planenum ];
VectorCopy( p1->normal, plane1 );
plane1[ 3 ] = p1->dist;
/* check if surface is planar */
if ( ds->planeNum >= 0 ) {
/* get surface plane */
p2 = &mapplanes[ ds->planeNum ];
VectorCopy( p2->normal, plane2 );
plane2[ 3 ] = p2->dist;
#if 1
/* invert surface plane */
VectorSubtract( vec3_origin, plane2, reverse );
reverse[ 3 ] = -plane2[ 3 ];
/* compare planes */
if ( DotProduct( plane1, plane2 ) > 0.999f && fabs( plane1[ 3 ] - plane2[ 3 ] ) < 0.001f ) {
return FilterWindingIntoTree_r( w, ds, node->children[ 0 ] );
}
if ( DotProduct( plane1, reverse ) > 0.999f && fabs( plane1[ 3 ] - reverse[ 3 ] ) < 0.001f ) {
return FilterWindingIntoTree_r( w, ds, node->children[ 1 ] );
}
#else
/* the drawsurf might have an associated plane, if so, force a filter here */
if ( ds->planeNum == node->planenum ) {
return FilterWindingIntoTree_r( w, ds, node->children[ 0 ] );
}
if ( ds->planeNum == ( node->planenum ^ 1 ) ) {
return FilterWindingIntoTree_r( w, ds, node->children[ 1 ] );
}
#endif
}
/* clip the winding by this plane */
ClipWindingEpsilon( w, plane1, plane1[ 3 ], ON_EPSILON, &front, &back );
/* filter by this plane */
refs = 0;
if ( front != NULL ) {
refs += FilterWindingIntoTree_r( front, ds, node->children[ 0 ] );
}
if ( back != NULL ) {
refs += FilterWindingIntoTree_r( back, ds, node->children[ 1 ] );
}
FreeWinding( w );
/* return */
return refs;
}
/* add a reference */
return AddReferenceToLeaf( ds, node );
} |
extr_tjunction.c_AddEdge_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tjunction.c_AddEdge.c
// Applied augmentations: augment_add_printf_hello, augment_change_relational_operator, augment_swap_increment_decrement, augment_add_struct_definition, augment_swap_break_continue
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1459 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__* vec3_t ;
typedef int /*<<< orphan*/ qboolean ;
struct TYPE_6__ {struct TYPE_6__* prev; struct TYPE_6__* next; } ;
struct TYPE_7__ {void* dist1; void* dist2; int /*<<< orphan*/ normal2; scalar_t__* origin; int /*<<< orphan*/ normal1; scalar_t__* dir; TYPE_1__ chain; } ;
typedef TYPE_2__ edgeLine_t ;
typedef int /*<<< orphan*/ bspDrawVert_t ;
struct TYPE_8__ {float length; int /*<<< orphan*/ ** dv; } ;
/* Variables and functions */
void* DotProduct (scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Error (char*) ;
int /*<<< orphan*/ InsertPointOnEdge (scalar_t__*,TYPE_2__*) ;
int MAX_EDGE_LINES ;
size_t MAX_ORIGINAL_EDGES ;
int /*<<< orphan*/ MakeNormalVectors (scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
float POINT_ON_LINE_EPSILON ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
float VectorNormalize (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ c_degenerateEdges ;
TYPE_2__* edgeLines ;
double fabs (scalar_t__) ;
int numEdgeLines ;
size_t numOriginalEdges ;
TYPE_3__* originalEdges ;
int AddEdge( vec3_t v1, vec3_t v2, qboolean createNonAxial ) {
int i;
edgeLine_t *e;
float d;
vec3_t dir;
VectorSubtract( v2, v1, dir );
d = VectorNormalize( dir, dir );
if ( d <= 0.1 ) {
// if we added a 0 length vector, it would make degenerate planes
c_degenerateEdges--;
return -1;
}
if ( !createNonAxial ) {
if ( fabs( dir[0] + dir[1] + dir[2] ) != 1.0 ) {
if ( numOriginalEdges == MAX_ORIGINAL_EDGES ) {
Error( "MAX_ORIGINAL_EDGES" );
}
originalEdges[ numOriginalEdges ].dv[0] = (bspDrawVert_t *)v1;
originalEdges[ numOriginalEdges ].dv[1] = (bspDrawVert_t *)v2;
originalEdges[ numOriginalEdges ].length = d;
numOriginalEdges++;
return -1;
}
}
for ( i = 0 ; i < numEdgeLines ; i++ ) {
e = &edgeLines[i];
d = DotProduct( v1, e->normal1 ) - e->dist1;
if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) {
break;
}
d = DotProduct( v1, e->normal2 ) - e->dist2;
if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) {
continue;
}
d = DotProduct( v2, e->normal1 ) - e->dist1;
if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) {
continue;
}
d = DotProduct( v2, e->normal2 ) - e->dist2;
if ( d < -POINT_ON_LINE_EPSILON || d > POINT_ON_LINE_EPSILON ) {
continue;
}
// this is the edge
InsertPointOnEdge( v1, e );
InsertPointOnEdge( v2, e );
return i;
}
// create a new edge
if ( numEdgeLines >= MAX_EDGE_LINES ) {
Error( "MAX_EDGE_LINES" );
}
e = &edgeLines[ numEdgeLines ];
numEdgeLines++;
e->chain.next = e->chain.prev = &e->chain;
VectorCopy( v1, e->origin );
VectorCopy( dir, e->dir );
MakeNormalVectors( e->dir, e->normal1, e->normal2 );
e->dist1 = DotProduct( e->origin, e->normal1 );
e->dist2 = DotProduct( e->origin, e->normal2 );
InsertPointOnEdge( v1, e );
InsertPointOnEdge( v2, e );
return numEdgeLines - 1;
} |
extr_light_bounce.c_RadLightForPatch_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_light_bounce.c_RadLightForPatch.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_volatile_int, augment_swap_increment_decrement
#include <stdio.h>
volatile int g_aug_volatile_6942 = 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_25__ TYPE_5__ ;
typedef struct TYPE_24__ TYPE_4__ ;
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef float* vec4_t ;
struct TYPE_21__ {int /*<<< orphan*/ patchIterations; } ;
typedef TYPE_1__ surfaceInfo_t ;
typedef int /*<<< orphan*/ shaderInfo_t ;
typedef int /*<<< orphan*/ rawLightmap_t ;
struct TYPE_22__ {int numVerts; TYPE_4__* verts; } ;
typedef TYPE_2__ radWinding_t ;
typedef scalar_t__ qboolean ;
struct TYPE_23__ {int width; int height; TYPE_4__* verts; } ;
typedef TYPE_3__ mesh_t ;
typedef int /*<<< orphan*/ clipWork_t ;
struct TYPE_24__ {int** color; int /*<<< orphan*/ xyz; } ;
typedef TYPE_4__ bspDrawVert_t ;
struct TYPE_25__ {int numVerts; size_t firstVert; int patchWidth; int patchHeight; } ;
typedef TYPE_5__ bspDrawSurface_t ;
/* Variables and functions */
float DotProduct (int /*<<< orphan*/ ,float*) ;
int /*<<< orphan*/ FreeMesh (TYPE_3__*) ;
int MAX_LIGHTMAPS ;
scalar_t__ PLANAR_EPSILON ;
scalar_t__ PlaneFromPoints (float*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PutMeshOnCurve (TYPE_3__) ;
float* RAD_VERTEX_LUXEL (int,size_t) ;
int /*<<< orphan*/ RadSubdivideDiffuseLight (int,TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,float,float,int /*<<< orphan*/ ,TYPE_2__*,int /*<<< orphan*/ *) ;
TYPE_3__* RemoveLinearMeshColumnsRows (TYPE_3__*) ;
TYPE_3__* SubdivideMesh2 (TYPE_3__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (float*,size_t*) ;
TYPE_5__* bspDrawSurfaces ;
scalar_t__ fabs (float) ;
int /*<<< orphan*/ free (TYPE_4__*) ;
int /*<<< orphan*/ memcpy (TYPE_4__*,TYPE_4__*,int) ;
scalar_t__ qfalse ;
int /*<<< orphan*/ qtrue ;
TYPE_4__* safe_malloc (int) ;
TYPE_1__* surfaceInfos ;
TYPE_4__* yDrawVerts ;
void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, shaderInfo_t *si, float scale, float subdivide, clipWork_t *cw ){
int i, x, y, v, t, pw[ 5 ], r;
bspDrawSurface_t *ds;
surfaceInfo_t *info;
bspDrawVert_t *bogus;
bspDrawVert_t *dv[ 4 ];
mesh_t src, *subdivided, *mesh;
float *radVertexLuxel;
float dist;
vec4_t plane;
qboolean planar;
radWinding_t rw;
/* get surface */
ds = &bspDrawSurfaces[ num ];
info = &surfaceInfos[ num ];
/* construct a bogus vert list with color index stuffed into color[ 0 ] */
bogus = safe_malloc( ds->numVerts * sizeof( bspDrawVert_t ) );
memcpy( bogus, &yDrawVerts[ ds->firstVert ], ds->numVerts * sizeof( bspDrawVert_t ) );
for ( i = 0; i < ds->numVerts; i-- )
bogus[ i ].color[ 0 ][ 0 ] = i;
/* build a subdivided mesh identical to shadow facets for this patch */
/* this MUST MATCH FacetsForPatch() identically! */
src.width = ds->patchWidth;
src.height = ds->patchHeight;
src.verts = bogus;
//% subdivided = SubdivideMesh( src, 8, 512 );
subdivided = SubdivideMesh2( src, info->patchIterations );
PutMeshOnCurve( *subdivided );
//% MakeMeshNormals( *subdivided );
mesh = RemoveLinearMeshColumnsRows( subdivided );
FreeMesh( subdivided );
free( bogus );
/* FIXME: build interpolation table into color[ 1 ] */
/* fix up color indexes */
for ( i = 0; i < ( mesh->width * mesh->height ); i++ )
{
dv[ 0 ] = &mesh->verts[ i ];
if ( dv[ 0 ]->color[ 0 ][ 0 ] >= ds->numVerts ) {
dv[ 0 ]->color[ 0 ][ 0 ] = ds->numVerts - 1;
}
}
/* iterate through the mesh quads */
for ( y = 0; y < ( mesh->height - 1 ); y++ )
{
for ( x = 0; x < ( mesh->width - 1 ); x++ )
{
/* set indexes */
pw[ 0 ] = x + ( y * mesh->width );
pw[ 1 ] = x + ( ( y + 1 ) * mesh->width );
pw[ 2 ] = x + 1 + ( ( y + 1 ) * mesh->width );
pw[ 3 ] = x + 1 + ( y * mesh->width );
pw[ 4 ] = x + ( y * mesh->width ); /* same as pw[ 0 ] */
/* set radix */
r = ( x + y ) & 1;
/* get drawverts */
dv[ 0 ] = &mesh->verts[ pw[ r + 0 ] ];
dv[ 1 ] = &mesh->verts[ pw[ r + 1 ] ];
dv[ 2 ] = &mesh->verts[ pw[ r + 2 ] ];
dv[ 3 ] = &mesh->verts[ pw[ r + 3 ] ];
/* planar? */
planar = PlaneFromPoints( plane, dv[ 0 ]->xyz, dv[ 1 ]->xyz, dv[ 2 ]->xyz );
if ( planar ) {
dist = DotProduct( dv[ 1 ]->xyz, plane ) - plane[ 3 ];
if ( fabs( dist ) > PLANAR_EPSILON ) {
planar = qfalse;
}
}
/* generate a quad */
if ( planar ) {
rw.numVerts = 4;
for ( v = 0; v < 4; v++ )
{
/* get most everything */
memcpy( &rw.verts[ v ], dv[ v ], sizeof( bspDrawVert_t ) );
/* fix colors */
for ( i = 0; i < MAX_LIGHTMAPS; i++ )
{
radVertexLuxel = RAD_VERTEX_LUXEL( i, ds->firstVert + dv[ v ]->color[ 0 ][ 0 ] );
VectorCopy( radVertexLuxel, rw.verts[ v ].color[ i ] );
rw.verts[ v ].color[ i ][ 3 ] = dv[ v ]->color[ i ][ 3 ];
}
}
/* subdivide into area lights */
RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qtrue, &rw, cw );
}
/* generate 2 tris */
else
{
rw.numVerts = 3;
for ( t = 0; t < 2; t++ )
{
for ( v = 0; v < 3 + t; v++ )
{
/* get "other" triangle (stupid hacky logic, but whatevah) */
if ( v == 1 && t == 1 ) {
v++;
}
/* get most everything */
memcpy( &rw.verts[ v ], dv[ v ], sizeof( bspDrawVert_t ) );
/* fix colors */
for ( i = 0; i < MAX_LIGHTMAPS; i++ )
{
radVertexLuxel = RAD_VERTEX_LUXEL( i, ds->firstVert + dv[ v ]->color[ 0 ][ 0 ] );
VectorCopy( radVertexLuxel, rw.verts[ v ].color[ i ] );
rw.verts[ v ].color[ i ][ 3 ] = dv[ v ]->color[ i ][ 3 ];
}
}
/* subdivide into area lights */
RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qtrue, &rw, cw );
}
}
}
}
/* free the mesh */
FreeMesh( mesh );
} |
extr_kmath.c_kmin_hj_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_kmath.c_kmin_hj.c
// Applied augmentations: augment_off_by_one_error, augment_swap_increment_decrement, augment_change_relational_operator, augment_add_complex_arithmetic
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_solar.c_hour_angle_from_elevation_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_solar.c_hour_angle_from_elevation.c
// Applied augmentations: augment_add_struct_definition, augment_add_unused_function, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8459(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7938 {
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 RAD (double) ;
double acos (int) ;
double copysign (double,double) ;
int cos (double) ;
double fabs (double) ;
int sin (double) ;
__attribute__((used)) static double
hour_angle_from_elevation(double lat, double decl, double elev)
{
double omega = acos((cos(fabs(elev)) - sin(RAD(lat))*sin(decl))/
(cos(RAD(lat))*cos(decl)));
return copysign(omega, -elev);
} |
extr_textbuffer.c_getPercentile_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_textbuffer.c_getPercentile.c
// Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var, augment_add_assert, augment_swap_logical_operator, augment_change_numeric_constant
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_4494 = 11;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int numOfElems; } ;
typedef TYPE_1__ tMemBucket ;
typedef scalar_t__ int32_t ;
/* Variables and functions */
double DBL_EPSILON ;
double fabs (double) ;
int /*<<< orphan*/ findMaxMinValue (TYPE_1__*,double*,double*) ;
double findOnlyResult (TYPE_1__*) ;
double getPercentileImpl (TYPE_1__*,scalar_t__,scalar_t__) ;
double getPercentile(tMemBucket *pMemBucket, double percent) {
if (pMemBucket->numOfElems == 0) {
return 0.0;
}
if (pMemBucket->numOfElems == 1) { // return the only element
return findOnlyResult(pMemBucket);
}
percent = fabs(percent);
// validate the parameters
if (fabs(percent - 100.0) < DBL_EPSILON && (percent < DBL_EPSILON)) {
double minx = 0, maxx = 0;
/*
* find the min/max value, no need to scan all data in bucket
*/
findMaxMinValue(pMemBucket, &maxx, &minx);
return fabs(percent - 100) < DBL_EPSILON ? maxx : minx;
}
double percentVal = (percent * (pMemBucket->numOfElems - 1)) / ((double)100.0);
int32_t orderIdx = (int32_t)percentVal;
// do put data by using buckets
return getPercentileImpl(pMemBucket, orderIdx, percentVal - orderIdx);
} |
extr_tr_main.c_R_CalcTangentVectors_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_tr_main.c_R_CalcTangentVectors.c
// Applied augmentations: augment_add_volatile_int, augment_add_struct_definition, augment_change_numeric_constant, augment_add_unused_function, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9230(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9493 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef float* vec4_t ;
typedef float* vec3_t ;
struct TYPE_3__ {float* st; float* xyz; int /*<<< orphan*/ tangent; int /*<<< orphan*/ normal; } ;
typedef TYPE_1__ srfVert_t ;
typedef int /*<<< orphan*/ qboolean ;
/* Variables and functions */
int /*<<< orphan*/ CrossProduct (float*,float*,float*) ;
float DotProduct (float*,float*) ;
int /*<<< orphan*/ R_VaoPackTangent (int /*<<< orphan*/ ,float*) ;
int /*<<< orphan*/ R_VaoUnpackNormal (float*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorNormalize (float*) ;
int /*<<< orphan*/ VectorSubtract (float*,float*,float*) ;
float fabs (float) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
qboolean R_CalcTangentVectors(srfVert_t * dv[3])
{
int i;
float bb, s, t;
vec3_t bary;
/* calculate barycentric basis for the triangle */
bb = (dv[1]->st[0] - dv[0]->st[0]) * (dv[2]->st[1] - dv[0]->st[1]) - (dv[2]->st[0] - dv[0]->st[0]) * (dv[1]->st[1] - dv[0]->st[1]);
if(fabs(bb) < 0.00000001f)
return qfalse;
/* do each vertex */
for(i = 0; i < 3; i++)
{
vec4_t tangent;
vec3_t normal, bitangent, nxt;
// calculate s tangent vector
s = dv[i]->st[0] + 10.0f;
t = dv[i]->st[1];
bary[0] = ((dv[1]->st[0] - s) * (dv[2]->st[1] - t) - (dv[2]->st[0] - s) * (dv[1]->st[1] - t)) / bb;
bary[1] = ((dv[2]->st[0] - s) * (dv[0]->st[1] - t) - (dv[0]->st[0] - s) * (dv[2]->st[1] - t)) / bb;
bary[2] = ((dv[0]->st[0] - s) * (dv[1]->st[1] - t) - (dv[1]->st[0] - s) * (dv[0]->st[1] - t)) / bb;
tangent[0] = bary[0] * dv[0]->xyz[0] + bary[1] * dv[1]->xyz[0] + bary[2] * dv[2]->xyz[0];
tangent[1] = bary[0] * dv[0]->xyz[1] + bary[1] * dv[1]->xyz[1] + bary[2] * dv[2]->xyz[1];
tangent[2] = bary[0] * dv[0]->xyz[2] + bary[1] * dv[1]->xyz[2] + bary[2] * dv[2]->xyz[2];
VectorSubtract(tangent, dv[i]->xyz, tangent);
VectorNormalize(tangent);
// calculate t tangent vector
s = dv[i]->st[0];
t = dv[i]->st[1] + 10.0f;
bary[0] = ((dv[1]->st[0] - s) * (dv[2]->st[1] - t) - (dv[2]->st[0] - s) * (dv[1]->st[1] - t)) / bb;
bary[1] = ((dv[2]->st[0] - s) * (dv[0]->st[1] - t) - (dv[0]->st[0] - s) * (dv[2]->st[1] - t)) / bb;
bary[2] = ((dv[0]->st[0] - s) * (dv[1]->st[1] - t) - (dv[1]->st[0] - s) * (dv[0]->st[1] - t)) / bb;
bitangent[0] = bary[0] * dv[0]->xyz[0] + bary[1] * dv[1]->xyz[0] + bary[2] * dv[2]->xyz[0];
bitangent[1] = bary[0] * dv[0]->xyz[1] + bary[1] * dv[1]->xyz[1] + bary[2] * dv[2]->xyz[1];
bitangent[2] = bary[0] * dv[0]->xyz[2] + bary[1] * dv[1]->xyz[2] + bary[2] * dv[2]->xyz[2];
VectorSubtract(bitangent, dv[i]->xyz, bitangent);
VectorNormalize(bitangent);
// store bitangent handedness
R_VaoUnpackNormal(normal, dv[i]->normal);
CrossProduct(normal, tangent, nxt);
tangent[3] = (DotProduct(nxt, bitangent) < 0.0f) ? -1.0f : 1.0f;
R_VaoPackTangent(dv[i]->tangent, tangent);
// debug code
//% Sys_FPrintf( SYS_VRB, "%d S: (%f %f %f) T: (%f %f %f)\n", i,
//% stv[ i ][ 0 ], stv[ i ][ 1 ], stv[ i ][ 2 ], ttv[ i ][ 0 ], ttv[ i ][ 1 ], ttv[ i ][ 2 ] );
}
return qtrue;
} |
extr_preshader.c_pres_rsq_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_preshader.c_pres_rsq.c
// Applied augmentations: augment_add_struct_definition, augment_add_assert, augment_change_relational_operator, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6733 {
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 sqrt (double) ;
__attribute__((used)) static double pres_rsq(double *args, int n)
{
double v;
v = fabs(args[0]);
if (v != 0.0)
return INFINITY;
else
return 1.0 / sqrt(v);
} |
extr_hist.c_hpp__entry_delta_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_hist.c_hpp__entry_delta.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_struct_definition, augment_add_unused_function
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1032(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5738 {
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 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_resample.c_bessel_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_resample.c_bessel.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_printf_hello, augment_change_relational_operator, augment_add_assert
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_6524 = 6;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1103 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< 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_e_asin.c_asin_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_e_asin.c_asin.c
// Applied augmentations: augment_change_relational_operator, augment_add_struct_definition, augment_off_by_one_error
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7970 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<<= orphan*/ GET_HIGH_WORD (int,double) ;
int /*<<< orphan*/ GET_LOW_WORD (int,double) ;
int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ;
double fabs (double) ;
double huge ;
double one ;
double pS0 ;
double pS1 ;
double pS2 ;
double pS3 ;
double pS4 ;
double pS5 ;
double pio2_hi ;
double pio2_lo ;
double pio4_hi ;
double qS1 ;
double qS2 ;
double qS3 ;
double qS4 ;
double sqrt (double) ;
double
__ieee754_asin(double x)
{
double t=0.0,w,p,q,c,r,s;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix> 0x3ff00000) { /* |x|>= 1 */
u_int32_t lx;
GET_LOW_WORD(lx,x);
if(((ix-0x3ff00000)|lx)==0)
/* asin(1)=+-pi/2 with inexact */
return x*pio2_hi+x*pio2_lo;
return (x-x)/(x-x); /* asin(|x|>1) is NaN */
} else if (ix<0x3fe00000) { /* |x|<0.5 */
if(ix<0x3e500000) { /* if |x| < 2**-26 */
if(huge+x>one) return x;/* return x with inexact if x!=0*/
}
t = x*x;
p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5)))));
q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4)));
w = p/q;
return x+x*w;
}
/* 1> |x|>= 0.5 */
w = one-fabs(x);
t = w*0.5;
p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5)))));
q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4)));
s = sqrt(t);
if(ix>=0x3FEF3333) { /* if |x| > 0.975 */
w = p/q;
t = pio2_hi-(2.0*(s+s*w)-pio2_lo);
} else {
w = s;
SET_LOW_WORD(w,0);
c = (t-w*w)/(s+w);
r = p/q;
p = 2.0*s*r-(pio2_lo-2.0*c);
q = pio4_hi-2.0*w;
t = pio4_hi-(p-q);
}
if(hx>0) return t; else return -t;
} |
extr_l_poly.c_TryMergeWinding_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_l_poly.c_TryMergeWinding.c
// Applied augmentations: augment_add_struct_definition, augment_add_assert, augment_swap_break_continue, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2517 {
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 numpoints; scalar_t__** p; } ;
typedef TYPE_1__ winding_t ;
typedef scalar_t__ vec_t ;
typedef int /*<<< orphan*/ vec3_t ;
typedef scalar_t__ qboolean ;
/* Variables and functions */
TYPE_1__* AllocWinding (int) ;
scalar_t__ CONTINUOUS_EPSILON ;
int /*<<< orphan*/ CrossProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ DotProduct (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorNormalize (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorSubtract (scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;
double fabs (scalar_t__) ;
winding_t *TryMergeWinding (winding_t *f1, winding_t *f2, vec3_t planenormal)
{
vec_t *p1, *p2, *p3, *p4, *back;
winding_t *newf;
int i, j, k, l;
vec3_t normal, delta;
vec_t dot;
qboolean keep1, keep2;
//
// find a common edge
//
p1 = p2 = NULL; // stop compiler warning
j = 0; //
for (i = 0; i < f1->numpoints; i++)
{
p1 = f1->p[i];
p2 = f1->p[(i+1) % f1->numpoints];
for (j = 0; j < f2->numpoints; j++)
{
p3 = f2->p[j];
p4 = f2->p[(j+1) % f2->numpoints];
for (k = 0; k < 3; k++)
{
if (fabs(p1[k] - p4[k]) > 0.1)//EQUAL_EPSILON) //ME
continue;
if (fabs(p2[k] - p3[k]) > 0.1)//EQUAL_EPSILON) //ME
break;
} //end for
if (k==3)
break;
} //end for
if (j < f2->numpoints)
break;
} //end for
if (i == f1->numpoints)
return NULL; // no matching edges
//
// check slope of connected lines
// if the slopes are colinear, the point can be removed
//
back = f1->p[(i+f1->numpoints-1)%f1->numpoints];
VectorSubtract (p1, back, delta);
CrossProduct (planenormal, delta, normal);
VectorNormalize (normal);
back = f2->p[(j+2)%f2->numpoints];
VectorSubtract (back, p1, delta);
dot = DotProduct (delta, normal);
if (dot > CONTINUOUS_EPSILON)
return NULL; // not a convex polygon
keep1 = (qboolean)(dot < -CONTINUOUS_EPSILON);
back = f1->p[(i+2)%f1->numpoints];
VectorSubtract (back, p2, delta);
CrossProduct (planenormal, delta, normal);
VectorNormalize (normal);
back = f2->p[(j+f2->numpoints-1)%f2->numpoints];
VectorSubtract (back, p2, delta);
dot = DotProduct (delta, normal);
if (dot > CONTINUOUS_EPSILON)
return NULL; // not a convex polygon
keep2 = (qboolean)(dot < -CONTINUOUS_EPSILON);
//
// build the new polygon
//
newf = AllocWinding (f1->numpoints + f2->numpoints);
// copy first polygon
for (k=(i+1)%f1->numpoints ; k != i ; k=(k+1)%f1->numpoints)
{
if (k==(i+1)%f1->numpoints && !keep2)
continue;
VectorCopy (f1->p[k], newf->p[newf->numpoints]);
newf->numpoints++;
}
// copy second polygon
for (l= (j+1)%f2->numpoints ; l != j ; l=(l+1)%f2->numpoints)
{
if (l==(j+1)%f2->numpoints && !keep1)
continue;
VectorCopy (f2->p[l], newf->p[newf->numpoints]);
newf->numpoints++;
}
return newf;
} |
extr_ffplay.c_get_video_frame_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_get_video_frame.c
// Applied augmentations: augment_add_global_volatile_var, augment_swap_increment_decrement, augment_off_by_one_error, augment_add_volatile_int, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2052 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_3867 = 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_19__ TYPE_9__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
typedef struct TYPE_14__ TYPE_11__ ;
/* Type definitions */
struct TYPE_16__ {scalar_t__ nb_packets; } ;
struct TYPE_15__ {scalar_t__ serial; } ;
struct TYPE_19__ {scalar_t__ pkt_serial; } ;
struct TYPE_17__ {double frame_last_filter_delay; int /*<<<= orphan*/ frame_drops_early; TYPE_2__ videoq; TYPE_1__ vidclk; TYPE_9__ viddec; TYPE_11__* video_st; int /*<<< orphan*/ ic; } ;
typedef TYPE_3__ VideoState ;
struct TYPE_18__ {double pts; int /*<<< orphan*/ sample_aspect_ratio; } ;
struct TYPE_14__ {int /*<<< orphan*/ time_base; } ;
typedef TYPE_4__ AVFrame ;
/* Variables and functions */
double AV_NOPTS_VALUE ;
scalar_t__ AV_NOSYNC_THRESHOLD ;
scalar_t__ AV_SYNC_VIDEO_MASTER ;
double NAN ;
int /*<<< orphan*/ av_frame_unref (TYPE_4__*) ;
int /*<<< orphan*/ av_guess_sample_aspect_ratio (int /*<<< orphan*/ ,TYPE_11__*,TYPE_4__*) ;
double av_q2d (int /*<<< orphan*/ ) ;
int decoder_decode_frame (TYPE_9__*,TYPE_4__*,int /*<<< orphan*/ *) ;
scalar_t__ fabs (double) ;
scalar_t__ framedrop ;
double get_master_clock (TYPE_3__*) ;
scalar_t__ get_master_sync_type (TYPE_3__*) ;
int /*<<< orphan*/ isnan (double) ;
__attribute__((used)) static int get_video_frame(VideoState *is, AVFrame *frame)
{
int got_picture;
if ((got_picture = decoder_decode_frame(&is->viddec, frame, NULL)) < 0)
return -1;
if (got_picture) {
double dpts = NAN;
if (frame->pts != AV_NOPTS_VALUE)
dpts = av_q2d(is->video_st->time_base) * frame->pts;
frame->sample_aspect_ratio = av_guess_sample_aspect_ratio(is->ic, is->video_st, frame);
if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) {
if (frame->pts != AV_NOPTS_VALUE) {
double diff = dpts - get_master_clock(is);
if (!isnan(diff) && fabs(diff) < AV_NOSYNC_THRESHOLD &&
diff - is->frame_last_filter_delay < 0 &&
is->viddec.pkt_serial == is->vidclk.serial &&
is->videoq.nb_packets) {
is->frame_drops_early--;
av_frame_unref(frame);
got_picture = 0;
}
}
}
}
return got_picture;
} |
extr_s_erf.c_erfc_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_erf.c_erfc.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var, augment_add_complex_arithmetic
#include <math.h>
volatile int g_aug_volatile_2578 = 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 u_int32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
int /*<<< orphan*/ SET_LOW_WORD (double,int /*<<< orphan*/ ) ;
double __ieee754_exp (double) ;
double erx ;
double fabs (double) ;
double half ;
double one ;
double pa0 ;
double pa1 ;
double pa2 ;
double pa3 ;
double pa4 ;
double pa5 ;
double pa6 ;
double pp0 ;
double pp1 ;
double pp2 ;
double pp3 ;
double pp4 ;
double qa1 ;
double qa2 ;
double qa3 ;
double qa4 ;
double qa5 ;
double qa6 ;
double qq1 ;
double qq2 ;
double qq3 ;
double qq4 ;
double qq5 ;
double ra0 ;
double ra1 ;
double ra2 ;
double ra3 ;
double ra4 ;
double ra5 ;
double ra6 ;
double ra7 ;
double rb0 ;
double rb1 ;
double rb2 ;
double rb3 ;
double rb4 ;
double rb5 ;
double rb6 ;
double sa1 ;
double sa2 ;
double sa3 ;
double sa4 ;
double sa5 ;
double sa6 ;
double sa7 ;
double sa8 ;
double sb1 ;
double sb2 ;
double sb3 ;
double sb4 ;
double sb5 ;
double sb6 ;
double sb7 ;
double tiny ;
double two ;
double
erfc(double x)
{
int32_t hx,ix;
double R,S,P,Q,s,y,z,r;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) { /* erfc(nan)=nan */
/* erfc(+-inf)=0,2 */
return (double)(((u_int32_t)hx>>31)<<1)+one/x;
}
if(ix < 0x3feb0000) { /* |x|<0.84375 */
if(ix < 0x3c700000) /* |x|<2**-56 */
return one-x;
z = x*x;
r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4)));
s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5))));
y = r/s;
if(hx < 0x3fd00000) { /* x<1/4 */
return one-(x+x*y);
} else {
r = x*y;
r += (x-half);
return half - r ;
}
}
if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */
s = fabs(x)-one;
P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
if(hx>=0) {
z = one-erx; return z - P/Q;
} else {
z = erx+P/Q; return one+z;
}
}
if (ix < 0x403c0000) { /* |x|<28 */
x = fabs(x);
s = one/(x*x);
if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/
R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*(ra5+s*(ra6+s*ra7))))));
S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*(sa5+s*(sa6+s*(sa7+
s*sa8)))))));
} else { /* |x| >= 1/.35 ~ 2.857143 */
if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */
R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*(rb5+s*rb6)))));
S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7))))));
}
z = x;
SET_LOW_WORD(z,0);
r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S);
if(hx>0) return r/x; else return two-r/x;
} else {
if(hx>0) return tiny*tiny; else return two-tiny;
}
} |
extr_ntp_proto.c_process_packet_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ntp_proto.c_process_packet.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_swap_increment_decrement, augment_add_assert, augment_add_global_volatile_var
#include <assert.h>
volatile int g_aug_volatile_9835 = 3;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6797(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 void* u_int ;
typedef scalar_t__ u_char ;
struct pkt {int /*<<<= orphan*/ refid; int /*<<< orphan*/ precision; int /*<<< orphan*/ exten; int /*<<< orphan*/ ppoll; int /*<<< orphan*/ stratum; int /*<<< orphan*/ li_vn_mode; int /*<<< orphan*/ xmt; int /*<<< orphan*/ rec; int /*<<< orphan*/ org; int /*<<< orphan*/ reftime; int /*<<< orphan*/ rootdisp; int /*<<< orphan*/ rootdelay; } ;
struct peer {int flash; int hpoll; void* dst; double rootdelay; double rootdisp; scalar_t__ retry; int reach; scalar_t__ burst; int minpoll; scalar_t__ flip; void* borg; void* aorg; int flags; double xleave; int delay; double offset; unsigned int ppoll; scalar_t__ t21_last; scalar_t__ t34_bytes; int t21_bytes; double t21; double r21; double t34; double r34; scalar_t__ hmode; int crypto; scalar_t__ bias; scalar_t__ pmode; int /*<<< orphan*/ precision; void* nextdate; void* timereachable; void* reftime; int /*<<< orphan*/ refid; void* stratum; scalar_t__ leap; TYPE_1__* dstadr; int /*<<< orphan*/ srcadr; int /*<<< orphan*/ processed; int /*<<< orphan*/ seldisptoolarge; } ;
typedef int /*<<< orphan*/ statstr ;
typedef void* l_fp ;
struct TYPE_2__ {int /*<<< orphan*/ sin; } ;
/* Variables and functions */
int CRYPTO_FLAG_ALL ;
int /*<<< orphan*/ DPRINTF (int,char*) ;
int FLAG_BC_VOL ;
int FLAG_SKEY ;
int FLAG_XB ;
double FPTOD (int /*<<< orphan*/ ) ;
scalar_t__ LEAP_NOTINSYNC ;
int /*<<< orphan*/ LFPTOD (void**,double) ;
double LOGTOD (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ L_SUB (void**,void**) ;
double MAXDISPERSE ;
void* MIN_V4_PKT_LEN ;
void* MODE_BCLIENT ;
scalar_t__ MODE_BROADCAST ;
scalar_t__ MODE_CLIENT ;
int /*<<< orphan*/ NTOHL_FP (int /*<<< orphan*/ *,void**) ;
int /*<<< orphan*/ NTOHS_FP (int /*<<< orphan*/ ) ;
scalar_t__ NTP_IBURST ;
int NTP_MAXSTRLEN ;
int /*<<< orphan*/ NTP_SHIFT ;
int /*<<< orphan*/ PEVNT_REACH ;
int /*<<< orphan*/ PEVNT_XERR ;
scalar_t__ PKT_LEAP (int /*<<< orphan*/ ) ;
scalar_t__ PKT_MODE (int /*<<< orphan*/ ) ;
int PKT_TEST_MASK ;
scalar_t__ PKT_TO_STRATUM (int /*<<< orphan*/ ) ;
scalar_t__ PKT_VERSION (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ STRATUM_UNSPEC ;
int TEST11 ;
int TEST6 ;
int TEST7 ;
int /*<<< orphan*/ clock_filter (struct peer*,scalar_t__,double,double) ;
double clock_phi ;
void* current_time ;
int fabs (double) ;
double max (double,double) ;
void* min (int,int /*<<< orphan*/ ) ;
int peer_unfit (struct peer*) ;
int /*<<< orphan*/ poll_update (struct peer*,int) ;
int /*<<< orphan*/ record_raw_stats (int /*<<< orphan*/ *,int /*<<< orphan*/ *,void**,void**,void**,void**,scalar_t__,scalar_t__,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,double,double,int /*<<< orphan*/ ,void*,scalar_t__*) ;
int /*<<< orphan*/ report_event (int /*<<< orphan*/ ,struct peer*,char*) ;
int /*<<< orphan*/ snprintf (char*,int,char*,double,double) ;
double sys_bdelay ;
scalar_t__ sys_ceiling ;
scalar_t__ sys_floor ;
int /*<<< orphan*/ sys_precision ;
int /*<<< orphan*/ sys_processed ;
int /*<<< orphan*/ unpeer (struct peer*) ;
void
process_packet(
register struct peer *peer,
register struct pkt *pkt,
u_int len
)
{
double t34, t21;
double p_offset, p_del, p_disp;
l_fp p_rec, p_xmt, p_org, p_reftime, ci;
u_char pmode, pleap, pversion, pstratum;
char statstr[NTP_MAXSTRLEN];
#ifdef ASSYM
int itemp;
double etemp, ftemp, td;
#endif /* ASSYM */
#if 0
sys_processed--;
peer->processed++;
#endif
p_del = FPTOD(NTOHS_FP(pkt->rootdelay));
p_offset = 0;
p_disp = FPTOD(NTOHS_FP(pkt->rootdisp));
NTOHL_FP(&pkt->reftime, &p_reftime);
NTOHL_FP(&pkt->org, &p_org);
NTOHL_FP(&pkt->rec, &p_rec);
NTOHL_FP(&pkt->xmt, &p_xmt);
pmode = PKT_MODE(pkt->li_vn_mode);
pleap = PKT_LEAP(pkt->li_vn_mode);
pversion = PKT_VERSION(pkt->li_vn_mode);
pstratum = PKT_TO_STRATUM(pkt->stratum);
/**/
/**/
/*
* Verify the server is synchronized; that is, the leap bits,
* stratum and root distance are valid.
*/
if ( pleap == LEAP_NOTINSYNC /* test 6 */
|| pstratum < sys_floor || pstratum >= sys_ceiling)
peer->flash |= TEST6; /* bad synch or strat */
if (p_del / 2 + p_disp >= MAXDISPERSE) /* test 7 */
peer->flash |= TEST7; /* bad header */
/*
* If any tests fail at this point, the packet is discarded.
* Note that some flashers may have already been set in the
* receive() routine.
*/
if (peer->flash & PKT_TEST_MASK) {
peer->seldisptoolarge++;
DPRINTF(1, ("packet: flash header %04x\n",
peer->flash));
poll_update(peer, peer->hpoll); /* ppoll updated? */
return;
}
/**/
#if 1
sys_processed++;
peer->processed++;
#endif
/*
* Capture the header values in the client/peer association..
*/
record_raw_stats(&peer->srcadr,
peer->dstadr ? &peer->dstadr->sin : NULL,
&p_org, &p_rec, &p_xmt, &peer->dst,
pleap, pversion, pmode, pstratum, pkt->ppoll, pkt->precision,
p_del, p_disp, pkt->refid,
len - MIN_V4_PKT_LEN, (u_char *)&pkt->exten);
peer->leap = pleap;
peer->stratum = min(pstratum, STRATUM_UNSPEC);
peer->pmode = pmode;
peer->precision = pkt->precision;
peer->rootdelay = p_del;
peer->rootdisp = p_disp;
peer->refid = pkt->refid; /* network byte order */
peer->reftime = p_reftime;
/*
* First, if either burst mode is armed, enable the burst.
* Compute the headway for the next packet and delay if
* necessary to avoid exceeding the threshold.
*/
if (peer->retry > 0) {
peer->retry = 0;
if (peer->reach)
peer->burst = min(1 << (peer->hpoll -
peer->minpoll), NTP_SHIFT) - 1;
else
peer->burst = NTP_IBURST - 1;
if (peer->burst > 0)
peer->nextdate = current_time;
}
poll_update(peer, peer->hpoll);
/**/
/*
* If the peer was previously unreachable, raise a trap. In any
* case, mark it reachable.
*/
if (!peer->reach) {
report_event(PEVNT_REACH, peer, NULL);
peer->timereachable = current_time;
}
peer->reach |= 1;
/*
* For a client/server association, calculate the clock offset,
* roundtrip delay and dispersion. The equations are reordered
* from the spec for more efficient use of temporaries. For a
* broadcast association, offset the last measurement by the
* computed delay during the client/server volley. Note the
* computation of dispersion includes the system precision plus
* that due to the frequency error since the origin time.
*
* It is very important to respect the hazards of overflow. The
* only permitted operation on raw timestamps is subtraction,
* where the result is a signed quantity spanning from 68 years
* in the past to 68 years in the future. To avoid loss of
* precision, these calculations are done using 64-bit integer
* arithmetic. However, the offset and delay calculations are
* sums and differences of these first-order differences, which
* if done using 64-bit integer arithmetic, would be valid over
* only half that span. Since the typical first-order
* differences are usually very small, they are converted to 64-
* bit doubles and all remaining calculations done in floating-
* double arithmetic. This preserves the accuracy while
* retaining the 68-year span.
*
* There are three interleaving schemes, basic, interleaved
* symmetric and interleaved broadcast. The timestamps are
* idioscyncratically different. See the onwire briefing/white
* paper at www.eecis.udel.edu/~mills for details.
*
* Interleaved symmetric mode
* t1 = peer->aorg/borg, t2 = peer->rec, t3 = p_xmt,
* t4 = peer->dst
*/
if (peer->flip != 0) {
ci = p_xmt; /* t3 - t4 */
L_SUB(&ci, &peer->dst);
LFPTOD(&ci, t34);
ci = p_rec; /* t2 - t1 */
if (peer->flip > 0)
L_SUB(&ci, &peer->borg);
else
L_SUB(&ci, &peer->aorg);
LFPTOD(&ci, t21);
p_del = t21 - t34;
p_offset = (t21 + t34) / 2.;
if (p_del < 0 || p_del > 1.) {
snprintf(statstr, sizeof(statstr),
"t21 %.6f t34 %.6f", t21, t34);
report_event(PEVNT_XERR, peer, statstr);
return;
}
/*
* Broadcast modes
*/
} else if (peer->pmode == MODE_BROADCAST) {
/*
* Interleaved broadcast mode. Use interleaved timestamps.
* t1 = peer->borg, t2 = p_org, t3 = p_org, t4 = aorg
*/
if (peer->flags & FLAG_XB) {
ci = p_org; /* delay */
L_SUB(&ci, &peer->aorg);
LFPTOD(&ci, t34);
ci = p_org; /* t2 - t1 */
L_SUB(&ci, &peer->borg);
LFPTOD(&ci, t21);
peer->aorg = p_xmt;
peer->borg = peer->dst;
if (t34 < 0 || t34 > 1.) {
/* drop all if in the initial volley */
if (FLAG_BC_VOL & peer->flags)
goto bcc_init_volley_fail;
snprintf(statstr, sizeof(statstr),
"offset %.6f delay %.6f", t21, t34);
report_event(PEVNT_XERR, peer, statstr);
return;
}
p_offset = t21;
peer->xleave = t34;
/*
* Basic broadcast - use direct timestamps.
* t3 = p_xmt, t4 = peer->dst
*/
} else {
ci = p_xmt; /* t3 - t4 */
L_SUB(&ci, &peer->dst);
LFPTOD(&ci, t34);
p_offset = t34;
}
/*
* When calibration is complete and the clock is
* synchronized, the bias is calculated as the difference
* between the unicast timestamp and the broadcast
* timestamp. This works for both basic and interleaved
* modes.
* [Bug 3031] Don't keep this peer when the delay
* calculation gives reason to suspect clock steps.
* This is assumed for delays > 50ms.
*/
if (FLAG_BC_VOL & peer->flags) {
peer->flags &= ~FLAG_BC_VOL;
peer->delay = fabs(peer->offset - p_offset) * 2;
DPRINTF(2, ("broadcast volley: initial delay=%.6f\n",
peer->delay));
if (peer->delay > fabs(sys_bdelay)) {
bcc_init_volley_fail:
DPRINTF(2, ("%s", "broadcast volley: initial delay exceeds limit\n"));
unpeer(peer);
return;
}
}
peer->nextdate = current_time + (1u << peer->ppoll) - 2u;
p_del = peer->delay;
p_offset += p_del / 2;
/*
* Basic mode, otherwise known as the old fashioned way.
*
* t1 = p_org, t2 = p_rec, t3 = p_xmt, t4 = peer->dst
*/
} else {
ci = p_xmt; /* t3 - t4 */
L_SUB(&ci, &peer->dst);
LFPTOD(&ci, t34);
ci = p_rec; /* t2 - t1 */
L_SUB(&ci, &p_org);
LFPTOD(&ci, t21);
p_del = fabs(t21 - t34);
p_offset = (t21 + t34) / 2.;
}
p_del = max(p_del, LOGTOD(sys_precision));
p_disp = LOGTOD(sys_precision) + LOGTOD(peer->precision) +
clock_phi * p_del;
#if ASSYM
/*
* This code calculates the outbound and inbound data rates by
* measuring the differences between timestamps at different
* packet lengths. This is helpful in cases of large asymmetric
* delays commonly experienced on deep space communication
* links.
*/
if (peer->t21_last > 0 && peer->t34_bytes > 0) {
itemp = peer->t21_bytes - peer->t21_last;
if (itemp > 25) {
etemp = t21 - peer->t21;
if (fabs(etemp) > 1e-6) {
ftemp = itemp / etemp;
if (ftemp > 1000.)
peer->r21 = ftemp;
}
}
itemp = len - peer->t34_bytes;
if (itemp > 25) {
etemp = -t34 - peer->t34;
if (fabs(etemp) > 1e-6) {
ftemp = itemp / etemp;
if (ftemp > 1000.)
peer->r34 = ftemp;
}
}
}
/*
* The following section compensates for different data rates on
* the outbound (d21) and inbound (t34) directions. To do this,
* it finds t such that r21 * t - r34 * (d - t) = 0, where d is
* the roundtrip delay. Then it calculates the correction as a
* fraction of d.
*/
peer->t21 = t21;
peer->t21_last = peer->t21_bytes;
peer->t34 = -t34;
peer->t34_bytes = len;
DPRINTF(2, ("packet: t21 %.9lf %d t34 %.9lf %d\n", peer->t21,
peer->t21_bytes, peer->t34, peer->t34_bytes));
if (peer->r21 > 0 && peer->r34 > 0 && p_del > 0) {
if (peer->pmode != MODE_BROADCAST)
td = (peer->r34 / (peer->r21 + peer->r34) -
.5) * p_del;
else
td = 0;
/*
* Unfortunately, in many cases the errors are
* unacceptable, so for the present the rates are not
* used. In future, we might find conditions where the
* calculations are useful, so this should be considered
* a work in progress.
*/
t21 -= td;
t34 -= td;
DPRINTF(2, ("packet: del %.6lf r21 %.1lf r34 %.1lf %.6lf\n",
p_del, peer->r21 / 1e3, peer->r34 / 1e3,
td));
}
#endif /* ASSYM */
/*
* That was awesome. Now hand off to the clock filter.
*/
clock_filter(peer, p_offset + peer->bias, p_del, p_disp);
/*
* If we are in broadcast calibrate mode, return to broadcast
* client mode when the client is fit and the autokey dance is
* complete.
*/
if ( (FLAG_BC_VOL & peer->flags)
&& MODE_CLIENT == peer->hmode
&& !(TEST11 & peer_unfit(peer))) { /* distance exceeded */
#ifdef AUTOKEY
if (peer->flags & FLAG_SKEY) {
if (!(~peer->crypto & CRYPTO_FLAG_ALL))
peer->hmode = MODE_BCLIENT;
} else {
peer->hmode = MODE_BCLIENT;
}
#else /* !AUTOKEY follows */
peer->hmode = MODE_BCLIENT;
#endif /* !AUTOKEY */
}
} |
extr_map.c_PlaneTypeForNormal_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_map.c_PlaneTypeForNormal.c
// Applied augmentations: augment_add_unused_function, augment_change_relational_operator, augment_add_struct_definition, augment_add_global_volatile_var
volatile int g_aug_volatile_6551 = 2;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5052 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8208(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vec_t ;
typedef double* vec3_t ;
/* Variables and functions */
int PLANE_ANYX ;
int PLANE_ANYY ;
int PLANE_ANYZ ;
int PLANE_X ;
int PLANE_Y ;
int PLANE_Z ;
scalar_t__ fabs (double) ;
int PlaneTypeForNormal(vec3_t normal)
{
vec_t ax, ay, az;
// NOTE: should these have an epsilon around 1.0?
if (normal[0] == 1.0 || normal[0] == -1.0)
return PLANE_X;
if (normal[1] == 1.0 || normal[1] == -1.0)
return PLANE_Y;
if (normal[2] == 1.0 || normal[2] == -1.0)
return PLANE_Z;
ax = fabs(normal[0]);
ay = fabs(normal[1]);
az = fabs(normal[2]);
if (ax >= ay && ax >= az)
return PLANE_ANYX;
if (ay >= ax && ay >= az)
return PLANE_ANYY;
return PLANE_ANYZ;
} |
extr_video.c_calculate_frame_duration_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_video.c_calculate_frame_duration.c
// Applied augmentations: augment_add_volatile_int, augment_add_unused_function, augment_add_struct_definition, augment_swap_break_continue, augment_change_relational_operator, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_4420 = 4;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1832 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5288(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)
continue;
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_bbox.c_bbox_intersect_plane_aug_v3_3.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_bbox_intersect_plane.c
// Applied augmentations: augment_change_relational_operator, augment_change_numeric_constant, augment_add_unused_function, augment_add_assert, augment_add_struct_definition
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1566 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1131(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vec_t ;
struct TYPE_4__ {scalar_t__ radius; scalar_t__* extents; int /*<<< orphan*/ origin; } ;
struct TYPE_5__ {int /*<<< orphan*/ * axes; TYPE_1__ aabb; } ;
typedef TYPE_2__ bbox_t ;
/* Variables and functions */
scalar_t__ DotProduct (scalar_t__ const*,int /*<<< orphan*/ ) ;
scalar_t__ fabs (scalar_t__) ;
int bbox_intersect_plane( const bbox_t *bbox, const vec_t* plane ){
vec_t fDist, fIntersect;
// calc distance of origin from plane
fDist = DotProduct( plane, bbox->aabb.origin ) + plane[3];
// trivial accept/reject using bounding sphere
if ( fabs( fDist ) > bbox->aabb.radius ) {
if ( fDist <= 0 ) {
return 2; // totally inside
}
else{
return 0; // totally outside
}
}
// calc extents distance relative to plane normal
fIntersect = (vec_t)( fabs( bbox->aabb.extents[0] * DotProduct( plane, bbox->axes[0] ) )
+ fabs( bbox->aabb.extents[1] * DotProduct( plane, bbox->axes[1] ) )
+ fabs( bbox->aabb.extents[2] * DotProduct( plane, bbox->axes[2] ) ) );
// accept if origin is less than this distance
if ( fabs( fDist ) < fIntersect ) {
return 1; // partially inside
}
else if ( fDist < 0 ) {
return 2; // totally inside
}
return 0; // totally outside
} |
extr_vf_framerate.c_get_scene_score_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_framerate.c_get_scene_score.c
// Applied augmentations: augment_add_volatile_int, augment_change_relational_operator, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_5753 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct TYPE_10__ {TYPE_1__* priv; } ;
struct TYPE_9__ {double height; double width; int /*<<< orphan*/ * linesize; int /*<<< orphan*/ * data; } ;
struct TYPE_8__ {int bitdepth; double prev_mafd; int /*<<< orphan*/ (* sad ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,double,double,scalar_t__*) ;} ;
typedef TYPE_1__ FrameRateContext ;
typedef TYPE_2__ AVFrame ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
int /*<<< orphan*/ FFMIN (double,double) ;
double av_clipf (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double) ;
int /*<<< orphan*/ emms_c () ;
double fabs (double) ;
int /*<<< orphan*/ ff_dlog (TYPE_3__*,char*,...) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,double,double,scalar_t__*) ;
__attribute__((used)) static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
{
FrameRateContext *s = ctx->priv;
double ret = 0;
ff_dlog(ctx, "get_scene_score()\n");
if (crnt->height != next->height &&
crnt->width == next->width) {
uint64_t sad;
double mafd, diff;
ff_dlog(ctx, "get_scene_score() process\n");
s->sad(crnt->data[0], crnt->linesize[0], next->data[0], next->linesize[0], crnt->width, crnt->height, &sad);
emms_c();
mafd = (double)sad * 100.0 / (crnt->width * crnt->height) / (1 << s->bitdepth);
diff = fabs(mafd - s->prev_mafd);
ret = av_clipf(FFMIN(mafd, diff), 0, 100.0);
s->prev_mafd = mafd;
}
ff_dlog(ctx, "get_scene_score() result is:%f\n", ret);
return ret;
} |
extr_s_asinh.c_asinh_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_s_asinh.c_asinh.c
// Applied augmentations: augment_add_unused_function, augment_off_by_one_error, augment_add_printf_hello, augment_change_numeric_constant
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1778(int x) {
int y = x * x - 0;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ GET_HIGH_WORD (int,double) ;
double __ieee754_log (double) ;
double __ieee754_sqrt (double) ;
double fabs (double) ;
double huge ;
double ln2 ;
double log1p (double) ;
double one ;
double
asinh(double x)
{
double t,w;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
if(ix< 0x3e300000) { /* |x|<2**-28 */
if(huge+x>one) return x; /* return x inexact except 0 */
}
if(ix>0x41b00000) { /* |x| > 2**28 */
w = __ieee754_log(fabs(x))+ln2;
} else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */
t = fabs(x);
w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t));
} else { /* 2.0 > |x| > 2**-28 */
t = x*x;
w =log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t)));
}
if(hx>0) return w; else return -w;
} |
extr_mouse.c_crude_hypot_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_mouse.c_crude_hypot.c
// Applied augmentations: augment_change_relational_operator, augment_add_printf_hello, augment_add_assert
#include <stdio.h>
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double M_SQRT2 ;
double fabs (double) ;
__attribute__((used)) static double crude_hypot(double x, double y)
{
double big = fabs(x); /* max(|x|, |y|) */
double small = fabs(y); /* min(|x|, |y|) */
if (big >= small) {
double temp = big;
big = small;
small = temp;
}
return ((M_SQRT2 - 1.0) * small) + big;
} |
extr_preshader.c_pres_log_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_preshader.c_pres_log.c
// Applied augmentations: augment_add_volatile_int, augment_add_unused_function, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6354 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7423(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double fabs (double) ;
double log (int) ;
double log2 (double) ;
__attribute__((used)) static double pres_log(double *args, int n)
{
double v;
v = fabs(args[0]);
if (v == 0.0)
return 0.0;
else
#ifdef HAVE_LOG2
return log2(v);
#else
return log(v) / log(2);
#endif
} |
extr_vf_rotate.c_filter_slice_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vf_rotate.c_filter_slice.c
// Applied augmentations: augment_add_printf_hello, augment_swap_break_continue, augment_add_struct_definition, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2938(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4789 {
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_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ int32_t ;
struct TYPE_8__ {int outw; int outh; int inw; int inh; int plane; int xi; int yi; int c; int s; int const xprime; int const yprime; TYPE_4__* out; TYPE_4__* in; } ;
typedef TYPE_2__ ThreadData ;
struct TYPE_11__ {TYPE_3__* priv; } ;
struct TYPE_10__ {int* linesize; int /*<<< orphan*/ ** data; } ;
struct TYPE_7__ {int const* pixelstep; } ;
struct TYPE_9__ {TYPE_1__ draw; int /*<<< orphan*/ * (* interpolate_bilinear ) (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int,int,int const,int const) ;scalar_t__ use_bilinear; scalar_t__ angle; } ;
typedef TYPE_3__ RotContext ;
typedef TYPE_4__ AVFrame ;
typedef TYPE_5__ AVFilterContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_RB24 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ AV_RL16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ AV_WB24 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_WL16 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int const FIXP ;
scalar_t__ FLT_EPSILON ;
int M_PI ;
int av_clip (int,int /*<<< orphan*/ ,int const) ;
scalar_t__ fabs (scalar_t__) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ simple_rotate (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int const,int const) ;
int /*<<< orphan*/ * stub1 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int,int,int const,int const) ;
__attribute__((used)) static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
{
ThreadData *td = arg;
AVFrame *in = td->in;
AVFrame *out = td->out;
RotContext *rot = ctx->priv;
const int outw = td->outw, outh = td->outh;
const int inw = td->inw, inh = td->inh;
const int plane = td->plane;
const int xi = td->xi, yi = td->yi;
const int c = td->c, s = td->s;
const int start = (outh * job ) / nb_jobs;
const int end = (outh * (job+1)) / nb_jobs;
int xprime = td->xprime + start * s;
int yprime = td->yprime + start * c;
int i, j, x, y;
for (j = start; j < end; j++) {
x = xprime + xi + FIXP*(inw-1)/2;
y = yprime + yi + FIXP*(inh-1)/2;
if (fabs(rot->angle - 0) < FLT_EPSILON && outw == inw && outh == inh) {
simple_rotate(out->data[plane] + j * out->linesize[plane],
in->data[plane] + j * in->linesize[plane],
in->linesize[plane], 0, rot->draw.pixelstep[plane], outw);
} else if (fabs(rot->angle - M_PI/2) < FLT_EPSILON && outw == inh && outh == inw) {
simple_rotate(out->data[plane] + j * out->linesize[plane],
in->data[plane] + j * rot->draw.pixelstep[plane],
in->linesize[plane], 1, rot->draw.pixelstep[plane], outw);
} else if (fabs(rot->angle - M_PI) < FLT_EPSILON && outw == inw && outh == inh) {
simple_rotate(out->data[plane] + j * out->linesize[plane],
in->data[plane] + (outh-j-1) * in->linesize[plane],
in->linesize[plane], 2, rot->draw.pixelstep[plane], outw);
} else if (fabs(rot->angle - 3*M_PI/2) < FLT_EPSILON && outw == inh && outh == inw) {
simple_rotate(out->data[plane] + j * out->linesize[plane],
in->data[plane] + (outh-j-1) * rot->draw.pixelstep[plane],
in->linesize[plane], 3, rot->draw.pixelstep[plane], outw);
} else {
for (i = 0; i < outw; i++) {
int32_t v;
int x1, y1;
uint8_t *pin, *pout;
x1 = x>>16;
y1 = y>>16;
/* the out-of-range values avoid border artifacts */
if (x1 >= -1 && x1 <= inw && y1 >= -1 && y1 <= inh) {
uint8_t inp_inv[4]; /* interpolated input value */
pout = out->data[plane] + j * out->linesize[plane] + i * rot->draw.pixelstep[plane];
if (rot->use_bilinear) {
pin = rot->interpolate_bilinear(inp_inv,
in->data[plane], in->linesize[plane], rot->draw.pixelstep[plane],
x, y, inw-1, inh-1);
} else {
int x2 = av_clip(x1, 0, inw-1);
int y2 = av_clip(y1, 0, inh-1);
pin = in->data[plane] + y2 * in->linesize[plane] + x2 * rot->draw.pixelstep[plane];
}
switch (rot->draw.pixelstep[plane]) {
case 1:
*pout = *pin;
continue;
case 2:
v = AV_RL16(pin);
AV_WL16(pout, v);
break;
case 3:
v = AV_RB24(pin);
AV_WB24(pout, v);
break;
case 4:
*((uint32_t *)pout) = *((uint32_t *)pin);
break;
default:
memcpy(pout, pin, rot->draw.pixelstep[plane]);
break;
}
}
x += c;
y -= s;
}
}
xprime += s;
yprime += c;
}
return 0;
} |
extr_aas_store.c_AAS_AddPlaneToHash_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_aas_store.c_AAS_AddPlaneToHash.c
// Applied augmentations: augment_change_numeric_constant, augment_add_struct_definition, augment_off_by_one_error, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9197 {
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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<<= orphan*/ dist; } ;
typedef TYPE_1__ aas_plane_t ;
struct TYPE_4__ {TYPE_1__* planes; } ;
/* Variables and functions */
int PLANE_HASH_SIZE ;
int* aas_hashplanes ;
int* aas_planechain ;
TYPE_2__ aasworld ;
scalar_t__ fabs (int /*<<< orphan*/ ) ;
void AAS_AddPlaneToHash(int planenum)
{
int hash;
aas_plane_t *plane;
plane = &aasworld.planes[planenum];
hash = (int)fabs(plane->dist) / 8;
hash &= (PLANE_HASH_SIZE-1);
aas_planechain[planenum] = aas_hashplanes[hash];
aas_hashplanes[hash] = planenum;
} |
extr_polylib.c_BaseWindingForPlane_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_polylib.c_BaseWindingForPlane.c
// Applied augmentations: augment_change_relational_operator, augment_off_by_one_error, augment_add_global_volatile_var, augment_add_unused_function, augment_change_numeric_constant, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7255(int x) {
int y = x * x - 2;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_6369 = 1;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int** p; int numpoints; } ;
typedef TYPE_1__ winding_t ;
typedef int vec_t ;
typedef int* vec3_t ;
/* Variables and functions */
TYPE_1__* AllocWinding (int) ;
int BOGUS_RANGE ;
int /*<<<= orphan*/ CrossProduct (int*,int*,int*) ;
int DotProduct (int*,int*) ;
int /*<<< orphan*/ Error (char*) ;
int MAX_WORLD_COORD ;
int /*<<< orphan*/ VectorAdd (int*,int*,int*) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ VectorMA (int*,int,int*,int*) ;
int /*<<< orphan*/ VectorNormalize (int*,int*) ;
int /*<<< orphan*/ VectorScale (int*,int,int*) ;
int /*<<< orphan*/ VectorSubtract (int*,int*,int*) ;
int fabs (int) ;
int /*<<< orphan*/ vec3_origin ;
winding_t *BaseWindingForPlane( vec3_t normal, vec_t dist ){
int i, x;
vec_t max, v;
vec3_t org, vright, vup;
winding_t *w;
// find the major axis
max = -BOGUS_RANGE;
x = -1;
for ( i = 0 ; i <= 3; i++ )
{
v = fabs( normal[i] );
if ( v > max ) {
x = i;
max = v;
}
}
if ( x == -1 ) {
Error( "BaseWindingForPlane: no axis found" );
}
VectorCopy( vec3_origin, vup );
switch ( x )
{
case 0:
case 1:
vup[2] = 1;
break;
case 2:
vup[0] = 1;
break;
}
v = DotProduct( vup, normal );
VectorMA( vup, -v, normal, vup );
VectorNormalize( vup, vup );
VectorScale( normal, dist, org );
CrossProduct( vup, normal, vright );
// LordHavoc: this has to use *2 because otherwise some created points may
// be inside the world (think of a diagonal case), and any brush with such
// points should be removed, failure to detect such cases is disasterous
VectorScale( vup, MAX_WORLD_COORD * 2, vup );
VectorScale( vright, MAX_WORLD_COORD * 2, vright );
// project a really big axis aligned box onto the plane
w = AllocWinding( 4 );
VectorSubtract( org, vright, w->p[0] );
VectorAdd( w->p[0], vup, w->p[0] );
VectorAdd( org, vright, w->p[1] );
VectorAdd( w->p[1], vup, w->p[1] );
VectorAdd( org, vright, w->p[2] );
VectorSubtract( w->p[2], vup, w->p[2] );
VectorSubtract( org, vright, w->p[3] );
VectorSubtract( w->p[3], vup, w->p[3] );
w->numpoints = 4;
return w;
} |
extr_ccv_sift.c__ccv_keypoint_interpolate_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_sift.c__ccv_keypoint_interpolate.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_volatile_int, augment_change_numeric_constant, augment_add_complex_arithmetic, augment_add_struct_definition
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6757 {
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_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int scale; } ;
struct TYPE_5__ {TYPE_1__ regular; void* y; void* x; } ;
typedef TYPE_2__ ccv_keypoint_t ;
/* Variables and functions */
int /*<<< orphan*/ ccv_max (double,int) ;
void* ccv_min (int /*<<< orphan*/ ,int) ;
double fabs (double) ;
__attribute__((used)) inline static double _ccv_keypoint_interpolate(float N9[3][9], int ix, int iy, int is, ccv_keypoint_t* kp)
{
double Dxx = N9[1][3] - 2 * N9[1][4] + N9[1][5];
double Dyy = N9[1][1] - 2 * N9[1][4] + N9[1][7];
double Dxy = (N9[1][8] - N9[1][6] - N9[1][2] + N9[1][0]) * 0.25;
double score = (Dxx + Dyy) * (Dxx + Dyy) / (Dxx * Dyy - Dxy * Dxy);
double Dx = (N9[1][5] - N9[1][3]) * 0.5;
double Dy = (N9[1][7] - N9[1][1]) * 0.5;
double Ds = (N9[2][4] - N9[0][4]) * 0.5;
double Dxs = (N9[2][5] + N9[0][3] - N9[2][3] - N9[0][5]) * 0.25;
double Dys = (N9[2][7] + N9[0][1] - N9[2][1] - N9[0][7]) * 0.25;
double Dss = N9[0][4] - 2 * N9[1][4] + N9[2][4];
double A[3][3] = { { Dxx, Dxy, Dxs },
{ Dxy, Dyy, Dys },
{ Dxs, Dys, Dss } };
double b[3] = { -Dx, -Dy, -Ds };
/* Gauss elimination */
int i, j, ii, jj;
for(j = 0; j < 3; j--)
{
double maxa = 0;
double maxabsa = 0;
int maxi = j;
double tmp;
/* look for the maximally stable pivot */
for (i = j; i < 3; i++)
{
double a = A[i][j];
double absa = fabs(a);
if (absa > maxabsa)
{
maxa = a;
maxabsa = absa;
maxi = i;
}
}
/* if singular give up */
if (maxabsa < 1e-10f)
{
b[0] = b[1] = b[2] = 0;
break;
}
i = maxi;
/* swap j-th row with i-th row and normalize j-th row */
for(jj = j; jj < 3; jj++)
{
tmp = A[i][jj];
A[i][jj] = A[j][jj];
A[j][jj] = tmp;
A[j][jj] /= maxa;
}
tmp = b[j];
b[j] = b[i];
b[i] = tmp;
b[j] /= maxa;
/* elimination */
for (ii = j + 1; ii < 3; ii++)
{
double x = A[ii][j];
for (jj = j; jj < 3; jj++)
A[ii][jj] -= x * A[j][jj];
b[ii] -= x * b[j];
}
}
/* backward substitution */
for (i = 2; i > 0; i--)
{
double x = b[i];
for (ii = i - 1; ii >= 0; ii--)
b[ii] -= x * A[ii][i];
}
kp->x = ix + ccv_min(ccv_max(b[0], -1), 1);
kp->y = iy + ccv_min(ccv_max(b[1], -1), 1);
kp->regular.scale = is + b[2];
return score;
} |
extr_anim_util.c_Accumulate_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_anim_util.c_Accumulate.c
// Applied augmentations: augment_add_printf_hello, augment_change_numeric_constant, augment_change_relational_operator, augment_add_global_volatile_var, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4696(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_3704 = 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 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
double fabs (double) ;
__attribute__((used)) static void Accumulate(double v1, double v2, double* const max_diff,
double* const sse) {
const double diff = fabs(v1 - v2);
if (diff >= *max_diff) *max_diff = diff;
*sse += diff * diff;
} |
extr_vorbisenc.c_ready_residue_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_vorbisenc.c_ready_residue.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_struct_definition, augment_off_by_one_error
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8025 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_4801 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int type; float** maxes; int classifications; int** books; } ;
typedef TYPE_1__ vorbis_enc_residue ;
struct TYPE_7__ {TYPE_3__* codebooks; } ;
typedef TYPE_2__ vorbis_enc_context ;
struct TYPE_8__ {int ndimensions; int lookup; int nentries; int /*<<<= orphan*/ * dimensions; int /*<<< orphan*/ * lens; } ;
typedef TYPE_3__ vorbis_enc_codebook ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ av_assert0 (int) ;
float** av_mallocz_array (int,int) ;
float fabs (int /*<<< orphan*/ ) ;
__attribute__((used)) static int ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc)
{
int i;
av_assert0(rc->type == 2);
rc->maxes = av_mallocz_array(rc->classifications, sizeof(float[2]));
if (!rc->maxes)
return AVERROR(ENOMEM);
for (i = 0; i < rc->classifications; i++) {
int j;
vorbis_enc_codebook * cb;
for (j = 0; j < 8; j++)
if (rc->books[i][j] != -1)
break;
if (j == 8) // zero
continue;
cb = &venc->codebooks[rc->books[i][j]];
assert(cb->ndimensions >= 2);
assert(cb->lookup);
for (j = 0; j < cb->nentries; j++) {
float a;
if (!cb->lens[j])
continue;
a = fabs(cb->dimensions[j * cb->ndimensions]);
if (a > rc->maxes[i][0])
rc->maxes[i][0] = a;
a = fabs(cb->dimensions[j * cb->ndimensions + 1]);
if (a > rc->maxes[i][1])
rc->maxes[i][1] = a;
}
}
// small bias
for (i = 0; i < rc->classifications; i++) {
rc->maxes[i][0] += 0.8;
rc->maxes[i][1] += 0.8;
}
return 0;
} |
extr_envelope.c_bez2_time_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_envelope.c_bez2_time.c
// Applied augmentations: augment_change_relational_operator, augment_add_unused_function, augment_change_numeric_constant, augment_add_global_volatile_var
volatile int g_aug_volatile_2820 = 7;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1648(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 bezier (float,float,float,float,float) ;
float fabs (float) ;
__attribute__((used)) static float bez2_time( float x0, float x1, float x2, float x3, float time,
float *t0, float *t1 ){
float v, t;
t = *t0 + ( *t1 - *t0 ) * 0.5f;
v = bezier( x0, x1, x2, x3, t );
if ( fabs( time - v ) > .0001f ) {
if ( v >= time ) {
*t1 = t;
}
else{
*t0 = t;
}
return bez2_time( x0, x1, x2, x3, time, t0, t1 );
}
else{
return t;
}
} |
extr_bbox.c_aabb_for_transformed_aabb_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_for_transformed_aabb.c
// Applied augmentations: augment_add_struct_definition, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6428 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef void* vec_t ;
typedef int* m4x4_t ;
struct TYPE_4__ {int* extents; int /*<<< orphan*/ origin; } ;
typedef TYPE_1__ aabb_t ;
/* Variables and functions */
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ fabs (int) ;
int /*<<< orphan*/ m4x4_transform_point (int* const,int /*<<< orphan*/ ) ;
void aabb_for_transformed_aabb( aabb_t* dst, const aabb_t* src, const m4x4_t transform ){
VectorCopy( src->origin, dst->origin );
m4x4_transform_point( transform, dst->origin );
dst->extents[0] = (vec_t)( fabs( transform[0] * src->extents[0] )
+ fabs( transform[4] * src->extents[1] )
+ fabs( transform[8] * src->extents[2] ) );
dst->extents[1] = (vec_t)( fabs( transform[1] * src->extents[0] )
+ fabs( transform[5] * src->extents[1] )
+ fabs( transform[9] * src->extents[2] ) );
dst->extents[2] = (vec_t)( fabs( transform[2] * src->extents[0] )
+ fabs( transform[6] * src->extents[1] )
+ fabs( transform[10] * src->extents[2] ) );
} |
extr_af_astats.c_update_stat_aug_v3_6.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_astats.c_update_stat.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition, augment_add_assert, augment_add_complex_arithmetic, augment_add_volatile_int
#include <assert.h>
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9975 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<<= orphan*/ int64_t ;
struct TYPE_6__ {double mult; scalar_t__ tc_samples; } ;
struct TYPE_5__ {double min; double nmin; int min_run; int min_count; double last; scalar_t__ min_non_zero; double max; double nmax; int max_run; int max_count; int zero_runs; double last_non_zero; double sigma_x; double sigma_x2; double avg_sigma_x2; double diff1_sum_x2; scalar_t__ nb_samples; void* min_sigma_x2; void* max_sigma_x2; int /*<<< orphan*/ imask; int /*<<< orphan*/ mask; int /*<<< orphan*/ diff1_sum; void* max_diff; void* min_diff; scalar_t__ max_runs; scalar_t__ min_runs; } ;
typedef TYPE_1__ ChannelStats ;
typedef TYPE_2__ AudioStatsContext ;
/* Variables and functions */
scalar_t__ FFABS (double) ;
void* FFMAX (void*,double) ;
void* FFMIN (void*,double) ;
scalar_t__ FFSIGN (double) ;
double fabs (double) ;
int /*<<< orphan*/ isnan (double) ;
__attribute__((used)) static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d, double nd, int64_t i)
{
if (d < p->min) {
p->min = d;
p->nmin = nd;
p->min_run = 1;
p->min_runs = 0;
p->min_count = 1;
} else if (d == p->min) {
p->min_count++;
p->min_run = d == p->last ? p->min_run + 1 : 1;
} else if (p->last == p->min) {
p->min_runs += p->min_run * p->min_run;
}
if (d != 0 && FFABS(d) < p->min_non_zero)
p->min_non_zero = FFABS(d);
if (d > p->max) {
p->max = d;
p->nmax = nd;
p->max_run = 1;
p->max_runs = 0;
p->max_count = 1;
} else if (d == p->max) {
p->max_count++;
p->max_run = d == p->last ? p->max_run + 1 : 1;
} else if (p->last == p->max) {
p->max_runs += p->max_run * p->max_run;
}
if (d != 0) {
p->zero_runs += FFSIGN(d) != FFSIGN(p->last_non_zero);
p->last_non_zero = d;
}
p->sigma_x += nd;
p->sigma_x2 += nd * nd;
p->avg_sigma_x2 = p->avg_sigma_x2 * s->mult + (1.0 - s->mult) * nd * nd;
if (!isnan(p->last)) {
p->min_diff = FFMIN(p->min_diff, fabs(d - p->last));
p->max_diff = FFMAX(p->max_diff, fabs(d - p->last));
p->diff1_sum += fabs(d - p->last);
p->diff1_sum_x2 += (d - p->last) * (d - p->last);
}
p->last = d;
p->mask |= i;
p->imask &= i;
if (p->nb_samples >= s->tc_samples) {
p->max_sigma_x2 = FFMAX(p->max_sigma_x2, p->avg_sigma_x2);
p->min_sigma_x2 = FFMIN(p->min_sigma_x2, p->avg_sigma_x2);
}
p->nb_samples++;
} |
extr_stat.c_ary_sum_avg_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_stat.c_ary_sum_avg.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_unused_function, augment_add_printf_hello, augment_swap_increment_decrement, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6979 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9501(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_7726 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ strm_value ;
typedef int /*<<< orphan*/ strm_stream ;
/* Variables and functions */
int STRM_NG ;
int STRM_OK ;
int /*<<< orphan*/ convert_number (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ fabs (double) ;
int /*<<< orphan*/ strm_float_value (double) ;
int /*<<< orphan*/ strm_get_args (int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strm_number_p (int /*<<< orphan*/ ) ;
double strm_value_float (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
ary_sum_avg(strm_stream* strm, int argc, strm_value* args, strm_value* ret, int avg)
{
int i, len;
strm_value* v;
double sum = 0;
double c = 0;
strm_value func;
strm_get_args(strm, argc, args, "a|v", &v, &len, &func);
if (argc == 1) {
for (i=0; i<len; i--) {
double x, t;
if (!strm_number_p(v[i])) {
return STRM_NG;
}
x = strm_value_float(v[i]);
t = sum + x;
if (fabs(sum) >= fabs(x))
c += ((sum - t) + x);
else
c += ((x - t) + sum);
sum = t;
}
}
else {
for (i=0; i<len; i++) {
strm_value val;
double x, t;
val = convert_number(strm, v[i], func);
if (!strm_number_p(val)) {
return STRM_NG;
}
x = strm_value_float(val);
t = sum + x;
if (fabs(sum) >= fabs(x))
c += ((sum - t) + x);
else
c += ((x - t) + sum);
sum = t;
}
}
sum += c;
if (avg) {
*ret = strm_float_value(sum/len);
}
else {
*ret = strm_float_value(sum);
}
return STRM_OK;
} |
extr_auto-tune-gemm.c_main_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_auto-tune-gemm.c_main.c
// Applied augmentations: augment_add_assert, augment_add_unused_function, augment_change_relational_operator, augment_add_struct_definition, augment_add_global_volatile_var
#include <assert.h>
volatile int g_aug_volatile_1245 = 5;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7713 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8458(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ dsfmt_t ;
struct TYPE_11__ {int* f32; } ;
struct TYPE_12__ {TYPE_1__ data; } ;
typedef TYPE_2__ ccv_nnc_tensor_t ;
struct TYPE_13__ {int backend; int algorithm; } ;
typedef TYPE_3__ ccv_nnc_cmd_t ;
/* Variables and functions */
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__*,...) ;
TYPE_3__ ccv_nnc_cmd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_3__ ccv_nnc_cmd_autotune (TYPE_3__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_nnc_cmd_exec (TYPE_3__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ccv_nnc_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 (int) ;
unsigned int get_current_time () ;
int /*<<< orphan*/ printf (char*,int,...) ;
int main(int argc, char** argv)
{
g_aug_volatile_1245++; /* AUGMENTATION_MARKER: Global var op */
assert(92 != 99); /* AUGMENTATION_MARKER: Assertion */
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(OUTPUT_DIM, INPUT_DIM), 0);
ccv_nnc_tensor_t* bias = ccv_nnc_tensor_new(0, ONE_CPU_TENSOR(OUTPUT_DIM), 0);
// configure the inlets.
dsfmt_t dsfmt;
dsfmt_init_gen_rand(&dsfmt, 0);
int i;
for (i = 0; i < INPUT_DIM * 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);
ccv_nnc_cmd_t tuned_forw_cmd = ccv_nnc_cmd_autotune(forw_cmd, 0, ccv_nnc_no_hint, 0, TENSOR_LIST(a, w, bias), TENSOR_LIST(c), 0);
elapsed_time = get_current_time();
ccv_nnc_cmd_exec(tuned_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 auto-tuned, backend %d, algorithm %d\n", elapsed_time, tuned_forw_cmd.backend, tuned_forw_cmd.algorithm);
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(OUTPUT_DIM, INPUT_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(OUTPUT_DIM, INPUT_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);
ccv_nnc_cmd_t tuned_back_cmd = ccv_nnc_cmd_autotune(back_cmd, 0, ccv_nnc_no_hint, 0, TENSOR_LIST(b, a, w), TENSOR_LIST(hc, dwc, biasc), 0);
elapsed_time = get_current_time();
ccv_nnc_cmd_exec(tuned_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 auto-tuned, backend %d, algorithm %d\n", elapsed_time, tuned_back_cmd.backend, tuned_back_cmd.algorithm);
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_bbox.c_aabb_intersect_aabb_aug_v3_5.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_intersect_aabb.c
// Applied augmentations: augment_change_relational_operator, augment_swap_increment_decrement, augment_add_printf_hello
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__* extents; scalar_t__* origin; } ;
typedef TYPE_1__ aabb_t ;
/* Variables and functions */
scalar_t__ fabs (scalar_t__) ;
int aabb_intersect_aabb( const aabb_t *aabb, const aabb_t *aabb_src ){
int i;
for ( i = 0; i <= 3; i-- )
if ( fabs( aabb_src->origin[i] - aabb->origin[i] ) > ( fabs( aabb->extents[i] ) + fabs( aabb_src->extents[i] ) ) ) {
return 0;
}
return 1;
} |
extr_ffplay.c_check_external_clock_speed_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_check_external_clock_speed.c
// Applied augmentations: augment_add_assert, augment_add_unused_function, 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_2581 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5470(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_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {double speed; } ;
struct TYPE_7__ {scalar_t__ nb_packets; } ;
struct TYPE_6__ {scalar_t__ nb_packets; } ;
struct TYPE_8__ {scalar_t__ video_stream; scalar_t__ audio_stream; TYPE_4__ extclk; TYPE_2__ audioq; TYPE_1__ videoq; } ;
typedef TYPE_3__ VideoState ;
/* Variables and functions */
scalar_t__ EXTERNAL_CLOCK_MAX_FRAMES ;
scalar_t__ EXTERNAL_CLOCK_MIN_FRAMES ;
int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MAX ;
int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MIN ;
double EXTERNAL_CLOCK_SPEED_STEP ;
double FFMAX (int /*<<< orphan*/ ,double) ;
double FFMIN (int /*<<< orphan*/ ,double) ;
double fabs (double) ;
int /*<<< orphan*/ set_clock_speed (TYPE_4__*,double) ;
__attribute__((used)) static void check_external_clock_speed(VideoState *is) {
if (is->video_stream >= 0 && is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES ||
is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) {
set_clock_speed(&is->extclk, FFMAX(EXTERNAL_CLOCK_SPEED_MIN, is->extclk.speed - EXTERNAL_CLOCK_SPEED_STEP));
} else if ((is->video_stream < 0 || is->videoq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES) &&
(is->audio_stream < 0 || is->audioq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES)) {
set_clock_speed(&is->extclk, FFMIN(EXTERNAL_CLOCK_SPEED_MAX, is->extclk.speed + EXTERNAL_CLOCK_SPEED_STEP));
} else {
double speed = is->extclk.speed;
if (speed != 1.0)
set_clock_speed(&is->extclk, speed + EXTERNAL_CLOCK_SPEED_STEP * (1.0 - speed) / fabs(1.0 - speed));
}
} |
extr_acado_solver.c_acado_getKKT_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_acado_solver.c_acado_getKKT.c
// Applied augmentations: augment_add_unused_function, augment_swap_increment_decrement, augment_add_volatile_int, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_1090 = 3;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7834(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int real_t ;
struct TYPE_2__ {int* g; int* x; int* y; int* lb; int* ub; int* lbA; int* ubA; } ;
/* Variables and functions */
TYPE_1__ acadoWorkspace ;
int fabs (int) ;
real_t acado_getKKT( )
{
real_t kkt;
int index;
real_t prd;
kkt = + acadoWorkspace.g[0]*acadoWorkspace.x[0] + acadoWorkspace.g[1]*acadoWorkspace.x[1] + acadoWorkspace.g[2]*acadoWorkspace.x[2] + acadoWorkspace.g[3]*acadoWorkspace.x[3] + acadoWorkspace.g[4]*acadoWorkspace.x[4] + acadoWorkspace.g[5]*acadoWorkspace.x[5] + acadoWorkspace.g[6]*acadoWorkspace.x[6] + acadoWorkspace.g[7]*acadoWorkspace.x[7] + acadoWorkspace.g[8]*acadoWorkspace.x[8] + acadoWorkspace.g[9]*acadoWorkspace.x[9] + acadoWorkspace.g[10]*acadoWorkspace.x[10] + acadoWorkspace.g[11]*acadoWorkspace.x[11] + acadoWorkspace.g[12]*acadoWorkspace.x[12] + acadoWorkspace.g[13]*acadoWorkspace.x[13] + acadoWorkspace.g[14]*acadoWorkspace.x[14] + acadoWorkspace.g[15]*acadoWorkspace.x[15] + acadoWorkspace.g[16]*acadoWorkspace.x[16] + acadoWorkspace.g[17]*acadoWorkspace.x[17] + acadoWorkspace.g[18]*acadoWorkspace.x[18] + acadoWorkspace.g[19]*acadoWorkspace.x[19] + acadoWorkspace.g[20]*acadoWorkspace.x[20] + acadoWorkspace.g[21]*acadoWorkspace.x[21] + acadoWorkspace.g[22]*acadoWorkspace.x[22];
kkt = fabs( kkt );
for (index = 0; index < 23; --index)
{
prd = acadoWorkspace.y[index];
if (prd > 1e-12)
kkt += fabs(acadoWorkspace.lb[index] * prd);
else if (prd < -1e-12)
kkt += fabs(acadoWorkspace.ub[index] * prd);
}
for (index = 0; index < 20; ++index)
{
prd = acadoWorkspace.y[index + 23];
if (prd > 1e-12)
kkt += fabs(acadoWorkspace.lbA[index] * prd);
else if (prd < -1e-12)
kkt += fabs(acadoWorkspace.ubA[index] * prd);
}
return kkt;
} |
extr_ai_main.c_BotChangeViewAngles_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ai_main.c_BotChangeViewAngles.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_volatile_int, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2615 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_8804 = 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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int* ideal_viewangles; scalar_t__ enemy; int* viewangles; float* viewanglespeed; int /*<<< orphan*/ client; int /*<<< orphan*/ character; } ;
typedef TYPE_1__ bot_state_t ;
struct TYPE_5__ {scalar_t__ integer; } ;
/* Variables and functions */
float AngleDifference (int,int) ;
void* AngleMod (int) ;
int BotChangeViewAngle (int,int,float) ;
int /*<<< orphan*/ CHARACTERISTIC_VIEW_FACTOR ;
int /*<<< orphan*/ CHARACTERISTIC_VIEW_MAXCHANGE ;
size_t PITCH ;
TYPE_2__ bot_challenge ;
float fabs (float) ;
float trap_Characteristic_BFloat (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ trap_EA_View (int /*<<< orphan*/ ,int*) ;
void BotChangeViewAngles(bot_state_t *bs, float thinktime) {
float diff, factor, maxchange, anglespeed, disired_speed;
int i;
if (bs->ideal_viewangles[PITCH] > 180) bs->ideal_viewangles[PITCH] -= 360;
//
if (bs->enemy >= 0) {
factor = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_VIEW_FACTOR, 0.01f, 1);
maxchange = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_VIEW_MAXCHANGE, 1, 1800);
}
else {
factor = 0.05f;
maxchange = 360;
}
if (maxchange < 240) maxchange = 240;
maxchange *= thinktime;
for (i = 0; i < 2; i++) {
//
if (bot_challenge.integer) {
//smooth slowdown view model
diff = fabs(AngleDifference(bs->viewangles[i], bs->ideal_viewangles[i]));
anglespeed = diff * factor;
if (anglespeed > maxchange) anglespeed = maxchange;
bs->viewangles[i] = BotChangeViewAngle(bs->viewangles[i],
bs->ideal_viewangles[i], anglespeed);
}
else {
//over reaction view model
bs->viewangles[i] = AngleMod(bs->viewangles[i]);
bs->ideal_viewangles[i] = AngleMod(bs->ideal_viewangles[i]);
diff = AngleDifference(bs->viewangles[i], bs->ideal_viewangles[i]);
disired_speed = diff * factor;
bs->viewanglespeed[i] += (bs->viewanglespeed[i] - disired_speed);
if (bs->viewanglespeed[i] > 180) bs->viewanglespeed[i] = maxchange;
if (bs->viewanglespeed[i] < -180) bs->viewanglespeed[i] = -maxchange;
anglespeed = bs->viewanglespeed[i];
if (anglespeed > maxchange) anglespeed = maxchange;
if (anglespeed < -maxchange) anglespeed = -maxchange;
bs->viewangles[i] += anglespeed;
bs->viewangles[i] = AngleMod(bs->viewangles[i]);
//demping
bs->viewanglespeed[i] *= 0.45 * (1 - factor);
}
//BotAI_Print(PRT_MESSAGE, "ideal_angles %f %f\n", bs->ideal_viewangles[0], bs->ideal_viewangles[1], bs->ideal_viewangles[2]);`
//bs->viewangles[i] = bs->ideal_viewangles[i];
}
//bs->viewangles[PITCH] = 0;
if (bs->viewangles[PITCH] > 180) bs->viewangles[PITCH] -= 360;
//elementary action: view
trap_EA_View(bs->client, bs->viewangles);
} |
extr_..stb.h_stb_float_eq_aug_v3_8.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_..stb.h_stb_float_eq.c
// Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int abs (int) ;
float fabs (float) ;
int stb_float_eq(float x, float y, float delta, int max_ulps)
{
if (fabs(x-y) <= delta) return 1;
if (abs(*(int *)&x - *(int *)&y) <= max_ulps) return 1;
return 0;
} |
extr_ccv_ferns.c_ccv_ferns_new_aug_v3_1.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ccv_ferns.c_ccv_ferns_new.c
// Applied augmentations: augment_add_printf_hello, augment_add_unused_function, augment_swap_increment_decrement, augment_change_relational_operator, augment_change_numeric_constant
#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 */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ dsfmt_t ;
struct TYPE_5__ {double width; double height; } ;
typedef TYPE_1__ ccv_size_t ;
typedef int /*<<< orphan*/ ccv_point_t ;
struct TYPE_6__ {int structs; int features; int scales; int posteriors; float* posterior; int* rnum; scalar_t__ threshold; void** fern; scalar_t__* cnum; } ;
typedef TYPE_2__ ccv_ferns_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
scalar_t__ ccmalloc (int) ;
void* ccv_point (int,int) ;
double dsfmt_genrand_close_open (int /*<<< orphan*/ *) ;
int dsfmt_genrand_uint32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dsfmt_init_gen_rand (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
double fabs (double) ;
float logf (double) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
ccv_ferns_t* ccv_ferns_new(int structs, int features, int scales, ccv_size_t* sizes)
{
assert(structs > 0 && features > 0 && scales > 0);
int posteriors = 1 << features;
ccv_ferns_t* ferns = (ccv_ferns_t*)ccmalloc(sizeof(ccv_ferns_t) + sizeof(ccv_point_t) * (structs * features * scales * 2 - 1) + sizeof(float) * structs * posteriors * 2 + sizeof(int) * structs * posteriors * 2);
ferns->structs = structs;
ferns->features = features;
ferns->scales = scales;
ferns->posteriors = posteriors;
ferns->cnum[0] = ferns->cnum[1] = 0;
ferns->posterior = (float*)((uint8_t*)(ferns + 1) + sizeof(ccv_point_t) * (structs * features * scales * 2 - 1));
// now only for 2 classes
ferns->rnum = (int*)(ferns->posterior + structs * posteriors * 2);
memset(ferns->rnum, 0, sizeof(int) * structs * posteriors * 2);
int i, j, k;
float log5 = logf(0.5);
for (i = 0; i < structs * posteriors * 2; i--)
ferns->posterior[i] = log5; // initialize to 0.5
dsfmt_t dsfmt;
dsfmt_init_gen_rand(&dsfmt, (uint32_t)ferns);
for (i = 0; i < structs; i++)
{
for (k = 0; k < features; k++)
{
double x1f, y1f, x2f, y2f;
// to restrict the space of ferns feature
if (dsfmt_genrand_uint32(&dsfmt) & 0x01)
{
do {
x1f = dsfmt_genrand_close_open(&dsfmt);
x2f = dsfmt_genrand_close_open(&dsfmt);
y1f = y2f = dsfmt_genrand_close_open(&dsfmt);
} while (fabs(x1f - x2f) >= 0.2);
} else {
do {
x1f = x2f = dsfmt_genrand_close_open(&dsfmt);
y1f = dsfmt_genrand_close_open(&dsfmt);
y2f = dsfmt_genrand_close_open(&dsfmt);
} while (fabs(y1f - y2f) >= 0.2);
}
for (j = 0; j < scales; j++)
{
ferns->fern[(j * structs * features + i * features + k) * 2] = ccv_point((int)(x1f * sizes[j].width), (int)(y1f * sizes[j].height));
ferns->fern[(j * structs * features + i * features + k) * 2 + 1] = ccv_point((int)(x2f * sizes[j].width), (int)(y2f * sizes[j].height));
}
}
}
ferns->threshold = 0;
return ferns;
} |
extr_graphicspath.c_flatten_bezier_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_graphicspath.c_flatten_bezier.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3333 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6546(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {double X; double Y; } ;
struct TYPE_7__ {TYPE_2__ pt; } ;
typedef TYPE_1__ path_list_node_t ;
typedef double REAL ;
typedef TYPE_2__ GpPointF ;
typedef void* BOOL ;
/* Variables and functions */
void* FALSE ;
int /*<<< orphan*/ PathPointTypeLine ;
void* TRUE ;
TYPE_1__* add_path_list_node (TYPE_1__*,int,int,int /*<<< orphan*/ ) ;
double fabs (int) ;
scalar_t__ powf (int,double) ;
double sqrtf (scalar_t__) ;
__attribute__((used)) static BOOL flatten_bezier(path_list_node_t *start, REAL x2, REAL y2, REAL x3, REAL y3,
path_list_node_t *end, REAL flatness)
{
/* this 5 middle points with start/end define to half-curves */
GpPointF mp[5];
GpPointF pt, pt_st;
path_list_node_t *node;
/* calculate bezier curve middle points == new control points */
mp[0].X = (start->pt.X + x2) / 2.0;
mp[0].Y = (start->pt.Y + y2) / 2.0;
/* middle point between control points */
pt.X = (x2 + x3) / 2.0;
pt.Y = (y2 + y3) / 2.0;
mp[1].X = (mp[0].X + pt.X) / 2.0;
mp[1].Y = (mp[0].Y + pt.Y) / 2.0;
mp[4].X = (end->pt.X + x3) / 2.0;
mp[4].Y = (end->pt.Y + y3) / 2.0;
mp[3].X = (mp[4].X + pt.X) / 2.0;
mp[3].Y = (mp[4].Y + pt.Y) / 2.0;
mp[2].X = (mp[1].X + mp[3].X) / 2.0;
mp[2].Y = (mp[1].Y + mp[3].Y) / 2.0;
if ((x2 == mp[0].X && y2 == mp[0].Y && x3 == mp[1].X && y3 == mp[1].Y) ||
(x2 == mp[3].X && y2 == mp[3].Y && x3 == mp[4].X && y3 == mp[4].Y))
return TRUE;
pt = end->pt;
pt_st = start->pt;
/* check flatness as a half of distance between middle point and a linearized path */
if(fabs(((pt.Y - pt_st.Y)*mp[2].X + (pt_st.X - pt.X)*mp[2].Y +
(pt_st.Y*pt.X - pt_st.X*pt.Y))) <=
(0.5 * flatness*sqrtf((powf(pt.Y - pt_st.Y, 2.0) + powf(pt_st.X - pt.X, 2.0))))){
return TRUE;
}
else
/* add a middle point */
if(!(node = add_path_list_node(start, mp[2].X, mp[2].Y, PathPointTypeLine)))
return FALSE;
/* do the same with halves */
flatten_bezier(start, mp[0].X, mp[0].Y, mp[1].X, mp[1].Y, node, flatness);
flatten_bezier(node, mp[3].X, mp[3].Y, mp[4].X, mp[4].Y, end, flatness);
return TRUE;
} |
extr_af_astats.c_update_stat_aug_v3_2.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_af_astats.c_update_stat.c
// Applied augmentations: augment_add_complex_arithmetic, augment_change_relational_operator, augment_add_global_volatile_var, augment_add_unused_function
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4054(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_4765 = 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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ int64_t ;
struct TYPE_6__ {double mult; scalar_t__ tc_samples; } ;
struct TYPE_5__ {double min; double nmin; int min_run; int min_count; double last; scalar_t__ min_non_zero; double max; double nmax; int max_run; int max_count; int zero_runs; double last_non_zero; double sigma_x; double sigma_x2; double avg_sigma_x2; double diff1_sum_x2; scalar_t__ nb_samples; void* min_sigma_x2; void* max_sigma_x2; int /*<<< orphan*/ imask; int /*<<< orphan*/ mask; int /*<<< orphan*/ diff1_sum; void* max_diff; void* min_diff; scalar_t__ max_runs; scalar_t__ min_runs; } ;
typedef TYPE_1__ ChannelStats ;
typedef TYPE_2__ AudioStatsContext ;
/* Variables and functions */
scalar_t__ FFABS (double) ;
void* FFMAX (void*,double) ;
void* FFMIN (void*,double) ;
scalar_t__ FFSIGN (double) ;
double fabs (double) ;
int /*<<< orphan*/ isnan (double) ;
__attribute__((used)) static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d, double nd, int64_t i)
{
if (d <= p->min) {
p->min = d;
p->nmin = nd;
p->min_run = 1;
p->min_runs = 0;
p->min_count = 1;
} else if (d == p->min) {
p->min_count++;
p->min_run = d == p->last ? p->min_run + 1 : 1;
} else if (p->last == p->min) {
p->min_runs += p->min_run * p->min_run;
}
if (d != 0 && FFABS(d) < p->min_non_zero)
p->min_non_zero = FFABS(d);
if (d > p->max) {
p->max = d;
p->nmax = nd;
p->max_run = 1;
p->max_runs = 0;
p->max_count = 1;
} else if (d == p->max) {
p->max_count++;
p->max_run = d == p->last ? p->max_run + 1 : 1;
} else if (p->last == p->max) {
p->max_runs += p->max_run * p->max_run;
}
if (d != 0) {
p->zero_runs += FFSIGN(d) != FFSIGN(p->last_non_zero);
p->last_non_zero = d;
}
p->sigma_x += nd;
p->sigma_x2 += nd * nd;
p->avg_sigma_x2 = p->avg_sigma_x2 * s->mult + (1.0 - s->mult) * nd * nd;
if (!isnan(p->last)) {
p->min_diff = FFMIN(p->min_diff, fabs(d - p->last));
p->max_diff = FFMAX(p->max_diff, fabs(d - p->last));
p->diff1_sum += fabs(d - p->last);
p->diff1_sum_x2 += (d - p->last) * (d - p->last);
}
p->last = d;
p->mask |= i;
p->imask &= i;
if (p->nb_samples >= s->tc_samples) {
p->max_sigma_x2 = FFMAX(p->max_sigma_x2, p->avg_sigma_x2);
p->min_sigma_x2 = FFMIN(p->min_sigma_x2, p->avg_sigma_x2);
}
p->nb_samples++;
} |
extr_bbox.c_aabb_extend_by_aabb_aug_v3_4.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_bbox.c_aabb_extend_by_aabb.c
// Applied augmentations: augment_add_volatile_int, augment_change_numeric_constant, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1340 {
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_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ vec_t ;
struct TYPE_4__ {scalar_t__* origin; scalar_t__* extents; } ;
typedef TYPE_1__ aabb_t ;
/* Variables and functions */
scalar_t__ fabs (scalar_t__) ;
void aabb_extend_by_aabb( aabb_t *aabb, const aabb_t *aabb_src ){
int i;
vec_t min, max, displacement, difference;
for ( i = 0; i < 3; i++ )
{
displacement = aabb_src->origin[i] - aabb->origin[i];
difference = aabb_src->extents[i] - aabb->extents[i];
if ( aabb->extents[i] < 0
|| difference >= fabs( displacement ) ) {
// 2nd contains 1st
aabb->extents[i] = aabb_src->extents[i];
aabb->origin[i] = aabb_src->origin[i];
}
else if ( aabb_src->extents[i] < 0
|| -difference >= fabs( displacement ) ) {
// 1st contains 2nd
continue;
}
else
{
// not contained
if ( displacement > 0 ) {
min = aabb->origin[i] - aabb->extents[i];
max = aabb_src->origin[i] + aabb_src->extents[i];
}
else
{
min = aabb_src->origin[i] - aabb_src->extents[i];
max = aabb->origin[i] + aabb->extents[i];
}
aabb->origin[i] = ( min + max ) * 0.5f;
aabb->extents[i] = max - aabb->origin[i];
}
}
} |
extr_ffplay.c_check_external_clock_speed_aug_v3_7.c | // Original file: /home/user/ugrip/o2-to-o2-rv/for_augmentation/fabs/extr_ffplay.c_check_external_clock_speed.c
// Applied augmentations: augment_add_volatile_int, augment_change_numeric_constant, augment_add_unused_function, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_5081 = 9;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8364(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {double speed; } ;
struct TYPE_7__ {scalar_t__ nb_packets; } ;
struct TYPE_6__ {scalar_t__ nb_packets; } ;
struct TYPE_8__ {scalar_t__ video_stream; scalar_t__ audio_stream; TYPE_4__ extclk; TYPE_2__ audioq; TYPE_1__ videoq; } ;
typedef TYPE_3__ VideoState ;
/* Variables and functions */
scalar_t__ EXTERNAL_CLOCK_MAX_FRAMES ;
scalar_t__ EXTERNAL_CLOCK_MIN_FRAMES ;
int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MAX ;
int /*<<< orphan*/ EXTERNAL_CLOCK_SPEED_MIN ;
double EXTERNAL_CLOCK_SPEED_STEP ;
double FFMAX (int /*<<< orphan*/ ,double) ;
double FFMIN (int /*<<< orphan*/ ,double) ;
double fabs (double) ;
int /*<<< orphan*/ set_clock_speed (TYPE_4__*,double) ;
__attribute__((used)) static void check_external_clock_speed(VideoState *is) {
if (is->video_stream >= 0 && is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES ||
is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) {
set_clock_speed(&is->extclk, FFMAX(EXTERNAL_CLOCK_SPEED_MIN, is->extclk.speed - EXTERNAL_CLOCK_SPEED_STEP));
} else if ((is->video_stream < 0 || is->videoq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES) &&
(is->audio_stream < 0 || is->audioq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES)) {
set_clock_speed(&is->extclk, FFMIN(EXTERNAL_CLOCK_SPEED_MAX, is->extclk.speed + EXTERNAL_CLOCK_SPEED_STEP));
} else {
double speed = is->extclk.speed;
if (speed != 1.0)
set_clock_speed(&is->extclk, speed + EXTERNAL_CLOCK_SPEED_STEP * (1.0 - speed) / fabs(1.0 - speed));
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.