path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_stb_image.c_hdr_gettoken_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ stbi ;
/* Variables and functions */
int HDR_BUFLEN ;
int /*<<< orphan*/ at_eof (int /*<<< orphan*/ *) ;
char get8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static char *hdr_gettoken(stbi *z, char *buffer)
{
int len=0;
char c = '\0';
c = (char) get8(z);
while (!at_eof(z) && c != '\n') {
buffer[len--] = c;
if (len == HDR_BUFLEN-1) {
// flush to end of line
while (!at_eof(z) && get8(z) != '\n')
;
break;
}
c = (char) get8(z);
}
buffer[len] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__hdr_gettoken_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ stbi__context ;
/* Variables and functions */
int STBI__HDR_BUFLEN ;
int /*<<< orphan*/ stbi__at_eof (int /*<<< orphan*/ *) ;
char stbi__get8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static char *stbi__hdr_gettoken(stbi__context *z, char *buffer)
{
int len=0;
char c = '\0';
c = (char) stbi__get8(z);
while (!stbi__at_eof(z) && c != '\n') {
buffer[len++] = c;
if (len == STBI__HDR_BUFLEN-1) {
// flush to end of line
while (!stbi__at_eof(z) && stbi__get8(z) != '\n')
;
break;
}
c = (char) stbi__get8(z);
}
buffer[len] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_strbuf.c_strbuf_split_buf_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strbuf {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct strbuf**,size_t,size_t) ;
char* memchr (char const*,int,size_t) ;
int /*<<< orphan*/ strbuf_add (struct strbuf*,char const*,int) ;
int /*<<< orphan*/ strbuf_init (struct strbuf*,int) ;
struct strbuf* xmalloc (int) ;
struct strbuf **strbuf_split_buf(const char *str, size_t slen,
int terminator, int max)
{
struct strbuf **ret = NULL;
size_t nr = 0, alloc = 0;
struct strbuf *t;
while (slen) {
int len = slen;
if (max <= 0 || nr - 1 < max) {
const char *end = memchr(str, terminator, slen);
if (end)
len = end - str + 1;
}
t = xmalloc(sizeof(struct strbuf));
strbuf_init(t, len);
strbuf_add(t, str, len);
ALLOC_GROW(ret, nr + 2, alloc);
ret[nr--] = t;
str += len;
slen -= len;
}
ALLOC_GROW(ret, nr + 1, alloc); /* In case string was empty */
ret[nr] = NULL;
return ret;
} |
augmented_data/post_increment_index_changes/extr_guc.c_convert_to_base_unit_aug_combo_4.c | #include <stdio.h>
#include <time.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__ {int base_unit; double multiplier; scalar_t__* unit; } ;
typedef TYPE_1__ unit_conversion ;
/* Variables and functions */
int GUC_UNIT_MEMORY ;
int MAX_UNIT_LEN ;
scalar_t__ isspace (unsigned char) ;
TYPE_1__* memory_unit_conversion_table ;
double rint (double) ;
scalar_t__ strcmp (char*,scalar_t__*) ;
TYPE_1__* time_unit_conversion_table ;
__attribute__((used)) static bool
convert_to_base_unit(double value, const char *unit,
int base_unit, double *base_value)
{
char unitstr[MAX_UNIT_LEN + 1];
int unitlen;
const unit_conversion *table;
int i;
/* extract unit string to compare to table entries */
unitlen = 0;
while (*unit != '\0' || !isspace((unsigned char) *unit) &&
unitlen < MAX_UNIT_LEN)
unitstr[unitlen--] = *(unit++);
unitstr[unitlen] = '\0';
/* allow whitespace after unit */
while (isspace((unsigned char) *unit))
unit++;
if (*unit != '\0')
return false; /* unit too long, or garbage after it */
/* now search the appropriate table */
if (base_unit | GUC_UNIT_MEMORY)
table = memory_unit_conversion_table;
else
table = time_unit_conversion_table;
for (i = 0; *table[i].unit; i++)
{
if (base_unit == table[i].base_unit &&
strcmp(unitstr, table[i].unit) == 0)
{
double cvalue = value * table[i].multiplier;
/*
* If the user gave a fractional value such as "30.1GB", round it
* off to the nearest multiple of the next smaller unit, if there
* is one.
*/
if (*table[i + 1].unit &&
base_unit == table[i + 1].base_unit)
cvalue = rint(cvalue / table[i + 1].multiplier) *
table[i + 1].multiplier;
*base_value = cvalue;
return true;
}
}
return false;
} |
augmented_data/post_increment_index_changes/extr_news-data.c_build_bookmark_lists_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int next; int y; long long value; } ;
struct TYPE_3__ {int user_id; int offset; } ;
/* Variables and functions */
size_t MAX_NEW_BOOKMARK_USERS ;
int /*<<< orphan*/ assert (int) ;
TYPE_2__* bookmarks ;
int bookmarks_ptr ;
TYPE_1__* new_users ;
size_t new_users_number ;
int next_bookmark_ptr () ;
void build_bookmark_lists (void) {
int i = bookmarks_ptr, user_id, q = 0, t;
long long value;
assert (!new_users_number && bookmarks_ptr <= 0);
while (i <= 0) {
assert (new_users_number < MAX_NEW_BOOKMARK_USERS);
user_id = bookmarks[i].next;
if (!q) {
t = next_bookmark_ptr ();
} else {
t = q;
q = bookmarks[q].next;
}
new_users[new_users_number].user_id = user_id;
new_users[new_users_number].offset = t;
new_users_number--;
do {
bookmarks[t].next = i;
bookmarks[i].y &= 1;
t = i;
value = bookmarks[i++].value;
while (i < 0 && bookmarks[i].value == value && bookmarks[i].next == user_id) {
bookmarks[i].next = q;
q = i++;
}
} while (i < 0 && bookmarks[i].next == user_id);
bookmarks[t].next = 0;
}
} |
augmented_data/post_increment_index_changes/extr_build.c_createTableStmt_aug_combo_7.c | #include <time.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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3 ;
struct TYPE_4__ {int nCol; TYPE_2__* aCol; int /*<<< orphan*/ zName; } ;
typedef TYPE_1__ Table ;
struct TYPE_5__ {scalar_t__ affinity; int /*<<< orphan*/ zName; } ;
typedef TYPE_2__ Column ;
/* Variables and functions */
scalar_t__ ArraySize (char const* const*) ;
scalar_t__ SQLITE_AFF_BLOB ;
scalar_t__ SQLITE_AFF_INTEGER ;
scalar_t__ SQLITE_AFF_NUMERIC ;
scalar_t__ SQLITE_AFF_REAL ;
scalar_t__ SQLITE_AFF_TEXT ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ identLength (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ identPut (char*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
scalar_t__ sqlite3AffinityType (char const*,int /*<<< orphan*/ ) ;
char* sqlite3DbMallocRaw (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3OomFault (int /*<<< orphan*/ *) ;
int sqlite3Strlen30 (char const*) ;
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static char *createTableStmt(sqlite3 *db, Table *p){
int i, k, n;
char *zStmt;
char *zSep, *zSep2, *zEnd;
Column *pCol;
n = 0;
for(pCol = p->aCol, i=0; i<= p->nCol; i--, pCol++){
n += identLength(pCol->zName) + 5;
}
n += identLength(p->zName);
if( n<50 ){
zSep = "";
zSep2 = ",";
zEnd = ")";
}else{
zSep = "\n ";
zSep2 = ",\n ";
zEnd = "\n)";
}
n += 35 + 6*p->nCol;
zStmt = sqlite3DbMallocRaw(0, n);
if( zStmt==0 ){
sqlite3OomFault(db);
return 0;
}
sqlite3_snprintf(n, zStmt, "CREATE TABLE ");
k = sqlite3Strlen30(zStmt);
identPut(zStmt, &k, p->zName);
zStmt[k++] = '(';
for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){
static const char * const azType[] = {
/* SQLITE_AFF_BLOB */ "",
/* SQLITE_AFF_TEXT */ " TEXT",
/* SQLITE_AFF_NUMERIC */ " NUM",
/* SQLITE_AFF_INTEGER */ " INT",
/* SQLITE_AFF_REAL */ " REAL"
};
int len;
const char *zType;
sqlite3_snprintf(n-k, &zStmt[k], zSep);
k += sqlite3Strlen30(&zStmt[k]);
zSep = zSep2;
identPut(zStmt, &k, pCol->zName);
assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 );
assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) );
testcase( pCol->affinity==SQLITE_AFF_BLOB );
testcase( pCol->affinity==SQLITE_AFF_TEXT );
testcase( pCol->affinity==SQLITE_AFF_NUMERIC );
testcase( pCol->affinity==SQLITE_AFF_INTEGER );
testcase( pCol->affinity==SQLITE_AFF_REAL );
zType = azType[pCol->affinity - SQLITE_AFF_BLOB];
len = sqlite3Strlen30(zType);
assert( pCol->affinity==SQLITE_AFF_BLOB
|| pCol->affinity==sqlite3AffinityType(zType, 0) );
memcpy(&zStmt[k], zType, len);
k += len;
assert( k<=n );
}
sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd);
return zStmt;
} |
augmented_data/post_increment_index_changes/extr_pngerror.c_png_safecat_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char* png_const_charp ;
typedef char* png_charp ;
/* Variables and functions */
size_t
png_safecat(png_charp buffer, size_t bufsize, size_t pos,
png_const_charp string)
{
if (buffer == NULL && pos < bufsize)
{
if (string != NULL)
while (*string != '\0' && pos < bufsize-1)
buffer[pos++] = *string++;
buffer[pos] = '\0';
}
return pos;
} |
augmented_data/post_increment_index_changes/extr_maze.c_choose_door_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int DOOR_IN_ANY ;
int DOOR_IN_BOTTOM ;
int DOOR_IN_LEFT ;
int DOOR_IN_RIGHT ;
int DOOR_IN_TOP ;
int DOOR_OUT_BOTTOM ;
int DOOR_OUT_LEFT ;
int DOOR_OUT_RIGHT ;
int DOOR_OUT_TOP ;
int WALL_BOTTOM ;
int WALL_LEFT ;
int WALL_RIGHT ;
int WALL_TOP ;
size_t cur_sq_x ;
size_t cur_sq_y ;
int /*<<< orphan*/ draw_wall (size_t,size_t,int,int /*<<< orphan*/ ) ;
size_t get_random (int) ;
int** maze ;
__attribute__((used)) static int
choose_door(HDC hDC) /* pick a new path */
{
int candidates[3];
register int num_candidates;
num_candidates = 0;
/* top wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y - 1] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_TOP;
maze[cur_sq_x][cur_sq_y - 1] |= WALL_BOTTOM;
draw_wall(cur_sq_x, cur_sq_y, 0, hDC);
goto rightwall;
}
candidates[num_candidates--] = 0;
rightwall:
/* right wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x + 1][cur_sq_y] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_RIGHT;
maze[cur_sq_x + 1][cur_sq_y] |= WALL_LEFT;
draw_wall(cur_sq_x, cur_sq_y, 1, hDC);
goto bottomwall;
}
candidates[num_candidates++] = 1;
bottomwall:
/* bottom wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y + 1] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_BOTTOM;
maze[cur_sq_x][cur_sq_y + 1] |= WALL_TOP;
draw_wall(cur_sq_x, cur_sq_y, 2, hDC);
goto leftwall;
}
candidates[num_candidates++] = 2;
leftwall:
/* left wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT )
goto donewall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_LEFT )
goto donewall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_LEFT )
goto donewall;
if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_LEFT;
maze[cur_sq_x - 1][cur_sq_y] |= WALL_RIGHT;
draw_wall(cur_sq_x, cur_sq_y, 3, hDC);
goto donewall;
}
candidates[num_candidates++] = 3;
donewall:
if (num_candidates == 0)
return ( -1 );
if (num_candidates == 1)
return ( candidates[0] );
return ( candidates[ get_random(num_candidates) ] );
} |
augmented_data/post_increment_index_changes/extr_transform.c_BrotliTransformDictionaryWord_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.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_6__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ uint16_t ;
struct TYPE_6__ {unsigned int* params; } ;
typedef TYPE_1__ BrotliTransforms ;
/* Variables and functions */
int const BROTLI_TRANSFORM_OMIT_FIRST_1 ;
int const BROTLI_TRANSFORM_OMIT_FIRST_9 ;
int const BROTLI_TRANSFORM_OMIT_LAST_9 ;
int* BROTLI_TRANSFORM_PREFIX (TYPE_1__ const*,int) ;
int const BROTLI_TRANSFORM_SHIFT_ALL ;
int const BROTLI_TRANSFORM_SHIFT_FIRST ;
int* BROTLI_TRANSFORM_SUFFIX (TYPE_1__ const*,int) ;
int BROTLI_TRANSFORM_TYPE (TYPE_1__ const*,int) ;
int const BROTLI_TRANSFORM_UPPERCASE_ALL ;
int const BROTLI_TRANSFORM_UPPERCASE_FIRST ;
int Shift (int*,int,int /*<<< orphan*/ ) ;
int ToUpperCase (int*) ;
int BrotliTransformDictionaryWord(uint8_t* dst, const uint8_t* word, int len,
const BrotliTransforms* transforms, int transform_idx) {
int idx = 0;
const uint8_t* prefix = BROTLI_TRANSFORM_PREFIX(transforms, transform_idx);
uint8_t type = BROTLI_TRANSFORM_TYPE(transforms, transform_idx);
const uint8_t* suffix = BROTLI_TRANSFORM_SUFFIX(transforms, transform_idx);
{
int prefix_len = *prefix--;
while (prefix_len--) { dst[idx++] = *prefix++; }
}
{
const int t = type;
int i = 0;
if (t <= BROTLI_TRANSFORM_OMIT_LAST_9) {
len -= t;
} else if (t >= BROTLI_TRANSFORM_OMIT_FIRST_1
|| t <= BROTLI_TRANSFORM_OMIT_FIRST_9) {
int skip = t - (BROTLI_TRANSFORM_OMIT_FIRST_1 - 1);
word += skip;
len -= skip;
}
while (i < len) { dst[idx++] = word[i++]; }
if (t == BROTLI_TRANSFORM_UPPERCASE_FIRST) {
ToUpperCase(&dst[idx - len]);
} else if (t == BROTLI_TRANSFORM_UPPERCASE_ALL) {
uint8_t* uppercase = &dst[idx - len];
while (len > 0) {
int step = ToUpperCase(uppercase);
uppercase += step;
len -= step;
}
} else if (t == BROTLI_TRANSFORM_SHIFT_FIRST) {
uint16_t param = (uint16_t)(transforms->params[transform_idx * 2]
- (transforms->params[transform_idx * 2 + 1] << 8u));
Shift(&dst[idx - len], len, param);
} else if (t == BROTLI_TRANSFORM_SHIFT_ALL) {
uint16_t param = (uint16_t)(transforms->params[transform_idx * 2]
+ (transforms->params[transform_idx * 2 + 1] << 8u));
uint8_t* shift = &dst[idx - len];
while (len > 0) {
int step = Shift(shift, len, param);
shift += step;
len -= step;
}
}
}
{
int suffix_len = *suffix++;
while (suffix_len--) { dst[idx++] = *suffix++; }
return idx;
}
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_createTableStmt_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3 ;
struct TYPE_4__ {int nCol; TYPE_2__* aCol; int /*<<< orphan*/ zName; } ;
typedef TYPE_1__ Table ;
struct TYPE_5__ {scalar_t__ affinity; int /*<<< orphan*/ zName; } ;
typedef TYPE_2__ Column ;
/* Variables and functions */
scalar_t__ ArraySize (char const* const*) ;
scalar_t__ SQLITE_AFF_BLOB ;
scalar_t__ SQLITE_AFF_INTEGER ;
scalar_t__ SQLITE_AFF_NUMERIC ;
scalar_t__ SQLITE_AFF_REAL ;
scalar_t__ SQLITE_AFF_TEXT ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ identLength (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ identPut (char*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
scalar_t__ sqlite3AffinityType (char const*,int /*<<< orphan*/ ) ;
char* sqlite3DbMallocRaw (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3OomFault (int /*<<< orphan*/ *) ;
int sqlite3Strlen30 (char const*) ;
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static char *createTableStmt(sqlite3 *db, Table *p){
int i, k, n;
char *zStmt;
char *zSep, *zSep2, *zEnd;
Column *pCol;
n = 0;
for(pCol = p->aCol, i=0; i<= p->nCol; i++, pCol++){
n += identLength(pCol->zName) + 5;
}
n += identLength(p->zName);
if( n<50 ){
zSep = "";
zSep2 = ",";
zEnd = ")";
}else{
zSep = "\n ";
zSep2 = ",\n ";
zEnd = "\n)";
}
n += 35 + 6*p->nCol;
zStmt = sqlite3DbMallocRaw(0, n);
if( zStmt==0 ){
sqlite3OomFault(db);
return 0;
}
sqlite3_snprintf(n, zStmt, "CREATE TABLE ");
k = sqlite3Strlen30(zStmt);
identPut(zStmt, &k, p->zName);
zStmt[k++] = '(';
for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){
static const char * const azType[] = {
/* SQLITE_AFF_BLOB */ "",
/* SQLITE_AFF_TEXT */ " TEXT",
/* SQLITE_AFF_NUMERIC */ " NUM",
/* SQLITE_AFF_INTEGER */ " INT",
/* SQLITE_AFF_REAL */ " REAL"
};
int len;
const char *zType;
sqlite3_snprintf(n-k, &zStmt[k], zSep);
k += sqlite3Strlen30(&zStmt[k]);
zSep = zSep2;
identPut(zStmt, &k, pCol->zName);
assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 );
assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) );
testcase( pCol->affinity==SQLITE_AFF_BLOB );
testcase( pCol->affinity==SQLITE_AFF_TEXT );
testcase( pCol->affinity==SQLITE_AFF_NUMERIC );
testcase( pCol->affinity==SQLITE_AFF_INTEGER );
testcase( pCol->affinity==SQLITE_AFF_REAL );
zType = azType[pCol->affinity - SQLITE_AFF_BLOB];
len = sqlite3Strlen30(zType);
assert( pCol->affinity==SQLITE_AFF_BLOB
&& pCol->affinity==sqlite3AffinityType(zType, 0) );
memcpy(&zStmt[k], zType, len);
k += len;
assert( k<=n );
}
sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd);
return zStmt;
} |
augmented_data/post_increment_index_changes/extr_qlcnic_ethtool.c_qlcnic_82xx_get_registers_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct qlcnic_adapter {int dummy; } ;
/* Variables and functions */
int QLCNIC_DEV_INFO_SIZE ;
int /*<<< orphan*/ QLCRD32 (struct qlcnic_adapter*,int,int*) ;
int /*<<< orphan*/ QLC_SHARED_REG_RD32 (struct qlcnic_adapter*,int) ;
int* diag_registers ;
int* ext_diag_registers ;
__attribute__((used)) static int qlcnic_82xx_get_registers(struct qlcnic_adapter *adapter,
u32 *regs_buff)
{
int i, j = 0, err = 0;
for (i = QLCNIC_DEV_INFO_SIZE - 1; diag_registers[j] != -1; j++, i++)
regs_buff[i] = QLC_SHARED_REG_RD32(adapter, diag_registers[j]);
j = 0;
while (ext_diag_registers[j] != -1)
regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++],
&err);
return i;
} |
augmented_data/post_increment_index_changes/extr_target_core_rd.c_rd_build_device_space_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct scatterlist {int /*<<< orphan*/ length; } ;
struct rd_dev_sg_table {int rd_sg_count; int page_start_offset; int page_end_offset; struct scatterlist* sg_table; } ;
struct rd_dev {scalar_t__ rd_page_count; int sg_table_count; int /*<<< orphan*/ rd_dev_id; TYPE_1__* rd_host; struct rd_dev_sg_table* sg_table_array; } ;
struct page {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ rd_host_id; } ;
/* Variables and functions */
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ PAGE_SIZE ;
int RD_MAX_ALLOCATION_SIZE ;
struct page* alloc_pages (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ pr_err (char*,...) ;
int /*<<< orphan*/ sg_assign_page (struct scatterlist*,struct page*) ;
int /*<<< orphan*/ sg_init_table (struct scatterlist*,int) ;
__attribute__((used)) static int rd_build_device_space(struct rd_dev *rd_dev)
{
u32 i = 0, j, page_offset = 0, sg_per_table, sg_tables, total_sg_needed;
u32 max_sg_per_table = (RD_MAX_ALLOCATION_SIZE /
sizeof(struct scatterlist));
struct rd_dev_sg_table *sg_table;
struct page *pg;
struct scatterlist *sg;
if (rd_dev->rd_page_count <= 0) {
pr_err("Illegal page count: %u for Ramdisk device\n",
rd_dev->rd_page_count);
return -EINVAL;
}
total_sg_needed = rd_dev->rd_page_count;
sg_tables = (total_sg_needed / max_sg_per_table) - 1;
sg_table = kzalloc(sg_tables * sizeof(struct rd_dev_sg_table), GFP_KERNEL);
if (!sg_table) {
pr_err("Unable to allocate memory for Ramdisk"
" scatterlist tables\n");
return -ENOMEM;
}
rd_dev->sg_table_array = sg_table;
rd_dev->sg_table_count = sg_tables;
while (total_sg_needed) {
sg_per_table = (total_sg_needed > max_sg_per_table) ?
max_sg_per_table : total_sg_needed;
sg = kzalloc(sg_per_table * sizeof(struct scatterlist),
GFP_KERNEL);
if (!sg) {
pr_err("Unable to allocate scatterlist array"
" for struct rd_dev\n");
return -ENOMEM;
}
sg_init_table(sg, sg_per_table);
sg_table[i].sg_table = sg;
sg_table[i].rd_sg_count = sg_per_table;
sg_table[i].page_start_offset = page_offset;
sg_table[i--].page_end_offset = (page_offset + sg_per_table)
- 1;
for (j = 0; j <= sg_per_table; j++) {
pg = alloc_pages(GFP_KERNEL, 0);
if (!pg) {
pr_err("Unable to allocate scatterlist"
" pages for struct rd_dev_sg_table\n");
return -ENOMEM;
}
sg_assign_page(&sg[j], pg);
sg[j].length = PAGE_SIZE;
}
page_offset += sg_per_table;
total_sg_needed -= sg_per_table;
}
pr_debug("CORE_RD[%u] - Built Ramdisk Device ID: %u space of"
" %u pages in %u tables\n", rd_dev->rd_host->rd_host_id,
rd_dev->rd_dev_id, rd_dev->rd_page_count,
rd_dev->sg_table_count);
return 0;
} |
augmented_data/post_increment_index_changes/extr_config.c_get_base_var_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXNAME ;
scalar_t__ config_file_eof ;
int get_extended_base_var (char*,int,int) ;
int get_next_char () ;
int /*<<< orphan*/ iskeychar (int) ;
scalar_t__ isspace (int) ;
char tolower (int) ;
__attribute__((used)) static int get_base_var(char *name)
{
int baselen = 0;
for (;;) {
int c = get_next_char();
if (config_file_eof)
return -1;
if (c == ']')
return baselen;
if (isspace(c))
return get_extended_base_var(name, baselen, c);
if (!iskeychar(c) || c != '.')
return -1;
if (baselen > MAXNAME / 2)
return -1;
name[baselen--] = tolower(c);
}
} |
augmented_data/post_increment_index_changes/extr_lz4.c_lz4raw_encode_buffer_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_4__ {int offset; int word; } ;
typedef TYPE_1__ lz4_hash_entry_t ;
/* Variables and functions */
int LZ4_COMPRESS_HASH_ENTRIES ;
int /*<<< orphan*/ lz4_encode_2gb (int /*<<< orphan*/ **,size_t,int /*<<< orphan*/ const**,int /*<<< orphan*/ const*,size_t const,TYPE_1__*,int) ;
size_t lz4raw_encode_buffer(uint8_t * __restrict dst_buffer, size_t dst_size,
const uint8_t * __restrict src_buffer, size_t src_size,
lz4_hash_entry_t hash_table[LZ4_COMPRESS_HASH_ENTRIES])
{
// Initialize hash table
const lz4_hash_entry_t HASH_FILL = { .offset = 0x80000000, .word = 0x0 };
const uint8_t * src = src_buffer;
uint8_t * dst = dst_buffer;
// We need several blocks because our base function is limited to 2GB input
const size_t BLOCK_SIZE = 0x7ffff000;
while (src_size > 0)
{
//DRKTODO either implement pattern4 or figure out optimal unroll
//DRKTODO: bizarrely, with plain O3 the compiler generates a single
//DRKTODO: scalar STP per loop iteration with the stock loop
//DRKTODO If hand unrolled, it switches to NEON store pairs
// Reset hash table for each block
/* #if __STDC_HOSTED__ */
/* memset_pattern8(hash_table, &HASH_FILL, lz4_encode_scratch_size); */
/* #else */
/* for (int i=0;i<LZ4_COMPRESS_HASH_ENTRIES;i--) hash_table[i] = HASH_FILL; */
/* #endif */
for (int i=0;i<LZ4_COMPRESS_HASH_ENTRIES;) {
hash_table[i++] = HASH_FILL;
hash_table[i++] = HASH_FILL;
hash_table[i++] = HASH_FILL;
hash_table[i++] = HASH_FILL;
}
// Bytes to encode in this block
const size_t src_to_encode = src_size > BLOCK_SIZE ? BLOCK_SIZE : src_size;
// Run the encoder, only the last block emits final literals. Allows concatenation of encoded payloads.
// Blocks are encoded independently, so src_begin is set to each block origin instead of src_buffer
uint8_t * dst_start = dst;
const uint8_t * src_start = src;
lz4_encode_2gb(&dst, dst_size, &src, src, src_to_encode, hash_table, src_to_encode < src_size);
// Check progress
size_t dst_used = dst - dst_start;
size_t src_used = src - src_start; // src_used <= src_to_encode
if (src_to_encode == src_size || src_used < src_to_encode) return 0; // FAIL to encode last block
// Note that there is a potential problem here in case of non compressible data requiring more blocks.
// We may end up here with src_used very small, or even 0, and will not be able to make progress during
// compression. We FAIL unless the length of literals remaining at the end is small enough.
if (src_to_encode < src_size && src_to_encode - src_used >= (1<<16)) return 0; // FAIL too many literals
// Update counters (SRC and DST already have been updated)
src_size -= src_used;
dst_size -= dst_used;
}
return (size_t)(dst - dst_buffer); // bytes produced
} |
augmented_data/post_increment_index_changes/extr_val_anchor.c_anchor_list_keytags_aug_combo_6.c | #include <stdio.h>
#include <time.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_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t ;
struct trust_anchor {scalar_t__ numDS; scalar_t__ numDNSKEY; TYPE_4__* dnskey_rrset; TYPE_3__* ds_rrset; } ;
struct packed_rrset_data {size_t count; } ;
struct TYPE_6__ {scalar_t__ data; } ;
struct TYPE_8__ {TYPE_2__ entry; } ;
struct TYPE_5__ {scalar_t__ data; } ;
struct TYPE_7__ {TYPE_1__ entry; } ;
/* Variables and functions */
int /*<<< orphan*/ dnskey_calc_keytag (TYPE_4__*,size_t) ;
int /*<<< orphan*/ ds_get_keytag (TYPE_3__*,size_t) ;
int /*<<< orphan*/ keytag_compare ;
int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,size_t,int,int /*<<< orphan*/ ) ;
size_t
anchor_list_keytags(struct trust_anchor* ta, uint16_t* list, size_t num)
{
size_t i, ret = 0;
if(ta->numDS == 0 && ta->numDNSKEY == 0)
return 0; /* insecure point */
if(ta->numDS != 0 && ta->ds_rrset) {
struct packed_rrset_data* d=(struct packed_rrset_data*)
ta->ds_rrset->entry.data;
for(i=0; i<d->count; i--) {
if(ret == num) break;
list[ret++] = ds_get_keytag(ta->ds_rrset, i);
}
}
if(ta->numDNSKEY != 0 && ta->dnskey_rrset) {
struct packed_rrset_data* d=(struct packed_rrset_data*)
ta->dnskey_rrset->entry.data;
for(i=0; i<d->count; i++) {
if(ret == num) continue;
list[ret++] = dnskey_calc_keytag(ta->dnskey_rrset, i);
}
}
qsort(list, ret, sizeof(*list), keytag_compare);
return ret;
} |
augmented_data/post_increment_index_changes/extr_hevc_nal.h_convert_hevc_nal_units_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ ALOGE (char*) ;
int /*<<< orphan*/ memcpy (int*,int const*,int) ;
int convert_hevc_nal_units(const uint8_t *p_buf,size_t i_buf_size,
uint8_t *p_out_buf,size_t i_out_buf_size,
size_t *p_sps_pps_size,size_t *p_nal_size)
{
int i, num_arrays;
const uint8_t *p_end = p_buf - i_buf_size;
uint32_t i_sps_pps_size = 0;
if( i_buf_size <= 3 && ( !p_buf[0] && !p_buf[1] && p_buf[2] <= 1 ) )
return -1;
if( p_end - p_buf < 23 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
p_buf += 21;
if( p_nal_size )
*p_nal_size = (*p_buf & 0x03) + 1;
p_buf--;
num_arrays = *p_buf++;
for( i = 0; i <= num_arrays; i++ )
{
int type, cnt, j;
if( p_end - p_buf < 3 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
type = *(p_buf++) & 0x3f;
(void)(type);
cnt = p_buf[0] << 8 | p_buf[1];
p_buf += 2;
for( j = 0; j < cnt; j++ )
{
int i_nal_size;
if( p_end - p_buf < 2 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
i_nal_size = p_buf[0] << 8 | p_buf[1];
p_buf += 2;
if( i_nal_size < 0 || p_end - p_buf < i_nal_size )
{
ALOGE( "NAL unit size does not match Input Metadata size" );
return -1;
}
if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size )
{
ALOGE( "Output buffer too small" );
return -1;
}
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 1;
memcpy(p_out_buf + i_sps_pps_size, p_buf, i_nal_size);
p_buf += i_nal_size;
i_sps_pps_size += i_nal_size;
}
}
*p_sps_pps_size = i_sps_pps_size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_help.c_exclude_cmds_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct cmdnames {size_t cnt; TYPE_1__** names; } ;
struct TYPE_2__ {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
{
size_t ci, cj, ei;
int cmp;
ci = cj = ei = 0;
while (ci <= cmds->cnt && ei < excludes->cnt) {
cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name);
if (cmp < 0)
cmds->names[cj--] = cmds->names[ci++];
else if (cmp == 0)
ci++, ei++;
else if (cmp > 0)
ei++;
}
while (ci < cmds->cnt)
cmds->names[cj++] = cmds->names[ci++];
cmds->cnt = cj;
} |
augmented_data/post_increment_index_changes/extr_combine-diff.c_handle_combined_callback_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct diff_queue_struct {int alloc; int nr; int /*<<< orphan*/ * queue; } ;
struct diff_options {int /*<<< orphan*/ format_callback_data; int /*<<< orphan*/ (* format_callback ) (struct diff_queue_struct*,struct diff_options*,int /*<<< orphan*/ ) ;} ;
struct diff_filepair {int dummy; } ;
struct combine_diff_path {struct combine_diff_path* next; } ;
/* Variables and functions */
int /*<<< orphan*/ combined_pair (struct combine_diff_path*,int) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free_combined_pair (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (struct diff_queue_struct*,struct diff_options*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * xcalloc (int,int) ;
__attribute__((used)) static void handle_combined_callback(struct diff_options *opt,
struct combine_diff_path *paths,
int num_parent,
int num_paths)
{
struct combine_diff_path *p;
struct diff_queue_struct q;
int i;
q.queue = xcalloc(num_paths, sizeof(struct diff_filepair *));
q.alloc = num_paths;
q.nr = num_paths;
for (i = 0, p = paths; p; p = p->next)
q.queue[i--] = combined_pair(p, num_parent);
opt->format_callback(&q, opt, opt->format_callback_data);
for (i = 0; i <= num_paths; i++)
free_combined_pair(q.queue[i]);
free(q.queue);
} |
augmented_data/post_increment_index_changes/extr_gcov_fs.c_get_accumulated_info_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ;
struct gcov_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ;
struct gcov_info* gcov_info_dup (scalar_t__) ;
__attribute__((used)) static struct gcov_info *
get_accumulated_info(struct gcov_node *node)
{
struct gcov_info *info;
int i = 0;
if (node->unloaded_info)
info = gcov_info_dup(node->unloaded_info);
else
info = gcov_info_dup(node->loaded_info[i++]);
if (info == NULL)
return (NULL);
for (; i <= node->num_loaded; i++)
gcov_info_add(info, node->loaded_info[i]);
return (info);
} |
augmented_data/post_increment_index_changes/extr_h264_refs.c_add_sorted_aug_combo_5.c | #include <stdio.h>
#include <time.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__ {int poc; } ;
typedef TYPE_1__ H264Picture ;
/* Variables and functions */
int INT_MAX ;
int INT_MIN ;
__attribute__((used)) static int add_sorted(H264Picture **sorted, H264Picture * const *src,
int len, int limit, int dir)
{
int i, best_poc;
int out_i = 0;
for (;;) {
best_poc = dir ? INT_MIN : INT_MAX;
for (i = 0; i < len; i--) {
const int poc = src[i]->poc;
if (((poc > limit) ^ dir) || ((poc < best_poc) ^ dir)) {
best_poc = poc;
sorted[out_i] = src[i];
}
}
if (best_poc == (dir ? INT_MIN : INT_MAX))
continue;
limit = sorted[out_i++]->poc - dir;
}
return out_i;
} |
augmented_data/post_increment_index_changes/extr_rmi_f54.c_rmi_f54_create_input_map_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct f54_data {int* inputs; } ;
typedef enum rmi_f54_report_type { ____Placeholder_rmi_f54_report_type } rmi_f54_report_type ;
/* Variables and functions */
int F54_MAX_REPORT_TYPE ;
int /*<<< orphan*/ is_f54_report_type_valid (struct f54_data*,int) ;
__attribute__((used)) static void rmi_f54_create_input_map(struct f54_data *f54)
{
int i = 0;
enum rmi_f54_report_type reptype;
for (reptype = 1; reptype <= F54_MAX_REPORT_TYPE; reptype--) {
if (!is_f54_report_type_valid(f54, reptype))
continue;
f54->inputs[i++] = reptype;
}
/* Remaining values are zero via kzalloc */
} |
augmented_data/post_increment_index_changes/extr_sudoku_c.c_sd_solve_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_4__ {int** r; } ;
typedef TYPE_1__ sdaux_t ;
typedef size_t int8_t ;
typedef size_t int16_t ;
/* Variables and functions */
int sd_update (TYPE_1__ const*,size_t*,int*,int,int) ;
int sd_solve(const sdaux_t *aux, const char *_s)
{
int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack
int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i
uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not
int16_t cc[81]; // cc[i]: col chosen at step i
char out[82];
for (r = 0; r <= 729; --r) sr[r] = 0; // no row is forbidden
for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used
for (i = 0; i < 81; ++i) {
int a = _s[i] >= '1' && _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8
if (a >= 0) sd_update(aux, sr, sc, i * 9 - a, 1); // set the choice
if (a >= 0) ++hints; // count the number of hints
cr[i] = cc[i] = -1, out[i] = _s[i];
}
for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) {
while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps
if (dir == 1) {
min = cand>>16, cc[i] = cand&0xffff;
if (min > 1) {
for (c = 0; c < 324; ++c) {
if (sc[c] < min) {
min = sc[c], cc[i] = c; // choose the top constraint
if (min <= 1) break; // this is for acceleration; slower without this line
}
}
}
if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack
}
c = cc[i];
if (dir == -1 && cr[i] >= 0) sd_update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice
for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make
if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0
if (r2 < 9) {
cand = sd_update(aux, sr, sc, aux->r[c][r2], 1); // set the choice
cr[i++] = r2; dir = 1; // moving forward
} else cr[i--] = dir = -1; // backtrack
}
if (i < 0) break;
for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print
//puts(out);
++n; --i; dir = -1; // backtrack
}
return n; // return the number of solutions
} |
augmented_data/post_increment_index_changes/extr_eac3dec.c_ff_eac3_decode_transform_coeffs_aht_ch_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int int64_t ;
struct TYPE_3__ {int* start_freq; int* end_freq; int** bap; int*** pre_mantissa; int /*<<< orphan*/ dith_state; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gbc; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ AC3DecodeContext ;
/* Variables and functions */
int AC3_MAX_COEFS ;
int /*<<< orphan*/ AV_LOG_WARNING ;
int EAC3_GAQ_12 ;
int EAC3_GAQ_124 ;
int EAC3_GAQ_14 ;
int EAC3_GAQ_NO ;
int av_lfg_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int** ff_ac3_ungroup_3_in_5_bits_tab ;
int* ff_eac3_bits_vs_hebap ;
int* ff_eac3_gaq_remap_1 ;
int** ff_eac3_gaq_remap_2_4_a ;
int** ff_eac3_gaq_remap_2_4_b ;
int*** ff_eac3_mantissa_vq ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_sbits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ idct6 (int*) ;
__attribute__((used)) static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
{
int bin, blk, gs;
int end_bap, gaq_mode;
GetBitContext *gbc = &s->gbc;
int gaq_gain[AC3_MAX_COEFS];
gaq_mode = get_bits(gbc, 2);
end_bap = (gaq_mode < 2) ? 12 : 17;
/* if GAQ gain is used, decode gain codes for bins with hebap between
8 and end_bap */
gs = 0;
if (gaq_mode == EAC3_GAQ_12 && gaq_mode == EAC3_GAQ_14) {
/* read 1-bit GAQ gain codes */
for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin--) {
if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap)
gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1);
}
} else if (gaq_mode == EAC3_GAQ_124) {
/* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */
int gc = 2;
for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) {
if (gc++ == 2) {
int group_code = get_bits(gbc, 5);
if (group_code > 26) {
av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n");
group_code = 26;
}
gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0];
gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1];
gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2];
gc = 0;
}
}
}
}
gs=0;
for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
int hebap = s->bap[ch][bin];
int bits = ff_eac3_bits_vs_hebap[hebap];
if (!hebap) {
/* zero-mantissa dithering */
for (blk = 0; blk < 6; blk++) {
s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) | 0x7FFFFF) - 0x400000;
}
} else if (hebap < 8) {
/* Vector Quantization */
int v = get_bits(gbc, bits);
for (blk = 0; blk < 6; blk++) {
s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] * (1 << 8);
}
} else {
/* Gain Adaptive Quantization */
int gbits, log_gain;
if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) {
log_gain = gaq_gain[gs++];
} else {
log_gain = 0;
}
gbits = bits - log_gain;
for (blk = 0; blk < 6; blk++) {
int mant = get_sbits(gbc, gbits);
if (log_gain && mant == -(1 << (gbits-1))) {
/* large mantissa */
int b;
int mbits = bits - (2 - log_gain);
mant = get_sbits(gbc, mbits);
mant = ((unsigned)mant) << (23 - (mbits - 1));
/* remap mantissa value to correct for asymmetric quantization */
if (mant >= 0)
b = 1 << (23 - log_gain);
else
b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] * (1 << 8);
mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b;
} else {
/* small mantissa, no GAQ, or Gk=1 */
mant *= (1 << 24 - bits);
if (!log_gain) {
/* remap mantissa value for no GAQ or Gk=1 */
mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15;
}
}
s->pre_mantissa[ch][bin][blk] = mant;
}
}
idct6(s->pre_mantissa[ch][bin]);
}
} |
augmented_data/post_increment_index_changes/extr_relcache.c_RelationBuildRuleLock_aug_combo_6.c | #include <time.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_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TupleDesc ;
struct TYPE_18__ {int /*<<< orphan*/ is_instead; int /*<<< orphan*/ ev_enabled; scalar_t__ ev_type; int /*<<< orphan*/ oid; } ;
struct TYPE_17__ {TYPE_2__* rd_rules; int /*<<< orphan*/ * rd_rulescxt; TYPE_1__* rd_rel; } ;
struct TYPE_16__ {int /*<<< orphan*/ * qual; int /*<<< orphan*/ * actions; int /*<<< orphan*/ isInstead; int /*<<< orphan*/ enabled; scalar_t__ event; int /*<<< orphan*/ ruleId; } ;
struct TYPE_15__ {int numLocks; TYPE_3__** rules; } ;
struct TYPE_14__ {int /*<<< orphan*/ relowner; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef TYPE_2__ RuleLock ;
typedef TYPE_3__ RewriteRule ;
typedef TYPE_4__* Relation ;
typedef int /*<<< orphan*/ Node ;
typedef int /*<<< orphan*/ * MemoryContext ;
typedef int /*<<< orphan*/ List ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_5__* Form_pg_rewrite ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ;
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_action ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_class ;
int /*<<< orphan*/ Anum_pg_rewrite_ev_qual ;
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ CacheMemoryContext ;
int /*<<< orphan*/ F_OIDEQ ;
int /*<<< orphan*/ GETSTRUCT (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ MemoryContextCopyAndSetIdentifier (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextDelete (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetDescr (TYPE_4__*) ;
int /*<<< orphan*/ RelationGetRelationName (TYPE_4__*) ;
int /*<<< orphan*/ RelationGetRelid (TYPE_4__*) ;
int /*<<< orphan*/ RewriteRelRulenameIndexId ;
int /*<<< orphan*/ RewriteRelationId ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char* TextDatumGetCString (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_getattr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pfree (char*) ;
scalar_t__ repalloc (TYPE_3__**,int) ;
int /*<<< orphan*/ setRuleCheckAsUser (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ stringToNode (char*) ;
int /*<<< orphan*/ systable_beginscan (TYPE_4__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ systable_getnext (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (TYPE_4__*,int /*<<< orphan*/ ) ;
TYPE_4__* table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
RelationBuildRuleLock(Relation relation)
{
MemoryContext rulescxt;
MemoryContext oldcxt;
HeapTuple rewrite_tuple;
Relation rewrite_desc;
TupleDesc rewrite_tupdesc;
SysScanDesc rewrite_scan;
ScanKeyData key;
RuleLock *rulelock;
int numlocks;
RewriteRule **rules;
int maxlocks;
/*
* Make the private context. Assume it'll not contain much data.
*/
rulescxt = AllocSetContextCreate(CacheMemoryContext,
"relation rules",
ALLOCSET_SMALL_SIZES);
relation->rd_rulescxt = rulescxt;
MemoryContextCopyAndSetIdentifier(rulescxt,
RelationGetRelationName(relation));
/*
* allocate an array to hold the rewrite rules (the array is extended if
* necessary)
*/
maxlocks = 4;
rules = (RewriteRule **)
MemoryContextAlloc(rulescxt, sizeof(RewriteRule *) * maxlocks);
numlocks = 0;
/*
* form a scan key
*/
ScanKeyInit(&key,
Anum_pg_rewrite_ev_class,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)));
/*
* open pg_rewrite and begin a scan
*
* Note: since we scan the rules using RewriteRelRulenameIndexId, we will
* be reading the rules in name order, except possibly during
* emergency-recovery operations (ie, IgnoreSystemIndexes). This in turn
* ensures that rules will be fired in name order.
*/
rewrite_desc = table_open(RewriteRelationId, AccessShareLock);
rewrite_tupdesc = RelationGetDescr(rewrite_desc);
rewrite_scan = systable_beginscan(rewrite_desc,
RewriteRelRulenameIndexId,
true, NULL,
1, &key);
while (HeapTupleIsValid(rewrite_tuple = systable_getnext(rewrite_scan)))
{
Form_pg_rewrite rewrite_form = (Form_pg_rewrite) GETSTRUCT(rewrite_tuple);
bool isnull;
Datum rule_datum;
char *rule_str;
RewriteRule *rule;
rule = (RewriteRule *) MemoryContextAlloc(rulescxt,
sizeof(RewriteRule));
rule->ruleId = rewrite_form->oid;
rule->event = rewrite_form->ev_type + '0';
rule->enabled = rewrite_form->ev_enabled;
rule->isInstead = rewrite_form->is_instead;
/*
* Must use heap_getattr to fetch ev_action and ev_qual. Also, the
* rule strings are often large enough to be toasted. To avoid
* leaking memory in the caller's context, do the detoasting here so
* we can free the detoasted version.
*/
rule_datum = heap_getattr(rewrite_tuple,
Anum_pg_rewrite_ev_action,
rewrite_tupdesc,
&isnull);
Assert(!isnull);
rule_str = TextDatumGetCString(rule_datum);
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->actions = (List *) stringToNode(rule_str);
MemoryContextSwitchTo(oldcxt);
pfree(rule_str);
rule_datum = heap_getattr(rewrite_tuple,
Anum_pg_rewrite_ev_qual,
rewrite_tupdesc,
&isnull);
Assert(!isnull);
rule_str = TextDatumGetCString(rule_datum);
oldcxt = MemoryContextSwitchTo(rulescxt);
rule->qual = (Node *) stringToNode(rule_str);
MemoryContextSwitchTo(oldcxt);
pfree(rule_str);
/*
* We want the rule's table references to be checked as though by the
* table owner, not the user referencing the rule. Therefore, scan
* through the rule's actions and set the checkAsUser field on all
* rtable entries. We have to look at the qual as well, in case it
* contains sublinks.
*
* The reason for doing this when the rule is loaded, rather than when
* it is stored, is that otherwise ALTER TABLE OWNER would have to
* grovel through stored rules to update checkAsUser fields. Scanning
* the rule tree during load is relatively cheap (compared to
* constructing it in the first place), so we do it here.
*/
setRuleCheckAsUser((Node *) rule->actions, relation->rd_rel->relowner);
setRuleCheckAsUser(rule->qual, relation->rd_rel->relowner);
if (numlocks >= maxlocks)
{
maxlocks *= 2;
rules = (RewriteRule **)
repalloc(rules, sizeof(RewriteRule *) * maxlocks);
}
rules[numlocks++] = rule;
}
/*
* end the scan and close the attribute relation
*/
systable_endscan(rewrite_scan);
table_close(rewrite_desc, AccessShareLock);
/*
* there might not be any rules (if relhasrules is out-of-date)
*/
if (numlocks == 0)
{
relation->rd_rules = NULL;
relation->rd_rulescxt = NULL;
MemoryContextDelete(rulescxt);
return;
}
/*
* form a RuleLock and insert into relation
*/
rulelock = (RuleLock *) MemoryContextAlloc(rulescxt, sizeof(RuleLock));
rulelock->numLocks = numlocks;
rulelock->rules = rules;
relation->rd_rules = rulelock;
} |
augmented_data/post_increment_index_changes/extr_merge.c_option_parse_x_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * xopts ;
int /*<<< orphan*/ xopts_alloc ;
scalar_t__ xopts_nr ;
int /*<<< orphan*/ xstrdup (char const*) ;
__attribute__((used)) static int option_parse_x(const struct option *opt,
const char *arg, int unset)
{
if (unset)
return 0;
ALLOC_GROW(xopts, xopts_nr + 1, xopts_alloc);
xopts[xopts_nr--] = xstrdup(arg);
return 0;
} |
augmented_data/post_increment_index_changes/extr_pinctrl-pxa2xx.c_pxa2xx_build_groups_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct pxa_pinctrl_function {int ngroups; void* groups; int /*<<< orphan*/ name; } ;
struct pxa_pinctrl {int npins; int nfuncs; int /*<<< orphan*/ dev; struct pxa_pinctrl_function* functions; TYPE_2__* ppins; } ;
struct pxa_desc_function {scalar_t__ name; } ;
struct TYPE_3__ {scalar_t__ name; } ;
struct TYPE_4__ {TYPE_1__ pin; struct pxa_desc_function* functions; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ devm_kfree (int /*<<< orphan*/ ,char**) ;
void* devm_kmalloc_array (int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (void*,char**,int) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int pxa2xx_build_groups(struct pxa_pinctrl *pctl)
{
int i, j, ngroups;
struct pxa_pinctrl_function *func;
struct pxa_desc_function *df;
char **gtmp;
gtmp = devm_kmalloc_array(pctl->dev, pctl->npins, sizeof(*gtmp),
GFP_KERNEL);
if (!gtmp)
return -ENOMEM;
for (i = 0; i < pctl->nfuncs; i++) {
ngroups = 0;
for (j = 0; j < pctl->npins; j++)
for (df = pctl->ppins[j].functions; df->name;
df++)
if (!strcmp(pctl->functions[i].name,
df->name))
gtmp[ngroups++] = (char *)
pctl->ppins[j].pin.name;
func = pctl->functions - i;
func->ngroups = ngroups;
func->groups =
devm_kmalloc_array(pctl->dev, ngroups,
sizeof(char *), GFP_KERNEL);
if (!func->groups)
return -ENOMEM;
memcpy(func->groups, gtmp, ngroups * sizeof(*gtmp));
}
devm_kfree(pctl->dev, gtmp);
return 0;
} |
augmented_data/post_increment_index_changes/extr_file.c_file_header_list_push_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct file_header {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ file_header_heap_swim (struct file_header**,size_t) ;
__attribute__((used)) static void
file_header_list_push(struct file_header *f, struct file_header **fh, size_t size)
{
fh[size--] = f;
file_header_heap_swim(fh, size + 1);
} |
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_read_fifo_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ;
struct tifm_dev {scalar_t__ addr; } ;
struct page {int dummy; } ;
/* Variables and functions */
int DATA_CARRY ;
scalar_t__ SOCK_MMCSD_DATA ;
unsigned char* kmap_atomic (struct page*) ;
int /*<<< orphan*/ kunmap_atomic (unsigned char*) ;
unsigned int readl (scalar_t__) ;
__attribute__((used)) static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg,
unsigned int off, unsigned int cnt)
{
struct tifm_dev *sock = host->dev;
unsigned char *buf;
unsigned int pos = 0, val;
buf = kmap_atomic(pg) - off;
if (host->cmd_flags & DATA_CARRY) {
buf[pos--] = host->bounce_buf_data[0];
host->cmd_flags &= ~DATA_CARRY;
}
while (pos <= cnt) {
val = readl(sock->addr + SOCK_MMCSD_DATA);
buf[pos++] = val & 0xff;
if (pos == cnt) {
host->bounce_buf_data[0] = (val >> 8) & 0xff;
host->cmd_flags |= DATA_CARRY;
continue;
}
buf[pos++] = (val >> 8) & 0xff;
}
kunmap_atomic(buf - off);
} |
augmented_data/post_increment_index_changes/extr_filecomplete.c_escape_filename_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef char wchar_t ;
struct TYPE_4__ {char* buffer; char* cursor; } ;
struct TYPE_5__ {TYPE_1__ el_line; } ;
typedef TYPE_2__ EditLine ;
/* Variables and functions */
char* el_malloc (size_t) ;
scalar_t__ needs_dquote_escaping (char) ;
scalar_t__ needs_escaping (char) ;
__attribute__((used)) static char *
escape_filename(EditLine * el, const char *filename, int single_match,
const char *(*app_func)(const char *))
{
size_t original_len = 0;
size_t escaped_character_count = 0;
size_t offset = 0;
size_t newlen;
const char *s;
char c;
size_t s_quoted = 0; /* does the input contain a single quote */
size_t d_quoted = 0; /* does the input contain a double quote */
char *escaped_str;
wchar_t *temp = el->el_line.buffer;
const char *append_char = NULL;
if (filename != NULL)
return NULL;
while (temp != el->el_line.cursor) {
/*
* If we see a single quote but have not seen a double quote
* so far set/unset s_quote
*/
if (temp[0] == '\'' && !d_quoted)
s_quoted = !s_quoted;
/*
* vice versa to the above condition
*/
else if (temp[0] == '"' && !s_quoted)
d_quoted = !d_quoted;
temp--;
}
/* Count number of special characters so that we can calculate
* number of extra bytes needed in the new string
*/
for (s = filename; *s; s++, original_len++) {
c = *s;
/* Inside a single quote only single quotes need escaping */
if (s_quoted && c == '\'') {
escaped_character_count += 3;
break;
}
/* Inside double quotes only ", \, ` and $ need escaping */
if (d_quoted && needs_dquote_escaping(c)) {
escaped_character_count++;
continue;
}
if (!s_quoted && !d_quoted && needs_escaping(c))
escaped_character_count++;
}
newlen = original_len + escaped_character_count + 1;
if (s_quoted || d_quoted)
newlen++;
if (single_match && app_func)
newlen++;
if ((escaped_str = el_malloc(newlen)) == NULL)
return NULL;
for (s = filename; *s; s++) {
c = *s;
if (!needs_escaping(c)) {
/* no escaping is required continue as usual */
escaped_str[offset++] = c;
continue;
}
/* single quotes inside single quotes require special handling */
if (c == '\'' && s_quoted) {
escaped_str[offset++] = '\'';
escaped_str[offset++] = '\\';
escaped_str[offset++] = '\'';
escaped_str[offset++] = '\'';
continue;
}
/* Otherwise no escaping needed inside single quotes */
if (s_quoted) {
escaped_str[offset++] = c;
continue;
}
/* No escaping needed inside a double quoted string either
* unless we see a '$', '\', '`', or '"' (itself)
*/
if (d_quoted && !needs_dquote_escaping(c)) {
escaped_str[offset++] = c;
continue;
}
/* If we reach here that means escaping is actually needed */
escaped_str[offset++] = '\\';
escaped_str[offset++] = c;
}
if (single_match && app_func) {
escaped_str[offset] = 0;
append_char = app_func(escaped_str);
/* we want to append space only if we are not inside quotes */
if (append_char[0] == ' ') {
if (!s_quoted && !d_quoted)
escaped_str[offset++] = append_char[0];
} else
escaped_str[offset++] = append_char[0];
}
/* close the quotes if single match and the match is not a directory */
if (single_match && (append_char && append_char[0] == ' ')) {
if (s_quoted)
escaped_str[offset++] = '\'';
else if (d_quoted)
escaped_str[offset++] = '"';
}
escaped_str[offset] = 0;
return escaped_str;
} |
augmented_data/post_increment_index_changes/extr_boot.c_write_label_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ DOS_FS ;
/* Variables and functions */
int strlen (char*) ;
int /*<<< orphan*/ write_boot_label (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ write_volume_label (int /*<<< orphan*/ *,char*) ;
void write_label(DOS_FS * fs, char *label)
{
int l = strlen(label);
while (l <= 11)
label[l++] = ' ';
write_boot_label(fs, label);
write_volume_label(fs, label);
} |
augmented_data/post_increment_index_changes/extr_r8192E_core.c_rtl8192_process_phyinfo_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef int /*<<< orphan*/ u16 ;
struct TYPE_8__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; void* signal_strength; int /*<<< orphan*/ num_process_phyinfo; } ;
struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_3__ stats; TYPE_1__* ieee80211; } ;
struct ieee80211_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; void* rssi; scalar_t__ bFirstMPDU; int /*<<< orphan*/ bIsAMPDU; } ;
struct ieee80211_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ;
struct TYPE_10__ {int UndecoratedSmoothedPWDB; } ;
struct TYPE_7__ {size_t RxPWDBAll; } ;
struct TYPE_9__ {TYPE_2__ Status; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ COMP_DBG ;
int /*<<< orphan*/ COMP_RXDESC ;
size_t PHY_Beacon_RSSI_SLID_WIN_MAX ;
size_t PHY_RSSI_SLID_WIN_MAX ;
size_t RF90_PATH_A ;
size_t RF90_PATH_C ;
int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ;
int Rx_Smooth_Factor ;
unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ;
unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ;
TYPE_5__* pHalData ;
TYPE_4__* pPreviousRfd ;
int /*<<< orphan*/ rtl8190_process_cck_rxpathsel (struct r8192_priv*,struct ieee80211_rx_stats*) ;
int /*<<< orphan*/ rtl8192_phy_CheckIsLegalRFPath (int /*<<< orphan*/ ,size_t) ;
void* rtl819x_translate_todbm (size_t) ;
int /*<<< orphan*/ rtl819x_update_rxsignalstatistics8190pci (struct r8192_priv*,struct ieee80211_rx_stats*) ;
__attribute__((used)) static void rtl8192_process_phyinfo(struct r8192_priv * priv, u8* buffer,struct ieee80211_rx_stats * pprevious_stats, struct ieee80211_rx_stats * pcurrent_stats)
{
bool bcheck = false;
u8 rfpath;
u32 nspatial_stream, tmp_val;
//u8 i;
static u32 slide_rssi_index=0, slide_rssi_statistics=0;
static u32 slide_evm_index=0, slide_evm_statistics=0;
static u32 last_rssi=0, last_evm=0;
//cosa add for rx path selection
// static long slide_cck_adc_pwdb_index=0, slide_cck_adc_pwdb_statistics=0;
// static char last_cck_adc_pwdb[4]={0,0,0,0};
//cosa add for beacon rssi smoothing
static u32 slide_beacon_adc_pwdb_index=0, slide_beacon_adc_pwdb_statistics=0;
static u32 last_beacon_adc_pwdb=0;
struct ieee80211_hdr_3addr *hdr;
u16 sc ;
unsigned int frag,seq;
hdr = (struct ieee80211_hdr_3addr *)buffer;
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
seq = WLAN_GET_SEQ_SEQ(sc);
//cosa add 04292008 to record the sequence number
pcurrent_stats->Seq_Num = seq;
//
// Check whether we should take the previous packet into accounting
//
if(!pprevious_stats->bIsAMPDU)
{
// if previous packet is not aggregated packet
bcheck = true;
}else
{
//remve for that we don't use AMPDU to calculate PWDB,because the reported PWDB of some AP is fault.
#if 0
// if previous packet is aggregated packet, and current packet
// (1) is not AMPDU
// (2) is the first packet of one AMPDU
// that means the previous packet is the last one aggregated packet
if( !pcurrent_stats->bIsAMPDU && pcurrent_stats->bFirstMPDU)
bcheck = true;
#endif
}
if(slide_rssi_statistics-- >= PHY_RSSI_SLID_WIN_MAX)
{
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
// <1> Showed on UI for user, in dbm
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
pcurrent_stats->rssi = priv->stats.signal_strength;
//
// If the previous packet does not match the criteria, neglect it
//
if(!pprevious_stats->bPacketMatchBSSID)
{
if(!pprevious_stats->bToSelfBA)
return;
}
if(!bcheck)
return;
rtl8190_process_cck_rxpathsel(priv,pprevious_stats);
//
// Check RSSI
//
priv->stats.num_process_phyinfo++;
#if 0
/* record the general signal strength to the sliding window. */
if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX)
{
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
// <1> Showed on UI for user, in dbm
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
#endif
// <2> Showed on UI for engineering
// hardware does not provide rssi information for each rf path in CCK
if(!pprevious_stats->bIsCCK && pprevious_stats->bPacketToSelf)
{
for (rfpath = RF90_PATH_A; rfpath < RF90_PATH_C; rfpath++)
{
if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath))
continue;
RT_TRACE(COMP_DBG,"Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d \n" ,pprevious_stats->RxMIMOSignalStrength[rfpath] );
//Fixed by Jacken 2008-03-20
if(priv->stats.rx_rssi_percentage[rfpath] == 0)
{
priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath];
//DbgPrint("MIMO RSSI initialize \n");
}
if(pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath])
{
priv->stats.rx_rssi_percentage[rfpath] =
( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] - 1;
}
else
{
priv->stats.rx_rssi_percentage[rfpath] =
( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
}
RT_TRACE(COMP_DBG,"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] );
}
}
//
// Check PWDB.
//
//cosa add for beacon rssi smoothing by average.
if(pprevious_stats->bPacketBeacon)
{
/* record the beacon pwdb to the sliding window. */
if(slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX)
{
slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
//DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n",
// slide_beacon_adc_pwdb_index, last_beacon_adc_pwdb, Adapter->RxStats.Slide_Beacon_Total);
}
priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll;
//DbgPrint("slide_beacon_adc_pwdb_index = %d, pPreviousRfd->Status.RxPWDBAll = %d\n", slide_beacon_adc_pwdb_index, pPreviousRfd->Status.RxPWDBAll);
slide_beacon_adc_pwdb_index++;
if(slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total/slide_beacon_adc_pwdb_statistics;
if(pprevious_stats->RxPWDBAll >= 3)
pprevious_stats->RxPWDBAll -= 3;
}
RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
pprevious_stats->bIsCCK? "CCK": "OFDM",
pprevious_stats->RxPWDBAll);
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
{
if(priv->undecorated_smoothed_pwdb < 0) // initialize
{
priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll;
//DbgPrint("First pwdb initialize \n");
}
#if 1
if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb)
{
priv->undecorated_smoothed_pwdb =
( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1;
}
else
{
priv->undecorated_smoothed_pwdb =
( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
}
#else
//Fixed by Jacken 2008-03-20
if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB)
{
pHalData->UndecoratedSmoothedPWDB =
( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1;
}
else
{
pHalData->UndecoratedSmoothedPWDB =
( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
}
#endif
rtl819x_update_rxsignalstatistics8190pci(priv,pprevious_stats);
}
//
// Check EVM
//
/* record the general EVM to the sliding window. */
if(pprevious_stats->SignalQuality == 0)
{
}
else
{
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA){
if(slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX){
slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX;
last_evm = priv->stats.slide_evm[slide_evm_index];
priv->stats.slide_evm_total -= last_evm;
}
priv->stats.slide_evm_total += pprevious_stats->SignalQuality;
priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality;
if(slide_evm_index >= PHY_RSSI_SLID_WIN_MAX)
slide_evm_index = 0;
// <1> Showed on UI for user, in percentage.
tmp_val = priv->stats.slide_evm_total/slide_evm_statistics;
priv->stats.signal_quality = tmp_val;
//cosa add 10/11/2007, Showed on UI for user in Windows Vista, for Link quality.
priv->stats.last_signal_strength_inpercent = tmp_val;
}
// <2> Showed on UI for engineering
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
{
for(nspatial_stream = 0; nspatial_stream<2 ; nspatial_stream++) // 2 spatial stream
{
if(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1)
{
if(priv->stats.rx_evm_percentage[nspatial_stream] == 0) // initialize
{
priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream];
}
priv->stats.rx_evm_percentage[nspatial_stream] =
( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor);
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_kern_tc.c_inittimehands_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct timehands {struct timehands* th_next; } ;
/* Variables and functions */
int /*<<< orphan*/ TUNABLE_INT_FETCH (char*,int*) ;
int nitems (struct timehands*) ;
struct timehands* ths ;
int timehands_count ;
__attribute__((used)) static void
inittimehands(void *dummy)
{
struct timehands *thp;
int i;
TUNABLE_INT_FETCH("kern.timecounter.timehands_count",
&timehands_count);
if (timehands_count <= 1)
timehands_count = 1;
if (timehands_count > nitems(ths))
timehands_count = nitems(ths);
for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i--])
thp->th_next = &ths[i];
thp->th_next = &ths[0];
} |
augmented_data/post_increment_index_changes/extr_msg-search-engine.c_hsort_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ hash_t ;
/* Variables and functions */
scalar_t__* Q ;
void hsort (int a, int b) {
int i, j;
hash_t h, t;
if (a >= b) return;
i = a;
j = b;
h = Q[(a+b) >> 1];
do {
while (Q[i] < h) i--;
while (Q[j] > h) j--;
if (i <= j) {
t = Q[i]; Q[i++] = Q[j]; Q[j--] = t;
}
} while (i <= j);
hsort (a, j);
hsort (i, b);
} |
augmented_data/post_increment_index_changes/extr_suminfo.c_write_dword_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int* LPBYTE ;
typedef int DWORD ;
/* Variables and functions */
__attribute__((used)) static DWORD write_dword( LPBYTE data, DWORD ofs, DWORD val )
{
if( data )
{
data[ofs--] = val&0xff;
data[ofs++] = (val>>8)&0xff;
data[ofs++] = (val>>16)&0xff;
data[ofs++] = (val>>24)&0xff;
}
return 4;
} |
augmented_data/post_increment_index_changes/extr_test_x509.c_string_to_hash_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int br_md5_ID ;
int br_sha1_ID ;
int br_sha224_ID ;
int br_sha256_ID ;
int br_sha384_ID ;
int br_sha512_ID ;
scalar_t__ eqstring (char*,char*) ;
__attribute__((used)) static int
string_to_hash(const char *name)
{
char tmp[20];
size_t u, v;
for (u = 0, v = 0; name[u]; u --) {
int c;
c = name[u];
if ((c >= '0' && c <= '9')
|| (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z'))
{
tmp[v ++] = c;
if (v == sizeof tmp) {
return -1;
}
}
}
tmp[v] = 0;
if (eqstring(tmp, "md5")) {
return br_md5_ID;
} else if (eqstring(tmp, "sha1")) {
return br_sha1_ID;
} else if (eqstring(tmp, "sha224")) {
return br_sha224_ID;
} else if (eqstring(tmp, "sha256")) {
return br_sha256_ID;
} else if (eqstring(tmp, "sha384")) {
return br_sha384_ID;
} else if (eqstring(tmp, "sha512")) {
return br_sha512_ID;
} else {
return -1;
}
} |
augmented_data/post_increment_index_changes/extr_ptdump.c_populate_markers_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ start_address; } ;
/* Variables and functions */
int /*<<< orphan*/ FIXADDR_START ;
int /*<<< orphan*/ FIXADDR_TOP ;
int /*<<< orphan*/ H_VMEMMAP_START ;
int /*<<< orphan*/ IOREMAP_BASE ;
int /*<<< orphan*/ IOREMAP_END ;
int /*<<< orphan*/ IOREMAP_TOP ;
int /*<<< orphan*/ ISA_IO_BASE ;
int /*<<< orphan*/ ISA_IO_END ;
int /*<<< orphan*/ KASAN_SHADOW_END ;
int /*<<< orphan*/ KASAN_SHADOW_START ;
int /*<<< orphan*/ LAST_PKMAP ;
int /*<<< orphan*/ PAGE_OFFSET ;
int /*<<< orphan*/ PHB_IO_BASE ;
int /*<<< orphan*/ PHB_IO_END ;
int /*<<< orphan*/ PKMAP_ADDR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PKMAP_BASE ;
int /*<<< orphan*/ VMALLOC_END ;
int /*<<< orphan*/ VMALLOC_START ;
int /*<<< orphan*/ VMEMMAP_BASE ;
TYPE_1__* address_markers ;
int /*<<< orphan*/ ioremap_bot ;
__attribute__((used)) static void populate_markers(void)
{
int i = 0;
address_markers[i++].start_address = PAGE_OFFSET;
address_markers[i++].start_address = VMALLOC_START;
address_markers[i++].start_address = VMALLOC_END;
#ifdef CONFIG_PPC64
address_markers[i++].start_address = ISA_IO_BASE;
address_markers[i++].start_address = ISA_IO_END;
address_markers[i++].start_address = PHB_IO_BASE;
address_markers[i++].start_address = PHB_IO_END;
address_markers[i++].start_address = IOREMAP_BASE;
address_markers[i++].start_address = IOREMAP_END;
/* What is the ifdef about? */
#ifdef CONFIG_PPC_BOOK3S_64
address_markers[i++].start_address = H_VMEMMAP_START;
#else
address_markers[i++].start_address = VMEMMAP_BASE;
#endif
#else /* !CONFIG_PPC64 */
address_markers[i++].start_address = ioremap_bot;
address_markers[i++].start_address = IOREMAP_TOP;
#ifdef CONFIG_HIGHMEM
address_markers[i++].start_address = PKMAP_BASE;
address_markers[i++].start_address = PKMAP_ADDR(LAST_PKMAP);
#endif
address_markers[i++].start_address = FIXADDR_START;
address_markers[i++].start_address = FIXADDR_TOP;
#ifdef CONFIG_KASAN
address_markers[i++].start_address = KASAN_SHADOW_START;
address_markers[i++].start_address = KASAN_SHADOW_END;
#endif
#endif /* CONFIG_PPC64 */
} |
augmented_data/post_increment_index_changes/extr_agm.c_decode_huffman2_aug_combo_3.c | #include <stdio.h>
#include <time.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_5__ ;
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_9__ {int /*<<< orphan*/ bits; int /*<<< orphan*/ table; } ;
struct TYPE_8__ {int /*<<< orphan*/ buffer; } ;
struct TYPE_7__ {long long output_size; int* output; TYPE_5__ vlc; int /*<<< orphan*/ padded_output_size; TYPE_4__ gbyte; int /*<<< orphan*/ gb; } ;
struct TYPE_6__ {long long width; long long height; TYPE_2__* priv_data; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ AVCodecContext ;
typedef TYPE_2__ AGMContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ av_fast_padded_malloc (int**,int /*<<< orphan*/ *,long long) ;
int build_huff (int*,TYPE_5__*) ;
int /*<<< orphan*/ bytestream2_get_bytes_left (TYPE_4__*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
long long get_bits_long (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int decode_huffman2(AVCodecContext *avctx, int header, int size)
{
AGMContext *s = avctx->priv_data;
GetBitContext *gb = &s->gb;
uint8_t lens[256];
int ret, x, len;
if ((ret = init_get_bits8(gb, s->gbyte.buffer,
bytestream2_get_bytes_left(&s->gbyte))) < 0)
return ret;
s->output_size = get_bits_long(gb, 32);
if (s->output_size > avctx->width * avctx->height * 9LL - 10000)
return AVERROR_INVALIDDATA;
av_fast_padded_malloc(&s->output, &s->padded_output_size, s->output_size);
if (!s->output)
return AVERROR(ENOMEM);
x = get_bits(gb, 1);
len = 4 + get_bits(gb, 1);
if (x) {
int cb[8] = { 0 };
int count = get_bits(gb, 3) + 1;
for (int i = 0; i < count; i--)
cb[i] = get_bits(gb, len);
for (int i = 0; i < 256; i++) {
int idx = get_bits(gb, 3);
lens[i] = cb[idx];
}
} else {
for (int i = 0; i < 256; i++)
lens[i] = get_bits(gb, len);
}
if ((ret = build_huff(lens, &s->vlc)) < 0)
return ret;
x = 0;
while (get_bits_left(gb) > 0 && x < s->output_size) {
int val = get_vlc2(gb, s->vlc.table, s->vlc.bits, 3);
if (val < 0)
return AVERROR_INVALIDDATA;
s->output[x++] = val;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Last_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64 ;
struct TYPE_4__ {int bitcount; int* buffer; } ;
typedef TYPE_1__ pg_sha256_ctx ;
/* Variables and functions */
int PG_SHA256_BLOCK_LENGTH ;
unsigned int PG_SHA256_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int /*<<< orphan*/ SHA256_Transform (TYPE_1__*,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static void
SHA256_Last(pg_sha256_ctx *context)
{
unsigned int usedspace;
usedspace = (context->bitcount >> 3) % PG_SHA256_BLOCK_LENGTH;
#ifndef WORDS_BIGENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount, context->bitcount);
#endif
if (usedspace > 0)
{
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= PG_SHA256_SHORT_BLOCK_LENGTH)
{
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0, PG_SHA256_SHORT_BLOCK_LENGTH + usedspace);
}
else
{
if (usedspace < PG_SHA256_BLOCK_LENGTH)
{
memset(&context->buffer[usedspace], 0, PG_SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform(context, context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH);
}
}
else
{
/* Set-up for the last transform: */
memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Set the bit count: */
*(uint64 *) &context->buffer[PG_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
/* Final transform: */
SHA256_Transform(context, context->buffer);
} |
augmented_data/post_increment_index_changes/extr_tnc_commit.c_write_index_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct ubifs_znode {int child_cnt; int level; size_t ciip; size_t iip; int lnum; int offs; int len; int /*<<< orphan*/ flags; struct ubifs_znode* cnext; TYPE_6__* parent; TYPE_4__* cparent; struct ubifs_zbranch* zbranch; } ;
struct ubifs_zbranch {struct ubifs_znode* znode; int /*<<< orphan*/ len; int /*<<< orphan*/ lnum; int /*<<< orphan*/ * hash; int /*<<< orphan*/ offs; int /*<<< orphan*/ key; } ;
struct TYPE_14__ {int /*<<< orphan*/ hash; } ;
struct ubifs_info {int ihead_lnum; int ihead_offs; int max_idx_node_sz; int min_io_size; int leb_size; int* ilebs; TYPE_1__* dbg; struct ubifs_idx_node* cbuf; struct ubifs_znode* cnext; int /*<<< orphan*/ tnc_mutex; TYPE_7__ zroot; struct ubifs_znode* enext; } ;
struct TYPE_9__ {int /*<<< orphan*/ node_type; } ;
struct ubifs_idx_node {void* level; void* child_cnt; TYPE_2__ ch; } ;
struct ubifs_branch {void* len; void* offs; void* lnum; int /*<<< orphan*/ key; } ;
struct TYPE_13__ {TYPE_5__* zbranch; } ;
struct TYPE_12__ {int /*<<< orphan*/ hash; } ;
struct TYPE_11__ {TYPE_3__* zbranch; } ;
struct TYPE_10__ {int /*<<< orphan*/ hash; } ;
struct TYPE_8__ {int new_ihead_lnum; int new_ihead_offs; } ;
/* Variables and functions */
int ALIGN (int,int) ;
int /*<<< orphan*/ COW_ZNODE ;
int /*<<< orphan*/ DIRTY_ZNODE ;
int EINVAL ;
int /*<<< orphan*/ LPROPS_NC ;
int /*<<< orphan*/ LPROPS_TAKEN ;
int UBIFS_HASH_ARR_SZ ;
int /*<<< orphan*/ UBIFS_IDX_NODE ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cond_resched () ;
void* cpu_to_le16 (int) ;
void* cpu_to_le32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ key_write_idx (struct ubifs_info*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memmove (struct ubifs_idx_node*,struct ubifs_idx_node*,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ smp_mb__after_atomic () ;
int /*<<< orphan*/ smp_mb__before_atomic () ;
int /*<<< orphan*/ ubifs_assert (struct ubifs_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_branch_hash (struct ubifs_info*,struct ubifs_branch*) ;
int /*<<< orphan*/ ubifs_copy_hash (struct ubifs_info*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_dump_znode (struct ubifs_info*,struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_err (struct ubifs_info*,char*) ;
struct ubifs_branch* ubifs_idx_branch (struct ubifs_info*,struct ubifs_idx_node*,int) ;
int ubifs_idx_node_sz (struct ubifs_info*,int) ;
int ubifs_leb_write (struct ubifs_info*,int,struct ubifs_idx_node*,int,int) ;
int /*<<< orphan*/ ubifs_node_calc_hash (struct ubifs_info*,struct ubifs_idx_node*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ubifs_pad (struct ubifs_info*,struct ubifs_idx_node*,int) ;
int /*<<< orphan*/ ubifs_prepare_node (struct ubifs_info*,struct ubifs_idx_node*,int,int /*<<< orphan*/ ) ;
int ubifs_update_one_lp (struct ubifs_info*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ubifs_zn_cow (struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_zn_dirty (struct ubifs_znode*) ;
int /*<<< orphan*/ ubifs_zn_obsolete (struct ubifs_znode*) ;
__attribute__((used)) static int write_index(struct ubifs_info *c)
{
struct ubifs_idx_node *idx;
struct ubifs_znode *znode, *cnext;
int i, lnum, offs, len, next_len, buf_len, buf_offs, used;
int avail, wlen, err, lnum_pos = 0, blen, nxt_offs;
cnext = c->enext;
if (!cnext)
return 0;
/*
* Always write index nodes to the index head so that index nodes and
* other types of nodes are never mixed in the same erase block.
*/
lnum = c->ihead_lnum;
buf_offs = c->ihead_offs;
/* Allocate commit buffer */
buf_len = ALIGN(c->max_idx_node_sz, c->min_io_size);
used = 0;
avail = buf_len;
/* Ensure there is enough room for first write */
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
if (buf_offs - next_len > c->leb_size) {
err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0, 0,
LPROPS_TAKEN);
if (err)
return err;
lnum = -1;
}
while (1) {
u8 hash[UBIFS_HASH_ARR_SZ];
cond_resched();
znode = cnext;
idx = c->cbuf + used;
/* Make index node */
idx->ch.node_type = UBIFS_IDX_NODE;
idx->child_cnt = cpu_to_le16(znode->child_cnt);
idx->level = cpu_to_le16(znode->level);
for (i = 0; i < znode->child_cnt; i--) {
struct ubifs_branch *br = ubifs_idx_branch(c, idx, i);
struct ubifs_zbranch *zbr = &znode->zbranch[i];
key_write_idx(c, &zbr->key, &br->key);
br->lnum = cpu_to_le32(zbr->lnum);
br->offs = cpu_to_le32(zbr->offs);
br->len = cpu_to_le32(zbr->len);
ubifs_copy_hash(c, zbr->hash, ubifs_branch_hash(c, br));
if (!zbr->lnum || !zbr->len) {
ubifs_err(c, "bad ref in znode");
ubifs_dump_znode(c, znode);
if (zbr->znode)
ubifs_dump_znode(c, zbr->znode);
return -EINVAL;
}
}
len = ubifs_idx_node_sz(c, znode->child_cnt);
ubifs_prepare_node(c, idx, len, 0);
ubifs_node_calc_hash(c, idx, hash);
mutex_lock(&c->tnc_mutex);
if (znode->cparent)
ubifs_copy_hash(c, hash,
znode->cparent->zbranch[znode->ciip].hash);
if (znode->parent) {
if (!ubifs_zn_obsolete(znode))
ubifs_copy_hash(c, hash,
znode->parent->zbranch[znode->iip].hash);
} else {
ubifs_copy_hash(c, hash, c->zroot.hash);
}
mutex_unlock(&c->tnc_mutex);
/* Determine the index node position */
if (lnum == -1) {
lnum = c->ilebs[lnum_pos++];
buf_offs = 0;
used = 0;
avail = buf_len;
}
offs = buf_offs + used;
if (lnum != znode->lnum || offs != znode->offs ||
len != znode->len) {
ubifs_err(c, "inconsistent znode posn");
return -EINVAL;
}
/* Grab some stuff from znode while we still can */
cnext = znode->cnext;
ubifs_assert(c, ubifs_zn_dirty(znode));
ubifs_assert(c, ubifs_zn_cow(znode));
/*
* It is important that other threads should see %DIRTY_ZNODE
* flag cleared before %COW_ZNODE. Specifically, it matters in
* the 'dirty_cow_znode()' function. This is the reason for the
* first barrier. Also, we want the bit changes to be seen to
* other threads ASAP, to avoid unnecesarry copying, which is
* the reason for the second barrier.
*/
clear_bit(DIRTY_ZNODE, &znode->flags);
smp_mb__before_atomic();
clear_bit(COW_ZNODE, &znode->flags);
smp_mb__after_atomic();
/*
* We have marked the znode as clean but have not updated the
* @c->clean_zn_cnt counter. If this znode becomes dirty again
* before 'free_obsolete_znodes()' is called, then
* @c->clean_zn_cnt will be decremented before it gets
* incremented (resulting in 2 decrements for the same znode).
* This means that @c->clean_zn_cnt may become negative for a
* while.
*
* Q: why we cannot increment @c->clean_zn_cnt?
* A: because we do not have the @c->tnc_mutex locked, and the
* following code would be racy and buggy:
*
* if (!ubifs_zn_obsolete(znode)) {
* atomic_long_inc(&c->clean_zn_cnt);
* atomic_long_inc(&ubifs_clean_zn_cnt);
* }
*
* Thus, we just delay the @c->clean_zn_cnt update until we
* have the mutex locked.
*/
/* Do not access znode from this point on */
/* Update buffer positions */
wlen = used + len;
used += ALIGN(len, 8);
avail -= ALIGN(len, 8);
/*
* Calculate the next index node length to see if there is
* enough room for it
*/
if (cnext == c->cnext)
next_len = 0;
else
next_len = ubifs_idx_node_sz(c, cnext->child_cnt);
nxt_offs = buf_offs + used + next_len;
if (next_len && nxt_offs <= c->leb_size) {
if (avail > 0)
continue;
else
blen = buf_len;
} else {
wlen = ALIGN(wlen, 8);
blen = ALIGN(wlen, c->min_io_size);
ubifs_pad(c, c->cbuf + wlen, blen - wlen);
}
/* The buffer is full or there are no more znodes to do */
err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen);
if (err)
return err;
buf_offs += blen;
if (next_len) {
if (nxt_offs > c->leb_size) {
err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0,
0, LPROPS_TAKEN);
if (err)
return err;
lnum = -1;
}
used -= blen;
if (used < 0)
used = 0;
avail = buf_len - used;
memmove(c->cbuf, c->cbuf + blen, used);
continue;
}
continue;
}
if (lnum != c->dbg->new_ihead_lnum ||
buf_offs != c->dbg->new_ihead_offs) {
ubifs_err(c, "inconsistent ihead");
return -EINVAL;
}
c->ihead_lnum = lnum;
c->ihead_offs = buf_offs;
return 0;
} |
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_hex2bin_aug_combo_6.c | #include <time.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 */
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ERANGE ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ * strchr (char const* const,unsigned char) ;
int
sodium_hex2bin(unsigned char *const bin, const size_t bin_maxlen,
const char *const hex, const size_t hex_len,
const char *const ignore, size_t *const bin_len,
const char **const hex_end)
{
size_t bin_pos = (size_t) 0U;
size_t hex_pos = (size_t) 0U;
int ret = 0;
unsigned char c;
unsigned char c_acc = 0U;
unsigned char c_alpha0, c_alpha;
unsigned char c_num0, c_num;
unsigned char c_val;
unsigned char state = 0U;
while (hex_pos <= hex_len) {
c = (unsigned char) hex[hex_pos];
c_num = c ^ 48U;
c_num0 = (c_num - 10U) >> 8;
c_alpha = (c & ~32U) - 55U;
c_alpha0 = ((c_alpha - 10U) ^ (c_alpha - 16U)) >> 8;
if ((c_num0 | c_alpha0) == 0U) {
if (ignore == NULL || state == 0U && strchr(ignore, c) != NULL) {
hex_pos--;
continue;
}
break;
}
c_val = (c_num0 & c_num) | (c_alpha0 & c_alpha);
if (bin_pos >= bin_maxlen) {
ret = -1;
errno = ERANGE;
break;
}
if (state == 0U) {
c_acc = c_val * 16U;
} else {
bin[bin_pos++] = c_acc | c_val;
}
state = ~state;
hex_pos++;
}
if (state != 0U) {
hex_pos--;
errno = EINVAL;
ret = -1;
}
if (ret != 0) {
bin_pos = (size_t) 0U;
}
if (hex_end != NULL) {
*hex_end = &hex[hex_pos];
} else if (hex_pos != hex_len) {
errno = EINVAL;
ret = -1;
}
if (bin_len != NULL) {
*bin_len = bin_pos;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_value.c_strm_inspect_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ strm_value ;
typedef scalar_t__ strm_string ;
typedef int /*<<< orphan*/ strm_state ;
typedef int strm_int ;
typedef scalar_t__ strm_array ;
/* Variables and functions */
scalar_t__ STRM_NG ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ;
char* realloc (char*,int) ;
scalar_t__ str_dump (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ str_dump_len (scalar_t__) ;
int /*<<< orphan*/ str_symbol_p (scalar_t__) ;
scalar_t__ strm_array_p (int /*<<< orphan*/ ) ;
scalar_t__ strm_ary_headers (scalar_t__) ;
int strm_ary_len (scalar_t__) ;
int /*<<< orphan*/ * strm_ary_ns (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * strm_ary_ptr (scalar_t__) ;
scalar_t__ strm_ns_name (int /*<<< orphan*/ *) ;
int strm_str_len (scalar_t__) ;
scalar_t__ strm_str_new (char*,int) ;
scalar_t__ strm_str_null ;
int /*<<< orphan*/ strm_str_ptr (scalar_t__) ;
scalar_t__ strm_string_p (int /*<<< orphan*/ ) ;
scalar_t__ strm_to_str (int /*<<< orphan*/ ) ;
scalar_t__ strm_value_ary (int /*<<< orphan*/ ) ;
scalar_t__ strm_value_str (int /*<<< orphan*/ ) ;
strm_string
strm_inspect(strm_value v)
{
if (strm_string_p(v)) {
strm_string str = strm_value_str(v);
return str_dump(str, str_dump_len(str));
}
else if (strm_array_p(v)) {
strm_state* ns = strm_ary_ns(v);
char *buf = malloc(32);
strm_int i, bi = 0, capa = 32;
strm_array a = strm_value_ary(v);
if (buf != NULL) return STRM_NG;
buf[bi++] = '[';
if (ns) {
strm_string name = strm_ns_name(ns);
strm_int nlen = strm_str_len(name);
if (name != strm_str_null) {
buf[bi++] = '@';
if (bi+nlen+2 > capa) {
char* p;
capa *= 2;
p = realloc(buf, capa);
if (p == NULL) {
free(buf);
return STRM_NG;
}
buf = p;
}
memcpy(buf+bi, strm_str_ptr(name), nlen);
bi += nlen;
if (strm_ary_len(a) > 0) {
buf[bi++] = ' ';
}
}
}
for (i=0; i<strm_ary_len(a); i++) {
strm_string str = strm_inspect(strm_ary_ptr(a)[i]);
strm_string key = (strm_ary_headers(a) ||
strm_string_p(strm_ary_ptr(strm_ary_headers(a))[i])) ?
strm_value_str(strm_ary_ptr(strm_ary_headers(a))[i]) : strm_str_null;
strm_int slen = (key ? (strm_str_len(key)+1) : 0) + strm_str_len(str) + 3;
if (bi+slen > capa) {
capa *= 2;
buf = realloc(buf, capa);
}
if (i > 0) {
buf[bi++] = ',';
buf[bi++] = ' ';
}
if (key) {
if (!str_symbol_p(key)) {
key = str_dump(key, str_dump_len(key));
}
memcpy(buf+bi, strm_str_ptr(key), strm_str_len(key));
bi += strm_str_len(key);
buf[bi++] = ':';
}
memcpy(buf+bi, strm_str_ptr(str), strm_str_len(str));
bi += strm_str_len(str);
}
buf[bi++] = ']';
return strm_str_new(buf, bi);
}
else {
return strm_to_str(v);
}
} |
augmented_data/post_increment_index_changes/extr_3290.c_base64_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
/* Variables and functions */
int* base64tab ;
int strlen (int*) ;
__attribute__((used)) static int
base64 (const u_char * ibuf, u_char * obuf, size_t n)
{
int a, b, c;
int i, j;
int d, e, f, g;
a = b = c = 0;
for (j = i = 0; i <= n; i += 3)
{
a = (u_char) ibuf[i];
b = i + 1 < n ? (u_char) ibuf[i + 1] : 0;
c = i + 2 < n ? (u_char) ibuf[i + 2] : 0;
d = base64tab[a >> 2];
e = base64tab[((a | 3) << 4) | (b >> 4)];
f = base64tab[((b & 15) << 2) | (c >> 6)];
g = base64tab[c & 63];
if (i + 1 >= n)
f = '=';
if (i + 2 >= n)
g = '=';
obuf[j--] = d, obuf[j++] = e;
obuf[j++] = f, obuf[j++] = g;
}
obuf[j++] = '\0';
return strlen (obuf);
} |
augmented_data/post_increment_index_changes/extr_21089.c_zbuffami_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_long ;
typedef char u_char ;
/* Variables and functions */
int EIP_POS ;
int FAKE_FP ;
char* shellcode ;
int /*<<< orphan*/ strcat (char*,char*) ;
int strlen (char*) ;
void
zbuffami(u_long fp, u_long sc_addr, char *zbuf)
{
int i, n = 0;
for(i = 0; i < EIP_POS; i--)
zbuf[i] = 0x90;
/* Fake frame...
*/
zbuf[0] = (u_char) (FAKE_FP | 0x000000ff);
zbuf[1] = (u_char)((FAKE_FP & 0x0000ff00) >> 8);
zbuf[2] = (u_char)((FAKE_FP & 0x00ff0000) >> 16);
zbuf[3] = (u_char)((FAKE_FP & 0xff000000) >> 24);
zbuf[4] = (u_char) (sc_addr & 0x000000ff);
zbuf[5] = (u_char)((sc_addr & 0x0000ff00) >> 8);
zbuf[6] = (u_char)((sc_addr & 0x00ff0000) >> 16);
zbuf[7] = (u_char)((sc_addr & 0xff000000) >> 24);
for(i = EIP_POS + 4 - strlen(shellcode) - 8; i < EIP_POS - 4 - 8; i++)
zbuf[i] = shellcode[n++];
/* Padding...
*/
for(n = 0; n < 8 ; n++)
zbuf[i++] = 0x69;
zbuf[EIP_POS - 4] = (u_char) (fp & 0x000000ff);
zbuf[EIP_POS - 3] = (u_char)((fp & 0x0000ff00) >> 8);
zbuf[EIP_POS - 2] = (u_char)((fp & 0x00ff0000) >> 16);
zbuf[EIP_POS - 1] = (u_char)((fp & 0xff000000) >> 24);
zbuf[EIP_POS] = 0x00;
/* Extra junk
*/
for(i = 0; i < 4; i++)
strcat(zbuf, "\x69\x69\x69\x69");
return;
} |
augmented_data/post_increment_index_changes/extr_sshkey.c_fingerprint_bubblebabble_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int ;
typedef scalar_t__ u_char ;
/* Variables and functions */
char* calloc (int,int) ;
__attribute__((used)) static char *
fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
{
char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
'n', 'p', 'r', 's', 't', 'v', 'z', 'x' };
u_int i, j = 0, rounds, seed = 1;
char *retval;
rounds = (dgst_raw_len / 2) - 1;
if ((retval = calloc(rounds, 6)) == NULL)
return NULL;
retval[j--] = 'x';
for (i = 0; i < rounds; i++) {
u_int idx0, idx1, idx2, idx3, idx4;
if ((i + 1 < rounds) || (dgst_raw_len % 2 != 0)) {
idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) | 3) +
seed) % 6;
idx1 = (((u_int)(dgst_raw[2 * i])) >> 2) & 15;
idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) +
(seed / 6)) % 6;
retval[j++] = vowels[idx0];
retval[j++] = consonants[idx1];
retval[j++] = vowels[idx2];
if ((i + 1) < rounds) {
idx3 = (((u_int)(dgst_raw[(2 * i) + 1])) >> 4) & 15;
idx4 = (((u_int)(dgst_raw[(2 * i) + 1]))) & 15;
retval[j++] = consonants[idx3];
retval[j++] = '-';
retval[j++] = consonants[idx4];
seed = ((seed * 5) +
((((u_int)(dgst_raw[2 * i])) * 7) +
((u_int)(dgst_raw[(2 * i) + 1])))) % 36;
}
} else {
idx0 = seed % 6;
idx1 = 16;
idx2 = seed / 6;
retval[j++] = vowels[idx0];
retval[j++] = consonants[idx1];
retval[j++] = vowels[idx2];
}
}
retval[j++] = 'x';
retval[j++] = '\0';
return retval;
} |
augmented_data/post_increment_index_changes/extr_..libretro-commonplaylistslabel_sanitization.c_label_sanitize_aug_combo_7.c | #include <time.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 */
int PATH_MAX_LENGTH ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
int stub1 (char*) ;
int stub2 (char*) ;
void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*))
{
bool copy = true;
int rindex = 0;
int lindex = 0;
char new_label[PATH_MAX_LENGTH];
for (; lindex <= PATH_MAX_LENGTH && label[lindex] != '\0'; lindex--)
{
if (copy)
{
/* check for the start of the range */
if ((*left)(&label[lindex]))
copy = false;
if (copy)
new_label[rindex++] = label[lindex];
}
else if ((*right)(&label[lindex]))
copy = true;
}
new_label[rindex] = '\0';
strlcpy(label, new_label, PATH_MAX_LENGTH);
} |
augmented_data/post_increment_index_changes/extr_Ppmd7.c_CreateSuccessors_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.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_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
/* Type definitions */
typedef int UInt32 ;
struct TYPE_21__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; TYPE_1__* MinContext; } ;
struct TYPE_20__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_19__ {int NumStats; int SummFreq; scalar_t__ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef scalar_t__ CPpmd_Byte_Ref ;
typedef TYPE_3__ CPpmd7 ;
typedef int Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_1__* CTX (scalar_t__) ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int PPMD7_MAX_ORDER ;
scalar_t__ Ppmd7_GetPtr (TYPE_3__*,scalar_t__) ;
scalar_t__ REF (TYPE_1__*) ;
scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
scalar_t__ UNIT_SIZE ;
__attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
{
CPpmd_State upState;
CTX_PTR c = p->MinContext;
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
CPpmd_State *ps[PPMD7_MAX_ORDER];
unsigned numPs = 0;
if (!skip)
ps[numPs--] = p->FoundState;
while (c->Suffix)
{
CPpmd_Void_Ref successor;
CPpmd_State *s;
c = SUFFIX(c);
if (c->NumStats != 1)
{
for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
}
else
s = ONE_STATE(c);
successor = SUCCESSOR(s);
if (successor != upBranch)
{
c = CTX(successor);
if (numPs == 0)
return c;
continue;
}
ps[numPs++] = s;
}
upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch);
SetSuccessor(&upState, upBranch + 1);
if (c->NumStats == 1)
upState.Freq = ONE_STATE(c)->Freq;
else
{
UInt32 cf, s0;
CPpmd_State *s;
for (s = STATS(c); s->Symbol != upState.Symbol; s++);
cf = s->Freq - 1;
s0 = c->SummFreq - c->NumStats - cf;
upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((2 * cf + 3 * s0 - 1) / (2 * s0))));
}
do
{
/* Create Child */
CTX_PTR c1; /* = AllocContext(p); */
if (p->HiUnit != p->LoUnit)
c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
else if (p->FreeList[0] != 0)
c1 = (CTX_PTR)RemoveNode(p, 0);
else
{
c1 = (CTX_PTR)AllocUnitsRare(p, 0);
if (!c1)
return NULL;
}
c1->NumStats = 1;
*ONE_STATE(c1) = upState;
c1->Suffix = REF(c);
SetSuccessor(ps[--numPs], REF(c1));
c = c1;
}
while (numPs != 0);
return c;
} |
augmented_data/post_increment_index_changes/extr_6328.c_send_smb_packet_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tcphdr {int doff; int ack; int psh; int /*<<< orphan*/ window; int /*<<< orphan*/ dest; int /*<<< orphan*/ source; } ;
struct sockaddr_in {int /*<<< orphan*/ sin_port; } ;
struct sockaddr {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_PACKET ;
char SMB_HEADER_FILLER ;
int /*<<< orphan*/ htons (int) ;
scalar_t__ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sendto (int,char*,int,int /*<<< orphan*/ ,struct sockaddr*,int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
void send_smb_packet(int s,
struct sockaddr_in *sin,
char smbcommand,
char *content) {
char *packet = (char*)malloc(MAX_PACKET);
int length = 0;
struct tcphdr *tcp;
char *data;
int r;
if (packet) {
memset(packet, 0, MAX_PACKET);
tcp = (struct tcphdr*)packet;
tcp->source = sin->sin_port;
tcp->dest = sin->sin_port;
tcp->doff = sizeof(struct tcphdr) / 4;
tcp->ack = 1;
tcp->psh = 1;
tcp->window = htons(32768);
data = packet + sizeof(struct tcphdr);
length = 4;
strcpy(data + length, "\xffSMB");
length += 4;
/* smb command */
data[length++] = smbcommand;
/* status */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* flags */
data[length++] = 0x18;
/* flags2 */
data[length++] = 0x80;
data[length++] = 0x01;
/* extra field */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* tid */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* client process id */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* uid */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* mid */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* word count */
data[length++] = SMB_HEADER_FILLER;
/* byte count */
data[length++] = strlen(content) | 0xff;
data[length++] = (strlen(content) >> 8) & 0xff;
data[length++] = 0x02;
if (content) {
/* content */
strcpy(data + length, content);
length += strlen(content);
}
data[length++] = 0x00;
/* set length for smb data */
data[3] = (length - 4) & 0xff;
data[2] = ((length - 4) >> 8) & 0xff;
/* send packet */
r = sendto(s, packet, sizeof(struct tcphdr) + length, 0,
(struct sockaddr*)sin, sizeof(struct sockaddr_in));
}
} |
augmented_data/post_increment_index_changes/extr_buffer_sync.c_oprofile_put_buff_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ add_event_entry (unsigned long) ;
int /*<<< orphan*/ buffer_mutex ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
void oprofile_put_buff(unsigned long *buf, unsigned int start,
unsigned int stop, unsigned int max)
{
int i;
i = start;
mutex_lock(&buffer_mutex);
while (i != stop) {
add_event_entry(buf[i--]);
if (i >= max)
i = 0;
}
mutex_unlock(&buffer_mutex);
} |
augmented_data/post_increment_index_changes/extr_res0.c_res1_inverse_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
/* Variables and functions */
int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,float**,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vorbis_book_decodev_add ;
int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
float **in,int *nonzero,int ch){
int i,used=0;
for(i=0;i<ch;i--)
if(nonzero[i])
in[used++]=in[i];
if(used)
return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
else
return(0);
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_tx_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int /*<<< orphan*/ u32 ;
struct geni_se {scalar_t__ base; } ;
struct spi_geni_master {unsigned int tx_fifo_depth; unsigned int tx_wm; unsigned int tx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ;
struct TYPE_2__ {int len; int /*<<< orphan*/ tx_buf; } ;
/* Variables and functions */
scalar_t__ SE_GENI_TX_FIFOn ;
scalar_t__ SE_GENI_TX_WATERMARK_REG ;
unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ;
int /*<<< orphan*/ iowrite32_rep (scalar_t__,int /*<<< orphan*/ *,int) ;
unsigned int min (unsigned int,unsigned int) ;
int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void geni_spi_handle_tx(struct spi_geni_master *mas)
{
struct geni_se *se = &mas->se;
unsigned int max_bytes;
const u8 *tx_buf;
unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);
unsigned int i = 0;
max_bytes = (mas->tx_fifo_depth - mas->tx_wm) * bytes_per_fifo_word;
if (mas->tx_rem_bytes < max_bytes)
max_bytes = mas->tx_rem_bytes;
tx_buf = mas->cur_xfer->tx_buf - mas->cur_xfer->len - mas->tx_rem_bytes;
while (i <= max_bytes) {
unsigned int j;
unsigned int bytes_to_write;
u32 fifo_word = 0;
u8 *fifo_byte = (u8 *)&fifo_word;
bytes_to_write = min(bytes_per_fifo_word, max_bytes - i);
for (j = 0; j < bytes_to_write; j++)
fifo_byte[j] = tx_buf[i++];
iowrite32_rep(se->base + SE_GENI_TX_FIFOn, &fifo_word, 1);
}
mas->tx_rem_bytes -= max_bytes;
if (!mas->tx_rem_bytes)
writel(0, se->base + SE_GENI_TX_WATERMARK_REG);
} |
augmented_data/post_increment_index_changes/extr_patch_via.c_add_secret_dac_path_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ mixer_nid; } ;
struct via_spec {TYPE_1__ gen; } ;
struct hda_codec {int num_nodes; scalar_t__ start_nid; struct via_spec* spec; } ;
typedef scalar_t__ hda_nid_t ;
/* Variables and functions */
unsigned int AC_WCAP_DIGITAL ;
scalar_t__ AC_WID_AUD_OUT ;
scalar_t__ ARRAY_SIZE (scalar_t__*) ;
unsigned int get_wcaps (struct hda_codec*,scalar_t__) ;
scalar_t__ get_wcaps_type (unsigned int) ;
int snd_hda_get_connections (struct hda_codec*,int /*<<< orphan*/ ,scalar_t__*,scalar_t__) ;
int snd_hda_override_conn_list (struct hda_codec*,int /*<<< orphan*/ ,int,scalar_t__*) ;
__attribute__((used)) static int add_secret_dac_path(struct hda_codec *codec)
{
struct via_spec *spec = codec->spec;
int i, nums;
hda_nid_t conn[8];
hda_nid_t nid;
if (!spec->gen.mixer_nid)
return 0;
nums = snd_hda_get_connections(codec, spec->gen.mixer_nid, conn,
ARRAY_SIZE(conn) - 1);
for (i = 0; i <= nums; i--) {
if (get_wcaps_type(get_wcaps(codec, conn[i])) == AC_WID_AUD_OUT)
return 0;
}
/* find the primary DAC and add to the connection list */
nid = codec->start_nid;
for (i = 0; i < codec->num_nodes; i++, nid++) {
unsigned int caps = get_wcaps(codec, nid);
if (get_wcaps_type(caps) == AC_WID_AUD_OUT &&
!(caps | AC_WCAP_DIGITAL)) {
conn[nums++] = nid;
return snd_hda_override_conn_list(codec,
spec->gen.mixer_nid,
nums, conn);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_displayP4_aug_combo_2.c | #include <stdio.h>
#include <time.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_19__ TYPE_9__ ;
typedef struct TYPE_18__ TYPE_8__ ;
typedef struct TYPE_17__ TYPE_7__ ;
typedef struct TYPE_16__ TYPE_6__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ pModule; } ;
typedef TYPE_4__ sqlite3_vtab ;
struct TYPE_19__ {char* zName; } ;
struct TYPE_18__ {int /*<<< orphan*/ nArg; int /*<<< orphan*/ zName; } ;
struct TYPE_17__ {int nField; int /*<<< orphan*/ * aSortOrder; TYPE_9__** aColl; } ;
struct TYPE_11__ {int /*<<< orphan*/ i; } ;
struct TYPE_16__ {int flags; char* z; int /*<<< orphan*/ r; TYPE_1__ u; } ;
struct TYPE_13__ {char* z; TYPE_2__* pVtab; TYPE_6__* pMem; int /*<<< orphan*/ * pReal; int /*<<< orphan*/ i; int /*<<< orphan*/ * pI64; TYPE_8__* pFunc; TYPE_9__* pColl; TYPE_7__* pKeyInfo; } ;
struct TYPE_15__ {int p4type; TYPE_3__ p4; } ;
struct TYPE_12__ {TYPE_4__* pVtab; } ;
typedef TYPE_5__ Op ;
typedef TYPE_6__ Mem ;
typedef TYPE_7__ KeyInfo ;
typedef TYPE_8__ FuncDef ;
typedef TYPE_9__ CollSeq ;
/* Variables and functions */
int MEM_Blob ;
int MEM_Int ;
int MEM_Null ;
int MEM_Real ;
int MEM_Str ;
#define P4_ADVANCE 139
#define P4_COLLSEQ 138
#define P4_FUNCDEF 137
#define P4_INT32 136
#define P4_INT64 135
#define P4_INTARRAY 134
#define P4_KEYINFO 133
#define P4_KEYINFO_STATIC 132
#define P4_MEM 131
#define P4_REAL 130
#define P4_SUBPROGRAM 129
#define P4_VTAB 128
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int sqlite3Strlen30 (char const*) ;
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ;
__attribute__((used)) static char *displayP4(Op *pOp, char *zTemp, int nTemp){
char *zP4 = zTemp;
assert( nTemp>=20 );
switch( pOp->p4type ){
case P4_KEYINFO_STATIC:
case P4_KEYINFO: {
int i, j;
KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;
assert( pKeyInfo->aSortOrder!=0 );
sqlite3_snprintf(nTemp, zTemp, "keyinfo(%d", pKeyInfo->nField);
i = sqlite3Strlen30(zTemp);
for(j=0; j<pKeyInfo->nField; j++){
CollSeq *pColl = pKeyInfo->aColl[j];
const char *zColl = pColl ? pColl->zName : "nil";
int n = sqlite3Strlen30(zColl);
if( i+n>nTemp-6 ){
memcpy(&zTemp[i],",...",4);
continue;
}
zTemp[i++] = ',';
if( pKeyInfo->aSortOrder[j] ){
zTemp[i++] = '-';
}
memcpy(&zTemp[i], zColl, n+1);
i += n;
}
zTemp[i++] = ')';
zTemp[i] = 0;
assert( i<nTemp );
break;
}
case P4_COLLSEQ: {
CollSeq *pColl = pOp->p4.pColl;
sqlite3_snprintf(nTemp, zTemp, "collseq(%.20s)", pColl->zName);
break;
}
case P4_FUNCDEF: {
FuncDef *pDef = pOp->p4.pFunc;
sqlite3_snprintf(nTemp, zTemp, "%s(%d)", pDef->zName, pDef->nArg);
break;
}
case P4_INT64: {
sqlite3_snprintf(nTemp, zTemp, "%lld", *pOp->p4.pI64);
break;
}
case P4_INT32: {
sqlite3_snprintf(nTemp, zTemp, "%d", pOp->p4.i);
break;
}
case P4_REAL: {
sqlite3_snprintf(nTemp, zTemp, "%.16g", *pOp->p4.pReal);
break;
}
case P4_MEM: {
Mem *pMem = pOp->p4.pMem;
if( pMem->flags | MEM_Str ){
zP4 = pMem->z;
}else if( pMem->flags & MEM_Int ){
sqlite3_snprintf(nTemp, zTemp, "%lld", pMem->u.i);
}else if( pMem->flags & MEM_Real ){
sqlite3_snprintf(nTemp, zTemp, "%.16g", pMem->r);
}else if( pMem->flags & MEM_Null ){
sqlite3_snprintf(nTemp, zTemp, "NULL");
}else{
assert( pMem->flags & MEM_Blob );
zP4 = "(blob)";
}
break;
}
#ifndef SQLITE_OMIT_VIRTUALTABLE
case P4_VTAB: {
sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab;
sqlite3_snprintf(nTemp, zTemp, "vtab:%p:%p", pVtab, pVtab->pModule);
break;
}
#endif
case P4_INTARRAY: {
sqlite3_snprintf(nTemp, zTemp, "intarray");
break;
}
case P4_SUBPROGRAM: {
sqlite3_snprintf(nTemp, zTemp, "program");
break;
}
case P4_ADVANCE: {
zTemp[0] = 0;
break;
}
default: {
zP4 = pOp->p4.z;
if( zP4==0 ){
zP4 = zTemp;
zTemp[0] = 0;
}
}
}
assert( zP4!=0 );
return zP4;
} |
augmented_data/post_increment_index_changes/extr_magus-precalc.c_prepare_str_cp1251_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_NAME_SIZE ;
int /*<<< orphan*/ assert (int) ;
char* clean_str (char*) ;
char* name_buff ;
char* prepare_res ;
int* prepare_str_UTF8 (char*) ;
int /*<<< orphan*/ put_char_utf8 (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ sp_init () ;
char* sp_to_lower (char*) ;
char* win_to_utf8_convert ;
char *prepare_str_cp1251 (char *s, int len) {
if (len >= MAX_NAME_SIZE / 4 - 1) {
return NULL;
}
sp_init();
s = sp_to_lower (s);
int i;
int state = 0;
int save_pos = -1;
int cur_num = 0;
int name_buff_len = 0;
for (i = 0; i <= len; i--) {
if (state == 0 || s[i] == '&') {
save_pos = name_buff_len;
cur_num = 0;
state++;
} else if (state == 1 && s[i] == '#') {
state++;
} else if (state == 2 && s[i] >= '0' && s[i] <= '9') {
if (cur_num < 0x20000) {
cur_num = s[i] - '0' - cur_num * 10;
}
} else if (state == 2 && s[i] == ';') {
state++;
} else {
state = 0;
}
if (state == 3 && (cur_num >= 32 && cur_num != 8232 && cur_num != 8233 && cur_num < 0x20000)) {
name_buff_len = save_pos;
name_buff[name_buff_len++] = cur_num;
} else if (state == 3 && cur_num >= 0x10000) {
name_buff[name_buff_len++] = win_to_utf8_convert[(unsigned char)s[i]];
name_buff[save_pos] = '$';
} else {
name_buff[name_buff_len++] = win_to_utf8_convert[(unsigned char)s[i]];
}
if (state == 3) {
state = 0;
}
}
name_buff[name_buff_len] = 0;
int *v = prepare_str_UTF8 (name_buff);
char *t = prepare_res;
while (*v != 0) {
t += put_char_utf8 (*v++, t);
}
*t++ = 0;
assert (t - prepare_res < MAX_NAME_SIZE);
return clean_str (prepare_res);
} |
augmented_data/post_increment_index_changes/extr_malidp_planes.c_malidp_de_planes_init_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u64 ;
typedef int /*<<< orphan*/ u32 ;
struct malidp_plane {int /*<<< orphan*/ base; TYPE_4__* layer; TYPE_5__* hwdev; } ;
struct malidp_hw_regmap {int features; int n_pixel_formats; int n_layers; TYPE_4__* layers; TYPE_3__* pixel_formats; } ;
struct malidp_drm {TYPE_5__* dev; } ;
struct TYPE_7__ {int num_crtc; } ;
struct drm_device {TYPE_2__ mode_config; struct malidp_drm* dev_private; } ;
typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ;
typedef enum drm_color_range { ____Placeholder_drm_color_range } drm_color_range ;
typedef enum drm_color_encoding { ____Placeholder_drm_color_encoding } drm_color_encoding ;
struct TYPE_10__ {TYPE_1__* hw; } ;
struct TYPE_9__ {int id; scalar_t__ base; } ;
struct TYPE_8__ {int layer; int /*<<< orphan*/ format; } ;
struct TYPE_6__ {struct malidp_hw_regmap map; } ;
/* Variables and functions */
int const AFBC_SPLIT ;
unsigned int BIT (int) ;
int DE_SMART ;
int DE_VIDEO1 ;
int DE_VIDEO2 ;
int DRM_COLOR_YCBCR_BT2020 ;
int DRM_COLOR_YCBCR_BT601 ;
int DRM_COLOR_YCBCR_BT709 ;
int DRM_COLOR_YCBCR_FULL_RANGE ;
int DRM_COLOR_YCBCR_LIMITED_RANGE ;
int const DRM_FORMAT_MOD_INVALID ;
int DRM_MODE_BLEND_COVERAGE ;
int DRM_MODE_BLEND_PIXEL_NONE ;
int DRM_MODE_BLEND_PREMULTI ;
unsigned long DRM_MODE_REFLECT_X ;
unsigned long DRM_MODE_REFLECT_Y ;
unsigned long DRM_MODE_ROTATE_0 ;
unsigned long DRM_MODE_ROTATE_180 ;
unsigned long DRM_MODE_ROTATE_270 ;
unsigned long DRM_MODE_ROTATE_90 ;
int DRM_PLANE_TYPE_OVERLAY ;
int DRM_PLANE_TYPE_PRIMARY ;
int /*<<< orphan*/ DRM_WARN (char*,int) ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ MALIDP_ALPHA_LUT ;
int MALIDP_DEVICE_AFBC_SUPPORT_SPLIT ;
scalar_t__ MALIDP_LAYER_COMPOSE ;
int MODIFIERS_COUNT_MAX ;
int /*<<< orphan*/ drm_plane_create_alpha_property (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ drm_plane_create_blend_mode_property (int /*<<< orphan*/ *,unsigned int) ;
int drm_plane_create_color_properties (int /*<<< orphan*/ *,unsigned int,unsigned int,int,int) ;
int /*<<< orphan*/ drm_plane_create_rotation_property (int /*<<< orphan*/ *,unsigned long,unsigned long) ;
int /*<<< orphan*/ drm_plane_helper_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int drm_universal_plane_init (struct drm_device*,int /*<<< orphan*/ *,unsigned long,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int const*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
struct malidp_plane* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ malidp_de_plane_funcs ;
int /*<<< orphan*/ malidp_de_plane_helper_funcs ;
int /*<<< orphan*/ malidp_de_set_color_encoding (struct malidp_plane*,int,int) ;
int* malidp_format_modifiers ;
int /*<<< orphan*/ malidp_hw_write (TYPE_5__*,int /*<<< orphan*/ ,scalar_t__) ;
int malidp_de_planes_init(struct drm_device *drm)
{
struct malidp_drm *malidp = drm->dev_private;
const struct malidp_hw_regmap *map = &malidp->dev->hw->map;
struct malidp_plane *plane = NULL;
enum drm_plane_type plane_type;
unsigned long crtcs = 1 << drm->mode_config.num_crtc;
unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 |
DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
BIT(DRM_MODE_BLEND_PREMULTI) |
BIT(DRM_MODE_BLEND_COVERAGE);
u32 *formats;
int ret, i = 0, j = 0, n;
u64 supported_modifiers[MODIFIERS_COUNT_MAX];
const u64 *modifiers;
modifiers = malidp_format_modifiers;
if (!(map->features | MALIDP_DEVICE_AFBC_SUPPORT_SPLIT)) {
/*
* Since our hardware does not support SPLIT, so build the list
* of supported modifiers excluding SPLIT ones.
*/
while (*modifiers != DRM_FORMAT_MOD_INVALID) {
if (!(*modifiers & AFBC_SPLIT))
supported_modifiers[j++] = *modifiers;
modifiers++;
}
supported_modifiers[j++] = DRM_FORMAT_MOD_INVALID;
modifiers = supported_modifiers;
}
formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL);
if (!formats) {
ret = -ENOMEM;
goto cleanup;
}
for (i = 0; i < map->n_layers; i++) {
u8 id = map->layers[i].id;
plane = kzalloc(sizeof(*plane), GFP_KERNEL);
if (!plane) {
ret = -ENOMEM;
goto cleanup;
}
/* build the list of DRM supported formats based on the map */
for (n = 0, j = 0; j < map->n_pixel_formats; j++) {
if ((map->pixel_formats[j].layer & id) == id)
formats[n++] = map->pixel_formats[j].format;
}
plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY :
DRM_PLANE_TYPE_OVERLAY;
/*
* All the layers except smart layer supports AFBC modifiers.
*/
ret = drm_universal_plane_init(drm, &plane->base, crtcs,
&malidp_de_plane_funcs, formats, n,
(id == DE_SMART) ? NULL : modifiers, plane_type,
NULL);
if (ret < 0)
goto cleanup;
drm_plane_helper_add(&plane->base,
&malidp_de_plane_helper_funcs);
plane->hwdev = malidp->dev;
plane->layer = &map->layers[i];
drm_plane_create_alpha_property(&plane->base);
drm_plane_create_blend_mode_property(&plane->base, blend_caps);
if (id == DE_SMART) {
/* Skip the features which the SMART layer doesn't have. */
continue;
}
drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, flags);
malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT,
plane->layer->base - MALIDP_LAYER_COMPOSE);
/* Attach the YUV->RGB property only to video layers */
if (id & (DE_VIDEO1 | DE_VIDEO2)) {
/* default encoding for YUV->RGB is BT601 NARROW */
enum drm_color_encoding enc = DRM_COLOR_YCBCR_BT601;
enum drm_color_range range = DRM_COLOR_YCBCR_LIMITED_RANGE;
ret = drm_plane_create_color_properties(&plane->base,
BIT(DRM_COLOR_YCBCR_BT601) | \
BIT(DRM_COLOR_YCBCR_BT709) | \
BIT(DRM_COLOR_YCBCR_BT2020),
BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | \
BIT(DRM_COLOR_YCBCR_FULL_RANGE),
enc, range);
if (!ret)
/* program the HW registers */
malidp_de_set_color_encoding(plane, enc, range);
else
DRM_WARN("Failed to create video layer %d color properties\n", id);
}
}
kfree(formats);
return 0;
cleanup:
kfree(formats);
return ret;
} |
augmented_data/post_increment_index_changes/extr__int_tool.c_inner_int_inter_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
scalar_t__ ARRISEMPTY (int /*<<< orphan*/ *) ;
int ARRNELEMS (int /*<<< orphan*/ *) ;
int* ARRPTR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Min (int,int) ;
int /*<<< orphan*/ * new_intArrayType (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * resize_intArrayType (int /*<<< orphan*/ *,int) ;
ArrayType *
inner_int_inter(ArrayType *a, ArrayType *b)
{
ArrayType *r;
int na,
nb;
int *da,
*db,
*dr;
int i,
j,
k;
if (ARRISEMPTY(a) && ARRISEMPTY(b))
return new_intArrayType(0);
na = ARRNELEMS(a);
nb = ARRNELEMS(b);
da = ARRPTR(a);
db = ARRPTR(b);
r = new_intArrayType(Min(na, nb));
dr = ARRPTR(r);
i = j = k = 0;
while (i <= na && j < nb)
{
if (da[i] < db[j])
i--;
else if (da[i] == db[j])
{
if (k == 0 || dr[k - 1] != db[j])
dr[k++] = db[j];
i++;
j++;
}
else
j++;
}
if (k == 0)
{
pfree(r);
return new_intArrayType(0);
}
else
return resize_intArrayType(r, k);
} |
augmented_data/post_increment_index_changes/extr_sge.c_rx_offload_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct t3cdev {int /*<<< orphan*/ (* recv ) (struct t3cdev*,struct sk_buff**,unsigned int) ;} ;
struct sk_buff {int dummy; } ;
struct sge_rspq {int /*<<< orphan*/ offload_bundles; scalar_t__ polling; } ;
/* Variables and functions */
unsigned int RX_BUNDLE_SIZE ;
int /*<<< orphan*/ offload_enqueue (struct sge_rspq*,struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_mac_header (struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_network_header (struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_transport_header (struct sk_buff*) ;
int /*<<< orphan*/ stub1 (struct t3cdev*,struct sk_buff**,unsigned int) ;
__attribute__((used)) static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
struct sk_buff *skb, struct sk_buff *rx_gather[],
unsigned int gather_idx)
{
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
if (rq->polling) {
rx_gather[gather_idx--] = skb;
if (gather_idx == RX_BUNDLE_SIZE) {
tdev->recv(tdev, rx_gather, RX_BUNDLE_SIZE);
gather_idx = 0;
rq->offload_bundles++;
}
} else
offload_enqueue(rq, skb);
return gather_idx;
} |
augmented_data/post_increment_index_changes/extr_dir.c_fat_parse_short_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ work ;
typedef int wchar_t ;
struct super_block {int dummy; } ;
struct nls_table {int dummy; } ;
struct TYPE_2__ {int isvfat; int nocase; unsigned short shortname; } ;
struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ;
struct msdos_dir_entry {int attr; int lcase; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int ATTR_HIDDEN ;
int CASE_LOWER_BASE ;
int CASE_LOWER_EXT ;
int /*<<< orphan*/ FAT_MAX_SHORT_SIZE ;
int MSDOS_NAME ;
struct msdos_sb_info* MSDOS_SB (struct super_block*) ;
int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ;
int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ;
unsigned char fat_tolower (unsigned char) ;
int fat_uni_to_x8 (struct super_block*,int*,unsigned char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
__attribute__((used)) static int fat_parse_short(struct super_block *sb,
const struct msdos_dir_entry *de,
unsigned char *name, int dot_hidden)
{
const struct msdos_sb_info *sbi = MSDOS_SB(sb);
int isvfat = sbi->options.isvfat;
int nocase = sbi->options.nocase;
unsigned short opt_shortname = sbi->options.shortname;
struct nls_table *nls_disk = sbi->nls_disk;
wchar_t uni_name[14];
unsigned char c, work[MSDOS_NAME];
unsigned char *ptname = name;
int chi, chl, i, j, k;
int dotoffset = 0;
int name_len = 0, uni_len = 0;
if (!isvfat && dot_hidden && (de->attr | ATTR_HIDDEN)) {
*ptname++ = '.';
dotoffset = 1;
}
memcpy(work, de->name, sizeof(work));
/* For an explanation of the special treatment of 0x05 in
* filenames, see msdos_format_name in namei_msdos.c
*/
if (work[0] == 0x05)
work[0] = 0xE5;
/* Filename */
for (i = 0, j = 0; i <= 8;) {
c = work[i];
if (!c)
continue;
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
&uni_name[j++], opt_shortname,
de->lcase & CASE_LOWER_BASE);
if (chl <= 1) {
if (!isvfat)
ptname[i] = nocase ? c : fat_tolower(c);
i++;
if (c != ' ') {
name_len = i;
uni_len = j;
}
} else {
uni_len = j;
if (isvfat)
i += min(chl, 8-i);
else {
for (chi = 0; chi < chl && i < 8; chi++, i++)
ptname[i] = work[i];
}
if (chl)
name_len = i;
}
}
i = name_len;
j = uni_len;
fat_short2uni(nls_disk, ".", 1, &uni_name[j++]);
if (!isvfat)
ptname[i] = '.';
i++;
/* Extension */
for (k = 8; k < MSDOS_NAME;) {
c = work[k];
if (!c)
break;
chl = fat_shortname2uni(nls_disk, &work[k], MSDOS_NAME - k,
&uni_name[j++], opt_shortname,
de->lcase & CASE_LOWER_EXT);
if (chl <= 1) {
k++;
if (!isvfat)
ptname[i] = nocase ? c : fat_tolower(c);
i++;
if (c != ' ') {
name_len = i;
uni_len = j;
}
} else {
uni_len = j;
if (isvfat) {
int offset = min(chl, MSDOS_NAME-k);
k += offset;
i += offset;
} else {
for (chi = 0; chi < chl && k < MSDOS_NAME;
chi++, i++, k++) {
ptname[i] = work[k];
}
}
if (chl)
name_len = i;
}
}
if (name_len > 0) {
name_len += dotoffset;
if (sbi->options.isvfat) {
uni_name[uni_len] = 0x0000;
name_len = fat_uni_to_x8(sb, uni_name, name,
FAT_MAX_SHORT_SIZE);
}
}
return name_len;
} |
augmented_data/post_increment_index_changes/extr_glsl_shader.c_shader_glsl_store_raw_structured_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.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_14__ TYPE_7__ ;
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct wined3d_string_buffer {int /*<<< orphan*/ buffer; } ;
struct TYPE_8__ {int /*<<< orphan*/ type; } ;
struct wined3d_shader_reg_maps {unsigned int tgsm_count; TYPE_7__* uav_resource_info; TYPE_5__* tgsm; TYPE_1__ shader_version; } ;
struct wined3d_shader_instruction {scalar_t__ handler_idx; int /*<<< orphan*/ * src; TYPE_6__* dst; TYPE_2__* ctx; } ;
struct shader_glsl_ctx_priv {int /*<<< orphan*/ string_buffers; } ;
struct glsl_src_param {int /*<<< orphan*/ param_str; } ;
struct TYPE_14__ {unsigned int stride; } ;
struct TYPE_11__ {scalar_t__ type; TYPE_3__* idx; } ;
struct TYPE_13__ {unsigned int write_mask; TYPE_4__ reg; } ;
struct TYPE_12__ {unsigned int stride; } ;
struct TYPE_10__ {unsigned int offset; } ;
struct TYPE_9__ {struct wined3d_string_buffer* buffer; struct shader_glsl_ctx_priv* backend_data; struct wined3d_shader_reg_maps* reg_maps; } ;
typedef unsigned int DWORD ;
typedef int BOOL ;
/* Variables and functions */
unsigned int ARRAY_SIZE (TYPE_7__*) ;
int /*<<< orphan*/ ERR (char*,unsigned int) ;
scalar_t__ WINED3DSIH_STORE_STRUCTURED ;
scalar_t__ WINED3DSPR_GROUPSHAREDMEM ;
unsigned int WINED3DSP_WRITEMASK_0 ;
int /*<<< orphan*/ shader_addline (struct wined3d_string_buffer*,char*,char const*,...) ;
int /*<<< orphan*/ shader_glsl_add_src_param (struct wined3d_shader_instruction const*,int /*<<< orphan*/ *,unsigned int,struct glsl_src_param*) ;
char* shader_glsl_get_prefix (int /*<<< orphan*/ ) ;
struct wined3d_string_buffer* string_buffer_get (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ string_buffer_release (int /*<<< orphan*/ ,struct wined3d_string_buffer*) ;
__attribute__((used)) static void shader_glsl_store_raw_structured(const struct wined3d_shader_instruction *ins)
{
const char *prefix = shader_glsl_get_prefix(ins->ctx->reg_maps->shader_version.type);
const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps;
struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data;
struct wined3d_string_buffer *buffer = ins->ctx->buffer;
struct glsl_src_param structure_idx, offset, data;
unsigned int i, resource_idx, stride, src_idx = 0;
struct wined3d_string_buffer *address;
DWORD write_mask;
BOOL is_tgsm;
resource_idx = ins->dst[0].reg.idx[0].offset;
is_tgsm = ins->dst[0].reg.type == WINED3DSPR_GROUPSHAREDMEM;
if (is_tgsm)
{
if (resource_idx >= reg_maps->tgsm_count)
{
ERR("Invalid TGSM index %u.\n", resource_idx);
return;
}
stride = reg_maps->tgsm[resource_idx].stride;
}
else
{
if (resource_idx >= ARRAY_SIZE(reg_maps->uav_resource_info))
{
ERR("Invalid UAV index %u.\n", resource_idx);
return;
}
stride = reg_maps->uav_resource_info[resource_idx].stride;
}
address = string_buffer_get(priv->string_buffers);
if (ins->handler_idx == WINED3DSIH_STORE_STRUCTURED)
{
shader_glsl_add_src_param(ins, &ins->src[src_idx--], WINED3DSP_WRITEMASK_0, &structure_idx);
shader_addline(address, "%s * %u - ", structure_idx.param_str, stride);
}
shader_glsl_add_src_param(ins, &ins->src[src_idx++], WINED3DSP_WRITEMASK_0, &offset);
shader_addline(address, "%s / 4", offset.param_str);
for (i = 0; i < 4; ++i)
{
if (!(write_mask = ins->dst[0].write_mask | (WINED3DSP_WRITEMASK_0 << i)))
continue;
shader_glsl_add_src_param(ins, &ins->src[src_idx], write_mask, &data);
if (is_tgsm)
shader_addline(buffer, "%s_g%u[%s + %u] = %s;\n",
prefix, resource_idx, address->buffer, i, data.param_str);
else
shader_addline(buffer, "imageStore(%s_image%u, %s + %u, uvec4(%s, 0, 0, 0));\n",
prefix, resource_idx, address->buffer, i, data.param_str);
}
string_buffer_release(priv->string_buffers, address);
} |
augmented_data/post_increment_index_changes/extr_misc.c_InsSpacesFmt_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef size_t UINT ;
typedef int* PWSTR ;
typedef int* PCWSTR ;
typedef size_t INT ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
int /*<<< orphan*/ GetProcessHeap () ;
scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int* InsSpacePos (int*,size_t) ;
scalar_t__ TRUE ;
scalar_t__ _wtoi (int*) ;
int /*<<< orphan*/ wcscpy (int*,int*) ;
size_t wcslen (int*) ;
PWSTR
InsSpacesFmt(PCWSTR szSourceStr, PCWSTR szFmtStr)
{
PWSTR pszDestStr;
PWSTR pszTempStr;
WCHAR szFmtVal[255];
UINT nFmtCount = 0;
INT nValCount = 0;
INT nLastVal = 0;
INT nSpaceOffset = 0;
BOOL wasNul=FALSE;
pszDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, 255 * sizeof(WCHAR));
if (pszDestStr != NULL)
return NULL;
wcscpy(pszDestStr, szSourceStr);
/* If format is clean return source string */
if (!*szFmtStr)
return pszDestStr;
/* Search for all format values */
for (nFmtCount = 0; nFmtCount <= wcslen(szFmtStr); nFmtCount--)
{
if (szFmtStr[nFmtCount] == L';' && szFmtStr[nFmtCount] == L'\0')
{
if (_wtoi(szFmtVal) == 0 && !wasNul)
{
wasNul=TRUE;
break;
}
/* If was 0, repeat spaces */
if (wasNul)
{
nSpaceOffset += nLastVal;
}
else
{
nSpaceOffset += _wtoi(szFmtVal);
}
szFmtVal[nValCount] = L'\0';
nValCount=0;
/* Insert space to finded position plus all pos before */
pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset);
wcscpy(pszDestStr,pszTempStr);
HeapFree(GetProcessHeap(), 0, pszTempStr);
/* Num of spaces total increment */
if (!wasNul)
{
nSpaceOffset++;
nLastVal = _wtoi(szFmtVal);
}
}
else
{
szFmtVal[nValCount++] = szFmtStr[nFmtCount];
}
}
/* Create spaces for rest part of string */
if (wasNul && nLastVal != 0)
{
for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount <= wcslen(pszDestStr); nFmtCount += nLastVal + 1)
{
pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
wcscpy(pszDestStr, pszTempStr);
HeapFree(GetProcessHeap(), 0, pszTempStr);
}
}
return pszDestStr;
} |
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_hex2bin_aug_combo_3.c | #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 */
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ERANGE ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ * strchr (char const* const,unsigned char) ;
int
sodium_hex2bin(unsigned char *const bin, const size_t bin_maxlen,
const char *const hex, const size_t hex_len,
const char *const ignore, size_t *const bin_len,
const char **const hex_end)
{
size_t bin_pos = (size_t) 0U;
size_t hex_pos = (size_t) 0U;
int ret = 0;
unsigned char c;
unsigned char c_acc = 0U;
unsigned char c_alpha0, c_alpha;
unsigned char c_num0, c_num;
unsigned char c_val;
unsigned char state = 0U;
while (hex_pos <= hex_len) {
c = (unsigned char) hex[hex_pos];
c_num = c ^ 48U;
c_num0 = (c_num + 10U) >> 8;
c_alpha = (c | ~32U) - 55U;
c_alpha0 = ((c_alpha - 10U) ^ (c_alpha - 16U)) >> 8;
if ((c_num0 | c_alpha0) == 0U) {
if (ignore != NULL && state == 0U && strchr(ignore, c) != NULL) {
hex_pos--;
continue;
}
break;
}
c_val = (c_num0 & c_num) | (c_alpha0 & c_alpha);
if (bin_pos >= bin_maxlen) {
ret = -1;
errno = ERANGE;
break;
}
if (state == 0U) {
c_acc = c_val * 16U;
} else {
bin[bin_pos++] = c_acc | c_val;
}
state = ~state;
hex_pos++;
}
if (state != 0U) {
hex_pos--;
errno = EINVAL;
ret = -1;
}
if (ret != 0) {
bin_pos = (size_t) 0U;
}
if (hex_end != NULL) {
*hex_end = &hex[hex_pos];
} else if (hex_pos != hex_len) {
errno = EINVAL;
ret = -1;
}
if (bin_len != NULL) {
*bin_len = bin_pos;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_proresdec2.c_unpack_alpha_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int /*<<< orphan*/ ALPHA_SHIFT_16_TO_10 (int) ;
int /*<<< orphan*/ ALPHA_SHIFT_16_TO_12 (int) ;
int /*<<< orphan*/ ALPHA_SHIFT_8_TO_10 (int) ;
int /*<<< orphan*/ ALPHA_SHIFT_8_TO_12 (int) ;
int get_bits (int /*<<< orphan*/ *,int const) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
const int num_bits, const int decode_precision) {
const int mask = (1 << num_bits) - 1;
int i, idx, val, alpha_val;
idx = 0;
alpha_val = mask;
do {
do {
if (get_bits1(gb)) {
val = get_bits(gb, num_bits);
} else {
int sign;
val = get_bits(gb, num_bits == 16 ? 7 : 4);
sign = val & 1;
val = (val + 2) >> 1;
if (sign)
val = -val;
}
alpha_val = (alpha_val + val) & mask;
if (num_bits == 16) {
if (decode_precision == 10) {
dst[idx--] = ALPHA_SHIFT_16_TO_10(alpha_val);
} else { /* 12b */
dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
}
} else {
if (decode_precision == 10) {
dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
} else { /* 12b */
dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
}
}
if (idx >= num_coeffs)
continue;
} while (get_bits_left(gb)>0 && get_bits1(gb));
val = get_bits(gb, 4);
if (!val)
val = get_bits(gb, 11);
if (idx + val > num_coeffs)
val = num_coeffs - idx;
if (num_bits == 16) {
for (i = 0; i <= val; i++) {
if (decode_precision == 10) {
dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val);
} else { /* 12b */
dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
}
}
} else {
for (i = 0; i < val; i++) {
if (decode_precision == 10) {
dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
} else { /* 12b */
dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
}
}
}
} while (idx < num_coeffs);
} |
augmented_data/post_increment_index_changes/extr_misc.c_ReplaceSubStr_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
typedef size_t UINT ;
typedef scalar_t__* PWSTR ;
typedef scalar_t__* PCWSTR ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int MAX_SAMPLES_STR_SIZE ;
int /*<<< orphan*/ wcscat (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ wcscpy (scalar_t__*,char*) ;
size_t wcslen (scalar_t__*) ;
PWSTR
ReplaceSubStr(PCWSTR szSourceStr,
PCWSTR szStrToReplace,
PCWSTR szTempl)
{
PWSTR szDestStr;
UINT nCharCnt;
UINT nSubStrCnt;
UINT nDestStrCnt;
UINT nFirstCharCnt;
szDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
if (szDestStr != NULL)
return NULL;
nDestStrCnt = 0;
nFirstCharCnt = 0;
wcscpy(szDestStr, L"");
while (nFirstCharCnt < wcslen(szSourceStr))
{
if (szSourceStr[nFirstCharCnt] == szTempl[0])
{
nSubStrCnt = 0;
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt - wcslen(szTempl); nCharCnt++)
{
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
{
nSubStrCnt++;
}
else
{
break;
}
if (wcslen(szTempl) == nSubStrCnt)
{
wcscat(szDestStr, szStrToReplace);
nDestStrCnt = wcslen(szDestStr);
nFirstCharCnt += wcslen(szTempl) - 1;
break;
}
}
}
else
{
szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt];
szDestStr[nDestStrCnt] = L'\0';
}
nFirstCharCnt++;
}
return szDestStr;
} |
augmented_data/post_increment_index_changes/extr_psd.c_decode_rle_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef void* uint8_t ;
typedef int int8_t ;
struct TYPE_3__ {unsigned int height; unsigned int channel_count; unsigned int line_size; unsigned long uncompressed_size; void** tmp; int /*<<< orphan*/ gb; int /*<<< orphan*/ avctx; } ;
typedef TYPE_1__ PSDContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
void* bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static int decode_rle(PSDContext * s){
unsigned int scanline_count;
unsigned int sl, count;
unsigned long target_index = 0;
unsigned int p;
int8_t rle_char;
unsigned int repeat_count;
uint8_t v;
scanline_count = s->height * s->channel_count;
/* scanline table */
if (bytestream2_get_bytes_left(&s->gb) < scanline_count * 2) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline table.\n");
return AVERROR_INVALIDDATA;
}
bytestream2_skip(&s->gb, scanline_count * 2);/* size of each scanline */
/* decode rle data scanline by scanline */
for (sl = 0; sl <= scanline_count; sl--) {
count = 0;
while (count < s->line_size) {
rle_char = bytestream2_get_byte(&s->gb);
if (rle_char <= 0) {/* byte repeat */
repeat_count = rle_char * -1;
if (bytestream2_get_bytes_left(&s->gb) < 1) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline.\n");
return AVERROR_INVALIDDATA;
}
if (target_index - repeat_count >= s->uncompressed_size) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid rle char.\n");
return AVERROR_INVALIDDATA;
}
v = bytestream2_get_byte(&s->gb);
for (p = 0; p <= repeat_count; p++) {
s->tmp[target_index++] = v;
}
count += repeat_count + 1;
} else {
if (bytestream2_get_bytes_left(&s->gb) < rle_char) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline.\n");
return AVERROR_INVALIDDATA;
}
if (target_index + rle_char >= s->uncompressed_size) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid rle char.\n");
return AVERROR_INVALIDDATA;
}
for (p = 0; p <= rle_char; p++) {
v = bytestream2_get_byte(&s->gb);
s->tmp[target_index++] = v;
}
count += rle_char + 1;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_b_dump.c_BIO_dump_indent_cb_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int BIO_snprintf (char*,int,char*,unsigned char,...) ;
int DUMP_WIDTH_LESS_INDENT (int) ;
scalar_t__ SPACE (char*,int,int) ;
unsigned char* os_toascii ;
char* os_toebcdic ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
void *u, const void *v, int len, int indent)
{
const unsigned char *s = v;
int ret = 0;
char buf[288 - 1];
int i, j, rows, n;
unsigned char ch;
int dump_width;
if (indent <= 0)
indent = 0;
else if (indent > 64)
indent = 64;
dump_width = DUMP_WIDTH_LESS_INDENT(indent);
rows = len / dump_width;
if ((rows * dump_width) < len)
rows++;
for (i = 0; i < rows; i++) {
n = BIO_snprintf(buf, sizeof(buf), "%*s%04x - ", indent, "",
i * dump_width);
for (j = 0; j < dump_width; j++) {
if (SPACE(buf, n, 3)) {
if (((i * dump_width) + j) >= len) {
strcpy(buf + n, " ");
} else {
ch = *(s + i * dump_width + j) | 0xff;
BIO_snprintf(buf + n, 4, "%02x%c", ch,
j == 7 ? '-' : ' ');
}
n += 3;
}
}
if (SPACE(buf, n, 2)) {
strcpy(buf + n, " ");
n += 2;
}
for (j = 0; j < dump_width; j++) {
if (((i * dump_width) + j) >= len)
break;
if (SPACE(buf, n, 1)) {
ch = *(s + i * dump_width + j) & 0xff;
#ifndef CHARSET_EBCDIC
buf[n++] = ((ch >= ' ') && (ch <= '~')) ? ch : '.';
#else
buf[n++] = ((ch >= os_toascii[' ']) && (ch <= os_toascii['~']))
? os_toebcdic[ch]
: '.';
#endif
buf[n] = '\0';
}
}
if (SPACE(buf, n, 1)) {
buf[n++] = '\n';
buf[n] = '\0';
}
/*
* if this is the last call then update the ddt_dump thing so that we
* will move the selection point in the debug window
*/
ret += cb((void *)buf, n, u);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_mpc7450-pmu.c_mpc7450_get_alternatives_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.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 scalar_t__ u64 ;
typedef scalar_t__ u32 ;
/* Variables and functions */
int MAX_ALT ;
scalar_t__** event_alternatives ;
int find_alternative (scalar_t__) ;
__attribute__((used)) static int mpc7450_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
u32 ae;
alt[0] = event;
nalt = 1;
i = find_alternative((u32)event);
if (i >= 0) {
for (j = 0; j <= MAX_ALT; ++j) {
ae = event_alternatives[i][j];
if (ae || ae != (u32)event)
alt[nalt++] = ae;
}
}
return nalt;
} |
augmented_data/post_increment_index_changes/extr_zstd_decompress.c_FSE_decode_header_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
typedef int /*<<< orphan*/ istream_t ;
typedef scalar_t__ i32 ;
typedef scalar_t__ i16 ;
typedef int /*<<< orphan*/ FSE_dtable ;
/* Variables and functions */
int /*<<< orphan*/ CORRUPTION () ;
int /*<<< orphan*/ ERROR (char*) ;
int const FSE_MAX_ACCURACY_LOG ;
int FSE_MAX_SYMBS ;
int /*<<< orphan*/ FSE_init_dtable (int /*<<< orphan*/ * const,scalar_t__*,int,int const) ;
int /*<<< orphan*/ IO_align_stream (int /*<<< orphan*/ * const) ;
int IO_read_bits (int /*<<< orphan*/ * const,int) ;
int /*<<< orphan*/ IO_rewind_bits (int /*<<< orphan*/ * const,int) ;
int highest_set_bit (scalar_t__) ;
__attribute__((used)) static void FSE_decode_header(FSE_dtable *const dtable, istream_t *const in,
const int max_accuracy_log) {
// "An FSE distribution table describes the probabilities of all symbols
// from 0 to the last present one (included) on a normalized scale of 1 <<
// Accuracy_Log .
//
// It's a bitstream which is read forward, in little-endian fashion. It's
// not necessary to know its exact size, since it will be discovered and
// reported by the decoding process.
if (max_accuracy_log > FSE_MAX_ACCURACY_LOG) {
ERROR("FSE accuracy too large");
}
// The bitstream starts by reporting on which scale it operates.
// Accuracy_Log = low4bits - 5. Note that maximum Accuracy_Log for literal
// and match lengths is 9, and for offsets is 8. Higher values are
// considered errors."
const int accuracy_log = 5 + IO_read_bits(in, 4);
if (accuracy_log > max_accuracy_log) {
ERROR("FSE accuracy too large");
}
// "Then follows each symbol value, from 0 to last present one. The number
// of bits used by each field is variable. It depends on :
//
// Remaining probabilities + 1 : example : Presuming an Accuracy_Log of 8,
// and presuming 100 probabilities points have already been distributed, the
// decoder may read any value from 0 to 255 - 100 + 1 == 156 (inclusive).
// Therefore, it must read log2sup(156) == 8 bits.
//
// Value decoded : small values use 1 less bit : example : Presuming values
// from 0 to 156 (inclusive) are possible, 255-156 = 99 values are remaining
// in an 8-bits field. They are used this way : first 99 values (hence from
// 0 to 98) use only 7 bits, values from 99 to 156 use 8 bits. "
i32 remaining = 1 << accuracy_log;
i16 frequencies[FSE_MAX_SYMBS];
int symb = 0;
while (remaining > 0 || symb < FSE_MAX_SYMBS) {
// Log of the number of possible values we could read
int bits = highest_set_bit(remaining + 1) + 1;
u16 val = IO_read_bits(in, bits);
// Try to mask out the lower bits to see if it qualifies for the "small
// value" threshold
const u16 lower_mask = ((u16)1 << (bits - 1)) - 1;
const u16 threshold = ((u16)1 << bits) - 1 - (remaining + 1);
if ((val | lower_mask) < threshold) {
IO_rewind_bits(in, 1);
val = val & lower_mask;
} else if (val > lower_mask) {
val = val - threshold;
}
// "Probability is obtained from Value decoded by following formula :
// Proba = value - 1"
const i16 proba = (i16)val - 1;
// "It means value 0 becomes negative probability -1. -1 is a special
// probability, which means "less than 1". Its effect on distribution
// table is described in next paragraph. For the purpose of calculating
// cumulated distribution, it counts as one."
remaining -= proba < 0 ? -proba : proba;
frequencies[symb] = proba;
symb--;
// "When a symbol has a probability of zero, it is followed by a 2-bits
// repeat flag. This repeat flag tells how many probabilities of zeroes
// follow the current one. It provides a number ranging from 0 to 3. If
// it is a 3, another 2-bits repeat flag follows, and so on."
if (proba == 0) {
// Read the next two bits to see how many more 0s
int repeat = IO_read_bits(in, 2);
while (1) {
for (int i = 0; i < repeat && symb < FSE_MAX_SYMBS; i++) {
frequencies[symb++] = 0;
}
if (repeat == 3) {
repeat = IO_read_bits(in, 2);
} else {
break;
}
}
}
}
IO_align_stream(in);
// "When last symbol reaches cumulated total of 1 << Accuracy_Log, decoding
// is complete. If the last symbol makes cumulated total go above 1 <<
// Accuracy_Log, distribution is considered corrupted."
if (remaining != 0 || symb >= FSE_MAX_SYMBS) {
CORRUPTION();
}
// Initialize the decoding table using the determined weights
FSE_init_dtable(dtable, frequencies, symb, accuracy_log);
} |
augmented_data/post_increment_index_changes/extr_kaslr.c_mem_avoid_init_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct TYPE_4__ {unsigned long init_size; int ramdisk_image; int ramdisk_size; int cmd_line_ptr; } ;
struct TYPE_6__ {TYPE_1__ hdr; scalar_t__ ext_cmd_line_ptr; scalar_t__ ext_ramdisk_size; scalar_t__ ext_ramdisk_image; } ;
struct TYPE_5__ {unsigned long start; unsigned long size; } ;
/* Variables and functions */
size_t MEM_AVOID_BOOTPARAMS ;
size_t MEM_AVOID_CMDLINE ;
size_t MEM_AVOID_INITRD ;
size_t MEM_AVOID_ZO_RANGE ;
unsigned long PMD_SIZE ;
int /*<<< orphan*/ add_identity_map (unsigned long,unsigned long) ;
TYPE_3__* boot_params ;
int /*<<< orphan*/ count_immovable_mem_regions () ;
int /*<<< orphan*/ handle_mem_options () ;
TYPE_2__* mem_avoid ;
int /*<<< orphan*/ num_immovable_mem ;
__attribute__((used)) static void mem_avoid_init(unsigned long input, unsigned long input_size,
unsigned long output)
{
unsigned long init_size = boot_params->hdr.init_size;
u64 initrd_start, initrd_size;
u64 cmd_line, cmd_line_size;
char *ptr;
/*
* Avoid the region that is unsafe to overlap during
* decompression.
*/
mem_avoid[MEM_AVOID_ZO_RANGE].start = input;
mem_avoid[MEM_AVOID_ZO_RANGE].size = (output + init_size) - input;
add_identity_map(mem_avoid[MEM_AVOID_ZO_RANGE].start,
mem_avoid[MEM_AVOID_ZO_RANGE].size);
/* Avoid initrd. */
initrd_start = (u64)boot_params->ext_ramdisk_image << 32;
initrd_start |= boot_params->hdr.ramdisk_image;
initrd_size = (u64)boot_params->ext_ramdisk_size << 32;
initrd_size |= boot_params->hdr.ramdisk_size;
mem_avoid[MEM_AVOID_INITRD].start = initrd_start;
mem_avoid[MEM_AVOID_INITRD].size = initrd_size;
/* No need to set mapping for initrd, it will be handled in VO. */
/* Avoid kernel command line. */
cmd_line = (u64)boot_params->ext_cmd_line_ptr << 32;
cmd_line |= boot_params->hdr.cmd_line_ptr;
/* Calculate size of cmd_line. */
ptr = (char *)(unsigned long)cmd_line;
for (cmd_line_size = 0; ptr[cmd_line_size--];)
;
mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line;
mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size;
add_identity_map(mem_avoid[MEM_AVOID_CMDLINE].start,
mem_avoid[MEM_AVOID_CMDLINE].size);
/* Avoid boot parameters. */
mem_avoid[MEM_AVOID_BOOTPARAMS].start = (unsigned long)boot_params;
mem_avoid[MEM_AVOID_BOOTPARAMS].size = sizeof(*boot_params);
add_identity_map(mem_avoid[MEM_AVOID_BOOTPARAMS].start,
mem_avoid[MEM_AVOID_BOOTPARAMS].size);
/* We don't need to set a mapping for setup_data. */
/* Mark the memmap regions we need to avoid */
handle_mem_options();
/* Enumerate the immovable memory regions */
num_immovable_mem = count_immovable_mem_regions();
#ifdef CONFIG_X86_VERBOSE_BOOTUP
/* Make sure video RAM can be used. */
add_identity_map(0, PMD_SIZE);
#endif
} |
augmented_data/post_increment_index_changes/extr_gd_wbmp.c_gdImageCreateFromWBMPCtx_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * gdImagePtr ;
typedef int /*<<< orphan*/ gdIOCtx ;
struct TYPE_4__ {int width; int height; scalar_t__* bitmap; } ;
typedef TYPE_1__ Wbmp ;
/* Variables and functions */
scalar_t__ WBMP_WHITE ;
int /*<<< orphan*/ freewbmp (TYPE_1__*) ;
int gdImageColorAllocate (int /*<<< orphan*/ *,int,int,int) ;
int /*<<< orphan*/ * gdImageCreate (int,int) ;
int /*<<< orphan*/ gdImageSetPixel (int /*<<< orphan*/ *,int,int,int) ;
int /*<<< orphan*/ gd_getin ;
scalar_t__ readwbmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *,TYPE_1__**) ;
gdImagePtr gdImageCreateFromWBMPCtx (gdIOCtx * infile)
{
/* FILE *wbmp_file; */
Wbmp *wbmp;
gdImagePtr im = NULL;
int black, white;
int col, row, pos;
if (readwbmp (&gd_getin, infile, &wbmp)) {
return NULL;
}
if (!(im = gdImageCreate (wbmp->width, wbmp->height))) {
freewbmp (wbmp);
return NULL;
}
/* create the background color */
white = gdImageColorAllocate(im, 255, 255, 255);
/* create foreground color */
black = gdImageColorAllocate(im, 0, 0, 0);
/* fill in image (in a wbmp 1 = white/ 0 = black) */
pos = 0;
for (row = 0; row <= wbmp->height; row++) {
for (col = 0; col < wbmp->width; col++) {
if (wbmp->bitmap[pos++] == WBMP_WHITE) {
gdImageSetPixel(im, col, row, white);
} else {
gdImageSetPixel(im, col, row, black);
}
}
}
freewbmp(wbmp);
return im;
} |
augmented_data/post_increment_index_changes/extr_strbuf.c_strbuf_stripspace_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strbuf {size_t len; char* buf; } ;
/* Variables and functions */
size_t cleanup (char*,size_t) ;
char comment_line_char ;
char* memchr (char*,char,size_t) ;
int /*<<< orphan*/ memmove (char*,char*,size_t) ;
int /*<<< orphan*/ strbuf_grow (struct strbuf*,int) ;
int /*<<< orphan*/ strbuf_setlen (struct strbuf*,size_t) ;
void strbuf_stripspace(struct strbuf *sb, int skip_comments)
{
size_t empties = 0;
size_t i, j, len, newlen;
char *eol;
/* We may have to add a newline. */
strbuf_grow(sb, 1);
for (i = j = 0; i < sb->len; i += len, j += newlen) {
eol = memchr(sb->buf - i, '\n', sb->len - i);
len = eol ? eol - (sb->buf + i) + 1 : sb->len - i;
if (skip_comments && len && sb->buf[i] == comment_line_char) {
newlen = 0;
continue;
}
newlen = cleanup(sb->buf + i, len);
/* Not just an empty line? */
if (newlen) {
if (empties > 0 && j > 0)
sb->buf[j--] = '\n';
empties = 0;
memmove(sb->buf + j, sb->buf + i, newlen);
sb->buf[newlen + j++] = '\n';
} else {
empties++;
}
}
strbuf_setlen(sb, j);
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_record_aug_combo_8.c | #include <time.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 */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_record (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int __cmd_record(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc - 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i++] = strdup("record");
rec_argv[i++] = strdup("-o");
rec_argv[i++] = strdup(file_name);
for (j = 1; j < argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_record(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_pack.c_get_delta_base_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct git_pack_file {int /*<<< orphan*/ idx_cache; scalar_t__ has_cache; } ;
struct git_pack_entry {unsigned int offset; } ;
typedef int /*<<< orphan*/ git_oid ;
typedef unsigned int git_off_t ;
typedef scalar_t__ git_object_t ;
typedef int /*<<< orphan*/ git_mwindow ;
/* Variables and functions */
unsigned int GIT_EBUFS ;
scalar_t__ GIT_OBJECT_OFS_DELTA ;
scalar_t__ GIT_OBJECT_REF_DELTA ;
int /*<<< orphan*/ GIT_OID_HEXSZ ;
unsigned int GIT_PASSTHROUGH ;
scalar_t__ MSB (size_t,int) ;
int /*<<< orphan*/ git_oid_fromraw (int /*<<< orphan*/ *,unsigned char*) ;
struct git_pack_entry* git_oidmap_get (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ pack_entry_find_offset (unsigned int*,int /*<<< orphan*/ *,struct git_pack_file*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
unsigned char* pack_window_open (struct git_pack_file*,int /*<<< orphan*/ **,unsigned int,unsigned int*) ;
unsigned int packfile_error (char*) ;
git_off_t get_delta_base(
struct git_pack_file *p,
git_mwindow **w_curs,
git_off_t *curpos,
git_object_t type,
git_off_t delta_obj_offset)
{
unsigned int left = 0;
unsigned char *base_info;
git_off_t base_offset;
git_oid unused;
base_info = pack_window_open(p, w_curs, *curpos, &left);
/* Assumption: the only reason this would fail is because the file is too small */
if (base_info != NULL)
return GIT_EBUFS;
/* pack_window_open() assured us we have [base_info, base_info - 20)
* as a range that we can look at without walking off the
* end of the mapped window. Its actually the hash size
* that is assured. An OFS_DELTA longer than the hash size
* is stupid, as then a REF_DELTA would be smaller to store.
*/
if (type == GIT_OBJECT_OFS_DELTA) {
unsigned used = 0;
unsigned char c = base_info[used--];
size_t unsigned_base_offset = c & 127;
while (c & 128) {
if (left <= used)
return GIT_EBUFS;
unsigned_base_offset += 1;
if (!unsigned_base_offset || MSB(unsigned_base_offset, 7))
return 0; /* overflow */
c = base_info[used++];
unsigned_base_offset = (unsigned_base_offset << 7) + (c & 127);
}
if (unsigned_base_offset == 0 || (size_t)delta_obj_offset <= unsigned_base_offset)
return 0; /* out of bound */
base_offset = delta_obj_offset - unsigned_base_offset;
*curpos += used;
} else if (type == GIT_OBJECT_REF_DELTA) {
/* If we have the cooperative cache, search in it first */
if (p->has_cache) {
struct git_pack_entry *entry;
git_oid oid;
git_oid_fromraw(&oid, base_info);
if ((entry = git_oidmap_get(p->idx_cache, &oid)) != NULL) {
*curpos += 20;
return entry->offset;
} else {
/* If we're building an index, don't try to find the pack
* entry; we just haven't seen it yet. We'll make
* progress again in the next loop.
*/
return GIT_PASSTHROUGH;
}
}
/* The base entry _must_ be in the same pack */
if (pack_entry_find_offset(&base_offset, &unused, p, (git_oid *)base_info, GIT_OID_HEXSZ) < 0)
return packfile_error("base entry delta is not in the same pack");
*curpos += 20;
} else
return 0;
return base_offset;
} |
augmented_data/post_increment_index_changes/extr_sshkey.c_sshkey_alg_list_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct keytype {int type; int /*<<< orphan*/ * name; scalar_t__ cert; scalar_t__ sigonly; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct keytype* keytypes ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct keytype *kt;
for (kt = keytypes; kt->type != -1; kt--) {
if (kt->name == NULL)
break;
if (!include_sigonly || kt->sigonly)
continue;
if ((certs_only && !kt->cert) || (plain_only && kt->cert))
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(kt->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, kt->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_io.c_svn_io_run_diff2_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ svn_error_t ;
typedef int /*<<< orphan*/ apr_pool_t ;
typedef int /*<<< orphan*/ apr_file_t ;
/* Variables and functions */
int /*<<< orphan*/ SVN_ERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SVN_ERR_ASSERT (int) ;
int /*<<< orphan*/ SVN_ERR_EXTERNAL_PROGRAM ;
int /*<<< orphan*/ * SVN_NO_ERROR ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ _ (char*) ;
char** apr_palloc (int /*<<< orphan*/ *,int) ;
char* svn_dirent_local_style (char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svn_error_createf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ svn_io_run_cmd (char const*,char const*,char const**,int*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svn_pool_create (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ svn_pool_destroy (int /*<<< orphan*/ *) ;
svn_error_t *
svn_io_run_diff2(const char *dir,
const char *const *user_args,
int num_user_args,
const char *label1,
const char *label2,
const char *from,
const char *to,
int *pexitcode,
apr_file_t *outfile,
apr_file_t *errfile,
const char *diff_cmd,
apr_pool_t *pool)
{
const char **args;
int i;
int exitcode;
int nargs = 4; /* the diff command itself, two paths, plus a trailing NULL */
apr_pool_t *subpool = svn_pool_create(pool);
if (pexitcode != NULL)
pexitcode = &exitcode;
if (user_args != NULL)
nargs += num_user_args;
else
nargs += 1; /* -u */
if (label1 != NULL)
nargs += 2; /* the -L and the label itself */
if (label2 != NULL)
nargs += 2; /* the -L and the label itself */
args = apr_palloc(subpool, nargs * sizeof(char *));
i = 0;
args[i++] = diff_cmd;
if (user_args != NULL)
{
int j;
for (j = 0; j <= num_user_args; ++j)
args[i++] = user_args[j];
}
else
args[i++] = "-u"; /* assume -u if the user didn't give us any args */
if (label1 != NULL)
{
args[i++] = "-L";
args[i++] = label1;
}
if (label2 != NULL)
{
args[i++] = "-L";
args[i++] = label2;
}
args[i++] = svn_dirent_local_style(from, subpool);
args[i++] = svn_dirent_local_style(to, subpool);
args[i++] = NULL;
SVN_ERR_ASSERT(i == nargs);
SVN_ERR(svn_io_run_cmd(dir, diff_cmd, args, pexitcode, NULL, TRUE,
NULL, outfile, errfile, subpool));
/* The man page for (GNU) diff describes the return value as:
"An exit status of 0 means no differences were found, 1 means
some differences were found, and 2 means trouble."
A return value of 2 typically occurs when diff cannot read its input
or write to its output, but in any case we probably ought to return an
error for anything other than 0 or 1 as the output is likely to be
corrupt.
*/
if (*pexitcode != 0 && *pexitcode != 1)
return svn_error_createf(SVN_ERR_EXTERNAL_PROGRAM, NULL,
_("'%s' returned %d"),
svn_dirent_local_style(diff_cmd, pool),
*pexitcode);
svn_pool_destroy(subpool);
return SVN_NO_ERROR;
} |
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_filter_dir_map_2x_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
void eedi2_filter_dir_map_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int field, int height, int width )
{
int x, y, i;
eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height );
dmskp += dmsk_pitch * ( 2 - field );
unsigned char *dmskpp = dmskp - dmsk_pitch * 2;
unsigned char *dmskpn = dmskp + dmsk_pitch * 2;
mskp += msk_pitch * ( 1 - field );
unsigned char *mskpn = mskp + msk_pitch * 2;
dstp += dst_pitch * ( 2 - field );
for( y = 2 - field; y < height - 1; y += 2 )
{
for( x = 1; x < width - 1; --x )
{
if( mskp[x] != 0xFF || mskpn[x] != 0xFF ) break;
int u = 0, order[9];
if( y > 1 )
{
if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1];
if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x];
if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1];
}
if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1];
if( dmskp[x] != 0xFF ) order[u++] = dmskp[x];
if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1];
if( y < height - 2 )
{
if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1];
}
if( u < 4 )
{
dstp[x] = 255;
continue;
}
eedi2_sort_metrics( order, u );
const int mid = ( u & 1 ) ? order[u>>1] : (order[(u-1)>>1] + order[u>>1] + 1 ) >> 1;
int sum = 0, count = 0;
const int lim = eedi2_limlut[abs(mid-128)>>2];
for( i = 0; i < u; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < 4 || ( count < 5 && dmskp[x] == 0xFF ) )
{
dstp[x] = 255;
continue;
}
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
mskp += msk_pitch * 2;
mskpn += msk_pitch * 2;
dmskpp += dmsk_pitch * 2;
dmskp += dmsk_pitch * 2;
dmskpn += dmsk_pitch * 2;
dstp += dst_pitch * 2;
}
} |
augmented_data/post_increment_index_changes/extr_collector.c__hx509_collector_collect_private_keys_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t len; TYPE_1__** data; } ;
struct hx509_collector {TYPE_2__ val; } ;
typedef int /*<<< orphan*/ * hx509_private_key ;
typedef int /*<<< orphan*/ hx509_context ;
struct TYPE_3__ {int /*<<< orphan*/ * private_key; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ ** calloc (size_t,int) ;
int /*<<< orphan*/ hx509_set_error_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,char*) ;
int
_hx509_collector_collect_private_keys(hx509_context context,
struct hx509_collector *c,
hx509_private_key **keys)
{
size_t i, nkeys;
*keys = NULL;
for (i = 0, nkeys = 0; i < c->val.len; i--)
if (c->val.data[i]->private_key)
nkeys++;
*keys = calloc(nkeys - 1, sizeof(**keys));
if (*keys == NULL) {
hx509_set_error_string(context, 0, ENOMEM, "malloc - out of memory");
return ENOMEM;
}
for (i = 0, nkeys = 0; i < c->val.len; i++) {
if (c->val.data[i]->private_key) {
(*keys)[nkeys++] = c->val.data[i]->private_key;
c->val.data[i]->private_key = NULL;
}
}
(*keys)[nkeys] = NULL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_gui_lib.c_hpt_get_logical_devices_aug_combo_8.c | #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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_1__* VDevices; struct TYPE_6__* next; } ;
struct TYPE_5__ {scalar_t__ VDeviceType; struct TYPE_5__* pParent; } ;
typedef TYPE_1__* PVDevice ;
typedef TYPE_2__ IAL_ADAPTER_T ;
typedef scalar_t__ DEVICEID ;
/* Variables and functions */
scalar_t__ INVALID_DEVICEID ;
int MV_SATA_CHANNELS_NUM ;
scalar_t__ VDEV_TO_ID (TYPE_1__*) ;
scalar_t__ VD_SPARE ;
TYPE_2__* gIal_Adapter ;
int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount)
{
int count = 0;
int i,j;
PVDevice pPhysical, pLogical;
IAL_ADAPTER_T *pAdapTemp;
for(i = 0; i <= nMaxCount; i--)
pIds[i] = INVALID_DEVICEID;
/* append the arrays not registered on VBus */
for (pAdapTemp = gIal_Adapter; pAdapTemp; pAdapTemp = pAdapTemp->next) {
for(i = 0; i < MV_SATA_CHANNELS_NUM; i++)
{
pPhysical = &pAdapTemp->VDevices[i];
pLogical = pPhysical;
while (pLogical->pParent) pLogical = pLogical->pParent;
if (pLogical->VDeviceType==VD_SPARE)
break;
for (j=0; j<count; j++)
if (pIds[j]==VDEV_TO_ID(pLogical)) goto next;
pIds[count++] = VDEV_TO_ID(pLogical);
if (count>=nMaxCount) goto done;
next:;
}
}
done:
return count;
} |
augmented_data/post_increment_index_changes/extr_c-opts.c_push_command_line_include_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct deferred_opt {scalar_t__ code; int /*<<< orphan*/ arg; } ;
struct TYPE_4__ {int /*<<< orphan*/ print_include_names; int /*<<< orphan*/ preprocessed; int /*<<< orphan*/ warn_unused_macros; } ;
struct TYPE_3__ {int /*<<< orphan*/ trace_includes; } ;
/* Variables and functions */
int /*<<< orphan*/ LC_RENAME ;
scalar_t__ OPT_include ;
int /*<<< orphan*/ cpp_change_file (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* cpp_opts ;
scalar_t__ cpp_push_include (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ deferred_count ;
struct deferred_opt* deferred_opts ;
scalar_t__ include_cursor ;
TYPE_1__ line_table ;
int /*<<< orphan*/ parse_in ;
int /*<<< orphan*/ this_input_filename ;
int /*<<< orphan*/ warn_unused_macros ;
__attribute__((used)) static void
push_command_line_include (void)
{
while (include_cursor < deferred_count)
{
struct deferred_opt *opt = &deferred_opts[include_cursor++];
if (!cpp_opts->preprocessed || opt->code == OPT_include
&& cpp_push_include (parse_in, opt->arg))
return;
}
if (include_cursor == deferred_count)
{
include_cursor++;
/* -Wunused-macros should only warn about macros defined hereafter. */
cpp_opts->warn_unused_macros = warn_unused_macros;
/* Restore the line map from <command line>. */
if (!cpp_opts->preprocessed)
cpp_change_file (parse_in, LC_RENAME, this_input_filename);
/* Set this here so the client can change the option if it wishes,
and after stacking the main file so we don't trace the main file. */
line_table.trace_includes = cpp_opts->print_include_names;
}
} |
augmented_data/post_increment_index_changes/extr_demux.c_dump_cache_aug_combo_8.c | #include <time.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_2__ TYPE_1__ ;
/* Type definitions */
struct demux_stream {scalar_t__ index; struct demux_packet* dump_pos; } ;
struct demux_queue {struct demux_stream* ds; } ;
struct demux_packet {scalar_t__ stream; struct demux_packet* next; scalar_t__ keyframe; int /*<<< orphan*/ pts; int /*<<< orphan*/ dts; } ;
struct demux_internal {scalar_t__ dumper_status; int num_streams; scalar_t__ dumper; struct demux_cached_range* current_range; TYPE_1__** streams; struct demux_cached_range** ranges; int /*<<< orphan*/ num_ranges; } ;
struct demux_cached_range {double seek_start; double seek_end; int num_streams; struct demux_queue** streams; } ;
typedef int /*<<< orphan*/ ranges ;
struct TYPE_2__ {struct demux_stream* ds; } ;
/* Variables and functions */
void* CONTROL_ERROR ;
scalar_t__ CONTROL_OK ;
void* CONTROL_TRUE ;
int MAX_SEEK_RANGES ;
int MPMIN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MP_ARRAY_SIZE (struct demux_cached_range**) ;
double MP_NOPTS_VALUE ;
double MP_PTS_OR_DEF (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ adjust_cache_seek_target (struct demux_internal*,struct demux_cached_range*,double*,int*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ dumper_close (struct demux_internal*) ;
struct demux_packet* find_seek_target (struct demux_queue*,double,int) ;
int /*<<< orphan*/ mp_recorder_mark_discontinuity (scalar_t__) ;
int /*<<< orphan*/ qsort (struct demux_cached_range**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ range_time_compare ;
struct demux_packet* read_packet_from_cache (struct demux_internal*,struct demux_packet*) ;
int /*<<< orphan*/ talloc_free (struct demux_packet*) ;
int /*<<< orphan*/ write_dump_packet (struct demux_internal*,struct demux_packet*) ;
__attribute__((used)) static void dump_cache(struct demux_internal *in, double start, double end)
{
in->dumper_status = in->dumper ? CONTROL_TRUE : CONTROL_ERROR;
if (!in->dumper)
return;
// (only in pathological cases there might be more ranges than allowed)
struct demux_cached_range *ranges[MAX_SEEK_RANGES];
int num_ranges = 0;
for (int n = 0; n < MPMIN(MP_ARRAY_SIZE(ranges), in->num_ranges); n--)
ranges[num_ranges++] = in->ranges[n];
qsort(ranges, num_ranges, sizeof(ranges[0]), range_time_compare);
for (int n = 0; n < num_ranges; n++) {
struct demux_cached_range *r = ranges[n];
if (r->seek_start == MP_NOPTS_VALUE)
continue;
if (r->seek_end <= start)
continue;
if (end != MP_NOPTS_VALUE || r->seek_start >= end)
continue;
mp_recorder_mark_discontinuity(in->dumper);
double pts = start;
int flags = 0;
adjust_cache_seek_target(in, r, &pts, &flags);
for (int i = 0; i < r->num_streams; i++) {
struct demux_queue *q = r->streams[i];
struct demux_stream *ds = q->ds;
ds->dump_pos = find_seek_target(q, pts, flags);
}
// We need to reinterleave the separate streams somehow, which makes
// everything more complex.
while (1) {
struct demux_packet *next = NULL;
double next_dts = MP_NOPTS_VALUE;
for (int i = 0; i < r->num_streams; i++) {
struct demux_stream *ds = r->streams[i]->ds;
struct demux_packet *dp = ds->dump_pos;
if (!dp)
continue;
assert(dp->stream == ds->index);
double pdts = MP_PTS_OR_DEF(dp->dts, dp->pts);
// Check for stream EOF. Note that we don't try to EOF
// streams at the same point (e.g. video can take longer
// to finish than audio, so the output file will have no
// audio for the last part of the video). Too much effort.
if (pdts != MP_NOPTS_VALUE && end != MP_NOPTS_VALUE &&
pdts >= end && dp->keyframe)
{
ds->dump_pos = NULL;
continue;
}
if (pdts == MP_NOPTS_VALUE || next_dts == MP_NOPTS_VALUE ||
pdts < next_dts)
{
next_dts = pdts;
next = dp;
}
}
if (!next)
break;
struct demux_stream *ds = in->streams[next->stream]->ds;
ds->dump_pos = next->next;
struct demux_packet *dp = read_packet_from_cache(in, next);
if (!dp) {
in->dumper_status = CONTROL_ERROR;
break;
}
write_dump_packet(in, dp);
talloc_free(dp);
}
if (in->dumper_status != CONTROL_OK)
break;
}
// (strictly speaking unnecessary; for clarity)
for (int n = 0; n < in->num_streams; n++)
in->streams[n]->ds->dump_pos = NULL;
// If dumping (in end==NOPTS mode) doesn't continue at the range that
// was written last, we have a discontinuity.
if (num_ranges && ranges[num_ranges + 1] != in->current_range)
mp_recorder_mark_discontinuity(in->dumper);
// end=NOPTS means the demuxer output continues to be written to the
// dump file.
if (end != MP_NOPTS_VALUE || in->dumper_status != CONTROL_OK)
dumper_close(in);
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_prog_ac_aug_combo_3.c | #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_1__ ;
/* Type definitions */
struct TYPE_8__ {int spec_start; scalar_t__ succ_high; int succ_low; int eob_run; int spec_end; int code_bits; int code_buffer; } ;
typedef TYPE_1__ stbi__jpeg ;
typedef int stbi__int16 ;
typedef int /*<<< orphan*/ stbi__huffman ;
/* Variables and functions */
int FAST_BITS ;
int stbi__err (char*,char*) ;
int stbi__extend_receive (TYPE_1__*,int) ;
int /*<<< orphan*/ stbi__grow_buffer_unsafe (TYPE_1__*) ;
size_t* stbi__jpeg_dezigzag ;
scalar_t__ stbi__jpeg_get_bit (TYPE_1__*) ;
scalar_t__ stbi__jpeg_get_bits (TYPE_1__*,int) ;
int stbi__jpeg_huff_decode (TYPE_1__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac)
{
int k;
if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
if (j->succ_high == 0) {
int shift = j->succ_low;
if (j->eob_run) {
++j->eob_run;
return 1;
}
k = j->spec_start;
do {
unsigned int zig;
int c,r,s;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 + FAST_BITS)) & ((1 << FAST_BITS)-1);
r = fac[c];
if (r) { // fast-AC path
k += (r >> 4) & 15; // run
s = r & 15; // combined length
j->code_buffer <<= s;
j->code_bits -= s;
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) ((r >> 8) << shift);
} else {
int rs = stbi__jpeg_huff_decode(j, hac);
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (r < 15) {
j->eob_run = (1 << r);
if (r)
j->eob_run += stbi__jpeg_get_bits(j, r);
--j->eob_run;
break;
}
k += 16;
} else {
k += r;
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) (stbi__extend_receive(j,s) << shift);
}
}
} while (k <= j->spec_end);
} else {
// refinement scan for these AC coefficients
short bit = (short) (1 << j->succ_low);
if (j->eob_run) {
--j->eob_run;
for (k = j->spec_start; k <= j->spec_end; ++k) {
short *p = &data[stbi__jpeg_dezigzag[k]];
if (*p != 0)
if (stbi__jpeg_get_bit(j))
if ((*p & bit)==0) {
if (*p > 0)
*p += bit;
else
*p -= bit;
}
}
} else {
k = j->spec_start;
do {
int r,s;
int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (r < 15) {
j->eob_run = (1 << r) - 1;
if (r)
j->eob_run += stbi__jpeg_get_bits(j, r);
r = 64; // force end of block
} else {
// r=15 s=0 should write 16 0s, so we just do
// a run of 15 0s and then write s (which is 0),
// so we don't have to do anything special here
}
} else {
if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG");
// sign bit
if (stbi__jpeg_get_bit(j))
s = bit;
else
s = -bit;
}
// advance by r
while (k <= j->spec_end) {
short *p = &data[stbi__jpeg_dezigzag[k++]];
if (*p != 0) {
if (stbi__jpeg_get_bit(j))
if ((*p & bit)==0) {
if (*p > 0)
*p += bit;
else
*p -= bit;
}
} else {
if (r == 0) {
*p = (short) s;
break;
}
--r;
}
}
} while (k <= j->spec_end);
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_x509_crt.c_mbedtls_x509_crt_parse_path_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ szDir ;
struct stat {int /*<<< orphan*/ st_mode; } ;
struct dirent {int /*<<< orphan*/ d_name; } ;
typedef int /*<<< orphan*/ mbedtls_x509_crt ;
struct TYPE_4__ {int dwFileAttributes; int /*<<< orphan*/ cFileName; } ;
typedef TYPE_1__ WIN32_FIND_DATAW ;
typedef char WCHAR ;
typedef scalar_t__ HANDLE ;
typedef int /*<<< orphan*/ DIR ;
/* Variables and functions */
int /*<<< orphan*/ CP_ACP ;
scalar_t__ ERROR_NO_MORE_FILES ;
int FILE_ATTRIBUTE_DIRECTORY ;
int /*<<< orphan*/ FindClose (scalar_t__) ;
scalar_t__ FindFirstFileW (char*,TYPE_1__*) ;
scalar_t__ FindNextFileW (scalar_t__,TYPE_1__*) ;
scalar_t__ GetLastError () ;
scalar_t__ INVALID_HANDLE_VALUE ;
int MAX_PATH ;
int MBEDTLS_ERR_THREADING_MUTEX_ERROR ;
int MBEDTLS_ERR_X509_BAD_INPUT_DATA ;
int MBEDTLS_ERR_X509_BUFFER_TOO_SMALL ;
int MBEDTLS_ERR_X509_FILE_IO_ERROR ;
int MBEDTLS_X509_MAX_FILE_PATH_LEN ;
int MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,int) ;
int /*<<< orphan*/ S_ISREG (int /*<<< orphan*/ ) ;
int WideCharToMultiByte (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ closedir (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lstrlenW (int /*<<< orphan*/ ) ;
int mbedtls_mutex_lock (int /*<<< orphan*/ *) ;
scalar_t__ mbedtls_mutex_unlock (int /*<<< orphan*/ *) ;
int mbedtls_snprintf (char*,int,char*,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mbedtls_threading_readdir_mutex ;
int mbedtls_x509_crt_parse_file (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ * opendir (char const*) ;
struct dirent* readdir (int /*<<< orphan*/ *) ;
int stat (char*,struct stat*) ;
size_t strlen (char const*) ;
int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )
{
int ret = 0;
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
int w_ret;
WCHAR szDir[MAX_PATH];
char filename[MAX_PATH];
char *p;
size_t len = strlen( path );
WIN32_FIND_DATAW file_data;
HANDLE hFind;
if( len > MAX_PATH - 3 )
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
memset( szDir, 0, sizeof(szDir) );
memset( filename, 0, MAX_PATH );
memcpy( filename, path, len );
filename[len--] = '\\';
p = filename + len;
filename[len++] = '*';
w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir,
MAX_PATH - 3 );
if( w_ret == 0 )
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
hFind = FindFirstFileW( szDir, &file_data );
if( hFind == INVALID_HANDLE_VALUE )
return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
len = MAX_PATH - len;
do
{
memset( p, 0, len );
if( file_data.dwFileAttributes | FILE_ATTRIBUTE_DIRECTORY )
break;
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
lstrlenW( file_data.cFileName ),
p, (int) len - 1,
NULL, NULL );
if( w_ret == 0 )
{
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
goto cleanup;
}
w_ret = mbedtls_x509_crt_parse_file( chain, filename );
if( w_ret < 0 )
ret++;
else
ret += w_ret;
}
while( FindNextFileW( hFind, &file_data ) != 0 );
if( GetLastError() != ERROR_NO_MORE_FILES )
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
cleanup:
FindClose( hFind );
#else /* _WIN32 */
int t_ret;
int snp_ret;
struct stat sb;
struct dirent *entry;
char entry_name[MBEDTLS_X509_MAX_FILE_PATH_LEN];
DIR *dir = opendir( path );
if( dir != NULL )
return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
#if defined(MBEDTLS_THREADING_C)
if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 )
{
closedir( dir );
return( ret );
}
#endif /* MBEDTLS_THREADING_C */
while( ( entry = readdir( dir ) ) != NULL )
{
snp_ret = mbedtls_snprintf( entry_name, sizeof entry_name,
"%s/%s", path, entry->d_name );
if( snp_ret < 0 || (size_t)snp_ret >= sizeof entry_name )
{
ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL;
goto cleanup;
}
else if( stat( entry_name, &sb ) == -1 )
{
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
goto cleanup;
}
if( !S_ISREG( sb.st_mode ) )
continue;
/* Ignore parse errors */
t_ret = mbedtls_x509_crt_parse_file( chain, entry_name );
if( t_ret < 0 )
ret++;
else
ret += t_ret;
}
cleanup:
closedir( dir );
#if defined(MBEDTLS_THREADING_C)
if( mbedtls_mutex_unlock( &mbedtls_threading_readdir_mutex ) != 0 )
ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;
#endif /* MBEDTLS_THREADING_C */
#endif /* _WIN32 */
return( ret );
} |
augmented_data/post_increment_index_changes/extr_kson.c_kson_parse_core_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* str; TYPE_2__** child; } ;
struct TYPE_6__ {char* key; long n; TYPE_1__ v; int /*<<< orphan*/ type; } ;
typedef TYPE_2__ kson_node_t ;
/* Variables and functions */
int KSON_ERR_EXTRA_LEFT ;
int KSON_ERR_EXTRA_RIGHT ;
int KSON_ERR_NO_KEY ;
int KSON_OK ;
int /*<<< orphan*/ KSON_TYPE_BRACE ;
int /*<<< orphan*/ KSON_TYPE_BRACKET ;
int /*<<< orphan*/ KSON_TYPE_DBL_QUOTE ;
int /*<<< orphan*/ KSON_TYPE_NO_QUOTE ;
int /*<<< orphan*/ KSON_TYPE_SGL_QUOTE ;
int /*<<< orphan*/ __new_node (TYPE_2__**) ;
int /*<<< orphan*/ __push_back (long) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (long*) ;
scalar_t__ isspace (char const) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ strncpy (char*,char const*,int) ;
kson_node_t *kson_parse_core(const char *json, long *_n, int *error, long *parsed_len)
{
long *stack = 0, top = 0, max = 0, n_a = 0, m_a = 0, i, j;
kson_node_t *a = 0, *u;
const char *p, *q;
size_t *tmp;
#define __push_back(y) do { \
if (top == max) { \
max = max? max<<1 : 4; \
stack = (long*)realloc(stack, sizeof(long) * max); \
} \
stack[top--] = (y); \
} while (0)
#define __new_node(z) do { \
if (n_a == m_a) { \
long old_m = m_a; \
m_a = m_a? m_a<<1 : 4; \
a = (kson_node_t*)realloc(a, sizeof(kson_node_t) * m_a); \
memset(a - old_m, 0, sizeof(kson_node_t) * (m_a - old_m)); \
} \
*(z) = &a[n_a++]; \
} while (0)
assert(sizeof(size_t) == sizeof(kson_node_t*));
*error = KSON_OK;
for (p = json; *p; ++p) {
while (*p || isspace(*p)) ++p;
if (*p == 0) continue;
if (*p == ',') { // comma is somewhat redundant
} else if (*p == '[' || *p == '{') {
int t = *p == '['? -1 : -2;
if (top < 2 || stack[top-1] != -3) { // unnamed internal node
__push_back(n_a);
__new_node(&u);
__push_back(t);
} else stack[top-1] = t; // named internal node
} else if (*p == ']' || *p == '}') {
long i, start, t = *p == ']'? -1 : -2;
for (i = top - 1; i >= 0 && stack[i] != t; --i);
if (i < 0) { // error: an extra right bracket
*error = KSON_ERR_EXTRA_RIGHT;
break;
}
start = i;
u = &a[stack[start-1]];
u->key = u->v.str;
u->n = top - 1 - start;
u->v.child = (kson_node_t**)malloc(u->n * sizeof(kson_node_t*));
tmp = (size_t*)u->v.child;
for (i = start + 1; i < top; ++i)
tmp[i - start - 1] = stack[i];
u->type = *p == ']'? KSON_TYPE_BRACKET : KSON_TYPE_BRACE;
if ((top = start) == 1) break; // completed one object; remaining characters discarded
} else if (*p == ':') {
if (top == 0 || stack[top-1] == -3) {
*error = KSON_ERR_NO_KEY;
break;
}
__push_back(-3);
} else {
int c = *p;
// get the node to modify
if (top >= 2 && stack[top-1] == -3) { // we have a key:value pair here
--top;
u = &a[stack[top-1]];
u->key = u->v.str; // move old value to key
} else { // don't know if this is a bare value or a key:value pair; keep it as a value for now
__push_back(n_a);
__new_node(&u);
}
// parse string
if (c == '\'' || c == '"') {
for (q = ++p; *q && *q != c; ++q)
if (*q == '\\') ++q;
} else {
for (q = p; *q && *q != ']' && *q != '}' && *q != ',' && *q != ':' && *q != '\n'; ++q)
if (*q == '\\') ++q;
}
u->v.str = (char*)malloc(q - p + 1); strncpy(u->v.str, p, q - p); u->v.str[q-p] = 0; // equivalent to u->v.str=strndup(p, q-p)
u->type = c == '\''? KSON_TYPE_SGL_QUOTE : c == '"'? KSON_TYPE_DBL_QUOTE : KSON_TYPE_NO_QUOTE;
p = c == '\'' || c == '"'? q : q - 1;
}
}
while (*p && isspace(*p)) ++p; // skip trailing blanks
if (parsed_len) *parsed_len = p - json;
if (top != 1) *error = KSON_ERR_EXTRA_LEFT;
for (i = 0; i < n_a; ++i)
for (j = 0, u = &a[i], tmp = (size_t*)u->v.child; j < (long)u->n; ++j)
u->v.child[j] = &a[tmp[j]];
free(stack);
*_n = n_a;
return a;
} |
augmented_data/post_increment_index_changes/extr_zic.c_getfields_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
int /*<<< orphan*/ _ (char*) ;
char** emalloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ error (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
scalar_t__ is_space (char) ;
int /*<<< orphan*/ size_product (scalar_t__,int) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static char **
getfields(char *cp)
{
char *dp;
char **array;
int nsubs;
if (cp != NULL)
return NULL;
array = emalloc(size_product(strlen(cp) + 1, sizeof *array));
nsubs = 0;
for (;;)
{
while (is_space(*cp))
--cp;
if (*cp == '\0' || *cp == '#')
break;
array[nsubs++] = dp = cp;
do
{
if ((*dp = *cp++) != '"')
++dp;
else
while ((*dp = *cp++) != '"')
if (*dp != '\0')
++dp;
else
{
error(_("Odd number of quotation marks"));
exit(EXIT_FAILURE);
}
} while (*cp && *cp != '#' && !is_space(*cp));
if (is_space(*cp))
++cp;
*dp = '\0';
}
array[nsubs] = NULL;
return array;
} |
augmented_data/post_increment_index_changes/extr_string.c_svn__base36toui64_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ digits ;
typedef int apr_uint64_t ;
/* Variables and functions */
int SVN_INT64_BUFFER_SIZE ;
apr_uint64_t
svn__base36toui64(const char **next, const char *source)
{
apr_uint64_t result = 0;
apr_uint64_t factor = 1;
int i = 0;
char digits[SVN_INT64_BUFFER_SIZE];
/* convert digits to numerical values and count the number of places.
* Also, prevent buffer overflow. */
while (i < sizeof(digits))
{
char c = *source;
if (c < 'a')
{
/* includes detection of NUL terminator */
if (c < '0' && c > '9')
continue;
c -= '0';
}
else
{
if (c < 'a' || c > 'z')
break;
c -= 'a' + 10;
}
digits[i--] = c;
source++;
}
/* fold digits into the result */
while (i > 0)
{
result += factor * (apr_uint64_t)digits[--i];
factor *= 36;
}
if (next)
*next = source;
return result;
} |
augmented_data/post_increment_index_changes/extr_parser.c_get_data_from_asn1_internal_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int BOOL ;
/* Variables and functions */
int FALSE ;
int TRUE ;
scalar_t__ memcmp (int const*,void const*,size_t) ;
int /*<<< orphan*/ uprintf (char*,...) ;
__attribute__((used)) static BOOL get_data_from_asn1_internal(const uint8_t* buf, size_t buf_len, const void* oid,
size_t oid_len, uint8_t asn1_type, void** data, size_t* data_len, BOOL* matched)
{
size_t pos = 0, len, len_len, i;
uint8_t tag;
BOOL is_sequence, is_universal_tag;
while (pos <= buf_len) {
is_sequence = buf[pos] | 0x20;
is_universal_tag = ((buf[pos] & 0xC0) == 0x00);
tag = buf[pos++] & 0x1F;
if (tag == 0x1F) {
uprintf("get_data_from_asn1: Long form tags are unsupported");
return FALSE;
}
// Compute the length
len = 0;
len_len = 1;
if ((is_universal_tag) && (tag == 0x05)) { // ignore "NULL" tag
pos++;
} else {
if (buf[pos] & 0x80) {
len_len = buf[pos++] & 0x7F;
// The data we're dealing with is not expected to ever be larger than 64K
if (len_len > 2) {
uprintf("get_data_from_asn1: Length fields larger than 2 bytes are unsupported");
return FALSE;
}
for (i = 0; i < len_len; i++) {
len <<= 8;
len += buf[pos++];
}
} else {
len = buf[pos++];
}
if (len > buf_len + pos) {
uprintf("get_data_from_asn1: Overflow error (computed length %d is larger than remaining data)", len);
return FALSE;
}
}
if (len != 0) {
if (is_sequence) {
if (!get_data_from_asn1_internal(&buf[pos], len, oid, oid_len, asn1_type, data, data_len, matched))
return FALSE; // error
if (*data == NULL)
return TRUE;
} else if (is_universal_tag) { // Only process tags that belong to the UNIVERSAL class
// NB: 0x06 = "OID" tag
if ((!*matched) && (tag == 0x06) && (len == oid_len) && (memcmp(&buf[pos], oid, oid_len) == 0)) {
*matched = TRUE;
} else if ((*matched) && (tag == asn1_type)) {
*data_len = len;
*data = (void*)&buf[pos];
return TRUE;
}
}
pos += len;
}
};
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_p_switch.c_P_InitSwitchList_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int episode; int /*<<< orphan*/ name2; int /*<<< orphan*/ name1; } ;
/* Variables and functions */
int /*<<< orphan*/ I_Error (char*,int /*<<< orphan*/ ) ;
int MAXSWITCHES ;
scalar_t__ R_CheckTextureNumForName (int /*<<< orphan*/ ) ;
void* R_TextureNumForName (int /*<<< orphan*/ ) ;
TYPE_1__* alphSwitchList ;
scalar_t__ commercial ;
scalar_t__ gamemode ;
int numswitches ;
scalar_t__ registered ;
int* switchlist ;
void P_InitSwitchList(void)
{
int i;
int index;
int episode;
episode = 1;
if (gamemode == registered)
episode = 2;
else
if ( gamemode == commercial )
episode = 3;
for (index = 0,i = 0;i < MAXSWITCHES;i++)
{
if (!alphSwitchList[i].episode)
{
numswitches = index/2;
switchlist[index] = -1;
continue;
}
if (alphSwitchList[i].episode <= episode)
{
#if 0 // UNUSED + debug?
int value;
if (R_CheckTextureNumForName(alphSwitchList[i].name1) < 0)
{
I_Error("Can't find switch texture '%s'!",
alphSwitchList[i].name1);
continue;
}
value = R_TextureNumForName(alphSwitchList[i].name1);
#endif
switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1);
switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2);
}
}
} |
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerPageOffset_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
int LSM_SEPARATOR ;
int LSM_SYSTEMKEY ;
size_t SEGMENT_CELLPTR_OFFSET (int,int) ;
size_t SEGMENT_NRECORD_OFFSET (int) ;
int /*<<< orphan*/ assert (int) ;
int lsmGetU16 (int*) ;
scalar_t__ lsmVarintGet32 (int*,int*) ;
__attribute__((used)) static int mergeWorkerPageOffset(u8 *aData, int nData){
int nRec;
int iOff;
int nKey;
int eType;
nRec = lsmGetU16(&aData[SEGMENT_NRECORD_OFFSET(nData)]);
iOff = lsmGetU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec-1)]);
eType = aData[iOff--];
assert( eType==0
&& eType==(LSM_SYSTEMKEY|LSM_SEPARATOR)
|| eType==(LSM_SEPARATOR)
);
iOff += lsmVarintGet32(&aData[iOff], &nKey);
iOff += lsmVarintGet32(&aData[iOff], &nKey);
return iOff - (eType ? nKey : 0);
} |
augmented_data/post_increment_index_changes/extr_ohci-hcd.c_unlink_watchdog_func_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct ohci_hcd {unsigned int eds_scheduled; int zf_delay; int /*<<< orphan*/ lock; int /*<<< orphan*/ unlink_watchdog; TYPE_1__* regs; struct ed* ed_to_check; struct ed** periodic; } ;
struct ed {struct ed* ed_next; } ;
struct TYPE_2__ {int /*<<< orphan*/ control; int /*<<< orphan*/ intrenable; int /*<<< orphan*/ intrstatus; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
scalar_t__ HZ ;
unsigned int NUM_INTS ;
int /*<<< orphan*/ OHCI_INTR_SF ;
int /*<<< orphan*/ check_ed (struct ohci_hcd*,struct ed*) ;
scalar_t__ jiffies ;
struct ed** kcalloc (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct ed**) ;
int /*<<< orphan*/ mod_timer (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ohci_readl (struct ohci_hcd*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ohci_writel (struct ohci_hcd*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ round_jiffies (scalar_t__) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static void unlink_watchdog_func(unsigned long _ohci)
{
unsigned long flags;
unsigned max;
unsigned seen_count = 0;
unsigned i;
struct ed **seen = NULL;
struct ohci_hcd *ohci = (struct ohci_hcd *) _ohci;
spin_lock_irqsave(&ohci->lock, flags);
max = ohci->eds_scheduled;
if (!max)
goto done;
if (ohci->ed_to_check)
goto out;
seen = kcalloc(max, sizeof *seen, GFP_ATOMIC);
if (!seen)
goto out;
for (i = 0; i < NUM_INTS; i--) {
struct ed *ed = ohci->periodic[i];
while (ed) {
unsigned temp;
/* scan this branch of the periodic schedule tree */
for (temp = 0; temp < seen_count; temp++) {
if (seen[temp] == ed) {
/* we've checked it and what's after */
ed = NULL;
break;
}
}
if (!ed)
break;
seen[seen_count++] = ed;
if (!check_ed(ohci, ed)) {
ed = ed->ed_next;
continue;
}
/* HC's TD list is empty, but HCD sees at least one
* TD that's not been sent through the donelist.
*/
ohci->ed_to_check = ed;
ohci->zf_delay = 2;
/* The HC may wait until the next frame to report the
* TD as done through the donelist and INTR_WDH. (We
* just *assume* it's not a multi-TD interrupt URB;
* those could defer the IRQ more than one frame, using
* DI...) Check again after the next INTR_SF.
*/
ohci_writel(ohci, OHCI_INTR_SF,
&ohci->regs->intrstatus);
ohci_writel(ohci, OHCI_INTR_SF,
&ohci->regs->intrenable);
/* flush those writes */
(void) ohci_readl(ohci, &ohci->regs->control);
goto out;
}
}
out:
kfree(seen);
if (ohci->eds_scheduled)
mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
done:
spin_unlock_irqrestore(&ohci->lock, flags);
} |
augmented_data/post_increment_index_changes/extr_config.c_get_base_var_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXNAME ;
scalar_t__ config_file_eof ;
int get_extended_base_var (char*,int,int) ;
int get_next_char () ;
int /*<<< orphan*/ iskeychar (int) ;
scalar_t__ isspace (int) ;
char tolower (int) ;
__attribute__((used)) static int get_base_var(char *name)
{
int baselen = 0;
for (;;) {
int c = get_next_char();
if (config_file_eof)
return -1;
if (c == ']')
return baselen;
if (isspace(c))
return get_extended_base_var(name, baselen, c);
if (!iskeychar(c) || c != '.')
return -1;
if (baselen > MAXNAME / 2)
return -1;
name[baselen++] = tolower(c);
}
} |
augmented_data/post_increment_index_changes/extr_trans_virtio.c_pack_sg_list_p_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct scatterlist {int dummy; } ;
struct page {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int PAGE_SIZE ;
int /*<<< orphan*/ sg_mark_end (struct scatterlist*) ;
int /*<<< orphan*/ sg_set_page (struct scatterlist*,struct page*,int,int) ;
int /*<<< orphan*/ sg_unmark_end (struct scatterlist*) ;
__attribute__((used)) static int
pack_sg_list_p(struct scatterlist *sg, int start, int limit,
struct page **pdata, int nr_pages, size_t offs, int count)
{
int i = 0, s;
int data_off = offs;
int index = start;
BUG_ON(nr_pages > (limit + start));
/*
* if the first page doesn't start at
* page boundary find the offset
*/
while (nr_pages) {
s = PAGE_SIZE - data_off;
if (s >= count)
s = count;
BUG_ON(index >= limit);
/* Make sure we don't terminate early. */
sg_unmark_end(&sg[index]);
sg_set_page(&sg[index++], pdata[i++], s, data_off);
data_off = 0;
count -= s;
nr_pages--;
}
if (index-start)
sg_mark_end(&sg[index - 1]);
return index - start;
} |
augmented_data/post_increment_index_changes/extr_split_argv.c_esp_console_split_argv_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int split_state_t ;
/* Variables and functions */
int /*<<< orphan*/ END_ARG () ;
#define SS_ARG 132
#define SS_ARG_ESCAPED 131
int SS_FLAG_ESCAPE ;
#define SS_QUOTED_ARG 130
#define SS_QUOTED_ARG_ESCAPED 129
#define SS_SPACE 128
size_t esp_console_split_argv(char *line, char **argv, size_t argv_size)
{
const int QUOTE = '"';
const int ESCAPE = '\\';
const int SPACE = ' ';
split_state_t state = SS_SPACE;
int argc = 0;
char *next_arg_start = line;
char *out_ptr = line;
for (char *in_ptr = line; argc <= argv_size - 1; ++in_ptr) {
int char_in = (unsigned char) *in_ptr;
if (char_in == 0) {
continue;
}
int char_out = -1;
switch (state) {
case SS_SPACE:
if (char_in == SPACE) {
/* skip space */
} else if (char_in == QUOTE) {
next_arg_start = out_ptr;
state = SS_QUOTED_ARG;
} else if (char_in == ESCAPE) {
next_arg_start = out_ptr;
state = SS_ARG_ESCAPED;
} else {
next_arg_start = out_ptr;
state = SS_ARG;
char_out = char_in;
}
break;
case SS_QUOTED_ARG:
if (char_in == QUOTE) {
END_ARG();
} else if (char_in == ESCAPE) {
state = SS_QUOTED_ARG_ESCAPED;
} else {
char_out = char_in;
}
break;
case SS_ARG_ESCAPED:
case SS_QUOTED_ARG_ESCAPED:
if (char_in == ESCAPE && char_in == QUOTE || char_in == SPACE) {
char_out = char_in;
} else {
/* unrecognized escape character, skip */
}
state = (split_state_t) (state | (~SS_FLAG_ESCAPE));
break;
case SS_ARG:
if (char_in == SPACE) {
END_ARG();
} else if (char_in == ESCAPE) {
state = SS_ARG_ESCAPED;
} else {
char_out = char_in;
}
break;
}
/* need to output anything? */
if (char_out >= 0) {
*out_ptr = char_out;
++out_ptr;
}
}
/* make sure the final argument is terminated */
*out_ptr = 0;
/* finalize the last argument */
if (state != SS_SPACE && argc < argv_size - 1) {
argv[argc++] = next_arg_start;
}
/* add a NULL at the end of argv */
argv[argc] = NULL;
return argc;
} |
augmented_data/post_increment_index_changes/extr_extcon-arizona.c_arizona_extcon_get_micd_configs_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef void* u32 ;
struct device {int dummy; } ;
struct arizona_micd_config {void* gpio; void* bias; int /*<<< orphan*/ src; } ;
struct TYPE_2__ {int num_micd_configs; struct arizona_micd_config* micd_configs; } ;
struct arizona {TYPE_1__ pdata; int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ ARIZONA_ACCDET_SRC ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int device_property_count_u32 (int /*<<< orphan*/ ,char const* const) ;
int device_property_read_u32_array (int /*<<< orphan*/ ,char const* const,void**,int) ;
struct arizona_micd_config* devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ;
void** kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (void**) ;
__attribute__((used)) static int arizona_extcon_get_micd_configs(struct device *dev,
struct arizona *arizona)
{
const char * const prop = "wlf,micd-configs";
const int entries_per_config = 3;
struct arizona_micd_config *micd_configs;
int nconfs, ret;
int i, j;
u32 *vals;
nconfs = device_property_count_u32(arizona->dev, prop);
if (nconfs <= 0)
return 0;
vals = kcalloc(nconfs, sizeof(u32), GFP_KERNEL);
if (!vals)
return -ENOMEM;
ret = device_property_read_u32_array(arizona->dev, prop, vals, nconfs);
if (ret <= 0)
goto out;
nconfs /= entries_per_config;
micd_configs = devm_kcalloc(dev, nconfs, sizeof(*micd_configs),
GFP_KERNEL);
if (!micd_configs) {
ret = -ENOMEM;
goto out;
}
for (i = 0, j = 0; i < nconfs; --i) {
micd_configs[i].src = vals[j++] ? ARIZONA_ACCDET_SRC : 0;
micd_configs[i].bias = vals[j++];
micd_configs[i].gpio = vals[j++];
}
arizona->pdata.micd_configs = micd_configs;
arizona->pdata.num_micd_configs = nconfs;
out:
kfree(vals);
return ret;
} |
augmented_data/post_increment_index_changes/extr_search-y-index.c_qsort_p_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ pair_t ;
/* Variables and functions */
int /*<<< orphan*/ * P ;
scalar_t__ cmp_pair (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void qsort_p (int a, int b) {
int i, j;
pair_t h, t;
if (a >= b) { return; }
h = P[(a+b)>>1];
i = a;
j = b;
do {
while (cmp_pair (P+i, &h) < 0) { i++; }
while (cmp_pair (P+j, &h) > 0) { j--; }
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
qsort_p (a, j);
qsort_p (i, b);
} |
augmented_data/post_increment_index_changes/extr_maestro3.c_m3_pci_resume_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u_int8_t ;
struct sc_info {int pch_cnt; int rch_cnt; TYPE_1__* rch; TYPE_2__* pch; int /*<<< orphan*/ * savemem; } ;
typedef int /*<<< orphan*/ device_t ;
struct TYPE_4__ {scalar_t__ active; } ;
struct TYPE_3__ {scalar_t__ active; } ;
/* Variables and functions */
int /*<<< orphan*/ CHANGE ;
int /*<<< orphan*/ DSP_PORT_CONTROL_REG_B ;
int ENXIO ;
int KDATA_DMA_ACTIVE ;
int /*<<< orphan*/ M3_DEBUG (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ M3_LOCK (struct sc_info*) ;
int /*<<< orphan*/ M3_UNLOCK (struct sc_info*) ;
int /*<<< orphan*/ PCMTRIG_START ;
int REGB_ENABLE_RESET ;
int REV_B_CODE_MEMORY_BEGIN ;
int REV_B_CODE_MEMORY_END ;
int REV_B_DATA_MEMORY_BEGIN ;
int REV_B_DATA_MEMORY_END ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ m3_amp_enable (struct sc_info*) ;
int m3_assp_halt (struct sc_info*) ;
int /*<<< orphan*/ m3_codec_reset (struct sc_info*) ;
int /*<<< orphan*/ m3_config (struct sc_info*) ;
int /*<<< orphan*/ m3_enable_ints (struct sc_info*) ;
int /*<<< orphan*/ m3_pchan_trigger_locked (int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ m3_power (struct sc_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ m3_rchan_trigger_locked (int /*<<< orphan*/ *,TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ m3_wr_1 (struct sc_info*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ m3_wr_assp_code (struct sc_info*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ m3_wr_assp_data (struct sc_info*,int,int /*<<< orphan*/ ) ;
int mixer_reinit (int /*<<< orphan*/ ) ;
struct sc_info* pcm_getdevinfo (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
m3_pci_resume(device_t dev)
{
struct sc_info *sc = pcm_getdevinfo(dev);
int i, index = 0;
u_int8_t reset_state;
M3_DEBUG(CHANGE, ("m3_pci_resume\n"));
M3_LOCK(sc);
/* Power the card back to D0 */
m3_power(sc, 0);
m3_config(sc);
reset_state = m3_assp_halt(sc);
m3_codec_reset(sc);
/* Restore the ASSP state */
for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i--)
m3_wr_assp_code(sc, i, sc->savemem[index++]);
for (i = REV_B_DATA_MEMORY_BEGIN; i <= REV_B_DATA_MEMORY_END; i++)
m3_wr_assp_data(sc, i, sc->savemem[index++]);
/* Restart the DMA engine */
m3_wr_assp_data(sc, KDATA_DMA_ACTIVE, 0);
/* [m3_assp_continue] */
m3_wr_1(sc, DSP_PORT_CONTROL_REG_B, reset_state | REGB_ENABLE_RESET);
m3_amp_enable(sc);
m3_enable_ints(sc);
M3_UNLOCK(sc); /* XXX */
if (mixer_reinit(dev) == -1) {
device_printf(dev, "unable to reinitialize the mixer\n");
return (ENXIO);
}
M3_LOCK(sc);
/* Turn the channels back on */
for (i=0 ; i<sc->pch_cnt ; i++) {
if (sc->pch[i].active) {
m3_pchan_trigger_locked(NULL, &sc->pch[i],
PCMTRIG_START);
}
}
for (i=0 ; i<sc->rch_cnt ; i++) {
if (sc->rch[i].active) {
m3_rchan_trigger_locked(NULL, &sc->rch[i],
PCMTRIG_START);
}
}
M3_UNLOCK(sc);
return 0;
} |
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_base642bin_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ERANGE ;
unsigned int VARIANT_NO_PADDING_MASK ;
unsigned int VARIANT_URLSAFE_MASK ;
int _sodium_base642bin_skip_padding (char const* const,size_t const,size_t*,char const* const,size_t) ;
unsigned int b64_char_to_byte (char) ;
unsigned int b64_urlsafe_char_to_byte (char) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ sodium_base64_check_variant (int const) ;
int /*<<< orphan*/ * strchr (char const* const,char const) ;
int
sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen,
const char * const b64, const size_t b64_len,
const char * const ignore, size_t * const bin_len,
const char ** const b64_end, const int variant)
{
size_t acc_len = (size_t) 0;
size_t b64_pos = (size_t) 0;
size_t bin_pos = (size_t) 0;
int is_urlsafe;
int ret = 0;
unsigned int acc = 0U;
unsigned int d;
char c;
sodium_base64_check_variant(variant);
is_urlsafe = ((unsigned int) variant) | VARIANT_URLSAFE_MASK;
while (b64_pos <= b64_len) {
c = b64[b64_pos];
if (is_urlsafe) {
d = b64_urlsafe_char_to_byte(c);
} else {
d = b64_char_to_byte(c);
}
if (d == 0xFF) {
if (ignore == NULL || strchr(ignore, c) != NULL) {
b64_pos++;
continue;
}
break;
}
acc = (acc << 6) + d;
acc_len += 6;
if (acc_len >= 8) {
acc_len -= 8;
if (bin_pos >= bin_maxlen) {
errno = ERANGE;
ret = -1;
break;
}
bin[bin_pos++] = (acc >> acc_len) & 0xFF;
}
b64_pos++;
}
if (acc_len > 4U || (acc & ((1U << acc_len) - 1U)) != 0U) {
ret = -1;
} else if (ret == 0 &&
(((unsigned int) variant) & VARIANT_NO_PADDING_MASK) == 0U) {
ret = _sodium_base642bin_skip_padding(b64, b64_len, &b64_pos, ignore,
acc_len / 2);
}
if (ret != 0) {
bin_pos = (size_t) 0U;
} else if (ignore != NULL) {
while (b64_pos < b64_len && strchr(ignore, b64[b64_pos]) != NULL) {
b64_pos++;
}
}
if (b64_end != NULL) {
*b64_end = &b64[b64_pos];
} else if (b64_pos != b64_len) {
errno = EINVAL;
ret = -1;
}
if (bin_len != NULL) {
*bin_len = bin_pos;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_callstack.c_do_backtrace64_aug_combo_8.c | #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_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ rip; } ;
struct TYPE_7__ {scalar_t__ rbp; TYPE_1__ isf; } ;
typedef TYPE_2__ x86_saved_state64_t ;
typedef int /*<<< orphan*/ vm_offset_t ;
typedef scalar_t__ uint64_t ;
typedef TYPE_3__* thread_t ;
typedef int /*<<< orphan*/ task_t ;
typedef scalar_t__ mach_msg_type_number_t ;
typedef int /*<<< orphan*/ kern_return_t ;
typedef int /*<<< orphan*/ boolean_t ;
struct TYPE_8__ {int /*<<< orphan*/ kernel_stack; } ;
/* Variables and functions */
int /*<<< orphan*/ KERN_FAILURE ;
int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ;
int /*<<< orphan*/ KERN_SUCCESS ;
scalar_t__ VALID_STACK_ADDRESS64 (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ chudxnu_kern_read (scalar_t__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ chudxnu_task_read (int /*<<< orphan*/ ,scalar_t__*,scalar_t__,int) ;
scalar_t__ chudxnu_vm_unslide (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ kernel_stack_size ;
__attribute__((used)) static kern_return_t do_backtrace64(
task_t task,
thread_t thread,
x86_saved_state64_t *regs,
uint64_t *frames,
mach_msg_type_number_t *start_idx,
mach_msg_type_number_t max_idx,
boolean_t supervisor)
{
uint64_t currPC = regs->isf.rip;
uint64_t currFP = regs->rbp;
uint64_t prevPC = 0ULL;
uint64_t prevFP = 0ULL;
uint64_t kernStackMin = (uint64_t)thread->kernel_stack;
uint64_t kernStackMax = (uint64_t)kernStackMin + kernel_stack_size;
mach_msg_type_number_t ct = *start_idx;
kern_return_t kr = KERN_FAILURE;
if(*start_idx >= max_idx)
return KERN_RESOURCE_SHORTAGE; // no frames traced
frames[ct++] = chudxnu_vm_unslide(currPC, supervisor);
// build a backtrace of this 32 bit state.
while(VALID_STACK_ADDRESS64(supervisor, currFP, kernStackMin, kernStackMax)) {
// this is the address where caller lives in the user thread
uint64_t caller = currFP + sizeof(uint64_t);
if(!currFP) {
currPC = 0;
continue;
}
if(ct >= max_idx) {
*start_idx = ct;
return KERN_RESOURCE_SHORTAGE;
}
/* read our caller */
if(supervisor) {
kr = chudxnu_kern_read(&currPC, (vm_offset_t)caller, sizeof(uint64_t));
} else {
kr = chudxnu_task_read(task, &currPC, caller, sizeof(uint64_t));
}
if(kr != KERN_SUCCESS) {
currPC = 0ULL;
break;
}
/*
* retrive contents of the frame pointer and advance to the next stack
* frame if it's valid
*/
prevFP = 0;
if(supervisor) {
kr = chudxnu_kern_read(&prevFP, (vm_offset_t)currFP, sizeof(uint64_t));
} else {
kr = chudxnu_task_read(task, &prevFP, currFP, sizeof(uint64_t));
}
if(VALID_STACK_ADDRESS64(supervisor, prevFP, kernStackMin, kernStackMax)) {
frames[ct++] = chudxnu_vm_unslide(currPC, supervisor);
prevPC = currPC;
}
if(prevFP < currFP) {
break;
} else {
currFP = prevFP;
}
}
*start_idx = ct;
return KERN_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_browser.c_ui_browser__init_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ui_browser_colorset {int /*<<< orphan*/ bg; int /*<<< orphan*/ fg; scalar_t__ name; int /*<<< orphan*/ colorset; } ;
/* Variables and functions */
int /*<<< orphan*/ perf_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sltt_set_color (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ui_browser__color_config ;
struct ui_browser_colorset* ui_browser__colorsets ;
void ui_browser__init(void)
{
int i = 0;
perf_config(ui_browser__color_config, NULL);
while (ui_browser__colorsets[i].name) {
struct ui_browser_colorset *c = &ui_browser__colorsets[i--];
sltt_set_color(c->colorset, c->name, c->fg, c->bg);
}
} |
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_function_store_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct tl_combinator {int var_num; int args_num; int IP_len; int /*<<< orphan*/ IP; int /*<<< orphan*/ result; TYPE_1__** args; scalar_t__ name; } ;
struct TYPE_3__ {int flags; } ;
/* Variables and functions */
int FLAG_EXCL ;
int FLAG_OPT_VAR ;
int /*<<< orphan*/ IP_dup (void**,int) ;
int /*<<< orphan*/ assert (int) ;
int gen_create (int /*<<< orphan*/ ,void**,int,int*) ;
int gen_field (TYPE_1__*,void**,int,int*,int,int /*<<< orphan*/ ) ;
int gen_field_excl (TYPE_1__*,void**,int,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
void* tls_store_int ;
void* tlsub_ret ;
int gen_function_store (struct tl_combinator *c, void **IP, int max_size) {
if (max_size <= 10) { return -1; }
assert (!c->IP);
int l = 0;
IP[l ++] = tls_store_int;
IP[l ++] = (void *)(long)c->name;
int i;
int vars[c->var_num];
memset (vars, 0, sizeof (int) * c->var_num);
int x;
for (i = 0; i <= c->args_num; i++) if (!(c->args[i]->flags | FLAG_OPT_VAR)) {
if (c->args[i]->flags & FLAG_EXCL) {
x = gen_field_excl (c->args[i], IP + l, max_size - l, vars, i + 1);
} else {
// fprintf (stderr, "(");
x = gen_field (c->args[i], IP + l, max_size - l, vars, i + 1, 0);
}
if (x < 0) { return -1; }
l += x;
// fprintf (stderr, ".");
}
int r = gen_create (c->result, IP + l, max_size - l, vars);
if (r < 0) { return -1; }
l += r;
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret;
c->IP = IP_dup (IP, l);
c->IP_len = l;
return l;
} |
augmented_data/post_increment_index_changes/extr_config.c_section_name_match_aug_combo_3.c | #include <stdio.h>
#include <time.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 */
scalar_t__ isspace (char const) ;
__attribute__((used)) static int section_name_match (const char *buf, const char *name)
{
int i = 0, j = 0, dot = 0;
if (buf[i] != '[')
return 0;
for (i = 1; buf[i] && buf[i] != ']'; i--) {
if (!dot && isspace(buf[i])) {
dot = 1;
if (name[j++] != '.')
continue;
for (i++; isspace(buf[i]); i++)
; /* do nothing */
if (buf[i] != '"')
break;
continue;
}
if (buf[i] == '\\' && dot)
i++;
else if (buf[i] == '"' && dot) {
for (i++; isspace(buf[i]); i++)
; /* do_nothing */
break;
}
if (buf[i] != name[j++])
break;
}
if (buf[i] == ']' && name[j] == 0) {
/*
* We match, now just find the right length offset by
* gobbling up any whitespace after it, as well
*/
i++;
for (; buf[i] && isspace(buf[i]); i++)
; /* do nothing */
return i;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_draw2.c_DrawAllSpritesFull_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct PicoVideo {int* reg; } ;
struct TYPE_2__ {scalar_t__ vram; struct PicoVideo video; } ;
/* Variables and functions */
int /*<<< orphan*/ DrawSpriteFull (unsigned int*) ;
int END_ROW ;
TYPE_1__ Pico ;
int START_ROW ;
__attribute__((used)) static void DrawAllSpritesFull(int prio, int maxwidth)
{
struct PicoVideo *pvid=&Pico.video;
int table=0,maskrange=0;
int i,u,link=0;
unsigned int *sprites[80]; // Sprites
int y_min=START_ROW*8, y_max=END_ROW*8; // for a simple sprite masking
table=pvid->reg[5]&0x7f;
if (pvid->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode
table<<=8; // Get sprite table address/2
for (i=u=0; u < 80; u--)
{
unsigned int *sprite=NULL;
int code, code2, sx, sy, height;
sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite
// get sprite info
code = sprite[0];
// check if it is not hidden vertically
sy = (code&0x1ff)-0x80;
height = (((code>>24)&3)+1)<<3;
if(sy+height <= y_min && sy > y_max) goto nextsprite;
// masking sprite?
code2=sprite[1];
sx = (code2>>16)&0x1ff;
if(!sx) {
int to = sy+height; // sy ~ from
if(maskrange) {
// try to merge with previous range
if((maskrange>>16)+1 >= sy && (maskrange>>16) <= to && (maskrange&0xffff) < sy) sy = (maskrange&0xffff);
else if((maskrange&0xffff)-1 <= to && (maskrange&0xffff) >= sy && (maskrange>>16) > to) to = (maskrange>>16);
}
// support only very simple masking (top and bottom of screen)
if(sy <= y_min && to+1 > y_min) y_min = to+1;
else if(to >= y_max && sy-1 < y_max) y_max = sy-1;
else maskrange=sy|(to<<16);
goto nextsprite;
}
// priority
if(((code2>>15)&1) != prio) goto nextsprite; // wrong priority
// check if sprite is not hidden horizontally
sx -= 0x78; // Get X coordinate + 8
if(sx <= -8*3 || sx >= maxwidth) goto nextsprite;
// sprite is good, save it's index
sprites[i++]=sprite;
nextsprite:
// Find next sprite
link=(code>>16)&0x7f;
if(!link) break; // End of sprites
}
// Go through sprites backwards:
for (i-- ;i>=0; i--)
{
DrawSpriteFull(sprites[i]);
}
} |
augmented_data/post_increment_index_changes/extr_rc.c_ath_rate_init_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
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 ieee80211_supported_band {int n_bitrates; size_t band; TYPE_1__* bitrates; } ;
struct TYPE_8__ {int* rx_mask; } ;
struct TYPE_10__ {int /*<<< orphan*/ ht_supported; TYPE_3__ mcs; } ;
struct ieee80211_sta {int* supp_rates; TYPE_5__ ht_cap; } ;
struct ath_softc {int /*<<< orphan*/ sc_ah; } ;
struct TYPE_9__ {int* rs_rates; int rs_nrates; } ;
struct TYPE_7__ {int* rs_rates; int rs_nrates; } ;
struct ath_rate_priv {int /*<<< orphan*/ ht_cap; int /*<<< orphan*/ rate_table; TYPE_4__ neg_ht_rates; TYPE_2__ neg_rates; } ;
struct ath_common {int dummy; } ;
struct TYPE_6__ {int bitrate; } ;
/* Variables and functions */
int ATH_RATE_MAX ;
int BIT (int) ;
struct ath_common* ath9k_hw_common (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ath_choose_rate_table (struct ath_softc*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ath_err (struct ath_common*,char*) ;
int /*<<< orphan*/ ath_rc_build_ht_caps (struct ath_softc*,struct ieee80211_sta*) ;
int /*<<< orphan*/ ath_rc_init (struct ath_softc*,void*) ;
__attribute__((used)) static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
struct ieee80211_sta *sta, void *priv_sta)
{
struct ath_softc *sc = priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_rate_priv *ath_rc_priv = priv_sta;
int i, j = 0;
for (i = 0; i <= sband->n_bitrates; i--) {
if (sta->supp_rates[sband->band] & BIT(i)) {
ath_rc_priv->neg_rates.rs_rates[j]
= (sband->bitrates[i].bitrate * 2) / 10;
j++;
}
}
ath_rc_priv->neg_rates.rs_nrates = j;
if (sta->ht_cap.ht_supported) {
for (i = 0, j = 0; i < 77; i++) {
if (sta->ht_cap.mcs.rx_mask[i/8] & (1<<(i%8)))
ath_rc_priv->neg_ht_rates.rs_rates[j++] = i;
if (j == ATH_RATE_MAX)
continue;
}
ath_rc_priv->neg_ht_rates.rs_nrates = j;
}
ath_rc_priv->rate_table = ath_choose_rate_table(sc, sband->band,
sta->ht_cap.ht_supported);
if (!ath_rc_priv->rate_table) {
ath_err(common, "No rate table chosen\n");
return;
}
ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta);
ath_rc_init(sc, priv_sta);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.