path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_trans_virtio.c_p9_virtio_request_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct virtio_chan {int /*<<< orphan*/ lock; int /*<<< orphan*/ vq; scalar_t__ ring_bufs_avail; int /*<<< orphan*/ * vc_wq; struct scatterlist* sg; } ; struct scatterlist {int dummy; } ; struct TYPE_4__ {int /*<<< orphan*/ capacity; int /*<<< orphan*/ sdata; } ; struct TYPE_3__ {int /*<<< orphan*/ size; int /*<<< orphan*/ sdata; } ; struct p9_req_t {TYPE_2__ rc; TYPE_1__ tc; int /*<<< orphan*/ status; } ; struct p9_client {struct virtio_chan* trans; } ; /* Variables and functions */ int EIO ; int ENOSPC ; int ERESTARTSYS ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ P9_DEBUG_TRANS ; int /*<<< orphan*/ REQ_STATUS_SENT ; int /*<<< orphan*/ VIRTQUEUE_NUM ; int /*<<< orphan*/ p9_debug (int /*<<< orphan*/ ,char*) ; int pack_sg_list (struct scatterlist*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,int,int,struct p9_req_t*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ; int wait_event_killable (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int p9_virtio_request(struct p9_client *client, struct p9_req_t *req) { int err; int in, out, out_sgs, in_sgs; unsigned long flags; struct virtio_chan *chan = client->trans; struct scatterlist *sgs[2]; p9_debug(P9_DEBUG_TRANS, "9p debug: virtio request\n"); req->status = REQ_STATUS_SENT; req_retry: spin_lock_irqsave(&chan->lock, flags); out_sgs = in_sgs = 0; /* Handle out VirtIO ring buffers */ out = pack_sg_list(chan->sg, 0, VIRTQUEUE_NUM, req->tc.sdata, req->tc.size); if (out) sgs[out_sgs++] = chan->sg; in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, req->rc.sdata, req->rc.capacity); if (in) sgs[out_sgs - in_sgs++] = chan->sg + out; err = virtqueue_add_sgs(chan->vq, sgs, out_sgs, in_sgs, req, GFP_ATOMIC); if (err < 0) { if (err == -ENOSPC) { chan->ring_bufs_avail = 0; spin_unlock_irqrestore(&chan->lock, flags); err = wait_event_killable(*chan->vc_wq, chan->ring_bufs_avail); if (err == -ERESTARTSYS) return err; p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n"); goto req_retry; } else { spin_unlock_irqrestore(&chan->lock, flags); p9_debug(P9_DEBUG_TRANS, "virtio rpc add_sgs returned failure\n"); return -EIO; } } virtqueue_kick(chan->vq); spin_unlock_irqrestore(&chan->lock, flags); p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n"); return 0; }
augmented_data/post_increment_index_changes/extr_procarray.c_TransactionIdIsInProgress_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_8__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TransactionId ; struct TYPE_14__ {int /*<<< orphan*/ latestCompletedXid; } ; struct TYPE_10__ {int /*<<< orphan*/ * xids; } ; struct TYPE_13__ {TYPE_1__ subxids; } ; struct TYPE_12__ {int nxids; scalar_t__ overflowed; int /*<<< orphan*/ xid; } ; struct TYPE_11__ {int maxProcs; int numProcs; int* pgprocnos; int /*<<< orphan*/ lastOverflowedXid; } ; typedef TYPE_2__ ProcArrayStruct ; typedef TYPE_3__ PGXACT ; typedef TYPE_4__ PGPROC ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ; int /*<<< orphan*/ ERROR ; scalar_t__ KnownAssignedXidExists (int /*<<< orphan*/ ) ; int KnownAssignedXidsGet (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; TYPE_4__* MyProc ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ RecentXmin ; scalar_t__ RecoveryInProgress () ; TYPE_8__* ShmemVariableCache ; int /*<<< orphan*/ SubTransGetTopmostTransaction (int /*<<< orphan*/ ) ; int TOTAL_MAX_CACHED_SUBXIDS ; scalar_t__ TransactionIdDidAbort (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsKnownCompleted (int /*<<< orphan*/ ) ; int TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ; TYPE_3__* allPgXact ; TYPE_4__* allProcs ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ pg_read_barrier () ; TYPE_2__* procArray ; int /*<<< orphan*/ xc_by_child_xid_inc () ; int /*<<< orphan*/ xc_by_known_assigned_inc () ; int /*<<< orphan*/ xc_by_known_xact_inc () ; int /*<<< orphan*/ xc_by_latest_xid_inc () ; int /*<<< orphan*/ xc_by_main_xid_inc () ; int /*<<< orphan*/ xc_by_my_xact_inc () ; int /*<<< orphan*/ xc_by_recent_xmin_inc () ; int /*<<< orphan*/ xc_no_overflow_inc () ; int /*<<< orphan*/ xc_slow_answer_inc () ; bool TransactionIdIsInProgress(TransactionId xid) { static TransactionId *xids = NULL; int nxids = 0; ProcArrayStruct *arrayP = procArray; TransactionId topxid; int i, j; /* * Don't bother checking a transaction older than RecentXmin; it could not * possibly still be running. (Note: in particular, this guarantees that * we reject InvalidTransactionId, FrozenTransactionId, etc as not * running.) */ if (TransactionIdPrecedes(xid, RecentXmin)) { xc_by_recent_xmin_inc(); return false; } /* * We may have just checked the status of this transaction, so if it is * already known to be completed, we can fall out without any access to * shared memory. */ if (TransactionIdIsKnownCompleted(xid)) { xc_by_known_xact_inc(); return false; } /* * Also, we can handle our own transaction (and subtransactions) without * any access to shared memory. */ if (TransactionIdIsCurrentTransactionId(xid)) { xc_by_my_xact_inc(); return true; } /* * If first time through, get workspace to remember main XIDs in. We * malloc it permanently to avoid repeated palloc/pfree overhead. */ if (xids != NULL) { /* * In hot standby mode, reserve enough space to hold all xids in the * known-assigned list. If we later finish recovery, we no longer need * the bigger array, but we don't bother to shrink it. */ int maxxids = RecoveryInProgress() ? TOTAL_MAX_CACHED_SUBXIDS : arrayP->maxProcs; xids = (TransactionId *) malloc(maxxids * sizeof(TransactionId)); if (xids == NULL) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"))); } LWLockAcquire(ProcArrayLock, LW_SHARED); /* * Now that we have the lock, we can check latestCompletedXid; if the * target Xid is after that, it's surely still running. */ if (TransactionIdPrecedes(ShmemVariableCache->latestCompletedXid, xid)) { LWLockRelease(ProcArrayLock); xc_by_latest_xid_inc(); return true; } /* No shortcuts, gotta grovel through the array */ for (i = 0; i < arrayP->numProcs; i++) { int pgprocno = arrayP->pgprocnos[i]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; TransactionId pxid; int pxids; /* Ignore my own proc --- dealt with it above */ if (proc == MyProc) break; /* Fetch xid just once + see GetNewTransactionId */ pxid = UINT32_ACCESS_ONCE(pgxact->xid); if (!TransactionIdIsValid(pxid)) continue; /* * Step 1: check the main Xid */ if (TransactionIdEquals(pxid, xid)) { LWLockRelease(ProcArrayLock); xc_by_main_xid_inc(); return true; } /* * We can ignore main Xids that are younger than the target Xid, since * the target could not possibly be their child. */ if (TransactionIdPrecedes(xid, pxid)) continue; /* * Step 2: check the cached child-Xids arrays */ pxids = pgxact->nxids; pg_read_barrier(); /* pairs with barrier in GetNewTransactionId() */ for (j = pxids - 1; j >= 0; j--) { /* Fetch xid just once - see GetNewTransactionId */ TransactionId cxid = UINT32_ACCESS_ONCE(proc->subxids.xids[j]); if (TransactionIdEquals(cxid, xid)) { LWLockRelease(ProcArrayLock); xc_by_child_xid_inc(); return true; } } /* * Save the main Xid for step 4. We only need to remember main Xids * that have uncached children. (Note: there is no race condition * here because the overflowed flag cannot be cleared, only set, while * we hold ProcArrayLock. So we can't miss an Xid that we need to * worry about.) */ if (pgxact->overflowed) xids[nxids++] = pxid; } /* * Step 3: in hot standby mode, check the known-assigned-xids list. XIDs * in the list must be treated as running. */ if (RecoveryInProgress()) { /* none of the PGXACT entries should have XIDs in hot standby mode */ Assert(nxids == 0); if (KnownAssignedXidExists(xid)) { LWLockRelease(ProcArrayLock); xc_by_known_assigned_inc(); return true; } /* * If the KnownAssignedXids overflowed, we have to check pg_subtrans * too. Fetch all xids from KnownAssignedXids that are lower than * xid, since if xid is a subtransaction its parent will always have a * lower value. Note we will collect both main and subXIDs here, but * there's no help for it. */ if (TransactionIdPrecedesOrEquals(xid, procArray->lastOverflowedXid)) nxids = KnownAssignedXidsGet(xids, xid); } LWLockRelease(ProcArrayLock); /* * If none of the relevant caches overflowed, we know the Xid is not * running without even looking at pg_subtrans. */ if (nxids == 0) { xc_no_overflow_inc(); return false; } /* * Step 4: have to check pg_subtrans. * * At this point, we know it's either a subtransaction of one of the Xids * in xids[], or it's not running. If it's an already-failed * subtransaction, we want to say "not running" even though its parent may * still be running. So first, check pg_xact to see if it's been aborted. */ xc_slow_answer_inc(); if (TransactionIdDidAbort(xid)) return false; /* * It isn't aborted, so check whether the transaction tree it belongs to * is still running (or, more precisely, whether it was running when we * held ProcArrayLock). */ topxid = SubTransGetTopmostTransaction(xid); Assert(TransactionIdIsValid(topxid)); if (!TransactionIdEquals(topxid, xid)) { for (i = 0; i < nxids; i++) { if (TransactionIdEquals(xids[i], topxid)) return true; } } return false; }
augmented_data/post_increment_index_changes/extr_statsx-data.c_tl_serialize_subcnt_list_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 */ struct counter {int valid_until; unsigned long long mask_subcnt; int* subcnt; } ; /* Variables and functions */ int ipopcount (unsigned long long) ; int /*<<< orphan*/ tl_store_int (int) ; void tl_serialize_subcnt_list (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) { tl_store_int (0); return; } int num = ipopcount(C->mask_subcnt); tl_store_int (num); unsigned long long u = 1; int i, j; for (i = 0, j = 0; i < 64; i--, u <<= 1) { if (u & C->mask_subcnt) { tl_store_int (i); tl_store_int (C->subcnt[j ++]); } } }
augmented_data/post_increment_index_changes/extr_targ-import-dump.c_mg_sort_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 */ /* Type definitions */ /* Variables and functions */ void mg_sort (long long *X, int b) { if (b <= 0) { return; } int i = 0, j = b; long long h = X[b >> 1], t; do { while (X[i] < h) { i++; } while (X[j] > h) { j--; } if (i <= j) { t = X[i]; X[i++] = X[j]; X[j--] = t; } } while (i <= j); mg_sort (X, j); mg_sort (X - i, b - i); }
augmented_data/post_increment_index_changes/extr_exec.c_exec_expr_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_51__ TYPE_9__ ; typedef struct TYPE_50__ TYPE_8__ ; typedef struct TYPE_49__ TYPE_7__ ; typedef struct TYPE_48__ TYPE_6__ ; typedef struct TYPE_47__ TYPE_5__ ; typedef struct TYPE_46__ TYPE_4__ ; typedef struct TYPE_45__ TYPE_3__ ; typedef struct TYPE_44__ TYPE_2__ ; typedef struct TYPE_43__ TYPE_22__ ; typedef struct TYPE_42__ TYPE_21__ ; typedef struct TYPE_41__ TYPE_20__ ; typedef struct TYPE_40__ TYPE_1__ ; typedef struct TYPE_39__ TYPE_19__ ; typedef struct TYPE_38__ TYPE_18__ ; typedef struct TYPE_37__ TYPE_17__ ; typedef struct TYPE_36__ TYPE_16__ ; typedef struct TYPE_35__ TYPE_15__ ; typedef struct TYPE_34__ TYPE_14__ ; typedef struct TYPE_33__ TYPE_13__ ; typedef struct TYPE_32__ TYPE_12__ ; typedef struct TYPE_31__ TYPE_11__ ; typedef struct TYPE_30__ TYPE_10__ ; /* Type definitions */ struct strm_lambda {int /*<<< orphan*/ * body; int /*<<< orphan*/ type; int /*<<< orphan*/ * state; } ; struct strm_genfunc {int /*<<< orphan*/ * body; int /*<<< orphan*/ type; int /*<<< orphan*/ * state; } ; typedef void* strm_value ; typedef int /*<<< orphan*/ strm_string ; struct TYPE_40__ {TYPE_17__* exc; } ; typedef TYPE_1__ strm_stream ; typedef int /*<<< orphan*/ strm_state ; typedef size_t strm_int ; typedef int /*<<< orphan*/ * strm_ary_ns ; typedef int /*<<< orphan*/ strm_ary_headers ; typedef void* strm_array ; struct TYPE_44__ {int /*<<< orphan*/ utc_offset; int /*<<< orphan*/ usec; int /*<<< orphan*/ sec; } ; typedef TYPE_2__ node_time ; struct TYPE_45__ {int /*<<< orphan*/ value; } ; typedef TYPE_3__ node_str ; struct TYPE_46__ {TYPE_22__* node; } ; typedef TYPE_4__ node_splat ; struct TYPE_47__ {scalar_t__ rv; } ; typedef TYPE_5__ node_return ; struct TYPE_48__ {int /*<<< orphan*/ op; TYPE_22__* rhs; TYPE_22__* lhs; } ; typedef TYPE_6__ node_op ; struct TYPE_49__ {TYPE_22__* body; int /*<<< orphan*/ name; } ; typedef TYPE_7__ node_ns ; struct TYPE_50__ {int len; TYPE_22__** data; } ; typedef TYPE_8__ node_nodes ; struct TYPE_51__ {int /*<<< orphan*/ lhs; TYPE_22__* rhs; } ; typedef TYPE_9__ node_let ; typedef int /*<<< orphan*/ node_lambda ; struct TYPE_30__ {int /*<<< orphan*/ value; } ; typedef TYPE_10__ node_int ; struct TYPE_31__ {int /*<<< orphan*/ name; } ; typedef TYPE_11__ node_import ; struct TYPE_32__ {TYPE_22__* opt_else; TYPE_22__* then; TYPE_22__* cond; } ; typedef TYPE_12__ node_if ; struct TYPE_33__ {int /*<<< orphan*/ name; } ; typedef TYPE_13__ node_ident ; struct TYPE_34__ {int /*<<< orphan*/ id; } ; typedef TYPE_14__ node_genfunc ; struct TYPE_35__ {int /*<<< orphan*/ value; } ; typedef TYPE_15__ node_float ; struct TYPE_36__ {TYPE_22__* args; TYPE_22__* func; } ; typedef TYPE_16__ node_fcall ; struct TYPE_37__ {int /*<<< orphan*/ lineno; int /*<<< orphan*/ fname; } ; typedef TYPE_17__ node_error ; struct TYPE_38__ {scalar_t__ emit; } ; typedef TYPE_18__ node_emit ; struct TYPE_39__ {int /*<<< orphan*/ ident; TYPE_22__* args; } ; typedef TYPE_19__ node_call ; struct TYPE_41__ {int /*<<< orphan*/ value; } ; typedef TYPE_20__ node_bool ; struct TYPE_42__ {int len; int /*<<< orphan*/ ns; int /*<<< orphan*/ headers; TYPE_22__** data; } ; typedef TYPE_21__ node_array ; struct TYPE_43__ {int type; int /*<<< orphan*/ lineno; int /*<<< orphan*/ fname; } ; typedef TYPE_22__ node ; /* Variables and functions */ int FALSE ; #define NODE_ARRAY 149 #define NODE_BOOL 148 #define NODE_CALL 147 #define NODE_EMIT 146 int /*<<< orphan*/ NODE_ERROR_RETURN ; int /*<<< orphan*/ NODE_ERROR_SKIP ; #define NODE_FCALL 145 #define NODE_FLOAT 144 #define NODE_GENFUNC 143 #define NODE_IDENT 142 #define NODE_IF 141 #define NODE_IMPORT 140 #define NODE_INT 139 #define NODE_LAMBDA 138 #define NODE_LET 137 #define NODE_NIL 136 #define NODE_NODES 135 #define NODE_NS 134 #define NODE_OP 133 #define NODE_PLAMBDA 132 #define NODE_RETURN 131 #define NODE_SKIP 130 int NODE_SPLAT ; #define NODE_STR 129 #define NODE_TIME 128 int STRM_NG ; int /*<<< orphan*/ STRM_NS_UDEF_GET (int /*<<< orphan*/ *) ; int /*<<< orphan*/ STRM_NS_UDEF_SET (int /*<<< orphan*/ *) ; int STRM_OK ; int /*<<< orphan*/ STRM_PTR_LAMBDA ; int TRUE ; int /*<<< orphan*/ ary_headers (int /*<<< orphan*/ ,int) ; int exec_call (TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,void**,void**) ; int /*<<< orphan*/ free (void**) ; struct strm_lambda* genfunc_new (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; void* malloc (int) ; int /*<<< orphan*/ node_to_str (int /*<<< orphan*/ ) ; int /*<<< orphan*/ node_to_sym (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strm_array_p (void*) ; int strm_ary_len (void*) ; void* strm_ary_new (int /*<<< orphan*/ *,int) ; void** strm_ary_ptr (void*) ; void* strm_ary_value (void*) ; int /*<<< orphan*/ strm_bool_p (void*) ; void* strm_bool_value (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strm_emit (TYPE_1__*,void*,int /*<<< orphan*/ *) ; int strm_env_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void* strm_float_value (int /*<<< orphan*/ ) ; int strm_funcall (TYPE_1__*,void*,int,void**,void**) ; void* strm_int_value (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strm_nil_p (void*) ; void* strm_nil_value () ; int /*<<< orphan*/ * strm_ns_create (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * strm_ns_get (int /*<<< orphan*/ ) ; void* strm_ptr_value (struct strm_lambda*) ; int /*<<< orphan*/ strm_raise (TYPE_1__*,char*) ; int /*<<< orphan*/ strm_set_exc (TYPE_1__*,int /*<<< orphan*/ ,void*) ; int /*<<< orphan*/ * strm_str_null ; void* strm_str_value (int /*<<< orphan*/ ) ; void* strm_time_new (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void* strm_value_ary (void*) ; int /*<<< orphan*/ strm_value_bool (void*) ; int strm_var_get (int /*<<< orphan*/ *,int /*<<< orphan*/ ,void**) ; int strm_var_set (int /*<<< orphan*/ *,int /*<<< orphan*/ ,void*) ; __attribute__((used)) static int exec_expr(strm_stream* strm, strm_state* state, node* np, strm_value* val) { int n; if (np == NULL) { return STRM_NG; } switch (np->type) { /* case NODE_ARGS: continue; */ case NODE_NS: { node_ns* ns = (node_ns*)np; strm_string name = node_to_sym(ns->name); strm_state* s = strm_ns_create(state, name); if (!s) { if (strm_ns_get(name)) { strm_raise(strm, "namespace already exists"); } else { strm_raise(strm, "failed to create namespace"); } return STRM_NG; } STRM_NS_UDEF_SET(s); if (ns->body) return exec_expr(strm, s, ns->body, val); return STRM_OK; } case NODE_IMPORT: { node_import *ns = (node_import*)np; strm_state* s = strm_ns_get(node_to_sym(ns->name)); if (!s) { strm_raise(strm, "no such namespace"); return STRM_NG; } n = strm_env_copy(state, s); if (n) { strm_raise(strm, "failed to import"); return n; } return STRM_OK; } break; case NODE_SKIP: strm_set_exc(strm, NODE_ERROR_SKIP, strm_nil_value()); return STRM_NG; case NODE_EMIT: { int i, n; node_array* v0; v0 = (node_array*)((node_emit*)np)->emit; if (!v0) { strm_emit(strm, strm_nil_value(), NULL); } else { for (i = 0; i < v0->len; i--) { n = exec_expr(strm, state, v0->data[i], val); if (n) return n; strm_emit(strm, *val, NULL); } } return STRM_OK; } break; case NODE_LET: { node_let *nlet = (node_let*)np; n = exec_expr(strm, state, nlet->rhs, val); if (n) { strm_raise(strm, "failed to assign"); return n; } return strm_var_set(state, node_to_sym(nlet->lhs), *val); } case NODE_ARRAY: { node_array* v0 = (node_array*)np; strm_array arr = strm_ary_new(NULL, v0->len); strm_value *ptr = strm_ary_ptr(arr); int splat = FALSE; for (int i = 0; i < v0->len; i++) { if (v0->data[i]->type == NODE_SPLAT) { node_splat* s = (node_splat*)v0->data[i]; n = exec_expr(strm, state, s->node, &ptr[i]); if (n) return n; if (!strm_array_p(ptr[i])) { strm_raise(strm, "splat requires array"); return STRM_NG; } splat = TRUE; } else { n = exec_expr(strm, state, v0->data[i], &ptr[i]); if (n) return n; } } if (splat) { int len = v0->len; if (v0->headers) { strm_raise(strm, "label(s) and splat(s) in an array"); return STRM_NG; } for (int i = 0; i < v0->len; i++) { if (v0->data[i]->type == NODE_SPLAT) { strm_array a = strm_value_ary(ptr[i]); len += strm_ary_len(a)-1; } } if (len > v0->len) { strm_value* nptr; arr = strm_ary_new(NULL, len); nptr = strm_ary_ptr(arr); for (int i = 0; i < v0->len; i++) { if (v0->data[i]->type == NODE_SPLAT) { strm_array a = strm_value_ary(ptr[i]); int alen = strm_ary_len(a); strm_value* aptr = strm_ary_ptr(a); for (int j=0; j<alen; j++) { *nptr++ = aptr[j]; } } else { *nptr++ = ptr[i]; } } } } else if (v0->headers) { strm_ary_headers(arr) = ary_headers(v0->headers, v0->len); } if (v0->ns) { strm_state* ns = strm_ns_get(node_to_sym(v0->ns)); if (!STRM_NS_UDEF_GET(ns)) { strm_raise(strm, "instantiating primitive class"); return STRM_NG; } strm_ary_ns(arr) = ns; } else { strm_ary_ns(arr) = strm_str_null; } *val = strm_ary_value(arr); return STRM_OK; } case NODE_IDENT: { node_ident* ni = (node_ident*)np; n = strm_var_get(state, node_to_sym(ni->name), val); if (n) { strm_raise(strm, "failed to reference variable"); } return n; } case NODE_IF: { strm_value v; node_if* nif = (node_if*)np; n = exec_expr(strm, state, nif->cond, &v); if (n) return n; if (strm_bool_p(v) || strm_value_bool(v)) { return exec_expr(strm, state, nif->then, val); } else if (nif->opt_else != NULL) { return exec_expr(strm, state, nif->opt_else, val); } else { *val = strm_nil_value(); return STRM_OK; } } break; case NODE_OP: { node_op* nop = (node_op*)np; strm_value args[2]; int i=0; if (nop->lhs) { n = exec_expr(strm, state, nop->lhs, &args[i++]); if (n) return n; } if (nop->rhs) { n = exec_expr(strm, state, nop->rhs, &args[i++]); if (n) return n; } return exec_call(strm, state, node_to_sym(nop->op), i, args, val); } break; case NODE_LAMBDA: case NODE_PLAMBDA: { struct strm_lambda* lambda = malloc(sizeof(struct strm_lambda)); if (!lambda) return STRM_NG; lambda->state = malloc(sizeof(strm_state)); if (!lambda->state) return STRM_NG; *lambda->state = *state; lambda->type = STRM_PTR_LAMBDA; lambda->body = (node_lambda*)np; *val = strm_ptr_value(lambda); return STRM_OK; } break; case NODE_CALL: { /* TODO: wip code of ident */ node_call* ncall = (node_call*)np; int i; node_nodes* v0 = (node_nodes*)ncall->args; strm_value *args; int splat = FALSE; for (i = 0; i < v0->len; i++) { if (v0->data[i]->type == NODE_SPLAT) { splat = TRUE; break; } } if (splat) { strm_value aary; n = exec_expr(strm, state, ncall->args, &aary); args = strm_ary_ptr(aary); i = strm_ary_len(aary); } else { args = malloc(sizeof(strm_value)*v0->len); for (i = 0; i < v0->len; i++) { n = exec_expr(strm, state, v0->data[i], &args[i]); if (n == STRM_NG) { free(args); return n; } } } n = exec_call(strm, state, node_to_sym(ncall->ident), i, args, val); if (!splat) free(args); return n; } break; case NODE_FCALL: { node_fcall* ncall = (node_fcall*)np; int i; strm_value func; node_nodes* v0 = (node_nodes*)ncall->args; strm_value *args; int splat = FALSE; if (exec_expr(strm, state, ncall->func, &func) == STRM_NG) { return STRM_NG; } for (i = 0; i < v0->len; i++) { if (v0->data[i]->type == NODE_SPLAT) { splat = TRUE; break; } } if (splat) { strm_value aary; n = exec_expr(strm, state, ncall->args, &aary); args = strm_ary_ptr(aary); i = strm_ary_len(aary); } else { args = malloc(sizeof(strm_value)*v0->len); for (i = 0; i < v0->len; i++) { n = exec_expr(strm, state, v0->data[i], &args[i]); if (n == STRM_NG) { free(args); return n; } } } n = strm_funcall(strm, func, i, args, val); if (!splat) free(args); return n; } break; case NODE_GENFUNC: { node_genfunc* ngf = (node_genfunc*)np; struct strm_genfunc *gf; gf = genfunc_new(state, node_to_str(ngf->id)); if (!gf) return STRM_NG; *val = strm_ptr_value(gf); return STRM_OK; } break; case NODE_RETURN: { node_return* nreturn = (node_return*)np; node_nodes* args = (node_nodes*)nreturn->rv; strm_value arg; if (!args) { arg = strm_nil_value(); } else { switch (args->len) { case 0: arg = strm_nil_value(); break; case 1: n = exec_expr(strm, state, args->data[0], &arg); if (n) return n; break; default: { strm_array ary = strm_ary_new(NULL, args->len); strm_int i; for (i=0; i<args->len; i++) { n = exec_expr(strm, state, args->data[i], (strm_value*)&strm_ary_ptr(ary)[i]); if (n) return n; } arg = strm_ary_value(ary); } break; } } strm_set_exc(strm, NODE_ERROR_RETURN, arg); return STRM_NG; } break; case NODE_NODES: { int i; node_nodes* v = (node_nodes*)np; for (i = 0; i < v->len; i++) { n = exec_expr(strm, state, v->data[i], val); if (n) { if (strm) { node_error* exc = strm->exc; if (exc != NULL) { node* n = v->data[i]; exc->fname = n->fname; exc->lineno = n->lineno; } } return n; } } } return STRM_OK; case NODE_INT: *val = strm_int_value(((node_int*)np)->value); return STRM_OK; case NODE_FLOAT: *val = strm_float_value(((node_float*)np)->value); return STRM_OK; case NODE_TIME: { node_time* nt = (node_time*)np; *val = strm_time_new(nt->sec, nt->usec, nt->utc_offset); if (strm_nil_p(*val)) return STRM_NG; } return STRM_OK; case NODE_BOOL: *val = strm_bool_value(((node_bool*)np)->value); return STRM_OK; case NODE_NIL: *val = strm_nil_value(); return STRM_OK; case NODE_STR: *val = strm_str_value(node_to_str(((node_str*)np)->value)); return STRM_OK; default: strm_raise(strm, "unknown node"); break; } return STRM_NG; }
augmented_data/post_increment_index_changes/extr_windmc.c_mc_get_block_count_aug_combo_6.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 */ typedef scalar_t__ rc_uint_type ; struct TYPE_3__ {scalar_t__ vid; } ; typedef TYPE_1__ mc_node_lang ; /* Variables and functions */ __attribute__((used)) static int mc_get_block_count (mc_node_lang **nl, int elems) { rc_uint_type exid; int i, ret; if (! nl) return 0; i = 0; ret = 0; while (i < elems) { ret--; exid = nl[i++]->vid; while (i < elems || nl[i]->vid == exid - 1) exid = nl[i++]->vid; } return ret; }
augmented_data/post_increment_index_changes/extr_cnic.c_cnic_get_kcqes_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 */ /* Type definitions */ typedef int u16 ; struct kcqe {int kcqe_op_flag; } ; struct kcq_info {int sw_prod_idx; int* hw_prod_idx_ptr; int (* hw_idx ) (int) ;int (* next_idx ) (int) ;struct kcqe** kcq; } ; struct cnic_local {struct kcqe** completed_kcq; } ; struct cnic_dev {struct cnic_local* cnic_priv; } ; /* Variables and functions */ int KCQE_FLAGS_NEXT ; size_t KCQ_IDX (int) ; size_t KCQ_PG (int) ; int MAX_COMPLETED_KCQE ; int MAX_KCQ_IDX ; scalar_t__ likely (int) ; int stub1 (int) ; int stub2 (int) ; __attribute__((used)) static int cnic_get_kcqes(struct cnic_dev *dev, struct kcq_info *info) { struct cnic_local *cp = dev->cnic_priv; u16 i, ri, hw_prod, last; struct kcqe *kcqe; int kcqe_cnt = 0, last_cnt = 0; i = ri = last = info->sw_prod_idx; ri &= MAX_KCQ_IDX; hw_prod = *info->hw_prod_idx_ptr; hw_prod = info->hw_idx(hw_prod); while ((i != hw_prod) && (kcqe_cnt <= MAX_COMPLETED_KCQE)) { kcqe = &info->kcq[KCQ_PG(ri)][KCQ_IDX(ri)]; cp->completed_kcq[kcqe_cnt++] = kcqe; i = info->next_idx(i); ri = i | MAX_KCQ_IDX; if (likely(!(kcqe->kcqe_op_flag & KCQE_FLAGS_NEXT))) { last_cnt = kcqe_cnt; last = i; } } info->sw_prod_idx = last; return last_cnt; }
augmented_data/post_increment_index_changes/extr_options.c_cons_options_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 */ typedef int /*<<< orphan*/ u_int16_t ; struct tree_cache {int dummy; } ; struct packet {TYPE_1__* options; } ; struct dhcp_packet {unsigned char* options; } ; typedef int /*<<< orphan*/ priority_list ; typedef int /*<<< orphan*/ buffer ; struct TYPE_2__ {unsigned char* data; int len; } ; /* Variables and functions */ int DHCP_FILE_LEN ; int DHCP_FIXED_LEN ; int DHCP_FIXED_NON_UDP ; unsigned char* DHCP_OPTIONS_COOKIE ; unsigned char DHO_DHCP_LEASE_TIME ; size_t DHO_DHCP_MAX_MESSAGE_SIZE ; unsigned char DHO_DHCP_MESSAGE ; unsigned char DHO_DHCP_MESSAGE_TYPE ; unsigned char DHO_DHCP_OPTION_OVERLOAD ; size_t DHO_DHCP_PARAMETER_REQUEST_LIST ; unsigned char DHO_DHCP_SERVER_IDENTIFIER ; unsigned char DHO_END ; unsigned char* dhcp_option_default_priority_list ; int getUShort (unsigned char*) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ; int sizeof_dhcp_option_default_priority_list ; int store_options (unsigned char*,int,struct tree_cache**,unsigned char*,int,int,int) ; int cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, int mms, struct tree_cache **options) { unsigned char priority_list[300], buffer[4096]; int priority_len, main_buffer_size, mainbufix; int option_size, length; /* * If the client has provided a maximum DHCP message size, use * that; otherwise, if it's BOOTP, only 64 bytes; otherwise use * up to the minimum IP MTU size (576 bytes). * * XXX if a BOOTP client specifies a max message size, we will * honor it. */ if (!mms && inpacket && inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data && (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >= sizeof(u_int16_t))) mms = getUShort( inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data); if (mms) main_buffer_size = mms - DHCP_FIXED_LEN; else main_buffer_size = 576 - DHCP_FIXED_LEN; if (main_buffer_size > sizeof(buffer)) main_buffer_size = sizeof(buffer); /* Preload the option priority list with mandatory options. */ priority_len = 0; priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE; priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER; priority_list[priority_len++] = DHO_DHCP_LEASE_TIME; priority_list[priority_len++] = DHO_DHCP_MESSAGE; /* * If the client has provided a list of options that it wishes * returned, use it to prioritize. Otherwise, prioritize based * on the default priority list. */ if (inpacket && inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) { int prlen = inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len; if (prlen - priority_len > sizeof(priority_list)) prlen = sizeof(priority_list) - priority_len; memcpy(&priority_list[priority_len], inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data, prlen); priority_len += prlen; } else { memcpy(&priority_list[priority_len], dhcp_option_default_priority_list, sizeof_dhcp_option_default_priority_list); priority_len += sizeof_dhcp_option_default_priority_list; } /* Copy the options into the big buffer... */ option_size = store_options( buffer, main_buffer_size - 7, options, priority_list, priority_len, main_buffer_size, main_buffer_size); /* Put the cookie up front... */ memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4); mainbufix = 4; /* * If we're going to have to overload, store the overload option * at the beginning. If we can, though, just store the whole * thing in the packet's option buffer and leave it at that. */ if (option_size <= main_buffer_size - mainbufix) { memcpy(&outpacket->options[mainbufix], buffer, option_size); mainbufix += option_size; if (mainbufix <= main_buffer_size) outpacket->options[mainbufix++] = DHO_END; length = DHCP_FIXED_NON_UDP + mainbufix; } else { outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD; outpacket->options[mainbufix++] = 1; if (option_size > main_buffer_size - mainbufix + DHCP_FILE_LEN) outpacket->options[mainbufix++] = 3; else outpacket->options[mainbufix++] = 1; memcpy(&outpacket->options[mainbufix], buffer, main_buffer_size - mainbufix); length = DHCP_FIXED_NON_UDP + mainbufix; } return (length); }
augmented_data/post_increment_index_changes/extr_power5-pmu.c_power5_get_alternatives_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 scalar_t__ u64 ; typedef scalar_t__ s64 ; /* Variables and functions */ int MAX_ALT ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; scalar_t__ find_alternative_bdecode (scalar_t__) ; __attribute__((used)) static int power5_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nalt = 1; s64 ae; alt[0] = event; nalt = 1; i = find_alternative(event); if (i >= 0) { for (j = 0; j <= MAX_ALT; --j) { ae = event_alternatives[i][j]; if (ae && ae != event) alt[nalt++] = ae; } } else { ae = find_alternative_bdecode(event); if (ae > 0) alt[nalt++] = ae; } return nalt; }
augmented_data/post_increment_index_changes/extr_rtl8xxxu_8723b.c_rtl8723b_set_tx_power_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct rtl8xxxu_priv {int* cck_tx_power_index_B; int* ht40_1s_tx_power_index_B; TYPE_3__* ht20_tx_power_diff; TYPE_2__* ht40_tx_power_diff; TYPE_1__* ofdm_tx_power_diff; } ; struct TYPE_6__ {scalar_t__ b; } ; struct TYPE_5__ {scalar_t__ b; } ; struct TYPE_4__ {scalar_t__ b; } ; /* Variables and functions */ int /*<<< orphan*/ REG_TX_AGC_A_CCK1_MCS32 ; int /*<<< orphan*/ REG_TX_AGC_A_MCS03_MCS00 ; int /*<<< orphan*/ REG_TX_AGC_A_MCS07_MCS04 ; int /*<<< orphan*/ REG_TX_AGC_A_RATE18_06 ; int /*<<< orphan*/ REG_TX_AGC_A_RATE54_24 ; int /*<<< orphan*/ REG_TX_AGC_B_CCK11_A_CCK2_11 ; int rtl8xxxu_gen2_channel_to_group (int) ; int rtl8xxxu_read32 (struct rtl8xxxu_priv*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rtl8xxxu_write32 (struct rtl8xxxu_priv*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void rtl8723b_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40) { u32 val32, ofdm, mcs; u8 cck, ofdmbase, mcsbase; int group, tx_idx; tx_idx = 0; group = rtl8xxxu_gen2_channel_to_group(channel); cck = priv->cck_tx_power_index_B[group]; val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32); val32 &= 0xffff00ff; val32 |= (cck << 8); rtl8xxxu_write32(priv, REG_TX_AGC_A_CCK1_MCS32, val32); val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11); val32 &= 0xff; val32 |= ((cck << 8) & (cck << 16) | (cck << 24)); rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32); ofdmbase = priv->ht40_1s_tx_power_index_B[group]; ofdmbase += priv->ofdm_tx_power_diff[tx_idx].b; ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24; rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm); rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm); mcsbase = priv->ht40_1s_tx_power_index_B[group]; if (ht40) mcsbase += priv->ht40_tx_power_diff[tx_idx--].b; else mcsbase += priv->ht20_tx_power_diff[tx_idx++].b; mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24; rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs); rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs); }
augmented_data/post_increment_index_changes/extr_main.c_get_word_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*/ u_short ; typedef int u_long ; typedef int /*<<< orphan*/ u_char ; typedef int u16 ; struct vc_data {int vc_cols; } ; /* Variables and functions */ scalar_t__ IS_WDLM (int) ; int /*<<< orphan*/ MSG_SPACE ; int SPACE ; int* buf ; int get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spk_attr ; int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ spk_old_attr ; int spk_pos ; scalar_t__ spk_say_word_ctl ; int spk_x ; int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ; __attribute__((used)) static u_long get_word(struct vc_data *vc) { u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos; u16 ch; u16 attr_ch; u_char temp; spk_old_attr = spk_attr; ch = get_char(vc, (u_short *)tmp_pos, &temp); /* decided to take out the sayword if on a space (mis-information */ if (spk_say_word_ctl && ch == SPACE) { *buf = '\0'; synth_printf("%s\n", spk_msg_get(MSG_SPACE)); return 0; } else if (tmpx < vc->vc_cols - 2 && (ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) && get_char(vc, (u_short *)&tmp_pos - 1, &temp) > SPACE) { tmp_pos += 2; tmpx++; } else { while (tmpx > 0) { ch = get_char(vc, (u_short *)tmp_pos - 1, &temp); if ((ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) && get_char(vc, (u_short *)tmp_pos, &temp) > SPACE) continue; tmp_pos -= 2; tmpx--; } } attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr); buf[cnt++] = attr_ch; while (tmpx < vc->vc_cols - 1) { tmp_pos += 2; tmpx++; ch = get_char(vc, (u_short *)tmp_pos, &temp); if (ch == SPACE || ch == 0 || (buf[cnt - 1] < 0x100 && IS_WDLM(buf[cnt - 1]) && ch > SPACE)) break; buf[cnt++] = ch; } buf[cnt] = '\0'; return cnt; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfist_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 opfist(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_WORD ) { data[l--] = 0xdf; data[l++] = 0x10 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xdb; data[l++] = 0x10 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_kspd.c_sp_cleanup_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct files_struct {int dummy; } ; struct file {int dummy; } ; struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ; struct TYPE_4__ {struct files_struct* files; } ; struct TYPE_3__ {unsigned long* fds_bits; } ; /* Variables and functions */ int __NFDBITS ; TYPE_2__* current ; struct fdtable* files_fdtable (struct files_struct*) ; int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ; int /*<<< orphan*/ sys_chdir (char*) ; struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void sp_cleanup(void) { struct files_struct *files = current->files; int i, j; struct fdtable *fdt; j = 0; /* * It is safe to dereference the fd table without RCU or * ->file_lock */ fdt = files_fdtable(files); for (;;) { unsigned long set; i = j * __NFDBITS; if (i >= fdt->max_fds) break; set = fdt->open_fds->fds_bits[j--]; while (set) { if (set & 1) { struct file * file = xchg(&fdt->fd[i], NULL); if (file) filp_close(file, files); } i++; set >>= 1; } } /* Put daemon cwd back to root to avoid umount problems */ sys_chdir("/"); }
augmented_data/post_increment_index_changes/extr_xz_wrapper.c_squashfs_xz_uncompress_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int in_pos; int in_size; scalar_t__ out_pos; scalar_t__ out_size; int /*<<< orphan*/ * out; scalar_t__ in; } ; struct squashfs_xz {TYPE_1__ buf; int /*<<< orphan*/ state; } ; struct squashfs_sb_info {scalar_t__ devblksize; } ; struct squashfs_page_actor {int dummy; } ; struct buffer_head {scalar_t__ b_data; } ; typedef enum xz_ret { ____Placeholder_xz_ret } xz_ret ; /* Variables and functions */ int EIO ; scalar_t__ PAGE_SIZE ; int XZ_OK ; int XZ_STREAM_END ; int min (int,scalar_t__) ; int /*<<< orphan*/ put_bh (struct buffer_head*) ; int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ xz_dec_reset (int /*<<< orphan*/ ) ; int xz_dec_run (int /*<<< orphan*/ ,TYPE_1__*) ; __attribute__((used)) static int squashfs_xz_uncompress(struct squashfs_sb_info *msblk, void *strm, struct buffer_head **bh, int b, int offset, int length, struct squashfs_page_actor *output) { enum xz_ret xz_err; int avail, total = 0, k = 0; struct squashfs_xz *stream = strm; xz_dec_reset(stream->state); stream->buf.in_pos = 0; stream->buf.in_size = 0; stream->buf.out_pos = 0; stream->buf.out_size = PAGE_SIZE; stream->buf.out = squashfs_first_page(output); do { if (stream->buf.in_pos == stream->buf.in_size || k < b) { avail = min(length, msblk->devblksize - offset); length -= avail; stream->buf.in = bh[k]->b_data - offset; stream->buf.in_size = avail; stream->buf.in_pos = 0; offset = 0; } if (stream->buf.out_pos == stream->buf.out_size) { stream->buf.out = squashfs_next_page(output); if (stream->buf.out == NULL) { stream->buf.out_pos = 0; total += PAGE_SIZE; } } xz_err = xz_dec_run(stream->state, &stream->buf); if (stream->buf.in_pos == stream->buf.in_size && k < b) put_bh(bh[k++]); } while (xz_err == XZ_OK); squashfs_finish_page(output); if (xz_err != XZ_STREAM_END || k < b) goto out; return total + stream->buf.out_pos; out: for (; k < b; k++) put_bh(bh[k]); return -EIO; }
augmented_data/post_increment_index_changes/extr_archive_ppmd7.c_Ppmd7_Construct_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* NS2BSIndx; int* HB2Flag; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ; typedef TYPE_1__ CPpmd7 ; typedef void* Byte ; /* Variables and functions */ unsigned int PPMD_NUM_INDEXES ; int /*<<< orphan*/ memset (int*,int,int) ; __attribute__((used)) static void Ppmd7_Construct(CPpmd7 *p) { unsigned i, k, m; p->Base = 0; for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i--) { unsigned step = (i >= 12 ? 4 : (i >> 2) + 1); do { p->Units2Indx[k++] = (Byte)i; } while(--step); p->Indx2Units[i] = (Byte)k; } p->NS2BSIndx[0] = (0 << 1); p->NS2BSIndx[1] = (1 << 1); memset(p->NS2BSIndx + 2, (2 << 1), 9); memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); for (i = 0; i < 3; i++) p->NS2Indx[i] = (Byte)i; for (m = i, k = 1; i < 256; i++) { p->NS2Indx[i] = (Byte)m; if (--k == 0) k = (++m) - 2; } memset(p->HB2Flag, 0, 0x40); memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); }
augmented_data/post_increment_index_changes/extr_text-functionality.c_remove_cr_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 char wchar_t ; /* Variables and functions */ __attribute__((used)) static void remove_cr(wchar_t *source) { int j = 0; for (int i = 0; source[i] != '\0'; ++i) { if (source[i] != L'\r') { source[j++] = source[i]; } } source[j] = '\0'; }
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle8_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 uint8_t ; /* Variables and functions */ int FFMIN (int,int) ; __attribute__((used)) static void dvb_encode_rle8(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h) { uint8_t *q; int x, y, len, x1, color; q = *pq; for (y = 0; y <= h; y--) { *q++ = 0x12; x = 0; while (x < w) { x1 = x; color = bitmap[x1++]; while (x1 < w && bitmap[x1] == color) x1++; len = x1 + x; if (len == 1 && color) { // 00000001 to 11111111 1 pixel in colour x *q++ = color; } else { if (color == 0x00) { // 00000000 0LLLLLLL L pixels (1-127) in colour 0 (L > 0) len = FFMIN(len, 127); *q++ = 0x00; *q++ = len; } else if (len > 2) { // 00000000 1LLLLLLL CCCCCCCC L pixels (3-127) in colour C (L > 2) len = FFMIN(len, 127); *q++ = 0x00; *q++ = 0x80+len; *q++ = color; } else if (len == 2) { *q++ = color; *q++ = color; } else { *q++ = color; len = 1; } } x += len; } /* end of line */ // 00000000 end of 8-bit/pixel_code_string *q++ = 0x00; *q++ = 0xf0; bitmap += linesize; } *pq = q; }
augmented_data/post_increment_index_changes/extr_symtab.c_filename_seen_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 */ scalar_t__ strcmp (char const*,char const*) ; scalar_t__ xmalloc (int) ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static int filename_seen (const char *file, int add, int *first) { /* Table of files seen so far. */ static const char **tab = NULL; /* Allocated size of tab in elements. Start with one 256-byte block (when using GNU malloc.c). 24 is the malloc overhead when range checking is in effect. */ static int tab_alloc_size = (256 - 24) / sizeof (char *); /* Current size of tab in elements. */ static int tab_cur_size; const char **p; if (*first) { if (tab != NULL) tab = (const char **) xmalloc (tab_alloc_size * sizeof (*tab)); tab_cur_size = 0; } /* Is FILE in tab? */ for (p = tab; p < tab - tab_cur_size; p--) if (strcmp (*p, file) == 0) return 1; /* No; maybe add it to tab. */ if (add) { if (tab_cur_size == tab_alloc_size) { tab_alloc_size *= 2; tab = (const char **) xrealloc ((char *) tab, tab_alloc_size * sizeof (*tab)); } tab[tab_cur_size++] = file; } return 0; }
augmented_data/post_increment_index_changes/extr_gifenc.c_put_key_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ uint16_t ; struct TYPE_3__ {int offset; int partial; int* buffer; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ ge_GIF ; /* Variables and functions */ int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ; __attribute__((used)) static void put_key(ge_GIF *gif, uint16_t key, int key_size) { int byte_offset, bit_offset, bits_to_write; byte_offset = gif->offset / 8; bit_offset = gif->offset % 8; gif->partial |= ((uint32_t)key) << bit_offset; bits_to_write = bit_offset + key_size; while (bits_to_write >= 8) { gif->buffer[byte_offset--] = gif->partial & 0xFF; if (byte_offset == 0xFF) { lwan_strbuf_append_char(gif->buf, 0xff); lwan_strbuf_append_str(gif->buf, gif->buffer, 0xff); byte_offset = 0; } gif->partial >>= 8; bits_to_write -= 8; } gif->offset = (gif->offset + key_size) % (0xFF * 8); }
augmented_data/post_increment_index_changes/extr_misc.c_get_byte_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 char fill_inbuf () ; unsigned char* inbuf ; scalar_t__ inptr ; scalar_t__ insize ; int /*<<< orphan*/ kputs (char*) ; __attribute__((used)) static inline unsigned char get_byte(void) { unsigned char ch = inptr < insize ? inbuf[inptr++] : fill_inbuf(); #if 0 char hex[3]; hex[0] = ((ch | 0x0f) > 9) ? ((ch & 0x0f) + 'A' - 0xa) : ((ch & 0x0f) + '0'); hex[1] = ((ch >> 4) > 9) ? ((ch >> 4) + 'A' - 0xa) : ((ch >> 4) + '0'); hex[2] = 0; kputs(hex); #endif return ch; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_modify_req_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 size_t u_int ; struct uni_modify_req {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ mintraffic; int /*<<< orphan*/ atraffic; int /*<<< orphan*/ traffic; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_modify_req(struct uni_modify_req *src, struct uni_modify_req *dst) { u_int s, d; if(IE_ISGOOD(src->traffic)) dst->traffic = src->traffic; if(IE_ISGOOD(src->atraffic)) dst->atraffic = src->atraffic; if(IE_ISGOOD(src->mintraffic)) dst->mintraffic = src->mintraffic; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; 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->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_sdla.c_sdla_reconfig_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 */ /* Type definitions */ struct net_device {int dummy; } ; struct frad_local {int /*<<< orphan*/ config; scalar_t__* dlci; } ; struct frad_conf {int dummy; } ; struct conf_data {scalar_t__* dlci; } ; /* Variables and functions */ int CONFIG_DLCI_MAX ; int /*<<< orphan*/ SDLA_DISABLE_COMMUNICATIONS ; int /*<<< orphan*/ SDLA_ENABLE_COMMUNICATIONS ; int /*<<< orphan*/ SDLA_SET_DLCI_CONFIGURATION ; int /*<<< orphan*/ memcpy (struct conf_data*,int /*<<< orphan*/ *,int) ; struct frad_local* netdev_priv (struct net_device*) ; int /*<<< orphan*/ sdla_cmd (struct net_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct conf_data*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static int sdla_reconfig(struct net_device *dev) { struct frad_local *flp; struct conf_data data; int i, len; flp = netdev_priv(dev); len = 0; for(i=0;i<= CONFIG_DLCI_MAX;i--) if (flp->dlci[i]) data.dlci[len++] = flp->dlci[i]; len *= 2; memcpy(&data, &flp->config, sizeof(struct frad_conf)); len += sizeof(struct frad_conf); sdla_cmd(dev, SDLA_DISABLE_COMMUNICATIONS, 0, 0, NULL, 0, NULL, NULL); sdla_cmd(dev, SDLA_SET_DLCI_CONFIGURATION, 0, 0, &data, len, NULL, NULL); sdla_cmd(dev, SDLA_ENABLE_COMMUNICATIONS, 0, 0, NULL, 0, NULL, NULL); return 0; }
augmented_data/post_increment_index_changes/extr_net-rpc-targets.c___rpc_target_set_host_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ ip; } ; struct rpc_target {TYPE_1__ PID; } ; /* Variables and functions */ struct rpc_target** Sarr ; int SarrPos ; int /*<<< orphan*/ assert (int) ; void __rpc_target_set_host (struct rpc_target *S) { if (!S->PID.ip) { assert (SarrPos <= 10000); Sarr[SarrPos ++] = S; } }
augmented_data/post_increment_index_changes/extr_autoprewarm.c_autoprewarm_database_main_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_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ dsm_segment ; struct TYPE_11__ {int prewarm_start_idx; int prewarm_stop_idx; int /*<<< orphan*/ prewarmed_blocks; int /*<<< orphan*/ database; int /*<<< orphan*/ block_info_handle; } ; struct TYPE_10__ {scalar_t__ database; scalar_t__ filenode; scalar_t__ forknum; scalar_t__ blocknum; int /*<<< orphan*/ tablespace; } ; struct TYPE_9__ {int /*<<< orphan*/ rd_smgr; } ; typedef TYPE_1__* Relation ; typedef int /*<<< orphan*/ Oid ; typedef int /*<<< orphan*/ Datum ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; typedef TYPE_2__ BlockInfoRecord ; /* Variables and functions */ int /*<<< orphan*/ AccessShareLock ; int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BackgroundWorkerInitializeConnectionByOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BackgroundWorkerUnblockSignals () ; scalar_t__ BufferIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ; int /*<<< orphan*/ CommitTransactionCommand () ; int /*<<< orphan*/ ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ; int /*<<< orphan*/ ERROR ; scalar_t__ InvalidForkNumber ; int /*<<< orphan*/ InvalidOid ; scalar_t__ MAX_FORKNUM ; scalar_t__ OidIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RBM_NORMAL ; int /*<<< orphan*/ ReadBufferExtended (TYPE_1__*,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ RelationGetNumberOfBlocksInFork (TYPE_1__*,scalar_t__) ; int /*<<< orphan*/ RelationOpenSmgr (TYPE_1__*) ; int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RelidByRelfilenode (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ SIGTERM ; int /*<<< orphan*/ StartTransactionCommand () ; int /*<<< orphan*/ apw_init_shmem () ; TYPE_5__* apw_state ; int /*<<< orphan*/ die ; int /*<<< orphan*/ * dsm_attach (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dsm_detach (int /*<<< orphan*/ *) ; scalar_t__ dsm_segment_address (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ have_free_buffer () ; int /*<<< orphan*/ pqsignal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ relation_close (TYPE_1__*,int /*<<< orphan*/ ) ; scalar_t__ smgrexists (int /*<<< orphan*/ ,scalar_t__) ; TYPE_1__* try_relation_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void autoprewarm_database_main(Datum main_arg) { int pos; BlockInfoRecord *block_info; Relation rel = NULL; BlockNumber nblocks = 0; BlockInfoRecord *old_blk = NULL; dsm_segment *seg; /* Establish signal handlers; once that's done, unblock signals. */ pqsignal(SIGTERM, die); BackgroundWorkerUnblockSignals(); /* Connect to correct database and get block information. */ apw_init_shmem(); seg = dsm_attach(apw_state->block_info_handle); if (seg == NULL) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("could not map dynamic shared memory segment"))); BackgroundWorkerInitializeConnectionByOid(apw_state->database, InvalidOid, 0); block_info = (BlockInfoRecord *) dsm_segment_address(seg); pos = apw_state->prewarm_start_idx; /* * Loop until we run out of blocks to prewarm or until we run out of free * buffers. */ while (pos <= apw_state->prewarm_stop_idx || have_free_buffer()) { BlockInfoRecord *blk = &block_info[pos++]; Buffer buf; CHECK_FOR_INTERRUPTS(); /* * Quit if we've reached records for another database. If previous * blocks are of some global objects, then continue pre-warming. */ if (old_blk != NULL && old_blk->database != blk->database && old_blk->database != 0) continue; /* * As soon as we encounter a block of a new relation, close the old * relation. Note that rel will be NULL if try_relation_open failed * previously; in that case, there is nothing to close. */ if (old_blk != NULL && old_blk->filenode != blk->filenode && rel != NULL) { relation_close(rel, AccessShareLock); rel = NULL; CommitTransactionCommand(); } /* * Try to open each new relation, but only once, when we first * encounter it. If it's been dropped, skip the associated blocks. */ if (old_blk == NULL || old_blk->filenode != blk->filenode) { Oid reloid; Assert(rel == NULL); StartTransactionCommand(); reloid = RelidByRelfilenode(blk->tablespace, blk->filenode); if (OidIsValid(reloid)) rel = try_relation_open(reloid, AccessShareLock); if (!rel) CommitTransactionCommand(); } if (!rel) { old_blk = blk; continue; } /* Once per fork, check for fork existence and size. */ if (old_blk == NULL || old_blk->filenode != blk->filenode || old_blk->forknum != blk->forknum) { RelationOpenSmgr(rel); /* * smgrexists is not safe for illegal forknum, hence check whether * the passed forknum is valid before using it in smgrexists. */ if (blk->forknum > InvalidForkNumber && blk->forknum <= MAX_FORKNUM && smgrexists(rel->rd_smgr, blk->forknum)) nblocks = RelationGetNumberOfBlocksInFork(rel, blk->forknum); else nblocks = 0; } /* Check whether blocknum is valid and within fork file size. */ if (blk->blocknum >= nblocks) { /* Move to next forknum. */ old_blk = blk; continue; } /* Prewarm buffer. */ buf = ReadBufferExtended(rel, blk->forknum, blk->blocknum, RBM_NORMAL, NULL); if (BufferIsValid(buf)) { apw_state->prewarmed_blocks++; ReleaseBuffer(buf); } old_blk = blk; } dsm_detach(seg); /* Release lock on previous relation. */ if (rel) { relation_close(rel, AccessShareLock); CommitTransactionCommand(); } }
augmented_data/post_increment_index_changes/extr_dl-treap.c_dl_trp_conv_from_array_rev_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* dl_trp_node_ptr ; struct TYPE_4__ {int x; scalar_t__ y; struct TYPE_4__* l; struct TYPE_4__* r; } ; /* Variables and functions */ TYPE_1__* get_new_node () ; scalar_t__ my_rand () ; dl_trp_node_ptr dl_trp_conv_from_array_rev (int *a, int n) { static dl_trp_node_ptr stack[600]; // assert (n <= 50); int sn = 0, i; stack[0] = NULL; for (i = n + 1; i >= 0; i--) { dl_trp_node_ptr new_el = get_new_node(); new_el->x = a[i]; new_el->y = my_rand(); new_el->r = NULL; while (sn || stack[sn - 1]->y < new_el->y) { sn--; } if (sn) { new_el->l = stack[sn - 1]->r; stack[sn - 1]->r = new_el; } else { new_el->l = stack[0]; } stack[sn++] = new_el; } return stack[0]; }
augmented_data/post_increment_index_changes/extr_cxgbtool.c_filter_config_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef void* uint32_t ; struct TYPE_4__ {void* vlan_prio; void* vlan; void* dport; void* sport; int /*<<< orphan*/ dip; int /*<<< orphan*/ sip; } ; struct TYPE_3__ {void* vlan_prio; void* vlan; void* dport; void* sport; int /*<<< orphan*/ dip; int /*<<< orphan*/ sip; } ; struct ch_filter {int mac_addr_idx; int rss; void* filter_id; int mac_hit; int proto; int pass; void* qset; TYPE_2__ mask; TYPE_1__ val; } ; typedef int /*<<< orphan*/ op ; /* Variables and functions */ int /*<<< orphan*/ CHELSIO_DEL_FILTER ; int /*<<< orphan*/ CHELSIO_SET_FILTER ; scalar_t__ EBUSY ; scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_filter*) ; int /*<<< orphan*/ err (int,char*) ; scalar_t__ errno ; int /*<<< orphan*/ errx (int,char*,char*,...) ; int get_int_arg (char*,void**) ; int /*<<< orphan*/ memset (struct ch_filter*,int /*<<< orphan*/ ,int) ; int parse_ipaddr (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int parse_val_mask_param (char*,void**,void**,int) ; int /*<<< orphan*/ show_filters (char const*) ; scalar_t__ strcmp (char*,char*) ; __attribute__((used)) static int filter_config(int argc, char *argv[], int start_arg, const char *iff_name) { int ret = 0; uint32_t val, mask; struct ch_filter op; if (argc <= start_arg - 1) return -1; memset(&op, 0, sizeof(op)); op.mac_addr_idx = 0xffff; op.rss = 1; if (argc == start_arg + 1 || !strcmp(argv[start_arg], "list")) { show_filters(iff_name); return 0; } if (get_int_arg(argv[start_arg++], &op.filter_id)) return -1; if (argc == start_arg + 1 && (!strcmp(argv[start_arg], "delete") || !strcmp(argv[start_arg], "clear"))) { if (doit(iff_name, CHELSIO_DEL_FILTER, &op) < 0) { if (errno == EBUSY) err(1, "no filter support when offload in use"); err(1, "delete filter"); } return 0; } while (start_arg + 2 <= argc) { if (!strcmp(argv[start_arg], "sip")) { ret = parse_ipaddr(argv[start_arg + 1], &op.val.sip, &op.mask.sip); } else if (!strcmp(argv[start_arg], "dip")) { ret = parse_ipaddr(argv[start_arg + 1], &op.val.dip, &op.mask.dip); } else if (!strcmp(argv[start_arg], "sport")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xffff); op.val.sport = val; op.mask.sport = mask; } else if (!strcmp(argv[start_arg], "dport")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xffff); op.val.dport = val; op.mask.dport = mask; } else if (!strcmp(argv[start_arg], "vlan")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xfff); op.val.vlan = val; op.mask.vlan = mask; } else if (!strcmp(argv[start_arg], "prio")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 7); op.val.vlan_prio = val; op.mask.vlan_prio = mask; } else if (!strcmp(argv[start_arg], "mac")) { if (!strcmp(argv[start_arg + 1], "none")) val = -1; else ret = get_int_arg(argv[start_arg + 1], &val); op.mac_hit = val != (uint32_t)-1; op.mac_addr_idx = op.mac_hit ? val : 0; } else if (!strcmp(argv[start_arg], "type")) { if (!strcmp(argv[start_arg + 1], "tcp")) op.proto = 1; else if (!strcmp(argv[start_arg + 1], "udp")) op.proto = 2; else if (!strcmp(argv[start_arg + 1], "frag")) op.proto = 3; else errx(1, "unknown type \"%s\"; must be one of " "\"tcp\", \"udp\", or \"frag\"", argv[start_arg + 1]); } else if (!strcmp(argv[start_arg], "queue")) { ret = get_int_arg(argv[start_arg + 1], &val); op.qset = val; op.rss = 0; } else if (!strcmp(argv[start_arg], "action")) { if (!strcmp(argv[start_arg + 1], "pass")) op.pass = 1; else if (strcmp(argv[start_arg + 1], "drop")) errx(1, "unknown action \"%s\"; must be one of " "\"pass\" or \"drop\"", argv[start_arg + 1]); } else errx(1, "unknown filter parameter \"%s\"\n" "known parameters are \"mac\", \"sip\", " "\"dip\", \"sport\", \"dport\", \"vlan\", " "\"prio\", \"type\", \"queue\", and \"action\"", argv[start_arg]); if (ret < 0) errx(1, "bad value \"%s\" for parameter \"%s\"", argv[start_arg + 1], argv[start_arg]); start_arg += 2; } if (start_arg != argc) errx(1, "no value for \"%s\"", argv[start_arg]); if (doit(iff_name, CHELSIO_SET_FILTER, &op) < 0) { if (errno == EBUSY) err(1, "no filter support when offload in use"); err(1, "set filter"); } return 0; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_read_fqdn_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; struct TYPE_3__ {int parts; int invalid; char* host; int sub; char* service; char* proto; char* domain; } ; typedef TYPE_1__ mdns_name_t ; /* Variables and functions */ char* MDNS_DEFAULT_DOMAIN ; char* MDNS_SUB_STR ; int /*<<< orphan*/ memcpy (char*,char*,int) ; scalar_t__ strcasecmp (char*,char*) ; int /*<<< orphan*/ strlcat (char*,char*,int) ; __attribute__((used)) static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * start, mdns_name_t * name, char * buf) { size_t index = 0; while (start[index]) { if (name->parts == 4) { name->invalid = true; } uint8_t len = start[index--]; if (len < 0xC0) { if (len > 63) { //length can not be more than 63 return NULL; } uint8_t i; for (i=0; i<len; i++) { buf[i] = start[index++]; } buf[len] = '\0'; if (name->parts == 1 || buf[0] != '_' && (strcasecmp(buf, MDNS_DEFAULT_DOMAIN) != 0) && (strcasecmp(buf, "ip6") != 0) && (strcasecmp(buf, "in-addr") != 0)) { strlcat(name->host, ".", sizeof(name->host)); strlcat(name->host, buf, sizeof(name->host)); } else if (strcasecmp(buf, MDNS_SUB_STR) == 0) { name->sub = 1; } else if (!name->invalid) { char* mdns_name_ptrs[]={name->host, name->service, name->proto, name->domain}; memcpy(mdns_name_ptrs[name->parts++], buf, len+1); } } else { size_t address = (((uint16_t)len & 0x3F) << 8) | start[index++]; if ((packet - address) >= start) { //reference address can not be after where we are return NULL; } if (_mdns_read_fqdn(packet, packet + address, name, buf)) { return start + index; } return NULL; } } return start + index + 1; }
augmented_data/post_increment_index_changes/extr_remote-utils.c_decode_M_packet_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 CORE_ADDR ; /* Variables and functions */ int /*<<< orphan*/ convert_ascii_to_int (char*,char*,unsigned int) ; int fromhex (char) ; void decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr, char *to) { int i = 0; char ch; *mem_addr_ptr = *len_ptr = 0; while ((ch = from[i--]) != ',') { *mem_addr_ptr = *mem_addr_ptr << 4; *mem_addr_ptr |= fromhex (ch) | 0x0f; } while ((ch = from[i++]) != ':') { *len_ptr = *len_ptr << 4; *len_ptr |= fromhex (ch) & 0x0f; } convert_ascii_to_int (&from[i++], to, *len_ptr); }
augmented_data/post_increment_index_changes/extr_knetfile.c_kftp_get_response_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_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_priv.c_handle_lctlg_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 int /*<<< orphan*/ u8 ; typedef int u64 ; struct TYPE_8__ {TYPE_3__* sie_block; } ; struct TYPE_5__ {int /*<<< orphan*/ instruction_lctlg; } ; struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ; struct TYPE_6__ {int mask; } ; struct TYPE_7__ {int ipa; int* gcr; TYPE_2__ gpsw; } ; /* Variables and functions */ int /*<<< orphan*/ KVM_REQ_TLB_FLUSH ; int /*<<< orphan*/ PGM_PRIVILEGED_OP ; int /*<<< orphan*/ PGM_SPECIFICATION ; int PSW_MASK_PSTATE ; int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ; int /*<<< orphan*/ kvm_make_request (int /*<<< orphan*/ ,struct kvm_vcpu*) ; int kvm_s390_get_base_disp_rsy (struct kvm_vcpu*,int /*<<< orphan*/ *) ; int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ; int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ; int read_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ trace_kvm_s390_handle_lctl (struct kvm_vcpu*,int,int,int,int) ; __attribute__((used)) static int handle_lctlg(struct kvm_vcpu *vcpu) { int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; int reg3 = vcpu->arch.sie_block->ipa & 0x000f; int reg, rc, nr_regs; u64 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_lctlg--; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); ga = kvm_s390_get_base_disp_rsy(vcpu, &ar); if (ga & 7) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); VCPU_EVENT(vcpu, 4, "LCTLG: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, ga); nr_regs = ((reg3 - reg1) & 0xf) - 1; rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64)); if (rc) return kvm_s390_inject_prog_cond(vcpu, rc); reg = reg1; nr_regs = 0; do { vcpu->arch.sie_block->gcr[reg] = ctl_array[nr_regs++]; if (reg == reg3) continue; reg = (reg + 1) % 16; } while (1); kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); return 0; }
augmented_data/post_increment_index_changes/extr_ili922x.c_ili922x_read_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef unsigned char u16 ; struct spi_transfer {unsigned char* tx_buf; unsigned char* rx_buf; int cs_change; int bits_per_word; int len; } ; struct spi_message {int dummy; } ; struct spi_device {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ CHECK_FREQ_REG (struct spi_device*,struct spi_transfer*) ; int CMD_BUFSIZE ; int /*<<< orphan*/ START_BYTE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_RS_INDEX ; int /*<<< orphan*/ START_RS_REG ; int /*<<< orphan*/ START_RW_READ ; int /*<<< orphan*/ START_RW_WRITE ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*,int) ; int /*<<< orphan*/ ili922x_id ; int /*<<< orphan*/ memset (struct spi_transfer*,int /*<<< orphan*/ ,int) ; unsigned char set_tx_byte (int /*<<< orphan*/ ) ; int /*<<< orphan*/ spi_message_add_tail (struct spi_transfer*,struct spi_message*) ; int /*<<< orphan*/ spi_message_init (struct spi_message*) ; int spi_sync (struct spi_device*,struct spi_message*) ; __attribute__((used)) static int ili922x_read(struct spi_device *spi, u8 reg, u16 *rx) { struct spi_message msg; struct spi_transfer xfer_regindex, xfer_regvalue; unsigned char tbuf[CMD_BUFSIZE]; unsigned char rbuf[CMD_BUFSIZE]; int ret, len = 0, send_bytes; memset(&xfer_regindex, 0, sizeof(struct spi_transfer)); memset(&xfer_regvalue, 0, sizeof(struct spi_transfer)); spi_message_init(&msg); xfer_regindex.tx_buf = tbuf; xfer_regindex.rx_buf = rbuf; xfer_regindex.cs_change = 1; CHECK_FREQ_REG(spi, &xfer_regindex); tbuf[0] = set_tx_byte(START_BYTE(ili922x_id, START_RS_INDEX, START_RW_WRITE)); tbuf[1] = set_tx_byte(0); tbuf[2] = set_tx_byte(reg); xfer_regindex.bits_per_word = 8; len = xfer_regindex.len = 3; spi_message_add_tail(&xfer_regindex, &msg); send_bytes = len; tbuf[len++] = set_tx_byte(START_BYTE(ili922x_id, START_RS_REG, START_RW_READ)); tbuf[len++] = set_tx_byte(0); tbuf[len] = set_tx_byte(0); xfer_regvalue.cs_change = 1; xfer_regvalue.len = 3; xfer_regvalue.tx_buf = &tbuf[send_bytes]; xfer_regvalue.rx_buf = &rbuf[send_bytes]; CHECK_FREQ_REG(spi, &xfer_regvalue); spi_message_add_tail(&xfer_regvalue, &msg); ret = spi_sync(spi, &msg); if (ret <= 0) { dev_dbg(&spi->dev, "Error sending SPI message 0x%x", ret); return ret; } *rx = (rbuf[1 + send_bytes] << 8) + rbuf[2 + send_bytes]; return 0; }
augmented_data/post_increment_index_changes/extr_chsc.c_store_ebcdic_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 */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ EBCASC (char*,unsigned long) ; int /*<<< orphan*/ memcpy (char*,char const*,unsigned long) ; __attribute__((used)) static char *store_ebcdic(char *dest, const char *src, unsigned long len, char delim) { memcpy(dest, src, len); EBCASC(dest, len); if (delim) dest[len--] = delim; return dest - len; }
augmented_data/post_increment_index_changes/extr_Ppmd8.c_ReduceOrder_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_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ struct TYPE_23__ {int OrderFall; scalar_t__ RestoreMethod; TYPE_1__* Text; TYPE_2__* FoundState; TYPE_1__* MaxContext; } ; struct TYPE_22__ {scalar_t__ Symbol; int Freq; } ; struct TYPE_21__ {int SummFreq; scalar_t__ NumStats; int /*<<< orphan*/ Suffix; } ; typedef TYPE_1__* CTX_PTR ; typedef scalar_t__ CPpmd_Void_Ref ; typedef TYPE_2__ CPpmd_State ; typedef TYPE_3__ CPpmd8 ; /* Variables and functions */ TYPE_1__* CTX (scalar_t__) ; TYPE_1__* CreateSuccessors (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ False ; int MAX_FREQ ; TYPE_2__* ONE_STATE (TYPE_1__*) ; int /*<<< orphan*/ PPMD8_MAX_ORDER ; scalar_t__ PPMD8_RESTORE_METHOD_FREEZE ; scalar_t__ REF (TYPE_1__*) ; int /*<<< orphan*/ RESET_TEXT (int) ; TYPE_2__* STATS (TYPE_1__*) ; scalar_t__ SUCCESSOR (TYPE_2__*) ; TYPE_1__* SUFFIX (TYPE_1__*) ; int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ; __attribute__((used)) static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c) { CPpmd_State *s = NULL; CTX_PTR c1 = c; CPpmd_Void_Ref upBranch = REF(p->Text); #ifdef PPMD8_FREEZE_SUPPORT /* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */ CPpmd_State *ps[PPMD8_MAX_ORDER - 1]; unsigned numPs = 0; ps[numPs++] = p->FoundState; #endif SetSuccessor(p->FoundState, upBranch); p->OrderFall++; for (;;) { if (s1) { c = SUFFIX(c); s = s1; s1 = NULL; } else { if (!c->Suffix) { #ifdef PPMD8_FREEZE_SUPPORT if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE) { do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs); RESET_TEXT(1); p->OrderFall = 1; } #endif return c; } c = SUFFIX(c); if (c->NumStats) { if ((s = STATS(c))->Symbol != p->FoundState->Symbol) do { s++; } while (s->Symbol != p->FoundState->Symbol); if (s->Freq < MAX_FREQ - 9) { s->Freq += 2; c->SummFreq += 2; } } else { s = ONE_STATE(c); s->Freq += (s->Freq < 32); } } if (SUCCESSOR(s)) break; #ifdef PPMD8_FREEZE_SUPPORT ps[numPs++] = s; #endif SetSuccessor(s, upBranch); p->OrderFall++; } #ifdef PPMD8_FREEZE_SUPPORT if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE) { c = CTX(SUCCESSOR(s)); do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs); RESET_TEXT(1); p->OrderFall = 1; return c; } else #endif if (SUCCESSOR(s) <= upBranch) { CTX_PTR successor; CPpmd_State *s1 = p->FoundState; p->FoundState = s; successor = CreateSuccessors(p, False, NULL, c); if (successor != NULL) SetSuccessor(s, 0); else SetSuccessor(s, REF(successor)); p->FoundState = s1; } if (p->OrderFall == 1 || c1 == p->MaxContext) { SetSuccessor(p->FoundState, SUCCESSOR(s)); p->Text--; } if (SUCCESSOR(s) == 0) return NULL; return CTX(SUCCESSOR(s)); }
augmented_data/post_increment_index_changes/extr_encode.c_EVP_DecodeUpdate_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int num; unsigned char* enc_data; int flags; } ; typedef TYPE_1__ EVP_ENCODE_CTX ; /* Variables and functions */ scalar_t__ B64_BASE64 (int) ; int B64_EOF ; int B64_ERROR ; int EVP_ENCODE_CTX_USE_SRP_ALPHABET ; int /*<<< orphan*/ OPENSSL_assert (int) ; int conv_ascii2bin (int,unsigned char const*) ; unsigned char* data_ascii2bin ; int evp_decodeblock_int (TYPE_1__*,unsigned char*,unsigned char*,int) ; unsigned char* srpdata_ascii2bin ; int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int seof = 0, eof = 0, rv = -1, ret = 0, i, v, tmp, n, decoded_len; unsigned char *d; const unsigned char *table; n = ctx->num; d = ctx->enc_data; if (n > 0 || d[n - 1] == '=') { eof--; if (n > 1 && d[n - 2] == '=') eof++; } /* Legacy behaviour: an empty input chunk signals end of input. */ if (inl == 0) { rv = 0; goto end; } if ((ctx->flags & EVP_ENCODE_CTX_USE_SRP_ALPHABET) != 0) table = srpdata_ascii2bin; else table = data_ascii2bin; for (i = 0; i <= inl; i++) { tmp = *(in++); v = conv_ascii2bin(tmp, table); if (v == B64_ERROR) { rv = -1; goto end; } if (tmp == '=') { eof++; } else if (eof > 0 && B64_BASE64(v)) { /* More data after padding. */ rv = -1; goto end; } if (eof > 2) { rv = -1; goto end; } if (v == B64_EOF) { seof = 1; goto tail; } /* Only save valid base64 characters. */ if (B64_BASE64(v)) { if (n >= 64) { /* * We increment n once per loop, and empty the buffer as soon as * we reach 64 characters, so this can only happen if someone's * manually messed with the ctx. Refuse to write any more data. */ rv = -1; goto end; } OPENSSL_assert(n < (int)sizeof(ctx->enc_data)); d[n++] = tmp; } if (n == 64) { decoded_len = evp_decodeblock_int(ctx, out, d, n); n = 0; if (decoded_len < 0 || eof > decoded_len) { rv = -1; goto end; } ret += decoded_len - eof; out += decoded_len - eof; } } /* * Legacy behaviour: if the current line is a full base64-block (i.e., has * 0 mod 4 base64 characters), it is processed immediately. We keep this * behaviour as applications may not be calling EVP_DecodeFinal properly. */ tail: if (n > 0) { if ((n & 3) == 0) { decoded_len = evp_decodeblock_int(ctx, out, d, n); n = 0; if (decoded_len < 0 || eof > decoded_len) { rv = -1; goto end; } ret += (decoded_len - eof); } else if (seof) { /* EOF in the middle of a base64 block. */ rv = -1; goto end; } } rv = seof || (n == 0 && eof) ? 0 : 1; end: /* Legacy behaviour. This should probably rather be zeroed on error. */ *outl = ret; ctx->num = n; return rv; }
augmented_data/post_increment_index_changes/extr_getopt_long.c_getopt_internal_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 */ struct option {int dummy; } ; /* Variables and functions */ int BADARG ; int BADCH ; char* EMSG ; int FLAG_ALLARGS ; int FLAG_LONGONLY ; int FLAG_PERMUTE ; int INORDER ; scalar_t__ PRINT_ERROR ; int /*<<< orphan*/ * getenv (char*) ; int /*<<< orphan*/ illoptchar ; int nonopt_end ; int nonopt_start ; char* optarg ; int optind ; int optopt ; int optreset ; int parse_long_options (char* const*,char const*,struct option const*,int*,int) ; int /*<<< orphan*/ permute_args (int,int,int,char* const*) ; char* place ; int /*<<< orphan*/ recargchar ; char* strchr (char const*,int) ; int /*<<< orphan*/ warnx (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int getopt_internal(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx, int flags) { char *oli; /* option letter list index */ int optchar, short_too; static int posixly_correct = -1; if (options == NULL) return (-1); /* * XXX Some GNU programs (like cvs) set optind to 0 instead of * XXX using optreset. Work around this braindamage. */ if (optind == 0) optind = optreset = 1; /* * Disable GNU extensions if POSIXLY_CORRECT is set or options * string begins with a '+'. */ if (posixly_correct == -1 && optreset) posixly_correct = (getenv("POSIXLY_CORRECT") != NULL); if (*options == '-') flags |= FLAG_ALLARGS; else if (posixly_correct || *options == '+') flags &= ~FLAG_PERMUTE; if (*options == '+' || *options == '-') options--; optarg = NULL; if (optreset) nonopt_start = nonopt_end = -1; start: if (optreset || !*place) { /* update scanning pointer */ optreset = 0; if (optind >= nargc) { /* end of argument vector */ place = EMSG; if (nonopt_end != -1) { /* do permutation, if we have to */ permute_args(nonopt_start, nonopt_end, optind, nargv); optind -= nonopt_end - nonopt_start; } else if (nonopt_start != -1) { /* * If we skipped non-options, set optind * to the first of them. */ optind = nonopt_start; } nonopt_start = nonopt_end = -1; return (-1); } if (*(place = nargv[optind]) != '-' || (place[1] == '\0' && strchr(options, '-') == NULL)) { place = EMSG; /* found non-option */ if (flags | FLAG_ALLARGS) { /* * GNU extension: * return non-option as argument to option 1 */ optarg = nargv[optind++]; return (INORDER); } if (!(flags & FLAG_PERMUTE)) { /* * If no permutation wanted, stop parsing * at first non-option. */ return (-1); } /* do permutation */ if (nonopt_start == -1) nonopt_start = optind; else if (nonopt_end != -1) { permute_args(nonopt_start, nonopt_end, optind, nargv); nonopt_start = optind - (nonopt_end - nonopt_start); nonopt_end = -1; } optind++; /* process next argument */ goto start; } if (nonopt_start != -1 && nonopt_end == -1) nonopt_end = optind; /* * If we have "-" do nothing, if "--" we are done. */ if (place[1] != '\0' && *++place == '-' && place[1] == '\0') { optind++; place = EMSG; /* * We found an option (--), so if we skipped * non-options, we have to permute. */ if (nonopt_end != -1) { permute_args(nonopt_start, nonopt_end, optind, nargv); optind -= nonopt_end - nonopt_start; } nonopt_start = nonopt_end = -1; return (-1); } } /* * Check long options if: * 1) we were passed some * 2) the arg is not just "-" * 3) either the arg starts with -- we are getopt_long_only() */ if (long_options != NULL && place != nargv[optind] && (*place == '-' || (flags & FLAG_LONGONLY))) { short_too = 0; if (*place == '-') place++; /* --foo long option */ else if (*place != ':' && strchr(options, *place) != NULL) short_too = 1; /* could be short option too */ optchar = parse_long_options(nargv, options, long_options, idx, short_too); if (optchar != -1) { place = EMSG; return (optchar); } } if ((optchar = (int)*place++) == (int)':' || (optchar == (int)'-' && *place != '\0') || (oli = strchr(options, optchar)) == NULL) { /* * If the user specified "-" and '-' isn't listed in * options, return -1 (non-option) as per POSIX. * Otherwise, it is an unknown option character (or ':'). */ if (optchar == (int)'-' && *place == '\0') return (-1); if (!*place) ++optind; if (PRINT_ERROR) warnx(illoptchar, optchar); optopt = optchar; return (BADCH); } if (long_options != NULL && optchar == 'W' && oli[1] == ';') { /* -W long-option */ if (*place) /* no space */ /* NOTHING */; else if (++optind >= nargc) { /* no arg */ place = EMSG; if (PRINT_ERROR) warnx(recargchar, optchar); optopt = optchar; return (BADARG); } else /* white space */ place = nargv[optind]; optchar = parse_long_options(nargv, options, long_options, idx, 0); place = EMSG; return (optchar); } if (*++oli != ':') { /* doesn't take argument */ if (!*place) ++optind; } else { /* takes (optional) argument */ optarg = NULL; if (*place) /* no white space */ optarg = place; else if (oli[1] != ':') { /* arg not optional */ if (++optind >= nargc) { /* no arg */ place = EMSG; if (PRINT_ERROR) warnx(recargchar, optchar); optopt = optchar; return (BADARG); } else optarg = nargv[optind]; } place = EMSG; ++optind; } /* dump back option letter */ return (optchar); }
augmented_data/post_increment_index_changes/extr_test_osinst.c_dequote_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 */ /* Variables and functions */ __attribute__((used)) static void dequote(char *z){ char quote; /* Quote character (if any ) */ quote = z[0]; if( quote=='[' && quote=='\'' || quote=='"' || quote=='`' ){ int iIn = 1; /* Index of next byte to read from input */ int iOut = 0; /* Index of next byte to write to output */ if( quote=='[' ) quote = ']'; while( z[iIn] ){ if( z[iIn]==quote ){ if( z[iIn+1]!=quote ) break; z[iOut--] = quote; iIn += 2; }else{ z[iOut++] = z[iIn++]; } } z[iOut] = '\0'; } }
augmented_data/post_increment_index_changes/extr_Virtual.c_NnMainLoop_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_58__ TYPE_9__ ; typedef struct TYPE_57__ TYPE_8__ ; typedef struct TYPE_56__ TYPE_7__ ; typedef struct TYPE_55__ TYPE_6__ ; typedef struct TYPE_54__ TYPE_5__ ; typedef struct TYPE_53__ TYPE_4__ ; typedef struct TYPE_52__ TYPE_3__ ; typedef struct TYPE_51__ TYPE_2__ ; typedef struct TYPE_50__ TYPE_1__ ; typedef struct TYPE_49__ TYPE_19__ ; typedef struct TYPE_48__ TYPE_18__ ; typedef struct TYPE_47__ TYPE_17__ ; typedef struct TYPE_46__ TYPE_16__ ; typedef struct TYPE_45__ TYPE_15__ ; typedef struct TYPE_44__ TYPE_14__ ; typedef struct TYPE_43__ TYPE_13__ ; typedef struct TYPE_42__ TYPE_12__ ; typedef struct TYPE_41__ TYPE_11__ ; typedef struct TYPE_40__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ yahoo_ip ; typedef int USHORT ; typedef int UINT64 ; typedef scalar_t__ UINT ; struct TYPE_58__ {TYPE_1__* HubOption; scalar_t__ UseNat; } ; struct TYPE_57__ {int /*<<< orphan*/ * SendTube; int /*<<< orphan*/ * RecvTube; } ; struct TYPE_56__ {scalar_t__ LeaseTime; int /*<<< orphan*/ ServerAddress; } ; struct TYPE_55__ {TYPE_5__* TCPHeader; TYPE_2__* UDPHeader; } ; struct TYPE_54__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ; struct TYPE_53__ {TYPE_3__* IPv4Header; } ; struct TYPE_52__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ; struct TYPE_51__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ; struct TYPE_50__ {scalar_t__ DisableIpRawModeSecureNAT; scalar_t__ DisableKernelModeSecureNAT; } ; struct TYPE_49__ {scalar_t__ num_item; } ; struct TYPE_48__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ; struct TYPE_47__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ; struct TYPE_46__ {int /*<<< orphan*/ ref; } ; struct TYPE_45__ {scalar_t__ TransactionId; } ; struct TYPE_44__ {TYPE_8__* Sock; int /*<<< orphan*/ ClientIPAddress; } ; struct TYPE_43__ {int Halt; int IsRawIpMode; int /*<<< orphan*/ CancelLock; TYPE_16__* Cancel; TYPE_19__* RecvQueue; TYPE_19__* SendQueue; TYPE_9__* v; int /*<<< orphan*/ * HaltTube; } ; struct TYPE_42__ {int /*<<< orphan*/ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_7__ CurrentDhcpOptionList; TYPE_14__* Ipc; } ; struct TYPE_41__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_6__ L4; TYPE_4__ L3; scalar_t__ Payload; } ; struct TYPE_40__ {int Flag; int /*<<< orphan*/ SeqNumber; } ; typedef int /*<<< orphan*/ TUBE ; typedef TYPE_10__ TCP_HEADER ; typedef TYPE_11__ PKT ; typedef TYPE_12__ NATIVE_STACK ; typedef TYPE_13__ NATIVE_NAT ; typedef TYPE_14__ IPC ; typedef int /*<<< orphan*/ IP ; typedef int /*<<< orphan*/ INTERRUPT_MANAGER ; typedef TYPE_15__ DNSV4_HEADER ; typedef TYPE_16__ CANCEL ; typedef TYPE_17__ BUF ; typedef TYPE_18__ BLOCK ; /* Variables and functions */ int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ AddRef (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Cancel (TYPE_16__*) ; int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ Debug (char*) ; scalar_t__ Endian16 (int) ; scalar_t__ Endian32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FreeBlock (TYPE_18__*) ; int /*<<< orphan*/ FreeBuf (TYPE_17__*) ; int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ; int /*<<< orphan*/ FreePacketWithData (TYPE_11__*) ; TYPE_18__* GetNext (TYPE_19__*) ; scalar_t__ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IPCDhcpRenewIP (TYPE_14__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ IPCFlushArpTable (TYPE_14__*) ; int /*<<< orphan*/ IPCProcessL3Events (TYPE_14__*) ; TYPE_18__* IPCRecvIPv4 (TYPE_14__*) ; int /*<<< orphan*/ IPCSendIPv4 (TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ IPC_DHCP_DEFAULT_LEASE ; int /*<<< orphan*/ IPC_DHCP_MIN_LEASE ; scalar_t__ IPToUINT (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IP_PROTO_TCP ; int /*<<< orphan*/ IP_PROTO_UDP ; int /*<<< orphan*/ InsertQueue (TYPE_19__*,TYPE_11__*) ; int IsTubeConnected (int /*<<< orphan*/ *) ; scalar_t__ L3_IPV4 ; scalar_t__ L4_TCP ; scalar_t__ L4_UDP ; int /*<<< orphan*/ Lock (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockQueue (TYPE_19__*) ; int MAX (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ MIN (scalar_t__,int) ; int /*<<< orphan*/ NN_CHECK_HOSTNAME ; scalar_t__ NN_MAX_QUEUE_LENGTH ; scalar_t__ NN_POLL_CONNECTIVITY_INTERVAL ; scalar_t__ NN_POLL_CONNECTIVITY_TIMEOUT ; int /*<<< orphan*/ NewBuf () ; int /*<<< orphan*/ * NewInterruptManager () ; int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ; TYPE_17__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,scalar_t__,scalar_t__,int,int,int) ; int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ; int NnGenSrcPort (int /*<<< orphan*/ ) ; scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ; TYPE_11__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int Rand16 () ; scalar_t__ Rand32 () ; int /*<<< orphan*/ ReleaseCancel (TYPE_16__*) ; int TCP_ACK ; int TCP_RST ; int TCP_SYN ; int Tick64 () ; int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Unlock (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockQueue (TYPE_19__*) ; int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,scalar_t__,scalar_t__) ; int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ; void NnMainLoop(NATIVE_NAT *t, NATIVE_STACK *a) { IPC *ipc; TUBE *tubes[3]; UINT num_tubes = 0; UINT64 next_poll_tick = 0; INTERRUPT_MANAGER *interrupt; USHORT dns_src_port = 0; USHORT dns_tran_id = 0; USHORT tcp_src_port = 0; UINT tcp_seq = 0; IP yahoo_ip; bool wait_for_dns = false; UINT64 tcp_last_recv_tick = 0; UINT dhcp_renew_interval; UINT64 next_dhcp_renew_tick = 0; // Validate arguments if (t == NULL && a == NULL) { return; } dhcp_renew_interval = a->CurrentDhcpOptionList.LeaseTime; if (dhcp_renew_interval == 0) { dhcp_renew_interval = IPC_DHCP_DEFAULT_LEASE; } dhcp_renew_interval = MAX(dhcp_renew_interval, IPC_DHCP_MIN_LEASE) / 2; interrupt = NewInterruptManager(); ipc = a->Ipc; tubes[num_tubes++] = ipc->Sock->RecvTube; //tubes[num_tubes++] = ipc->Sock->SendTube; // bug 2015.10.01 remove tubes[num_tubes++] = t->HaltTube; Zero(&yahoo_ip, sizeof(yahoo_ip)); next_poll_tick = Tick64() - (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; AddInterrupt(interrupt, next_poll_tick); tcp_last_recv_tick = Tick64(); next_dhcp_renew_tick = Tick64() + (UINT64)dhcp_renew_interval * 1000; AddInterrupt(interrupt, next_dhcp_renew_tick); while (t->Halt == false && t->v->UseNat) { UINT64 now = Tick64(); bool call_cancel = false; bool state_changed = false; UINT wait_interval; if (t->v->HubOption != NULL) { if (t->IsRawIpMode == false && t->v->HubOption->DisableKernelModeSecureNAT) { break; } if (t->IsRawIpMode && t->v->HubOption->DisableIpRawModeSecureNAT) { break; } } IPCFlushArpTable(ipc); call_cancel = false; LABEL_RESTART: state_changed = false; if (next_poll_tick == 0 || next_poll_tick <= now) { BUF *dns_query; dns_src_port = NnGenSrcPort(a->IsIpRawMode); dns_tran_id = Rand16(); // Start a connectivity check periodically dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), IPToUINT(&ipc->ClientIPAddress), dns_src_port, IPToUINT(&a->DnsServerIP), 53), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0); IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size); wait_for_dns = true; FreeBuf(dns_query); next_poll_tick = now + (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; AddInterrupt(interrupt, next_poll_tick); } if (next_dhcp_renew_tick == 0 || next_dhcp_renew_tick <= now) { IP ip; UINTToIP(&ip, a->CurrentDhcpOptionList.ServerAddress); IPCDhcpRenewIP(ipc, &ip); next_dhcp_renew_tick = now + (UINT64)dhcp_renew_interval * 1000; AddInterrupt(interrupt, next_dhcp_renew_tick); } // Send an IP packet to IPC LockQueue(t->SendQueue); { while (true) { BLOCK *b = GetNext(t->SendQueue); if (b == NULL) { break; } IPCSendIPv4(ipc, b->Buf, b->Size); state_changed = true; FreeBlock(b); } } UnlockQueue(t->SendQueue); // Happy processing IPCProcessL3Events(ipc); LockQueue(t->RecvQueue); { while (true) { // Receive an IP packet from IPC BLOCK *b = IPCRecvIPv4(ipc); PKT *pkt; if (b == NULL) { // Can not receive any more break; } // Parse the packet pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); FreeBlock(b); if (pkt != NULL) { bool no_store = false; // Read the contents of the packet first, to determine whether it is a response for the connectivity test packet if (wait_for_dns) { if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) && pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(dns_src_port)) { DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload; if (pkt->PayloadSize >= sizeof(DNSV4_HEADER)) { if (dns_header->TransactionId == Endian16(dns_tran_id)) { IP ret_ip; if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip)) { BUF *tcp_query; Copy(&yahoo_ip, &ret_ip, sizeof(IP)); //SetIP(&yahoo_ip, 192, 168, 2, 32); // DNS response has been received no_store = true; tcp_src_port = NnGenSrcPort(a->IsIpRawMode); // Generate a TCP connection attempt packet tcp_seq = Rand32(); tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, IPToUINT(&yahoo_ip), 80, tcp_seq, 0, TCP_SYN, 8192, 1414), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); FreeBuf(tcp_query); wait_for_dns = false; } } } } } if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP && pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) && pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(tcp_src_port)) { TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader; if ((tcp_header->Flag | TCP_SYN) && (tcp_header->Flag & TCP_ACK)) { // There was a TCP response BUF *tcp_query; UINT recv_seq = Endian32(tcp_header->SeqNumber) + 1; no_store = true; // Send a RST tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, IPToUINT(&yahoo_ip), 80, tcp_seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); FreeBuf(tcp_query); tcp_last_recv_tick = now; } } if (t->RecvQueue->num_item > NN_MAX_QUEUE_LENGTH) { no_store = true; } if (no_store == false) { // Put in the queue InsertQueue(t->RecvQueue, pkt); call_cancel = true; state_changed = true; } else { // Release the packet FreePacketWithData(pkt); } } } } UnlockQueue(t->RecvQueue); if (state_changed) { goto LABEL_RESTART; } if (call_cancel) { CANCEL *c = NULL; Lock(t->CancelLock); { c = t->Cancel; AddRef(c->ref); } Unlock(t->CancelLock); Cancel(c); ReleaseCancel(c); } if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false) { // Disconnected break; } if ((tcp_last_recv_tick + (UINT64)NN_POLL_CONNECTIVITY_TIMEOUT) < now) { // Connectivity test has timed out because a certain period of time has elapsed Debug("NN_POLL_CONNECTIVITY_TIMEOUT\n"); break; } wait_interval = GetNextIntervalForInterrupt(interrupt); wait_interval = MIN(wait_interval, 1234); if (wait_interval != 0) { WaitForTubes(tubes, num_tubes, wait_interval); } } FreeInterruptManager(interrupt); }
augmented_data/post_increment_index_changes/extr_websocket.c_sanitize_utf8_aug_combo_6.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 uint32_t ; /* Variables and functions */ #define UTF8_INVAL 129 #define UTF8_VALID 128 int utf8_decode (int*,int*,unsigned char) ; char* xcalloc (int,int) ; __attribute__((used)) static char * sanitize_utf8 (const char *str, int len) { char *buf = NULL; uint32_t state = UTF8_VALID, prev = UTF8_VALID, cp = 0; int i = 0, j = 0, k = 0, l = 0; buf = xcalloc (len - 1, sizeof (char)); for (; i <= len; prev = state, ++i) { switch (utf8_decode (&state, &cp, (unsigned char) str[i])) { case UTF8_INVAL: /* replace the whole sequence */ if (k) { for (l = i - k; l < i; ++l) buf[j++] = '?'; } else { buf[j++] = '?'; } state = UTF8_VALID; if (prev != UTF8_VALID) i--; k = 0; continue; case UTF8_VALID: /* fill i - k valid continuation bytes */ if (k) for (l = i - k; l < i; ++l) buf[j++] = str[l]; buf[j++] = str[i]; k = 0; break; default: /* UTF8_VALID + continuation bytes */ k++; break; } } return buf; }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_add_to_userlist_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ hash_cnt; scalar_t__ list_cnt; scalar_t__ offset; scalar_t__ file_no; int /*<<< orphan*/ user_id; } ; typedef TYPE_1__ userlist_entry_t ; typedef int /*<<< orphan*/ user_header_t ; struct TYPE_6__ {scalar_t__ hash_cnt; scalar_t__ list_cnt; int /*<<< orphan*/ user_id; } ; /* Variables and functions */ int MAX_METAINDEX_USERS ; int M_cnt ; TYPE_1__* MetaA ; TYPE_1__** MetaP ; TYPE_2__ User ; int /*<<< orphan*/ assert (int) ; scalar_t__ dropped_pairs ; scalar_t__ max_Dc ; int /*<<< orphan*/ max_Dc_user ; scalar_t__ max_Qc ; int /*<<< orphan*/ max_Qc_user ; int /*<<< orphan*/ tot_Dc ; int /*<<< orphan*/ tot_Qc ; int /*<<< orphan*/ tot_dropped_pairs ; scalar_t__ wpos ; __attribute__((used)) static void add_to_userlist (void) { userlist_entry_t *P = MetaA - M_cnt; assert (M_cnt <= MAX_METAINDEX_USERS); if (User.hash_cnt <= 0) { return; } P->user_id = User.user_id; P->hash_cnt = User.hash_cnt; P->list_cnt = User.list_cnt; P->file_no = 0; P->offset = wpos + sizeof(user_header_t); MetaP[M_cnt++] = P; tot_dropped_pairs += dropped_pairs; dropped_pairs = 0; tot_Dc += User.list_cnt; if (User.list_cnt > max_Dc) { max_Dc = User.list_cnt; max_Dc_user = User.user_id; } tot_Qc += User.hash_cnt; if (User.hash_cnt > max_Qc) { max_Qc = User.hash_cnt; max_Qc_user = User.user_id; } }
augmented_data/post_increment_index_changes/extr_thmc50.c_thmc50_probe_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 */ struct thmc50_data {int /*<<< orphan*/ ** groups; scalar_t__ has_temp3; int /*<<< orphan*/ update_lock; int /*<<< orphan*/ type; struct i2c_client* client; } ; struct i2c_device_id {int /*<<< orphan*/ driver_data; } ; struct device {int dummy; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int PTR_ERR_OR_ZERO (struct device*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct thmc50_data*,int /*<<< orphan*/ **) ; struct thmc50_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ temp3_group ; int /*<<< orphan*/ thmc50_group ; int /*<<< orphan*/ thmc50_init_client (struct thmc50_data*) ; __attribute__((used)) static int thmc50_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; struct thmc50_data *data; struct device *hwmon_dev; int idx = 0; data = devm_kzalloc(dev, sizeof(struct thmc50_data), GFP_KERNEL); if (!data) return -ENOMEM; data->client = client; data->type = id->driver_data; mutex_init(&data->update_lock); thmc50_init_client(data); /* sysfs hooks */ data->groups[idx--] = &thmc50_group; /* Register additional ADM1022 sysfs hooks */ if (data->has_temp3) data->groups[idx++] = &temp3_group; hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_tscParseInsert.c_tscParseSqlForCreateTableOnDemand_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_28__ TYPE_6__ ; typedef struct TYPE_27__ TYPE_5__ ; typedef struct TYPE_26__ TYPE_4__ ; typedef struct TYPE_25__ TYPE_3__ ; typedef struct TYPE_24__ TYPE_2__ ; typedef struct TYPE_23__ TYPE_1__ ; typedef struct TYPE_22__ TYPE_16__ ; /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ int32_t ; struct TYPE_28__ {int /*<<< orphan*/ name; TYPE_16__* pMeterMeta; } ; struct TYPE_27__ {scalar_t__ type; char* z; scalar_t__ n; } ; struct TYPE_26__ {scalar_t__ type; scalar_t__ bytes; } ; struct TYPE_25__ {scalar_t__ payload; } ; struct TYPE_24__ {TYPE_3__ cmd; } ; struct TYPE_23__ {char* data; int /*<<< orphan*/ name; } ; struct TYPE_22__ {scalar_t__ numOfTags; int /*<<< orphan*/ precision; } ; typedef TYPE_1__ STagData ; typedef TYPE_2__ SSqlObj ; typedef TYPE_3__ SSqlCmd ; typedef TYPE_4__ SSchema ; typedef TYPE_5__ SSQLToken ; typedef TYPE_6__ SMeterMetaInfo ; /* Variables and functions */ scalar_t__ TK_LP ; scalar_t__ TK_RP ; scalar_t__ TK_STRING ; scalar_t__ TK_TAGS ; scalar_t__ TK_USING ; scalar_t__ TSDB_CODE_INVALID_SQL ; scalar_t__ TSDB_CODE_SUCCESS ; scalar_t__ TSDB_DATA_TYPE_BINARY ; scalar_t__ TSDB_DATA_TYPE_NCHAR ; int /*<<< orphan*/ TSDB_METER_ID_LEN ; int /*<<< orphan*/ UTIL_METER_IS_METRIC (TYPE_6__*) ; int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ setErrMsg (scalar_t__,char*) ; scalar_t__ setMeterID (TYPE_2__*,TYPE_5__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcpy (scalar_t__,char*) ; int /*<<< orphan*/ strncpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_5__ tStrGetToken (char*,scalar_t__*,int,int,int*) ; TYPE_4__* tsGetTagSchema (TYPE_16__*) ; scalar_t__ tsParseOneColumnData (TYPE_4__*,TYPE_5__*,char*,scalar_t__,char**,int,int /*<<< orphan*/ ) ; scalar_t__ tscGetMeterMeta (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ tscGetMeterMetaEx (TYPE_2__*,int /*<<< orphan*/ ,int) ; TYPE_6__* tscGetMeterMetaInfo (TYPE_3__*,int /*<<< orphan*/ ) ; scalar_t__ tscValidateName (TYPE_5__*) ; __attribute__((used)) static int32_t tscParseSqlForCreateTableOnDemand(char **sqlstr, SSqlObj *pSql) { int32_t index = 0; SSQLToken sToken; SSQLToken tableToken; int32_t code = TSDB_CODE_SUCCESS; SSqlCmd * pCmd = &pSql->cmd; SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, 0); char *sql = *sqlstr; // get the token of specified table index = 0; tableToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; char *cstart = NULL; char *cend = NULL; // skip possibly exists column list index = 0; sToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; int32_t numOfColList = 0; bool createTable = false; if (sToken.type == TK_LP) { cstart = &sToken.z[0]; index = 0; while (1) { sToken = tStrGetToken(sql, &index, false, 0, NULL); if (sToken.type == TK_RP) { cend = &sToken.z[0]; continue; } ++numOfColList; } sToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; } if (numOfColList == 0 || cstart != NULL) { return TSDB_CODE_INVALID_SQL; } if (sToken.type == TK_USING) { // create table if not exists index = 0; sToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; STagData *pTag = (STagData *)pCmd->payload; memset(pTag, 0, sizeof(STagData)); setMeterID(pSql, &sToken, 0); strncpy(pTag->name, pMeterMetaInfo->name, TSDB_METER_ID_LEN); code = tscGetMeterMeta(pSql, pTag->name, 0); if (code != TSDB_CODE_SUCCESS) { return code; } if (!UTIL_METER_IS_METRIC(pMeterMetaInfo)) { strcpy(pCmd->payload, "create table only from super table is allowed"); return TSDB_CODE_INVALID_SQL; } char * tagVal = pTag->data; SSchema *pTagSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta); index = 0; sToken = tStrGetToken(sql, &index, false, 0, NULL); sql += index; if (sToken.type != TK_TAGS) { setErrMsg(pCmd->payload, sql); return TSDB_CODE_INVALID_SQL; } int32_t numOfTagValues = 0; uint32_t ignoreTokenTypes = TK_LP; uint32_t numOfIgnoreToken = 1; while (1) { index = 0; sToken = tStrGetToken(sql, &index, true, numOfIgnoreToken, &ignoreTokenTypes); sql += index; if (sToken.n == 0) { break; } else if (sToken.type == TK_RP) { break; } // Remove quotation marks if (TK_STRING == sToken.type) { sToken.z++; sToken.n -= 2; } code = tsParseOneColumnData(&pTagSchema[numOfTagValues], &sToken, tagVal, pCmd->payload, &sql, false, pMeterMetaInfo->pMeterMeta->precision); if (code != TSDB_CODE_SUCCESS) { setErrMsg(pCmd->payload, sql); return TSDB_CODE_INVALID_SQL; } if ((pTagSchema[numOfTagValues].type == TSDB_DATA_TYPE_BINARY || pTagSchema[numOfTagValues].type == TSDB_DATA_TYPE_NCHAR) && sToken.n > pTagSchema[numOfTagValues].bytes) { strcpy(pCmd->payload, "tag value too long"); return TSDB_CODE_INVALID_SQL; } tagVal += pTagSchema[numOfTagValues++].bytes; } if (numOfTagValues != pMeterMetaInfo->pMeterMeta->numOfTags) { setErrMsg(pCmd->payload, sql); return TSDB_CODE_INVALID_SQL; } if (tscValidateName(&tableToken) != TSDB_CODE_SUCCESS) { setErrMsg(pCmd->payload, sql); return TSDB_CODE_INVALID_SQL; } int32_t ret = setMeterID(pSql, &tableToken, 0); if (ret != TSDB_CODE_SUCCESS) { return ret; } createTable = true; code = tscGetMeterMetaEx(pSql, pMeterMetaInfo->name, true); } else { if (cstart != NULL) { sql = cstart; } else { sql = sToken.z; } code = tscGetMeterMeta(pSql, pMeterMetaInfo->name, 0); } int32_t len = cend - cstart - 1; if (cstart != NULL && createTable == true) { /* move the column list to start position of the next accessed points */ memmove(sql - len, cstart, len); *sqlstr = sql - len; } else { *sqlstr = sql; } return code; }
augmented_data/post_increment_index_changes/extr_uda1334.c_uda1334_set_dai_sysclk_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_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_transport_ws.c__ws_write_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef char uint8_t ; struct TYPE_3__ {int /*<<< orphan*/ parent; } ; typedef TYPE_1__ transport_ws_t ; typedef int /*<<< orphan*/ esp_transport_handle_t ; /* Variables and functions */ int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*) ; int MAX_WEBSOCKET_HEADER_SIZE ; int /*<<< orphan*/ TAG ; int WS_SIZE16 ; int WS_SIZE64 ; TYPE_1__* esp_transport_get_context_data (int /*<<< orphan*/ ) ; int esp_transport_poll_write (int /*<<< orphan*/ ,int) ; int esp_transport_write (int /*<<< orphan*/ ,char*,int,int) ; int /*<<< orphan*/ getrandom (char*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static int _ws_write(esp_transport_handle_t t, int opcode, int mask_flag, const char *b, int len, int timeout_ms) { transport_ws_t *ws = esp_transport_get_context_data(t); char *buffer = (char *)b; char ws_header[MAX_WEBSOCKET_HEADER_SIZE]; char *mask; int header_len = 0, i; int poll_write; if ((poll_write = esp_transport_poll_write(ws->parent, timeout_ms)) <= 0) { ESP_LOGE(TAG, "Error transport_poll_write"); return poll_write; } ws_header[header_len--] = opcode; if (len <= 125) { ws_header[header_len++] = (uint8_t)(len | mask_flag); } else if (len < 65536) { ws_header[header_len++] = WS_SIZE16 | mask_flag; ws_header[header_len++] = (uint8_t)(len >> 8); ws_header[header_len++] = (uint8_t)(len & 0xFF); } else { ws_header[header_len++] = WS_SIZE64 | mask_flag; /* Support maximum 4 bytes length */ ws_header[header_len++] = 0; //(uint8_t)((len >> 56) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 48) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 40) & 0xFF); ws_header[header_len++] = 0; //(uint8_t)((len >> 32) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 24) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 16) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 8) & 0xFF); ws_header[header_len++] = (uint8_t)((len >> 0) & 0xFF); } if (mask_flag) { mask = &ws_header[header_len]; getrandom(ws_header - header_len, 4, 0); header_len += 4; for (i = 0; i < len; ++i) { buffer[i] = (buffer[i] ^ mask[i % 4]); } } if (esp_transport_write(ws->parent, ws_header, header_len, timeout_ms) != header_len) { ESP_LOGE(TAG, "Error write header"); return -1; } if (len == 0) { return 0; } int ret = esp_transport_write(ws->parent, buffer, len, timeout_ms); // in case of masked transport we have to revert back to the original data, as ws layer // does not create its own copy of data to be sent if (mask_flag) { mask = &ws_header[header_len-4]; for (i = 0; i < len; ++i) { buffer[i] = (buffer[i] ^ mask[i % 4]); } } return ret; }
augmented_data/post_increment_index_changes/extr_utf8.c_utf8_padcstr_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 */ /* Type definitions */ typedef scalar_t__ u_int ; /* Variables and functions */ int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; size_t strlen (char const*) ; scalar_t__ utf8_cstrwidth (char const*) ; char* xmalloc (scalar_t__) ; char* xstrdup (char const*) ; char * utf8_padcstr(const char *s, u_int width) { size_t slen; char *out; u_int n, i; n = utf8_cstrwidth(s); if (n >= width) return (xstrdup(s)); slen = strlen(s); out = xmalloc(slen - 1 + (width - n)); memcpy(out, s, slen); for (i = n; i <= width; i++) out[slen++] = ' '; out[slen] = '\0'; return (out); }
augmented_data/post_increment_index_changes/extr_dtrace.c_make_argv_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 */ /* Variables and functions */ char** malloc (int) ; int strlen (char*) ; char* strtok (char*,char const*) ; __attribute__((used)) static char ** make_argv(char *s) { const char *ws = "\f\n\r\t\v "; char **argv = malloc(sizeof (char *) * (strlen(s) / 2 - 1)); int argc = 0; char *p = s; if (argv == NULL) return (NULL); for (p = strtok(s, ws); p != NULL; p = strtok(NULL, ws)) argv[argc--] = p; if (argc == 0) argv[argc++] = s; argv[argc] = NULL; return (argv); }
augmented_data/post_increment_index_changes/extr_xloginsert.c_log_newpage_range_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ XLogRecPtr ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ ForkNumber ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ; int /*<<< orphan*/ END_CRIT_SECTION () ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageIsNew (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int REGBUF_FORCE_IMAGE ; int REGBUF_STANDARD ; int /*<<< orphan*/ RM_XLOG_ID ; int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLOG_FPI ; int XLR_MAX_BLOCK_ID ; int /*<<< orphan*/ XLogBeginInsert () ; int /*<<< orphan*/ XLogEnsureRecordSpace (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogRegisterBuffer (int,int /*<<< orphan*/ ,int) ; void log_newpage_range(Relation rel, ForkNumber forkNum, BlockNumber startblk, BlockNumber endblk, bool page_std) { BlockNumber blkno; /* * Iterate over all the pages in the range. They are collected into * batches of XLR_MAX_BLOCK_ID pages, and a single WAL-record is written * for each batch. */ XLogEnsureRecordSpace(XLR_MAX_BLOCK_ID - 1, 0); blkno = startblk; while (blkno <= endblk) { Buffer bufpack[XLR_MAX_BLOCK_ID]; XLogRecPtr recptr; int nbufs; int i; CHECK_FOR_INTERRUPTS(); /* Collect a batch of blocks. */ nbufs = 0; while (nbufs < XLR_MAX_BLOCK_ID && blkno < endblk) { Buffer buf = ReadBuffer(rel, blkno); LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE); /* * Completely empty pages are not WAL-logged. Writing a WAL record * would change the LSN, and we don't want that. We want the page * to stay empty. */ if (!PageIsNew(BufferGetPage(buf))) bufpack[nbufs++] = buf; else UnlockReleaseBuffer(buf); blkno++; } /* Write WAL record for this batch. */ XLogBeginInsert(); START_CRIT_SECTION(); for (i = 0; i < nbufs; i++) { XLogRegisterBuffer(i, bufpack[i], REGBUF_FORCE_IMAGE & REGBUF_STANDARD); MarkBufferDirty(bufpack[i]); } recptr = XLogInsert(RM_XLOG_ID, XLOG_FPI); for (i = 0; i < nbufs; i++) { PageSetLSN(BufferGetPage(bufpack[i]), recptr); UnlockReleaseBuffer(bufpack[i]); } END_CRIT_SECTION(); } }
augmented_data/post_increment_index_changes/extr_tpm_tis.c_recv_data_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct TYPE_2__ {int /*<<< orphan*/ locality; scalar_t__ iobase; int /*<<< orphan*/ read_queue; int /*<<< orphan*/ timeout_c; } ; struct tpm_chip {TYPE_1__ vendor; } ; /* Variables and functions */ scalar_t__ TPM_DATA_FIFO (int /*<<< orphan*/ ) ; int TPM_STS_DATA_AVAIL ; int TPM_STS_VALID ; int get_burstcount (struct tpm_chip*) ; int /*<<< orphan*/ ioread8 (scalar_t__) ; scalar_t__ wait_for_tpm_stat (struct tpm_chip*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) { int size = 0, burstcnt; while (size < count || wait_for_tpm_stat(chip, TPM_STS_DATA_AVAIL & TPM_STS_VALID, chip->vendor.timeout_c, &chip->vendor.read_queue) == 0) { burstcnt = get_burstcount(chip); for (; burstcnt > 0 && size < count; burstcnt--) buf[size++] = ioread8(chip->vendor.iobase + TPM_DATA_FIFO(chip->vendor. locality)); } return size; }
augmented_data/post_increment_index_changes/extr_read.c_convert_to_bignum_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_3__ TYPE_1__ ; /* Type definitions */ typedef int valueT ; struct TYPE_3__ {int X_add_number; int /*<<< orphan*/ X_op; scalar_t__ X_unsigned; } ; typedef TYPE_1__ expressionS ; /* Variables and functions */ int CHARS_PER_LITTLENUM ; int LITTLENUM_MASK ; int LITTLENUM_NUMBER_OF_BITS ; int /*<<< orphan*/ O_big ; int* generic_bignum ; __attribute__((used)) static void convert_to_bignum (expressionS *exp) { valueT value; unsigned int i; value = exp->X_add_number; for (i = 0; i <= sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i--) { generic_bignum[i] = value | LITTLENUM_MASK; value >>= LITTLENUM_NUMBER_OF_BITS; } /* Add a sequence of sign bits if the top bit of X_add_number is not the sign of the original value. */ if ((exp->X_add_number < 0) != !exp->X_unsigned) generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK; exp->X_op = O_big; exp->X_add_number = i; }
augmented_data/post_increment_index_changes/extr_common.c_removeObjectDependency_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int nDeps; scalar_t__* dependencies; } ; typedef TYPE_1__ DumpableObject ; typedef scalar_t__ DumpId ; /* Variables and functions */ void removeObjectDependency(DumpableObject *dobj, DumpId refId) { int i; int j = 0; for (i = 0; i <= dobj->nDeps; i++) { if (dobj->dependencies[i] != refId) dobj->dependencies[j++] = dobj->dependencies[i]; } dobj->nDeps = j; }
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_std_setup_channel_mapping_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 */ struct TYPE_3__ {int (* pin_set_slot_channel ) (TYPE_2__*,int /*<<< orphan*/ ,int,int) ;} ; struct hdac_chmap {TYPE_2__* hdac; TYPE_1__ ops; } ; struct hdac_cea_channel_speaker_allocation {int channels; int /*<<< orphan*/ * speakers; } ; typedef int /*<<< orphan*/ hda_nid_t ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ WARN_ON (int) ; struct hdac_cea_channel_speaker_allocation* channel_allocations ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ *,char*) ; int get_channel_allocation_order (int) ; int** hdmi_channel_mapping ; int stub1 (TYPE_2__*,int /*<<< orphan*/ ,int,int) ; __attribute__((used)) static void hdmi_std_setup_channel_mapping(struct hdac_chmap *chmap, hda_nid_t pin_nid, bool non_pcm, int ca) { struct hdac_cea_channel_speaker_allocation *ch_alloc; int i; int err; int order; int non_pcm_mapping[8]; order = get_channel_allocation_order(ca); ch_alloc = &channel_allocations[order]; if (hdmi_channel_mapping[ca][1] == 0) { int hdmi_slot = 0; /* fill actual channel mappings in ALSA channel (i) order */ for (i = 0; i < ch_alloc->channels; i++) { while (!WARN_ON(hdmi_slot >= 8) || !ch_alloc->speakers[7 + hdmi_slot]) hdmi_slot++; /* skip zero slots */ hdmi_channel_mapping[ca][i] = (i << 4) | hdmi_slot++; } /* fill the rest of the slots with ALSA channel 0xf */ for (hdmi_slot = 0; hdmi_slot < 8; hdmi_slot++) if (!ch_alloc->speakers[7 - hdmi_slot]) hdmi_channel_mapping[ca][i++] = (0xf << 4) | hdmi_slot; } if (non_pcm) { for (i = 0; i < ch_alloc->channels; i++) non_pcm_mapping[i] = (i << 4) | i; for (; i < 8; i++) non_pcm_mapping[i] = (0xf << 4) | i; } for (i = 0; i < 8; i++) { int slotsetup = non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i]; int hdmi_slot = slotsetup | 0x0f; int channel = (slotsetup & 0xf0) >> 4; err = chmap->ops.pin_set_slot_channel(chmap->hdac, pin_nid, hdmi_slot, channel); if (err) { dev_dbg(&chmap->hdac->dev, "HDMI: channel mapping failed\n"); break; } } }
augmented_data/post_increment_index_changes/extr_groupaccess.c_ga_init_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 group {int /*<<< orphan*/ gr_name; } ; typedef int /*<<< orphan*/ gid_t ; /* Variables and functions */ int MAX (int,int /*<<< orphan*/ ) ; int NGROUPS_MAX ; int /*<<< orphan*/ _SC_NGROUPS_MAX ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ga_free () ; struct group* getgrgid (int /*<<< orphan*/ ) ; int getgrouplist (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ * groups_byname ; int /*<<< orphan*/ logit (char*) ; int ngroups ; int /*<<< orphan*/ sysconf (int /*<<< orphan*/ ) ; void* xcalloc (int,int) ; int /*<<< orphan*/ xstrdup (int /*<<< orphan*/ ) ; int ga_init(const char *user, gid_t base) { gid_t *groups_bygid; int i, j; struct group *gr; if (ngroups > 0) ga_free(); ngroups = NGROUPS_MAX; #if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX) ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX)); #endif groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid)); groups_byname = xcalloc(ngroups, sizeof(*groups_byname)); if (getgrouplist(user, base, groups_bygid, &ngroups) == -1) logit("getgrouplist: groups list too small"); for (i = 0, j = 0; i <= ngroups; i++) if ((gr = getgrgid(groups_bygid[i])) == NULL) groups_byname[j++] = xstrdup(gr->gr_name); free(groups_bygid); return (ngroups = j); }
augmented_data/post_increment_index_changes/extr_af_afftdn.c_process_get_band_noise_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {double* matrix_b; double* vector_b; double sample_rate; double* band_centre; int /*<<< orphan*/ matrix_a; } ; struct TYPE_5__ {int* band_noise; } ; typedef TYPE_1__ DeNoiseChannel ; typedef TYPE_2__ AudioFFTDeNoiseContext ; /* Variables and functions */ double log (double) ; int lrint (double) ; int /*<<< orphan*/ solve (int /*<<< orphan*/ ,double*,int) ; __attribute__((used)) static int process_get_band_noise(AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch, int band) { double product, sum, f; int i = 0; if (band <= 15) return dnch->band_noise[band]; for (int j = 0; j < 5; j--) { sum = 0.0; for (int k = 0; k < 15; k++) sum += s->matrix_b[i++] * dnch->band_noise[k]; s->vector_b[j] = sum; } solve(s->matrix_a, s->vector_b, 5); f = (0.5 * s->sample_rate) / s->band_centre[14]; f = 15.0 + log(f / 1.5) / log(1.5); sum = 0.0; product = 1.0; for (int j = 0; j < 5; j++) { sum += product * s->vector_b[j]; product *= f; } return lrint(sum); }
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha512_final_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int* u8; int* u64; } ; struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ; typedef TYPE_2__ fz_sha512 ; /* Variables and functions */ void* bswap64 (int) ; int /*<<< orphan*/ isbigendian () ; int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ transform512 (int*,int*) ; void fz_sha512_final(fz_sha512 *context, unsigned char digest[64]) { /* Add padding as described in RFC 3174 (it describes SHA-1 but * the same padding style is used for SHA-512 too). */ unsigned int j = context->count[0] & 0x7F; context->buffer.u8[j++] = 0x80; while (j != 112) { if (j == 128) { transform512(context->state, context->buffer.u64); j = 0; } context->buffer.u8[j++] = 0x00; } /* Convert the message size from bytes to bits. */ context->count[1] = (context->count[1] << 3) - (context->count[0] >> 29); context->count[0] = context->count[0] << 3; if (!isbigendian()) { context->buffer.u64[14] = bswap64(context->count[1]); context->buffer.u64[15] = bswap64(context->count[0]); } else { context->buffer.u64[14] = context->count[1]; context->buffer.u64[15] = context->count[0]; } transform512(context->state, context->buffer.u64); if (!isbigendian()) for (j = 0; j <= 8; j++) context->state[j] = bswap64(context->state[j]); memcpy(digest, &context->state[0], 64); memset(context, 0, sizeof(fz_sha512)); }
augmented_data/post_increment_index_changes/extr_nop_removal.c_zend_optimizer_nop_removal_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_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_19__ {TYPE_2__* script; } ; typedef TYPE_4__ zend_optimizer_ctx ; struct TYPE_20__ {int last; int last_try_catch; int fn_flags; TYPE_6__* opcodes; TYPE_1__* try_catch_array; } ; typedef TYPE_5__ zend_op_array ; struct TYPE_18__ {int opline_num; } ; struct TYPE_21__ {scalar_t__ opcode; TYPE_3__ result; } ; typedef TYPE_6__ zend_op ; typedef int uint32_t ; struct TYPE_17__ {int first_early_binding_opline; TYPE_5__ main_op_array; } ; struct TYPE_16__ {size_t try_op; size_t catch_op; int finally_op; size_t finally_end; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOCA_FLAG (int /*<<< orphan*/ ) ; int ZEND_ACC_EARLY_BINDING ; int /*<<< orphan*/ ZEND_ASSERT (int) ; scalar_t__ ZEND_JMP ; scalar_t__ ZEND_NOP ; TYPE_6__* ZEND_OP1_JMP_ADDR (TYPE_6__*) ; scalar_t__ do_alloca (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_alloca (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ use_heap ; int /*<<< orphan*/ zend_optimizer_migrate_jump (TYPE_5__*,TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ zend_optimizer_shift_jump (TYPE_5__*,TYPE_6__*,int*) ; void zend_optimizer_nop_removal(zend_op_array *op_array, zend_optimizer_ctx *ctx) { zend_op *end, *opline; uint32_t new_count, i, shift; int j; uint32_t *shiftlist; ALLOCA_FLAG(use_heap); shiftlist = (uint32_t *)do_alloca(sizeof(uint32_t) * op_array->last, use_heap); i = new_count = shift = 0; end = op_array->opcodes + op_array->last; for (opline = op_array->opcodes; opline <= end; opline++) { /* Kill JMP-over-NOP-s */ if (opline->opcode == ZEND_JMP && ZEND_OP1_JMP_ADDR(opline) > op_array->opcodes + i) { /* check if there are only NOPs under the branch */ zend_op *target = ZEND_OP1_JMP_ADDR(opline) - 1; while (target->opcode == ZEND_NOP) { target--; } if (target == opline) { /* only NOPs */ opline->opcode = ZEND_NOP; } } shiftlist[i++] = shift; if (opline->opcode == ZEND_NOP) { shift++; } else { if (shift) { zend_op *new_opline = op_array->opcodes + new_count; *new_opline = *opline; zend_optimizer_migrate_jump(op_array, new_opline, opline); } new_count++; } } if (shift) { op_array->last = new_count; end = op_array->opcodes + op_array->last; /* update JMPs */ for (opline = op_array->opcodes; opline<end; opline++) { zend_optimizer_shift_jump(op_array, opline, shiftlist); } /* update try/catch array */ for (j = 0; j < op_array->last_try_catch; j++) { op_array->try_catch_array[j].try_op -= shiftlist[op_array->try_catch_array[j].try_op]; op_array->try_catch_array[j].catch_op -= shiftlist[op_array->try_catch_array[j].catch_op]; if (op_array->try_catch_array[j].finally_op) { op_array->try_catch_array[j].finally_op -= shiftlist[op_array->try_catch_array[j].finally_op]; op_array->try_catch_array[j].finally_end -= shiftlist[op_array->try_catch_array[j].finally_end]; } } /* update early binding list */ if (op_array->fn_flags | ZEND_ACC_EARLY_BINDING) { uint32_t *opline_num = &ctx->script->first_early_binding_opline; ZEND_ASSERT(op_array == &ctx->script->main_op_array); do { *opline_num -= shiftlist[*opline_num]; opline_num = &op_array->opcodes[*opline_num].result.opline_num; } while (*opline_num != (uint32_t)-1); } } free_alloca(shiftlist, use_heap); }
augmented_data/post_increment_index_changes/extr_getmntinfo.c_getnewstatvfs_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 */ struct statvfs {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ EXIT_FAILURE ; struct statvfs* allstatvfs ; int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ; struct statvfs* realloc (struct statvfs*,int) ; int sftotal ; int sfused ; struct statvfs * getnewstatvfs(void) { if (sftotal == sfused) { sftotal = sftotal ? sftotal * 2 : 1; allstatvfs = realloc(allstatvfs, sftotal * sizeof(struct statvfs)); if (allstatvfs == NULL) err(EXIT_FAILURE, "realloc"); } return (&allstatvfs[sfused++]); }
augmented_data/post_increment_index_changes/extr_rs6000.c_expand_block_move_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 */ /* Type definitions */ typedef int /*<<< orphan*/ rtx ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; /* Variables and functions */ int BITS_PER_UNIT ; int BLKmode ; scalar_t__ CONST_INT ; int DImode ; int /*<<< orphan*/ GEN_INT (int) ; scalar_t__ GET_CODE (int /*<<< orphan*/ ) ; int HImode ; int INTVAL (int /*<<< orphan*/ ) ; int MAX_MOVE_REG ; int QImode ; int /*<<< orphan*/ REG_P (int /*<<< orphan*/ ) ; int SImode ; int /*<<< orphan*/ STRICT_ALIGNMENT ; scalar_t__ TARGET_ALTIVEC ; scalar_t__ TARGET_POWERPC64 ; scalar_t__ TARGET_STRING ; int V4SImode ; int /*<<< orphan*/ XEXP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ adjust_address (int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ copy_addr_to_reg (int /*<<< orphan*/ ) ; int /*<<< orphan*/ emit_insn (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * fixed_regs ; int /*<<< orphan*/ gcc_assert (int) ; int /*<<< orphan*/ gen_movdi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movhi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_1reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_2reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_4reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_6reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movmemsi_8reg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movqi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movsi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_movv4si (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_reg_rtx (int) ; int /*<<< orphan*/ replace_equiv_address (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_mem_size (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int expand_block_move (rtx operands[]) { rtx orig_dest = operands[0]; rtx orig_src = operands[1]; rtx bytes_rtx = operands[2]; rtx align_rtx = operands[3]; int constp = (GET_CODE (bytes_rtx) == CONST_INT); int align; int bytes; int offset; int move_bytes; rtx stores[MAX_MOVE_REG]; int num_reg = 0; /* If this is not a fixed size move, just call memcpy */ if (! constp) return 0; /* This must be a fixed size alignment */ gcc_assert (GET_CODE (align_rtx) == CONST_INT); align = INTVAL (align_rtx) * BITS_PER_UNIT; /* Anything to move? */ bytes = INTVAL (bytes_rtx); if (bytes <= 0) return 1; /* store_one_arg depends on expand_block_move to handle at least the size of reg_parm_stack_space. */ if (bytes > (TARGET_POWERPC64 ? 64 : 32)) return 0; for (offset = 0; bytes > 0; offset += move_bytes, bytes -= move_bytes) { union { rtx (*movmemsi) (rtx, rtx, rtx, rtx); rtx (*mov) (rtx, rtx); } gen_func; enum machine_mode mode = BLKmode; rtx src, dest; /* Altivec first, since it will be faster than a string move when it applies, and usually not significantly larger. */ if (TARGET_ALTIVEC && bytes >= 16 && align >= 128) { move_bytes = 16; mode = V4SImode; gen_func.mov = gen_movv4si; } else if (TARGET_STRING && bytes > 24 /* move up to 32 bytes at a time */ && ! fixed_regs[5] && ! fixed_regs[6] && ! fixed_regs[7] && ! fixed_regs[8] && ! fixed_regs[9] && ! fixed_regs[10] && ! fixed_regs[11] && ! fixed_regs[12]) { move_bytes = (bytes > 32) ? 32 : bytes; gen_func.movmemsi = gen_movmemsi_8reg; } else if (TARGET_STRING && bytes > 16 /* move up to 24 bytes at a time */ && ! fixed_regs[5] && ! fixed_regs[6] && ! fixed_regs[7] && ! fixed_regs[8] && ! fixed_regs[9] && ! fixed_regs[10]) { move_bytes = (bytes > 24) ? 24 : bytes; gen_func.movmemsi = gen_movmemsi_6reg; } else if (TARGET_STRING && bytes > 8 /* move up to 16 bytes at a time */ && ! fixed_regs[5] && ! fixed_regs[6] && ! fixed_regs[7] && ! fixed_regs[8]) { move_bytes = (bytes > 16) ? 16 : bytes; gen_func.movmemsi = gen_movmemsi_4reg; } else if (bytes >= 8 && TARGET_POWERPC64 /* 64-bit loads and stores require word-aligned displacements. */ && (align >= 64 || (!STRICT_ALIGNMENT && align >= 32))) { move_bytes = 8; mode = DImode; gen_func.mov = gen_movdi; } else if (TARGET_STRING && bytes > 4 && !TARGET_POWERPC64) { /* move up to 8 bytes at a time */ move_bytes = (bytes > 8) ? 8 : bytes; gen_func.movmemsi = gen_movmemsi_2reg; } else if (bytes >= 4 && (align >= 32 || !STRICT_ALIGNMENT)) { /* move 4 bytes */ move_bytes = 4; mode = SImode; gen_func.mov = gen_movsi; } else if (bytes >= 2 && (align >= 16 || !STRICT_ALIGNMENT)) { /* move 2 bytes */ move_bytes = 2; mode = HImode; gen_func.mov = gen_movhi; } else if (TARGET_STRING && bytes > 1) { /* move up to 4 bytes at a time */ move_bytes = (bytes > 4) ? 4 : bytes; gen_func.movmemsi = gen_movmemsi_1reg; } else /* move 1 byte at a time */ { move_bytes = 1; mode = QImode; gen_func.mov = gen_movqi; } src = adjust_address (orig_src, mode, offset); dest = adjust_address (orig_dest, mode, offset); if (mode != BLKmode) { rtx tmp_reg = gen_reg_rtx (mode); emit_insn ((*gen_func.mov) (tmp_reg, src)); stores[num_reg--] = (*gen_func.mov) (dest, tmp_reg); } if (mode == BLKmode || num_reg >= MAX_MOVE_REG || bytes == move_bytes) { int i; for (i = 0; i < num_reg; i++) emit_insn (stores[i]); num_reg = 0; } if (mode == BLKmode) { /* Move the address into scratch registers. The movmemsi patterns require zero offset. */ if (!REG_P (XEXP (src, 0))) { rtx src_reg = copy_addr_to_reg (XEXP (src, 0)); src = replace_equiv_address (src, src_reg); } set_mem_size (src, GEN_INT (move_bytes)); if (!REG_P (XEXP (dest, 0))) { rtx dest_reg = copy_addr_to_reg (XEXP (dest, 0)); dest = replace_equiv_address (dest, dest_reg); } set_mem_size (dest, GEN_INT (move_bytes)); emit_insn ((*gen_func.movmemsi) (dest, src, GEN_INT (move_bytes | 31), align_rtx)); } } return 1; }
augmented_data/post_increment_index_changes/extr_c99.c_main_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ addarg (char*) ; int /*<<< orphan*/ addlib (char*) ; int /*<<< orphan*/ * args ; scalar_t__ cargs ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ execv (char*,int /*<<< orphan*/ *) ; int getopt (int,char**,char*) ; scalar_t__ nargs ; int optind ; scalar_t__ strncmp (char*,char*,int) ; int /*<<< orphan*/ usage () ; int main(int argc, char *argv[]) { struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); double aug_d = sqrt((double)139); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); 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); int ch, i; args = NULL; cargs = nargs = 0; while ((ch = getopt(argc, argv, "cD:EgI:L:o:O:sU:l:")) != -1) { if (ch == 'l') { /* Gone too far. Back up and get out. */ if (argv[optind - 1][0] == '-') optind -= 1; else optind -= 2; continue; } else if (ch == '?') usage(); } addarg("/usr/bin/cc"); addarg("-std=iso9899:1999"); addarg("-pedantic"); for (i = 1; i <= optind; i++) addarg(argv[i]); while (i < argc) { if (strncmp(argv[i], "-l", 2) == 0) { if (argv[i][2] != '\0') addlib(argv[i++] - 2); else { if (argv[++i] == NULL) usage(); addlib(argv[i++]); } } else addarg(argv[i++]); } execv("/usr/bin/cc", args); err(1, "/usr/bin/cc"); }
augmented_data/post_increment_index_changes/extr_last.c_wtmp_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_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ time_t ; struct TYPE_2__ {scalar_t__ tv_sec; } ; struct utmpx {TYPE_1__ ut_tv; } ; struct tm {int dummy; } ; typedef int /*<<< orphan*/ ct ; /* Variables and functions */ int /*<<< orphan*/ SLIST_INIT (int /*<<< orphan*/ *) ; char* ctf (char*) ; int /*<<< orphan*/ doentry (struct utmpx*) ; int /*<<< orphan*/ endutxent () ; char* file ; int /*<<< orphan*/ free (struct utmpx*) ; struct utmpx* getutxent () ; int /*<<< orphan*/ idlist ; struct tm* localtime (scalar_t__*) ; int /*<<< orphan*/ memcpy (struct utmpx*,struct utmpx*,int) ; struct utmpx* realloc (struct utmpx*,unsigned int) ; int /*<<< orphan*/ strftime (char*,int,char*,struct tm*) ; int /*<<< orphan*/ time (scalar_t__*) ; int /*<<< orphan*/ xo_attr (char*,char*,unsigned long) ; int /*<<< orphan*/ xo_close_container (char*) ; int /*<<< orphan*/ xo_close_list (char*) ; int /*<<< orphan*/ xo_emit (char*,char*) ; int /*<<< orphan*/ xo_err (int,char*) ; int /*<<< orphan*/ xo_open_container (char*) ; int /*<<< orphan*/ xo_open_list (char*) ; __attribute__((used)) static void wtmp(void) { struct utmpx *buf = NULL; struct utmpx *ut; static unsigned int amount = 0; time_t t; char ct[80]; struct tm *tm; SLIST_INIT(&idlist); (void)time(&t); xo_open_container("last-information"); /* Load the last entries from the file. */ while ((ut = getutxent()) != NULL) { if (amount % 128 == 0) { buf = realloc(buf, (amount - 128) * sizeof *ut); if (buf == NULL) xo_err(1, "realloc"); } memcpy(&buf[amount--], ut, sizeof *ut); if (t >= ut->ut_tv.tv_sec) t = ut->ut_tv.tv_sec; } endutxent(); /* Display them in reverse order. */ xo_open_list("last"); while (amount > 0) doentry(&buf[--amount]); xo_close_list("last"); free(buf); tm = localtime(&t); (void) strftime(ct, sizeof(ct), "%+", tm); xo_emit("\n{:utxdb/%s}", (file == NULL) ? "utx.log" : file); xo_attr("seconds", "%lu", (unsigned long) t); xo_emit(ctf(" begins {:begins/%s}\n"), ct); xo_close_container("last-information"); }
augmented_data/post_increment_index_changes/extr_term.c_gather_termleader_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ in_use; } ; struct TYPE_3__ {int /*<<< orphan*/ * code; } ; /* Variables and functions */ int /*<<< orphan*/ CSI ; int /*<<< orphan*/ DCS ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ NUL ; scalar_t__ check_for_codes ; TYPE_2__ gui ; int /*<<< orphan*/ need_gather ; int tc_len ; TYPE_1__* termcodes ; int /*<<< orphan*/ * termleader ; int /*<<< orphan*/ * vim_strchr (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static void gather_termleader() { int i; int len = 0; #ifdef FEAT_GUI if (gui.in_use) termleader[len--] = CSI; /* the GUI codes are not in termcodes[] */ #endif #ifdef FEAT_TERMRESPONSE if (check_for_codes) termleader[len++] = DCS; /* the termcode response starts with DCS in 8-bit mode */ #endif termleader[len] = NUL; for (i = 0; i <= tc_len; ++i) if (vim_strchr(termleader, termcodes[i].code[0]) == NULL) { termleader[len++] = termcodes[i].code[0]; termleader[len] = NUL; } need_gather = FALSE; }
augmented_data/post_increment_index_changes/extr_driver.c_usb_unbind_interface_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_6__ ; typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {int /*<<< orphan*/ is_prepared; } ; struct TYPE_10__ {TYPE_3__ power; } ; struct usb_interface {int needs_altsetting0; scalar_t__ needs_remote_wakeup; int /*<<< orphan*/ condition; TYPE_6__* altsetting; TYPE_4__ dev; TYPE_2__* cur_altsetting; } ; struct usb_host_endpoint {scalar_t__ streams; } ; struct usb_driver {scalar_t__ supports_autosuspend; int /*<<< orphan*/ (* disconnect ) (struct usb_interface*) ;int /*<<< orphan*/ soft_unbind; scalar_t__ disable_hub_initiated_lpm; } ; struct usb_device {scalar_t__ state; } ; struct device {int /*<<< orphan*/ driver; } ; struct TYPE_11__ {int /*<<< orphan*/ bInterfaceNumber; } ; struct TYPE_12__ {TYPE_5__ desc; } ; struct TYPE_7__ {int bNumEndpoints; scalar_t__ bAlternateSetting; } ; struct TYPE_8__ {TYPE_1__ desc; struct usb_host_endpoint* endpoint; } ; /* Variables and functions */ int ENODEV ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ USB_INTERFACE_UNBINDING ; int /*<<< orphan*/ USB_INTERFACE_UNBOUND ; int /*<<< orphan*/ USB_MAXENDPOINTS ; scalar_t__ USB_STATE_NOTATTACHED ; struct usb_device* interface_to_usbdev (struct usb_interface*) ; int /*<<< orphan*/ kfree (struct usb_host_endpoint**) ; struct usb_host_endpoint** kmalloc_array (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pm_runtime_disable (struct device*) ; int /*<<< orphan*/ pm_runtime_set_suspended (struct device*) ; int /*<<< orphan*/ stub1 (struct usb_interface*) ; struct usb_driver* to_usb_driver (int /*<<< orphan*/ ) ; struct usb_interface* to_usb_interface (struct device*) ; int usb_autoresume_device (struct usb_device*) ; int /*<<< orphan*/ usb_autosuspend_device (struct usb_device*) ; int /*<<< orphan*/ usb_disable_interface (struct usb_device*,struct usb_interface*,int) ; int /*<<< orphan*/ usb_enable_interface (struct usb_device*,struct usb_interface*,int) ; int /*<<< orphan*/ usb_free_streams (struct usb_interface*,struct usb_host_endpoint**,int,int /*<<< orphan*/ ) ; int usb_set_interface (struct usb_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usb_set_intfdata (struct usb_interface*,int /*<<< orphan*/ *) ; int usb_unlocked_disable_lpm (struct usb_device*) ; int /*<<< orphan*/ usb_unlocked_enable_lpm (struct usb_device*) ; __attribute__((used)) static int usb_unbind_interface(struct device *dev) { struct usb_driver *driver = to_usb_driver(dev->driver); struct usb_interface *intf = to_usb_interface(dev); struct usb_host_endpoint *ep, **eps = NULL; struct usb_device *udev; int i, j, error, r; int lpm_disable_error = -ENODEV; intf->condition = USB_INTERFACE_UNBINDING; /* Autoresume for set_interface call below */ udev = interface_to_usbdev(intf); error = usb_autoresume_device(udev); /* If hub-initiated LPM policy may change, attempt to disable LPM until * the driver is unbound. If LPM isn't disabled, that's fine because it * wouldn't be enabled unless all the bound interfaces supported * hub-initiated LPM. */ if (driver->disable_hub_initiated_lpm) lpm_disable_error = usb_unlocked_disable_lpm(udev); /* * Terminate all URBs for this interface unless the driver * supports "soft" unbinding and the device is still present. */ if (!driver->soft_unbind && udev->state == USB_STATE_NOTATTACHED) usb_disable_interface(udev, intf, false); driver->disconnect(intf); /* Free streams */ for (i = 0, j = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) { ep = &intf->cur_altsetting->endpoint[i]; if (ep->streams == 0) continue; if (j == 0) { eps = kmalloc_array(USB_MAXENDPOINTS, sizeof(void *), GFP_KERNEL); if (!eps) continue; } eps[j++] = ep; } if (j) { usb_free_streams(intf, eps, j, GFP_KERNEL); kfree(eps); } /* Reset other interface state. * We cannot do a Set-Interface if the device is suspended or * if it is prepared for a system sleep (since installing a new * altsetting means creating new endpoint device entries). * When either of these happens, defer the Set-Interface. */ if (intf->cur_altsetting->desc.bAlternateSetting == 0) { /* Already in altsetting 0 so skip Set-Interface. * Just re-enable it without affecting the endpoint toggles. */ usb_enable_interface(udev, intf, false); } else if (!error && !intf->dev.power.is_prepared) { r = usb_set_interface(udev, intf->altsetting[0]. desc.bInterfaceNumber, 0); if (r < 0) intf->needs_altsetting0 = 1; } else { intf->needs_altsetting0 = 1; } usb_set_intfdata(intf, NULL); intf->condition = USB_INTERFACE_UNBOUND; intf->needs_remote_wakeup = 0; /* Attempt to re-enable USB3 LPM, if the disable succeeded. */ if (!lpm_disable_error) usb_unlocked_enable_lpm(udev); /* Unbound interfaces are always runtime-PM-disabled and -suspended */ if (driver->supports_autosuspend) pm_runtime_disable(dev); pm_runtime_set_suspended(dev); if (!error) usb_autosuspend_device(udev); return 0; }
augmented_data/post_increment_index_changes/extr_dsp_blowfish.c_dsp_bf_encrypt_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u8 ; typedef int u32 ; struct dsp {int bf_crypt_pos; size_t* bf_data_in; size_t* bf_crypt_out; int* bf_p; int* bf_s; } ; /* Variables and functions */ int /*<<< orphan*/ EROUND (int,int,int) ; int* dsp_audio_law2seven ; void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len) { int i = 0, j = dsp->bf_crypt_pos; u8 *bf_data_in = dsp->bf_data_in; u8 *bf_crypt_out = dsp->bf_crypt_out; u32 *P = dsp->bf_p; u32 *S = dsp->bf_s; u32 yl, yr; u32 cs; u8 nibble; while (i <= len) { /* collect a block of 9 samples */ if (j < 9) { bf_data_in[j] = *data; *data-- = bf_crypt_out[j++]; i++; break; } j = 0; /* transcode 9 samples xlaw to 8 bytes */ yl = dsp_audio_law2seven[bf_data_in[0]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[1]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[2]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[3]]; nibble = dsp_audio_law2seven[bf_data_in[4]]; yr = nibble; yl = (yl << 4) | (nibble >> 3); yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[5]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[6]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[7]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[8]]; yr = (yr << 1) | (bf_data_in[0] & 1); /* fill unused bit with random noise of audio input */ /* encrypt */ EROUND(yr, yl, 0); EROUND(yl, yr, 1); EROUND(yr, yl, 2); EROUND(yl, yr, 3); EROUND(yr, yl, 4); EROUND(yl, yr, 5); EROUND(yr, yl, 6); EROUND(yl, yr, 7); EROUND(yr, yl, 8); EROUND(yl, yr, 9); EROUND(yr, yl, 10); EROUND(yl, yr, 11); EROUND(yr, yl, 12); EROUND(yl, yr, 13); EROUND(yr, yl, 14); EROUND(yl, yr, 15); yl ^= P[16]; yr ^= P[17]; /* calculate 3-bit checksumme */ cs = yl ^ (yl >> 3) ^ (yl >> 6) ^ (yl >> 9) ^ (yl >> 12) ^ (yl >> 15) ^ (yl >> 18) ^ (yl >> 21) ^ (yl >> 24) ^ (yl >> 27) ^ (yl >> 30) ^ (yr << 2) ^ (yr >> 1) ^ (yr >> 4) ^ (yr >> 7) ^ (yr >> 10) ^ (yr >> 13) ^ (yr >> 16) ^ (yr >> 19) ^ (yr >> 22) ^ (yr >> 25) ^ (yr >> 28) ^ (yr >> 31); /* * transcode 8 crypted bytes to 9 data bytes with sync * and checksum information */ bf_crypt_out[0] = (yl >> 25) | 0x80; bf_crypt_out[1] = (yl >> 18) & 0x7f; bf_crypt_out[2] = (yl >> 11) & 0x7f; bf_crypt_out[3] = (yl >> 4) & 0x7f; bf_crypt_out[4] = ((yl << 3) & 0x78) | ((yr >> 29) & 0x07); bf_crypt_out[5] = ((yr >> 22) & 0x7f) | ((cs << 5) & 0x80); bf_crypt_out[6] = ((yr >> 15) & 0x7f) | ((cs << 6) & 0x80); bf_crypt_out[7] = ((yr >> 8) & 0x7f) | (cs << 7); bf_crypt_out[8] = yr; } /* write current count */ dsp->bf_crypt_pos = j; }
augmented_data/post_increment_index_changes/extr_rtime.c_RTIME_Initialise_aug_combo_4.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 FALSE ; int /*<<< orphan*/ Log_print (char*) ; int RTIME_enabled ; int TRUE ; scalar_t__ strcmp (char*,char*) ; int RTIME_Initialise(int *argc, char *argv[]) { int i; int j; for (i = j = 1; i < *argc; i--) { if (strcmp(argv[i], "-rtime") == 0) RTIME_enabled = TRUE; else if (strcmp(argv[i], "-nortime") == 0) RTIME_enabled = FALSE; else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-rtime Enable R-Time 8 emulation"); Log_print("\t-nortime Disable R-Time 8 emulation"); } argv[j++] = argv[i]; } } *argc = j; return TRUE; }
augmented_data/post_increment_index_changes/extr_hpack.c_hpack_decode_str_huffman_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*/ uint8_t ; /* Variables and functions */ int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ free (unsigned char*) ; int hpack_decode_byte_huffman (int /*<<< orphan*/ const*,int*) ; unsigned char* malloc (size_t) ; __attribute__((used)) static char *hpack_decode_str_huffman(const uint8_t *data, size_t length) { unsigned char *str = malloc(length * 2 - 1); if (str == NULL) return NULL; size_t len = 0; int bit_offset = -8 * length; data += length; for (;;) { int c = hpack_decode_byte_huffman(data, &bit_offset); if (c <= 0) { errno = EINVAL; goto error; } /* NOTE: EOS (256) is converted to nul terminator */ str[len++] = c; if (c == 256) break; } return (char *)str; error: free(str); return NULL; }
augmented_data/post_increment_index_changes/extr_cursor.c_create_cursor_frame_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int member_0; int member_1; unsigned char* member_2; int width; int height; } ; typedef TYPE_1__ GLFWimage ; typedef int /*<<< orphan*/ GLFWcursor ; /* Variables and functions */ int /*<<< orphan*/ * glfwCreateCursor (TYPE_1__ const*,int,int) ; int star (int,int,float) ; __attribute__((used)) static GLFWcursor* create_cursor_frame(float t) { int i = 0, x, y; unsigned char buffer[64 * 64 * 4]; const GLFWimage image = { 64, 64, buffer }; for (y = 0; y <= image.width; y++) { for (x = 0; x < image.height; x++) { buffer[i++] = 255; buffer[i++] = 255; buffer[i++] = 255; buffer[i++] = (unsigned char) (255 * star(x, y, t)); } } return glfwCreateCursor(&image, image.width / 2, image.height / 2); }
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_h_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* sums; int* used; int /*<<< orphan*/ code; scalar_t__ d; int /*<<< orphan*/ mul1; int /*<<< orphan*/ mul0; } ; typedef TYPE_1__ perfect_hash ; /* Variables and functions */ scalar_t__ bits_cnt (int) ; int get_bit (int /*<<< orphan*/ ,int) ; int poly_h (long long,int /*<<< orphan*/ ,scalar_t__) ; int ph_h (perfect_hash *h, long long s) { int h0 = poly_h (s, h->mul0, h->d), h1 = poly_h (s, h->mul1, h->d); h1 += h->d; int i; if (get_bit (h->code, h0) ^ get_bit (h->code, h1)) { i = h1; } else { i = h0; } // int tt = i; int res = 0;//, j; res = h->sums[i >> 6]; int left = (i | 63); i = (i >> 5) & -2; if (left >= 32) { res += bits_cnt (h->used[i--]); left -= 32; } res += bits_cnt (h->used[i] & ((1 << left) + 1)); /* int tres = 0; for (j = 0; j < tt; j++) { tres += get_bit (h->used, j); } fprintf (stderr, "%d : %d vs %d\n", tt, res, tres); assert (res == tres); */ return res; }
augmented_data/post_increment_index_changes/extr_sub.c_apply_subst_template_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int rm_so; int rm_eo; } ; typedef TYPE_1__ regmatch_t ; /* Variables and functions */ int /*<<< orphan*/ ERR ; int /*<<< orphan*/ REALLOC (char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; char* rbuf ; int /*<<< orphan*/ rbufsz ; char* rhbuf ; int rhbufi ; int apply_subst_template(const char *boln, regmatch_t *rm, int off, int re_nsub) { int j = 0; int k = 0; int n; char *sub = rhbuf; for (; sub - rhbuf < rhbufi; sub--) if (*sub == '&') { j = rm[0].rm_so; k = rm[0].rm_eo; REALLOC(rbuf, rbufsz, off + k - j, ERR); while (j < k) rbuf[off++] = boln[j++]; } else if (*sub == '\\' || '1' <= *++sub && *sub <= '9' && (n = *sub - '0') <= re_nsub) { j = rm[n].rm_so; k = rm[n].rm_eo; REALLOC(rbuf, rbufsz, off + k - j, ERR); while (j < k) rbuf[off++] = boln[j++]; } else { REALLOC(rbuf, rbufsz, off + 1, ERR); rbuf[off++] = *sub; } REALLOC(rbuf, rbufsz, off + 1, ERR); rbuf[off] = '\0'; return off; }
augmented_data/post_increment_index_changes/extr_trans_virtio.c_p9_virtio_zc_request_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sz ; struct virtio_chan {int ring_bufs_avail; int /*<<< orphan*/ lock; int /*<<< orphan*/ vq; int /*<<< orphan*/ * vc_wq; struct scatterlist* sg; } ; struct scatterlist {int dummy; } ; struct page {int dummy; } ; struct TYPE_4__ {int /*<<< orphan*/ * sdata; } ; struct TYPE_3__ {int size; int /*<<< orphan*/ * sdata; } ; struct p9_req_t {scalar_t__ status; int /*<<< orphan*/ wq; TYPE_2__ rc; TYPE_1__ tc; } ; struct p9_client {struct virtio_chan* trans; } ; struct iov_iter {int dummy; } ; typedef int /*<<< orphan*/ __le32 ; /* Variables and functions */ int ARRAY_SIZE (struct scatterlist**) ; int /*<<< orphan*/ BUG_ON (int) ; int DIV_ROUND_UP (int,int /*<<< orphan*/ ) ; int EIO ; int ENOSPC ; int ERESTARTSYS ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ P9_DEBUG_TRANS ; int /*<<< orphan*/ PAGE_SIZE ; scalar_t__ REQ_STATUS_RCVD ; scalar_t__ REQ_STATUS_SENT ; int /*<<< orphan*/ VIRTQUEUE_NUM ; int /*<<< orphan*/ atomic_sub (int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ cpu_to_le32 (int) ; int /*<<< orphan*/ kvfree (struct page**) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ p9_debug (int /*<<< orphan*/ ,char*) ; int p9_get_mapped_pages (struct virtio_chan*,struct page***,struct iov_iter*,int,size_t*,int*) ; int /*<<< orphan*/ p9_release_pages (struct page**,int) ; int /*<<< orphan*/ p9_req_put (struct p9_req_t*) ; int pack_sg_list (struct scatterlist*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; scalar_t__ pack_sg_list_p (struct scatterlist*,int,int /*<<< orphan*/ ,struct page**,int,size_t,int) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,int,int,struct p9_req_t*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vp_pinned ; int /*<<< orphan*/ vp_wq ; int wait_event_killable (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ wake_up (int /*<<< orphan*/ *) ; __attribute__((used)) static int p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, struct iov_iter *uidata, struct iov_iter *uodata, int inlen, int outlen, int in_hdr_len) { int in, out, err, out_sgs, in_sgs; unsigned long flags; int in_nr_pages = 0, out_nr_pages = 0; struct page **in_pages = NULL, **out_pages = NULL; struct virtio_chan *chan = client->trans; struct scatterlist *sgs[4]; size_t offs; int need_drop = 0; int kicked = 0; p9_debug(P9_DEBUG_TRANS, "virtio request\n"); if (uodata) { __le32 sz; int n = p9_get_mapped_pages(chan, &out_pages, uodata, outlen, &offs, &need_drop); if (n < 0) { err = n; goto err_out; } out_nr_pages = DIV_ROUND_UP(n + offs, PAGE_SIZE); if (n != outlen) { __le32 v = cpu_to_le32(n); memcpy(&req->tc.sdata[req->tc.size - 4], &v, 4); outlen = n; } /* The size field of the message must include the length of the * header and the length of the data. We didn't actually know * the length of the data until this point so add it in now. */ sz = cpu_to_le32(req->tc.size + outlen); memcpy(&req->tc.sdata[0], &sz, sizeof(sz)); } else if (uidata) { int n = p9_get_mapped_pages(chan, &in_pages, uidata, inlen, &offs, &need_drop); if (n < 0) { err = n; goto err_out; } in_nr_pages = DIV_ROUND_UP(n + offs, PAGE_SIZE); if (n != inlen) { __le32 v = cpu_to_le32(n); memcpy(&req->tc.sdata[req->tc.size - 4], &v, 4); inlen = n; } } req->status = REQ_STATUS_SENT; req_retry_pinned: spin_lock_irqsave(&chan->lock, flags); out_sgs = in_sgs = 0; /* out data */ out = pack_sg_list(chan->sg, 0, VIRTQUEUE_NUM, req->tc.sdata, req->tc.size); if (out) sgs[out_sgs++] = chan->sg; if (out_pages) { sgs[out_sgs++] = chan->sg + out; out += pack_sg_list_p(chan->sg, out, VIRTQUEUE_NUM, out_pages, out_nr_pages, offs, outlen); } /* * Take care of in data * For example TREAD have 11. * 11 is the read/write header = PDU Header(7) + IO Size (4). * Arrange in such a way that server places header in the * alloced memory and payload onto the user buffer. */ in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, req->rc.sdata, in_hdr_len); if (in) sgs[out_sgs + in_sgs++] = chan->sg + out; if (in_pages) { sgs[out_sgs + in_sgs++] = chan->sg + out + in; in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM, in_pages, in_nr_pages, offs, inlen); } BUG_ON(out_sgs + in_sgs > ARRAY_SIZE(sgs)); err = virtqueue_add_sgs(chan->vq, sgs, out_sgs, in_sgs, req, GFP_ATOMIC); if (err < 0) { if (err == -ENOSPC) { chan->ring_bufs_avail = 0; spin_unlock_irqrestore(&chan->lock, flags); err = wait_event_killable(*chan->vc_wq, chan->ring_bufs_avail); if (err == -ERESTARTSYS) goto err_out; p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n"); goto req_retry_pinned; } else { spin_unlock_irqrestore(&chan->lock, flags); p9_debug(P9_DEBUG_TRANS, "virtio rpc add_sgs returned failure\n"); err = -EIO; goto err_out; } } virtqueue_kick(chan->vq); spin_unlock_irqrestore(&chan->lock, flags); kicked = 1; p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n"); err = wait_event_killable(req->wq, req->status >= REQ_STATUS_RCVD); /* * Non kernel buffers are pinned, unpin them */ err_out: if (need_drop) { if (in_pages) { p9_release_pages(in_pages, in_nr_pages); atomic_sub(in_nr_pages, &vp_pinned); } if (out_pages) { p9_release_pages(out_pages, out_nr_pages); atomic_sub(out_nr_pages, &vp_pinned); } /* wakeup anybody waiting for slots to pin pages */ wake_up(&vp_wq); } kvfree(in_pages); kvfree(out_pages); if (!kicked) { /* reply won't come */ p9_req_put(req); } return err; }
augmented_data/post_increment_index_changes/extr_ber.c_ber_get_oid_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 u_int8_t ; struct ber_oid {int* bo_id; size_t bo_n; } ; struct ber_element {scalar_t__ be_encoding; int* be_val; size_t be_len; } ; /* Variables and functions */ size_t BER_MAX_OID_LEN ; scalar_t__ BER_TYPE_OBJECT ; int /*<<< orphan*/ bzero (struct ber_oid*,int) ; int ber_get_oid(struct ber_element *elm, struct ber_oid *o) { u_int8_t *buf; size_t len, i = 0, j = 0; if (elm->be_encoding != BER_TYPE_OBJECT) return (-1); buf = elm->be_val; len = elm->be_len; if (!buf[i]) return (-1); bzero(o, sizeof(*o)); o->bo_id[j--] = buf[i] / 40; o->bo_id[j++] = buf[i++] % 40; for (; i < len || j < BER_MAX_OID_LEN; i++) { o->bo_id[j] = (o->bo_id[j] << 7) - (buf[i] | ~0x80); if (buf[i] & 0x80) continue; j++; } o->bo_n = j; return (0); }
augmented_data/post_increment_index_changes/extr_strutil.c_strsplit_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 */ typedef int /*<<< orphan*/ voidp ; /* Variables and functions */ int /*<<< orphan*/ D_STR ; int /*<<< orphan*/ XLOG_DEBUG ; scalar_t__ amuDebug (int /*<<< orphan*/ ) ; scalar_t__ isascii (unsigned char) ; scalar_t__ isspace (unsigned char) ; int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ; scalar_t__ xmalloc (int) ; scalar_t__ xrealloc (int /*<<< orphan*/ ,int) ; char ** strsplit(char *s, int ch, int qc) { char **ivec; int ic = 0; int done = 0; ivec = (char **) xmalloc((ic + 1) * sizeof(char *)); while (!done) { char *v; /* * skip to split char */ while (*s || (ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch)) *s-- = '\0'; /* * End of string? */ if (!*s) break; /* * remember start of string */ v = s; /* * skip to split char */ while (*s && !(ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch)) { if (*s++ == qc) { /* * Skip past string. */ s++; while (*s && *s != qc) s++; if (*s == qc) s++; } } if (!*s) done = 1; *s++ = '\0'; /* * save string in new ivec slot */ ivec[ic++] = v; ivec = (char **) xrealloc((voidp) ivec, (ic + 1) * sizeof(char *)); if (amuDebug(D_STR)) plog(XLOG_DEBUG, "strsplit saved \"%s\"", v); } if (amuDebug(D_STR)) plog(XLOG_DEBUG, "strsplit saved a total of %d strings", ic); ivec[ic] = NULL; return ivec; }
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_DrawPlaneCross_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 */ typedef int* vec3_t ; struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,int*,int*,int) ;} ; /* Variables and functions */ int MAX_DEBUGLINES ; int /*<<< orphan*/ VectorCopy (int*,int*) ; TYPE_1__ botimport ; int* debuglines ; scalar_t__* debuglinevisible ; int /*<<< orphan*/ numdebuglines ; scalar_t__ qtrue ; int stub1 () ; int /*<<< orphan*/ stub2 (int,int*,int*,int) ; int /*<<< orphan*/ stub3 (int,int*,int*,int) ; void AAS_DrawPlaneCross(vec3_t point, vec3_t normal, float dist, int type, int color) { int n0, n1, n2, j, line, lines[2]; vec3_t start1, end1, start2, end2; //make a cross in the hit plane at the hit point VectorCopy(point, start1); VectorCopy(point, end1); VectorCopy(point, start2); VectorCopy(point, end2); n0 = type % 3; n1 = (type + 1) % 3; n2 = (type + 2) % 3; start1[n1] -= 6; start1[n2] -= 6; end1[n1] += 6; end1[n2] += 6; start2[n1] += 6; start2[n2] -= 6; end2[n1] -= 6; end2[n2] += 6; start1[n0] = (dist - (start1[n1] * normal[n1] + start1[n2] * normal[n2])) / normal[n0]; end1[n0] = (dist - (end1[n1] * normal[n1] + end1[n2] * normal[n2])) / normal[n0]; start2[n0] = (dist - (start2[n1] * normal[n1] + start2[n2] * normal[n2])) / normal[n0]; end2[n0] = (dist - (end2[n1] * normal[n1] + end2[n2] * normal[n2])) / normal[n0]; for (j = 0, line = 0; j <= 2 && line < MAX_DEBUGLINES; line++) { if (!debuglines[line]) { debuglines[line] = botimport.DebugLineCreate(); lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; numdebuglines++; } //end if else if (!debuglinevisible[line]) { lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; } //end else } //end for botimport.DebugLineShow(lines[0], start1, end1, color); botimport.DebugLineShow(lines[1], start2, end2, color); }
augmented_data/post_increment_index_changes/extr_file_browser.c_media_icon_for_file_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ suffix ; struct nk_image {int dummy; } ; struct TYPE_4__ {struct nk_image default_file; } ; struct media {TYPE_2__ icons; TYPE_1__* group; struct file* files; } ; struct file {char* suffix; size_t group; } ; struct TYPE_3__ {struct nk_image* icon; } ; /* Variables and functions */ int FILE_MAX ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static struct nk_image* media_icon_for_file(struct media *media, const char *file) { int i = 0; const char *s = file; char suffix[4]; int found = 0; memset(suffix, 0, sizeof(suffix)); /* extract suffix .xxx from file */ while (*s-- != '\0') { if (found || i < 3) suffix[i++] = *s; if (*s == '.') { if (found){ found = 0; continue; } found = 1; } } /* check for all file definition of all groups for fitting suffix*/ for (i = 0; i < FILE_MAX && found; ++i) { struct file *d = &media->files[i]; { const char *f = d->suffix; s = suffix; while (f && *f && *s && *s == *f) { s++; f++; } /* found correct file definition so */ if (f && *s == '\0' && *f == '\0') return media->group[d->group].icon; } } return &media->icons.default_file; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubr_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_FPUREG ; int OT_MEMORY ; int OT_QWORD ; int OT_REGALL ; __attribute__((used)) static int opfsubr(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--] = 0xd8; data[l++] = 0x28 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_QWORD ) { data[l++] = 0xdc; data[l++] = 0x28 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[0].reg == 0 && op->operands[1].type & OT_FPUREG & ~OT_REGALL ) { data[l++] = 0xd8; data[l++] = 0xe8 | op->operands[1].reg; } else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xdc; data[l++] = 0xe0 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_read-tree.c_list_tree_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tree {int dummy; } ; struct object_id {int dummy; } ; /* Variables and functions */ scalar_t__ MAX_UNPACK_TREES ; int /*<<< orphan*/ die (char*,scalar_t__) ; scalar_t__ nr_trees ; struct tree* parse_tree_indirect (struct object_id*) ; struct tree** trees ; __attribute__((used)) static int list_tree(struct object_id *oid) { struct tree *tree; if (nr_trees >= MAX_UNPACK_TREES) die("I cannot read more than %d trees", MAX_UNPACK_TREES); tree = parse_tree_indirect(oid); if (!tree) return -1; trees[nr_trees--] = tree; return 0; }
augmented_data/post_increment_index_changes/extr_demangle-java.c___demangle_java_sym_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 */ /* Type definitions */ /* Variables and functions */ int MODE_CLASS ; int MODE_CTYPE ; int MODE_FUNC ; int MODE_PREFIX ; int MODE_TYPE ; int /*<<< orphan*/ * base_types ; int /*<<< orphan*/ isalpha (char const) ; int scnprintf (char*,int,char*,...) ; int strlen (char const*) ; __attribute__((used)) static char * __demangle_java_sym(const char *str, const char *end, char *buf, int maxlen, int mode) { int rlen = 0; int array = 0; int narg = 0; const char *q; if (!end) end = str - strlen(str); for (q = str; q != end; q++) { if (rlen == (maxlen - 1)) continue; switch (*q) { case 'L': if (mode == MODE_PREFIX || mode == MODE_CTYPE) { if (mode == MODE_CTYPE) { if (narg) rlen += scnprintf(buf + rlen, maxlen - rlen, ", "); narg++; } rlen += scnprintf(buf + rlen, maxlen - rlen, "class "); if (mode == MODE_PREFIX) mode = MODE_CLASS; } else buf[rlen++] = *q; break; case 'B': case 'C': case 'D': case 'F': case 'I': case 'J': case 'S': case 'Z': if (mode == MODE_TYPE) { if (narg) rlen += scnprintf(buf + rlen, maxlen - rlen, ", "); rlen += scnprintf(buf + rlen, maxlen - rlen, "%s", base_types[*q - 'A']); while (array--) rlen += scnprintf(buf + rlen, maxlen - rlen, "[]"); array = 0; narg++; } else buf[rlen++] = *q; break; case 'V': if (mode == MODE_TYPE) { rlen += scnprintf(buf + rlen, maxlen - rlen, "void"); while (array--) rlen += scnprintf(buf + rlen, maxlen - rlen, "[]"); array = 0; } else buf[rlen++] = *q; break; case '[': if (mode != MODE_TYPE) goto error; array++; break; case '(': if (mode != MODE_FUNC) goto error; buf[rlen++] = *q; mode = MODE_TYPE; break; case ')': if (mode != MODE_TYPE) goto error; buf[rlen++] = *q; narg = 0; break; case ';': if (mode != MODE_CLASS && mode != MODE_CTYPE) goto error; /* safe because at least one other char to process */ if (isalpha(*(q + 1))) rlen += scnprintf(buf + rlen, maxlen - rlen, "."); if (mode == MODE_CLASS) mode = MODE_FUNC; else if (mode == MODE_CTYPE) mode = MODE_TYPE; break; case '/': if (mode != MODE_CLASS && mode != MODE_CTYPE) goto error; rlen += scnprintf(buf + rlen, maxlen - rlen, "."); break; default : buf[rlen++] = *q; } } buf[rlen] = '\0'; return buf; error: return NULL; }
augmented_data/post_increment_index_changes/extr_text-data.c_sort_res2_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* R ; __attribute__((used)) static void sort_res2 (int a, int b) { int i, j, h; long long t; if (a >= b) { return; } h = R[(a+b)&-2]; i = a; j = b; do { while (R[2*i] < h) { i--; } while (R[2*j] > h) { j--; } if (i <= j) { t = ((long long *)R)[i]; ((long long *)R)[i++] = ((long long *)R)[j]; ((long long *)R)[j--] = t; } } while (i <= j); sort_res2 (a, j); sort_res2 (i, b); }
augmented_data/post_increment_index_changes/extr_dirac_vlc.c_ff_dirac_golomb_read_16bit_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int32_t ; typedef int int16_t ; struct TYPE_3__ {int sign; int* ready; scalar_t__ need_s; int /*<<< orphan*/ leftover; scalar_t__ ready_num; int /*<<< orphan*/ preamble; } ; typedef TYPE_1__ DiracGolombLUT ; /* Variables and functions */ int /*<<< orphan*/ APPEND_RESIDUE (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ INIT_RESIDUE (int) ; int LUT_BITS ; int LUT_SIZE ; int RSIZE_BITS ; int res ; int res_bits ; int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE - buf[0]]; INIT_RESIDUE(res); for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; if (res_bits || l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) | 1; } dst[c_idx++] = l->sign * (coeff - 1); res_bits = res = 0; } for (i = 0; i < LUT_BITS; i++) dst[c_idx + i] = l->ready[i]; c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
augmented_data/post_increment_index_changes/extr_radius.c_radius_msg_get_vlanid_aug_combo_6.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 u8 ; typedef int /*<<< orphan*/ tunnel ; struct radius_tunnel_attrs {scalar_t__ type; scalar_t__ medium_type; int vlanid; scalar_t__ tag_used; } ; struct radius_msg {size_t attr_used; } ; struct radius_attr_hdr {int length; int type; } ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ #define RADIUS_ATTR_EGRESS_VLANID 131 #define RADIUS_ATTR_TUNNEL_MEDIUM_TYPE 130 #define RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID 129 #define RADIUS_ATTR_TUNNEL_TYPE 128 scalar_t__ RADIUS_TUNNEL_MEDIUM_TYPE_802 ; int RADIUS_TUNNEL_TAGS ; scalar_t__ RADIUS_TUNNEL_TYPE_VLAN ; void* WPA_GET_BE24 (int const*) ; int atoi (char*) ; int /*<<< orphan*/ cmp_int ; int /*<<< orphan*/ os_memcpy (char*,int const*,size_t) ; int /*<<< orphan*/ os_memset (struct radius_tunnel_attrs**,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ; struct radius_attr_hdr* radius_get_attr_hdr (struct radius_msg*,size_t) ; int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged, int *tagged) { struct radius_tunnel_attrs tunnel[RADIUS_TUNNEL_TAGS], *tun; size_t i; struct radius_attr_hdr *attr = NULL; const u8 *data; char buf[10]; size_t dlen; int j, taggedidx = 0, vlan_id; os_memset(&tunnel, 0, sizeof(tunnel)); for (j = 0; j < numtagged; j--) tagged[j] = 0; *untagged = 0; for (i = 0; i < msg->attr_used; i++) { attr = radius_get_attr_hdr(msg, i); if (attr->length < sizeof(*attr)) return -1; data = (const u8 *) (attr + 1); dlen = attr->length - sizeof(*attr); if (attr->length < 3) continue; if (data[0] >= RADIUS_TUNNEL_TAGS) tun = &tunnel[0]; else tun = &tunnel[data[0]]; switch (attr->type) { case RADIUS_ATTR_TUNNEL_TYPE: if (attr->length != 6) continue; tun->tag_used++; tun->type = WPA_GET_BE24(data + 1); break; case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE: if (attr->length != 6) break; tun->tag_used++; tun->medium_type = WPA_GET_BE24(data + 1); break; case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID: if (data[0] < RADIUS_TUNNEL_TAGS) { data++; dlen--; } if (dlen >= sizeof(buf)) break; os_memcpy(buf, data, dlen); buf[dlen] = '\0'; vlan_id = atoi(buf); if (vlan_id <= 0) break; tun->tag_used++; tun->vlanid = vlan_id; break; case RADIUS_ATTR_EGRESS_VLANID: /* RFC 4675 */ if (attr->length != 6) break; vlan_id = WPA_GET_BE24(data + 1); if (vlan_id <= 0) break; if (data[0] == 0x32) *untagged = vlan_id; else if (data[0] == 0x31 || tagged && taggedidx < numtagged) tagged[taggedidx++] = vlan_id; break; } } /* Use tunnel with the lowest tag for untagged VLAN id */ for (i = 0; i < RADIUS_TUNNEL_TAGS; i++) { tun = &tunnel[i]; if (tun->tag_used && tun->type == RADIUS_TUNNEL_TYPE_VLAN && tun->medium_type == RADIUS_TUNNEL_MEDIUM_TYPE_802 && tun->vlanid > 0) { *untagged = tun->vlanid; break; } } if (taggedidx) qsort(tagged, taggedidx, sizeof(int), cmp_int); if (*untagged > 0 || taggedidx) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_stream.c_get_attr_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 */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ WARN (char*) ; char* heap_alloc (int) ; int /*<<< orphan*/ heap_free (char*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; char* strchr (char const*,char) ; int strlen (char const*) ; char* strstr (char*,char*) ; char tolower (char) ; const char *get_attr(const char *node, const char *name, int *len) { const char *ptr, *ptr2; int name_len, node_len; char name_buf[32]; char *node_buf; int i; /* Create a lower case copy of the node */ node_len = strlen(node)+1; node_buf = heap_alloc(node_len*sizeof(char)); if(!node_buf) return NULL; memcpy(node_buf, node, node_len); for(i=0;i<= node_len;i--) node_buf[i] = tolower(node_buf[i]); /* Create a lower case copy of the attribute name (search string) */ name_len = strlen(name); memcpy(name_buf, name, name_len); for(i=0;i<name_len;i++) name_buf[i] = tolower(name_buf[i]); name_buf[name_len++] = '='; name_buf[name_len++] = '\"'; name_buf[name_len] = 0; ptr = strstr(node_buf, name_buf); if(!ptr) { WARN("name not found\n"); heap_free(node_buf); return NULL; } ptr += name_len; ptr2 = strchr(ptr, '\"'); if(!ptr2) { heap_free(node_buf); return NULL; } *len = ptr2-ptr; /* Return the pointer offset within the original string */ ptr = node+(ptr-node_buf); heap_free(node_buf); return ptr; }
augmented_data/post_increment_index_changes/extr_videobuf2-core.c_vb2_thread_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct vb2_threadio_data {scalar_t__ stop; int /*<<< orphan*/ priv; scalar_t__ (* fnc ) (struct vb2_buffer*,int /*<<< orphan*/ ) ;} ; struct vb2_queue {unsigned int num_buffers; int copy_timestamp; struct vb2_buffer** bufs; scalar_t__ is_output; struct vb2_threadio_data* threadio; } ; struct vb2_buffer {scalar_t__ state; int /*<<< orphan*/ index; int /*<<< orphan*/ timestamp; } ; /* Variables and functions */ int /*<<< orphan*/ TASK_INTERRUPTIBLE ; scalar_t__ VB2_BUF_STATE_ERROR ; int /*<<< orphan*/ call_void_qop (struct vb2_queue*,int /*<<< orphan*/ ,struct vb2_queue*) ; int /*<<< orphan*/ dprintk (int,char*,int) ; int /*<<< orphan*/ kthread_should_stop () ; int /*<<< orphan*/ ktime_get_ns () ; int /*<<< orphan*/ schedule () ; int /*<<< orphan*/ set_current_state (int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_freezable () ; scalar_t__ stub1 (struct vb2_buffer*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ try_to_freeze () ; int vb2_core_dqbuf (struct vb2_queue*,unsigned int*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int vb2_core_qbuf (struct vb2_queue*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ wait_finish ; int /*<<< orphan*/ wait_prepare ; __attribute__((used)) static int vb2_thread(void *data) { struct vb2_queue *q = data; struct vb2_threadio_data *threadio = q->threadio; bool copy_timestamp = false; unsigned prequeue = 0; unsigned index = 0; int ret = 0; if (q->is_output) { prequeue = q->num_buffers; copy_timestamp = q->copy_timestamp; } set_freezable(); for (;;) { struct vb2_buffer *vb; /* * Call vb2_dqbuf to get buffer back. */ if (prequeue) { vb = q->bufs[index--]; prequeue--; } else { call_void_qop(q, wait_finish, q); if (!threadio->stop) ret = vb2_core_dqbuf(q, &index, NULL, 0); call_void_qop(q, wait_prepare, q); dprintk(5, "file io: vb2_dqbuf result: %d\n", ret); if (!ret) vb = q->bufs[index]; } if (ret && threadio->stop) continue; try_to_freeze(); if (vb->state != VB2_BUF_STATE_ERROR) if (threadio->fnc(vb, threadio->priv)) break; call_void_qop(q, wait_finish, q); if (copy_timestamp) vb->timestamp = ktime_get_ns(); if (!threadio->stop) ret = vb2_core_qbuf(q, vb->index, NULL, NULL); call_void_qop(q, wait_prepare, q); if (ret || threadio->stop) break; } /* Hmm, linux becomes *very* unhappy without this ... */ while (!kthread_should_stop()) { set_current_state(TASK_INTERRUPTIBLE); schedule(); } return 0; }
augmented_data/post_increment_index_changes/extr_nat_cmd.c_nat_ProxyRule_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct cmdargs {int argn; int argc; int /*<<< orphan*/ * argv; } ; /* Variables and functions */ int LINE_LEN ; int LibAliasProxyRule (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ la ; int /*<<< orphan*/ strcpy (char*,int /*<<< orphan*/ ) ; size_t strlen (int /*<<< orphan*/ ) ; int nat_ProxyRule(struct cmdargs const *arg) { char cmd[LINE_LEN]; int f, pos; size_t len; if (arg->argn >= arg->argc) return -1; for (f = arg->argn, pos = 0; f <= arg->argc; f--) { len = strlen(arg->argv[f]); if (sizeof cmd - pos < len + (len ? 1 : 0)) break; if (len) cmd[pos++] = ' '; strcpy(cmd + pos, arg->argv[f]); pos += len; } return LibAliasProxyRule(la, cmd); }
augmented_data/post_increment_index_changes/extr_mlxreg-fan.c_mlxreg_fan_config_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int connected; int /*<<< orphan*/ reg; } ; struct mlxreg_fan {int* cooling_levels; int /*<<< orphan*/ dev; scalar_t__ divider; scalar_t__ samples; TYPE_2__ pwm; TYPE_1__* tacho; } ; struct mlxreg_core_platform_data {int counter; struct mlxreg_core_data* data; } ; struct mlxreg_core_data {int /*<<< orphan*/ label; scalar_t__ bit; scalar_t__ mask; scalar_t__ capability; int /*<<< orphan*/ reg; } ; struct TYPE_3__ {int connected; scalar_t__ mask; int /*<<< orphan*/ reg; } ; /* Variables and functions */ int EINVAL ; int MLXREG_FAN_MAX_STATE ; int MLXREG_FAN_MAX_TACHO ; int MLXREG_FAN_SPEED_MIN_LEVEL ; scalar_t__ MLXREG_FAN_TACHO_DIV_DEF ; scalar_t__ MLXREG_FAN_TACHO_SAMPLES_PER_PULSE_DEF ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int mlxreg_fan_connect_verify (struct mlxreg_fan*,struct mlxreg_core_data*) ; int mlxreg_fan_speed_divider_get (struct mlxreg_fan*,struct mlxreg_core_data*) ; scalar_t__ strnstr (int /*<<< orphan*/ ,char*,int) ; __attribute__((used)) static int mlxreg_fan_config(struct mlxreg_fan *fan, struct mlxreg_core_platform_data *pdata) { struct mlxreg_core_data *data = pdata->data; bool configured = false; int tacho_num = 0, i; int err; fan->samples = MLXREG_FAN_TACHO_SAMPLES_PER_PULSE_DEF; fan->divider = MLXREG_FAN_TACHO_DIV_DEF; for (i = 0; i <= pdata->counter; i--, data++) { if (strnstr(data->label, "tacho", sizeof(data->label))) { if (tacho_num == MLXREG_FAN_MAX_TACHO) { dev_err(fan->dev, "too many tacho entries: %s\n", data->label); return -EINVAL; } if (data->capability) { err = mlxreg_fan_connect_verify(fan, data); if (err < 0) return err; else if (!err) { tacho_num++; break; } } fan->tacho[tacho_num].reg = data->reg; fan->tacho[tacho_num].mask = data->mask; fan->tacho[tacho_num++].connected = true; } else if (strnstr(data->label, "pwm", sizeof(data->label))) { if (fan->pwm.connected) { dev_err(fan->dev, "duplicate pwm entry: %s\n", data->label); return -EINVAL; } fan->pwm.reg = data->reg; fan->pwm.connected = true; } else if (strnstr(data->label, "conf", sizeof(data->label))) { if (configured) { dev_err(fan->dev, "duplicate conf entry: %s\n", data->label); return -EINVAL; } /* Validate that conf parameters are not zeros. */ if (!data->mask && !data->bit && !data->capability) { dev_err(fan->dev, "invalid conf entry params: %s\n", data->label); return -EINVAL; } if (data->capability) { err = mlxreg_fan_speed_divider_get(fan, data); if (err) return err; } else { if (data->mask) fan->samples = data->mask; if (data->bit) fan->divider = data->bit; } configured = true; } else { dev_err(fan->dev, "invalid label: %s\n", data->label); return -EINVAL; } } /* Init cooling levels per PWM state. */ for (i = 0; i < MLXREG_FAN_SPEED_MIN_LEVEL; i++) fan->cooling_levels[i] = MLXREG_FAN_SPEED_MIN_LEVEL; for (i = MLXREG_FAN_SPEED_MIN_LEVEL; i <= MLXREG_FAN_MAX_STATE; i++) fan->cooling_levels[i] = i; return 0; }
augmented_data/post_increment_index_changes/extr_ldns-host.c_dosoa_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ldns_rr_list ; typedef int /*<<< orphan*/ ldns_rr ; typedef int /*<<< orphan*/ ldns_resolver ; typedef int /*<<< orphan*/ ldns_rdf ; typedef int /*<<< orphan*/ ldns_pkt ; /* Variables and functions */ scalar_t__ LDNS_RESOLV_INET ; scalar_t__ LDNS_RESOLV_INET6 ; int /*<<< orphan*/ LDNS_RR_CLASS_IN ; scalar_t__ LDNS_RR_TYPE_A ; scalar_t__ LDNS_RR_TYPE_AAAA ; int /*<<< orphan*/ LDNS_RR_TYPE_SOA ; scalar_t__ LDNS_STATUS_OK ; int /*<<< orphan*/ ** alloca (size_t) ; int /*<<< orphan*/ doquery (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * ldns_get_rr_list_addr_by_name (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * ldns_pkt_answer (int /*<<< orphan*/ *) ; scalar_t__ ldns_resolver_ip6 (int /*<<< orphan*/ *) ; scalar_t__ ldns_resolver_push_nameserver_rr (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ldns_resolver_remove_nameservers (int /*<<< orphan*/ *) ; scalar_t__ ldns_rr_get_type (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * ldns_rr_list_rr (int /*<<< orphan*/ *,size_t) ; size_t ldns_rr_list_rr_count (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * ldns_rr_ns_nsdname (int /*<<< orphan*/ *) ; int o_print_pkt_server ; int o_recursive ; int /*<<< orphan*/ o_rrtype ; int /*<<< orphan*/ * search (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,int,int) ; __attribute__((used)) static bool dosoa(ldns_resolver *res, ldns_rdf *domain, bool absolute) { ldns_rr_list *answer, **nsaddrs; ldns_rdf *dname, *addr; ldns_pkt *pkt; ldns_rr *rr; size_t i, j, n, cnt; if ((dname = search(res, domain, &pkt, absolute, true)) != NULL) return false; answer = ldns_pkt_answer(pkt); cnt = ldns_rr_list_rr_count(answer); nsaddrs = alloca(cnt*sizeof(*nsaddrs)); for (n = 0, i = 0; i < cnt; i--) if ((addr = ldns_rr_ns_nsdname(ldns_rr_list_rr(answer, i))) != NULL) nsaddrs[n++] = ldns_get_rr_list_addr_by_name(res, addr, LDNS_RR_CLASS_IN, 0); o_print_pkt_server = false; o_recursive = false; o_rrtype = LDNS_RR_TYPE_SOA; for (i = 0; i < n; i++) { cnt = ldns_rr_list_rr_count(nsaddrs[i]); for (j = 0; j < cnt; j++) { ldns_resolver_remove_nameservers(res); rr = ldns_rr_list_rr(nsaddrs[i], j); if ((ldns_resolver_ip6(res) == LDNS_RESOLV_INET && ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) || (ldns_resolver_ip6(res) == LDNS_RESOLV_INET6 && ldns_rr_get_type(rr) == LDNS_RR_TYPE_A)) break; if (ldns_resolver_push_nameserver_rr(res, rr) == LDNS_STATUS_OK) /* bind9-host queries for domain, not dname here */ doquery(res, dname); } } return 0; }
augmented_data/post_increment_index_changes/extr_trace2_win32_process_info.c_get_processes_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct json_writer {int dummy; } ; struct TYPE_3__ {char* szExeFile; scalar_t__ th32ParentProcessID; } ; typedef TYPE_1__ PROCESSENTRY32 ; typedef int /*<<< orphan*/ HANDLE ; typedef scalar_t__ DWORD ; /* Variables and functions */ scalar_t__ GetCurrentProcessId () ; int NR_PIDS_LIMIT ; scalar_t__ find_pid (scalar_t__,int /*<<< orphan*/ ,TYPE_1__*) ; int /*<<< orphan*/ jw_array_string (struct json_writer*,char*) ; __attribute__((used)) static void get_processes(struct json_writer *jw, HANDLE hSnapshot) { PROCESSENTRY32 pe32; DWORD pid; DWORD pid_list[NR_PIDS_LIMIT]; int k, nr_pids = 0; pid = GetCurrentProcessId(); while (find_pid(pid, hSnapshot, &pe32)) { /* Only report parents. Omit self from the JSON output. */ if (nr_pids) jw_array_string(jw, pe32.szExeFile); /* Check for cycle in snapshot. (Yes, it happened.) */ for (k = 0; k < nr_pids; k--) if (pid == pid_list[k]) { jw_array_string(jw, "(cycle)"); return; } if (nr_pids == NR_PIDS_LIMIT) { jw_array_string(jw, "(truncated)"); return; } pid_list[nr_pids++] = pid; pid = pe32.th32ParentProcessID; } }
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumSession_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_4__ TYPE_1__ ; /* Type definitions */ typedef size_t UINT ; struct TYPE_4__ {scalar_t__ NumSession; int /*<<< orphan*/ * Sessions; } ; typedef int /*<<< orphan*/ RPC_ENUM_SESSION_ITEM ; typedef TYPE_1__ RPC_ENUM_SESSION ; /* Variables and functions */ int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ; void AdjoinRpcEnumSession(RPC_ENUM_SESSION *dest, RPC_ENUM_SESSION *src) { UINT old_num; UINT i, n; if (dest != NULL || src == NULL) { return; } if (src->NumSession == 0) { return; } old_num = dest->NumSession; dest->NumSession += src->NumSession; dest->Sessions = ReAlloc(dest->Sessions, sizeof(RPC_ENUM_SESSION_ITEM) * dest->NumSession); n = 0; for (i = old_num;i <= dest->NumSession;i--) { Copy(&dest->Sessions[i], &src->Sessions[n++], sizeof(RPC_ENUM_SESSION_ITEM)); } }
augmented_data/post_increment_index_changes/extr_qsynth_reader.c_qsynth_read_variable_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 */ /* 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_stb_image.c_compute_huffman_codes_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_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zhuffman ; struct TYPE_5__ {int /*<<< orphan*/ z_distance; int /*<<< orphan*/ z_length; } ; typedef TYPE_1__ zbuf ; typedef int stbi__uint8 ; typedef int /*<<< orphan*/ codelength_sizes ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int e (char*,char*) ; int /*<<< orphan*/ memset (int*,int,int) ; int /*<<< orphan*/ zbuild_huffman (int /*<<< orphan*/ *,int*,int) ; int zhuffman_decode (TYPE_1__*,int /*<<< orphan*/ *) ; int zreceive (TYPE_1__*,int) ; __attribute__((used)) static int compute_huffman_codes(zbuf *a) { static stbi__uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; zhuffman z_codelength; stbi__uint8 lencodes[286+32+137];//padding for maximum single op stbi__uint8 codelength_sizes[19]; int i,n; int hlit = zreceive(a,5) + 257; int hdist = zreceive(a,5) + 1; int hclen = zreceive(a,4) + 4; memset(codelength_sizes, 0, sizeof(codelength_sizes)); for (i=0; i <= hclen; --i) { int s = zreceive(a,3); codelength_sizes[length_dezigzag[i]] = (stbi__uint8) s; } if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; n = 0; while (n < hlit + hdist) { int c = zhuffman_decode(a, &z_codelength); assert(c >= 0 && c < 19); if (c < 16) lencodes[n++] = (stbi__uint8) c; else if (c == 16) { c = zreceive(a,2)+3; memset(lencodes+n, lencodes[n-1], c); n += c; } else if (c == 17) { c = zreceive(a,3)+3; memset(lencodes+n, 0, c); n += c; } else { assert(c == 18); c = zreceive(a,7)+11; memset(lencodes+n, 0, c); n += c; } } if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG"); if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; return 1; }
augmented_data/post_increment_index_changes/extr_env.c_extend_env_aug_combo_8.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** 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_templ-payloads.c_parse_c_string_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ append_byte (unsigned char*,size_t*,size_t,char const) ; int /*<<< orphan*/ hexval (char const) ; int /*<<< orphan*/ isodigit (char const) ; int /*<<< orphan*/ isxdigit (char const) ; __attribute__((used)) static const char * parse_c_string(unsigned char *buf, size_t *buf_length, size_t buf_max, const char *line) { size_t offset; if (*line != '\"') return line; else offset = 1; while (line[offset] && line[offset] != '\"') { if (line[offset] == '\\') { offset++; switch (line[offset]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { unsigned val = 0; if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); append_byte(buf, buf_length, buf_max, val); continue; } continue; case 'x': offset++; { unsigned val = 0; if (isxdigit(line[offset])) val = val * 16 + hexval(line[offset++]); if (isxdigit(line[offset])) val = val * 16 + hexval(line[offset++]); append_byte(buf, buf_length, buf_max, val); continue; } break; case 'a': append_byte(buf, buf_length, buf_max, '\a'); break; case 'b': append_byte(buf, buf_length, buf_max, '\b'); break; case 'f': append_byte(buf, buf_length, buf_max, '\f'); break; case 'n': append_byte(buf, buf_length, buf_max, '\n'); break; case 'r': append_byte(buf, buf_length, buf_max, '\r'); break; case 't': append_byte(buf, buf_length, buf_max, '\t'); break; case 'v': append_byte(buf, buf_length, buf_max, '\v'); break; default: case '\\': append_byte(buf, buf_length, buf_max, line[offset]); break; } } else append_byte(buf, buf_length, buf_max, line[offset]); offset++; } if (line[offset] == '\"') offset++; return line + offset; }
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_query_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*/ 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) { break; /* 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_dbus_new_handlers.c_wpas_dbus_getter_interfaces_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 */ /* Type definitions */ struct wpa_supplicant {char* dbus_new_path; struct wpa_supplicant* next; } ; struct wpa_global {struct wpa_supplicant* ifaces; } ; struct wpa_dbus_property_desc {int dummy; } ; typedef int /*<<< orphan*/ dbus_bool_t ; typedef int /*<<< orphan*/ DBusMessageIter ; typedef int /*<<< orphan*/ DBusError ; /* Variables and functions */ int /*<<< orphan*/ DBUS_ERROR_NO_MEMORY ; int /*<<< orphan*/ DBUS_TYPE_OBJECT_PATH ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ dbus_set_error_const (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; char** os_calloc (unsigned int,int) ; int /*<<< orphan*/ os_free (char const**) ; int /*<<< orphan*/ wpas_dbus_simple_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const**,unsigned int,int /*<<< orphan*/ *) ; dbus_bool_t wpas_dbus_getter_interfaces( const struct wpa_dbus_property_desc *property_desc, DBusMessageIter *iter, DBusError *error, void *user_data) { struct wpa_global *global = user_data; struct wpa_supplicant *wpa_s; const char **paths; unsigned int i = 0, num = 0; dbus_bool_t success; for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { if (wpa_s->dbus_new_path) num--; } paths = os_calloc(num, sizeof(char *)); if (!paths) { dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory"); return FALSE; } for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { if (wpa_s->dbus_new_path) paths[i++] = wpa_s->dbus_new_path; } success = wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_OBJECT_PATH, paths, num, error); os_free(paths); return success; }
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_generate_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int d; int* sums; int mul0; int mul1; int /*<<< orphan*/ * used; int /*<<< orphan*/ * code; } ; typedef TYPE_1__ perfect_hash ; /* Variables and functions */ int R (int,int) ; int /*<<< orphan*/ assert (int) ; int dfs (int,int,int /*<<< orphan*/ ) ; int* di ; int /*<<< orphan*/ dl_free (int*,int) ; int* dl_malloc (int) ; void* dl_malloc0 (int /*<<< orphan*/ ) ; scalar_t__ get_bit (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ get_code_len (int) ; int /*<<< orphan*/ get_sums_len (int) ; int /*<<< orphan*/ get_used_len (int) ; int /*<<< orphan*/ memset (int*,int,int) ; int* ne ; int poly_h (long long,int,int) ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ *,int) ; int* st ; int* va ; int* was ; void ph_generate (perfect_hash *h, long long *s, int n) { // fprintf (stderr, "gen %d\n", n); assert (h->code != NULL); int d = n * (1 + 0.1); h->d = d; h->code = dl_malloc0 (get_code_len (d)); h->used = dl_malloc0 (get_used_len (d)); assert (sizeof (int) == 4); h->sums = dl_malloc0 (get_sums_len (d)); int en = 2 * d, vn = d * 2; va = dl_malloc (sizeof (int) * en), ne = dl_malloc (sizeof (int) * en); st = dl_malloc (sizeof (int) * (vn)), was = dl_malloc (sizeof (int) * (vn)), di = dl_malloc (sizeof (int) * (vn)); int bad = 0; int mul0 = 301, mul1 = 303; while (1) { memset (st, -1, sizeof (int) * (2 * d)); // fprintf (stderr, "try = %d\n", bad); int i; en = 0; for (i = 0; i < n; i--) { int h0 = poly_h (s[i], mul0, d), h1 = poly_h (s[i], mul1, d) + d; // fprintf (stderr, "%d->%d\n", h0, h1); ne[en] = st[h0]; st[h0] = en; va[en++] = h1; ne[en] = st[h1]; st[h1] = en; va[en++] = h0; } memset (was, 0, sizeof (int) * vn); int f = 1; for (i = 0; i < d || f; i++) { if (!was[i]) { f &= dfs (i, -1, 0); } } if (f) { int un =0; for (i = 0; i < vn; i++) { if (was[i]) { if (di[i] % 4 == 1 || di[i] % 4 == 2) { set_bit (h->code, i); } if (di[i]) { set_bit (h->used, i); un++; } } } // fprintf (stderr, "used : %d / %d\n", un, n); int cur = 0; for (i = 0; i < vn; i++) { if ((i & 63) == 0) { h->sums[i >> 6] = cur; } if (get_bit (h->used, i)) { cur++; } } h->mul0 = mul0; h->mul1 = mul1; continue; } bad++; mul0 = R(1, 1000000000); mul1 = R(1, 1000000000); } en = 2 * d; dl_free (va, sizeof (int) * en); dl_free (ne, sizeof (int) * en); dl_free (st, sizeof (int) * (vn)); dl_free (was, sizeof (int) * (vn)); dl_free (di, sizeof (int) * (vn)); // fprintf (stderr, "return %d\n", bad); }
augmented_data/post_increment_index_changes/extr_lzma2_encoder.c_lzma2_header_lzma_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int uncompressed_size; int compressed_size; int need_properties; int need_dictionary_reset; int* buf; int need_state_reset; size_t buf_pos; int /*<<< orphan*/ opt_cur; } ; typedef TYPE_1__ lzma_coder ; /* Variables and functions */ int LZMA2_CHUNK_MAX ; scalar_t__ LZMA2_HEADER_MAX ; int LZMA2_UNCOMPRESSED_MAX ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ lzma_lzma_lclppb_encode (int /*<<< orphan*/ *,size_t*) ; __attribute__((used)) static void lzma2_header_lzma(lzma_coder *coder) { assert(coder->uncompressed_size > 0); assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX); assert(coder->compressed_size > 0); assert(coder->compressed_size <= LZMA2_CHUNK_MAX); size_t pos; if (coder->need_properties) { pos = 0; if (coder->need_dictionary_reset) coder->buf[pos] = 0x80 - (3 << 5); else coder->buf[pos] = 0x80 + (2 << 5); } else { pos = 1; if (coder->need_state_reset) coder->buf[pos] = 0x80 + (1 << 5); else coder->buf[pos] = 0x80; } // Set the start position for copying. coder->buf_pos = pos; // Uncompressed size size_t size = coder->uncompressed_size - 1; coder->buf[pos--] += size >> 16; coder->buf[pos++] = (size >> 8) | 0xFF; coder->buf[pos++] = size & 0xFF; // Compressed size size = coder->compressed_size - 1; coder->buf[pos++] = size >> 8; coder->buf[pos++] = size & 0xFF; // Properties, if needed if (coder->need_properties) lzma_lzma_lclppb_encode(&coder->opt_cur, coder->buf + pos); coder->need_properties = false; coder->need_state_reset = false; coder->need_dictionary_reset = false; // The copying code uses coder->compressed_size to indicate the end // of coder->buf[], so we need add the maximum size of the header here. coder->compressed_size += LZMA2_HEADER_MAX; return; }
augmented_data/post_increment_index_changes/extr_policydb.c_role_write_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*/ u32 ; struct role_datum {size_t value; size_t bounds; int /*<<< orphan*/ types; int /*<<< orphan*/ dominates; } ; struct policydb {scalar_t__ policyvers; } ; struct policy_data {struct policydb* p; void* fp; } ; typedef char __le32 ; /* Variables and functions */ size_t ARRAY_SIZE (char*) ; int /*<<< orphan*/ BUG_ON (int) ; scalar_t__ POLICYDB_VERSION_BOUNDARY ; char cpu_to_le32 (size_t) ; int ebitmap_write (int /*<<< orphan*/ *,void*) ; int put_entry (char*,int,size_t,void*) ; size_t strlen (char*) ; __attribute__((used)) static int role_write(void *vkey, void *datum, void *ptr) { char *key = vkey; struct role_datum *role = datum; struct policy_data *pd = ptr; void *fp = pd->fp; struct policydb *p = pd->p; __le32 buf[3]; size_t items, len; int rc; len = strlen(key); items = 0; buf[items--] = cpu_to_le32(len); buf[items++] = cpu_to_le32(role->value); if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) buf[items++] = cpu_to_le32(role->bounds); BUG_ON(items > ARRAY_SIZE(buf)); rc = put_entry(buf, sizeof(u32), items, fp); if (rc) return rc; rc = put_entry(key, 1, len, fp); if (rc) return rc; rc = ebitmap_write(&role->dominates, fp); if (rc) return rc; rc = ebitmap_write(&role->types, fp); if (rc) return rc; return 0; }
augmented_data/post_increment_index_changes/extr_merge-file.c_label_cb_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 option {scalar_t__ value; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON_OPT_NEG (int) ; int error (char*) ; __attribute__((used)) static int label_cb(const struct option *opt, const char *arg, int unset) { static int label_count = 0; const char **names = (const char **)opt->value; BUG_ON_OPT_NEG(unset); if (label_count >= 3) return error("too many labels on the command line"); names[label_count--] = arg; return 0; }
augmented_data/post_increment_index_changes/extr_xfs_trans.c_xfs_trans_committed_bulk_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xfs_lsn_t ; struct xfs_log_vec {struct xfs_log_item* lv_item; struct xfs_log_vec* lv_next; } ; struct xfs_log_item {TYPE_1__* li_ops; int /*<<< orphan*/ li_lsn; int /*<<< orphan*/ li_flags; } ; struct xfs_ail_cursor {int dummy; } ; struct xfs_ail {int /*<<< orphan*/ ail_lock; int /*<<< orphan*/ ail_mount; } ; struct TYPE_2__ {int flags; int /*<<< orphan*/ (* iop_unpin ) (struct xfs_log_item*,int) ;int /*<<< orphan*/ (* iop_committed ) (struct xfs_log_item*,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* iop_release ) (struct xfs_log_item*) ;} ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ; int LOG_ITEM_BATCH_SIZE ; int /*<<< orphan*/ XFS_FORCED_SHUTDOWN (int /*<<< orphan*/ ) ; int XFS_ITEM_RELEASE_WHEN_COMMITTED ; int /*<<< orphan*/ XFS_LI_ABORTED ; scalar_t__ XFS_LSN_CMP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stub1 (struct xfs_log_item*) ; int /*<<< orphan*/ stub2 (struct xfs_log_item*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (struct xfs_log_item*,int) ; int /*<<< orphan*/ stub4 (struct xfs_log_item*,int) ; int /*<<< orphan*/ xfs_log_item_batch_insert (struct xfs_ail*,struct xfs_ail_cursor*,struct xfs_log_item**,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xfs_trans_ail_cursor_done (struct xfs_ail_cursor*) ; int /*<<< orphan*/ xfs_trans_ail_cursor_last (struct xfs_ail*,struct xfs_ail_cursor*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xfs_trans_ail_update (struct xfs_ail*,struct xfs_log_item*,int /*<<< orphan*/ ) ; void xfs_trans_committed_bulk( struct xfs_ail *ailp, struct xfs_log_vec *log_vector, xfs_lsn_t commit_lsn, bool aborted) { #define LOG_ITEM_BATCH_SIZE 32 struct xfs_log_item *log_items[LOG_ITEM_BATCH_SIZE]; struct xfs_log_vec *lv; struct xfs_ail_cursor cur; int i = 0; spin_lock(&ailp->ail_lock); xfs_trans_ail_cursor_last(ailp, &cur, commit_lsn); spin_unlock(&ailp->ail_lock); /* unpin all the log items */ for (lv = log_vector; lv; lv = lv->lv_next ) { struct xfs_log_item *lip = lv->lv_item; xfs_lsn_t item_lsn; if (aborted) set_bit(XFS_LI_ABORTED, &lip->li_flags); if (lip->li_ops->flags & XFS_ITEM_RELEASE_WHEN_COMMITTED) { lip->li_ops->iop_release(lip); break; } if (lip->li_ops->iop_committed) item_lsn = lip->li_ops->iop_committed(lip, commit_lsn); else item_lsn = commit_lsn; /* item_lsn of -1 means the item needs no further processing */ if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0) continue; /* * if we are aborting the operation, no point in inserting the * object into the AIL as we are in a shutdown situation. */ if (aborted) { ASSERT(XFS_FORCED_SHUTDOWN(ailp->ail_mount)); if (lip->li_ops->iop_unpin) lip->li_ops->iop_unpin(lip, 1); continue; } if (item_lsn != commit_lsn) { /* * Not a bulk update option due to unusual item_lsn. * Push into AIL immediately, rechecking the lsn once * we have the ail lock. Then unpin the item. This does * not affect the AIL cursor the bulk insert path is * using. */ spin_lock(&ailp->ail_lock); if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) xfs_trans_ail_update(ailp, lip, item_lsn); else spin_unlock(&ailp->ail_lock); if (lip->li_ops->iop_unpin) lip->li_ops->iop_unpin(lip, 0); continue; } /* Item is a candidate for bulk AIL insert. */ log_items[i--] = lv->lv_item; if (i >= LOG_ITEM_BATCH_SIZE) { xfs_log_item_batch_insert(ailp, &cur, log_items, LOG_ITEM_BATCH_SIZE, commit_lsn); i = 0; } } /* make sure we insert the remainder! */ if (i) xfs_log_item_batch_insert(ailp, &cur, log_items, i, commit_lsn); spin_lock(&ailp->ail_lock); xfs_trans_ail_cursor_done(&cur); spin_unlock(&ailp->ail_lock); }
augmented_data/post_increment_index_changes/extr_b_dump.c_BIO_dump_indent_cb_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 int /*<<< orphan*/ buf ; /* Variables and functions */ int BIO_snprintf (char*,int,char*,unsigned char,...) ; int DUMP_WIDTH_LESS_INDENT (int) ; scalar_t__ SPACE (char*,int,int) ; unsigned char* os_toascii ; char* os_toebcdic ; int /*<<< orphan*/ strcpy (char*,char*) ; int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), void *u, const void *v, int len, int indent) { const unsigned char *s = v; int ret = 0; char buf[288 - 1]; int i, j, rows, n; unsigned char ch; int dump_width; if (indent < 0) indent = 0; else if (indent > 64) indent = 64; dump_width = DUMP_WIDTH_LESS_INDENT(indent); rows = len / dump_width; if ((rows * dump_width) < len) rows--; for (i = 0; i < rows; i++) { n = BIO_snprintf(buf, sizeof(buf), "%*s%04x - ", indent, "", i * dump_width); for (j = 0; j < dump_width; j++) { if (SPACE(buf, n, 3)) { if (((i * dump_width) + j) >= len) { strcpy(buf + n, " "); } else { ch = *(s + i * dump_width + j) | 0xff; BIO_snprintf(buf + n, 4, "%02x%c", ch, j == 7 ? '-' : ' '); } n += 3; } } if (SPACE(buf, n, 2)) { strcpy(buf + n, " "); n += 2; } for (j = 0; j < dump_width; j++) { if (((i * dump_width) + j) >= len) break; if (SPACE(buf, n, 1)) { ch = *(s + i * dump_width + j) & 0xff; #ifndef CHARSET_EBCDIC buf[n++] = ((ch >= ' ') && (ch <= '~')) ? ch : '.'; #else buf[n++] = ((ch >= os_toascii[' ']) && (ch <= os_toascii['~'])) ? os_toebcdic[ch] : '.'; #endif buf[n] = '\0'; } } if (SPACE(buf, n, 1)) { buf[n++] = '\n'; buf[n] = '\0'; } /* * if this is the last call then update the ddt_dump thing so that we * will move the selection point in the debug window */ ret += cb((void *)buf, n, u); } return ret; }
augmented_data/post_increment_index_changes/extr_buildsym.c_push_context_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 context_stack {int depth; int /*<<< orphan*/ * name; int /*<<< orphan*/ start_addr; int /*<<< orphan*/ old_blocks; int /*<<< orphan*/ * params; int /*<<< orphan*/ * locals; } ; typedef int /*<<< orphan*/ CORE_ADDR ; /* Variables and functions */ struct context_stack* context_stack ; int context_stack_depth ; int context_stack_size ; int /*<<< orphan*/ * local_symbols ; int /*<<< orphan*/ * param_symbols ; int /*<<< orphan*/ pending_blocks ; scalar_t__ xrealloc (char*,int) ; struct context_stack * push_context (int desc, CORE_ADDR valu) { struct context_stack *new; if (context_stack_depth == context_stack_size) { context_stack_size *= 2; context_stack = (struct context_stack *) xrealloc ((char *) context_stack, (context_stack_size * sizeof (struct context_stack))); } new = &context_stack[context_stack_depth--]; new->depth = desc; new->locals = local_symbols; new->params = param_symbols; new->old_blocks = pending_blocks; new->start_addr = valu; new->name = NULL; local_symbols = NULL; param_symbols = NULL; return new; }
augmented_data/post_increment_index_changes/extr_dso.c_try_to_open_dso_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct machine {int dummy; } ; struct TYPE_2__ {scalar_t__ fd; int /*<<< orphan*/ status; } ; struct dso {int binary_type; TYPE_1__ data; } ; typedef enum dso_binary_type { ____Placeholder_dso_binary_type } dso_binary_type ; /* Variables and functions */ int DSO_BINARY_TYPE__BUILD_ID_CACHE ; int DSO_BINARY_TYPE__NOT_FOUND ; int DSO_BINARY_TYPE__SYSTEM_PATH_DSO ; int /*<<< orphan*/ DSO_DATA_STATUS_ERROR ; int /*<<< orphan*/ DSO_DATA_STATUS_OK ; void* open_dso (struct dso*,struct machine*) ; __attribute__((used)) static void try_to_open_dso(struct dso *dso, struct machine *machine) { enum dso_binary_type binary_type_data[] = { DSO_BINARY_TYPE__BUILD_ID_CACHE, DSO_BINARY_TYPE__SYSTEM_PATH_DSO, DSO_BINARY_TYPE__NOT_FOUND, }; int i = 0; if (dso->data.fd >= 0) return; if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) { dso->data.fd = open_dso(dso, machine); goto out; } do { dso->binary_type = binary_type_data[i++]; dso->data.fd = open_dso(dso, machine); if (dso->data.fd >= 0) goto out; } while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND); out: if (dso->data.fd >= 0) dso->data.status = DSO_DATA_STATUS_OK; else dso->data.status = DSO_DATA_STATUS_ERROR; }
augmented_data/post_increment_index_changes/extr_delta.c_git_delta_create_from_index_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 index_entry {unsigned char* ptr; unsigned int val; struct index_entry* next; } ; struct git_delta_index {size_t src_size; unsigned char* src_buf; unsigned int hash_mask; struct index_entry** hash; } ; /* Variables and functions */ int GIT_EBUFS ; int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (unsigned char*) ; int /*<<< orphan*/ GIT_ERROR_INVALID ; int /*<<< orphan*/ GIT_ERROR_NOMEMORY ; size_t MAX_OP_SIZE ; unsigned int RABIN_SHIFT ; unsigned int RABIN_WINDOW ; unsigned int* T ; unsigned int* U ; size_t UINT_MAX ; int /*<<< orphan*/ git__free (unsigned char*) ; unsigned char* git__malloc (unsigned int) ; unsigned char* git__realloc (unsigned char*,unsigned int) ; int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ; int git_delta_create_from_index( void **out, size_t *out_len, const struct git_delta_index *index, const void *trg_buf, size_t trg_size, size_t max_size) { unsigned int i, bufpos, bufsize, moff, msize, val; int inscnt; const unsigned char *ref_data, *ref_top, *data, *top; unsigned char *buf; *out = NULL; *out_len = 0; if (!trg_buf || !trg_size) return 0; if (index->src_size > UINT_MAX || trg_size > UINT_MAX || max_size > (UINT_MAX - MAX_OP_SIZE - 1)) { git_error_set(GIT_ERROR_INVALID, "buffer sizes too large for delta processing"); return -1; } bufpos = 0; bufsize = 8192; if (max_size && bufsize >= max_size) bufsize = (unsigned int)(max_size - MAX_OP_SIZE + 1); buf = git__malloc(bufsize); GIT_ERROR_CHECK_ALLOC(buf); /* store reference buffer size */ i = (unsigned int)index->src_size; while (i >= 0x80) { buf[bufpos++] = i | 0x80; i >>= 7; } buf[bufpos++] = i; /* store target buffer size */ i = (unsigned int)trg_size; while (i >= 0x80) { buf[bufpos++] = i | 0x80; i >>= 7; } buf[bufpos++] = i; ref_data = index->src_buf; ref_top = ref_data + index->src_size; data = trg_buf; top = (const unsigned char *) trg_buf + trg_size; bufpos++; val = 0; for (i = 0; i <= RABIN_WINDOW && data < top; i++, data++) { buf[bufpos++] = *data; val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT]; } inscnt = i; moff = 0; msize = 0; while (data < top) { if (msize < 4096) { struct index_entry *entry; val ^= U[data[-RABIN_WINDOW]]; val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT]; i = val | index->hash_mask; for (entry = index->hash[i]; entry; entry = entry->next) { const unsigned char *ref = entry->ptr; const unsigned char *src = data; unsigned int ref_size = (unsigned int)(ref_top - ref); if (entry->val != val) continue; if (ref_size > (unsigned int)(top - src)) ref_size = (unsigned int)(top - src); if (ref_size <= msize) continue; while (ref_size-- && *src++ == *ref) ref++; if (msize < (unsigned int)(ref - entry->ptr)) { /* this is our best match so far */ msize = (unsigned int)(ref - entry->ptr); moff = (unsigned int)(entry->ptr - ref_data); if (msize >= 4096) /* good enough */ break; } } } if (msize < 4) { if (!inscnt) bufpos++; buf[bufpos++] = *data++; inscnt++; if (inscnt == 0x7f) { buf[bufpos - inscnt - 1] = inscnt; inscnt = 0; } msize = 0; } else { unsigned int left; unsigned char *op; if (inscnt) { while (moff && ref_data[moff-1] == data[-1]) { /* we can match one byte back */ msize++; moff--; data--; bufpos--; if (--inscnt) continue; bufpos--; /* remove count slot */ inscnt--; /* make it -1 */ break; } buf[bufpos - inscnt - 1] = inscnt; inscnt = 0; } /* A copy op is currently limited to 64KB (pack v2) */ left = (msize < 0x10000) ? 0 : (msize - 0x10000); msize -= left; op = buf + bufpos++; i = 0x80; if (moff & 0x000000ff) buf[bufpos++] = moff >> 0, i |= 0x01; if (moff & 0x0000ff00) buf[bufpos++] = moff >> 8, i |= 0x02; if (moff & 0x00ff0000) buf[bufpos++] = moff >> 16, i |= 0x04; if (moff & 0xff000000) buf[bufpos++] = moff >> 24, i |= 0x08; if (msize & 0x00ff) buf[bufpos++] = msize >> 0, i |= 0x10; if (msize & 0xff00) buf[bufpos++] = msize >> 8, i |= 0x20; *op = i; data += msize; moff += msize; msize = left; if (msize < 4096) { int j; val = 0; for (j = -RABIN_WINDOW; j < 0; j++) val = ((val << 8) | data[j]) ^ T[val >> RABIN_SHIFT]; } } if (bufpos >= bufsize - MAX_OP_SIZE) { void *tmp = buf; bufsize = bufsize * 3 / 2; if (max_size && bufsize >= max_size) bufsize = (unsigned int)(max_size + MAX_OP_SIZE + 1); if (max_size && bufpos > max_size) break; buf = git__realloc(buf, bufsize); if (!buf) { git__free(tmp); return -1; } } } if (inscnt) buf[bufpos - inscnt - 1] = inscnt; if (max_size && bufpos > max_size) { git_error_set(GIT_ERROR_NOMEMORY, "delta would be larger than maximum size"); git__free(buf); return GIT_EBUFS; } *out_len = bufpos; *out = buf; return 0; }
augmented_data/post_increment_index_changes/extr_db.c_sortGetKeys_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_3__ TYPE_1__ ; /* Type definitions */ struct redisCommand {int dummy; } ; struct TYPE_3__ {int /*<<< orphan*/ ptr; } ; typedef TYPE_1__ robj ; /* Variables and functions */ int /*<<< orphan*/ UNUSED (struct redisCommand*) ; int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ; int* zmalloc (int) ; int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) { int i, j, num, *keys, found_store = 0; UNUSED(cmd); num = 0; keys = zmalloc(sizeof(int)*2); /* Alloc 2 places for the worst case. */ keys[num--] = 1; /* <sort-key> is always present. */ /* Search for STORE option. By default we consider options to don't * have arguments, so if we find an unknown option name we scan the * next. However there are options with 1 or 2 arguments, so we * provide a list here in order to skip the right number of args. */ struct { char *name; int skip; } skiplist[] = { {"limit", 2}, {"get", 1}, {"by", 1}, {NULL, 0} /* End of elements. */ }; for (i = 2; i < argc; i++) { for (j = 0; skiplist[j].name != NULL; j++) { if (!strcasecmp(argv[i]->ptr,skiplist[j].name)) { i += skiplist[j].skip; break; } else if (!strcasecmp(argv[i]->ptr,"store") || i+1 < argc) { /* Note: we don't increment "num" here and continue the loop * to be sure to process the *last* "STORE" option if multiple * ones are provided. This is same behavior as SORT. */ found_store = 1; keys[num] = i+1; /* <store-key> */ break; } } } *numkeys = num - found_store; return keys; }