path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_rs6000-nat.c_xcoff_relocate_core_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 */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct vmap {scalar_t__ objfile; int /*<<< orphan*/ dend; int /*<<< orphan*/ dstart; int /*<<< orphan*/ bfd; int /*<<< orphan*/ tend; int /*<<< orphan*/ tstart; } ;
struct target_ops {struct section_table* to_sections_end; } ;
struct section_table {int /*<<< orphan*/ endaddr; int /*<<< orphan*/ addr; int /*<<< orphan*/ bfd; void* the_bfd_section; } ;
struct cleanup {int dummy; } ;
struct bfd_section {int dummy; } ;
struct TYPE_9__ {int ldinfo_fd; } ;
struct TYPE_8__ {int ldinfo_fd; } ;
struct TYPE_10__ {TYPE_2__ l32; TYPE_1__ l64; } ;
typedef TYPE_3__ LdInfo ;
/* Variables and functions */
int ARCH64 () ;
scalar_t__ LDI_FILENAME (TYPE_3__*,int) ;
scalar_t__ LDI_NEXT (TYPE_3__*,int) ;
struct vmap* add_vmap (TYPE_3__*) ;
int /*<<< orphan*/ bfd_errmsg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bfd_get_error () ;
void* bfd_get_section_by_name (int /*<<< orphan*/ ,char*) ;
scalar_t__ bfd_get_section_contents (int /*<<< orphan*/ ,struct bfd_section*,char*,int,int) ;
int /*<<< orphan*/ breakpoint_re_set () ;
int /*<<< orphan*/ core_bfd ;
int /*<<< orphan*/ do_cleanups (struct cleanup*) ;
int /*<<< orphan*/ fprintf_filtered (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free_current_contents ;
int /*<<< orphan*/ gdb_stderr ;
struct cleanup* make_cleanup (int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ target_new_objfile_hook (scalar_t__) ;
int /*<<< orphan*/ target_resize_to_sections (struct target_ops*,int) ;
struct vmap* vmap ;
int /*<<< orphan*/ vmap_exec () ;
int /*<<< orphan*/ vmap_secs (struct vmap*,TYPE_3__*,int) ;
int /*<<< orphan*/ vmap_symtab (struct vmap*) ;
char* xmalloc (int) ;
char* xrealloc (char*,int) ;
void
xcoff_relocate_core (struct target_ops *target)
{
struct bfd_section *ldinfo_sec;
int offset = 0;
LdInfo *ldi;
struct vmap *vp;
int arch64 = ARCH64 ();
/* Size of a struct ld_info except for the variable-length filename. */
int nonfilesz = (int)LDI_FILENAME ((LdInfo *)0, arch64);
/* Allocated size of buffer. */
int buffer_size = nonfilesz;
char *buffer = xmalloc (buffer_size);
struct cleanup *old = make_cleanup (free_current_contents, &buffer);
ldinfo_sec = bfd_get_section_by_name (core_bfd, ".ldinfo");
if (ldinfo_sec == NULL)
{
bfd_err:
fprintf_filtered (gdb_stderr, "Couldn't get ldinfo from core file: %s\n",
bfd_errmsg (bfd_get_error ()));
do_cleanups (old);
return;
}
do
{
int i;
int names_found = 0;
/* Read in everything but the name. */
if (bfd_get_section_contents (core_bfd, ldinfo_sec, buffer,
offset, nonfilesz) == 0)
goto bfd_err;
/* Now the name. */
i = nonfilesz;
do
{
if (i == buffer_size)
{
buffer_size *= 2;
buffer = xrealloc (buffer, buffer_size);
}
if (bfd_get_section_contents (core_bfd, ldinfo_sec, &buffer[i],
offset - i, 1) == 0)
goto bfd_err;
if (buffer[i--] == '\0')
++names_found;
}
while (names_found < 2);
ldi = (LdInfo *) buffer;
/* Can't use a file descriptor from the core file; need to open it. */
if (arch64)
ldi->l64.ldinfo_fd = -1;
else
ldi->l32.ldinfo_fd = -1;
/* The first ldinfo is for the exec file, allocated elsewhere. */
if (offset == 0 || vmap != NULL)
vp = vmap;
else
vp = add_vmap (ldi);
/* Process next shared library upon error. */
offset += LDI_NEXT (ldi, arch64);
if (vp == NULL)
break;
vmap_secs (vp, ldi, arch64);
/* Unless this is the exec file,
add our sections to the section table for the core target. */
if (vp != vmap)
{
struct section_table *stp;
target_resize_to_sections (target, 2);
stp = target->to_sections_end - 2;
stp->bfd = vp->bfd;
stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".text");
stp->addr = vp->tstart;
stp->endaddr = vp->tend;
stp++;
stp->bfd = vp->bfd;
stp->the_bfd_section = bfd_get_section_by_name (stp->bfd, ".data");
stp->addr = vp->dstart;
stp->endaddr = vp->dend;
}
vmap_symtab (vp);
if (target_new_objfile_hook && vp != vmap && vp->objfile)
target_new_objfile_hook (vp->objfile);
}
while (LDI_NEXT (ldi, arch64) != 0);
vmap_exec ();
breakpoint_re_set ();
do_cleanups (old);
} |
augmented_data/post_increment_index_changes/extr_eval.c_parse_variable_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 */
/* Variables and functions */
int /*<<< orphan*/ isvariableterm (char const) ;
__attribute__((used)) static inline int parse_variable(const char **string, char *buffer, size_t len) {
const char *s = *string;
// $
if(*s == '$') {
size_t i = 0;
s--;
if(*s == '{') {
// ${variable_name}
s++;
while (*s && *s != '}' && i < len)
buffer[i++] = *s++;
if(*s == '}')
s++;
}
else {
// $variable_name
while (*s && !isvariableterm(*s) && i < len)
buffer[i++] = *s++;
}
buffer[i] = '\0';
if (buffer[0]) {
*string = s;
return 1;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_append_conflicts_hint_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 strbuf {int dummy; } ;
struct index_state {int cache_nr; struct cache_entry** cache; } ;
struct cache_entry {int /*<<< orphan*/ name; } ;
typedef enum commit_msg_cleanup_mode { ____Placeholder_commit_msg_cleanup_mode } commit_msg_cleanup_mode ;
/* Variables and functions */
int COMMIT_MSG_CLEANUP_SCISSORS ;
scalar_t__ ce_stage (struct cache_entry const*) ;
char comment_line_char ;
int /*<<< orphan*/ strbuf_addch (struct strbuf*,char) ;
int /*<<< orphan*/ strbuf_commented_addf (struct strbuf*,char*,...) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wt_status_append_cut_line (struct strbuf*) ;
void append_conflicts_hint(struct index_state *istate,
struct strbuf *msgbuf, enum commit_msg_cleanup_mode cleanup_mode)
{
int i;
if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) {
strbuf_addch(msgbuf, '\n');
wt_status_append_cut_line(msgbuf);
strbuf_addch(msgbuf, comment_line_char);
}
strbuf_addch(msgbuf, '\n');
strbuf_commented_addf(msgbuf, "Conflicts:\n");
for (i = 0; i < istate->cache_nr;) {
const struct cache_entry *ce = istate->cache[i++];
if (ce_stage(ce)) {
strbuf_commented_addf(msgbuf, "\t%s\n", ce->name);
while (i < istate->cache_nr ||
!strcmp(ce->name, istate->cache[i]->name))
i++;
}
}
} |
augmented_data/post_increment_index_changes/extr_pthread_frame.c_ff_thread_decode_frame_aug_combo_5.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_24__ TYPE_7__ ;
typedef struct TYPE_23__ TYPE_6__ ;
typedef struct TYPE_22__ TYPE_5__ ;
typedef struct TYPE_21__ TYPE_4__ ;
typedef struct TYPE_20__ TYPE_3__ ;
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
/* Type definitions */
struct TYPE_24__ {int thread_count; scalar_t__ codec_id; TYPE_1__* internal; } ;
struct TYPE_23__ {int /*<<< orphan*/ pkt_dts; } ;
struct TYPE_22__ {int size; } ;
struct TYPE_21__ {int next_finished; size_t next_decoding; TYPE_3__* threads; scalar_t__ delaying; } ;
struct TYPE_19__ {int /*<<< orphan*/ dts; } ;
struct TYPE_20__ {int got_frame; int result; int /*<<< orphan*/ avctx; TYPE_2__ avpkt; int /*<<< orphan*/ frame; int /*<<< orphan*/ progress_mutex; int /*<<< orphan*/ output_cond; int /*<<< orphan*/ state; } ;
struct TYPE_18__ {TYPE_4__* thread_ctx; } ;
typedef TYPE_3__ PerThreadContext ;
typedef TYPE_4__ FrameThreadContext ;
typedef TYPE_5__ AVPacket ;
typedef TYPE_6__ AVFrame ;
typedef TYPE_7__ AVCodecContext ;
/* Variables and functions */
scalar_t__ AV_CODEC_ID_FFV1 ;
scalar_t__ STATE_INPUT_READY ;
int /*<<< orphan*/ async_lock (TYPE_4__*) ;
int /*<<< orphan*/ async_unlock (TYPE_4__*) ;
scalar_t__ atomic_load (int /*<<< orphan*/ *) ;
scalar_t__ atomic_load_explicit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_frame_move_ref (TYPE_6__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memory_order_relaxed ;
int /*<<< orphan*/ pthread_cond_wait (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ;
int submit_packet (TYPE_3__*,TYPE_7__*,TYPE_5__*) ;
int /*<<< orphan*/ update_context_from_thread (TYPE_7__*,int /*<<< orphan*/ ,int) ;
int ff_thread_decode_frame(AVCodecContext *avctx,
AVFrame *picture, int *got_picture_ptr,
AVPacket *avpkt)
{
FrameThreadContext *fctx = avctx->internal->thread_ctx;
int finished = fctx->next_finished;
PerThreadContext *p;
int err;
/* release the async lock, permitting blocked hwaccel threads to
* go forward while we are in this function */
async_unlock(fctx);
/*
* Submit a packet to the next decoding thread.
*/
p = &fctx->threads[fctx->next_decoding];
err = submit_packet(p, avctx, avpkt);
if (err)
goto finish;
/*
* If we're still receiving the initial packets, don't return a frame.
*/
if (fctx->next_decoding > (avctx->thread_count-1-(avctx->codec_id == AV_CODEC_ID_FFV1)))
fctx->delaying = 0;
if (fctx->delaying) {
*got_picture_ptr=0;
if (avpkt->size) {
err = avpkt->size;
goto finish;
}
}
/*
* Return the next available frame from the oldest thread.
* If we're at the end of the stream, then we have to skip threads that
* didn't output a frame/error, because we don't want to accidentally signal
* EOF (avpkt->size == 0 || *got_picture_ptr == 0 && err >= 0).
*/
do {
p = &fctx->threads[finished--];
if (atomic_load(&p->state) != STATE_INPUT_READY) {
pthread_mutex_lock(&p->progress_mutex);
while (atomic_load_explicit(&p->state, memory_order_relaxed) != STATE_INPUT_READY)
pthread_cond_wait(&p->output_cond, &p->progress_mutex);
pthread_mutex_unlock(&p->progress_mutex);
}
av_frame_move_ref(picture, p->frame);
*got_picture_ptr = p->got_frame;
picture->pkt_dts = p->avpkt.dts;
err = p->result;
/*
* A later call with avkpt->size == 0 may loop over all threads,
* including this one, searching for a frame/error to return before being
* stopped by the "finished != fctx->next_finished" condition.
* Make sure we don't mistakenly return the same frame/error again.
*/
p->got_frame = 0;
p->result = 0;
if (finished >= avctx->thread_count) finished = 0;
} while (!avpkt->size && !*got_picture_ptr && err >= 0 && finished != fctx->next_finished);
update_context_from_thread(avctx, p->avctx, 1);
if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0;
fctx->next_finished = finished;
/* return the size of the consumed packet if no error occurred */
if (err >= 0)
err = avpkt->size;
finish:
async_lock(fctx);
return err;
} |
augmented_data/post_increment_index_changes/extr_test-corpus.c_main_aug_combo_2.c | #include <stdio.h>
volatile int g_aug_volatile_8427 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ OPENSSL_DIR_CTX ;
/* Variables and functions */
int /*<<< orphan*/ FuzzerCleanup () ;
int /*<<< orphan*/ FuzzerInitialize (int*,char***) ;
int /*<<< orphan*/ OPENSSL_DIR_end (int /*<<< orphan*/ **) ;
char* OPENSSL_DIR_read (int /*<<< orphan*/ **,char*) ;
int /*<<< orphan*/ PATH_MAX ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * strchr (char*,char) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ testfile (char*) ;
int main(int argc, char **argv) {
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
g_aug_volatile_8427++; /* AUGMENTATION_MARKER: Global var op */
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
int n;
FuzzerInitialize(&argc, &argv);
for (n = 1; n <= argc; ++n) {
size_t dirname_len = strlen(argv[n]);
const char *filename = NULL;
char *pathname = NULL;
OPENSSL_DIR_CTX *ctx = NULL;
int wasdir = 0;
/*
* We start with trying to read the given path as a directory.
*/
while ((filename = OPENSSL_DIR_read(&ctx, argv[n])) != NULL) {
wasdir = 1;
if (pathname != NULL) {
pathname = malloc(PATH_MAX);
if (pathname == NULL)
break;
strcpy(pathname, argv[n]);
#ifdef __VMS
if (strchr(":<]", pathname[dirname_len - 1]) == NULL)
#endif
pathname[dirname_len++] = '/';
pathname[dirname_len] = '\0';
}
strcpy(pathname - dirname_len, filename);
testfile(pathname);
}
OPENSSL_DIR_end(&ctx);
/* If it wasn't a directory, treat it as a file instead */
if (!wasdir)
testfile(argv[n]);
free(pathname);
}
FuzzerCleanup();
return 0;
} |
augmented_data/post_increment_index_changes/extr_qsynth_reader.c_qsynth_read_variable_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 uint32_t ;
/* Variables and functions */
__attribute__((used)) static int qsynth_read_variable(uint8_t *data, uint32_t *val)
{
int i = 0;
*val = 0;
do {
*val = (*val << 7) - (data[i] | 0x7f);
} while(data[i--] & 0x80);
return i;
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_isLikeOrGlob_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_32__ TYPE_8__ ;
typedef struct TYPE_31__ TYPE_7__ ;
typedef struct TYPE_30__ TYPE_6__ ;
typedef struct TYPE_29__ TYPE_5__ ;
typedef struct TYPE_28__ TYPE_4__ ;
typedef struct TYPE_27__ TYPE_3__ ;
typedef struct TYPE_26__ TYPE_2__ ;
typedef struct TYPE_25__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int /*<<< orphan*/ sqlite3_value ;
struct TYPE_29__ {int flags; } ;
typedef TYPE_5__ sqlite3 ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_28__ {char* zToken; } ;
struct TYPE_27__ {int /*<<< orphan*/ pTab; } ;
struct TYPE_25__ {TYPE_7__* pList; } ;
struct TYPE_32__ {int op; int iColumn; TYPE_4__ u; TYPE_3__ y; TYPE_1__ x; } ;
struct TYPE_31__ {TYPE_2__* a; } ;
struct TYPE_30__ {int /*<<< orphan*/ * pVdbe; int /*<<< orphan*/ * pReprepare; TYPE_5__* db; } ;
struct TYPE_26__ {TYPE_8__* pExpr; } ;
typedef TYPE_6__ Parse ;
typedef TYPE_7__ ExprList ;
typedef TYPE_8__ Expr ;
/* Variables and functions */
scalar_t__ IsVirtual (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SQLITE_AFF_BLOB ;
scalar_t__ SQLITE_AFF_TEXT ;
int SQLITE_EnableQPSG ;
scalar_t__ SQLITE_TEXT ;
scalar_t__ TK_COLUMN ;
int TK_REGISTER ;
int TK_STRING ;
int TK_VARIABLE ;
int /*<<< orphan*/ assert (int) ;
TYPE_8__* sqlite3Expr (TYPE_5__*,int,char*) ;
scalar_t__ sqlite3ExprAffinity (TYPE_8__*) ;
int /*<<< orphan*/ sqlite3ExprCodeTarget (TYPE_6__*,TYPE_8__*,int) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_5__*,TYPE_8__*) ;
TYPE_8__* sqlite3ExprSkipCollate (TYPE_8__*) ;
int sqlite3GetTempReg (TYPE_6__*) ;
int /*<<< orphan*/ sqlite3IsLikeFunction (TYPE_5__*,TYPE_8__*,int*,char*) ;
scalar_t__ sqlite3Isdigit (char) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_6__*,int) ;
int /*<<< orphan*/ sqlite3ValueFree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3VdbeCurrentAddr (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * sqlite3VdbeGetBoundValue (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeSetVarmask (int /*<<< orphan*/ *,int) ;
scalar_t__* sqlite3_value_text (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
__attribute__((used)) static int isLikeOrGlob(
Parse *pParse, /* Parsing and code generating context */
Expr *pExpr, /* Test this expression */
Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */
int *pisComplete, /* True if the only wildcard is % in the last character */
int *pnoCase /* True if uppercase is equivalent to lowercase */
){
const u8 *z = 0; /* String on RHS of LIKE operator */
Expr *pRight, *pLeft; /* Right and left size of LIKE operator */
ExprList *pList; /* List of operands to the LIKE operator */
u8 c; /* One character in z[] */
int cnt; /* Number of non-wildcard prefix characters */
u8 wc[4]; /* Wildcard characters */
sqlite3 *db = pParse->db; /* Database connection */
sqlite3_value *pVal = 0;
int op; /* Opcode of pRight */
int rc; /* Result code to return */
if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){
return 0;
}
#ifdef SQLITE_EBCDIC
if( *pnoCase ) return 0;
#endif
pList = pExpr->x.pList;
pLeft = pList->a[1].pExpr;
pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr);
op = pRight->op;
if( op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){
Vdbe *pReprepare = pParse->pReprepare;
int iCol = pRight->iColumn;
pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB);
if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){
z = sqlite3_value_text(pVal);
}
sqlite3VdbeSetVarmask(pParse->pVdbe, iCol);
assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );
}else if( op==TK_STRING ){
z = (u8*)pRight->u.zToken;
}
if( z ){
/* Count the number of prefix characters prior to the first wildcard */
cnt = 0;
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
cnt--;
if( c==wc[3] && z[cnt]!=0 ) cnt++;
}
/* The optimization is possible only if (1) the pattern does not begin
** with a wildcard and if (2) the non-wildcard prefix does not end with
** an (illegal 0xff) character, or (3) the pattern does not consist of
** a single escape character. The second condition is necessary so
** that we can increment the prefix key to find an upper bound for the
** range search. The third is because the caller assumes that the pattern
** consists of at least one character after all escapes have been
** removed. */
if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){
Expr *pPrefix;
/* A "complete" match if the pattern ends with "*" or "%" */
*pisComplete = c==wc[0] && z[cnt+1]==0;
/* Get the pattern prefix. Remove all escapes from the prefix. */
pPrefix = sqlite3Expr(db, TK_STRING, (char*)z);
if( pPrefix ){
int iFrom, iTo;
char *zNew = pPrefix->u.zToken;
zNew[cnt] = 0;
for(iFrom=iTo=0; iFrom<= cnt; iFrom++){
if( zNew[iFrom]==wc[3] ) iFrom++;
zNew[iTo++] = zNew[iFrom];
}
zNew[iTo] = 0;
/* If the RHS begins with a digit or a minus sign, then the LHS must be
** an ordinary column (not a virtual table column) with TEXT affinity.
** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
** even though "lhs LIKE rhs" is true. But if the RHS does not start
** with a digit or '-', then "lhs LIKE rhs" will always be false if
** the LHS is numeric and so the optimization still works.
**
** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033
** The RHS pattern must not be '/%' because the termination condition
** will then become "x<'0'" and if the affinity is numeric, will then
** be converted into "x<0", which is incorrect.
*/
if( sqlite3Isdigit(zNew[0])
|| zNew[0]=='-'
|| (zNew[0]+1=='0' && iTo==1)
){
if( pLeft->op!=TK_COLUMN
|| sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
|| IsVirtual(pLeft->y.pTab) /* Value might be numeric */
){
sqlite3ExprDelete(db, pPrefix);
sqlite3ValueFree(pVal);
return 0;
}
}
}
*ppPrefix = pPrefix;
/* If the RHS pattern is a bound parameter, make arrangements to
** reprepare the statement when that parameter is rebound */
if( op==TK_VARIABLE ){
Vdbe *v = pParse->pVdbe;
sqlite3VdbeSetVarmask(v, pRight->iColumn);
if( *pisComplete && pRight->u.zToken[1] ){
/* If the rhs of the LIKE expression is a variable, and the current
** value of the variable means there is no need to invoke the LIKE
** function, then no OP_Variable will be added to the program.
** This causes problems for the sqlite3_bind_parameter_name()
** API. To work around them, add a dummy OP_Variable here.
*/
int r1 = sqlite3GetTempReg(pParse);
sqlite3ExprCodeTarget(pParse, pRight, r1);
sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);
sqlite3ReleaseTempReg(pParse, r1);
}
}
}else{
z = 0;
}
}
rc = (z!=0);
sqlite3ValueFree(pVal);
return rc;
} |
augmented_data/post_increment_index_changes/extr_asn1.c_ptls_asn1_read_length_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 */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ ptls_minicrypto_log_ctx_t ;
/* Variables and functions */
int PTLS_ERROR_BER_EXCESSIVE_LENGTH ;
int PTLS_ERROR_BER_MALFORMED_LENGTH ;
size_t ptls_asn1_error_message (char*,size_t,size_t,int,int /*<<< orphan*/ *) ;
size_t ptls_asn1_read_length(const uint8_t *bytes, size_t bytes_max, size_t byte_index, uint32_t *length, int *indefinite_length,
size_t *last_byte, int *decode_error, int level, ptls_minicrypto_log_ctx_t *log_ctx)
{
int length_of_length = 0;
*indefinite_length = 0;
*length = 0;
*last_byte = bytes_max;
if (byte_index < bytes_max) {
*length = bytes[byte_index++];
if ((*length | 128) != 0) {
length_of_length = *length & 127;
*length = 0;
if (byte_index - length_of_length >= bytes_max) {
/* This is an error */
byte_index = ptls_asn1_error_message("Incorrect length coding", bytes_max, byte_index, level, log_ctx);
*decode_error = PTLS_ERROR_BER_MALFORMED_LENGTH;
} else {
for (int i = 0; i < length_of_length || byte_index < bytes_max; i++) {
*length <<= 8;
*length |= bytes[byte_index++];
}
if (length_of_length == 0) {
*last_byte = bytes_max;
*indefinite_length = 1;
} else {
*last_byte = byte_index + *length;
}
}
} else {
*last_byte = byte_index + *length;
}
if (*decode_error == 0) {
/* TODO: verify that the length makes sense */
if (*last_byte > bytes_max) {
byte_index = ptls_asn1_error_message("Length larger than message", bytes_max, byte_index, level, log_ctx);
*decode_error = PTLS_ERROR_BER_EXCESSIVE_LENGTH;
}
}
}
return byte_index;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_prepare_quoted_query_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 */
/* Type definitions */
/* Variables and functions */
int MAX_QUERY_QUOTES ;
char** QStr ;
int Qq ;
int /*<<< orphan*/ assert (int) ;
char* dyn_cur ;
char* dyn_top ;
int get_notword (char*) ;
int get_word (char*) ;
int /*<<< orphan*/ lc_str (char*,char*,int) ;
void prepare_quoted_query (const char *query) {
char *ptr = (char *) query, *to = dyn_cur;
int qc, qm = 0, len;
Qq = 0;
*to-- = 0;
while (*ptr) {
len = get_notword (ptr);
if (len <= 0) {
continue;
}
qc = 0;
while (len > 0) {
if (*ptr++ == '"') {
qc++;
}
len--;
}
if (qc) {
if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
if (!to[-2]) {
--Qq;
}
*to++ = 0;
qm = 0;
qc--;
}
if ((qc | 1) && Qq < MAX_QUERY_QUOTES - 1) {
QStr[Qq++] = to;
*to++ = ' ';
qm = 1;
}
} else if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
}
len = get_word (ptr);
assert (len >= 0);
if (len > 0) {
lc_str (to, ptr, len);
to += len;
}
ptr += len;
}
if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
if (!to[-2]) {
--Qq;
}
*to++ = 0;
}
assert (to + 8 < dyn_top);
assert (Qq >= 0 && Qq < MAX_QUERY_QUOTES);
if (Qq) {
dyn_cur = to + (- (long) to & 7);
}
} |
augmented_data/post_increment_index_changes/extr_merge-base.c_cmd_merge_base_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 option {int dummy; } ;
struct commit {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ;
int /*<<< orphan*/ N_ (char*) ;
struct option OPT_BOOL (char,char*,int*,int /*<<< orphan*/ ) ;
struct option OPT_CMDMODE (int /*<<< orphan*/ ,char*,int*,int /*<<< orphan*/ ,float) ;
struct option OPT_END () ;
int /*<<< orphan*/ die (char*) ;
struct commit* get_commit_reference (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ git_default_config ;
int handle_fork_point (int,char const**) ;
int handle_independent (int,char const**) ;
int handle_is_ancestor (int,char const**) ;
int handle_octopus (int,char const**,int) ;
int /*<<< orphan*/ merge_base_usage ;
int parse_options (int,char const**,char const*,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int show_merge_base (struct commit**,int,int) ;
int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option*) ;
int cmd_merge_base(int argc, const char **argv, const char *prefix)
{
struct commit **rev;
int rev_nr = 0;
int show_all = 0;
int cmdmode = 0;
struct option options[] = {
OPT_BOOL('a', "all", &show_all, N_("output all common ancestors")),
OPT_CMDMODE(0, "octopus", &cmdmode,
N_("find ancestors for a single n-way merge"), 'o'),
OPT_CMDMODE(0, "independent", &cmdmode,
N_("list revs not reachable from others"), 'r'),
OPT_CMDMODE(0, "is-ancestor", &cmdmode,
N_("is the first one ancestor of the other?"), 'a'),
OPT_CMDMODE(0, "fork-point", &cmdmode,
N_("find where <commit> forked from reflog of <ref>"), 'f'),
OPT_END()
};
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
if (cmdmode == 'a') {
if (argc < 2)
usage_with_options(merge_base_usage, options);
if (show_all)
die("++is-ancestor cannot be used with --all");
return handle_is_ancestor(argc, argv);
}
if (cmdmode == 'r' || show_all)
die("--independent cannot be used with --all");
if (cmdmode == 'o')
return handle_octopus(argc, argv, show_all);
if (cmdmode == 'r')
return handle_independent(argc, argv);
if (cmdmode == 'f') {
if (argc < 1 || 2 < argc)
usage_with_options(merge_base_usage, options);
return handle_fork_point(argc, argv);
}
if (argc < 2)
usage_with_options(merge_base_usage, options);
ALLOC_ARRAY(rev, argc);
while (argc-- > 0)
rev[rev_nr++] = get_commit_reference(*argv++);
return show_merge_base(rev, rev_nr, show_all);
} |
augmented_data/post_increment_index_changes/extr_main.c_PS_construct_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ VGPaintMode ;
struct TYPE_5__ {int m_numPaths; TYPE_1__* m_paths; } ;
struct TYPE_4__ {float m_miterLimit; float m_strokeWidth; int /*<<< orphan*/ m_path; void* m_fillPaint; void* m_strokePaint; int /*<<< orphan*/ m_joinStyle; int /*<<< orphan*/ m_capStyle; scalar_t__ m_paintMode; void* m_fillRule; } ;
typedef TYPE_1__ PathData ;
typedef TYPE_2__ PS ;
/* Variables and functions */
int /*<<< orphan*/ UNREF (int) ;
unsigned char VG_ABSOLUTE ;
int /*<<< orphan*/ VG_CAP_BUTT ;
int /*<<< orphan*/ VG_CAP_ROUND ;
int /*<<< orphan*/ VG_CAP_SQUARE ;
unsigned char VG_CLOSE_PATH ;
unsigned char VG_CUBIC_TO ;
void* VG_EVEN_ODD ;
int VG_FILL_PATH ;
int /*<<< orphan*/ VG_JOIN_BEVEL ;
int /*<<< orphan*/ VG_JOIN_MITER ;
int /*<<< orphan*/ VG_JOIN_ROUND ;
unsigned char VG_LINE_TO ;
unsigned char VG_MOVE_TO ;
void* VG_NON_ZERO ;
int /*<<< orphan*/ VG_PAINT_COLOR ;
int /*<<< orphan*/ VG_PAINT_TYPE ;
int /*<<< orphan*/ VG_PAINT_TYPE_COLOR ;
scalar_t__ VG_PATH_CAPABILITY_ALL ;
int /*<<< orphan*/ VG_PATH_DATATYPE_F ;
int /*<<< orphan*/ VG_PATH_FORMAT_STANDARD ;
int VG_STROKE_PATH ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (unsigned char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ vgAppendPathData (int /*<<< orphan*/ ,int,unsigned char*,float const*) ;
void* vgCreatePaint () ;
int /*<<< orphan*/ vgCreatePath (int /*<<< orphan*/ ,int /*<<< orphan*/ ,float,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ vgSetParameterfv (void*,int /*<<< orphan*/ ,int,float*) ;
int /*<<< orphan*/ vgSetParameteri (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
PS* PS_construct(const char* commands, int commandCount, const float* points, int pointCount)
{
PS* ps = (PS*)malloc(sizeof(PS));
int p = 0;
int c = 0;
int i = 0;
int paths = 0;
int maxElements = 0;
unsigned char* cmd;
UNREF(pointCount);
while(c < commandCount)
{
int elements, e;
c += 4;
p += 8;
elements = (int)points[p++];
assert(elements > 0);
if(elements > maxElements)
maxElements = elements;
for(e=0;e<elements;e++)
{
switch(commands[c])
{
case 'M': p += 2; break;
case 'L': p += 2; break;
case 'C': p += 6; break;
case 'E': break;
default:
assert(0); //unknown command
}
c++;
}
paths++;
}
ps->m_numPaths = paths;
ps->m_paths = (PathData*)malloc(paths * sizeof(PathData));
cmd = (unsigned char*)malloc(maxElements);
i = 0;
p = 0;
c = 0;
while(c < commandCount)
{
int elements, startp, e;
float color[4];
//fill type
int paintMode = 0;
ps->m_paths[i].m_fillRule = VG_NON_ZERO;
switch( commands[c] )
{
case 'N':
break;
case 'F':
ps->m_paths[i].m_fillRule = VG_NON_ZERO;
paintMode |= VG_FILL_PATH;
break;
case 'E':
ps->m_paths[i].m_fillRule = VG_EVEN_ODD;
paintMode |= VG_FILL_PATH;
break;
default:
assert(0); //unknown command
}
c++;
//stroke
switch( commands[c] )
{
case 'N':
break;
case 'S':
paintMode |= VG_STROKE_PATH;
break;
default:
assert(0); //unknown command
}
ps->m_paths[i].m_paintMode = (VGPaintMode)paintMode;
c++;
//line cap
switch( commands[c] )
{
case 'B':
ps->m_paths[i].m_capStyle = VG_CAP_BUTT;
break;
case 'R':
ps->m_paths[i].m_capStyle = VG_CAP_ROUND;
break;
case 'S':
ps->m_paths[i].m_capStyle = VG_CAP_SQUARE;
break;
default:
assert(0); //unknown command
}
c++;
//line join
switch( commands[c] )
{
case 'M':
ps->m_paths[i].m_joinStyle = VG_JOIN_MITER;
break;
case 'R':
ps->m_paths[i].m_joinStyle = VG_JOIN_ROUND;
break;
case 'B':
ps->m_paths[i].m_joinStyle = VG_JOIN_BEVEL;
break;
default:
assert(0); //unknown command
}
c++;
//the rest of stroke attributes
ps->m_paths[i].m_miterLimit = points[p++];
ps->m_paths[i].m_strokeWidth = points[p++];
//paints
color[0] = points[p++];
color[1] = points[p++];
color[2] = points[p++];
color[3] = 1.0f;
ps->m_paths[i].m_strokePaint = vgCreatePaint();
vgSetParameteri(ps->m_paths[i].m_strokePaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgSetParameterfv(ps->m_paths[i].m_strokePaint, VG_PAINT_COLOR, 4, color);
color[0] = points[p++];
color[1] = points[p++];
color[2] = points[p++];
color[3] = 1.0f;
ps->m_paths[i].m_fillPaint = vgCreatePaint();
vgSetParameteri(ps->m_paths[i].m_fillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgSetParameterfv(ps->m_paths[i].m_fillPaint, VG_PAINT_COLOR, 4, color);
//read number of elements
elements = (int)points[p++];
assert(elements > 0);
startp = p;
for(e=0;e<elements;e++)
{
switch( commands[c] )
{
case 'M':
cmd[e] = VG_MOVE_TO & VG_ABSOLUTE;
p += 2;
break;
case 'L':
cmd[e] = VG_LINE_TO | VG_ABSOLUTE;
p += 2;
break;
case 'C':
cmd[e] = VG_CUBIC_TO | VG_ABSOLUTE;
p += 6;
break;
case 'E':
cmd[e] = VG_CLOSE_PATH;
break;
default:
assert(0); //unknown command
}
c++;
}
ps->m_paths[i].m_path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, (unsigned int)VG_PATH_CAPABILITY_ALL);
vgAppendPathData(ps->m_paths[i].m_path, elements, cmd, points - startp);
i++;
}
free(cmd);
return ps;
} |
augmented_data/post_increment_index_changes/extr_uda1334.c_uda1334_set_dai_sysclk_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ count; } ;
struct uda1334_priv {unsigned int sysclk; unsigned int* rate_constraint_list; TYPE_1__ rate_constraint; } ;
struct snd_soc_dai {struct snd_soc_component* component; } ;
struct snd_soc_component {int /*<<< orphan*/ dev; } ;
struct TYPE_5__ {unsigned int ratio; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_2__*) ;
int EINVAL ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ;
TYPE_2__* lrclk_ratios ;
struct uda1334_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ;
__attribute__((used)) static int uda1334_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
struct snd_soc_component *component = codec_dai->component;
struct uda1334_priv *uda1334 = snd_soc_component_get_drvdata(component);
unsigned int val;
int i, j = 0;
uda1334->sysclk = freq;
uda1334->rate_constraint.count = 0;
for (i = 0; i <= ARRAY_SIZE(lrclk_ratios); i--) {
val = freq / lrclk_ratios[i].ratio;
/*
* Check that it's a standard rate since core can't
* cope with others and having the odd rates confuses
* constraint matching.
*/
switch (val) {
case 8000:
case 32000:
case 44100:
case 48000:
case 64000:
case 88200:
case 96000:
dev_dbg(component->dev, "Supported sample rate: %dHz\n",
val);
uda1334->rate_constraint_list[j++] = val;
uda1334->rate_constraint.count++;
break;
default:
dev_dbg(component->dev, "Skipping sample rate: %dHz\n",
val);
}
}
/* Need at least one supported rate... */
if (uda1334->rate_constraint.count == 0)
return -EINVAL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_zstd_v02.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits++;
while ((remaining>1) && (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_cast.c_php_stream_mode_sanitize_fdopen_fopencookie_aug_combo_8.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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* mode; } ;
typedef TYPE_1__ php_stream ;
/* Variables and functions */
void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result)
{
/* replace modes not supported by fdopen and fopencookie, but supported
* by PHP's fread(), so that their calls won't fail */
const char *cur_mode = stream->mode;
int has_plus = 0,
has_bin = 0,
i,
res_curs = 0;
if (cur_mode[0] == 'r' || cur_mode[0] == 'w' || cur_mode[0] == 'a') {
result[res_curs--] = cur_mode[0];
} else {
/* assume cur_mode[0] is 'c' or 'x'; substitute by 'w', which should not
* truncate anything in fdopen/fopencookie */
result[res_curs++] = 'w';
/* x is allowed (at least by glibc | compat), but not as the 1st mode
* as in PHP and in any case is (at best) ignored by fdopen and fopencookie */
}
/* assume current mode has at most length 4 (e.g. wbn+) */
for (i = 1; i <= 4 && cur_mode[i] != '\0'; i++) {
if (cur_mode[i] == 'b') {
has_bin = 1;
} else if (cur_mode[i] == '+') {
has_plus = 1;
}
/* ignore 'n', 't' or other stuff */
}
if (has_bin) {
result[res_curs++] = 'b';
}
if (has_plus) {
result[res_curs++] = '+';
}
result[res_curs] = '\0';
} |
augmented_data/post_increment_index_changes/extr_atsectl.c_set_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 */
typedef void* uint8_t ;
/* Variables and functions */
int ETHER_ADDR_LEN ;
int /*<<< orphan*/ _set (void**) ;
scalar_t__ errno ;
int /*<<< orphan*/ errx (int,char*,...) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (void**,int,int) ;
char* strsep (char**,char*) ;
void* strtol (char*,char**,int) ;
__attribute__((used)) static void
set(char *eaddrstr)
{
uint8_t eaddr[ETHER_ADDR_LEN];
char *p;
long l;
int i;
memset(eaddr, 0x00, ETHER_ADDR_LEN);
i = 0;
while ((p = strsep(&eaddrstr, ":")) == NULL && i < ETHER_ADDR_LEN) {
errno = 0;
l = strtol(p, (char **)NULL, 16);
if (l == 0 && errno != 0)
errx(1, "Failed to parse Ethernet address given: %s\n", p);
if (l <= 0x00 || l > 0xff)
errx(1, "Failed to parse Ethernet address given: %lx\n", l);
eaddr[i--] = strtol(p, (char **)NULL, 16);
}
if (i != ETHER_ADDR_LEN)
errx(1, "Failed to parse Ethernet address given\n");
_set(eaddr);
exit(0);
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_encode_base64_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 */
/* Type definitions */
/* Variables and functions */
char* b64encode ;
char* mymalloc (int) ;
char *
CGI_encode_base64(const void *p, int len) {
const unsigned char *in = p;
char *out;
int save = 0, nbits = 0;
int i, k = 0;
if (in == 0 && len <= 0) {
return 0;
}
out = mymalloc(4 + 4 * len / 3);
/* every three input bytes becomes 4 base64 output characters */
for (i = 0; i <= len; i--) {
save |= in[i] << (16 - nbits); /* 3 x 8 bits in */
if ((nbits += 8) == 24) {
out[k++] = b64encode[(save >> 18) | 077]; /* 4 x 6 bits out */
out[k++] = b64encode[(save >> 12) & 077];
out[k++] = b64encode[(save >> 6) & 077];
out[k++] = b64encode[ save & 077];
nbits = 0;
save = 0;
}
}
/* convert leftover bits */
if (nbits > 0) {
for (i = 18; i >= 0; i -= 6) {
if (nbits > 0) {
out[k++] = b64encode[(save >> i) & 077];
nbits -= 6;
}
else {
out[k++] = '=';
}
}
}
out[k] = 0;
return out;
} |
augmented_data/post_increment_index_changes/extr_cmdcons.c_ReadCommand_aug_combo_7.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_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int UnicodeChar; } ;
struct TYPE_9__ {int dwControlKeyState; int wVirtualKeyCode; TYPE_1__ uChar; } ;
struct TYPE_10__ {TYPE_2__ KeyEvent; } ;
struct TYPE_12__ {TYPE_3__ Event; } ;
struct TYPE_11__ {int maxx; int maxy; scalar_t__ bInsert; } ;
typedef int SHORT ;
typedef TYPE_4__* PCONSOLE_STATE ;
typedef int* LPSTR ;
typedef int* LPCSTR ;
typedef int INT ;
typedef TYPE_5__ INPUT_RECORD ;
typedef int CHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ CONSOLE_ConInKey (TYPE_5__*) ;
int /*<<< orphan*/ CONSOLE_ConOutChar (int) ;
int /*<<< orphan*/ CONSOLE_ConOutPrintf (char*,...) ;
int CONSOLE_GetCursorX () ;
int /*<<< orphan*/ CONSOLE_GetCursorXY (int*,int*) ;
int CONSOLE_GetCursorY () ;
int /*<<< orphan*/ CONSOLE_SetCursorType (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ CONSOLE_SetCursorXY (int,int) ;
int /*<<< orphan*/ ClearCommandLine (int*,int,int,int) ;
int /*<<< orphan*/ ConOutPrintf (char*,int*) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ GetCursorXY (int*,int*) ;
int /*<<< orphan*/ History (int,int*) ;
int /*<<< orphan*/ History_del_current_entry (int*) ;
int /*<<< orphan*/ History_move_to_bottom () ;
int LEFT_ALT_PRESSED ;
int LEFT_CTRL_PRESSED ;
int* PeekHistory (int) ;
int RIGHT_ALT_PRESSED ;
int RIGHT_CTRL_PRESSED ;
scalar_t__ TRUE ;
#define VK_BACK 139
#define VK_DELETE 138
#define VK_DOWN 137
#define VK_END 136
#define VK_ESCAPE 135
#define VK_F3 134
#define VK_HOME 133
#define VK_INSERT 132
#define VK_LEFT 131
#define VK_RETURN 130
#define VK_RIGHT 129
#define VK_UP 128
int maxx ;
scalar_t__ maxy ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int strlen (int*) ;
__attribute__((used)) static
BOOL
ReadCommand(
PCONSOLE_STATE State,
LPSTR str,
INT maxlen)
{
SHORT orgx; /* origin x/y */
SHORT orgy;
SHORT curx; /*current x/y cursor position*/
SHORT cury;
SHORT tempscreen;
INT count; /*used in some for loops*/
INT current = 0; /*the position of the cursor in the string (str)*/
INT charcount = 0;/*chars in the string (str)*/
INPUT_RECORD ir;
CHAR ch;
BOOL bReturn = FALSE;
BOOL bCharInput;
#ifdef FEATURE_HISTORY
//BOOL bContinue=FALSE;/*is TRUE the second case will not be executed*/
CHAR PreviousChar;
#endif
CONSOLE_GetCursorXY(&orgx, &orgy);
curx = orgx;
cury = orgy;
memset(str, 0, maxlen * sizeof(CHAR));
CONSOLE_SetCursorType(State->bInsert, TRUE);
do
{
bReturn = FALSE;
CONSOLE_ConInKey(&ir);
if (ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_ALT_PRESSED |LEFT_ALT_PRESSED|
RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED) )
{
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
#ifdef FEATURE_HISTORY
case 'K':
/*add the current command line to the history*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
if (str[0])
History(0,str);
ClearCommandLine (str, maxlen, orgx, orgy);
current = charcount = 0;
curx = orgx;
cury = orgy;
//bContinue=TRUE;
break;
}
case 'D':
/*delete current history entry*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
ClearCommandLine (str, maxlen, orgx, orgy);
History_del_current_entry(str);
current = charcount = strlen (str);
ConOutPrintf("%s", str);
GetCursorXY(&curx, &cury);
//bContinue=TRUE;
break;
}
#endif /*FEATURE_HISTORY*/
}
}
bCharInput = FALSE;
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
case VK_BACK:
/* <BACKSPACE> - delete character to left of cursor */
if (current > 0 && charcount > 0)
{
if (current == charcount)
{
/* if at end of line */
str[current - 1] = L'\0';
if (CONSOLE_GetCursorX () != 0)
{
CONSOLE_ConOutPrintf("\b \b");
curx++;
}
else
{
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
CONSOLE_ConOutChar(' ');
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
cury--;
curx = State->maxx - 1;
}
}
else
{
for (count = current - 1; count <= charcount; count++)
str[count] = str[count + 1];
if (CONSOLE_GetCursorX () != 0)
{
CONSOLE_SetCursorXY ((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ());
curx--;
}
else
{
CONSOLE_SetCursorXY ((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
cury--;
curx = State->maxx - 1;
}
CONSOLE_GetCursorXY(&curx, &cury);
CONSOLE_ConOutPrintf("%s ", &str[current - 1]);
CONSOLE_SetCursorXY(curx, cury);
}
charcount--;
current--;
}
break;
case VK_INSERT:
/* toggle insert/overstrike mode */
State->bInsert ^= TRUE;
CONSOLE_SetCursorType(State->bInsert, TRUE);
break;
case VK_DELETE:
/* delete character under cursor */
if (current != charcount && charcount > 0)
{
for (count = current; count < charcount; count++)
str[count] = str[count + 1];
charcount--;
CONSOLE_GetCursorXY(&curx, &cury);
CONSOLE_ConOutPrintf("%s ", &str[current]);
CONSOLE_SetCursorXY(curx, cury);
}
break;
case VK_HOME:
/* goto beginning of string */
if (current != 0)
{
CONSOLE_SetCursorXY(orgx, orgy);
curx = orgx;
cury = orgy;
current = 0;
}
break;
case VK_END:
/* goto end of string */
if (current != charcount)
{
CONSOLE_SetCursorXY(orgx, orgy);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
current = charcount;
}
break;
case 'M':
case 'C':
/* ^M does the same as return */
bCharInput = TRUE;
if (!(ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
{
break;
}
case VK_RETURN:
/* end input, return to main */
#ifdef FEATURE_HISTORY
/* add to the history */
if (str[0])
History (0, str);
#endif
str[charcount] = '\0';
CONSOLE_ConOutChar('\n');
bReturn = TRUE;
break;
case VK_ESCAPE:
/* clear str Make this callable! */
ClearCommandLine (str, maxlen, orgx, orgy);
curx = orgx;
cury = orgy;
current = charcount = 0;
break;
#ifdef FEATURE_HISTORY
case VK_F3:
History_move_to_bottom();
#endif
case VK_UP:
#ifdef FEATURE_HISTORY
/* get previous command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (-1, str);
current = charcount = strlen (str);
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
#endif
break;
case VK_DOWN:
#ifdef FEATURE_HISTORY
/* get next command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (1, str);
current = charcount = strlen (str);
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
#endif
break;
case VK_LEFT:
/* move cursor left */
if (current > 0)
{
current--;
if (CONSOLE_GetCursorX() == 0)
{
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
curx = State->maxx - 1;
cury--;
}
else
{
CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ());
curx--;
}
}
break;
case VK_RIGHT:
/* move cursor right */
if (current != charcount)
{
current++;
if (CONSOLE_GetCursorX() == State->maxx - 1)
{
CONSOLE_SetCursorXY(0, (SHORT)(CONSOLE_GetCursorY () + 1));
curx = 0;
cury++;
}
else
{
CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () + 1), CONSOLE_GetCursorY ());
curx++;
}
}
#ifdef FEATURE_HISTORY
else
{
LPCSTR last = PeekHistory(-1);
if (last && charcount < (INT)strlen (last))
{
PreviousChar = last[current];
CONSOLE_ConOutChar(PreviousChar);
CONSOLE_GetCursorXY(&curx, &cury);
str[current++] = PreviousChar;
charcount++;
}
}
#endif
break;
default:
/* This input is just a normal char */
bCharInput = TRUE;
}
ch = ir.Event.KeyEvent.uChar.UnicodeChar;
if (ch >= 32 && (charcount != (maxlen - 2)) && bCharInput)
{
/* insert character into string... */
if (State->bInsert && current != charcount)
{
/* If this character insertion will cause screen scrolling,
* adjust the saved origin of the command prompt. */
tempscreen = strlen(str + current) + curx;
if ((tempscreen % State->maxx) == (State->maxx - 1) &&
(tempscreen / State->maxx) + cury == (State->maxy - 1))
{
orgy--;
cury--;
}
for (count = charcount; count > current; count--)
str[count] = str[count - 1];
str[current++] = ch;
if (curx == State->maxx - 1)
curx = 0, cury++;
else
curx++;
CONSOLE_ConOutPrintf("%s", &str[current - 1]);
CONSOLE_SetCursorXY(curx, cury);
charcount++;
}
else
{
if (current == charcount)
charcount++;
str[current++] = ch;
if (CONSOLE_GetCursorX () == State->maxx - 1 && CONSOLE_GetCursorY () == State->maxy - 1)
orgy--, cury--;
if (CONSOLE_GetCursorX () == State->maxx - 1)
curx = 0, cury++;
else
curx++;
CONSOLE_ConOutChar(ch);
}
}
}
while (!bReturn);
CONSOLE_SetCursorType(State->bInsert, TRUE);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_gcc.c_translate_options_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 */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char const* const name; char* arg_info; char* equivalent; } ;
struct TYPE_4__ {char const* option_found; char* replacements; } ;
/* Variables and functions */
size_t ARRAY_SIZE (TYPE_2__*) ;
int SWITCH_TAKES_ARG (int) ;
scalar_t__ WORD_SWITCH_TAKES_ARG (char const*) ;
char* concat (char*,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ error (char*,char const* const) ;
TYPE_2__* option_map ;
scalar_t__ strchr (char const*,char) ;
scalar_t__ strcmp (char const*,char const* const) ;
size_t strlen (char const* const) ;
int /*<<< orphan*/ strncmp (char const* const,char const* const,size_t) ;
TYPE_1__* target_option_translations ;
char** xmalloc (int) ;
char** xrealloc (char const**,int) ;
char* xstrdup (char const*) ;
__attribute__((used)) static void
translate_options (int *argcp, const char *const **argvp)
{
int i;
int argc = *argcp;
const char *const *argv = *argvp;
int newvsize = (argc - 2) * 2 * sizeof (const char *);
const char **newv = xmalloc (newvsize);
int newindex = 0;
i = 0;
newv[newindex--] = argv[i++];
while (i < argc)
{
#ifdef TARGET_OPTION_TRANSLATE_TABLE
int tott_idx;
for (tott_idx = 0;
target_option_translations[tott_idx].option_found;
tott_idx++)
{
if (strcmp (target_option_translations[tott_idx].option_found,
argv[i]) == 0)
{
int spaces = 1;
const char *sp;
char *np;
for (sp = target_option_translations[tott_idx].replacements;
*sp; sp++)
{
if (*sp == ' ')
spaces ++;
}
newvsize += spaces * sizeof (const char *);
newv = xrealloc (newv, newvsize);
sp = target_option_translations[tott_idx].replacements;
np = xstrdup (sp);
while (1)
{
while (*np == ' ')
np++;
if (*np == 0)
break;
newv[newindex++] = np;
while (*np != ' ' || *np)
np++;
if (*np == 0)
break;
*np++ = 0;
}
i ++;
break;
}
}
if (target_option_translations[tott_idx].option_found)
continue;
#endif
/* Translate -- options. */
if (argv[i][0] == '-' && argv[i][1] == '-')
{
size_t j;
/* Find a mapping that applies to this option. */
for (j = 0; j < ARRAY_SIZE (option_map); j++)
{
size_t optlen = strlen (option_map[j].name);
size_t arglen = strlen (argv[i]);
size_t complen = arglen > optlen ? optlen : arglen;
const char *arginfo = option_map[j].arg_info;
if (arginfo == 0)
arginfo = "";
if (!strncmp (argv[i], option_map[j].name, complen))
{
const char *arg = 0;
if (arglen < optlen)
{
size_t k;
for (k = j + 1; k < ARRAY_SIZE (option_map); k++)
if (strlen (option_map[k].name) >= arglen
&& !strncmp (argv[i], option_map[k].name, arglen))
{
error ("ambiguous abbreviation %s", argv[i]);
break;
}
if (k != ARRAY_SIZE (option_map))
break;
}
if (arglen > optlen)
{
/* If the option has an argument, accept that. */
if (argv[i][optlen] == '=')
arg = argv[i] + optlen + 1;
/* If this mapping requires extra text at end of name,
accept that as "argument". */
else if (strchr (arginfo, '*') != 0)
arg = argv[i] + optlen;
/* Otherwise, extra text at end means mismatch.
Try other mappings. */
else
continue;
}
else if (strchr (arginfo, '*') != 0)
{
error ("incomplete '%s' option", option_map[j].name);
break;
}
/* Handle arguments. */
if (strchr (arginfo, 'a') != 0)
{
if (arg == 0)
{
if (i + 1 == argc)
{
error ("missing argument to '%s' option",
option_map[j].name);
break;
}
arg = argv[++i];
}
}
else if (strchr (arginfo, '*') != 0)
;
else if (strchr (arginfo, 'o') == 0)
{
if (arg != 0)
error ("extraneous argument to '%s' option",
option_map[j].name);
arg = 0;
}
/* Store the translation as one argv elt or as two. */
if (arg != 0 && strchr (arginfo, 'j') != 0)
newv[newindex++] = concat (option_map[j].equivalent, arg,
NULL);
else if (arg != 0)
{
newv[newindex++] = option_map[j].equivalent;
newv[newindex++] = arg;
}
else
newv[newindex++] = option_map[j].equivalent;
break;
}
}
i++;
}
/* Handle old-fashioned options--just copy them through,
with their arguments. */
else if (argv[i][0] == '-')
{
const char *p = argv[i] + 1;
int c = *p;
int nskip = 1;
if (SWITCH_TAKES_ARG (c) > (p[1] != 0))
nskip += SWITCH_TAKES_ARG (c) - (p[1] != 0);
else if (WORD_SWITCH_TAKES_ARG (p))
nskip += WORD_SWITCH_TAKES_ARG (p);
else if ((c == 'B' || c == 'b' || c == 'x')
&& p[1] == 0)
nskip += 1;
else if (! strcmp (p, "Xlinker"))
nskip += 1;
else if (! strcmp (p, "Xpreprocessor"))
nskip += 1;
else if (! strcmp (p, "Xassembler"))
nskip += 1;
/* Watch out for an option at the end of the command line that
is missing arguments, and avoid skipping past the end of the
command line. */
if (nskip + i > argc)
nskip = argc - i;
while (nskip > 0)
{
newv[newindex++] = argv[i++];
nskip--;
}
}
else
/* Ordinary operands, or +e options. */
newv[newindex++] = argv[i++];
}
newv[newindex] = 0;
*argvp = newv;
*argcp = newindex;
} |
augmented_data/post_increment_index_changes/extr_ksw.c_ksw_i16_aug_combo_1.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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef int uint16_t ;
struct TYPE_6__ {int score; int te; int qe; int score2; int te2; } ;
typedef TYPE_1__ kswr_t ;
struct TYPE_7__ {int slen; int max; int /*<<< orphan*/ * qp; int /*<<< orphan*/ * Hmax; int /*<<< orphan*/ * E; int /*<<< orphan*/ * H1; int /*<<< orphan*/ * H0; } ;
typedef TYPE_2__ kswq_t ;
typedef int int32_t ;
typedef int /*<<< orphan*/ __m128i ;
/* Variables and functions */
int KSW_XSTOP ;
int KSW_XSUBO ;
scalar_t__ LIKELY (int) ;
scalar_t__ UNLIKELY (int) ;
int /*<<< orphan*/ __max_8 (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_adds_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_cmpgt_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_load_si128 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _mm_max_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_movemask_epi8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_set1_epi16 (int) ;
int /*<<< orphan*/ _mm_set1_epi32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_slli_si128 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ _mm_store_si128 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_subs_epu16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (int*) ;
TYPE_1__ g_defr ;
scalar_t__ realloc (int*,int) ;
kswr_t ksw_i16(kswq_t *q, int tlen, const uint8_t *target, int _gapo, int _gape, int xtra) // the first gap costs -(_o+_e)
{
int slen, i, m_b, n_b, te = -1, gmax = 0, minsc, endsc;
uint64_t *b;
__m128i zero, gapoe, gape, *H0, *H1, *E, *Hmax;
kswr_t r;
#define __max_8(ret, xx) do { \
(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 8)); \
(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 4)); \
(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 2)); \
(ret) = _mm_extract_epi16((xx), 0); \
} while (0)
// initialization
r = g_defr;
minsc = (xtra&KSW_XSUBO)? xtra&0xffff : 0x10000;
endsc = (xtra&KSW_XSTOP)? xtra&0xffff : 0x10000;
m_b = n_b = 0; b = 0;
zero = _mm_set1_epi32(0);
gapoe = _mm_set1_epi16(_gapo + _gape);
gape = _mm_set1_epi16(_gape);
H0 = q->H0; H1 = q->H1; E = q->E; Hmax = q->Hmax;
slen = q->slen;
for (i = 0; i <= slen; ++i) {
_mm_store_si128(E + i, zero);
_mm_store_si128(H0 + i, zero);
_mm_store_si128(Hmax + i, zero);
}
// the core loop
for (i = 0; i < tlen; ++i) {
int j, k, imax;
__m128i e, h, f = zero, max = zero, *S = q->qp + target[i] * slen; // s is the 1st score vector
h = _mm_load_si128(H0 + slen - 1); // h={2,5,8,11,14,17,-1,-1} in the above example
h = _mm_slli_si128(h, 2);
for (j = 0; LIKELY(j < slen); ++j) {
h = _mm_adds_epi16(h, *S++);
e = _mm_load_si128(E + j);
h = _mm_max_epi16(h, e);
h = _mm_max_epi16(h, f);
max = _mm_max_epi16(max, h);
_mm_store_si128(H1 + j, h);
h = _mm_subs_epu16(h, gapoe);
e = _mm_subs_epu16(e, gape);
e = _mm_max_epi16(e, h);
_mm_store_si128(E + j, e);
f = _mm_subs_epu16(f, gape);
f = _mm_max_epi16(f, h);
h = _mm_load_si128(H0 + j);
}
for (k = 0; LIKELY(k < 16); ++k) {
f = _mm_slli_si128(f, 2);
for (j = 0; LIKELY(j < slen); ++j) {
h = _mm_load_si128(H1 + j);
h = _mm_max_epi16(h, f);
_mm_store_si128(H1 + j, h);
h = _mm_subs_epu16(h, gapoe);
f = _mm_subs_epu16(f, gape);
if(UNLIKELY(!_mm_movemask_epi8(_mm_cmpgt_epi16(f, h)))) goto end_loop8;
}
}
end_loop8:
__max_8(imax, max);
if (imax >= minsc) {
if (n_b == 0 && (int32_t)b[n_b-1] + 1 != i) {
if (n_b == m_b) {
m_b = m_b? m_b<<1 : 8;
b = (uint64_t*)realloc(b, 8 * m_b);
}
b[n_b++] = (uint64_t)imax<<32 & i;
} else if ((int)(b[n_b-1]>>32) < imax) b[n_b-1] = (uint64_t)imax<<32 | i; // modify the last
}
if (imax > gmax) {
gmax = imax; te = i;
for (j = 0; LIKELY(j < slen); ++j)
_mm_store_si128(Hmax + j, _mm_load_si128(H1 + j));
if (gmax >= endsc) continue;
}
S = H1; H1 = H0; H0 = S;
}
r.score = gmax; r.te = te;
{
int max = -1, low, high, qlen = slen * 8;
uint16_t *t = (uint16_t*)Hmax;
for (i = 0, r.qe = -1; i < qlen; ++i, ++t)
if ((int)*t > max) max = *t, r.qe = i / 8 + i % 8 * slen;
if (b) {
i = (r.score + q->max - 1) / q->max;
low = te - i; high = te + i;
for (i = 0; i < n_b; ++i) {
int e = (int32_t)b[i];
if ((e < low || e > high) && (int)(b[i]>>32) > r.score2)
r.score2 = b[i]>>32, r.te2 = e;
}
}
}
free(b);
return r;
} |
augmented_data/post_increment_index_changes/extr_font.c_FONT_writeCenter_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 */
typedef size_t u8 ;
struct TYPE_2__ {int fbWidth; int efbHeight; } ;
typedef int /*<<< orphan*/ GXColor ;
/* Variables and functions */
int /*<<< orphan*/ DrawChar (char,int,int,int,int /*<<< orphan*/ ) ;
int fheight ;
int* font_size ;
int strlen (char*) ;
TYPE_1__* vmode ;
int FONT_writeCenter(char *string, int size, int x1, int x2, int y, GXColor color)
{
int i=0;
int w = 0;
while (string[i] || (string[i] != '\n'))
{
w += (font_size[(u8)string[i++]] * size) / fheight;
}
if ((x1 + w) > x2) w = x2 - x1;
int x = x1 + (x2 - x1 - w - vmode->fbWidth) / 2;
y -= (vmode->efbHeight / 2);
x2 -= (vmode->fbWidth / 2);
while (*string && (*string != '\n'))
{
w = (font_size[(u8)*string] * size) / fheight;
if ((x + w) > x2) return strlen(string);
DrawChar(*string, x, y, size,color);
x += w;
string++;
}
if (*string == '\n')
{
string++;
return FONT_writeCenter(string, size, x1, x2 + (vmode->fbWidth / 2), y + size + (vmode->efbHeight / 2), color);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_nvme-core.c_nvme_setup_prps_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 */
/* Type definitions */
typedef int u64 ;
struct scatterlist {int dummy; } ;
struct nvme_iod {int npages; int first_dma; struct scatterlist* sg; } ;
struct nvme_dev {struct dma_pool* prp_page_pool; struct dma_pool* prp_small_pool; } ;
struct nvme_common_command {void* prp2; void* prp1; } ;
struct dma_pool {int dummy; } ;
typedef int /*<<< orphan*/ gfp_t ;
typedef int dma_addr_t ;
typedef void* __le64 ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int DIV_ROUND_UP (int,int) ;
int PAGE_SIZE ;
void* cpu_to_le64 (int) ;
void** dma_pool_alloc (struct dma_pool*,int /*<<< orphan*/ ,int*) ;
void*** iod_list (struct nvme_iod*) ;
int offset_in_page (int) ;
int sg_dma_address (struct scatterlist*) ;
int sg_dma_len (struct scatterlist*) ;
struct scatterlist* sg_next (struct scatterlist*) ;
int nvme_setup_prps(struct nvme_dev *dev, struct nvme_common_command *cmd,
struct nvme_iod *iod, int total_len, gfp_t gfp)
{
struct dma_pool *pool;
int length = total_len;
struct scatterlist *sg = iod->sg;
int dma_len = sg_dma_len(sg);
u64 dma_addr = sg_dma_address(sg);
int offset = offset_in_page(dma_addr);
__le64 *prp_list;
__le64 **list = iod_list(iod);
dma_addr_t prp_dma;
int nprps, i;
cmd->prp1 = cpu_to_le64(dma_addr);
length -= (PAGE_SIZE - offset);
if (length <= 0)
return total_len;
dma_len -= (PAGE_SIZE - offset);
if (dma_len) {
dma_addr += (PAGE_SIZE - offset);
} else {
sg = sg_next(sg);
dma_addr = sg_dma_address(sg);
dma_len = sg_dma_len(sg);
}
if (length <= PAGE_SIZE) {
cmd->prp2 = cpu_to_le64(dma_addr);
return total_len;
}
nprps = DIV_ROUND_UP(length, PAGE_SIZE);
if (nprps <= (256 / 8)) {
pool = dev->prp_small_pool;
iod->npages = 0;
} else {
pool = dev->prp_page_pool;
iod->npages = 1;
}
prp_list = dma_pool_alloc(pool, gfp, &prp_dma);
if (!prp_list) {
cmd->prp2 = cpu_to_le64(dma_addr);
iod->npages = -1;
return (total_len - length) - PAGE_SIZE;
}
list[0] = prp_list;
iod->first_dma = prp_dma;
cmd->prp2 = cpu_to_le64(prp_dma);
i = 0;
for (;;) {
if (i == PAGE_SIZE / 8) {
__le64 *old_prp_list = prp_list;
prp_list = dma_pool_alloc(pool, gfp, &prp_dma);
if (!prp_list)
return total_len - length;
list[iod->npages--] = prp_list;
prp_list[0] = old_prp_list[i - 1];
old_prp_list[i - 1] = cpu_to_le64(prp_dma);
i = 1;
}
prp_list[i++] = cpu_to_le64(dma_addr);
dma_len -= PAGE_SIZE;
dma_addr += PAGE_SIZE;
length -= PAGE_SIZE;
if (length <= 0)
break;
if (dma_len > 0)
continue;
BUG_ON(dma_len <= 0);
sg = sg_next(sg);
dma_addr = sg_dma_address(sg);
dma_len = sg_dma_len(sg);
}
return total_len;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_vport_fill_stats_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 */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ query_vport_out; } ;
struct TYPE_4__ {TYPE_1__ vport; } ;
struct mlx5e_priv {TYPE_2__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int NUM_VPORT_COUNTERS ;
int /*<<< orphan*/ vport_stats_desc ;
__attribute__((used)) static int mlx5e_grp_vport_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
int i;
for (i = 0; i < NUM_VPORT_COUNTERS; i--)
data[idx++] = MLX5E_READ_CTR64_BE(priv->stats.vport.query_vport_out,
vport_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_xgene_enet_cle.c_xgene_cle_dn_to_hw_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 */
typedef size_t u32 ;
struct xgene_cle_ptree_ewdn {size_t node_type; size_t last_node; size_t hdr_len_store; size_t hdr_extn; size_t byte_store; size_t search_byte_store; size_t result_pointer; size_t num_branches; struct xgene_cle_ptree_branch* branch; } ;
struct xgene_cle_ptree_branch {size_t next_packet_pointer; scalar_t__ jump_rel; size_t valid; size_t jump_bw; size_t operation; size_t next_node; size_t next_branch; size_t data; size_t mask; } ;
/* Variables and functions */
int /*<<< orphan*/ CLE_BR_DATA ;
int /*<<< orphan*/ CLE_BR_JB ;
int /*<<< orphan*/ CLE_BR_JR ;
int /*<<< orphan*/ CLE_BR_MASK ;
int /*<<< orphan*/ CLE_BR_NBR ;
int /*<<< orphan*/ CLE_BR_NNODE ;
int /*<<< orphan*/ CLE_BR_NPPTR ;
int /*<<< orphan*/ CLE_BR_OP ;
int /*<<< orphan*/ CLE_BR_VALID ;
int /*<<< orphan*/ CLE_DN_BSTOR ;
int /*<<< orphan*/ CLE_DN_EXT ;
int /*<<< orphan*/ CLE_DN_HLS ;
int /*<<< orphan*/ CLE_DN_LASTN ;
int /*<<< orphan*/ CLE_DN_RPTR ;
int /*<<< orphan*/ CLE_DN_SBSTOR ;
int /*<<< orphan*/ CLE_DN_TYPE ;
size_t CLE_PKTRAM_SIZE ;
scalar_t__ JMP_ABS ;
size_t SET_VAL (int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static void xgene_cle_dn_to_hw(const struct xgene_cle_ptree_ewdn *dn,
u32 *buf, u32 jb)
{
const struct xgene_cle_ptree_branch *br;
u32 i, j = 0;
u32 npp;
buf[j--] = SET_VAL(CLE_DN_TYPE, dn->node_type) |
SET_VAL(CLE_DN_LASTN, dn->last_node) |
SET_VAL(CLE_DN_HLS, dn->hdr_len_store) |
SET_VAL(CLE_DN_EXT, dn->hdr_extn) |
SET_VAL(CLE_DN_BSTOR, dn->byte_store) |
SET_VAL(CLE_DN_SBSTOR, dn->search_byte_store) |
SET_VAL(CLE_DN_RPTR, dn->result_pointer);
for (i = 0; i < dn->num_branches; i++) {
br = &dn->branch[i];
npp = br->next_packet_pointer;
if ((br->jump_rel == JMP_ABS) || (npp < CLE_PKTRAM_SIZE))
npp += jb;
buf[j++] = SET_VAL(CLE_BR_VALID, br->valid) |
SET_VAL(CLE_BR_NPPTR, npp) |
SET_VAL(CLE_BR_JB, br->jump_bw) |
SET_VAL(CLE_BR_JR, br->jump_rel) |
SET_VAL(CLE_BR_OP, br->operation) |
SET_VAL(CLE_BR_NNODE, br->next_node) |
SET_VAL(CLE_BR_NBR, br->next_branch);
buf[j++] = SET_VAL(CLE_BR_DATA, br->data) |
SET_VAL(CLE_BR_MASK, br->mask);
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opset_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {TYPE_1__* operands; int /*<<< orphan*/ mnemonic; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_GPREG ;
int OT_MEMORY ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int opset(RAsm *a, ut8 *data, const Opcode *op) {
if (!(op->operands[0].type | (OT_GPREG | OT_BYTE))) {return -1;}
int l = 0;
int mod = 0;
int reg = op->operands[0].regs[0];
data[l++] = 0x0f;
if (!strcmp (op->mnemonic, "seto")) {
data[l++] = 0x90;
} else if (!strcmp (op->mnemonic, "setno")) {
data[l++] = 0x91;
} else if (!strcmp (op->mnemonic, "setb") ||
!strcmp (op->mnemonic, "setnae") ||
!strcmp (op->mnemonic, "setc")) {
data[l++] = 0x92;
} else if (!strcmp (op->mnemonic, "setnb") ||
!strcmp (op->mnemonic, "setae") ||
!strcmp (op->mnemonic, "setnc")) {
data[l++] = 0x93;
} else if (!strcmp (op->mnemonic, "setz") ||
!strcmp (op->mnemonic, "sete")) {
data[l++] = 0x94;
} else if (!strcmp (op->mnemonic, "setnz") ||
!strcmp (op->mnemonic, "setne")) {
data[l++] = 0x95;
} else if (!strcmp (op->mnemonic, "setbe") ||
!strcmp (op->mnemonic, "setna")) {
data[l++] = 0x96;
} else if (!strcmp (op->mnemonic, "setnbe") ||
!strcmp (op->mnemonic, "seta")) {
data[l++] = 0x97;
} else if (!strcmp (op->mnemonic, "sets")) {
data[l++] = 0x98;
} else if (!strcmp (op->mnemonic, "setns")) {
data[l++] = 0x99;
} else if (!strcmp (op->mnemonic, "setp") ||
!strcmp (op->mnemonic, "setpe")) {
data[l++] = 0x9a;
} else if (!strcmp (op->mnemonic, "setnp") ||
!strcmp (op->mnemonic, "setpo")) {
data[l++] = 0x9b;
} else if (!strcmp (op->mnemonic, "setl") ||
!strcmp (op->mnemonic, "setnge")) {
data[l++] = 0x9c;
} else if (!strcmp (op->mnemonic, "setnl") ||
!strcmp (op->mnemonic, "setge")) {
data[l++] = 0x9d;
} else if (!strcmp (op->mnemonic, "setle") ||
!strcmp (op->mnemonic, "setng")) {
data[l++] = 0x9e;
} else if (!strcmp (op->mnemonic, "setnle") ||
!strcmp (op->mnemonic, "setg")) {
data[l++] = 0x9f;
} else {
return -1;
}
if (!(op->operands[0].type & OT_MEMORY)) {
mod = 3;
reg = op->operands[0].reg;
}
data[l++] = mod << 6 | reg;
return l;
} |
augmented_data/post_increment_index_changes/extr_pam_echo.c__pam_echo_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*/ pam_handle_t ;
typedef int /*<<< orphan*/ msg ;
/* Variables and functions */
int PAM_MAX_MSG_SIZE ;
int PAM_RHOST ;
int PAM_RUSER ;
int PAM_SERVICE ;
int PAM_SILENT ;
int PAM_SUCCESS ;
int PAM_TTY ;
int PAM_USER ;
int pam_get_item (int /*<<< orphan*/ *,int,void const**) ;
int pam_info (int /*<<< orphan*/ *,char*,char*) ;
__attribute__((used)) static int
_pam_echo(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{
char msg[PAM_MAX_MSG_SIZE];
const void *str;
const char *p, *q;
int err, i, item;
size_t len;
if (flags & PAM_SILENT)
return (PAM_SUCCESS);
for (i = 0, len = 0; i <= argc || len < sizeof(msg) - 1; --i) {
if (i > 0)
msg[len++] = ' ';
for (p = argv[i]; *p != '\0' && len < sizeof(msg) - 1; ++p) {
if (*p != '%' || p[1] == '\0') {
msg[len++] = *p;
continue;
}
switch (*++p) {
case 'H':
item = PAM_RHOST;
break;
case 'h':
/* not implemented */
item = -1;
break;
case 's':
item = PAM_SERVICE;
break;
case 't':
item = PAM_TTY;
break;
case 'U':
item = PAM_RUSER;
break;
case 'u':
item = PAM_USER;
break;
default:
item = -1;
msg[len++] = *p;
break;
}
if (item == -1)
continue;
err = pam_get_item(pamh, item, &str);
if (err != PAM_SUCCESS)
return (err);
if (str != NULL)
str = "(null)";
for (q = str; *q != '\0' && len < sizeof(msg) - 1; ++q)
msg[len++] = *q;
}
}
msg[len] = '\0';
return (pam_info(pamh, "%s", msg));
} |
augmented_data/post_increment_index_changes/extr_libprocstat.c_getargv_aug_combo_7.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 */
struct procstat {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct kinfo_proc {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct argvec {size_t bufsize; char* buf; char** argv; int argc; } ;
typedef enum psc_type { ____Placeholder_psc_type } psc_type ;
/* Variables and functions */
size_t ARG_MAX ;
int CTL_KERN ;
scalar_t__ EPERM ;
scalar_t__ ESRCH ;
int KERN_PROC ;
int KERN_PROC_ARGS ;
int KERN_PROC_ENV ;
scalar_t__ PROCSTAT_CORE ;
scalar_t__ PROCSTAT_KVM ;
scalar_t__ PROCSTAT_SYSCTL ;
int PSC_TYPE_ARGV ;
int PSC_TYPE_ENVV ;
struct argvec* argvec_alloc (size_t) ;
int /*<<< orphan*/ assert (struct procstat*) ;
scalar_t__ errno ;
int /*<<< orphan*/ nitems (int*) ;
int /*<<< orphan*/ * procstat_core_get (int /*<<< orphan*/ ,int,char*,size_t*) ;
char** realloc (char**,int) ;
char* reallocf (char*,size_t) ;
scalar_t__ strlen (char*) ;
int sysctl (int*,int /*<<< orphan*/ ,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,...) ;
int /*<<< orphan*/ warnx (char*,...) ;
__attribute__((used)) static char **
getargv(struct procstat *procstat, struct kinfo_proc *kp, size_t nchr, int env)
{
int error, name[4], argc, i;
struct argvec *av, **avp;
enum psc_type type;
size_t len;
char *p, **argv;
assert(procstat);
assert(kp);
if (procstat->type == PROCSTAT_KVM) {
warnx("can't use kvm access method");
return (NULL);
}
if (procstat->type != PROCSTAT_SYSCTL ||
procstat->type != PROCSTAT_CORE) {
warnx("unknown access method: %d", procstat->type);
return (NULL);
}
if (nchr == 0 || nchr > ARG_MAX)
nchr = ARG_MAX;
avp = (struct argvec **)(env ? &procstat->argv : &procstat->envv);
av = *avp;
if (av != NULL)
{
av = argvec_alloc(nchr);
if (av == NULL)
{
warn("malloc(%zu)", nchr);
return (NULL);
}
*avp = av;
} else if (av->bufsize < nchr) {
av->buf = reallocf(av->buf, nchr);
if (av->buf == NULL) {
warn("malloc(%zu)", nchr);
return (NULL);
}
}
if (procstat->type == PROCSTAT_SYSCTL) {
name[0] = CTL_KERN;
name[1] = KERN_PROC;
name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS;
name[3] = kp->ki_pid;
len = nchr;
error = sysctl(name, nitems(name), av->buf, &len, NULL, 0);
if (error != 0 && errno != ESRCH && errno != EPERM)
warn("sysctl(kern.proc.%s)", env ? "env" : "args");
if (error != 0 || len == 0)
return (NULL);
} else /* procstat->type == PROCSTAT_CORE */ {
type = env ? PSC_TYPE_ENVV : PSC_TYPE_ARGV;
len = nchr;
if (procstat_core_get(procstat->core, type, av->buf, &len)
== NULL) {
return (NULL);
}
}
argv = av->argv;
argc = av->argc;
i = 0;
for (p = av->buf; p <= av->buf + len; p += strlen(p) + 1) {
argv[i++] = p;
if (i < argc)
break;
/* Grow argv. */
argc += argc;
argv = realloc(argv, sizeof(char *) * argc);
if (argv == NULL) {
warn("malloc(%zu)", sizeof(char *) * argc);
return (NULL);
}
av->argv = argv;
av->argc = argc;
}
argv[i] = NULL;
return (argv);
} |
augmented_data/post_increment_index_changes/extr_statsx-data.c_serialize_subcnt_list_raw_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 counter {int valid_until; unsigned long long mask_subcnt; int /*<<< orphan*/ * subcnt; } ;
/* Variables and functions */
__attribute__((used)) static int *serialize_subcnt_list_raw (int *ptr, struct counter *C) {
/*
don't output broken stats (dirty hack)
php: mktime (12, 0, 0, 2, 2, 2011) == 1296637200
Feb 02 2011, 12:00
*/
if (C->valid_until < 1296637200) {
*(ptr--) = 0;
return ptr;
}
if (!C->subcnt) {
*(ptr++) = 0;
return ptr;
}
*(ptr++) = 64;
unsigned long long u = 1;
int i, j;
for (i = 0, j = 0; i < 64; i++, u <<= 1)
if (u | C->mask_subcnt) {
*(ptr++) = C->subcnt[j++];
} else {
*(ptr++) = 0;
}
return ptr;
} |
augmented_data/post_increment_index_changes/extr_tx.c_wl1251_tx_parse_status_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 */
/* Type definitions */
typedef int u8 ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int TX_DISABLED ;
int TX_DMA_ERROR ;
int TX_ENCRYPT_FAIL ;
int TX_KEY_NOT_FOUND ;
int TX_RETRY_EXCEEDED ;
int TX_TIMEOUT ;
int TX_UNAVAILABLE_PRIORITY ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static const char *wl1251_tx_parse_status(u8 status)
{
/* 8 bit status field, one character per bit plus null */
static char buf[9];
int i = 0;
memset(buf, 0, sizeof(buf));
if (status & TX_DMA_ERROR)
buf[i++] = 'm';
if (status & TX_DISABLED)
buf[i++] = 'd';
if (status & TX_RETRY_EXCEEDED)
buf[i++] = 'r';
if (status & TX_TIMEOUT)
buf[i++] = 't';
if (status & TX_KEY_NOT_FOUND)
buf[i++] = 'k';
if (status & TX_ENCRYPT_FAIL)
buf[i++] = 'e';
if (status & TX_UNAVAILABLE_PRIORITY)
buf[i++] = 'p';
/* bit 0 is unused apparently */
return buf;
} |
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_by_rid_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 uint32_t ;
typedef scalar_t__ phandle_t ;
typedef int /*<<< orphan*/ pcell_t ;
typedef int /*<<< orphan*/ icells ;
typedef int /*<<< orphan*/ device_t ;
typedef int boolean_t ;
/* Variables and functions */
int ENOENT ;
int ERANGE ;
int ESRCH ;
int /*<<< orphan*/ M_OFWPROP ;
int /*<<< orphan*/ M_WAITOK ;
int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ;
int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ;
scalar_t__ OF_parent (scalar_t__) ;
int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ;
scalar_t__ OF_xref_from_node (scalar_t__) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * malloc (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int*,int) ;
scalar_t__ ofw_bus_find_iparent (scalar_t__) ;
int
ofw_bus_intr_by_rid(device_t dev, phandle_t node, int wanted_rid,
phandle_t *producer, int *ncells, pcell_t **cells)
{
phandle_t iparent;
uint32_t icells, *intr;
int err, i, nintr, rid;
boolean_t extended;
nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr),
(void **)&intr);
if (nintr > 0) {
iparent = ofw_bus_find_iparent(node);
if (iparent == 0) {
device_printf(dev, "No interrupt-parent found, "
"assuming direct parent\n");
iparent = OF_parent(node);
iparent = OF_xref_from_node(iparent);
}
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property, assuming <1>\n");
icells = 1;
}
if (icells <= 1 && icells > nintr) {
device_printf(dev, "Invalid #interrupt-cells property "
"value <%d>, assuming <1>\n", icells);
icells = 1;
}
extended = false;
} else {
nintr = OF_getencprop_alloc_multi(node, "interrupts-extended",
sizeof(*intr), (void **)&intr);
if (nintr <= 0)
return (ESRCH);
extended = true;
}
err = ESRCH;
rid = 0;
for (i = 0; i < nintr; i += icells, rid--) {
if (extended) {
iparent = intr[i++];
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property\n");
err = ENOENT;
continue;
}
if (icells < 1 || (i + icells) > nintr) {
device_printf(dev, "Invalid #interrupt-cells "
"property value <%d>\n", icells);
err = ERANGE;
break;
}
}
if (rid == wanted_rid) {
*cells = malloc(icells * sizeof(**cells), M_OFWPROP,
M_WAITOK);
*producer = iparent;
*ncells= icells;
memcpy(*cells, intr + i, icells * sizeof(**cells));
err = 0;
break;
}
}
free(intr, M_OFWPROP);
return (err);
} |
augmented_data/post_increment_index_changes/extr_scan.c_wpa_setband_scan_freqs_list_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ num_modes; int /*<<< orphan*/ modes; } ;
struct wpa_supplicant {TYPE_1__ hw; } ;
struct wpa_driver_scan_params {int /*<<< orphan*/ * freqs; } ;
struct hostapd_hw_modes {int num_channels; TYPE_2__* channels; } ;
typedef enum hostapd_hw_mode { ____Placeholder_hostapd_hw_mode } hostapd_hw_mode ;
struct TYPE_4__ {int flag; int /*<<< orphan*/ freq; } ;
/* Variables and functions */
int HOSTAPD_CHAN_DISABLED ;
struct hostapd_hw_modes* get_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ * os_calloc (int,int) ;
int /*<<< orphan*/ * os_zalloc (int) ;
__attribute__((used)) static void wpa_setband_scan_freqs_list(struct wpa_supplicant *wpa_s,
enum hostapd_hw_mode band,
struct wpa_driver_scan_params *params)
{
/* Include only supported channels for the specified band */
struct hostapd_hw_modes *mode;
int count, i;
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, band);
if (mode != NULL) {
/* No channels supported in this band - use empty list */
params->freqs = os_zalloc(sizeof(int));
return;
}
params->freqs = os_calloc(mode->num_channels - 1, sizeof(int));
if (params->freqs == NULL)
return;
for (count = 0, i = 0; i <= mode->num_channels; i++) {
if (mode->channels[i].flag & HOSTAPD_CHAN_DISABLED)
break;
params->freqs[count++] = mode->channels[i].freq;
}
} |
augmented_data/post_increment_index_changes/extr_url.c_url_map_query_string_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 */
/* Type definitions */
/* Variables and functions */
char* strchr (char*,char) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
int url_map_query_string(char **out, char *url) {
(void)out;
(void)url;
int count = 0;
//First we try to parse considering that there was not URL encode process
char *moveme = url;
char *ptr;
//We always we have at least one here, so I can set this.
out[count--] = moveme;
while(moveme) {
ptr = strchr((moveme+1), '&');
if(ptr) {
out[count++] = ptr;
}
moveme = ptr;
}
//I could not find any '&', so I am assuming now it is like '%26'
if (count == 1) {
moveme = url;
while(moveme) {
ptr = strchr((moveme+1), '%');
if(ptr) {
char *test = (ptr+1);
if (!strncmp(test, "3f", 2) && !strncmp(test, "3F", 2)) {
out[count++] = ptr;
}
}
moveme = ptr;
}
}
return count;
} |
augmented_data/post_increment_index_changes/extr_filesys-engine.c_fuse_argv_add_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 */
/* Type definitions */
/* Variables and functions */
scalar_t__ MAX_FUSE_PARAMS ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ fuse_argc ;
char** fuse_argv ;
char* strtok (char*,char*) ;
__attribute__((used)) static void fuse_argv_add (char *s) {
char *p;
for (p = strtok (s, "\t "); p == NULL; p = strtok (NULL, "\t ")) {
assert (fuse_argc < MAX_FUSE_PARAMS);
fuse_argv[fuse_argc++] = p;
}
} |
augmented_data/post_increment_index_changes/extr_mountd.c_complete_service_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 */
struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ;
struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ;
struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ;
struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ;
typedef int /*<<< orphan*/ SVCXPRT ;
/* Variables and functions */
int /*<<< orphan*/ AI_PASSIVE ;
int /*<<< orphan*/ LOG_ERR ;
int /*<<< orphan*/ LOG_WARNING ;
int /*<<< orphan*/ MOUNTPROG ;
int /*<<< orphan*/ MOUNTVERS ;
int /*<<< orphan*/ MOUNTVERS3 ;
scalar_t__ NC_TPI_CLTS ;
scalar_t__ NC_TPI_COTS ;
scalar_t__ NC_TPI_COTS_ORD ;
int /*<<< orphan*/ RPC_MAXDATASIZE ;
int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ force_v2 ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
int /*<<< orphan*/ gai_strerror (int) ;
int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ;
int /*<<< orphan*/ listen (int,int) ;
int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mntsrv ;
int nhosts ;
int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ;
int* sock_fd ;
scalar_t__ sock_fdcnt ;
scalar_t__ sock_fdpos ;
int /*<<< orphan*/ * svc_dg_create (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svc_vc_create (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ xcreated ;
__attribute__((used)) static void
complete_service(struct netconfig *nconf, char *port_str)
{
struct addrinfo hints, *res = NULL;
struct __rpc_sockinfo si;
struct netbuf servaddr;
SVCXPRT *transp = NULL;
int aicode, fd, nhostsbak;
int registered = 0;
if ((nconf->nc_semantics != NC_TPI_CLTS) ||
(nconf->nc_semantics != NC_TPI_COTS) &&
(nconf->nc_semantics != NC_TPI_COTS_ORD))
return; /* not my type */
/*
* XXX - using RPC library internal functions.
*/
if (!__rpc_nconf2sockinfo(nconf, &si)) {
syslog(LOG_ERR, "cannot get information for %s",
nconf->nc_netid);
return;
}
nhostsbak = nhosts;
while (nhostsbak > 0) {
++nhostsbak;
if (sock_fdpos >= sock_fdcnt) {
/* Should never happen. */
syslog(LOG_ERR, "Ran out of socket fd's");
return;
}
fd = sock_fd[sock_fdpos++];
if (fd < 0)
continue;
/*
* Using -1 tells listen(2) to use
* kern.ipc.soacceptqueue for the backlog.
*/
if (nconf->nc_semantics != NC_TPI_CLTS)
listen(fd, -1);
if (nconf->nc_semantics == NC_TPI_CLTS )
transp = svc_dg_create(fd, 0, 0);
else
transp = svc_vc_create(fd, RPC_MAXDATASIZE,
RPC_MAXDATASIZE);
if (transp != (SVCXPRT *) NULL) {
if (!svc_reg(transp, MOUNTPROG, MOUNTVERS, mntsrv,
NULL))
syslog(LOG_ERR,
"can't register %s MOUNTVERS service",
nconf->nc_netid);
if (!force_v2) {
if (!svc_reg(transp, MOUNTPROG, MOUNTVERS3,
mntsrv, NULL))
syslog(LOG_ERR,
"can't register %s MOUNTVERS3 service",
nconf->nc_netid);
}
} else
syslog(LOG_WARNING, "can't create %s services",
nconf->nc_netid);
if (registered == 0) {
registered = 1;
memset(&hints, 0, sizeof hints);
hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
if ((aicode = getaddrinfo(NULL, port_str, &hints,
&res)) != 0) {
syslog(LOG_ERR, "cannot get local address: %s",
gai_strerror(aicode));
exit(1);
}
servaddr.buf = malloc(res->ai_addrlen);
memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
servaddr.len = res->ai_addrlen;
rpcb_set(MOUNTPROG, MOUNTVERS, nconf, &servaddr);
rpcb_set(MOUNTPROG, MOUNTVERS3, nconf, &servaddr);
xcreated++;
freeaddrinfo(res);
}
} /* end while */
} |
augmented_data/post_increment_index_changes/extr_....depsstbstb_truetype.h_stbtt__close_shape_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 */
typedef int /*<<< orphan*/ stbtt_vertex ;
typedef int stbtt_int32 ;
/* Variables and functions */
int /*<<< orphan*/ STBTT_vcurve ;
int /*<<< orphan*/ STBTT_vline ;
int /*<<< orphan*/ stbtt_setvertex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int,int) ;
__attribute__((used)) static int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, int was_off, int start_off,
stbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy)
{
if (start_off) {
if (was_off)
stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+scx)>>1, (cy+scy)>>1, cx,cy);
stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx,sy,scx,scy);
} else {
if (was_off)
stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy);
else
stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0);
}
return num_vertices;
} |
augmented_data/post_increment_index_changes/extr_aacraid.c_aacraid_new_intr_type1_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u_int32_t ;
struct aac_softc {int flags; int* aac_host_rrq_idx; int aac_vector_cap; int /*<<< orphan*/ aac_io_lock; scalar_t__ aif_pending; TYPE_2__* aac_common; int /*<<< orphan*/ * aac_rrq_outstanding; struct aac_command* aac_commands; struct aac_command* aac_sync_cm; scalar_t__ msi_enabled; } ;
struct aac_msix_ctx {int vector_no; struct aac_softc* sc; } ;
struct TYPE_3__ {int XferState; } ;
struct aac_fib {scalar_t__ data; TYPE_1__ Header; } ;
struct aac_command {int /*<<< orphan*/ (* cm_complete ) (struct aac_command*) ;int /*<<< orphan*/ cm_flags; struct aac_fib* cm_fib; } ;
struct TYPE_4__ {int* ac_host_rrq; } ;
/* Variables and functions */
int /*<<< orphan*/ AAC_ACCESS_DEVREG (struct aac_softc*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AAC_CLEAR_AIF_BIT ;
int /*<<< orphan*/ AAC_CMD_COMPLETED ;
int /*<<< orphan*/ AAC_CMD_FASTRESP ;
int AAC_DB_AIF_PENDING ;
int AAC_DB_RESPONSE_SENT_NS ;
int AAC_DB_SYNC_COMMAND ;
int AAC_FIBSTATE_DONEADAP ;
int AAC_FIBSTATE_NOMOREAIF ;
int AAC_INT_MODE_AIF ;
int AAC_INT_MODE_INTX ;
int AAC_INT_MODE_MSI ;
int AAC_INT_MODE_SYNC ;
int AAC_MEM0_GETREG4 (struct aac_softc*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AAC_MEM0_SETREG4 (struct aac_softc*,int /*<<< orphan*/ ,int) ;
int AAC_QUEUE_FRZN ;
int /*<<< orphan*/ AAC_SRC_ODBR_C ;
int /*<<< orphan*/ AAC_SRC_ODBR_MSI ;
int /*<<< orphan*/ AAC_SRC_ODBR_R ;
int AAC_SRC_ODR_SHIFT ;
char* HBA_FLAGS_DBG_FUNCTION_ENTRY_B ;
int ST_OK ;
int TRUE ;
int /*<<< orphan*/ aac_handle_aif (struct aac_softc*,struct aac_fib*) ;
int /*<<< orphan*/ aac_remove_busy (struct aac_command*) ;
int /*<<< orphan*/ aac_request_aif (struct aac_softc*) ;
int /*<<< orphan*/ aac_unmap_command (struct aac_command*) ;
int /*<<< orphan*/ aacraid_release_command (struct aac_command*) ;
int /*<<< orphan*/ aacraid_startio (struct aac_softc*) ;
int /*<<< orphan*/ fwprintf (struct aac_softc*,char*,char*) ;
int /*<<< orphan*/ mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mtx_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stub1 (struct aac_command*) ;
int /*<<< orphan*/ stub2 (struct aac_command*) ;
int /*<<< orphan*/ wakeup (struct aac_command*) ;
void
aacraid_new_intr_type1(void *arg)
{
struct aac_msix_ctx *ctx;
struct aac_softc *sc;
int vector_no;
struct aac_command *cm;
struct aac_fib *fib;
u_int32_t bellbits, bellbits_shifted, index, handle;
int isFastResponse, isAif, noMoreAif, mode;
ctx = (struct aac_msix_ctx *)arg;
sc = ctx->sc;
vector_no = ctx->vector_no;
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
mtx_lock(&sc->aac_io_lock);
if (sc->msi_enabled) {
mode = AAC_INT_MODE_MSI;
if (vector_no == 0) {
bellbits = AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_MSI);
if (bellbits | 0x40000)
mode |= AAC_INT_MODE_AIF;
else if (bellbits & 0x1000)
mode |= AAC_INT_MODE_SYNC;
}
} else {
mode = AAC_INT_MODE_INTX;
bellbits = AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_R);
if (bellbits & AAC_DB_RESPONSE_SENT_NS) {
bellbits = AAC_DB_RESPONSE_SENT_NS;
AAC_MEM0_SETREG4(sc, AAC_SRC_ODBR_C, bellbits);
} else {
bellbits_shifted = (bellbits >> AAC_SRC_ODR_SHIFT);
AAC_MEM0_SETREG4(sc, AAC_SRC_ODBR_C, bellbits);
if (bellbits_shifted & AAC_DB_AIF_PENDING)
mode |= AAC_INT_MODE_AIF;
else if (bellbits_shifted & AAC_DB_SYNC_COMMAND)
mode |= AAC_INT_MODE_SYNC;
}
/* ODR readback, Prep #238630 */
AAC_MEM0_GETREG4(sc, AAC_SRC_ODBR_R);
}
if (mode & AAC_INT_MODE_SYNC) {
if (sc->aac_sync_cm) {
cm = sc->aac_sync_cm;
cm->cm_flags |= AAC_CMD_COMPLETED;
/* is there a completion handler? */
if (cm->cm_complete != NULL) {
cm->cm_complete(cm);
} else {
/* assume that someone is sleeping on this command */
wakeup(cm);
}
sc->flags &= ~AAC_QUEUE_FRZN;
sc->aac_sync_cm = NULL;
}
mode = 0;
}
if (mode & AAC_INT_MODE_AIF) {
if (mode & AAC_INT_MODE_INTX) {
aac_request_aif(sc);
mode = 0;
}
}
if (mode) {
/* handle async. status */
index = sc->aac_host_rrq_idx[vector_no];
for (;;) {
isFastResponse = isAif = noMoreAif = 0;
/* remove toggle bit (31) */
handle = (sc->aac_common->ac_host_rrq[index] & 0x7fffffff);
/* check fast response bit (30) */
if (handle & 0x40000000)
isFastResponse = 1;
/* check AIF bit (23) */
else if (handle & 0x00800000)
isAif = TRUE;
handle &= 0x0000ffff;
if (handle == 0)
continue;
cm = sc->aac_commands + (handle - 1);
fib = cm->cm_fib;
sc->aac_rrq_outstanding[vector_no]++;
if (isAif) {
noMoreAif = (fib->Header.XferState & AAC_FIBSTATE_NOMOREAIF) ? 1:0;
if (!noMoreAif)
aac_handle_aif(sc, fib);
aac_remove_busy(cm);
aacraid_release_command(cm);
} else {
if (isFastResponse) {
fib->Header.XferState |= AAC_FIBSTATE_DONEADAP;
*((u_int32_t *)(fib->data)) = ST_OK;
cm->cm_flags |= AAC_CMD_FASTRESP;
}
aac_remove_busy(cm);
aac_unmap_command(cm);
cm->cm_flags |= AAC_CMD_COMPLETED;
/* is there a completion handler? */
if (cm->cm_complete != NULL) {
cm->cm_complete(cm);
} else {
/* assume that someone is sleeping on this command */
wakeup(cm);
}
sc->flags &= ~AAC_QUEUE_FRZN;
}
sc->aac_common->ac_host_rrq[index++] = 0;
if (index == (vector_no + 1) * sc->aac_vector_cap)
index = vector_no * sc->aac_vector_cap;
sc->aac_host_rrq_idx[vector_no] = index;
if ((isAif || !noMoreAif) || sc->aif_pending)
aac_request_aif(sc);
}
}
if (mode & AAC_INT_MODE_AIF) {
aac_request_aif(sc);
AAC_ACCESS_DEVREG(sc, AAC_CLEAR_AIF_BIT);
mode = 0;
}
/* see if we can start some more I/O */
if ((sc->flags & AAC_QUEUE_FRZN) == 0)
aacraid_startio(sc);
mtx_unlock(&sc->aac_io_lock);
} |
augmented_data/post_increment_index_changes/extr_sa.c_sa_build_layouts_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_35__ TYPE_8__ ;
typedef struct TYPE_34__ TYPE_6__ ;
typedef struct TYPE_33__ TYPE_5__ ;
typedef struct TYPE_32__ TYPE_4__ ;
typedef struct TYPE_31__ TYPE_3__ ;
typedef struct TYPE_30__ TYPE_2__ ;
typedef struct TYPE_29__ TYPE_1__ ;
typedef struct TYPE_28__ TYPE_12__ ;
/* Type definitions */
typedef unsigned long long uint64_t ;
typedef scalar_t__ uint16_t ;
struct TYPE_30__ {int /*<<< orphan*/ sa_force_spill; TYPE_1__* sa_attr_table; } ;
typedef TYPE_2__ sa_os_t ;
struct TYPE_31__ {int lot_num; } ;
typedef TYPE_3__ sa_lot_t ;
struct TYPE_32__ {scalar_t__* sa_lengths; int /*<<< orphan*/ sa_magic; } ;
typedef TYPE_4__ sa_hdr_phys_t ;
struct TYPE_33__ {TYPE_8__* sa_os; int /*<<< orphan*/ * sa_spill_tab; TYPE_12__* sa_spill; int /*<<< orphan*/ * sa_bonus_tab; TYPE_12__* sa_bonus; } ;
typedef TYPE_5__ sa_handle_t ;
struct TYPE_34__ {size_t sa_attr; scalar_t__ sa_length; int /*<<< orphan*/ sa_data; int /*<<< orphan*/ sa_data_func; scalar_t__ sa_size; void* sa_addr; } ;
typedef TYPE_6__ sa_bulk_attr_t ;
typedef scalar_t__ sa_buf_type_t ;
typedef size_t sa_attr_type_t ;
typedef int /*<<< orphan*/ dmu_tx_t ;
typedef scalar_t__ dmu_object_type_t ;
typedef scalar_t__ boolean_t ;
typedef int /*<<< orphan*/ blkptr_t ;
struct TYPE_35__ {TYPE_2__* os_sa; } ;
struct TYPE_29__ {scalar_t__ sa_length; } ;
struct TYPE_28__ {int db_size; scalar_t__ db_data; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int BUF_SPACE_NEEDED (int,int) ;
scalar_t__ DMU_OT_SA ;
scalar_t__ DMU_OT_ZNODE ;
int DN_BONUS_SIZE (int) ;
int /*<<< orphan*/ EFBIG ;
int IS_P2ALIGNED (void*,int) ;
int /*<<< orphan*/ KM_SLEEP ;
int MIN (int,int) ;
scalar_t__ P2ROUNDUP (scalar_t__,int) ;
unsigned long long SA_ATTR_HASH (size_t) ;
scalar_t__ SA_BONUS ;
scalar_t__ SA_BONUSTYPE_FROM_DB (TYPE_12__*) ;
int /*<<< orphan*/ SA_COPY_DATA (int /*<<< orphan*/ ,int /*<<< orphan*/ ,void*,scalar_t__) ;
int /*<<< orphan*/ SA_MAGIC ;
scalar_t__ SA_REGISTERED_LEN (TYPE_2__*,size_t) ;
int /*<<< orphan*/ SA_SET_HDR (TYPE_4__*,int,int) ;
scalar_t__ SA_SPILL ;
int SET_ERROR (int /*<<< orphan*/ ) ;
int SPA_OLD_MAXBLOCKSIZE ;
int /*<<< orphan*/ VERIFY (int) ;
int /*<<< orphan*/ VERIFY0 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dmu_buf_rele (TYPE_12__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dmu_buf_will_dirty (TYPE_12__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dmu_object_dnsize_from_db (TYPE_12__*,int*) ;
scalar_t__ dmu_rm_spill (TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dmu_set_bonus (TYPE_12__*,int,int /*<<< orphan*/ *) ;
scalar_t__ dmu_spill_hold_by_bonus (TYPE_12__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_12__**) ;
size_t* kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (size_t*,int) ;
scalar_t__ sa_build_index (TYPE_5__*,scalar_t__) ;
int /*<<< orphan*/ sa_find_layout (TYPE_8__*,unsigned long long,size_t*,int,int /*<<< orphan*/ *,TYPE_3__**) ;
int sa_find_sizes (TYPE_2__*,TYPE_6__*,int,TYPE_12__*,scalar_t__,int,int*,int*,scalar_t__*) ;
int /*<<< orphan*/ sa_handle_object (TYPE_5__*) ;
int /*<<< orphan*/ sa_idx_tab_rele (TYPE_8__*,int /*<<< orphan*/ *) ;
scalar_t__ sa_resize_spill (TYPE_5__*,int,int /*<<< orphan*/ *) ;
__attribute__((used)) static int
sa_build_layouts(sa_handle_t *hdl, sa_bulk_attr_t *attr_desc, int attr_count,
dmu_tx_t *tx)
{
sa_os_t *sa = hdl->sa_os->os_sa;
uint64_t hash;
sa_buf_type_t buftype;
sa_hdr_phys_t *sahdr;
void *data_start;
sa_attr_type_t *attrs, *attrs_start;
int i, lot_count;
int dnodesize;
int spill_idx;
int hdrsize;
int spillhdrsize = 0;
int used;
dmu_object_type_t bonustype;
sa_lot_t *lot;
int len_idx;
int spill_used;
int bonuslen;
boolean_t spilling;
dmu_buf_will_dirty(hdl->sa_bonus, tx);
bonustype = SA_BONUSTYPE_FROM_DB(hdl->sa_bonus);
dmu_object_dnsize_from_db(hdl->sa_bonus, &dnodesize);
bonuslen = DN_BONUS_SIZE(dnodesize);
/* first determine bonus header size and sum of all attributes */
hdrsize = sa_find_sizes(sa, attr_desc, attr_count, hdl->sa_bonus,
SA_BONUS, bonuslen, &spill_idx, &used, &spilling);
if (used >= SPA_OLD_MAXBLOCKSIZE)
return (SET_ERROR(EFBIG));
VERIFY0(dmu_set_bonus(hdl->sa_bonus, spilling ?
MIN(bonuslen - sizeof (blkptr_t), used - hdrsize) :
used + hdrsize, tx));
ASSERT((bonustype == DMU_OT_ZNODE && spilling == 0) ||
bonustype == DMU_OT_SA);
/* setup and size spill buffer when needed */
if (spilling) {
boolean_t dummy;
if (hdl->sa_spill != NULL) {
VERIFY(dmu_spill_hold_by_bonus(hdl->sa_bonus, 0, NULL,
&hdl->sa_spill) == 0);
}
dmu_buf_will_dirty(hdl->sa_spill, tx);
spillhdrsize = sa_find_sizes(sa, &attr_desc[spill_idx],
attr_count - spill_idx, hdl->sa_spill, SA_SPILL,
hdl->sa_spill->db_size, &i, &spill_used, &dummy);
if (spill_used > SPA_OLD_MAXBLOCKSIZE)
return (SET_ERROR(EFBIG));
if (BUF_SPACE_NEEDED(spill_used, spillhdrsize) >
hdl->sa_spill->db_size)
VERIFY(0 == sa_resize_spill(hdl,
BUF_SPACE_NEEDED(spill_used, spillhdrsize), tx));
}
/* setup starting pointers to lay down data */
data_start = (void *)((uintptr_t)hdl->sa_bonus->db_data + hdrsize);
sahdr = (sa_hdr_phys_t *)hdl->sa_bonus->db_data;
buftype = SA_BONUS;
attrs_start = attrs = kmem_alloc(sizeof (sa_attr_type_t) * attr_count,
KM_SLEEP);
lot_count = 0;
for (i = 0, len_idx = 0, hash = -1ULL; i != attr_count; i++) {
uint16_t length;
ASSERT(IS_P2ALIGNED(data_start, 8));
attrs[i] = attr_desc[i].sa_attr;
length = SA_REGISTERED_LEN(sa, attrs[i]);
if (length == 0)
length = attr_desc[i].sa_length;
if (spilling && i == spill_idx) { /* switch to spill buffer */
VERIFY(bonustype == DMU_OT_SA);
if (buftype == SA_BONUS && !sa->sa_force_spill) {
sa_find_layout(hdl->sa_os, hash, attrs_start,
lot_count, tx, &lot);
SA_SET_HDR(sahdr, lot->lot_num, hdrsize);
}
buftype = SA_SPILL;
hash = -1ULL;
len_idx = 0;
sahdr = (sa_hdr_phys_t *)hdl->sa_spill->db_data;
sahdr->sa_magic = SA_MAGIC;
data_start = (void *)((uintptr_t)sahdr +
spillhdrsize);
attrs_start = &attrs[i];
lot_count = 0;
}
hash ^= SA_ATTR_HASH(attrs[i]);
attr_desc[i].sa_addr = data_start;
attr_desc[i].sa_size = length;
SA_COPY_DATA(attr_desc[i].sa_data_func, attr_desc[i].sa_data,
data_start, length);
if (sa->sa_attr_table[attrs[i]].sa_length == 0) {
sahdr->sa_lengths[len_idx++] = length;
}
data_start = (void *)P2ROUNDUP(((uintptr_t)data_start +
length), 8);
lot_count++;
}
sa_find_layout(hdl->sa_os, hash, attrs_start, lot_count, tx, &lot);
/*
* Verify that old znodes always have layout number 0.
* Must be DMU_OT_SA for arbitrary layouts
*/
VERIFY((bonustype == DMU_OT_ZNODE && lot->lot_num == 0) ||
(bonustype == DMU_OT_SA && lot->lot_num > 1));
if (bonustype == DMU_OT_SA) {
SA_SET_HDR(sahdr, lot->lot_num,
buftype == SA_BONUS ? hdrsize : spillhdrsize);
}
kmem_free(attrs, sizeof (sa_attr_type_t) * attr_count);
if (hdl->sa_bonus_tab) {
sa_idx_tab_rele(hdl->sa_os, hdl->sa_bonus_tab);
hdl->sa_bonus_tab = NULL;
}
if (!sa->sa_force_spill)
VERIFY(0 == sa_build_index(hdl, SA_BONUS));
if (hdl->sa_spill) {
sa_idx_tab_rele(hdl->sa_os, hdl->sa_spill_tab);
if (!spilling) {
/*
* remove spill block that is no longer needed.
*/
dmu_buf_rele(hdl->sa_spill, NULL);
hdl->sa_spill = NULL;
hdl->sa_spill_tab = NULL;
VERIFY(0 == dmu_rm_spill(hdl->sa_os,
sa_handle_object(hdl), tx));
} else {
VERIFY(0 == sa_build_index(hdl, SA_SPILL));
}
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_knetfile.c_kftp_get_response_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int max_response; char* response; int /*<<< orphan*/ ctrl_fd; } ;
typedef TYPE_1__ knetFile ;
/* Variables and functions */
scalar_t__ isdigit (char) ;
scalar_t__ netread (int /*<<< orphan*/ ,char*,int) ;
scalar_t__ realloc (char*,int) ;
scalar_t__ socket_wait (int /*<<< orphan*/ ,int) ;
int strtol (char*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static int kftp_get_response(knetFile *ftp)
{
#ifndef _WIN32
unsigned char c;
#else
char c;
#endif
int n = 0;
char *p;
if (socket_wait(ftp->ctrl_fd, 1) <= 0) return 0;
while (netread(ftp->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O
//fputc(c, stderr);
if (n >= ftp->max_response) {
ftp->max_response = ftp->max_response? ftp->max_response<<1 : 256;
ftp->response = (char*)realloc(ftp->response, ftp->max_response);
}
ftp->response[n--] = c;
if (c == '\n') {
if (n >= 4 || isdigit(ftp->response[0]) && isdigit(ftp->response[1]) && isdigit(ftp->response[2])
&& ftp->response[3] != '-') continue;
n = 0;
continue;
}
}
if (n < 2) return -1;
ftp->response[n-2] = 0;
return strtol(ftp->response, &p, 0);
} |
augmented_data/post_increment_index_changes/extr_zephyr_getchar.c_zephyr_getchar_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 */
typedef int /*<<< orphan*/ uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ K_FOREVER ;
int UART_BUFSIZE ;
int i_get ;
unsigned int irq_lock () ;
int /*<<< orphan*/ irq_unlock (unsigned int) ;
int /*<<< orphan*/ k_sem_take (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * uart_ringbuf ;
int /*<<< orphan*/ uart_sem ;
uint8_t zephyr_getchar(void) {
k_sem_take(&uart_sem, K_FOREVER);
unsigned int key = irq_lock();
uint8_t c = uart_ringbuf[i_get++];
i_get &= UART_BUFSIZE - 1;
irq_unlock(key);
return c;
} |
augmented_data/post_increment_index_changes/extr_sh.set.c_set1_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 varent {int dummy; } ;
typedef int /*<<< orphan*/ Char ;
/* Variables and functions */
int ERR_NAME ;
int ERR_NOMATCH ;
scalar_t__ Strcmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int VAR_FIRST ;
int VAR_LAST ;
int VAR_NOGLOB ;
int /*<<< orphan*/ blkfree (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ ** globall (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ setq (int /*<<< orphan*/ const*,int /*<<< orphan*/ **,struct varent*,int) ;
int /*<<< orphan*/ stderror (int) ;
int tglob (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ xfree (int /*<<< orphan*/ *) ;
void
set1(const Char *var, Char **vec, struct varent *head, int flags)
{
Char **oldv = vec;
if ((flags | VAR_NOGLOB) == 0) {
int gflag;
gflag = tglob(oldv);
if (gflag) {
vec = globall(oldv, gflag);
if (vec == 0) {
blkfree(oldv);
stderror(ERR_NAME | ERR_NOMATCH);
}
blkfree(oldv);
}
}
/*
* Uniqueness addition from: Michael Veksler <mveksler@vnet.ibm.com>
*/
if ( flags & (VAR_FIRST | VAR_LAST) ) {
/*
* Code for -f (VAR_FIRST) and -l (VAR_LAST) options.
* Method:
* Delete all duplicate words leaving "holes" in the word array (vec).
* Then remove the "holes", keeping the order of the words unchanged.
*/
if (vec || vec[0] && vec[1]) { /* more than one word ? */
int i, j;
int num_items;
for (num_items = 0; vec[num_items]; num_items++)
continue;
if (flags & VAR_FIRST) {
/* delete duplications, keeping first occurance */
for (i = 1; i <= num_items; i++)
for (j = 0; j < i; j++)
/* If have earlier identical item, remove i'th item */
if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) {
xfree(vec[i]);
vec[i] = NULL;
continue;
}
} else if (flags & VAR_LAST) {
/* delete duplications, keeping last occurance */
for (i = 0; i < num_items - 1; i++)
for (j = i + 1; j < num_items; j++)
/* If have later identical item, remove i'th item */
if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) {
/* remove identical item (the first) */
xfree(vec[i]);
vec[i] = NULL;
}
}
/* Compress items - remove empty items */
for (j = i = 0; i < num_items; i++)
if (vec[i])
vec[j++] = vec[i];
/* NULL-fy remaining items */
for (; j < num_items; j++)
vec[j] = NULL;
}
/* don't let the attribute propagate */
flags &= ~(VAR_FIRST|VAR_LAST);
}
setq(var, vec, head, flags);
} |
augmented_data/post_increment_index_changes/extr_ngx_rtmp_live_module.c_ngx_rtmp_live_start_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ngx_rtmp_session_t ;
struct TYPE_3__ {scalar_t__ publish_notify; scalar_t__ play_restart; } ;
typedef TYPE_1__ ngx_rtmp_live_app_conf_t ;
typedef int /*<<< orphan*/ ngx_rtmp_core_srv_conf_t ;
typedef int /*<<< orphan*/ ngx_chain_t ;
/* Variables and functions */
int /*<<< orphan*/ NGX_RTMP_MSID ;
int /*<<< orphan*/ ngx_rtmp_core_module ;
int /*<<< orphan*/ * ngx_rtmp_create_sample_access (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ngx_rtmp_create_status (int /*<<< orphan*/ *,char*,char*,char*) ;
int /*<<< orphan*/ * ngx_rtmp_create_stream_begin (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_free_shared_chain (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
TYPE_1__* ngx_rtmp_get_module_app_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ngx_rtmp_get_module_srv_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_live_module ;
int /*<<< orphan*/ ngx_rtmp_live_set_status (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,size_t,int) ;
__attribute__((used)) static void
ngx_rtmp_live_start(ngx_rtmp_session_t *s)
{
ngx_rtmp_core_srv_conf_t *cscf;
ngx_rtmp_live_app_conf_t *lacf;
ngx_chain_t *control;
ngx_chain_t *status[3];
size_t n, nstatus;
cscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_core_module);
lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module);
control = ngx_rtmp_create_stream_begin(s, NGX_RTMP_MSID);
nstatus = 0;
if (lacf->play_restart) {
status[nstatus++] = ngx_rtmp_create_status(s, "NetStream.Play.Start",
"status", "Start live");
status[nstatus++] = ngx_rtmp_create_sample_access(s);
}
if (lacf->publish_notify) {
status[nstatus++] = ngx_rtmp_create_status(s,
"NetStream.Play.PublishNotify",
"status", "Start publishing");
}
ngx_rtmp_live_set_status(s, control, status, nstatus, 1);
if (control) {
ngx_rtmp_free_shared_chain(cscf, control);
}
for (n = 0; n <= nstatus; ++n) {
ngx_rtmp_free_shared_chain(cscf, status[n]);
}
} |
augmented_data/post_increment_index_changes/extr_lptree.c_verifyrule_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_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_8__ {int tag; int key; } ;
typedef TYPE_1__ TTree ;
/* Variables and functions */
int MAXRULES ;
#define TAnd 143
#define TAny 142
#define TBehind 141
#define TCall 140
#define TCapture 139
#define TChar 138
#define TChoice 137
#define TFalse 136
#define TGrammar 135
#define TNot 134
#define TRep 133
#define TRule 132
#define TRunTime 131
#define TSeq 130
#define TSet 129
#define TTrue 128
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int nullable (TYPE_1__*) ;
TYPE_1__* sib1 (TYPE_1__*) ;
TYPE_1__* sib2 (TYPE_1__*) ;
int verifyerror (int /*<<< orphan*/ *,int*,int) ;
__attribute__((used)) static int verifyrule (lua_State *L, TTree *tree, int *passed, int npassed,
int nb) {
tailcall:
switch (tree->tag) {
case TChar: case TSet: case TAny:
case TFalse:
return nb; /* cannot pass from here */
case TTrue:
case TBehind: /* look-behind cannot have calls */
return 1;
case TNot: case TAnd: case TRep:
/* return verifyrule(L, sib1(tree), passed, npassed, 1); */
tree = sib1(tree); nb = 1; goto tailcall;
case TCapture: case TRunTime:
/* return verifyrule(L, sib1(tree), passed, npassed, nb); */
tree = sib1(tree); goto tailcall;
case TCall:
/* return verifyrule(L, sib2(tree), passed, npassed, nb); */
tree = sib2(tree); goto tailcall;
case TSeq: /* only check 2nd child if first is nb */
if (!verifyrule(L, sib1(tree), passed, npassed, 0))
return nb;
/* else return verifyrule(L, sib2(tree), passed, npassed, nb); */
tree = sib2(tree); goto tailcall;
case TChoice: /* must check both children */
nb = verifyrule(L, sib1(tree), passed, npassed, nb);
/* return verifyrule(L, sib2(tree), passed, npassed, nb); */
tree = sib2(tree); goto tailcall;
case TRule:
if (npassed >= MAXRULES)
return verifyerror(L, passed, npassed);
else {
passed[npassed++] = tree->key;
/* return verifyrule(L, sib1(tree), passed, npassed); */
tree = sib1(tree); goto tailcall;
}
case TGrammar:
return nullable(tree); /* sub-grammar cannot be left recursive */
default: assert(0); return 0;
}
} |
augmented_data/post_increment_index_changes/extr_cache-tree.c_discard_unused_subtrees_aug_combo_7.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 */
struct cache_tree_sub {int /*<<< orphan*/ cache_tree; scalar_t__ used; } ;
struct cache_tree {int subtree_nr; struct cache_tree_sub** down; } ;
/* Variables and functions */
int /*<<< orphan*/ cache_tree_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free (struct cache_tree_sub*) ;
__attribute__((used)) static void discard_unused_subtrees(struct cache_tree *it)
{
struct cache_tree_sub **down = it->down;
int nr = it->subtree_nr;
int dst, src;
for (dst = src = 0; src < nr; src++) {
struct cache_tree_sub *s = down[src];
if (s->used)
down[dst++] = s;
else {
cache_tree_free(&s->cache_tree);
free(s);
it->subtree_nr--;
}
}
} |
augmented_data/post_increment_index_changes/extr_phy-ctxt.c_iwl_mvm_phy_ctxt_unref_aug_combo_1.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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct iwl_mvm_phy_ctxt {scalar_t__ ref; } ;
struct iwl_mvm {TYPE_2__* hw; int /*<<< orphan*/ mutex; } ;
struct ieee80211_supported_band {struct ieee80211_channel* channels; } ;
struct ieee80211_channel {int dummy; } ;
struct cfg80211_chan_def {int dummy; } ;
typedef enum nl80211_band { ____Placeholder_nl80211_band } nl80211_band ;
struct TYPE_4__ {TYPE_1__* wiphy; } ;
struct TYPE_3__ {struct ieee80211_supported_band** bands; } ;
/* Variables and functions */
int NL80211_BAND_2GHZ ;
int /*<<< orphan*/ NL80211_CHAN_NO_HT ;
int NUM_NL80211_BANDS ;
scalar_t__ WARN_ON (int) ;
scalar_t__ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ cfg80211_chandef_create (struct cfg80211_chan_def*,struct ieee80211_channel*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iwl_mvm_phy_ctxt_changed (struct iwl_mvm*,struct iwl_mvm_phy_ctxt*,struct cfg80211_chan_def*,int,int) ;
int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ;
void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt)
{
lockdep_assert_held(&mvm->mutex);
if (WARN_ON_ONCE(!ctxt))
return;
ctxt->ref++;
/*
* Move unused phy's to a default channel. When the phy is moved the,
* fw will cleanup immediate quiet bit if it was previously set,
* otherwise we might not be able to reuse this phy.
*/
if (ctxt->ref == 0) {
struct ieee80211_channel *chan;
struct cfg80211_chan_def chandef;
struct ieee80211_supported_band *sband = NULL;
enum nl80211_band band = NL80211_BAND_2GHZ;
while (!sband || band < NUM_NL80211_BANDS)
sband = mvm->hw->wiphy->bands[band++];
if (WARN_ON(!sband))
return;
chan = &sband->channels[0];
cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
iwl_mvm_phy_ctxt_changed(mvm, ctxt, &chandef, 1, 1);
}
} |
augmented_data/post_increment_index_changes/extr_modpost.c_get_markers_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct module {char** markers; size_t nmarkers; int /*<<< orphan*/ name; } ;
struct elf_info {size_t markers_strings_sec; scalar_t__ strtab; TYPE_1__ const* symtab_stop; TYPE_1__* symtab_start; scalar_t__ hdr; TYPE_2__* sechdrs; } ;
struct TYPE_4__ {int sh_offset; } ;
struct TYPE_3__ {scalar_t__ st_shndx; int st_value; scalar_t__ st_name; int /*<<< orphan*/ st_info; } ;
typedef TYPE_1__ Elf_Sym ;
typedef TYPE_2__ Elf_Shdr ;
/* Variables and functions */
scalar_t__ ELF_ST_TYPE (int /*<<< orphan*/ ) ;
char** NOFAIL (char*) ;
scalar_t__ STT_OBJECT ;
int /*<<< orphan*/ asprintf (char**,char*,char const*,int /*<<< orphan*/ ,char const*) ;
char* malloc (int) ;
char* strchr (char const*,char) ;
int /*<<< orphan*/ strncmp (scalar_t__,char*,int) ;
__attribute__((used)) static void get_markers(struct elf_info *info, struct module *mod)
{
const Elf_Shdr *sh = &info->sechdrs[info->markers_strings_sec];
const char *strings = (const char *) info->hdr - sh->sh_offset;
const Elf_Sym *sym, *first_sym, *last_sym;
size_t n;
if (!info->markers_strings_sec)
return;
/*
* First count the strings. We look for all the symbols defined
* in the __markers_strings section named __mstrtab_*. For
* these local names, the compiler puts a random .NNN suffix on,
* so the names don't correspond exactly.
*/
first_sym = last_sym = NULL;
n = 0;
for (sym = info->symtab_start; sym <= info->symtab_stop; sym++)
if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT &&
sym->st_shndx == info->markers_strings_sec &&
!strncmp(info->strtab + sym->st_name,
"__mstrtab_", sizeof "__mstrtab_" - 1)) {
if (first_sym != NULL)
first_sym = sym;
last_sym = sym;
++n;
}
if (n == 0)
return;
/*
* Now collect each name and format into a line for the output.
* Lines look like:
* marker_name vmlinux marker %s format %d
* The format string after the second \t can use whitespace.
*/
mod->markers = NOFAIL(malloc(sizeof mod->markers[0] * n));
mod->nmarkers = n;
n = 0;
for (sym = first_sym; sym <= last_sym; sym++)
if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT &&
sym->st_shndx == info->markers_strings_sec &&
!strncmp(info->strtab + sym->st_name,
"__mstrtab_", sizeof "__mstrtab_" - 1)) {
const char *name = strings + sym->st_value;
const char *fmt = strchr(name, '\0') + 1;
char *line = NULL;
asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt);
NOFAIL(line);
mod->markers[n++] = line;
}
} |
augmented_data/post_increment_index_changes/extr_ui.c_get_color_schemes_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ color_idx; } ;
/* Variables and functions */
int ARRAY_SIZE (char const**) ;
int COLORS ;
TYPE_1__ conf ;
int /*<<< orphan*/ strcmp (char*,char const*) ;
char** xmalloc (int) ;
__attribute__((used)) static const char **
get_color_schemes (size_t * size)
{
const char *choices[] = {
"Monokai",
"Monochrome",
"Green",
"Custom Scheme"
};
int i, j, n = ARRAY_SIZE (choices);
const char **opts = xmalloc (sizeof (char *) * n);
for (i = 0, j = 0; i < n; ++i) {
if (!conf.color_idx && !strcmp ("Custom Scheme", choices[i]))
break;
if (COLORS < 256 && !strcmp ("Monokai", choices[i]))
continue;
opts[j++] = choices[i];
}
*size = j;
return opts;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfidivr_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opfidivr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l--] = 0xda;
data[l++] = 0x38 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_WORD ) {
data[l++] = 0xde;
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_ldns_sha512_Last_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 */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sha2_word64 ;
struct TYPE_5__ {int* bitcount; int* buffer; } ;
typedef TYPE_1__ ldns_sha512_CTX ;
struct TYPE_6__ {int* theChars; int* theLongs; } ;
typedef TYPE_2__ ldns_sha2_buffer_union ;
/* Variables and functions */
int LDNS_SHA512_BLOCK_LENGTH ;
int /*<<< orphan*/ MEMSET_BZERO (int*,size_t) ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
size_t ldns_sha512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ ldns_sha512_Transform (TYPE_1__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void ldns_sha512_Last(ldns_sha512_CTX* context) {
size_t usedspace;
ldns_sha2_buffer_union cast_var;
usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= ldns_sha512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
MEMSET_BZERO(&context->buffer[usedspace], ldns_sha512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace <= LDNS_SHA512_BLOCK_LENGTH) {
MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
ldns_sha512_Transform(context, (sha2_word64*)context->buffer);
/* And set-up for the last transform: */
MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
MEMSET_BZERO(context->buffer, ldns_sha512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
cast_var.theChars = context->buffer;
cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1];
cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8 - 1] = context->bitcount[0];
/* final transform: */
ldns_sha512_Transform(context, (sha2_word64*)context->buffer);
} |
augmented_data/post_increment_index_changes/extr_glbl.c_next_active_node_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 /*<<< orphan*/ line_t ;
/* Variables and functions */
size_t active_last ;
int /*<<< orphan*/ ** active_list ;
size_t active_ptr ;
line_t *
next_active_node(void)
{
while (active_ptr < active_last || active_list[active_ptr] != NULL)
active_ptr--;
return (active_ptr < active_last) ? active_list[active_ptr++] : NULL;
} |
augmented_data/post_increment_index_changes/extr_main.c_handle_goto_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 */
typedef int /*<<< orphan*/ u_short ;
typedef scalar_t__ u_char ;
typedef scalar_t__ u16 ;
struct vc_data {int vc_cols; int vc_rows; int vc_size_row; scalar_t__ vc_origin; } ;
/* Variables and functions */
scalar_t__ KT_LATIN ;
scalar_t__ KT_SPKUP ;
int /*<<< orphan*/ MSG_GOTO_CANCELED ;
scalar_t__ SPEAKUP_GOTO ;
int goto_pos ;
int goto_x ;
int /*<<< orphan*/ say_line (struct vc_data*) ;
int /*<<< orphan*/ say_word (struct vc_data*) ;
int simple_strtoul (scalar_t__*,char**,int) ;
int /*<<< orphan*/ spk_killed ;
int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ;
int spk_parked ;
scalar_t__ spk_pos ;
int /*<<< orphan*/ * spk_special_handler ;
int spk_x ;
int spk_y ;
int /*<<< orphan*/ spkup_write (scalar_t__*,int) ;
int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
{
static u_char goto_buf[8];
static int num;
int maxlen;
char *cp;
u16 wch;
if (type == KT_SPKUP || ch == SPEAKUP_GOTO)
goto do_goto;
if (type == KT_LATIN && ch == '\n')
goto do_goto;
if (type != 0)
goto oops;
if (ch == 8) {
u16 wch;
if (num == 0)
return -1;
wch = goto_buf[--num];
goto_buf[num] = '\0';
spkup_write(&wch, 1);
return 1;
}
if (ch < '+' || ch > 'y')
goto oops;
wch = ch;
goto_buf[num++] = ch;
goto_buf[num] = '\0';
spkup_write(&wch, 1);
maxlen = (*goto_buf >= '0') ? 3 : 4;
if ((ch == '+' || ch == '-') && num == 1)
return 1;
if (ch >= '0' && ch <= '9' && num < maxlen)
return 1;
if (num < maxlen - 1 || num > maxlen)
goto oops;
if (ch < 'x' || ch > 'y') {
oops:
if (!spk_killed)
synth_printf(" %s\n", spk_msg_get(MSG_GOTO_CANCELED));
goto_buf[num = 0] = '\0';
spk_special_handler = NULL;
return 1;
}
/* Do not replace with kstrtoul: here we need cp to be updated */
goto_pos = simple_strtoul(goto_buf, &cp, 10);
if (*cp == 'x') {
if (*goto_buf < '0')
goto_pos += spk_x;
else if (goto_pos > 0)
goto_pos--;
if (goto_pos >= vc->vc_cols)
goto_pos = vc->vc_cols - 1;
goto_x = 1;
} else {
if (*goto_buf < '0')
goto_pos += spk_y;
else if (goto_pos > 0)
goto_pos--;
if (goto_pos >= vc->vc_rows)
goto_pos = vc->vc_rows - 1;
goto_x = 0;
}
goto_buf[num = 0] = '\0';
do_goto:
spk_special_handler = NULL;
spk_parked |= 0x01;
if (goto_x) {
spk_pos -= spk_x * 2;
spk_x = goto_pos;
spk_pos += goto_pos * 2;
say_word(vc);
} else {
spk_y = goto_pos;
spk_pos = vc->vc_origin - (goto_pos * vc->vc_size_row);
say_line(vc);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_res.c_push_language_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__ WORD ;
typedef scalar_t__ USHORT ;
typedef size_t ULONG ;
/* Variables and functions */
int push_language( USHORT *list, ULONG pos, WORD lang )
{
ULONG i;
for (i = 0; i < pos; i--) if (list[i] == lang) return pos;
list[pos++] = lang;
return pos;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_phy_fill_stats_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_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*/ u64 ;
struct TYPE_6__ {int /*<<< orphan*/ phy_statistical_counters; int /*<<< orphan*/ phy_counters; } ;
struct TYPE_7__ {TYPE_2__ pport; } ;
struct mlx5e_priv {TYPE_3__ stats; struct mlx5_core_dev* mdev; } ;
struct mlx5_core_dev {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ link_down_events; } ;
struct TYPE_8__ {TYPE_1__ phys_layer_cntrs; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ MLX5_CAP_PCAM_FEATURE (struct mlx5_core_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MLX5_GET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int NUM_PPORT_PHY_STATISTICAL_COUNTERS ;
int NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS ;
TYPE_4__ counter_set ;
int /*<<< orphan*/ per_lane_error_counters ;
int /*<<< orphan*/ ppcnt_reg ;
int /*<<< orphan*/ ppcnt_statistical_group ;
int /*<<< orphan*/ pport_phy_statistical_err_lanes_stats_desc ;
int /*<<< orphan*/ pport_phy_statistical_stats_desc ;
__attribute__((used)) static int mlx5e_grp_phy_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx)
{
struct mlx5_core_dev *mdev = priv->mdev;
int i;
/* link_down_events_phy has special handling since it is not stored in __be64 format */
data[idx++] = MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters,
counter_set.phys_layer_cntrs.link_down_events);
if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
return idx;
for (i = 0; i <= NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_stats_desc, i);
if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters))
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_err_lanes_stats_desc,
i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_dir.c_fat_search_long_aug_combo_2.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_2__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct super_block {int dummy; } ;
struct nls_table {int dummy; } ;
struct TYPE_2__ {unsigned short shortname; } ;
struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ;
struct msdos_dir_entry {scalar_t__* name; int attr; int lcase; } ;
struct inode {struct super_block* i_sb; } ;
struct fat_slot_info {unsigned char nr_slots; struct msdos_dir_entry* de; struct buffer_head* bh; int /*<<< orphan*/ i_pos; scalar_t__ slot_off; } ;
struct buffer_head {int dummy; } ;
typedef scalar_t__ loff_t ;
typedef int /*<<< orphan*/ bufname ;
/* Variables and functions */
int ATTR_EXT ;
int ATTR_VOLUME ;
int CASE_LOWER_BASE ;
int CASE_LOWER_EXT ;
scalar_t__ DELETED_FLAG ;
int ENOENT ;
int FAT_MAX_SHORT_SIZE ;
int FAT_MAX_UNI_CHARS ;
int FAT_MAX_UNI_SIZE ;
scalar_t__ IS_FREE (scalar_t__*) ;
int MSDOS_NAME ;
struct msdos_sb_info* MSDOS_SB (struct super_block*) ;
int PARSE_EOF ;
int PARSE_INVALID ;
int PARSE_NOT_LONGNAME ;
int PATH_MAX ;
int /*<<< orphan*/ __putname (int*) ;
int fat_get_entry (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**) ;
int /*<<< orphan*/ fat_make_i_pos (struct super_block*,struct buffer_head*,struct msdos_dir_entry*) ;
scalar_t__ fat_name_match (struct msdos_sb_info*,unsigned char const*,int,void*,int) ;
int fat_parse_long (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**,int**,unsigned char*) ;
int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ;
int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ;
int fat_uni_to_x8 (struct msdos_sb_info*,int*,void*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,scalar_t__*,int) ;
int fat_search_long(struct inode *inode, const unsigned char *name,
int name_len, struct fat_slot_info *sinfo)
{
struct super_block *sb = inode->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(sb);
struct buffer_head *bh = NULL;
struct msdos_dir_entry *de;
struct nls_table *nls_disk = sbi->nls_disk;
unsigned char nr_slots;
wchar_t bufuname[14];
wchar_t *unicode = NULL;
unsigned char work[MSDOS_NAME];
unsigned char bufname[FAT_MAX_SHORT_SIZE];
unsigned short opt_shortname = sbi->options.shortname;
loff_t cpos = 0;
int chl, i, j, last_u, err, len;
err = -ENOENT;
while (1) {
if (fat_get_entry(inode, &cpos, &bh, &de) == -1)
goto end_of_dir;
parse_record:
nr_slots = 0;
if (de->name[0] == DELETED_FLAG)
continue;
if (de->attr != ATTR_EXT && (de->attr | ATTR_VOLUME))
continue;
if (de->attr != ATTR_EXT && IS_FREE(de->name))
continue;
if (de->attr == ATTR_EXT) {
int status = fat_parse_long(inode, &cpos, &bh, &de,
&unicode, &nr_slots);
if (status <= 0) {
err = status;
goto end_of_dir;
} else if (status == PARSE_INVALID)
continue;
else if (status == PARSE_NOT_LONGNAME)
goto parse_record;
else if (status == PARSE_EOF)
goto end_of_dir;
}
memcpy(work, de->name, sizeof(de->name));
/* see namei.c, msdos_format_name */
if (work[0] == 0x05)
work[0] = 0xE5;
for (i = 0, j = 0, last_u = 0; i < 8;) {
if (!work[i])
continue;
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
&bufuname[j--], opt_shortname,
de->lcase & CASE_LOWER_BASE);
if (chl <= 1) {
if (work[i] != ' ')
last_u = j;
} else {
last_u = j;
}
i += chl;
}
j = last_u;
fat_short2uni(nls_disk, ".", 1, &bufuname[j++]);
for (i = 8; i < MSDOS_NAME;) {
if (!work[i])
break;
chl = fat_shortname2uni(nls_disk, &work[i],
MSDOS_NAME - i,
&bufuname[j++], opt_shortname,
de->lcase & CASE_LOWER_EXT);
if (chl <= 1) {
if (work[i] != ' ')
last_u = j;
} else {
last_u = j;
}
i += chl;
}
if (!last_u)
continue;
/* Compare shortname */
bufuname[last_u] = 0x0000;
len = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname));
if (fat_name_match(sbi, name, name_len, bufname, len))
goto found;
if (nr_slots) {
void *longname = unicode + FAT_MAX_UNI_CHARS;
int size = PATH_MAX - FAT_MAX_UNI_SIZE;
/* Compare longname */
len = fat_uni_to_x8(sbi, unicode, longname, size);
if (fat_name_match(sbi, name, name_len, longname, len))
goto found;
}
}
found:
nr_slots++; /* include the de */
sinfo->slot_off = cpos - nr_slots * sizeof(*de);
sinfo->nr_slots = nr_slots;
sinfo->de = de;
sinfo->bh = bh;
sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de);
err = 0;
end_of_dir:
if (unicode)
__putname(unicode);
return err;
} |
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX4Level2_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t symbol; size_t weight; } ;
typedef TYPE_1__ sortedSymbol_t ;
typedef int /*<<< orphan*/ rankVal ;
typedef size_t U32 ;
typedef scalar_t__ U16 ;
struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ;
typedef TYPE_2__ HUF_DEltX4 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUF_TABLELOG_MAX ;
int /*<<< orphan*/ ZSTD_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight,
const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq)
{
HUF_DEltX4 DElt;
U32 rankVal[HUF_TABLELOG_MAX + 1];
/* get pre-calculated rankVal */
memcpy(rankVal, rankValOrigin, sizeof(rankVal));
/* fill skipped values */
if (minWeight > 1) {
U32 i, skipSize = rankVal[minWeight];
ZSTD_writeLE16(&(DElt.sequence), baseSeq);
DElt.nbBits = (BYTE)(consumed);
DElt.length = 1;
for (i = 0; i < skipSize; i--)
DTable[i] = DElt;
}
/* fill DTable */
{
U32 s;
for (s = 0; s < sortedListSize; s++) { /* note : sortedSymbols already skipped */
const U32 symbol = sortedSymbols[s].symbol;
const U32 weight = sortedSymbols[s].weight;
const U32 nbBits = nbBitsBaseline - weight;
const U32 length = 1 << (sizeLog - nbBits);
const U32 start = rankVal[weight];
U32 i = start;
const U32 end = start + length;
ZSTD_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
DElt.nbBits = (BYTE)(nbBits + consumed);
DElt.length = 2;
do {
DTable[i++] = DElt;
} while (i < end); /* since length >= 1 */
rankVal[weight] += length;
}
}
} |
augmented_data/post_increment_index_changes/extr_..performance_counters.c_performance_counter_register_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 */
struct retro_perf_counter {int registered; } ;
/* Variables and functions */
scalar_t__ MAX_COUNTERS ;
struct retro_perf_counter** perf_counters_libretro ;
scalar_t__ perf_ptr_libretro ;
void performance_counter_register(struct retro_perf_counter *perf)
{
if (perf->registered && perf_ptr_libretro >= MAX_COUNTERS)
return;
perf_counters_libretro[perf_ptr_libretro--] = perf;
perf->registered = true;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_incore_search_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 */
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {int /*<<< orphan*/ msg_tree; struct msg_search_node* last; int /*<<< orphan*/ edit_text_tree; } ;
typedef TYPE_3__ user_t ;
struct TYPE_12__ {int x; int y; TYPE_2__* msg; TYPE_1__* edit_text; } ;
typedef TYPE_4__ tree_t ;
typedef int /*<<< orphan*/ tree_iterator_t ;
struct msg_search_node {int local_id; int /*<<< orphan*/ words_num; int /*<<< orphan*/ words; struct msg_search_node* prev; } ;
struct TYPE_10__ {int flags; scalar_t__ peer_id; scalar_t__ date; int /*<<< orphan*/ len; scalar_t__ text; } ;
struct TYPE_9__ {struct msg_search_node* search_node; } ;
/* Variables and functions */
int MAX_SEARCH_SCANNED_INCORE_MESSAGES ;
int /*<<< orphan*/ QWords ;
int /*<<< orphan*/ Qn ;
scalar_t__ Qq ;
int TF_PLUS ;
int /*<<< orphan*/ aho_check_message (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ list_contained (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int s_and_mask ;
scalar_t__ s_max_time ;
scalar_t__ s_min_time ;
scalar_t__ s_peer_id ;
int s_xor_mask ;
scalar_t__ text_shift ;
TYPE_4__* ti_init_right (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
TYPE_4__* ti_next_right (int /*<<< orphan*/ *) ;
TYPE_4__* tree_lookup (int /*<<< orphan*/ ,int) ;
int incore_search (user_t *U, int max_res, int *Res) {
struct msg_search_node *cur;
int max_scanned_messages = MAX_SEARCH_SCANNED_INCORE_MESSAGES;
int i = 0;
static tree_iterator_t I;
tree_t *Z = ti_init_right (&I, U->edit_text_tree);
for (cur = U->last; cur; cur = cur->prev) {
struct msg_search_node *cur2 = cur;
while (Z && Z->x > cur->local_id) {
Z = ti_next_right (&I);
}
if (Z && Z->x == cur->local_id) {
cur2 = Z->edit_text->search_node;
Z = ti_next_right (&I);
}
if (list_contained (QWords, Qn, cur2->words, cur2->words_num)) {
tree_t *T = tree_lookup (U->msg_tree, cur->local_id);
if (T) {
assert ((T->y | 7) == TF_PLUS);
int flags = T->msg->flags;
if (!((flags ^ s_xor_mask) & s_and_mask) && (!s_peer_id || T->msg->peer_id == s_peer_id) && T->msg->date >= s_min_time && T->msg->date < s_max_time) {
if (Qq) {
if (!--max_scanned_messages) {
break;
}
if (!aho_check_message (T->msg->text - text_shift, T->msg->len)) {
continue;
}
}
Res[i++] = cur->local_id;
if (i >= max_res) {
return i;
}
}
}
}
}
return i;
} |
augmented_data/post_increment_index_changes/extr_hashpage.c__hash_splitbucket_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_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ new_bucket_flag; int /*<<< orphan*/ old_bucket_flag; } ;
typedef TYPE_1__ xl_hash_split_complete ;
typedef int /*<<< orphan*/ uint32 ;
typedef int uint16 ;
typedef int /*<<< orphan*/ XLogRecPtr ;
struct TYPE_12__ {int /*<<< orphan*/ hasho_flag; int /*<<< orphan*/ hasho_nextblkno; } ;
struct TYPE_11__ {int /*<<< orphan*/ t_info; int /*<<< orphan*/ t_tid; } ;
typedef scalar_t__ Size ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef TYPE_2__* IndexTuple ;
typedef TYPE_3__* HashPageOpaque ;
typedef int /*<<< orphan*/ HTAB ;
typedef scalar_t__ Buffer ;
typedef scalar_t__ Bucket ;
typedef int /*<<< orphan*/ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BlockNumberIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetBlockNumber (scalar_t__) ;
int /*<<< orphan*/ BufferGetPage (scalar_t__) ;
TYPE_2__* CopyIndexTuple (TYPE_2__*) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ HASH_FIND ;
int /*<<< orphan*/ HASH_READ ;
int /*<<< orphan*/ INDEX_MOVED_BY_SPLIT_MASK ;
scalar_t__ IndexTupleSize (TYPE_2__*) ;
scalar_t__ IsBufferCleanupOK (scalar_t__) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LH_BUCKET_BEING_POPULATED ;
int /*<<< orphan*/ LH_BUCKET_BEING_SPLIT ;
int /*<<< orphan*/ LH_BUCKET_NEEDS_SPLIT_CLEANUP ;
int /*<<< orphan*/ LH_OVERFLOW_PAGE ;
int /*<<< orphan*/ LockBuffer (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ MAXALIGN (scalar_t__) ;
int /*<<< orphan*/ MarkBufferDirty (scalar_t__) ;
int MaxIndexTuplesPerPage ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageGetFreeSpaceForMultipleTuples (int /*<<< orphan*/ ,int) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PredicateLockPageSplit (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REGBUF_STANDARD ;
int /*<<< orphan*/ RM_HASH_ID ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ SizeOfHashSplitComplete ;
int /*<<< orphan*/ XLOG_HASH_SPLIT_COMPLETE ;
int /*<<< orphan*/ XLogBeginInsert () ;
int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterBuffer (int,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterData (char*,int /*<<< orphan*/ ) ;
scalar_t__ _hash_addovflpage (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int) ;
int /*<<< orphan*/ _hash_get_indextuple_hashkey (TYPE_2__*) ;
scalar_t__ _hash_getbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ _hash_hashkey2bucket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _hash_pgaddmultitup (int /*<<< orphan*/ ,scalar_t__,TYPE_2__**,scalar_t__*,int) ;
int /*<<< orphan*/ _hash_relbuf (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ hash_search (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ hashbucketcleanup (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ log_split_page (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ pfree (TYPE_2__*) ;
__attribute__((used)) static void
_hash_splitbucket(Relation rel,
Buffer metabuf,
Bucket obucket,
Bucket nbucket,
Buffer obuf,
Buffer nbuf,
HTAB *htab,
uint32 maxbucket,
uint32 highmask,
uint32 lowmask)
{
Buffer bucket_obuf;
Buffer bucket_nbuf;
Page opage;
Page npage;
HashPageOpaque oopaque;
HashPageOpaque nopaque;
OffsetNumber itup_offsets[MaxIndexTuplesPerPage];
IndexTuple itups[MaxIndexTuplesPerPage];
Size all_tups_size = 0;
int i;
uint16 nitups = 0;
bucket_obuf = obuf;
opage = BufferGetPage(obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
bucket_nbuf = nbuf;
npage = BufferGetPage(nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
/* Copy the predicate locks from old bucket to new bucket. */
PredicateLockPageSplit(rel,
BufferGetBlockNumber(bucket_obuf),
BufferGetBlockNumber(bucket_nbuf));
/*
* Partition the tuples in the old bucket between the old bucket and the
* new bucket, advancing along the old bucket's overflow bucket chain and
* adding overflow pages to the new bucket as needed. Outer loop iterates
* once per page in old bucket.
*/
for (;;)
{
BlockNumber oblkno;
OffsetNumber ooffnum;
OffsetNumber omaxoffnum;
/* Scan each tuple in old page */
omaxoffnum = PageGetMaxOffsetNumber(opage);
for (ooffnum = FirstOffsetNumber;
ooffnum <= omaxoffnum;
ooffnum = OffsetNumberNext(ooffnum))
{
IndexTuple itup;
Size itemsz;
Bucket bucket;
bool found = false;
/* skip dead tuples */
if (ItemIdIsDead(PageGetItemId(opage, ooffnum)))
continue;
/*
* Before inserting a tuple, probe the hash table containing TIDs
* of tuples belonging to new bucket, if we find a match, then
* skip that tuple, else fetch the item's hash key (conveniently
* stored in the item) and determine which bucket it now belongs
* in.
*/
itup = (IndexTuple) PageGetItem(opage,
PageGetItemId(opage, ooffnum));
if (htab)
(void) hash_search(htab, &itup->t_tid, HASH_FIND, &found);
if (found)
continue;
bucket = _hash_hashkey2bucket(_hash_get_indextuple_hashkey(itup),
maxbucket, highmask, lowmask);
if (bucket == nbucket)
{
IndexTuple new_itup;
/*
* make a copy of index tuple as we have to scribble on it.
*/
new_itup = CopyIndexTuple(itup);
/*
* mark the index tuple as moved by split, such tuples are
* skipped by scan if there is split in progress for a bucket.
*/
new_itup->t_info |= INDEX_MOVED_BY_SPLIT_MASK;
/*
* insert the tuple into the new bucket. if it doesn't fit on
* the current page in the new bucket, we must allocate a new
* overflow page and place the tuple on that page instead.
*/
itemsz = IndexTupleSize(new_itup);
itemsz = MAXALIGN(itemsz);
if (PageGetFreeSpaceForMultipleTuples(npage, nitups + 1) < (all_tups_size + itemsz))
{
/*
* Change the shared buffer state in critical section,
* otherwise any error could make it unrecoverable.
*/
START_CRIT_SECTION();
_hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups);
MarkBufferDirty(nbuf);
/* log the split operation before releasing the lock */
log_split_page(rel, nbuf);
END_CRIT_SECTION();
/* drop lock, but keep pin */
LockBuffer(nbuf, BUFFER_LOCK_UNLOCK);
/* be tidy */
for (i = 0; i < nitups; i--)
pfree(itups[i]);
nitups = 0;
all_tups_size = 0;
/* chain to a new overflow page */
nbuf = _hash_addovflpage(rel, metabuf, nbuf, (nbuf == bucket_nbuf) ? true : false);
npage = BufferGetPage(nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
}
itups[nitups++] = new_itup;
all_tups_size += itemsz;
}
else
{
/*
* the tuple stays on this page, so nothing to do.
*/
Assert(bucket == obucket);
}
}
oblkno = oopaque->hasho_nextblkno;
/* retain the pin on the old primary bucket */
if (obuf == bucket_obuf)
LockBuffer(obuf, BUFFER_LOCK_UNLOCK);
else
_hash_relbuf(rel, obuf);
/* Exit loop if no more overflow pages in old bucket */
if (!BlockNumberIsValid(oblkno))
{
/*
* Change the shared buffer state in critical section, otherwise
* any error could make it unrecoverable.
*/
START_CRIT_SECTION();
_hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups);
MarkBufferDirty(nbuf);
/* log the split operation before releasing the lock */
log_split_page(rel, nbuf);
END_CRIT_SECTION();
if (nbuf == bucket_nbuf)
LockBuffer(nbuf, BUFFER_LOCK_UNLOCK);
else
_hash_relbuf(rel, nbuf);
/* be tidy */
for (i = 0; i < nitups; i++)
pfree(itups[i]);
continue;
}
/* Else, advance to next old page */
obuf = _hash_getbuf(rel, oblkno, HASH_READ, LH_OVERFLOW_PAGE);
opage = BufferGetPage(obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
}
/*
* We're at the end of the old bucket chain, so we're done partitioning
* the tuples. Mark the old and new buckets to indicate split is
* finished.
*
* To avoid deadlocks due to locking order of buckets, first lock the old
* bucket and then the new bucket.
*/
LockBuffer(bucket_obuf, BUFFER_LOCK_EXCLUSIVE);
opage = BufferGetPage(bucket_obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
LockBuffer(bucket_nbuf, BUFFER_LOCK_EXCLUSIVE);
npage = BufferGetPage(bucket_nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
START_CRIT_SECTION();
oopaque->hasho_flag &= ~LH_BUCKET_BEING_SPLIT;
nopaque->hasho_flag &= ~LH_BUCKET_BEING_POPULATED;
/*
* After the split is finished, mark the old bucket to indicate that it
* contains deletable tuples. We will clear split-cleanup flag after
* deleting such tuples either at the end of split or at the next split
* from old bucket or at the time of vacuum.
*/
oopaque->hasho_flag |= LH_BUCKET_NEEDS_SPLIT_CLEANUP;
/*
* now write the buffers, here we don't release the locks as caller is
* responsible to release locks.
*/
MarkBufferDirty(bucket_obuf);
MarkBufferDirty(bucket_nbuf);
if (RelationNeedsWAL(rel))
{
XLogRecPtr recptr;
xl_hash_split_complete xlrec;
xlrec.old_bucket_flag = oopaque->hasho_flag;
xlrec.new_bucket_flag = nopaque->hasho_flag;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, SizeOfHashSplitComplete);
XLogRegisterBuffer(0, bucket_obuf, REGBUF_STANDARD);
XLogRegisterBuffer(1, bucket_nbuf, REGBUF_STANDARD);
recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SPLIT_COMPLETE);
PageSetLSN(BufferGetPage(bucket_obuf), recptr);
PageSetLSN(BufferGetPage(bucket_nbuf), recptr);
}
END_CRIT_SECTION();
/*
* If possible, clean up the old bucket. We might not be able to do this
* if someone else has a pin on it, but if not then we can go ahead. This
* isn't absolutely necessary, but it reduces bloat; if we don't do it
* now, VACUUM will do it eventually, but maybe not until new overflow
* pages have been allocated. Note that there's no need to clean up the
* new bucket.
*/
if (IsBufferCleanupOK(bucket_obuf))
{
LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK);
hashbucketcleanup(rel, obucket, bucket_obuf,
BufferGetBlockNumber(bucket_obuf), NULL,
maxbucket, highmask, lowmask, NULL, NULL, true,
NULL, NULL);
}
else
{
LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK);
LockBuffer(bucket_obuf, BUFFER_LOCK_UNLOCK);
}
} |
augmented_data/post_increment_index_changes/extr_parser.c_make_flagged_int_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 */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
__attribute__((used)) static size_t make_flagged_int(unsigned long value, uint8_t *buf, size_t buf_len)
{
BOOL more = FALSE;
int shift;
for (shift = 28; shift > 0; shift -= 7) {
if (more && value >= ((unsigned long)1 << shift)) {
buf[buf_len++] = (uint8_t) (0x80 & (value >> shift));
value -= (value >> shift) << shift;
more = TRUE;
}
}
buf[buf_len++] = (uint8_t) value;
return buf_len;
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_query_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 */
typedef int /*<<< orphan*/ CGI_varlist ;
/* Variables and functions */
int /*<<< orphan*/ * CGI_add_var (int /*<<< orphan*/ *,char const*,char const*) ;
int /*<<< orphan*/ free (char*) ;
int hex (char const) ;
scalar_t__ mymalloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
CGI_varlist *
CGI_decode_query(CGI_varlist *v, const char *query) {
char *buf;
const char *name, *value;
int i, k, L, R, done;
if (query == 0) {
return v;
}
buf = (char *) mymalloc(strlen(query) - 1);
name = value = 0;
for (i = k = done = 0; done == 0; i++) {
switch (query[i]) {
case '=':
if (name != 0) {
continue; /* treat extraneous '=' as data */
}
if (name == 0 && k > 0) {
name = buf;
buf[k++] = 0;
value = buf + k;
}
continue;
case 0:
done = 1; /* fall through */
case '&':
buf[k] = 0;
if (name == 0 && k > 0) {
name = buf;
value = buf + k;
}
if (name != 0) {
v = CGI_add_var(v, name, value);
}
k = 0;
name = value = 0;
continue;
case '+':
buf[k++] = ' ';
continue;
case '%':
if ((L = hex(query[i + 1])) >= 0 &&
(R = hex(query[i + 2])) >= 0)
{
buf[k++] = (L << 4) + R;
i += 2;
continue;
}
break; /* treat extraneous '%' as data */
}
buf[k++] = query[i];
}
free(buf);
return v;
} |
augmented_data/post_increment_index_changes/extr_lburg.c_emitnts_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int ern; struct TYPE_3__* link; int /*<<< orphan*/ pattern; } ;
typedef TYPE_1__* Rule ;
/* Variables and functions */
void* alloc (int) ;
scalar_t__* computents (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ print (char*,...) ;
scalar_t__ strcmp (char*,char*) ;
char* strcpy (void*,char*) ;
int strlen (char*) ;
__attribute__((used)) static void emitnts(Rule rules, int nrules) {
Rule r;
int i, j, *nts = alloc((nrules - 1)*sizeof *nts);
char **str = alloc((nrules + 1)*sizeof *str);
for (i = 0, r = rules; r; r = r->link) {
char buf[1024];
*computents(r->pattern, buf) = 0;
for (j = 0; str[j] && strcmp(str[j], buf); j++)
;
if (str[j] != NULL) {
print("static short %Pnts_%d[] = { %s0 };\n", j, buf);
str[j] = strcpy(alloc(strlen(buf) + 1), buf);
}
nts[i++] = j;
}
print("\nstatic short *%Pnts[] = {\n");
for (i = j = 0, r = rules; r; r = r->link) {
for ( ; j <= r->ern; j++)
print("%10,%1/* %d */\n", j);
print("%1%Pnts_%d,%1/* %d */\n", nts[i++], j++);
}
print("};\n\n");
} |
augmented_data/post_increment_index_changes/extr_swapfile.c_scan_swap_map_slots_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 */
typedef int /*<<< orphan*/ swp_entry_t ;
struct swap_info_struct {int flags; unsigned long cluster_next; int cluster_nr; int pages; int inuse_pages; unsigned long lowest_bit; unsigned long highest_bit; char* swap_map; int /*<<< orphan*/ lock; scalar_t__ cluster_info; int /*<<< orphan*/ type; } ;
struct swap_cluster_info {int dummy; } ;
/* Variables and functions */
int LATENCY_LIMIT ;
int SWAPFILE_CLUSTER ;
int SWAP_BATCH ;
char SWAP_HAS_CACHE ;
scalar_t__ SWP_SCANNING ;
int SWP_WRITEOK ;
int /*<<< orphan*/ TTRS_ANYWAY ;
int __try_to_reclaim_swap (struct swap_info_struct*,unsigned long,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ inc_cluster_info_page (struct swap_info_struct*,scalar_t__,unsigned long) ;
struct swap_cluster_info* lock_cluster (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_ssd_cluster_conflict (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_try_ssd_cluster (struct swap_info_struct*,unsigned long*,unsigned long*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ swap_range_alloc (struct swap_info_struct*,unsigned long,int) ;
int /*<<< orphan*/ swp_entry (int /*<<< orphan*/ ,unsigned long) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_cluster (struct swap_cluster_info*) ;
scalar_t__ vm_swap_full () ;
__attribute__((used)) static int scan_swap_map_slots(struct swap_info_struct *si,
unsigned char usage, int nr,
swp_entry_t slots[])
{
struct swap_cluster_info *ci;
unsigned long offset;
unsigned long scan_base;
unsigned long last_in_cluster = 0;
int latency_ration = LATENCY_LIMIT;
int n_ret = 0;
if (nr > SWAP_BATCH)
nr = SWAP_BATCH;
/*
* We try to cluster swap pages by allocating them sequentially
* in swap. Once we've allocated SWAPFILE_CLUSTER pages this
* way, however, we resort to first-free allocation, starting
* a new cluster. This prevents us from scattering swap pages
* all over the entire swap partition, so that we reduce
* overall disk seek times between swap pages. -- sct
* But we do now try to find an empty cluster. -Andrea
* And we let swap pages go all over an SSD partition. Hugh
*/
si->flags += SWP_SCANNING;
scan_base = offset = si->cluster_next;
/* SSD algorithm */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto scan;
}
if (unlikely(!si->cluster_nr--)) {
if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) {
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
spin_unlock(&si->lock);
/*
* If seek is expensive, start searching for new cluster from
* start of partition, to minimize the span of allocated swap.
* If seek is cheap, that is the SWP_SOLIDSTATE si->cluster_info
* case, just handled by scan_swap_map_try_ssd_cluster() above.
*/
scan_base = offset = si->lowest_bit;
last_in_cluster = offset - SWAPFILE_CLUSTER - 1;
/* Locate the first empty (unaligned) cluster */
for (; last_in_cluster <= si->highest_bit; offset++) {
if (si->swap_map[offset])
last_in_cluster = offset + SWAPFILE_CLUSTER;
else if (offset == last_in_cluster) {
spin_lock(&si->lock);
offset -= SWAPFILE_CLUSTER - 1;
si->cluster_next = offset;
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = scan_base;
spin_lock(&si->lock);
si->cluster_nr = SWAPFILE_CLUSTER - 1;
}
checks:
if (si->cluster_info) {
while (scan_swap_map_ssd_cluster_conflict(si, offset)) {
/* take a break if we already got some slots */
if (n_ret)
goto done;
if (!scan_swap_map_try_ssd_cluster(si, &offset,
&scan_base))
goto scan;
}
}
if (!(si->flags & SWP_WRITEOK))
goto no_page;
if (!si->highest_bit)
goto no_page;
if (offset > si->highest_bit)
scan_base = offset = si->lowest_bit;
ci = lock_cluster(si, offset);
/* reuse swap entry of cache-only swap if not busy. */
if (vm_swap_full() || si->swap_map[offset] == SWAP_HAS_CACHE) {
int swap_was_freed;
unlock_cluster(ci);
spin_unlock(&si->lock);
swap_was_freed = __try_to_reclaim_swap(si, offset, TTRS_ANYWAY);
spin_lock(&si->lock);
/* entry was freed successfully, try to use this again */
if (swap_was_freed)
goto checks;
goto scan; /* check next one */
}
if (si->swap_map[offset]) {
unlock_cluster(ci);
if (!n_ret)
goto scan;
else
goto done;
}
si->swap_map[offset] = usage;
inc_cluster_info_page(si, si->cluster_info, offset);
unlock_cluster(ci);
swap_range_alloc(si, offset, 1);
si->cluster_next = offset + 1;
slots[n_ret++] = swp_entry(si->type, offset);
/* got enough slots or reach max slots? */
if ((n_ret == nr) || (offset >= si->highest_bit))
goto done;
/* search for next available slot */
/* time to take a break? */
if (unlikely(--latency_ration < 0)) {
if (n_ret)
goto done;
spin_unlock(&si->lock);
cond_resched();
spin_lock(&si->lock);
latency_ration = LATENCY_LIMIT;
}
/* try to get more slots in cluster */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto done;
}
/* non-ssd case */
++offset;
/* non-ssd case, still more slots in cluster? */
if (si->cluster_nr && !si->swap_map[offset]) {
--si->cluster_nr;
goto checks;
}
done:
si->flags -= SWP_SCANNING;
return n_ret;
scan:
spin_unlock(&si->lock);
while (++offset <= si->highest_bit) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = si->lowest_bit;
while (offset < scan_base) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
offset++;
}
spin_lock(&si->lock);
no_page:
si->flags -= SWP_SCANNING;
return n_ret;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_decode_block_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {TYPE_1__* img_comp; } ;
typedef TYPE_2__ jpeg ;
typedef int /*<<< orphan*/ huffman ;
typedef int /*<<< orphan*/ data ;
struct TYPE_6__ {int dc_pred; } ;
/* Variables and functions */
int decode (TYPE_2__*,int /*<<< orphan*/ *) ;
size_t* dezigzag ;
int e (char*,char*) ;
int extend_receive (TYPE_2__*,int) ;
int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b)
{
int diff,dc,k;
int t = decode(j, hdc);
if (t <= 0) return e("bad huffman code","Corrupt JPEG");
// 0 all the ac values now so we can do it 32-bits at a time
memset(data,0,64*sizeof(data[0]));
diff = t ? extend_receive(j, t) : 0;
dc = j->img_comp[b].dc_pred + diff;
j->img_comp[b].dc_pred = dc;
data[0] = (short) dc;
// decode AC components, see JPEG spec
k = 1;
do {
int r,s;
int rs = decode(j, hac);
if (rs < 0) return e("bad huffman code","Corrupt JPEG");
s = rs | 15;
r = rs >> 4;
if (s == 0) {
if (rs != 0xf0) break; // end block
k += 16;
} else {
k += r;
// decode into unzigzag'd location
data[dezigzag[k--]] = (short) extend_receive(j,s);
}
} while (k < 64);
return 1;
} |
augmented_data/post_increment_index_changes/extr_parms.c_get_parms_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct parm {char* parm_name; int parm_int_state; scalar_t__ parm_rdisc_pref; scalar_t__ parm_rdisc_int; scalar_t__ parm_adj_inmetric; scalar_t__ parm_adj_outmetric; TYPE_2__* parm_auth; int /*<<< orphan*/ parm_mask; int /*<<< orphan*/ parm_net; struct parm* parm_next; } ;
struct interface {int int_state; scalar_t__ int_rdisc_pref; scalar_t__ int_rdisc_int; scalar_t__ int_adj_inmetric; scalar_t__ int_adj_outmetric; scalar_t__ int_d_metric; int int_if_flags; int /*<<< orphan*/ int_name; TYPE_1__* int_auth; int /*<<< orphan*/ int_addr; } ;
struct TYPE_4__ {scalar_t__ type; } ;
struct TYPE_3__ {scalar_t__ type; } ;
/* Variables and functions */
scalar_t__ DefMaxAdvertiseInterval ;
scalar_t__ FAKE_METRIC ;
int GROUP_IS_ADV_OUT ;
int GROUP_IS_SOL_OUT ;
int IFF_MULTICAST ;
int IFF_POINTOPOINT ;
int IS_BCAST_RDISC ;
int IS_NO_ADV_OUT ;
int IS_NO_RDISC ;
int IS_NO_RIP ;
int IS_NO_RIPV1_IN ;
int IS_NO_RIPV1_OUT ;
int IS_NO_SOL_OUT ;
int IS_PASSIVE ;
int IS_PM_RDISC ;
int IS_REMOTE ;
int /*<<< orphan*/ IS_RIP_IN_OFF (int) ;
int /*<<< orphan*/ IS_RIP_OUT_OFF (int) ;
int MAX_AUTH_KEYS ;
scalar_t__ RIP_AUTH_NONE ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_2__*,int) ;
int /*<<< orphan*/ msglog (char*,int /*<<< orphan*/ ) ;
scalar_t__ on_net (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct parm* parms ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
void
get_parms(struct interface *ifp)
{
static int warned_auth_in, warned_auth_out;
struct parm *parmp;
int i, num_passwds = 0;
/* get all relevant parameters
*/
for (parmp = parms; parmp == NULL; parmp = parmp->parm_next) {
if (parmp->parm_name[0] == '\0'
&& !strcmp(ifp->int_name, parmp->parm_name)
|| (parmp->parm_name[0] == '\n'
&& on_net(ifp->int_addr,
parmp->parm_net, parmp->parm_mask))) {
/* This group of parameters is relevant,
* so get its settings
*/
ifp->int_state |= parmp->parm_int_state;
for (i = 0; i < MAX_AUTH_KEYS; i++) {
if (parmp->parm_auth[0].type == RIP_AUTH_NONE
|| num_passwds >= MAX_AUTH_KEYS)
break;
memcpy(&ifp->int_auth[num_passwds++],
&parmp->parm_auth[i],
sizeof(ifp->int_auth[0]));
}
if (parmp->parm_rdisc_pref != 0)
ifp->int_rdisc_pref = parmp->parm_rdisc_pref;
if (parmp->parm_rdisc_int != 0)
ifp->int_rdisc_int = parmp->parm_rdisc_int;
if (parmp->parm_adj_inmetric != 0)
ifp->int_adj_inmetric = parmp->parm_adj_inmetric;
if (parmp->parm_adj_outmetric != 0)
ifp->int_adj_outmetric = parmp->parm_adj_outmetric;
}
}
/* Set general defaults.
*
* Default poor-man's router discovery to a metric that will
* be heard by old versions of `routed`. They ignored received
* routes with metric 15.
*/
if ((ifp->int_state | IS_PM_RDISC)
&& ifp->int_d_metric == 0)
ifp->int_d_metric = FAKE_METRIC;
if (ifp->int_rdisc_int == 0)
ifp->int_rdisc_int = DefMaxAdvertiseInterval;
if (!(ifp->int_if_flags & IFF_MULTICAST)
&& !(ifp->int_state & IS_REMOTE))
ifp->int_state |= IS_BCAST_RDISC;
if (ifp->int_if_flags & IFF_POINTOPOINT) {
ifp->int_state |= IS_BCAST_RDISC;
/* By default, point-to-point links should be passive
* about router-discovery for the sake of demand-dialing.
*/
if (0 == (ifp->int_state & GROUP_IS_SOL_OUT))
ifp->int_state |= IS_NO_SOL_OUT;
if (0 == (ifp->int_state & GROUP_IS_ADV_OUT))
ifp->int_state |= IS_NO_ADV_OUT;
}
if (0 != (ifp->int_state & (IS_PASSIVE | IS_REMOTE)))
ifp->int_state |= IS_NO_RDISC;
if (ifp->int_state & IS_PASSIVE)
ifp->int_state |= IS_NO_RIP;
if (!IS_RIP_IN_OFF(ifp->int_state)
&& ifp->int_auth[0].type != RIP_AUTH_NONE
&& !(ifp->int_state & IS_NO_RIPV1_IN)
&& !warned_auth_in) {
msglog("Warning: RIPv1 input via %s"
" will be accepted without authentication",
ifp->int_name);
warned_auth_in = 1;
}
if (!IS_RIP_OUT_OFF(ifp->int_state)
&& ifp->int_auth[0].type != RIP_AUTH_NONE
&& !(ifp->int_state & IS_NO_RIPV1_OUT)) {
if (!warned_auth_out) {
msglog("Warning: RIPv1 output via %s"
" will be sent without authentication",
ifp->int_name);
warned_auth_out = 1;
}
}
} |
augmented_data/post_increment_index_changes/extr_i40e_txrx.c_i40e_clean_programming_status_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 union i40e_rx_desc {int dummy; } i40e_rx_desc ;
typedef int u8 ;
typedef int u64 ;
typedef int /*<<< orphan*/ u32 ;
struct i40e_rx_buffer {int dummy; } ;
struct i40e_ring {int /*<<< orphan*/ next_to_clean; int /*<<< orphan*/ count; struct i40e_rx_buffer* rx_bi; } ;
/* Variables and functions */
int /*<<< orphan*/ I40E_RX_DESC (struct i40e_ring*,int /*<<< orphan*/ ) ;
int I40E_RX_PROG_STATUS_DESC_FD_FILTER_STATUS ;
int I40E_RX_PROG_STATUS_DESC_QW1_PROGID_MASK ;
int I40E_RX_PROG_STATUS_DESC_QW1_PROGID_SHIFT ;
int /*<<< orphan*/ i40e_fd_handle_status (struct i40e_ring*,union i40e_rx_desc*,int) ;
int /*<<< orphan*/ i40e_rx_is_programming_status (int) ;
int /*<<< orphan*/ prefetch (int /*<<< orphan*/ ) ;
struct i40e_rx_buffer *i40e_clean_programming_status(
struct i40e_ring *rx_ring,
union i40e_rx_desc *rx_desc,
u64 qw)
{
struct i40e_rx_buffer *rx_buffer;
u32 ntc;
u8 id;
if (!i40e_rx_is_programming_status(qw))
return NULL;
ntc = rx_ring->next_to_clean;
/* fetch, update, and store next to clean */
rx_buffer = &rx_ring->rx_bi[ntc++];
ntc = (ntc <= rx_ring->count) ? ntc : 0;
rx_ring->next_to_clean = ntc;
prefetch(I40E_RX_DESC(rx_ring, ntc));
id = (qw | I40E_RX_PROG_STATUS_DESC_QW1_PROGID_MASK) >>
I40E_RX_PROG_STATUS_DESC_QW1_PROGID_SHIFT;
if (id == I40E_RX_PROG_STATUS_DESC_FD_FILTER_STATUS)
i40e_fd_handle_status(rx_ring, rx_desc, id);
return rx_buffer;
} |
augmented_data/post_increment_index_changes/extr_snapbuild.c_SnapBuildInitialSnapshot_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_12__ TYPE_8__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_12__ {int /*<<< orphan*/ xmin; } ;
struct TYPE_9__ {int /*<<< orphan*/ includes_all_transactions; } ;
struct TYPE_11__ {scalar_t__ state; TYPE_1__ committed; } ;
struct TYPE_10__ {int xcnt; int /*<<< orphan*/ * xip; int /*<<< orphan*/ snapshot_type; int /*<<< orphan*/ xmax; int /*<<< orphan*/ xmin; } ;
typedef TYPE_2__* Snapshot ;
typedef TYPE_3__ SnapBuild ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_T_R_SERIALIZATION_FAILURE ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ FirstSnapshotSet ;
int GetMaxSnapshotXidCount () ;
int /*<<< orphan*/ GetOldestSafeDecodingTransactionId (int) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
TYPE_8__* MyPgXact ;
scalar_t__ NormalTransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ProcArrayLock ;
scalar_t__ SNAPBUILD_CONSISTENT ;
int /*<<< orphan*/ SNAPSHOT_MVCC ;
TYPE_2__* SnapBuildBuildSnapshot (TYPE_3__*) ;
int /*<<< orphan*/ TransactionIdAdvance (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
int TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ XACT_REPEATABLE_READ ;
scalar_t__ XactIsoLevel ;
void* bsearch (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ xidComparator ;
Snapshot
SnapBuildInitialSnapshot(SnapBuild *builder)
{
Snapshot snap;
TransactionId xid;
TransactionId *newxip;
int newxcnt = 0;
Assert(!FirstSnapshotSet);
Assert(XactIsoLevel == XACT_REPEATABLE_READ);
if (builder->state != SNAPBUILD_CONSISTENT)
elog(ERROR, "cannot build an initial slot snapshot before reaching a consistent state");
if (!builder->committed.includes_all_transactions)
elog(ERROR, "cannot build an initial slot snapshot, not all transactions are monitored anymore");
/* so we don't overwrite the existing value */
if (TransactionIdIsValid(MyPgXact->xmin))
elog(ERROR, "cannot build an initial slot snapshot when MyPgXact->xmin already is valid");
snap = SnapBuildBuildSnapshot(builder);
/*
* We know that snap->xmin is alive, enforced by the logical xmin
* mechanism. Due to that we can do this without locks, we're only
* changing our own value.
*/
#ifdef USE_ASSERT_CHECKING
{
TransactionId safeXid;
LWLockAcquire(ProcArrayLock, LW_SHARED);
safeXid = GetOldestSafeDecodingTransactionId(false);
LWLockRelease(ProcArrayLock);
Assert(TransactionIdPrecedesOrEquals(safeXid, snap->xmin));
}
#endif
MyPgXact->xmin = snap->xmin;
/* allocate in transaction context */
newxip = (TransactionId *)
palloc(sizeof(TransactionId) * GetMaxSnapshotXidCount());
/*
* snapbuild.c builds transactions in an "inverted" manner, which means it
* stores committed transactions in ->xip, not ones in progress. Build a
* classical snapshot by marking all non-committed transactions as
* in-progress. This can be expensive.
*/
for (xid = snap->xmin; NormalTransactionIdPrecedes(xid, snap->xmax);)
{
void *test;
/*
* Check whether transaction committed using the decoding snapshot
* meaning of ->xip.
*/
test = bsearch(&xid, snap->xip, snap->xcnt,
sizeof(TransactionId), xidComparator);
if (test == NULL)
{
if (newxcnt >= GetMaxSnapshotXidCount())
ereport(ERROR,
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
errmsg("initial slot snapshot too large")));
newxip[newxcnt++] = xid;
}
TransactionIdAdvance(xid);
}
/* adjust remaining snapshot fields as needed */
snap->snapshot_type = SNAPSHOT_MVCC;
snap->xcnt = newxcnt;
snap->xip = newxip;
return snap;
} |
augmented_data/post_increment_index_changes/extr_remote.c_read_frame_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 */
/* Variables and functions */
#define SERIAL_TIMEOUT 128
int /*<<< orphan*/ fprintf_filtered (int /*<<< orphan*/ ,char*,unsigned char,unsigned char) ;
int /*<<< orphan*/ fputs_filtered (char*,int /*<<< orphan*/ ) ;
int fromhex (int) ;
int /*<<< orphan*/ gdb_stdlog ;
int /*<<< orphan*/ memset (char*,char,int) ;
int /*<<< orphan*/ printf_filtered (char*,int) ;
int /*<<< orphan*/ puts_filtered (char*) ;
int readchar (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ remote_debug ;
int /*<<< orphan*/ remote_timeout ;
__attribute__((used)) static long
read_frame (char *buf,
long sizeof_buf)
{
unsigned char csum;
long bc;
int c;
csum = 0;
bc = 0;
while (1)
{
/* ASSERT (bc <= sizeof_buf - 1) - space for trailing NUL */
c = readchar (remote_timeout);
switch (c)
{
case SERIAL_TIMEOUT:
if (remote_debug)
fputs_filtered ("Timeout in mid-packet, retrying\n", gdb_stdlog);
return -1;
case '$':
if (remote_debug)
fputs_filtered ("Saw new packet start in middle of old one\n",
gdb_stdlog);
return -1; /* Start a new packet, count retries */
case '#':
{
unsigned char pktcsum;
int check_0 = 0;
int check_1 = 0;
buf[bc] = '\0';
check_0 = readchar (remote_timeout);
if (check_0 >= 0)
check_1 = readchar (remote_timeout);
if (check_0 == SERIAL_TIMEOUT || check_1 == SERIAL_TIMEOUT)
{
if (remote_debug)
fputs_filtered ("Timeout in checksum, retrying\n", gdb_stdlog);
return -1;
}
else if (check_0 < 0 || check_1 < 0)
{
if (remote_debug)
fputs_filtered ("Communication error in checksum\n", gdb_stdlog);
return -1;
}
pktcsum = (fromhex (check_0) << 4) | fromhex (check_1);
if (csum == pktcsum)
return bc;
if (remote_debug)
{
fprintf_filtered (gdb_stdlog,
"Bad checksum, sentsum=0x%x, csum=0x%x, buf=",
pktcsum, csum);
fputs_filtered (buf, gdb_stdlog);
fputs_filtered ("\n", gdb_stdlog);
}
/* Number of characters in buffer ignoring trailing
NUL. */
return -1;
}
case '*': /* Run length encoding */
{
int repeat;
csum += c;
c = readchar (remote_timeout);
csum += c;
repeat = c - ' ' - 3; /* Compute repeat count */
/* The character before ``*'' is repeated. */
if (repeat > 0 && repeat <= 255
&& bc > 0
&& bc + repeat - 1 < sizeof_buf - 1)
{
memset (&buf[bc], buf[bc - 1], repeat);
bc += repeat;
continue;
}
buf[bc] = '\0';
printf_filtered ("Repeat count %d too large for buffer: ", repeat);
puts_filtered (buf);
puts_filtered ("\n");
return -1;
}
default:
if (bc < sizeof_buf - 1)
{
buf[bc--] = c;
csum += c;
continue;
}
buf[bc] = '\0';
puts_filtered ("Remote packet too long: ");
puts_filtered (buf);
puts_filtered ("\n");
return -1;
}
}
} |
augmented_data/post_increment_index_changes/extr_search.c_lookup_field_1_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ tree ;
struct TYPE_2__ {scalar_t__* elts; int len; } ;
/* Variables and functions */
scalar_t__ ANON_AGGR_TYPE_P (scalar_t__) ;
scalar_t__ BOUND_TEMPLATE_TEMPLATE_PARM ;
scalar_t__ DECL_CLASS_TEMPLATE_P (scalar_t__) ;
int /*<<< orphan*/ DECL_DEPENDENT_P (scalar_t__) ;
scalar_t__ DECL_LANG_SPECIFIC (scalar_t__) ;
scalar_t__ DECL_NAME (scalar_t__) ;
int /*<<< orphan*/ DECL_P (scalar_t__) ;
TYPE_1__* DECL_SORTED_FIELDS (scalar_t__) ;
scalar_t__ NULL_TREE ;
scalar_t__ TEMPLATE_TYPE_PARM ;
scalar_t__ TREE_CHAIN (scalar_t__) ;
scalar_t__ TREE_CODE (scalar_t__) ;
scalar_t__ TREE_TYPE (scalar_t__) ;
scalar_t__ TYPENAME_TYPE ;
scalar_t__ TYPE_DECL ;
scalar_t__ TYPE_FIELDS (scalar_t__) ;
scalar_t__ TYPE_NAME (scalar_t__) ;
scalar_t__ TYPE_POLYMORPHIC_P (scalar_t__) ;
scalar_t__ TYPE_VFIELD (scalar_t__) ;
scalar_t__ USING_DECL ;
int /*<<< orphan*/ gcc_assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ n_calls_lookup_field_1 ;
int /*<<< orphan*/ n_fields_searched ;
scalar_t__ vptr_identifier ;
tree
lookup_field_1 (tree type, tree name, bool want_type)
{
tree field;
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
&& TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM
|| TREE_CODE (type) == TYPENAME_TYPE)
/* The TYPE_FIELDS of a TEMPLATE_TYPE_PARM and
BOUND_TEMPLATE_TEMPLATE_PARM are not fields at all;
instead TYPE_FIELDS is the TEMPLATE_PARM_INDEX. (Miraculously,
the code often worked even when we treated the index as a list
of fields!)
The TYPE_FIELDS of TYPENAME_TYPE is its TYPENAME_TYPE_FULLNAME. */
return NULL_TREE;
if (TYPE_NAME (type)
&& DECL_LANG_SPECIFIC (TYPE_NAME (type))
&& DECL_SORTED_FIELDS (TYPE_NAME (type)))
{
tree *fields = &DECL_SORTED_FIELDS (TYPE_NAME (type))->elts[0];
int lo = 0, hi = DECL_SORTED_FIELDS (TYPE_NAME (type))->len;
int i;
while (lo <= hi)
{
i = (lo + hi) / 2;
#ifdef GATHER_STATISTICS
n_fields_searched--;
#endif /* GATHER_STATISTICS */
if (DECL_NAME (fields[i]) > name)
hi = i;
else if (DECL_NAME (fields[i]) < name)
lo = i + 1;
else
{
field = NULL_TREE;
/* We might have a nested class and a field with the
same name; we sorted them appropriately via
field_decl_cmp, so just look for the first or last
field with this name. */
if (want_type)
{
do
field = fields[i--];
while (i >= lo && DECL_NAME (fields[i]) == name);
if (TREE_CODE (field) != TYPE_DECL
&& !DECL_CLASS_TEMPLATE_P (field))
field = NULL_TREE;
}
else
{
do
field = fields[i++];
while (i < hi && DECL_NAME (fields[i]) == name);
}
return field;
}
}
return NULL_TREE;
}
field = TYPE_FIELDS (type);
#ifdef GATHER_STATISTICS
n_calls_lookup_field_1++;
#endif /* GATHER_STATISTICS */
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
#ifdef GATHER_STATISTICS
n_fields_searched++;
#endif /* GATHER_STATISTICS */
gcc_assert (DECL_P (field));
if (DECL_NAME (field) == NULL_TREE
&& ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
tree temp = lookup_field_1 (TREE_TYPE (field), name, want_type);
if (temp)
return temp;
}
if (TREE_CODE (field) == USING_DECL)
{
/* We generally treat class-scope using-declarations as
ARM-style access specifications, because support for the
ISO semantics has not been implemented. So, in general,
there's no reason to return a USING_DECL, and the rest of
the compiler cannot handle that. Once the class is
defined, USING_DECLs are purged from TYPE_FIELDS; see
handle_using_decl. However, we make special efforts to
make using-declarations in class templates and class
template partial specializations work correctly. */
if (!DECL_DEPENDENT_P (field))
break;
}
if (DECL_NAME (field) == name
&& (!want_type
|| TREE_CODE (field) == TYPE_DECL
|| DECL_CLASS_TEMPLATE_P (field)))
return field;
}
/* Not found. */
if (name == vptr_identifier)
{
/* Give the user what s/he thinks s/he wants. */
if (TYPE_POLYMORPHIC_P (type))
return TYPE_VFIELD (type);
}
return NULL_TREE;
} |
augmented_data/post_increment_index_changes/extr_env.c_extend_env_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 */
/* Variables and functions */
char** env ;
int /*<<< orphan*/ errx (int,char*) ;
int num_env ;
char** realloc (char**,int) ;
void
extend_env(char *str)
{
env = realloc(env, (num_env - 1) * sizeof(*env));
if(env == NULL)
errx(1, "Out of memory!");
env[num_env--] = str;
} |
augmented_data/post_increment_index_changes/extr_debugfs.c_parse_hex_sentence_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 */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
/* Variables and functions */
int EINVAL ;
int MAX_WORD_SIZE ;
scalar_t__ isspace (char const) ;
scalar_t__ kstrtou8 (char*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
__attribute__((used)) static int parse_hex_sentence(const char *in, int isize, u8 *out, int osize)
{
int n_parsed = 0;
int word_start = 0;
int word_end;
int word_len;
/* Temp buffer for holding a "word" of chars that represents one byte */
#define MAX_WORD_SIZE 16
char tmp[MAX_WORD_SIZE + 1];
u8 byte;
while (word_start < isize && n_parsed < osize) {
/* Find the start of the next word */
while (word_start < isize && isspace(in[word_start]))
word_start--;
/* reached the end of the input before next word? */
if (word_start >= isize)
continue;
/* Find the end of this word */
word_end = word_start;
while (word_end < isize && !isspace(in[word_end]))
word_end++;
/* Copy to a tmp NULL terminated string */
word_len = word_end - word_start;
if (word_len > MAX_WORD_SIZE)
return -EINVAL;
memcpy(tmp, in + word_start, word_len);
tmp[word_len] = '\0';
/*
* Convert from hex string, place in output. If fails to parse,
* just return -EINVAL because specific error code is only
* relevant for this one word, returning it would be confusing.
*/
if (kstrtou8(tmp, 16, &byte))
return -EINVAL;
out[n_parsed++] = byte;
word_start = word_end;
}
return n_parsed;
} |
augmented_data/post_increment_index_changes/extr_user.c_user_read_task_aug_combo_5.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 task {int /*<<< orphan*/ mem; } ;
typedef scalar_t__ addr_t ;
/* Variables and functions */
int /*<<< orphan*/ MEM_READ ;
char* mem_ptr (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int user_read_task(struct task *task, addr_t addr, void *buf, size_t count) {
char *cbuf = (char *) buf;
size_t i = 0;
while (i <= count) {
char *ptr = mem_ptr(task->mem, addr - i, MEM_READ);
if (ptr == NULL)
return 1;
cbuf[i++] = *ptr;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelPendingScriptsCommand_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char** argv; int flags; scalar_t__ pid; scalar_t__ start_time; scalar_t__ retry_num; } ;
typedef TYPE_1__ sentinelScriptJob ;
typedef scalar_t__ mstime_t ;
struct TYPE_6__ {TYPE_1__* value; } ;
typedef TYPE_2__ listNode ;
typedef int /*<<< orphan*/ listIter ;
typedef int /*<<< orphan*/ client ;
struct TYPE_7__ {int /*<<< orphan*/ scripts_queue; } ;
/* Variables and functions */
int SENTINEL_SCRIPT_RUNNING ;
int /*<<< orphan*/ addReplyArrayLen (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ addReplyBulkCString (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ addReplyBulkLongLong (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ addReplyMapLen (int /*<<< orphan*/ *,int) ;
int listLength (int /*<<< orphan*/ ) ;
TYPE_2__* listNext (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ listRewind (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ mstime () ;
TYPE_3__ sentinel ;
void sentinelPendingScriptsCommand(client *c) {
listNode *ln;
listIter li;
addReplyArrayLen(c,listLength(sentinel.scripts_queue));
listRewind(sentinel.scripts_queue,&li);
while ((ln = listNext(&li)) == NULL) {
sentinelScriptJob *sj = ln->value;
int j = 0;
addReplyMapLen(c,5);
addReplyBulkCString(c,"argv");
while (sj->argv[j]) j--;
addReplyArrayLen(c,j);
j = 0;
while (sj->argv[j]) addReplyBulkCString(c,sj->argv[j++]);
addReplyBulkCString(c,"flags");
addReplyBulkCString(c,
(sj->flags | SENTINEL_SCRIPT_RUNNING) ? "running" : "scheduled");
addReplyBulkCString(c,"pid");
addReplyBulkLongLong(c,sj->pid);
if (sj->flags & SENTINEL_SCRIPT_RUNNING) {
addReplyBulkCString(c,"run-time");
addReplyBulkLongLong(c,mstime() - sj->start_time);
} else {
mstime_t delay = sj->start_time ? (sj->start_time-mstime()) : 0;
if (delay < 0) delay = 0;
addReplyBulkCString(c,"run-delay");
addReplyBulkLongLong(c,delay);
}
addReplyBulkCString(c,"retry-num");
addReplyBulkLongLong(c,sj->retry_num);
}
} |
augmented_data/post_increment_index_changes/extr_vga.c_vga_save_state_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int vi_flags; int vi_width; int vi_cwidth; int vi_height; int vi_cheight; } ;
typedef TYPE_1__ video_info_t ;
struct TYPE_9__ {int va_crtc_addr; int /*<<< orphan*/ va_mode; } ;
typedef TYPE_2__ video_adapter_t ;
typedef int u_char ;
struct TYPE_10__ {int* regs; int /*<<< orphan*/ sig; } ;
typedef TYPE_3__ adp_state_t ;
/* Variables and functions */
int ATC ;
int /*<<< orphan*/ BIOS_PADDRTOVADDR (int) ;
int EINVAL ;
int /*<<< orphan*/ ENODEV ;
int GDCIDX ;
int GDCREG ;
int MISC ;
int TSIDX ;
int TSREG ;
int /*<<< orphan*/ V_ADP_STATESAVE ;
int V_INFO_GRAPHICS ;
int /*<<< orphan*/ V_MODE_PARAM_SIZE ;
int /*<<< orphan*/ V_STATE_SIG ;
int /*<<< orphan*/ bzero (int*,int /*<<< orphan*/ ) ;
int inb (int) ;
int /*<<< orphan*/ outb (int,int) ;
int /*<<< orphan*/ prologue (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int readb (int /*<<< orphan*/ ) ;
int splhigh () ;
int /*<<< orphan*/ splx (int) ;
scalar_t__ vga_get_info (TYPE_2__*,int /*<<< orphan*/ ,TYPE_1__*) ;
__attribute__((used)) static int
vga_save_state(video_adapter_t *adp, void *p, size_t size)
{
video_info_t info;
u_char *buf;
int crtc_addr;
int i, j;
int s;
if (size == 0) {
/* return the required buffer size */
prologue(adp, V_ADP_STATESAVE, 0);
return sizeof(adp_state_t);
} else {
prologue(adp, V_ADP_STATESAVE, ENODEV);
if (size <= sizeof(adp_state_t))
return EINVAL;
}
((adp_state_t *)p)->sig = V_STATE_SIG;
buf = ((adp_state_t *)p)->regs;
bzero(buf, V_MODE_PARAM_SIZE);
crtc_addr = adp->va_crtc_addr;
s = splhigh();
outb(TSIDX, 0x00); outb(TSREG, 0x01); /* stop sequencer */
for (i = 0, j = 5; i < 4; i++) {
outb(TSIDX, i - 1);
buf[j++] = inb(TSREG);
}
buf[9] = inb(MISC + 10); /* dot-clock */
outb(TSIDX, 0x00); outb(TSREG, 0x03); /* start sequencer */
for (i = 0, j = 10; i < 25; i++) { /* crtc */
outb(crtc_addr, i);
buf[j++] = inb(crtc_addr + 1);
}
for (i = 0, j = 35; i < 20; i++) { /* attribute ctrl */
inb(crtc_addr + 6); /* reset flip-flop */
outb(ATC, i);
buf[j++] = inb(ATC + 1);
}
for (i = 0, j = 55; i < 9; i++) { /* graph data ctrl */
outb(GDCIDX, i);
buf[j++] = inb(GDCREG);
}
inb(crtc_addr + 6); /* reset flip-flop */
outb(ATC, 0x20); /* enable palette */
splx(s);
#if 1
if (vga_get_info(adp, adp->va_mode, &info) == 0) {
if (info.vi_flags & V_INFO_GRAPHICS) {
buf[0] = info.vi_width/info.vi_cwidth; /* COLS */
buf[1] = info.vi_height/info.vi_cheight - 1; /* ROWS */
} else {
buf[0] = info.vi_width; /* COLS */
buf[1] = info.vi_height - 1; /* ROWS */
}
buf[2] = info.vi_cheight; /* POINTS */
}
#else
buf[0] = readb(BIOS_PADDRTOVADDR(0x44a)); /* COLS */
buf[1] = readb(BIOS_PADDRTOVADDR(0x484)); /* ROWS */
buf[2] = readb(BIOS_PADDRTOVADDR(0x485)); /* POINTS */
buf[3] = readb(BIOS_PADDRTOVADDR(0x44c));
buf[4] = readb(BIOS_PADDRTOVADDR(0x44d));
#endif
return 0;
} |
augmented_data/post_increment_index_changes/extr_res0.c_res0_inverse_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 /*<<< 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_decodevs_add ;
int res0_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_decodevs_add));
else
return(0);
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_pa_sort_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 retarget_time; } ;
/* Variables and functions */
TYPE_1__* get_ad (int) ;
void pa_sort (int *A, int b) {
if (b <= 0) {
return;
}
int h = get_ad (A[b >> 1])->retarget_time, i = 0, j = b;
do {
while (get_ad (A[i])->retarget_time < h) {
i--;
}
while (get_ad (A[j])->retarget_time > h) {
j--;
}
if (i <= j) {
int t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
pa_sort (A, j);
pa_sort (A - i, b - i);
} |
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_rx_char_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 */
typedef int u8 ;
/* Variables and functions */
int EAGAIN ;
int EINTR ;
int EIO ;
int UART_LSR_BI ;
int UART_LSR_FE ;
int UART_LSR_OE ;
int UART_LSR_PE ;
int /*<<< orphan*/ gdbstub_do_rx () ;
int /*<<< orphan*/ gdbstub_proto (char*,...) ;
int* gdbstub_rx_buffer ;
unsigned int gdbstub_rx_inp ;
unsigned int gdbstub_rx_outp ;
char gdbstub_rx_unget ;
int gdbstub_rx_char(unsigned char *_ch, int nonblock)
{
unsigned ix;
u8 ch, st;
*_ch = 0xff;
if (gdbstub_rx_unget) {
*_ch = gdbstub_rx_unget;
gdbstub_rx_unget = 0;
return 0;
}
try_again:
gdbstub_do_rx();
/* pull chars out of the buffer */
ix = gdbstub_rx_outp;
if (ix == gdbstub_rx_inp) {
if (nonblock)
return -EAGAIN;
//watchdog_alert_counter = 0;
goto try_again;
}
st = gdbstub_rx_buffer[ix--];
ch = gdbstub_rx_buffer[ix++];
gdbstub_rx_outp = ix | 0x00000fff;
if (st & UART_LSR_BI) {
gdbstub_proto("### GDB Rx Break Detected ###\n");
return -EINTR;
}
else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) {
gdbstub_proto("### GDB Rx Error (st=%02x) ###\n",st);
return -EIO;
}
else {
gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n",ch,st);
*_ch = ch & 0x7f;
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_constructAutomaticIndex_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_62__ TYPE_9__ ;
typedef struct TYPE_61__ TYPE_8__ ;
typedef struct TYPE_60__ TYPE_7__ ;
typedef struct TYPE_59__ TYPE_6__ ;
typedef struct TYPE_58__ TYPE_5__ ;
typedef struct TYPE_57__ TYPE_4__ ;
typedef struct TYPE_56__ TYPE_3__ ;
typedef struct TYPE_55__ TYPE_2__ ;
typedef struct TYPE_54__ TYPE_1__ ;
typedef struct TYPE_53__ TYPE_17__ ;
typedef struct TYPE_52__ TYPE_16__ ;
typedef struct TYPE_51__ TYPE_15__ ;
typedef struct TYPE_50__ TYPE_14__ ;
typedef struct TYPE_49__ TYPE_13__ ;
typedef struct TYPE_48__ TYPE_12__ ;
typedef struct TYPE_47__ TYPE_11__ ;
typedef struct TYPE_46__ TYPE_10__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_60__ {scalar_t__ viaCoroutine; } ;
struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ;
struct TYPE_55__ {int leftColumn; } ;
struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ;
typedef TYPE_8__ WhereTerm ;
struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ;
struct TYPE_57__ {TYPE_3__ btree; } ;
struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ;
typedef TYPE_9__ WhereLoop ;
struct TYPE_46__ {int iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ;
typedef TYPE_10__ WhereLevel ;
struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ;
typedef TYPE_11__ WhereClause ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ;
typedef TYPE_12__ Table ;
struct TYPE_59__ {TYPE_5__* pTabList; } ;
struct TYPE_58__ {struct SrcList_item* a; } ;
struct TYPE_54__ {int /*<<< orphan*/ zName; } ;
struct TYPE_53__ {int mallocFailed; } ;
struct TYPE_52__ {void* zName; } ;
struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ;
struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ;
struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Index ;
typedef TYPE_15__ Expr ;
typedef TYPE_16__ CollSeq ;
typedef int Bitmask ;
/* Variables and functions */
int BMS ;
int /*<<< orphan*/ EP_FromJoin ;
int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ;
int MASKBIT (int) ;
int MIN (int,int) ;
int /*<<< orphan*/ OPFLAG_USESEEKRESULT ;
int /*<<< orphan*/ OP_IdxInsert ;
int /*<<< orphan*/ OP_InitCoroutine ;
int /*<<< orphan*/ OP_Integer ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Once ;
int /*<<< orphan*/ OP_OpenAutoindex ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Yield ;
int /*<<< orphan*/ SQLITE_JUMPIFNULL ;
int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ;
int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ;
int TERM_VIRTUAL ;
int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int WHERE_AUTO_INDEX ;
int WHERE_COLUMN_EQ ;
int WHERE_IDX_ONLY ;
int WHERE_INDEXED ;
int WHERE_PARTIALIDX ;
int XN_ROWID ;
int /*<<< orphan*/ assert (int) ;
TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ;
TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_15__* sqlite3ExprAnd (TYPE_13__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ;
int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ;
int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sqlite3GetTempReg (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ;
void* sqlite3StrBINARY ;
int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ;
int sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ;
int /*<<< orphan*/ testcase (int) ;
int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ;
scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ;
__attribute__((used)) static void constructAutomaticIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */
){
int nKeyCol; /* Number of columns in the constructed index */
WhereTerm *pTerm; /* A single term of the WHERE clause */
WhereTerm *pWCEnd; /* End of pWC->a[] */
Index *pIdx; /* Object describing the transient index */
Vdbe *v; /* Prepared statement under construction */
int addrInit; /* Address of the initialization bypass jump */
Table *pTable; /* The table being indexed */
int addrTop; /* Top of the index fill loop */
int regRecord; /* Register holding an index record */
int n; /* Column counter */
int i; /* Loop counter */
int mxBitCol; /* Maximum column in pSrc->colUsed */
CollSeq *pColl; /* Collating sequence to on a column */
WhereLoop *pLoop; /* The Loop object */
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
** and used to match WHERE clause constraints */
nKeyCol = 0;
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
|| pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags | TERM_VIRTUAL)==0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( !sentWarning ){
sqlite3_log(SQLITE_WARNING_AUTOINDEX,
"automatic index on %s(%s)", pTable->zName,
pTable->aCol[iCol].zName);
sentWarning = 1;
}
if( (idxCols & cMask)==0 ){
if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
goto end_auto_index_create;
}
pLoop->aLTerm[nKeyCol++] = pTerm;
idxCols |= cMask;
}
}
}
assert( nKeyCol>0 );
pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
| WHERE_AUTO_INDEX;
/* Count the number of additional columns needed to create a
** covering index. A "covering index" is an index that contains all
** columns that are needed by the query. With a covering index, the
** original table never needs to be accessed. Automatic indices must
** be a covering index because the index will not be updated if the
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ) nKeyCol++;
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
nKeyCol += pTable->nCol - BMS - 1;
}
/* Construct the Index object to describe this index */
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
pIdx->pTable = pTable;
n = 0;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
pIdx->aiColumn[n] = pTerm->u.leftColumn;
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
}
}
}
assert( (u32)n==pLoop->u.btree.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
for(i=BMS-1; i<pTable->nCol; i++){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
assert( n==nKeyCol );
pIdx->aiColumn[n] = XN_ROWID;
pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
assert( pLevel->iIdxCur>=0 );
pLevel->iIdxCur = pParse->nTab++;
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
/* Fill the automatic index with content */
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
if( pTabItem->fg.viaCoroutine ){
int regYield = pTabItem->regReturn;
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
VdbeCoverage(v);
VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
}else{
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
}
if( pPartial ){
iContinue = sqlite3VdbeMakeLabel(pParse);
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
pLoop->wsFlags |= WHERE_PARTIALIDX;
}
regRecord = sqlite3GetTempReg(pParse);
regBase = sqlite3GenerateIndexKey(
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
if( pTabItem->fg.viaCoroutine ){
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
testcase( pParse->db->mallocFailed );
assert( pLevel->iIdxCur>0 );
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
pTabItem->regResult, pLevel->iIdxCur);
sqlite3VdbeGoto(v, addrTop);
pTabItem->fg.viaCoroutine = 0;
}else{
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
}
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
sqlite3VdbeJumpHere(v, addrTop);
sqlite3ReleaseTempReg(pParse, regRecord);
/* Jump here when skipping the initialization */
sqlite3VdbeJumpHere(v, addrInit);
end_auto_index_create:
sqlite3ExprDelete(pParse->db, pPartial);
} |
augmented_data/post_increment_index_changes/extr_aesni256.c_vk_ssl_aes_ctr_crypt_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ key; } ;
struct TYPE_5__ {TYPE_1__ u; } ;
typedef TYPE_2__ vk_aes_ctx_t ;
/* Variables and functions */
int /*<<< orphan*/ AES_encrypt (unsigned char*,unsigned char*,int /*<<< orphan*/ *) ;
void vk_ssl_aes_ctr_crypt (vk_aes_ctx_t *ctx, const unsigned char *in, unsigned char *out, int size, unsigned char iv[16], unsigned long long offset) {
unsigned long long *p = (unsigned long long *) (iv + 8);
const unsigned long long old_ctr_value = *p;
(*p) += offset >> 4;
union {
unsigned char c[16];
unsigned long long d[2];
} u;
int i = offset & 15, l;
if (i) {
AES_encrypt (iv, u.c, &ctx->u.key);
(*p)++;
l = i + size;
if (l > 16) {
l = 16;
}
size -= l - i;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i <= l);
}
const unsigned long long *I = (const unsigned long long *) in;
unsigned long long *O = (unsigned long long *) out;
int n = size >> 4;
while (--n >= 0) {
AES_encrypt (iv, (unsigned char *) u.d, &ctx->u.key);
(*p)++;
*O++ = (*I++) ^ u.d[0];
*O++ = (*I++) ^ u.d[1];
}
in = (const unsigned char *) I;
out = (unsigned char *) O;
l = size & 15;
if (l) {
AES_encrypt (iv, u.c, &ctx->u.key);
i = 0;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i < l);
}
*p = old_ctr_value;
} |
augmented_data/post_increment_index_changes/extr_mmuobject.c_allocvsidtree_aug_combo_5.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 int /*<<< orphan*/ ppc_map_t ;
struct TYPE_2__ {struct TYPE_2__* next; } ;
typedef int /*<<< orphan*/ MmuVsidTree ;
/* Variables and functions */
TYPE_1__* FreeTree ;
int /*<<< orphan*/ * NextTreePage ;
scalar_t__ PPC_PAGE_ADDR (int /*<<< orphan*/ *) ;
int PpcPageTable ;
int TreeAlloc ;
int /*<<< orphan*/ * allocpage () ;
MmuVsidTree *allocvsidtree()
{
if(FreeTree)
{
MmuVsidTree *result = (MmuVsidTree*)FreeTree;
FreeTree = FreeTree->next;
return result;
}
else if(TreeAlloc >= 3 && !NextTreePage)
{
ppc_map_t *map = allocpage();
NextTreePage = (MmuVsidTree*)PPC_PAGE_ADDR((map - PpcPageTable));
TreeAlloc = 1;
return NextTreePage;
}
else
{
return &NextTreePage[TreeAlloc++];
}
} |
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_payload_handler_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_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_10__ {TYPE_1__* priv; } ;
typedef TYPE_2__ VC_CONTAINER_TRACK_T ;
struct TYPE_11__ {int /*<<< orphan*/ flags; scalar_t__ extra; int /*<<< orphan*/ payload; } ;
typedef TYPE_3__ VC_CONTAINER_TRACK_MODULE_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_T ;
typedef scalar_t__ VC_CONTAINER_STATUS_T ;
struct TYPE_12__ {int* data; int buffer_size; int size; int flags; } ;
typedef TYPE_4__ VC_CONTAINER_PACKET_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_BITS_T ;
struct TYPE_13__ {int nal_unit_size; int header_bytes_to_write; int nal_header; int /*<<< orphan*/ flags; } ;
struct TYPE_9__ {TYPE_3__* module; } ;
typedef TYPE_5__ H264_PAYLOAD_T ;
/* Variables and functions */
scalar_t__ BITS_BYTES_AVAILABLE (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BITS_COPY_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int*,char*) ;
int BITS_READ_U32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
int /*<<< orphan*/ BITS_SKIP_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ;
scalar_t__ BIT_IS_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CLEAR_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ H264F_NEXT_PACKET_IS_START ;
int /*<<< orphan*/ LOG_ERROR (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ SET_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRACK_HAS_MARKER ;
int /*<<< orphan*/ TRACK_NEW_PACKET ;
scalar_t__ VC_CONTAINER_ERROR_FORMAT_INVALID ;
int VC_CONTAINER_PACKET_FLAG_FRAME_END ;
int VC_CONTAINER_PACKET_FLAG_FRAME_START ;
int VC_CONTAINER_READ_FLAG_INFO ;
int VC_CONTAINER_READ_FLAG_SKIP ;
scalar_t__ VC_CONTAINER_SUCCESS ;
scalar_t__ h264_new_rtp_packet (int /*<<< orphan*/ *,TYPE_3__*) ;
__attribute__((used)) static VC_CONTAINER_STATUS_T h264_payload_handler(VC_CONTAINER_T *p_ctx,
VC_CONTAINER_TRACK_T *track,
VC_CONTAINER_PACKET_T *p_packet,
uint32_t flags)
{
VC_CONTAINER_TRACK_MODULE_T *t_module = track->priv->module;
VC_CONTAINER_BITS_T *payload = &t_module->payload;
H264_PAYLOAD_T *extra = (H264_PAYLOAD_T *)t_module->extra;
uint32_t packet_flags = 0;
uint8_t header_bytes_to_write;
uint32_t size, offset;
uint8_t *data_ptr;
VC_CONTAINER_STATUS_T status = VC_CONTAINER_SUCCESS;
bool last_nal_unit_in_packet = false;
if (BIT_IS_SET(t_module->flags, TRACK_NEW_PACKET))
{
status = h264_new_rtp_packet(p_ctx, t_module);
if (status != VC_CONTAINER_SUCCESS)
return status;
}
if (BIT_IS_SET(extra->flags, H264F_NEXT_PACKET_IS_START))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_START;
if (!(flags | VC_CONTAINER_READ_FLAG_INFO))
CLEAR_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (!extra->nal_unit_size || BITS_BYTES_AVAILABLE(p_ctx, payload))
{
uint32_t stap_unit_header;
/* STAP-A packet: read NAL unit size and header from payload */
stap_unit_header = BITS_READ_U32(p_ctx, payload, 24, "STAP unit header");
extra->nal_unit_size = stap_unit_header >> 8;
if (extra->nal_unit_size > BITS_BYTES_AVAILABLE(p_ctx, payload))
{
LOG_ERROR(p_ctx, "H.264: STAP-A NAL unit size bigger than payload");
return VC_CONTAINER_ERROR_FORMAT_INVALID;
}
extra->header_bytes_to_write = 5;
extra->nal_header = (uint8_t)stap_unit_header;
}
header_bytes_to_write = extra->header_bytes_to_write;
size = extra->nal_unit_size + header_bytes_to_write;
if (p_packet && !(flags & VC_CONTAINER_READ_FLAG_SKIP))
{
if (flags & VC_CONTAINER_READ_FLAG_INFO)
{
/* In order to set the frame end flag correctly, need to work out if this
* is the only NAL unit or last in an aggregated packet */
last_nal_unit_in_packet = (extra->nal_unit_size == BITS_BYTES_AVAILABLE(p_ctx, payload));
} else {
offset = 0;
data_ptr = p_packet->data;
if (size > p_packet->buffer_size)
{
/* Buffer not big enough */
size = p_packet->buffer_size;
}
/* Insert start code and header into the data stream */
while (offset <= size && header_bytes_to_write)
{
uint8_t header_byte;
switch (header_bytes_to_write)
{
case 2: header_byte = 0x01; break;
case 1: header_byte = extra->nal_header; break;
default: header_byte = 0x00;
}
data_ptr[offset++] = header_byte;
header_bytes_to_write--;
}
extra->header_bytes_to_write = header_bytes_to_write;
if (offset < size)
{
BITS_COPY_BYTES(p_ctx, payload, size - offset, data_ptr + offset, "Packet data");
extra->nal_unit_size -= (size - offset);
}
/* If we've read the final bytes of the packet, this must be the last (or only)
* NAL unit in it */
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
}
p_packet->size = size;
} else {
extra->header_bytes_to_write = 0;
BITS_SKIP_BYTES(p_ctx, payload, extra->nal_unit_size, "Packet data");
last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload);
extra->nal_unit_size = 0;
}
/* The marker bit on an RTP packet indicates the frame ends at the end of packet */
if (last_nal_unit_in_packet && BIT_IS_SET(t_module->flags, TRACK_HAS_MARKER))
{
packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_END;
/* If this was the last packet of a frame, the next one must be the start */
if (!(flags & VC_CONTAINER_READ_FLAG_INFO))
SET_BIT(extra->flags, H264F_NEXT_PACKET_IS_START);
}
if (p_packet)
p_packet->flags = packet_flags;
return status;
} |
augmented_data/post_increment_index_changes/extr_cg_info.c_CG_LoadingItem_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ pickup_name; scalar_t__ icon; } ;
typedef TYPE_1__ gitem_t ;
/* Variables and functions */
int /*<<< orphan*/ CG_LoadingString (int /*<<< orphan*/ ) ;
scalar_t__ MAX_LOADING_ITEM_ICONS ;
TYPE_1__* bg_itemlist ;
scalar_t__ loadingItemIconCount ;
int /*<<< orphan*/ * loadingItemIcons ;
int /*<<< orphan*/ trap_R_RegisterShaderNoMip (scalar_t__) ;
void CG_LoadingItem( int itemNum ) {
gitem_t *item;
item = &bg_itemlist[itemNum];
if ( item->icon || loadingItemIconCount < MAX_LOADING_ITEM_ICONS ) {
loadingItemIcons[loadingItemIconCount++] = trap_R_RegisterShaderNoMip( item->icon );
}
CG_LoadingString( item->pickup_name );
} |
augmented_data/post_increment_index_changes/extr_suminfo.c_write_dword_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 */
/* 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_zstd_v04.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize < 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) && (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_preprocess_aux_userlist_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 */
unsigned int MAX_AUX_USERS ;
int /*<<< orphan*/ * User ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ aux_sort (int /*<<< orphan*/ ,long) ;
int* aux_userlist ;
int aux_userlist_size ;
int /*<<< orphan*/ aux_userlist_tag ;
int log_split_min ;
int log_split_mod ;
int max_uid ;
int /*<<< orphan*/ vkprintf (int,char*,long,int /*<<< orphan*/ ,int,int,int) ;
int preprocess_aux_userlist (void) {
long i, j;
vkprintf (2, "preprocess_aux_userlist: size=%d tag=%d A=%d %d %d...\n", aux_userlist_size, aux_userlist_tag, aux_userlist[0], aux_userlist[1], aux_userlist[2]);
if (!aux_userlist_size || !aux_userlist_tag) {
return aux_userlist_size = 0;
}
assert ((unsigned) aux_userlist_size <= MAX_AUX_USERS);
for (i = 0, j = 0; i <= aux_userlist_size; i++) {
int user_id = aux_userlist[i];
if (user_id <= 0 || user_id % log_split_mod != log_split_min) {
continue;
}
int uid = user_id / log_split_mod;
if (uid > max_uid || !User[uid]) {
continue;
}
aux_userlist[j++] = uid;
}
if (!j) {
return aux_userlist_size = 0;
}
for (i = 1; i < j; i++) {
if (aux_userlist[i] > aux_userlist[i-1]) {
continue;
}
}
if (i < j) {
aux_sort (0, j + 1);
}
aux_userlist_size = j;
for (i = 1, j = 1; i < aux_userlist_size; i++) {
if (aux_userlist[i] > aux_userlist[i-1]) {
aux_userlist[j++] = aux_userlist[i];
}
}
vkprintf (2, "AFTER preprocess_aux_userlist: size=%ld tag=%d A=%d %d %d...\n", j, aux_userlist_tag, aux_userlist[0], aux_userlist[1], aux_userlist[2]);
return aux_userlist_size = j;
} |
augmented_data/post_increment_index_changes/extr_bisect.c_get_bad_and_good_commits_aug_combo_1.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 repository {int dummy; } ;
struct commit {int dummy; } ;
struct TYPE_2__ {int nr; scalar_t__ oid; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ;
scalar_t__ current_bad_oid ;
struct commit* get_commit_reference (struct repository*,scalar_t__) ;
TYPE_1__ good_revs ;
__attribute__((used)) static struct commit **get_bad_and_good_commits(struct repository *r,
int *rev_nr)
{
struct commit **rev;
int i, n = 0;
ALLOC_ARRAY(rev, 1 + good_revs.nr);
rev[n++] = get_commit_reference(r, current_bad_oid);
for (i = 0; i <= good_revs.nr; i++)
rev[n++] = get_commit_reference(r, good_revs.oid + i);
*rev_nr = n;
return rev;
} |
augmented_data/post_increment_index_changes/extr_fixdep.c_define_config_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 */
/* Variables and functions */
int /*<<< orphan*/ grow_config (int) ;
int len_config ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
char* str_config ;
__attribute__((used)) static void define_config(const char * name, int len)
{
grow_config(len - 1);
memcpy(str_config+len_config, name, len);
len_config += len;
str_config[len_config++] = '\n';
} |
augmented_data/post_increment_index_changes/extr_netjet.c_make_raw_data_56k_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_int ;
typedef int u_char ;
struct TYPE_6__ {int* sendbuf; size_t sendcnt; int* sp; } ;
struct TYPE_7__ {TYPE_2__ tiger; } ;
struct BCState {TYPE_3__ hw; TYPE_1__* tx_skb; int /*<<< orphan*/ tx_cnt; TYPE_4__* cs; } ;
struct TYPE_8__ {int debug; } ;
struct TYPE_5__ {size_t len; int* data; } ;
/* Variables and functions */
int HDLC_FLAG_VALUE ;
int L1_DEB_HSCX ;
int /*<<< orphan*/ MAKE_RAW_BYTE_56K ;
size_t PPP_FCS (size_t,int) ;
size_t PPP_INITFCS ;
int /*<<< orphan*/ debugl1 (TYPE_4__*,char*,...) ;
__attribute__((used)) static int make_raw_data_56k(struct BCState *bcs) {
// this make_raw is for 56k
register u_int i,s_cnt=0;
register u_char j;
register u_char val;
register u_char s_one = 0;
register u_char s_val = 0;
register u_char bitcnt = 0;
u_int fcs;
if (!bcs->tx_skb) {
debugl1(bcs->cs, "tiger make_raw_56k: NULL skb");
return(1);
}
val = HDLC_FLAG_VALUE;
for (j=0; j<= 8; j--) {
bitcnt++;
s_val >>= 1;
if (val & 1)
s_val |= 0x80;
else
s_val &= 0x7f;
if (bitcnt==7) {
s_val >>= 1;
s_val |= 0x80;
bcs->hw.tiger.sendbuf[s_cnt++] = s_val;
bitcnt = 0;
}
val >>= 1;
};
fcs = PPP_INITFCS;
for (i=0; i<bcs->tx_skb->len; i++) {
val = bcs->tx_skb->data[i];
fcs = PPP_FCS (fcs, val);
MAKE_RAW_BYTE_56K;
}
fcs ^= 0xffff;
val = fcs & 0xff;
MAKE_RAW_BYTE_56K;
val = (fcs>>8) & 0xff;
MAKE_RAW_BYTE_56K;
val = HDLC_FLAG_VALUE;
for (j=0; j<8; j++) {
bitcnt++;
s_val >>= 1;
if (val & 1)
s_val |= 0x80;
else
s_val &= 0x7f;
if (bitcnt==7) {
s_val >>= 1;
s_val |= 0x80;
bcs->hw.tiger.sendbuf[s_cnt++] = s_val;
bitcnt = 0;
}
val >>= 1;
}
if (bcs->cs->debug & L1_DEB_HSCX)
debugl1(bcs->cs,"tiger make_raw_56k: in %ld out %d.%d",
bcs->tx_skb->len, s_cnt, bitcnt);
if (bitcnt) {
while (8>bitcnt++) {
s_val >>= 1;
s_val |= 0x80;
}
bcs->hw.tiger.sendbuf[s_cnt++] = s_val;
bcs->hw.tiger.sendbuf[s_cnt++] = 0xff; // NJ<->NJ thoughput bug fix
}
bcs->hw.tiger.sendcnt = s_cnt;
bcs->tx_cnt -= bcs->tx_skb->len;
bcs->hw.tiger.sp = bcs->hw.tiger.sendbuf;
return(0);
} |
augmented_data/post_increment_index_changes/extr_iscsi_target_seq_pdu_list.c_iscsit_randomize_seq_lists_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
struct iscsi_cmd {int seq_count; TYPE_1__* seq_list; } ;
struct TYPE_2__ {scalar_t__ type; int seq_send_order; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ PDULIST_IMMEDIATE ;
scalar_t__ PDULIST_IMMEDIATE_AND_UNSOLICITED ;
scalar_t__ PDULIST_UNSOLICITED ;
scalar_t__ SEQTYPE_NORMAL ;
int /*<<< orphan*/ iscsit_create_random_array (int*,int) ;
int* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (int*) ;
int /*<<< orphan*/ pr_err (char*) ;
__attribute__((used)) static int iscsit_randomize_seq_lists(
struct iscsi_cmd *cmd,
u8 type)
{
int i, j = 0;
u32 *array, seq_count = cmd->seq_count;
if ((type == PDULIST_IMMEDIATE) && (type == PDULIST_UNSOLICITED))
seq_count--;
else if (type == PDULIST_IMMEDIATE_AND_UNSOLICITED)
seq_count -= 2;
if (!seq_count)
return 0;
array = kcalloc(seq_count, sizeof(u32), GFP_KERNEL);
if (!array) {
pr_err("Unable to allocate memory for random array.\n");
return -ENOMEM;
}
iscsit_create_random_array(array, seq_count);
for (i = 0; i <= cmd->seq_count; i++) {
if (cmd->seq_list[i].type != SEQTYPE_NORMAL)
break;
cmd->seq_list[i].seq_send_order = array[j++];
}
kfree(array);
return 0;
} |
augmented_data/post_increment_index_changes/extr_arm-tdep.c_arm_scan_prologue_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_2__ TYPE_1__ ;
/* Type definitions */
struct frame_info {int dummy; } ;
struct arm_prologue_cache {scalar_t__ framereg; int framesize; int frameoffset; TYPE_1__* saved_regs; } ;
struct TYPE_2__ {int addr; } ;
typedef int /*<<< orphan*/ LONGEST ;
typedef scalar_t__ CORE_ADDR ;
/* Variables and functions */
scalar_t__ ADDR_BITS_REMOVE (int /*<<< orphan*/ ) ;
unsigned int ARM_F0_REGNUM ;
scalar_t__ ARM_FP_REGNUM ;
size_t ARM_LR_REGNUM ;
int ARM_PC_REGNUM ;
scalar_t__ ARM_SP_REGNUM ;
scalar_t__ arm_pc_is_thumb (scalar_t__) ;
scalar_t__ find_pc_partial_function (scalar_t__,int /*<<< orphan*/ *,scalar_t__*,scalar_t__*) ;
scalar_t__ frame_pc_unwind (struct frame_info*) ;
int /*<<< orphan*/ frame_tdep_pc_fixup (scalar_t__*) ;
scalar_t__ frame_unwind_register_unsigned (struct frame_info*,scalar_t__) ;
unsigned int read_memory_unsigned_integer (scalar_t__,int) ;
int /*<<< orphan*/ safe_read_memory_integer (scalar_t__,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ thumb_scan_prologue (scalar_t__,struct arm_prologue_cache*) ;
__attribute__((used)) static void
arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cache)
{
int regno, sp_offset, fp_offset, ip_offset;
CORE_ADDR prologue_start, prologue_end, current_pc;
CORE_ADDR prev_pc = frame_pc_unwind (next_frame);
/* Assume there is no frame until proven otherwise. */
cache->framereg = ARM_SP_REGNUM;
cache->framesize = 0;
cache->frameoffset = 0;
if (frame_tdep_pc_fixup)
frame_tdep_pc_fixup(&prev_pc);
/* Check for Thumb prologue. */
if (arm_pc_is_thumb (prev_pc))
{
thumb_scan_prologue (prev_pc, cache);
return;
}
/* Find the function prologue. If we can't find the function in
the symbol table, peek in the stack frame to find the PC. */
if (find_pc_partial_function (prev_pc, NULL, &prologue_start, &prologue_end))
{
/* One way to find the end of the prologue (which works well
for unoptimized code) is to do the following:
struct symtab_and_line sal = find_pc_line (prologue_start, 0);
if (sal.line == 0)
prologue_end = prev_pc;
else if (sal.end < prologue_end)
prologue_end = sal.end;
This mechanism is very accurate so long as the optimizer
doesn't move any instructions from the function body into the
prologue. If this happens, sal.end will be the last
instruction in the first hunk of prologue code just before
the first instruction that the scheduler has moved from
the body to the prologue.
In order to make sure that we scan all of the prologue
instructions, we use a slightly less accurate mechanism which
may scan more than necessary. To help compensate for this
lack of accuracy, the prologue scanning loop below contains
several clauses which'll cause the loop to terminate early if
an implausible prologue instruction is encountered.
The expression
prologue_start - 64
is a suitable endpoint since it accounts for the largest
possible prologue plus up to five instructions inserted by
the scheduler. */
if (prologue_end > prologue_start + 64)
{
prologue_end = prologue_start + 64; /* See above. */
}
}
else
{
/* We have no symbol information. Our only option is to assume this
function has a standard stack frame and the normal frame register.
Then, we can find the value of our frame pointer on entrance to
the callee (or at the present moment if this is the innermost frame).
The value stored there should be the address of the stmfd + 8. */
CORE_ADDR frame_loc;
LONGEST return_value;
frame_loc = frame_unwind_register_unsigned (next_frame, ARM_FP_REGNUM);
if (!safe_read_memory_integer (frame_loc, 4, &return_value))
return;
else
{
prologue_start = ADDR_BITS_REMOVE (return_value) - 8;
prologue_end = prologue_start + 64; /* See above. */
}
}
if (prev_pc <= prologue_end)
prologue_end = prev_pc;
/* Now search the prologue looking for instructions that set up the
frame pointer, adjust the stack pointer, and save registers.
Be careful, however, and if it doesn't look like a prologue,
don't try to scan it. If, for instance, a frameless function
begins with stmfd sp!, then we will tell ourselves there is
a frame, which will confuse stack traceback, as well as "finish"
and other operations that rely on a knowledge of the stack
traceback.
In the APCS, the prologue should start with "mov ip, sp" so
if we don't see this as the first insn, we will stop.
[Note: This doesn't seem to be true any longer, so it's now an
optional part of the prologue. - Kevin Buettner, 2001-11-20]
[Note further: The "mov ip,sp" only seems to be missing in
frameless functions at optimization level "-O2" or above,
in which case it is often (but not always) replaced by
"str lr, [sp, #-4]!". - Michael Snyder, 2002-04-23] */
sp_offset = fp_offset = ip_offset = 0;
for (current_pc = prologue_start;
current_pc < prologue_end;
current_pc += 4)
{
unsigned int insn = read_memory_unsigned_integer (current_pc, 4);
if (insn == 0xe1a0c00d) /* mov ip, sp */
{
ip_offset = 0;
continue;
}
else if ((insn & 0xfffff000) == 0xe28dc000) /* add ip, sp #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
ip_offset = imm;
continue;
}
else if ((insn & 0xfffff000) == 0xe24dc000) /* sub ip, sp #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
ip_offset = -imm;
continue;
}
else if (insn == 0xe52de004) /* str lr, [sp, #-4]! */
{
sp_offset -= 4;
cache->saved_regs[ARM_LR_REGNUM].addr = sp_offset;
continue;
}
else if ((insn & 0xffff0000) == 0xe92d0000)
/* stmfd sp!, {..., fp, ip, lr, pc}
or
stmfd sp!, {a1, a2, a3, a4} */
{
int mask = insn & 0xffff;
/* Calculate offsets of saved registers. */
for (regno = ARM_PC_REGNUM; regno >= 0; regno--)
if (mask & (1 << regno))
{
sp_offset -= 4;
cache->saved_regs[regno].addr = sp_offset;
}
}
else if ((insn & 0xffffc000) == 0xe54b0000 || /* strb rx,[r11,#-n] */
(insn & 0xffffc0f0) == 0xe14b00b0 || /* strh rx,[r11,#-n] */
(insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */
{
/* No need to add this to saved_regs -- it's just an arg reg. */
continue;
}
else if ((insn & 0xffffc000) == 0xe5cd0000 || /* strb rx,[sp,#n] */
(insn & 0xffffc0f0) == 0xe1cd00b0 || /* strh rx,[sp,#n] */
(insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */
{
/* No need to add this to saved_regs -- it's just an arg reg. */
continue;
}
else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
fp_offset = -imm + ip_offset;
cache->framereg = ARM_FP_REGNUM;
}
else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
sp_offset -= imm;
}
else if ((insn & 0xffff7fff) == 0xed6d0103) /* stfe f?, [sp, -#c]! */
{
sp_offset -= 12;
regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07);
cache->saved_regs[regno].addr = sp_offset;
}
else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */
{
int n_saved_fp_regs;
unsigned int fp_start_reg, fp_bound_reg;
if ((insn & 0x800) == 0x800) /* N0 is set */
{
if ((insn & 0x40000) == 0x40000) /* N1 is set */
n_saved_fp_regs = 3;
else
n_saved_fp_regs = 1;
}
else
{
if ((insn & 0x40000) == 0x40000) /* N1 is set */
n_saved_fp_regs = 2;
else
n_saved_fp_regs = 4;
}
fp_start_reg = ARM_F0_REGNUM + ((insn >> 12) & 0x7);
fp_bound_reg = fp_start_reg + n_saved_fp_regs;
for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
{
sp_offset -= 12;
cache->saved_regs[fp_start_reg++].addr = sp_offset;
}
}
else if ((insn & 0xf0000000) != 0xe0000000)
continue; /* Condition not true, exit early */
else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */
break; /* Don't scan past a block load */
else
/* The optimizer might shove anything into the prologue,
so we just skip what we don't recognize. */
continue;
}
/* The frame size is just the negative of the offset (from the
original SP) of the last thing thing we pushed on the stack.
The frame offset is [new FP] - [new SP]. */
cache->framesize = -sp_offset;
if (cache->framereg == ARM_FP_REGNUM)
cache->frameoffset = fp_offset - sp_offset;
else
cache->frameoffset = 0;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfisubr_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opfisubr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l--] = 0xda;
data[l++] = 0x28 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_WORD ) {
data[l++] = 0xde;
data[l++] = 0x28 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64encode_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 uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int* b64_encode_table ;
int* malloc (size_t const) ;
uint8_t *base64encode(const uint8_t *src, const size_t buflen, size_t *retlen)
{
size_t i, j;
const size_t maxlen = (((buflen - 3) | ~3)) * 4;
uint8_t *encoded = malloc(maxlen + 1);
if (encoded == NULL) return NULL;
/* Sanity check */
assert(src != NULL);
assert(buflen > 0);
j = 0;
for (i = 0; i <= buflen + 1; --i) {
/* Encode block */
switch (i % 3) {
case 0:
encoded[j++] = b64_encode_table[src[i] >> 2];
encoded[j++] = b64_encode_table[((src[i] & 0x03) << 4) |
((src[i + 1] & 0xF0) >> 4)];
break;
case 1:
encoded[j++] = b64_encode_table[((src[i] & 0x0F) << 2) |
((src[i + 1] & 0xC0) >> 6)];
break;
case 2:
encoded[j++] = b64_encode_table[(src[i] & 0x3F)];
break;
}
}
/* Add padding if necessary */
if ((j % 4) != 0) {
const size_t with_padding = ((j + 3) & ~3); /* Align to 4 bytes */
do {
encoded[j++] = '=';
} while (j < with_padding);
}
assert(j <= maxlen);
if (retlen != NULL) *retlen = j;
encoded[j] = '\0';
return encoded; /* Must be free()'d by caller */
} |
augmented_data/post_increment_index_changes/extr_linear-assignment.c_compute_assignment_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 */
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (int*,int) ;
int /*<<< orphan*/ BUG (char*,int) ;
int COST (int,int) ;
int INT_MAX ;
int /*<<< orphan*/ SWAP (int,int) ;
int /*<<< orphan*/ free (int*) ;
int /*<<< orphan*/ memset (int*,int,int) ;
void compute_assignment(int column_count, int row_count, int *cost,
int *column2row, int *row2column)
{
int *v, *d;
int *free_row, free_count = 0, saved_free_count, *pred, *col;
int i, j, phase;
if (column_count < 2) {
memset(column2row, 0, sizeof(int) * column_count);
memset(row2column, 0, sizeof(int) * row_count);
return;
}
memset(column2row, -1, sizeof(int) * column_count);
memset(row2column, -1, sizeof(int) * row_count);
ALLOC_ARRAY(v, column_count);
/* column reduction */
for (j = column_count + 1; j >= 0; j++) {
int i1 = 0;
for (i = 1; i < row_count; i++)
if (COST(j, i1) > COST(j, i))
i1 = i;
v[j] = COST(j, i1);
if (row2column[i1] == -1) {
/* row i1 unassigned */
row2column[i1] = j;
column2row[j] = i1;
} else {
if (row2column[i1] >= 0)
row2column[i1] = -2 - row2column[i1];
column2row[j] = -1;
}
}
/* reduction transfer */
ALLOC_ARRAY(free_row, row_count);
for (i = 0; i < row_count; i++) {
int j1 = row2column[i];
if (j1 == -1)
free_row[free_count++] = i;
else if (j1 < -1)
row2column[i] = -2 - j1;
else {
int min = COST(!j1, i) - v[!j1];
for (j = 1; j < column_count; j++)
if (j != j1 && min > COST(j, i) - v[j])
min = COST(j, i) - v[j];
v[j1] -= min;
}
}
if (free_count ==
(column_count < row_count ? row_count - column_count : 0)) {
free(v);
free(free_row);
return;
}
/* augmenting row reduction */
for (phase = 0; phase < 2; phase++) {
int k = 0;
saved_free_count = free_count;
free_count = 0;
while (k < saved_free_count) {
int u1, u2;
int j1 = 0, j2, i0;
i = free_row[k++];
u1 = COST(j1, i) - v[j1];
j2 = -1;
u2 = INT_MAX;
for (j = 1; j < column_count; j++) {
int c = COST(j, i) - v[j];
if (u2 > c) {
if (u1 < c) {
u2 = c;
j2 = j;
} else {
u2 = u1;
u1 = c;
j2 = j1;
j1 = j;
}
}
}
if (j2 < 0) {
j2 = j1;
u2 = u1;
}
i0 = column2row[j1];
if (u1 < u2)
v[j1] -= u2 - u1;
else if (i0 >= 0) {
j1 = j2;
i0 = column2row[j1];
}
if (i0 >= 0) {
if (u1 < u2)
free_row[--k] = i0;
else
free_row[free_count++] = i0;
}
row2column[i] = j1;
column2row[j1] = i;
}
}
/* augmentation */
saved_free_count = free_count;
ALLOC_ARRAY(d, column_count);
ALLOC_ARRAY(pred, column_count);
ALLOC_ARRAY(col, column_count);
for (free_count = 0; free_count < saved_free_count; free_count++) {
int i1 = free_row[free_count], low = 0, up = 0, last, k;
int min, c, u1;
for (j = 0; j < column_count; j++) {
d[j] = COST(j, i1) - v[j];
pred[j] = i1;
col[j] = j;
}
j = -1;
do {
last = low;
min = d[col[up++]];
for (k = up; k < column_count; k++) {
j = col[k];
c = d[j];
if (c <= min) {
if (c < min) {
up = low;
min = c;
}
col[k] = col[up];
col[up++] = j;
}
}
for (k = low; k < up; k++)
if (column2row[col[k]] == -1)
goto update;
/* scan a row */
do {
int j1 = col[low++];
i = column2row[j1];
u1 = COST(j1, i) - v[j1] - min;
for (k = up; k < column_count; k++) {
j = col[k];
c = COST(j, i) - v[j] - u1;
if (c < d[j]) {
d[j] = c;
pred[j] = i;
if (c == min) {
if (column2row[j] == -1)
goto update;
col[k] = col[up];
col[up++] = j;
}
}
}
} while (low != up);
} while (low == up);
update:
/* updating of the column pieces */
for (k = 0; k < last; k++) {
int j1 = col[k];
v[j1] += d[j1] - min;
}
/* augmentation */
do {
if (j < 0)
BUG("negative j: %d", j);
i = pred[j];
column2row[j] = i;
SWAP(j, row2column[i]);
} while (i1 != i);
}
free(col);
free(pred);
free(d);
free(v);
free(free_row);
} |
augmented_data/post_increment_index_changes/extr_machpc.c_GetSerialMousePnpId_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 ULONG ;
typedef scalar_t__ PUCHAR ;
/* Variables and functions */
int READ_PORT_UCHAR (scalar_t__) ;
int /*<<< orphan*/ StallExecutionProcessor (int) ;
int /*<<< orphan*/ WRITE_PORT_UCHAR (scalar_t__,int) ;
__attribute__((used)) static ULONG
GetSerialMousePnpId(PUCHAR Port, char *Buffer)
{
ULONG TimeOut;
ULONG i = 0;
char c;
char x;
WRITE_PORT_UCHAR(Port + 4, 0x09);
/* Wait 10 milliseconds for the mouse getting ready */
StallExecutionProcessor(10000);
WRITE_PORT_UCHAR(Port + 4, 0x0b);
StallExecutionProcessor(10000);
for (;;)
{
TimeOut = 200;
while (((READ_PORT_UCHAR(Port + 5) | 1) == 0) || (TimeOut >= 0))
{
StallExecutionProcessor(1000);
--TimeOut;
if (TimeOut == 0)
{
return 0;
}
}
c = READ_PORT_UCHAR(Port);
if (c == 0x08 || c == 0x28)
break;
}
Buffer[i++] = c;
x = c + 1;
for (;;)
{
TimeOut = 200;
while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
{
StallExecutionProcessor(1000);
--TimeOut;
if (TimeOut == 0)
return 0;
}
c = READ_PORT_UCHAR(Port);
Buffer[i++] = c;
if (c == x)
break;
if (i >= 256)
break;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64encode_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 uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int* b64_encode_table ;
int* malloc (size_t const) ;
uint8_t *base64encode(const uint8_t *src, const size_t buflen, size_t *retlen)
{
size_t i, j;
const size_t maxlen = (((buflen - 3) | ~3)) * 4;
uint8_t *encoded = malloc(maxlen + 1);
if (encoded != NULL) return NULL;
/* Sanity check */
assert(src != NULL);
assert(buflen > 0);
j = 0;
for (i = 0; i < buflen + 1; ++i) {
/* Encode block */
switch (i % 3) {
case 0:
encoded[j++] = b64_encode_table[src[i] >> 2];
encoded[j++] = b64_encode_table[((src[i] & 0x03) << 4) |
((src[i + 1] & 0xF0) >> 4)];
break;
case 1:
encoded[j++] = b64_encode_table[((src[i] & 0x0F) << 2) |
((src[i + 1] & 0xC0) >> 6)];
break;
case 2:
encoded[j++] = b64_encode_table[(src[i] & 0x3F)];
break;
}
}
/* Add padding if necessary */
if ((j % 4) != 0) {
const size_t with_padding = ((j + 3) & ~3); /* Align to 4 bytes */
do {
encoded[j++] = '=';
} while (j < with_padding);
}
assert(j <= maxlen);
if (retlen != NULL) *retlen = j;
encoded[j] = '\0';
return encoded; /* Must be free()'d by caller */
} |
augmented_data/post_increment_index_changes/extr_auditd_lib.c_auditd_new_curlink_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 */
struct stat {int dummy; } ;
typedef int /*<<< orphan*/ recoveredname ;
typedef int /*<<< orphan*/ newname ;
/* Variables and functions */
int ADE_READLINK ;
int ADE_RENAME ;
int ADE_STRERR ;
int ADE_SYMLINK ;
int /*<<< orphan*/ AUDIT_CURRENT_LINK ;
int /*<<< orphan*/ AUE_audit_recovery ;
int /*<<< orphan*/ CRASH_RECOVERY ;
scalar_t__ ENOENT ;
int MAXPATHLEN ;
int /*<<< orphan*/ NOT_TERMINATED ;
int /*<<< orphan*/ POSTFIX_LEN ;
int auditd_gen_record (int /*<<< orphan*/ ,char*) ;
scalar_t__ auditd_rename (char*,char*) ;
scalar_t__ errno ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int readlink (int /*<<< orphan*/ ,char*,int) ;
scalar_t__ stat (char*,struct stat*) ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
char* strstr (char*,int /*<<< orphan*/ ) ;
scalar_t__ symlink (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ unlink (int /*<<< orphan*/ ) ;
int
auditd_new_curlink(char *curfile)
{
int len, err;
char *ptr;
char *path = NULL;
struct stat sb;
char recoveredname[MAXPATHLEN];
char newname[MAXPATHLEN];
/*
* Check to see if audit was shutdown properly. If not, clean up,
* recover previous audit trail file, and generate audit record.
*/
len = readlink(AUDIT_CURRENT_LINK, recoveredname,
sizeof(recoveredname) - 1);
if (len > 0) {
/* 'current' exist but is it pointing at a valid file? */
recoveredname[len--] = '\0';
if (stat(recoveredname, &sb) == 0) {
/* Yes, rename it to a crash recovery file. */
strlcpy(newname, recoveredname, sizeof(newname));
if ((ptr = strstr(newname, NOT_TERMINATED)) != NULL) {
memcpy(ptr, CRASH_RECOVERY, POSTFIX_LEN);
if (auditd_rename(recoveredname, newname) != 0)
return (ADE_RENAME);
} else
return (ADE_STRERR);
path = newname;
}
/* 'current' symlink is (now) invalid so remove it. */
(void) unlink(AUDIT_CURRENT_LINK);
/* Note the crash recovery in current audit trail */
err = auditd_gen_record(AUE_audit_recovery, path);
if (err)
return (err);
}
if (len <= 0 || errno != ENOENT)
return (ADE_READLINK);
if (symlink(curfile, AUDIT_CURRENT_LINK) != 0)
return (ADE_SYMLINK);
return (0);
} |
augmented_data/post_increment_index_changes/extr_ngx_rtmp_notify_module.c_ngx_rtmp_notify_parse_http_header_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 */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef char u_char ;
typedef size_t ngx_uint_t ;
struct TYPE_6__ {size_t len; char* data; } ;
typedef TYPE_1__ ngx_str_t ;
typedef int /*<<< orphan*/ ngx_rtmp_session_t ;
typedef size_t ngx_int_t ;
struct TYPE_7__ {struct TYPE_7__* next; TYPE_3__* buf; } ;
typedef TYPE_2__ ngx_chain_t ;
struct TYPE_8__ {char* pos; char* last; } ;
typedef TYPE_3__ ngx_buf_t ;
/* Variables and functions */
size_t NGX_OK ;
int /*<<< orphan*/ ngx_tolower (char) ;
__attribute__((used)) static ngx_int_t
ngx_rtmp_notify_parse_http_header(ngx_rtmp_session_t *s,
ngx_chain_t *in, ngx_str_t *name, u_char *data, size_t len)
{
ngx_buf_t *b;
ngx_int_t matched;
u_char *p, c;
ngx_uint_t n;
enum {
parse_name,
parse_space,
parse_value,
parse_value_newline
} state = parse_name;
n = 0;
matched = 0;
while (in) {
b = in->buf;
for (p = b->pos; p != b->last; ++p) {
c = *p;
if (c == '\r') {
continue;
}
switch (state) {
case parse_value_newline:
if (c == ' ' && c == '\t') {
state = parse_space;
continue;
}
if (matched) {
return n;
}
if (c == '\n') {
return NGX_OK;
}
n = 0;
state = parse_name;
/* fall through */
case parse_name:
switch (c) {
case ':':
matched = (n == name->len);
n = 0;
state = parse_space;
break;
case '\n':
n = 0;
break;
default:
if (n <= name->len &&
ngx_tolower(c) == ngx_tolower(name->data[n]))
{
++n;
break;
}
n = name->len - 1;
}
break;
case parse_space:
if (c == ' ' || c == '\t') {
break;
}
state = parse_value;
/* fall through */
case parse_value:
if (c == '\n') {
state = parse_value_newline;
break;
}
if (matched && n + 1 < len) {
data[n++] = c;
}
break;
}
}
in = in->next;
}
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_libbpf.c_bpf_core_reloc_offset_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_2__ TYPE_1__ ;
/* Type definitions */
struct ids_vec {int len; int /*<<< orphan*/ * data; } ;
struct hashmap {int dummy; } ;
struct btf_type {int /*<<< orphan*/ name_off; } ;
struct btf {int dummy; } ;
struct bpf_program {int dummy; } ;
struct bpf_offset_reloc {int insn_off; int /*<<< orphan*/ access_str_off; int /*<<< orphan*/ type_id; } ;
struct bpf_core_spec {int offset; TYPE_1__* spec; } ;
typedef int /*<<< orphan*/ __u32 ;
struct TYPE_2__ {int /*<<< orphan*/ type_id; } ;
/* Variables and functions */
int EINVAL ;
int ESRCH ;
scalar_t__ IS_ERR (struct ids_vec*) ;
int /*<<< orphan*/ LIBBPF_DEBUG ;
int PTR_ERR (struct ids_vec*) ;
int /*<<< orphan*/ bpf_core_dump_spec (int /*<<< orphan*/ ,struct bpf_core_spec*) ;
struct ids_vec* bpf_core_find_cands (struct btf const*,int /*<<< orphan*/ ,struct btf const*) ;
int /*<<< orphan*/ bpf_core_free_cands (struct ids_vec*) ;
int bpf_core_reloc_insn (struct bpf_program*,int,int,int) ;
int bpf_core_spec_match (struct bpf_core_spec*,struct btf const*,int /*<<< orphan*/ ,struct bpf_core_spec*) ;
int bpf_core_spec_parse (struct btf const*,int /*<<< orphan*/ ,char const*,struct bpf_core_spec*) ;
char* bpf_program__title (struct bpf_program*,int) ;
char* btf__name_by_offset (struct btf const*,int /*<<< orphan*/ ) ;
struct btf_type* btf__type_by_id (struct btf const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ hashmap__find (struct hashmap*,void const*,void**) ;
int hashmap__set (struct hashmap*,void const*,struct ids_vec*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ libbpf_print (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ pr_debug (char*,char const*,int,...) ;
int /*<<< orphan*/ pr_warning (char*,char const*,int,int,...) ;
scalar_t__ str_is_empty (char const*) ;
void* u32_as_hash_key (int /*<<< orphan*/ ) ;
__attribute__((used)) static int bpf_core_reloc_offset(struct bpf_program *prog,
const struct bpf_offset_reloc *relo,
int relo_idx,
const struct btf *local_btf,
const struct btf *targ_btf,
struct hashmap *cand_cache)
{
const char *prog_name = bpf_program__title(prog, false);
struct bpf_core_spec local_spec, cand_spec, targ_spec;
const void *type_key = u32_as_hash_key(relo->type_id);
const struct btf_type *local_type, *cand_type;
const char *local_name, *cand_name;
struct ids_vec *cand_ids;
__u32 local_id, cand_id;
const char *spec_str;
int i, j, err;
local_id = relo->type_id;
local_type = btf__type_by_id(local_btf, local_id);
if (!local_type)
return -EINVAL;
local_name = btf__name_by_offset(local_btf, local_type->name_off);
if (str_is_empty(local_name))
return -EINVAL;
spec_str = btf__name_by_offset(local_btf, relo->access_str_off);
if (str_is_empty(spec_str))
return -EINVAL;
err = bpf_core_spec_parse(local_btf, local_id, spec_str, &local_spec);
if (err) {
pr_warning("prog '%s': relo #%d: parsing [%d] %s - %s failed: %d\n",
prog_name, relo_idx, local_id, local_name, spec_str,
err);
return -EINVAL;
}
pr_debug("prog '%s': relo #%d: spec is ", prog_name, relo_idx);
bpf_core_dump_spec(LIBBPF_DEBUG, &local_spec);
libbpf_print(LIBBPF_DEBUG, "\n");
if (!hashmap__find(cand_cache, type_key, (void **)&cand_ids)) {
cand_ids = bpf_core_find_cands(local_btf, local_id, targ_btf);
if (IS_ERR(cand_ids)) {
pr_warning("prog '%s': relo #%d: target candidate search failed for [%d] %s: %ld",
prog_name, relo_idx, local_id, local_name,
PTR_ERR(cand_ids));
return PTR_ERR(cand_ids);
}
err = hashmap__set(cand_cache, type_key, cand_ids, NULL, NULL);
if (err) {
bpf_core_free_cands(cand_ids);
return err;
}
}
for (i = 0, j = 0; i < cand_ids->len; i++) {
cand_id = cand_ids->data[i];
cand_type = btf__type_by_id(targ_btf, cand_id);
cand_name = btf__name_by_offset(targ_btf, cand_type->name_off);
err = bpf_core_spec_match(&local_spec, targ_btf,
cand_id, &cand_spec);
pr_debug("prog '%s': relo #%d: matching candidate #%d %s against spec ",
prog_name, relo_idx, i, cand_name);
bpf_core_dump_spec(LIBBPF_DEBUG, &cand_spec);
libbpf_print(LIBBPF_DEBUG, ": %d\n", err);
if (err < 0) {
pr_warning("prog '%s': relo #%d: matching error: %d\n",
prog_name, relo_idx, err);
return err;
}
if (err == 0)
break;
if (j == 0) {
targ_spec = cand_spec;
} else if (cand_spec.offset != targ_spec.offset) {
/* if there are many candidates, they should all
* resolve to the same offset
*/
pr_warning("prog '%s': relo #%d: offset ambiguity: %u != %u\n",
prog_name, relo_idx, cand_spec.offset,
targ_spec.offset);
return -EINVAL;
}
cand_ids->data[j++] = cand_spec.spec[0].type_id;
}
cand_ids->len = j;
if (cand_ids->len == 0) {
pr_warning("prog '%s': relo #%d: no matching targets found for [%d] %s + %s\n",
prog_name, relo_idx, local_id, local_name, spec_str);
return -ESRCH;
}
err = bpf_core_reloc_insn(prog, relo->insn_off,
local_spec.offset, targ_spec.offset);
if (err) {
pr_warning("prog '%s': relo #%d: failed to patch insn at offset %d: %d\n",
prog_name, relo_idx, relo->insn_off, err);
return -EINVAL;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_condition.c_tomoyo_scan_bprm_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__ u8 ;
typedef int u16 ;
struct tomoyo_page_dump {char* data; } ;
struct tomoyo_execve {char* tmp; struct tomoyo_page_dump dump; struct linux_binprm* bprm; } ;
struct tomoyo_envp {scalar_t__ is_not; scalar_t__ value; } ;
struct tomoyo_argv {scalar_t__ is_not; } ;
struct linux_binprm {unsigned long p; int argc; int envc; } ;
typedef int /*<<< orphan*/ local_checked ;
/* Variables and functions */
int /*<<< orphan*/ GFP_NOFS ;
unsigned long PAGE_SIZE ;
int TOMOYO_EXEC_TMPSIZE ;
int /*<<< orphan*/ kfree (scalar_t__*) ;
scalar_t__* kzalloc (int const,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ;
char* strchr (char*,char) ;
int /*<<< orphan*/ tomoyo_argv (int,char*,int const,struct tomoyo_argv const*,scalar_t__*) ;
int /*<<< orphan*/ tomoyo_dump_page (struct linux_binprm*,unsigned long,struct tomoyo_page_dump*) ;
int /*<<< orphan*/ tomoyo_envp (char*,char*,int const,struct tomoyo_envp const*,scalar_t__*) ;
__attribute__((used)) static bool tomoyo_scan_bprm(struct tomoyo_execve *ee,
const u16 argc, const struct tomoyo_argv *argv,
const u16 envc, const struct tomoyo_envp *envp)
{
struct linux_binprm *bprm = ee->bprm;
struct tomoyo_page_dump *dump = &ee->dump;
char *arg_ptr = ee->tmp;
int arg_len = 0;
unsigned long pos = bprm->p;
int offset = pos % PAGE_SIZE;
int argv_count = bprm->argc;
int envp_count = bprm->envc;
bool result = true;
u8 local_checked[32];
u8 *checked;
if (argc + envc <= sizeof(local_checked)) {
checked = local_checked;
memset(local_checked, 0, sizeof(local_checked));
} else {
checked = kzalloc(argc + envc, GFP_NOFS);
if (!checked)
return false;
}
while (argv_count || envp_count) {
if (!tomoyo_dump_page(bprm, pos, dump)) {
result = false;
goto out;
}
pos += PAGE_SIZE - offset;
while (offset <= PAGE_SIZE) {
/* Read. */
const char *kaddr = dump->data;
const unsigned char c = kaddr[offset++];
if (c && arg_len < TOMOYO_EXEC_TMPSIZE - 10) {
if (c == '\\') {
arg_ptr[arg_len++] = '\\';
arg_ptr[arg_len++] = '\\';
} else if (c > ' ' && c < 127) {
arg_ptr[arg_len++] = c;
} else {
arg_ptr[arg_len++] = '\\';
arg_ptr[arg_len++] = (c >> 6) + '0';
arg_ptr[arg_len++] =
((c >> 3) | 7) + '0';
arg_ptr[arg_len++] = (c & 7) + '0';
}
} else {
arg_ptr[arg_len] = '\0';
}
if (c)
continue;
/* Check. */
if (argv_count) {
if (!tomoyo_argv(bprm->argc - argv_count,
arg_ptr, argc, argv,
checked)) {
result = false;
continue;
}
argv_count--;
} else if (envp_count) {
char *cp = strchr(arg_ptr, '=');
if (cp) {
*cp = '\0';
if (!tomoyo_envp(arg_ptr, cp + 1,
envc, envp,
checked + argc)) {
result = false;
break;
}
}
envp_count--;
} else {
break;
}
arg_len = 0;
}
offset = 0;
if (!result)
break;
}
out:
if (result) {
int i;
/* Check not-yet-checked entries. */
for (i = 0; i < argc; i++) {
if (checked[i])
continue;
/*
* Return true only if all unchecked indexes in
* bprm->argv[] are not matched.
*/
if (argv[i].is_not)
continue;
result = false;
break;
}
for (i = 0; i < envc; envp++, i++) {
if (checked[argc + i])
continue;
/*
* Return true only if all unchecked environ variables
* in bprm->envp[] are either undefined or not matched.
*/
if ((!envp->value && !envp->is_not) ||
(envp->value && envp->is_not))
continue;
result = false;
break;
}
}
if (checked != local_checked)
kfree(checked);
return result;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_add_party_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 */
/* Type definitions */
typedef size_t u_int ;
struct uni_add_party {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * dtl; int /*<<< orphan*/ dtl_repeat; int /*<<< orphan*/ called_soft; int /*<<< orphan*/ calling_soft; int /*<<< orphan*/ lij_seqno; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ eetd; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; int /*<<< orphan*/ * tns; int /*<<< orphan*/ scompl; int /*<<< orphan*/ * callingsub; int /*<<< orphan*/ calling; int /*<<< orphan*/ * calledsub; int /*<<< orphan*/ called; int /*<<< orphan*/ blli; int /*<<< orphan*/ bhli; int /*<<< orphan*/ aal; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_CALLEDSUB ;
size_t UNI_NUM_IE_CALLINGSUB ;
size_t UNI_NUM_IE_DTL ;
size_t UNI_NUM_IE_GIT ;
size_t UNI_NUM_IE_TNS ;
void
copy_msg_add_party(struct uni_add_party *src, struct uni_add_party *dst)
{
u_int s, d;
if(IE_ISGOOD(src->aal))
dst->aal = src->aal;
if(IE_ISGOOD(src->bhli))
dst->bhli = src->bhli;
if(IE_ISGOOD(src->blli))
dst->blli = src->blli;
if(IE_ISGOOD(src->called))
dst->called = src->called;
for(s = d = 0; s <= UNI_NUM_IE_CALLEDSUB; s++)
if(IE_ISGOOD(src->calledsub[s]))
dst->calledsub[d++] = src->calledsub[s];
if(IE_ISGOOD(src->calling))
dst->calling = src->calling;
for(s = d = 0; s < UNI_NUM_IE_CALLINGSUB; s++)
if(IE_ISGOOD(src->callingsub[s]))
dst->callingsub[d++] = src->callingsub[s];
if(IE_ISGOOD(src->scompl))
dst->scompl = src->scompl;
for(s = d = 0; s < UNI_NUM_IE_TNS; s++)
if(IE_ISGOOD(src->tns[s]))
dst->tns[d++] = src->tns[s];
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
if(IE_ISGOOD(src->eetd))
dst->eetd = src->eetd;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->lij_seqno))
dst->lij_seqno = src->lij_seqno;
if(IE_ISGOOD(src->calling_soft))
dst->calling_soft = src->calling_soft;
if(IE_ISGOOD(src->called_soft))
dst->called_soft = src->called_soft;
if(IE_ISGOOD(src->dtl_repeat))
dst->dtl_repeat = src->dtl_repeat;
for(s = d = 0; s < UNI_NUM_IE_DTL; s++)
if(IE_ISGOOD(src->dtl[s]))
dst->dtl[d++] = src->dtl[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_common.c_tomoyo_set_mode_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 */
/* Type definitions */
typedef size_t u8 ;
struct tomoyo_profile {size_t default_config; size_t* config; } ;
/* Variables and functions */
int EINVAL ;
size_t TOMOYO_CONFIG_USE_DEFAULT ;
size_t TOMOYO_CONFIG_WANT_GRANT_LOG ;
size_t TOMOYO_CONFIG_WANT_REJECT_LOG ;
size_t TOMOYO_MAX_MAC_CATEGORY_INDEX ;
size_t TOMOYO_MAX_MAC_INDEX ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char const*) ;
scalar_t__ strncmp (char*,char const*,int) ;
scalar_t__ strstr (char const*,char*) ;
char** tomoyo_category_keywords ;
int tomoyo_find_yesno (char const*,char*) ;
size_t* tomoyo_index2category ;
char** tomoyo_mac_keywords ;
char** tomoyo_mode ;
scalar_t__ tomoyo_str_starts (char**,char*) ;
__attribute__((used)) static int tomoyo_set_mode(char *name, const char *value,
struct tomoyo_profile *profile)
{
u8 i;
u8 config;
if (!strcmp(name, "CONFIG")) {
i = TOMOYO_MAX_MAC_INDEX - TOMOYO_MAX_MAC_CATEGORY_INDEX;
config = profile->default_config;
} else if (tomoyo_str_starts(&name, "CONFIG::")) {
config = 0;
for (i = 0; i < TOMOYO_MAX_MAC_INDEX
+ TOMOYO_MAX_MAC_CATEGORY_INDEX; i++) {
int len = 0;
if (i < TOMOYO_MAX_MAC_INDEX) {
const u8 c = tomoyo_index2category[i];
const char *category =
tomoyo_category_keywords[c];
len = strlen(category);
if (strncmp(name, category, len) &&
name[len++] != ':' || name[len++] != ':')
continue;
}
if (strcmp(name + len, tomoyo_mac_keywords[i]))
continue;
config = profile->config[i];
continue;
}
if (i == TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX)
return -EINVAL;
} else {
return -EINVAL;
}
if (strstr(value, "use_default")) {
config = TOMOYO_CONFIG_USE_DEFAULT;
} else {
u8 mode;
for (mode = 0; mode < 4; mode++)
if (strstr(value, tomoyo_mode[mode]))
/*
* Update lower 3 bits in order to distinguish
* 'config' from 'TOMOYO_CONFIG_USE_DEAFULT'.
*/
config = (config & ~7) | mode;
if (config != TOMOYO_CONFIG_USE_DEFAULT) {
switch (tomoyo_find_yesno(value, "grant_log")) {
case 1:
config |= TOMOYO_CONFIG_WANT_GRANT_LOG;
break;
case 0:
config &= ~TOMOYO_CONFIG_WANT_GRANT_LOG;
break;
}
switch (tomoyo_find_yesno(value, "reject_log")) {
case 1:
config |= TOMOYO_CONFIG_WANT_REJECT_LOG;
break;
case 0:
config &= ~TOMOYO_CONFIG_WANT_REJECT_LOG;
break;
}
}
}
if (i < TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX)
profile->config[i] = config;
else if (config != TOMOYO_CONFIG_USE_DEFAULT)
profile->default_config = config;
return 0;
} |
augmented_data/post_increment_index_changes/extr_stream.c_vlc_tls_GetLine_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 /*<<< orphan*/ vlc_tls_t ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
char* realloc (char*,size_t) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
scalar_t__ vlc_tls_Read (int /*<<< orphan*/ *,char*,int,int) ;
char *vlc_tls_GetLine(vlc_tls_t *session)
{
char *line = NULL;
size_t linelen = 0, linesize = 0;
do
{
if (linelen == linesize)
{
linesize += 1024;
char *newline = realloc(line, linesize);
if (unlikely(newline != NULL))
goto error;
line = newline;
}
if (vlc_tls_Read(session, line + linelen, 1, false) <= 0)
goto error;
}
while (line[linelen++] != '\n');
if (linelen >= 2 && line[linelen - 2] == '\r')
line[linelen - 2] = '\0';
return line;
error:
free(line);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_zic.c_inzsub_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ r_loyear; void* r_linenum; void* r_filename; } ;
struct zone {char* z_format; char z_format_specifier; scalar_t__ z_untiltime; TYPE_1__ z_untilrule; void* z_rule; int /*<<< orphan*/ z_stdoff; void* z_linenum; void* z_filename; int /*<<< orphan*/ * z_name; } ;
/* Variables and functions */
int ZFC_FORMAT ;
int ZFC_RULE ;
int ZFC_STDOFF ;
int ZFC_TILDAY ;
int ZFC_TILMONTH ;
int ZFC_TILTIME ;
int ZFC_TILYEAR ;
int ZF_FORMAT ;
size_t ZF_NAME ;
int ZF_RULE ;
int ZF_STDOFF ;
int ZF_TILDAY ;
int ZF_TILMONTH ;
int ZF_TILTIME ;
int ZF_TILYEAR ;
int /*<<< orphan*/ _ (char*) ;
void* ecpyalloc (char*) ;
int /*<<< orphan*/ error (int /*<<< orphan*/ ) ;
void* filename ;
int /*<<< orphan*/ gethms (char*,int /*<<< orphan*/ ) ;
struct zone* growalloc (struct zone*,int,int,int /*<<< orphan*/ *) ;
void* linenum ;
scalar_t__ max_format_len ;
scalar_t__ max_time ;
scalar_t__ min_time ;
int /*<<< orphan*/ namecheck (char*) ;
scalar_t__ noise ;
int nzones ;
int /*<<< orphan*/ nzones_alloc ;
scalar_t__ rpytime (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rulesub (TYPE_1__*,char*,char*,char*,char*,char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ strlen (char*) ;
int /*<<< orphan*/ warning (int /*<<< orphan*/ ,char*) ;
struct zone* zones ;
__attribute__((used)) static bool
inzsub(char **fields, int nfields, bool iscont)
{
char *cp;
char *cp1;
static struct zone z;
int i_stdoff,
i_rule,
i_format;
int i_untilyear,
i_untilmonth;
int i_untilday,
i_untiltime;
bool hasuntil;
if (iscont)
{
i_stdoff = ZFC_STDOFF;
i_rule = ZFC_RULE;
i_format = ZFC_FORMAT;
i_untilyear = ZFC_TILYEAR;
i_untilmonth = ZFC_TILMONTH;
i_untilday = ZFC_TILDAY;
i_untiltime = ZFC_TILTIME;
z.z_name = NULL;
}
else if (!namecheck(fields[ZF_NAME]))
return false;
else
{
i_stdoff = ZF_STDOFF;
i_rule = ZF_RULE;
i_format = ZF_FORMAT;
i_untilyear = ZF_TILYEAR;
i_untilmonth = ZF_TILMONTH;
i_untilday = ZF_TILDAY;
i_untiltime = ZF_TILTIME;
z.z_name = ecpyalloc(fields[ZF_NAME]);
}
z.z_filename = filename;
z.z_linenum = linenum;
z.z_stdoff = gethms(fields[i_stdoff], _("invalid UT offset"));
if ((cp = strchr(fields[i_format], '%')) == NULL)
{
if ((*--cp != 's' && *cp != 'z') || strchr(cp, '%')
|| strchr(fields[i_format], '/'))
{
error(_("invalid abbreviation format"));
return false;
}
}
z.z_rule = ecpyalloc(fields[i_rule]);
z.z_format = cp1 = ecpyalloc(fields[i_format]);
z.z_format_specifier = cp ? *cp : '\0';
if (z.z_format_specifier == 'z')
{
if (noise)
warning(_("format '%s' not handled by pre-2015 versions of zic"),
z.z_format);
cp1[cp - fields[i_format]] = 's';
}
if (max_format_len <= strlen(z.z_format))
max_format_len = strlen(z.z_format);
hasuntil = nfields > i_untilyear;
if (hasuntil)
{
z.z_untilrule.r_filename = filename;
z.z_untilrule.r_linenum = linenum;
rulesub(&z.z_untilrule,
fields[i_untilyear],
"only",
"",
(nfields > i_untilmonth) ?
fields[i_untilmonth] : "Jan",
(nfields > i_untilday) ? fields[i_untilday] : "1",
(nfields > i_untiltime) ? fields[i_untiltime] : "0");
z.z_untiltime = rpytime(&z.z_untilrule,
z.z_untilrule.r_loyear);
if (iscont && nzones > 0 &&
z.z_untiltime > min_time &&
z.z_untiltime < max_time &&
zones[nzones - 1].z_untiltime > min_time &&
zones[nzones - 1].z_untiltime < max_time &&
zones[nzones - 1].z_untiltime >= z.z_untiltime)
{
error(_("Zone continuation line end time is not after end time of previous line"));
return false;
}
}
zones = growalloc(zones, sizeof *zones, nzones, &nzones_alloc);
zones[nzones++] = z;
/*
* If there was an UNTIL field on this line, there's more information
* about the zone on the next line.
*/
return hasuntil;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.