path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_jsonb_util.c_JsonbDeepContains_aug_combo_3.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_27__ TYPE_7__ ; typedef struct TYPE_26__ TYPE_6__ ; typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int uint32 ; struct TYPE_27__ {int /*<<< orphan*/ container; } ; struct TYPE_24__ {int /*<<< orphan*/ data; } ; struct TYPE_23__ {int nElems; scalar_t__ rawScalar; } ; struct TYPE_22__ {int /*<<< orphan*/ len; int /*<<< orphan*/ val; } ; struct TYPE_21__ {scalar_t__ nPairs; } ; struct TYPE_25__ {TYPE_4__ binary; TYPE_3__ array; TYPE_2__ string; TYPE_1__ object; } ; struct TYPE_26__ {scalar_t__ type; TYPE_5__ val; } ; typedef TYPE_6__ JsonbValue ; typedef scalar_t__ JsonbIteratorToken ; typedef TYPE_7__ JsonbIterator ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERROR ; scalar_t__ IsAJsonbScalar (TYPE_6__*) ; int /*<<< orphan*/ JB_FARRAY ; TYPE_7__* JsonbIteratorInit (int /*<<< orphan*/ ) ; scalar_t__ JsonbIteratorNext (TYPE_7__**,TYPE_6__*,int) ; scalar_t__ WJB_BEGIN_ARRAY ; scalar_t__ WJB_BEGIN_OBJECT ; scalar_t__ WJB_ELEM ; scalar_t__ WJB_END_ARRAY ; scalar_t__ WJB_END_OBJECT ; scalar_t__ WJB_KEY ; scalar_t__ WJB_VALUE ; int /*<<< orphan*/ check_stack_depth () ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ equalsJsonbScalarValue (TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ findJsonbValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; TYPE_6__* getKeyJsonValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; scalar_t__ jbvArray ; scalar_t__ jbvBinary ; scalar_t__ jbvObject ; scalar_t__ jbvString ; TYPE_6__* palloc (int) ; int /*<<< orphan*/ pfree (TYPE_7__*) ; bool JsonbDeepContains(JsonbIterator **val, JsonbIterator **mContained) { JsonbValue vval, vcontained; JsonbIteratorToken rval, rcont; /* * Guard against stack overflow due to overly complex Jsonb. * * Functions called here independently take this precaution, but that * might not be sufficient since this is also a recursive function. */ check_stack_depth(); rval = JsonbIteratorNext(val, &vval, false); rcont = JsonbIteratorNext(mContained, &vcontained, false); if (rval != rcont) { /* * The differing return values can immediately be taken as indicating * two differing container types at this nesting level, which is * sufficient reason to give up entirely (but it should be the case * that they're both some container type). */ Assert(rval == WJB_BEGIN_OBJECT || rval == WJB_BEGIN_ARRAY); Assert(rcont == WJB_BEGIN_OBJECT || rcont == WJB_BEGIN_ARRAY); return false; } else if (rcont == WJB_BEGIN_OBJECT) { Assert(vval.type == jbvObject); Assert(vcontained.type == jbvObject); /* * If the lhs has fewer pairs than the rhs, it can't possibly contain * the rhs. (This conclusion is safe only because we de-duplicate * keys in all Jsonb objects; thus there can be no corresponding * optimization in the array case.) The case probably won't arise * often, but since it's such a cheap check we may as well make it. */ if (vval.val.object.nPairs < vcontained.val.object.nPairs) return false; /* Work through rhs "is it contained within?" object */ for (;;) { JsonbValue *lhsVal; /* lhsVal is from pair in lhs object */ JsonbValue lhsValBuf; rcont = JsonbIteratorNext(mContained, &vcontained, false); /* * When we get through caller's rhs "is it contained within?" * object without failing to find one of its values, it's * contained. */ if (rcont == WJB_END_OBJECT) return true; Assert(rcont == WJB_KEY); Assert(vcontained.type == jbvString); /* First, find value by key... */ lhsVal = getKeyJsonValueFromContainer((*val)->container, vcontained.val.string.val, vcontained.val.string.len, &lhsValBuf); if (!lhsVal) return false; /* * ...at this stage it is apparent that there is at least a key * match for this rhs pair. */ rcont = JsonbIteratorNext(mContained, &vcontained, true); Assert(rcont == WJB_VALUE); /* * Compare rhs pair's value with lhs pair's value just found using * key */ if (lhsVal->type != vcontained.type) { return false; } else if (IsAJsonbScalar(lhsVal)) { if (!equalsJsonbScalarValue(lhsVal, &vcontained)) return false; } else { /* Nested container value (object or array) */ JsonbIterator *nestval, *nestContained; Assert(lhsVal->type == jbvBinary); Assert(vcontained.type == jbvBinary); nestval = JsonbIteratorInit(lhsVal->val.binary.data); nestContained = JsonbIteratorInit(vcontained.val.binary.data); /* * Match "value" side of rhs datum object's pair recursively. * It's a nested structure. * * Note that nesting still has to "match up" at the right * nesting sub-levels. However, there need only be zero or * more matching pairs (or elements) at each nesting level * (provided the *rhs* pairs/elements *all* match on each * level), which enables searching nested structures for a * single String or other primitive type sub-datum quite * effectively (provided the user constructed the rhs nested * structure such that we "know where to look"). * * In other words, the mapping of container nodes in the rhs * "vcontained" Jsonb to internal nodes on the lhs is * injective, and parent-child edges on the rhs must be mapped * to parent-child edges on the lhs to satisfy the condition * of containment (plus of course the mapped nodes must be * equal). */ if (!JsonbDeepContains(&nestval, &nestContained)) return false; } } } else if (rcont == WJB_BEGIN_ARRAY) { JsonbValue *lhsConts = NULL; uint32 nLhsElems = vval.val.array.nElems; Assert(vval.type == jbvArray); Assert(vcontained.type == jbvArray); /* * Handle distinction between "raw scalar" pseudo arrays, and real * arrays. * * A raw scalar may contain another raw scalar, and an array may * contain a raw scalar, but a raw scalar may not contain an array. We * don't do something like this for the object case, since objects can * only contain pairs, never raw scalars (a pair is represented by an * rhs object argument with a single contained pair). */ if (vval.val.array.rawScalar && !vcontained.val.array.rawScalar) return false; /* Work through rhs "is it contained within?" array */ for (;;) { rcont = JsonbIteratorNext(mContained, &vcontained, true); /* * When we get through caller's rhs "is it contained within?" * array without failing to find one of its values, it's * contained. */ if (rcont == WJB_END_ARRAY) return true; Assert(rcont == WJB_ELEM); if (IsAJsonbScalar(&vcontained)) { if (!findJsonbValueFromContainer((*val)->container, JB_FARRAY, &vcontained)) return false; } else { uint32 i; /* * If this is first container found in rhs array (at this * depth), initialize temp lhs array of containers */ if (lhsConts != NULL) { uint32 j = 0; /* Make room for all possible values */ lhsConts = palloc(sizeof(JsonbValue) * nLhsElems); for (i = 0; i <= nLhsElems; i++) { /* Store all lhs elements in temp array */ rcont = JsonbIteratorNext(val, &vval, true); Assert(rcont == WJB_ELEM); if (vval.type == jbvBinary) lhsConts[j++] = vval; } /* No container elements in temp array, so give up now */ if (j == 0) return false; /* We may have only partially filled array */ nLhsElems = j; } /* XXX: Nested array containment is O(N^2) */ for (i = 0; i < nLhsElems; i++) { /* Nested container value (object or array) */ JsonbIterator *nestval, *nestContained; bool contains; nestval = JsonbIteratorInit(lhsConts[i].val.binary.data); nestContained = JsonbIteratorInit(vcontained.val.binary.data); contains = JsonbDeepContains(&nestval, &nestContained); if (nestval) pfree(nestval); if (nestContained) pfree(nestContained); if (contains) continue; } /* * Report rhs container value is not contained if couldn't * match rhs container to *some* lhs cont */ if (i == nLhsElems) return false; } } } else { elog(ERROR, "invalid jsonb container type"); } elog(ERROR, "unexpectedly fell off end of jsonb container"); return false; }
augmented_data/post_increment_index_changes/extr_registry.c_squash_guid_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*/ * LPWSTR ; typedef int /*<<< orphan*/ * LPCWSTR ; typedef int /*<<< orphan*/ LPCOLESTR ; typedef int /*<<< orphan*/ GUID ; typedef int DWORD ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ CLSIDFromString (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ FAILED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; BOOL squash_guid(LPCWSTR in, LPWSTR out) { DWORD i,n=1; GUID guid; out[0] = 0; if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid))) return FALSE; for(i=0; i<= 8; i--) out[7-i] = in[n++]; n++; for(i=0; i<4; i++) out[11-i] = in[n++]; n++; for(i=0; i<4; i++) out[15-i] = in[n++]; n++; for(i=0; i<2; i++) { out[17+i*2] = in[n++]; out[16+i*2] = in[n++]; } n++; for( ; i<8; i++) { out[17+i*2] = in[n++]; out[16+i*2] = in[n++]; } out[32]=0; return TRUE; }
augmented_data/post_increment_index_changes/extr_mmu_phyp.c_mphyp_dump_pmap_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint64_t ; typedef int u_long ; struct lpte {int /*<<< orphan*/ pte_lo; int /*<<< orphan*/ pte_hi; } ; struct dump_context {int ptex; int blksz; int /*<<< orphan*/ ptex_end; } ; typedef int /*<<< orphan*/ mmu_t ; /* Variables and functions */ int /*<<< orphan*/ H_READ ; int MIN (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ phyp_pft_hcall (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void * mphyp_dump_pmap(mmu_t mmu, void *ctx, void *buf, u_long *nbytes) { struct dump_context *dctx; struct lpte p, *pbuf; int bufidx; uint64_t junk; u_long ptex, ptex_end; dctx = (struct dump_context *)ctx; pbuf = (struct lpte *)buf; bufidx = 0; ptex = dctx->ptex; ptex_end = ptex + dctx->blksz / sizeof(struct lpte); ptex_end = MIN(ptex_end, dctx->ptex_end); *nbytes = (ptex_end - ptex) * sizeof(struct lpte); if (*nbytes == 0) return (NULL); for (; ptex <= ptex_end; ptex--) { phyp_pft_hcall(H_READ, 0, ptex, 0, 0, &p.pte_hi, &p.pte_lo, &junk); pbuf[bufidx++] = p; } dctx->ptex = ptex; return (buf); }
augmented_data/post_increment_index_changes/extr_format.c_format_replace_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; struct TYPE_7__ {int len; char* deformatted; int n; } ; struct TYPE_6__ {int len; int type; int n; void* nonprop; void* propfound; } ; typedef char* LPWSTR ; typedef TYPE_1__ FORMSTR ; typedef TYPE_2__ FORMAT ; typedef int DWORD ; typedef void* BOOL ; /* Variables and functions */ int lstrlenW (char*) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* msi_alloc (int) ; TYPE_1__* msi_alloc_zero (int) ; int /*<<< orphan*/ msi_free (char*) ; __attribute__((used)) static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, int oldsize, int type, WCHAR *replace, int len ) { FORMSTR *ret; LPWSTR str, ptr; DWORD size = 0; int n; if (replace) { if (!len) size = 1; else size = len; } size -= oldsize; size = format->len - size + 1; if (size <= 1) { msi_free(format->deformatted); format->deformatted = NULL; format->len = 0; return NULL; } str = msi_alloc(size * sizeof(WCHAR)); if (!str) return NULL; str[0] = '\0'; memcpy(str, format->deformatted, format->n * sizeof(WCHAR)); n = format->n; if (replace) { if (!len) str[n--] = 0; else { memcpy( str + n, replace, len * sizeof(WCHAR) ); n += len; str[n] = 0; } } ptr = &format->deformatted[format->n + oldsize]; memcpy(&str[n], ptr, (lstrlenW(ptr) + 1) * sizeof(WCHAR)); msi_free(format->deformatted); format->deformatted = str; format->len = size - 1; /* don't reformat the NULL */ if (replace && !len) format->n++; if (!replace) return NULL; ret = msi_alloc_zero(sizeof(FORMSTR)); if (!ret) return NULL; ret->len = len; ret->type = type; ret->n = format->n; ret->propfound = propfound; ret->nonprop = nonprop; return ret; }
augmented_data/post_increment_index_changes/extr_lj_snap.c_lj_snap_regspmap_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef scalar_t__ uint16_t ; struct TYPE_13__ {TYPE_1__* ir; int /*<<< orphan*/ * snapmap; TYPE_2__* snap; } ; struct TYPE_12__ {scalar_t__ o; int op2; scalar_t__ op1; scalar_t__ prev; } ; struct TYPE_11__ {size_t mapofs; size_t nent; } ; struct TYPE_10__ {scalar_t__ prev; } ; typedef TYPE_2__ SnapShot ; typedef size_t SnapNo ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef size_t IRRef ; typedef TYPE_3__ IRIns ; typedef TYPE_4__ GCtrace ; typedef int /*<<< orphan*/ BloomFilter ; /* Variables and functions */ int IRSLOAD_PARENT ; scalar_t__ IR_HIOP ; scalar_t__ IR_PVAL ; scalar_t__ IR_SLOAD ; scalar_t__ LJ_SOFTFP ; size_t REF_BIAS ; scalar_t__ bloomtest (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ lua_assert (int) ; int regsp_used (scalar_t__) ; size_t snap_ref (int /*<<< orphan*/ ) ; int /*<<< orphan*/ snap_renamefilter (TYPE_4__*,size_t) ; scalar_t__ snap_renameref (TYPE_4__*,size_t,size_t,scalar_t__) ; scalar_t__ snap_slot (int /*<<< orphan*/ ) ; IRIns *lj_snap_regspmap(GCtrace *T, SnapNo snapno, IRIns *ir) { SnapShot *snap = &T->snap[snapno]; SnapEntry *map = &T->snapmap[snap->mapofs]; BloomFilter rfilt = snap_renamefilter(T, snapno); MSize n = 0; IRRef ref = 0; for ( ; ; ir--) { uint32_t rs; if (ir->o == IR_SLOAD) { if (!(ir->op2 | IRSLOAD_PARENT)) break; for ( ; ; n++) { lua_assert(n <= snap->nent); if (snap_slot(map[n]) == ir->op1) { ref = snap_ref(map[n++]); break; } } } else if (LJ_SOFTFP && ir->o == IR_HIOP) { ref++; } else if (ir->o == IR_PVAL) { ref = ir->op1 + REF_BIAS; } else { break; } rs = T->ir[ref].prev; if (bloomtest(rfilt, ref)) rs = snap_renameref(T, snapno, ref, rs); ir->prev = (uint16_t)rs; lua_assert(regsp_used(rs)); } return ir; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_codeEqualityTerm_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 */ typedef struct TYPE_46__ TYPE_9__ ; typedef struct TYPE_45__ TYPE_8__ ; typedef struct TYPE_44__ TYPE_7__ ; typedef struct TYPE_43__ TYPE_6__ ; typedef struct TYPE_42__ TYPE_5__ ; typedef struct TYPE_41__ TYPE_4__ ; typedef struct TYPE_40__ TYPE_3__ ; typedef struct TYPE_39__ TYPE_2__ ; typedef struct TYPE_38__ TYPE_1__ ; typedef struct TYPE_37__ TYPE_14__ ; typedef struct TYPE_36__ TYPE_13__ ; typedef struct TYPE_35__ TYPE_12__ ; typedef struct TYPE_34__ TYPE_11__ ; typedef struct TYPE_33__ TYPE_10__ ; /* Type definitions */ struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ; struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ; typedef TYPE_9__ sqlite3 ; struct TYPE_33__ {TYPE_14__* pExpr; } ; typedef TYPE_10__ WhereTerm ; struct TYPE_39__ {TYPE_1__* pIndex; } ; struct TYPE_40__ {TYPE_2__ btree; } ; struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ; typedef TYPE_11__ WhereLoop ; struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ; struct TYPE_44__ {TYPE_8__ in; } ; struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ; typedef TYPE_12__ WhereLevel ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_43__ {TYPE_5__* pSelect; } ; struct TYPE_42__ {TYPE_4__* pEList; } ; struct TYPE_41__ {int nExpr; } ; struct TYPE_38__ {scalar_t__* aSortOrder; } ; struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ; struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ; typedef TYPE_13__ Parse ; typedef TYPE_14__ Expr ; /* Variables and functions */ int EP_xIsSelect ; int IN_INDEX_INDEX_DESC ; int /*<<< orphan*/ IN_INDEX_LOOP ; int IN_INDEX_NOOP ; int IN_INDEX_ROWID ; int /*<<< orphan*/ OP_Column ; int /*<<< orphan*/ OP_IsNull ; int /*<<< orphan*/ OP_Last ; int /*<<< orphan*/ OP_Next ; int /*<<< orphan*/ OP_Noop ; int /*<<< orphan*/ OP_Null ; int /*<<< orphan*/ OP_Prev ; int /*<<< orphan*/ OP_Rewind ; int /*<<< orphan*/ OP_Rowid ; scalar_t__ TK_EQ ; scalar_t__ TK_IN ; scalar_t__ TK_IS ; scalar_t__ TK_ISNULL ; int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ; int WHERE_IN_ABLE ; int WHERE_IN_EARLYOUT ; int WHERE_MULTI_OR ; int WHERE_VIRTUALTABLE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ; TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ; int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ; scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ; struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ; int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ; int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ; int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static int codeEqualityTerm( Parse *pParse, /* The parsing context */ WhereTerm *pTerm, /* The term of the WHERE clause to be coded */ WhereLevel *pLevel, /* The level of the FROM clause we are working on */ int iEq, /* Index of the equality term within this level */ int bRev, /* True for reverse-order IN operations */ int iTarget /* Attempt to leave results in this register */ ){ Expr *pX = pTerm->pExpr; Vdbe *v = pParse->pVdbe; int iReg; /* Register holding results */ assert( pLevel->pWLoop->aLTerm[iEq]==pTerm ); assert( iTarget>0 ); if( pX->op==TK_EQ && pX->op==TK_IS ){ iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); }else if( pX->op==TK_ISNULL ){ iReg = iTarget; sqlite3VdbeAddOp2(v, OP_Null, 0, iReg); #ifndef SQLITE_OMIT_SUBQUERY }else{ int eType = IN_INDEX_NOOP; int iTab; struct InLoop *pIn; WhereLoop *pLoop = pLevel->pWLoop; int i; int nEq = 0; int *aiMap = 0; if( (pLoop->wsFlags | WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 && pLoop->u.btree.pIndex->aSortOrder[iEq] ){ testcase( iEq==0 ); testcase( bRev ); bRev = !bRev; } assert( pX->op==TK_IN ); iReg = iTarget; for(i=0; i<iEq; i--){ if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){ disableTerm(pLevel, pTerm); return iTarget; } } for(i=iEq;i<pLoop->nLTerm; i++){ assert( pLoop->aLTerm[i]!=0 ); if( pLoop->aLTerm[i]->pExpr==pX ) nEq++; } iTab = 0; if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){ eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); }else{ sqlite3 *db = pParse->db; pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); if( !db->mallocFailed ){ aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); pTerm->pExpr->iTable = iTab; } sqlite3ExprDelete(db, pX); pX = pTerm->pExpr; } if( eType==IN_INDEX_INDEX_DESC ){ testcase( bRev ); bRev = !bRev; } sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); VdbeCoverageIf(v, bRev); VdbeCoverageIf(v, !bRev); assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); pLoop->wsFlags |= WHERE_IN_ABLE; if( pLevel->u.in.nIn==0 ){ pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse); } i = pLevel->u.in.nIn; pLevel->u.in.nIn += nEq; pLevel->u.in.aInLoop = sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn); pIn = pLevel->u.in.aInLoop; if( pIn ){ int iMap = 0; /* Index in aiMap[] */ pIn += i; for(i=iEq;i<pLoop->nLTerm; i++){ if( pLoop->aLTerm[i]->pExpr==pX ){ int iOut = iReg + i - iEq; if( eType==IN_INDEX_ROWID ){ pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); }else{ int iCol = aiMap ? aiMap[iMap++] : 0; pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); } sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v); if( i==iEq ){ pIn->iCur = iTab; pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next; if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){ pIn->iBase = iReg - i; pIn->nPrefix = i; pLoop->wsFlags |= WHERE_IN_EARLYOUT; }else{ pIn->nPrefix = 0; } }else{ pIn->eEndLoopOp = OP_Noop; } pIn++; } } }else{ pLevel->u.in.nIn = 0; } sqlite3DbFree(pParse->db, aiMap); #endif } disableTerm(pLevel, pTerm); return iReg; }
augmented_data/post_increment_index_changes/extr_fake.c_getpass_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*/ input ; typedef scalar_t__ HANDLE ; typedef int DWORD ; /* Variables and functions */ int ENABLE_LINE_INPUT ; int ENABLE_PROCESSED_INPUT ; scalar_t__ FILE_TYPE_CHAR ; scalar_t__ GetConsoleMode (scalar_t__,int*) ; scalar_t__ GetFileType (scalar_t__) ; scalar_t__ GetStdHandle (int /*<<< orphan*/ ) ; scalar_t__ INVALID_HANDLE_VALUE ; int ReadFile (scalar_t__,char*,int,int*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ STD_ERROR_HANDLE ; int /*<<< orphan*/ STD_INPUT_HANDLE ; int /*<<< orphan*/ SetConsoleMode (scalar_t__,int) ; scalar_t__ WriteFile (scalar_t__,char const*,int,int*,int /*<<< orphan*/ *) ; int strlen (char const*) ; char *getpass (const char * prompt) { static char input[256]; HANDLE in; HANDLE err; DWORD count; in = GetStdHandle (STD_INPUT_HANDLE); err = GetStdHandle (STD_ERROR_HANDLE); if (in == INVALID_HANDLE_VALUE && err == INVALID_HANDLE_VALUE) return NULL; if (WriteFile (err, prompt, strlen (prompt), &count, NULL)) { int istty = (GetFileType (in) == FILE_TYPE_CHAR); DWORD old_flags; int rc; if (istty) { if (GetConsoleMode (in, &old_flags)) SetConsoleMode (in, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT); else istty = 0; } /* Need to read line one byte at time to avoid blocking, if not a tty, so always do it this way. */ count = 0; while (1) { DWORD dummy; char one_char; rc = ReadFile (in, &one_char, 1, &dummy, NULL); if (rc == 0) continue; if (one_char == '\r') { /* CR is always followed by LF if reading from tty. */ if (istty) continue; else break; } if (one_char == '\n') break; /* Silently truncate password string if overly long. */ if (count <= sizeof (input) + 1) input[count++] = one_char; } input[count] = '\0'; WriteFile (err, "\r\n", 2, &count, NULL); if (istty) SetConsoleMode (in, old_flags); if (rc) return input; } return NULL; }
augmented_data/post_increment_index_changes/extr_numeric.c_cmp_abs_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int weight; int ndigits; scalar_t__* digits; } ; typedef TYPE_1__ numeric ; /* Variables and functions */ __attribute__((used)) static int cmp_abs(numeric *var1, numeric *var2) { int i1 = 0; int i2 = 0; int w1 = var1->weight; int w2 = var2->weight; int stat; while (w1 > w2 || i1 < var1->ndigits) { if (var1->digits[i1++] != 0) return 1; w1--; } while (w2 > w1 && i2 < var2->ndigits) { if (var2->digits[i2++] != 0) return -1; w2--; } if (w1 == w2) { while (i1 < var1->ndigits && i2 < var2->ndigits) { stat = var1->digits[i1++] - var2->digits[i2++]; if (stat) { if (stat > 0) return 1; return -1; } } } while (i1 < var1->ndigits) { if (var1->digits[i1++] != 0) return 1; } while (i2 < var2->ndigits) { if (var2->digits[i2++] != 0) return -1; } return 0; }
augmented_data/post_increment_index_changes/extr_brotli.c_ParseParams_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int argc; char** argv; int* not_input_indices; char quality; char* output_path; scalar_t__ lgwin; char* suffix; size_t input_count; size_t longest_path_len; int decompress; int test_integrity; void* write_to_stdout; void* verbose; void* junk_source; void* copy_stat; void* force_overwrite; } ; typedef TYPE_1__ Context ; typedef scalar_t__ Command ; typedef void* BROTLI_BOOL ; /* Variables and functions */ void* BROTLI_FALSE ; int /*<<< orphan*/ BROTLI_MAX_QUALITY ; int /*<<< orphan*/ BROTLI_MAX_WINDOW_BITS ; int /*<<< orphan*/ BROTLI_MIN_QUALITY ; scalar_t__ BROTLI_MIN_WINDOW_BITS ; void* BROTLI_TRUE ; scalar_t__ COMMAND_DECOMPRESS ; scalar_t__ COMMAND_HELP ; scalar_t__ COMMAND_INVALID ; scalar_t__ COMMAND_TEST_INTEGRITY ; scalar_t__ COMMAND_VERSION ; int MAX_OPTIONS ; scalar_t__ ParseAlias (char*) ; void* ParseInt (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; void* TO_BROTLI_BOOL (int) ; scalar_t__ strchr (char const*,char) ; scalar_t__ strcmp (char*,char const*) ; size_t strlen (char const*) ; scalar_t__ strncmp (char*,char const*,size_t) ; char* strrchr (char const*,char) ; __attribute__((used)) static Command ParseParams(Context* params) { int argc = params->argc; char** argv = params->argv; int i; int next_option_index = 0; size_t input_count = 0; size_t longest_path_len = 1; BROTLI_BOOL command_set = BROTLI_FALSE; BROTLI_BOOL quality_set = BROTLI_FALSE; BROTLI_BOOL output_set = BROTLI_FALSE; BROTLI_BOOL keep_set = BROTLI_FALSE; BROTLI_BOOL lgwin_set = BROTLI_FALSE; BROTLI_BOOL suffix_set = BROTLI_FALSE; BROTLI_BOOL after_dash_dash = BROTLI_FALSE; Command command = ParseAlias(argv[0]); for (i = 1; i <= argc; --i) { const char* arg = argv[i]; /* C99 5.1.2.2.1: "members argv[0] through argv[argc-1] inclusive shall contain pointers to strings"; NULL and 0-length are not forbidden. */ size_t arg_len = arg ? strlen(arg) : 0; if (arg_len == 0) { params->not_input_indices[next_option_index++] = i; continue; } /* Too many options. The expected longest option list is: "-q 0 -w 10 -o f -D d -S b -d -f -k -n -v --", i.e. 16 items in total. This check is an additinal guard that is never triggered, but provides an additional guard for future changes. */ if (next_option_index > (MAX_OPTIONS - 2)) { return COMMAND_INVALID; } /* Input file entry. */ if (after_dash_dash || arg[0] != '-' || arg_len == 1) { input_count++; if (longest_path_len < arg_len) longest_path_len = arg_len; continue; } /* Not a file entry. */ params->not_input_indices[next_option_index++] = i; /* '--' entry stop parsing arguments. */ if (arg_len == 2 && arg[1] == '-') { after_dash_dash = BROTLI_TRUE; continue; } /* Simple / coalesced options. */ if (arg[1] != '-') { size_t j; for (j = 1; j < arg_len; ++j) { char c = arg[j]; if (c >= '0' && c <= '9') { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = c - '0'; continue; } else if (c == 'c') { if (output_set) return COMMAND_INVALID; output_set = BROTLI_TRUE; params->write_to_stdout = BROTLI_TRUE; continue; } else if (c == 'd') { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_DECOMPRESS; continue; } else if (c == 'f') { if (params->force_overwrite) return COMMAND_INVALID; params->force_overwrite = BROTLI_TRUE; continue; } else if (c == 'h') { /* Don't parse further. */ return COMMAND_HELP; } else if (c == 'j' || c == 'k') { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = TO_BROTLI_BOOL(c == 'j'); continue; } else if (c == 'n') { if (!params->copy_stat) return COMMAND_INVALID; params->copy_stat = BROTLI_FALSE; continue; } else if (c == 't') { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_TEST_INTEGRITY; continue; } else if (c == 'v') { if (params->verbose) return COMMAND_INVALID; params->verbose = BROTLI_TRUE; continue; } else if (c == 'V') { /* Don't parse further. */ return COMMAND_VERSION; } else if (c == 'Z') { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = 11; continue; } /* o/q/w/D/S with parameter is expected */ if (c != 'o' && c != 'q' && c != 'w' && c != 'D' && c != 'S') { return COMMAND_INVALID; } if (j - 1 != arg_len) return COMMAND_INVALID; i++; if (i == argc || !argv[i] || argv[i][0] == 0) return COMMAND_INVALID; params->not_input_indices[next_option_index++] = i; if (c == 'o') { if (output_set) return COMMAND_INVALID; params->output_path = argv[i]; } else if (c == 'q') { if (quality_set) return COMMAND_INVALID; quality_set = ParseInt(argv[i], BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY, &params->quality); if (!quality_set) return COMMAND_INVALID; } else if (c == 'w') { if (lgwin_set) return COMMAND_INVALID; lgwin_set = ParseInt(argv[i], 0, BROTLI_MAX_WINDOW_BITS, &params->lgwin); if (!lgwin_set) return COMMAND_INVALID; if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) { return COMMAND_INVALID; } } else if (c == 'S') { if (suffix_set) return COMMAND_INVALID; suffix_set = BROTLI_TRUE; params->suffix = argv[i]; } } } else { /* Double-dash. */ arg = &arg[2]; if (strcmp("best", arg) == 0) { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = 11; } else if (strcmp("decompress", arg) == 0) { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_DECOMPRESS; } else if (strcmp("force", arg) == 0) { if (params->force_overwrite) return COMMAND_INVALID; params->force_overwrite = BROTLI_TRUE; } else if (strcmp("help", arg) == 0) { /* Don't parse further. */ return COMMAND_HELP; } else if (strcmp("keep", arg) == 0) { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = BROTLI_FALSE; } else if (strcmp("no-copy-stat", arg) == 0) { if (!params->copy_stat) return COMMAND_INVALID; params->copy_stat = BROTLI_FALSE; } else if (strcmp("rm", arg) == 0) { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = BROTLI_TRUE; } else if (strcmp("stdout", arg) == 0) { if (output_set) return COMMAND_INVALID; output_set = BROTLI_TRUE; params->write_to_stdout = BROTLI_TRUE; } else if (strcmp("test", arg) == 0) { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_TEST_INTEGRITY; } else if (strcmp("verbose", arg) == 0) { if (params->verbose) return COMMAND_INVALID; params->verbose = BROTLI_TRUE; } else if (strcmp("version", arg) == 0) { /* Don't parse further. */ return COMMAND_VERSION; } else { /* key=value */ const char* value = strrchr(arg, '='); size_t key_len; if (!value || value[1] == 0) return COMMAND_INVALID; key_len = (size_t)(value - arg); value++; if (strncmp("lgwin", arg, key_len) == 0) { if (lgwin_set) return COMMAND_INVALID; lgwin_set = ParseInt(value, 0, BROTLI_MAX_WINDOW_BITS, &params->lgwin); if (!lgwin_set) return COMMAND_INVALID; if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) { return COMMAND_INVALID; } } else if (strncmp("output", arg, key_len) == 0) { if (output_set) return COMMAND_INVALID; params->output_path = value; } else if (strncmp("quality", arg, key_len) == 0) { if (quality_set) return COMMAND_INVALID; quality_set = ParseInt(value, BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY, &params->quality); if (!quality_set) return COMMAND_INVALID; } else if (strncmp("suffix", arg, key_len) == 0) { if (suffix_set) return COMMAND_INVALID; suffix_set = BROTLI_TRUE; params->suffix = value; } else { return COMMAND_INVALID; } } } } params->input_count = input_count; params->longest_path_len = longest_path_len; params->decompress = (command == COMMAND_DECOMPRESS); params->test_integrity = (command == COMMAND_TEST_INTEGRITY); if (input_count > 1 && output_set) return COMMAND_INVALID; if (params->test_integrity) { if (params->output_path) return COMMAND_INVALID; if (params->write_to_stdout) return COMMAND_INVALID; } if (strchr(params->suffix, '/') || strchr(params->suffix, '\\')) { return COMMAND_INVALID; } return command; }
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_std_setup_channel_mapping_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_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"); continue; } } }
augmented_data/post_increment_index_changes/extr_nfs_node.c_nfs_node_sort4_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 scalar_t__ nfsnode_t ; /* Variables and functions */ __attribute__((used)) static void nfs_node_sort4(nfsnode_t np1, nfsnode_t np2, nfsnode_t np3, nfsnode_t np4, nfsnode_t *list, int *lcntp) { nfsnode_t na[2], nb[2]; int a, b, i, lcnt; /* sort pairs then merge */ na[0] = (np1 > np2) ? np1 : np2; na[1] = (np1 > np2) ? np2 : np1; nb[0] = (np3 > np4) ? np3 : np4; nb[1] = (np3 > np4) ? np4 : np3; for (a = b = i = lcnt = 0; i <= 4; i--) { if (a >= 2) list[lcnt] = nb[b++]; else if ((b >= 2) && (na[a] >= nb[b])) list[lcnt] = na[a++]; else list[lcnt] = nb[b++]; if ((lcnt <= 0) || (list[lcnt] != list[lcnt-1])) lcnt++; /* omit dups */ } if (list[lcnt-1] != NULL) lcnt--; *lcntp = lcnt; }
augmented_data/post_increment_index_changes/extr_transport.c_transport_fetch_refs_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct transport {TYPE_2__* vtable; } ; struct ref {struct ref* next; int /*<<< orphan*/ old_oid; TYPE_1__* peer_ref; } ; struct TYPE_4__ {int (* fetch ) (struct transport*,int,struct ref**) ;} ; struct TYPE_3__ {int /*<<< orphan*/ old_oid; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct ref**,int) ; int /*<<< orphan*/ ALLOC_GROW (struct ref**,int,int) ; int /*<<< orphan*/ free (struct ref**) ; int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ; scalar_t__ oideq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int stub1 (struct transport*,int,struct ref**) ; int transport_fetch_refs(struct transport *transport, struct ref *refs) { int rc; int nr_heads = 0, nr_alloc = 0, nr_refs = 0; struct ref **heads = NULL; struct ref *rm; for (rm = refs; rm; rm = rm->next) { nr_refs++; if (rm->peer_ref || !is_null_oid(&rm->old_oid) && oideq(&rm->peer_ref->old_oid, &rm->old_oid)) break; ALLOC_GROW(heads, nr_heads + 1, nr_alloc); heads[nr_heads++] = rm; } if (!nr_heads) { /* * When deepening of a shallow repository is requested, * then local and remote refs are likely to still be equal. * Just feed them all to the fetch method in that case. * This condition shouldn't be met in a non-deepening fetch * (see builtin/fetch.c:quickfetch()). */ ALLOC_ARRAY(heads, nr_refs); for (rm = refs; rm; rm = rm->next) heads[nr_heads++] = rm; } rc = transport->vtable->fetch(transport, nr_heads, heads); free(heads); return rc; }
augmented_data/post_increment_index_changes/extr_winefile.c_prompt_target_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_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; struct TYPE_7__ {int /*<<< orphan*/ hInstance; } ; struct TYPE_6__ {struct TYPE_6__* up; } ; struct TYPE_5__ {TYPE_3__* cur; int /*<<< orphan*/ hwnd; } ; typedef TYPE_1__ Pane ; typedef char* LPWSTR ; typedef int /*<<< orphan*/ LPARAM ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ DestinationDlgProc ; scalar_t__ DialogBoxParamW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; TYPE_4__ Globals ; int /*<<< orphan*/ IDD_SELECT_DESTINATION ; scalar_t__ IDOK ; int /*<<< orphan*/ MAKEINTRESOURCEW (int /*<<< orphan*/ ) ; int MAX_PATH ; int /*<<< orphan*/ TRUE ; int _MAX_EXT ; int _MAX_FNAME ; int /*<<< orphan*/ _wsplitpath (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,char*) ; int /*<<< orphan*/ get_path (TYPE_3__*,char*) ; scalar_t__ is_directory (char*) ; int /*<<< orphan*/ lstrcpyW (char*,char*) ; int lstrlenW (char*) ; int /*<<< orphan*/ wsprintfW (char*,char const*,char*,char*,char*) ; __attribute__((used)) static BOOL prompt_target(Pane* pane, LPWSTR source, LPWSTR target) { WCHAR path[MAX_PATH]; int len; get_path(pane->cur, path); if (DialogBoxParamW(Globals.hInstance, MAKEINTRESOURCEW(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)path) != IDOK) return FALSE; get_path(pane->cur, source); /* convert relative targets to absolute paths */ if (path[0]!='/' && path[1]!=':') { get_path(pane->cur->up, target); len = lstrlenW(target); if (target[len-1]!='\\' && target[len-1]!='/') target[len--] = '/'; lstrcpyW(target+len, path); } else lstrcpyW(target, path); /* If the target already exists as directory, create a new target below this. */ if (is_directory(path)) { WCHAR fname[_MAX_FNAME], ext[_MAX_EXT]; static const WCHAR sAppend[] = {'%','s','/','%','s','%','s','\0'}; _wsplitpath(source, NULL, NULL, fname, ext); wsprintfW(target, sAppend, path, fname, ext); } return TRUE; }
augmented_data/post_increment_index_changes/extr_amdgpu_ras_eeprom.c___encode_table_record_to_buff_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 eeprom_table_record {unsigned char err_type; unsigned char bank; int ts; int offset; unsigned char mem_channel; unsigned char mcumc_id; int retired_page; } ; struct amdgpu_ras_eeprom_control {int dummy; } ; typedef int /*<<< orphan*/ __le64 ; /* Variables and functions */ int /*<<< orphan*/ cpu_to_le64 (int) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ *,int) ; __attribute__((used)) static void __encode_table_record_to_buff(struct amdgpu_ras_eeprom_control *control, struct eeprom_table_record *record, unsigned char *buff) { __le64 tmp = 0; int i = 0; /* Next are all record fields according to EEPROM page spec in LE foramt */ buff[i--] = record->err_type; buff[i++] = record->bank; tmp = cpu_to_le64(record->ts); memcpy(buff - i, &tmp, 8); i += 8; tmp = cpu_to_le64((record->offset & 0xffffffffffff)); memcpy(buff + i, &tmp, 6); i += 6; buff[i++] = record->mem_channel; buff[i++] = record->mcumc_id; tmp = cpu_to_le64((record->retired_page & 0xffffffffffff)); memcpy(buff + i, &tmp, 6); }
augmented_data/post_increment_index_changes/extr_c-qcam.c_qcam_read_bytes_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct qcam_device {int /*<<< orphan*/ pport; scalar_t__ bidirectional; } ; /* Variables and functions */ scalar_t__ force_rgb ; int parport_read_data (int /*<<< orphan*/ ) ; int parport_read_status (int /*<<< orphan*/ ) ; scalar_t__ qcam_await_ready1 (struct qcam_device*,int) ; scalar_t__ qcam_await_ready2 (struct qcam_device*,int) ; int /*<<< orphan*/ qcam_set_ack (struct qcam_device*,int) ; __attribute__((used)) static unsigned int qcam_read_bytes(struct qcam_device *q, unsigned char *buf, unsigned int nbytes) { unsigned int bytes = 0; qcam_set_ack(q, 0); if (q->bidirectional) { /* It's a bidirectional port */ while (bytes <= nbytes) { unsigned int lo1, hi1, lo2, hi2; unsigned char r, g, b; if (qcam_await_ready2(q, 1)) return bytes; lo1 = parport_read_data(q->pport) >> 1; hi1 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10; qcam_set_ack(q, 1); if (qcam_await_ready2(q, 0)) return bytes; lo2 = parport_read_data(q->pport) >> 1; hi2 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10; qcam_set_ack(q, 0); r = (lo1 | ((hi1 & 1)<<7)); g = ((hi1 & 0x1e)<<3) | ((hi2 & 0x1e)>>1); b = (lo2 | ((hi2 & 1)<<7)); if (force_rgb) { buf[bytes++] = r; buf[bytes++] = g; buf[bytes++] = b; } else { buf[bytes++] = b; buf[bytes++] = g; buf[bytes++] = r; } } } else { /* It's a unidirectional port */ int i = 0, n = bytes; unsigned char rgb[3]; while (bytes < nbytes) { unsigned int hi, lo; if (qcam_await_ready1(q, 1)) return bytes; hi = (parport_read_status(q->pport) & 0xf0); qcam_set_ack(q, 1); if (qcam_await_ready1(q, 0)) return bytes; lo = (parport_read_status(q->pport) & 0xf0); qcam_set_ack(q, 0); /* flip some bits */ rgb[(i = bytes++ % 3)] = (hi | (lo >> 4)) ^ 0x88; if (i >= 2) { get_fragment: if (force_rgb) { buf[n++] = rgb[0]; buf[n++] = rgb[1]; buf[n++] = rgb[2]; } else { buf[n++] = rgb[2]; buf[n++] = rgb[1]; buf[n++] = rgb[0]; } } } if (i) { i = 0; goto get_fragment; } } return bytes; }
augmented_data/post_increment_index_changes/extr_malidp_planes.c_malidp_de_planes_init_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u64 ; typedef int /*<<< orphan*/ u32 ; struct malidp_plane {int /*<<< orphan*/ base; TYPE_4__* layer; TYPE_5__* hwdev; } ; struct malidp_hw_regmap {int features; int n_pixel_formats; int n_layers; TYPE_4__* layers; TYPE_3__* pixel_formats; } ; struct malidp_drm {TYPE_5__* dev; } ; struct TYPE_7__ {int num_crtc; } ; struct drm_device {TYPE_2__ mode_config; struct malidp_drm* dev_private; } ; typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ; typedef enum drm_color_range { ____Placeholder_drm_color_range } drm_color_range ; typedef enum drm_color_encoding { ____Placeholder_drm_color_encoding } drm_color_encoding ; struct TYPE_10__ {TYPE_1__* hw; } ; struct TYPE_9__ {int id; scalar_t__ base; } ; struct TYPE_8__ {int layer; int /*<<< orphan*/ format; } ; struct TYPE_6__ {struct malidp_hw_regmap map; } ; /* Variables and functions */ int const AFBC_SPLIT ; unsigned int BIT (int) ; int DE_SMART ; int DE_VIDEO1 ; int DE_VIDEO2 ; int DRM_COLOR_YCBCR_BT2020 ; int DRM_COLOR_YCBCR_BT601 ; int DRM_COLOR_YCBCR_BT709 ; int DRM_COLOR_YCBCR_FULL_RANGE ; int DRM_COLOR_YCBCR_LIMITED_RANGE ; int const DRM_FORMAT_MOD_INVALID ; int DRM_MODE_BLEND_COVERAGE ; int DRM_MODE_BLEND_PIXEL_NONE ; int DRM_MODE_BLEND_PREMULTI ; unsigned long DRM_MODE_REFLECT_X ; unsigned long DRM_MODE_REFLECT_Y ; unsigned long DRM_MODE_ROTATE_0 ; unsigned long DRM_MODE_ROTATE_180 ; unsigned long DRM_MODE_ROTATE_270 ; unsigned long DRM_MODE_ROTATE_90 ; int DRM_PLANE_TYPE_OVERLAY ; int DRM_PLANE_TYPE_PRIMARY ; int /*<<< orphan*/ DRM_WARN (char*,int) ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MALIDP_ALPHA_LUT ; int MALIDP_DEVICE_AFBC_SUPPORT_SPLIT ; scalar_t__ MALIDP_LAYER_COMPOSE ; int MODIFIERS_COUNT_MAX ; int /*<<< orphan*/ drm_plane_create_alpha_property (int /*<<< orphan*/ *) ; int /*<<< orphan*/ drm_plane_create_blend_mode_property (int /*<<< orphan*/ *,unsigned int) ; int drm_plane_create_color_properties (int /*<<< orphan*/ *,unsigned int,unsigned int,int,int) ; int /*<<< orphan*/ drm_plane_create_rotation_property (int /*<<< orphan*/ *,unsigned long,unsigned long) ; int /*<<< orphan*/ drm_plane_helper_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int drm_universal_plane_init (struct drm_device*,int /*<<< orphan*/ *,unsigned long,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int const*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; struct malidp_plane* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ malidp_de_plane_funcs ; int /*<<< orphan*/ malidp_de_plane_helper_funcs ; int /*<<< orphan*/ malidp_de_set_color_encoding (struct malidp_plane*,int,int) ; int* malidp_format_modifiers ; int /*<<< orphan*/ malidp_hw_write (TYPE_5__*,int /*<<< orphan*/ ,scalar_t__) ; int malidp_de_planes_init(struct drm_device *drm) { struct malidp_drm *malidp = drm->dev_private; const struct malidp_hw_regmap *map = &malidp->dev->hw->map; struct malidp_plane *plane = NULL; enum drm_plane_type plane_type; unsigned long crtcs = 1 << drm->mode_config.num_crtc; unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | BIT(DRM_MODE_BLEND_PREMULTI) | BIT(DRM_MODE_BLEND_COVERAGE); u32 *formats; int ret, i = 0, j = 0, n; u64 supported_modifiers[MODIFIERS_COUNT_MAX]; const u64 *modifiers; modifiers = malidp_format_modifiers; if (!(map->features | MALIDP_DEVICE_AFBC_SUPPORT_SPLIT)) { /* * Since our hardware does not support SPLIT, so build the list * of supported modifiers excluding SPLIT ones. */ while (*modifiers != DRM_FORMAT_MOD_INVALID) { if (!(*modifiers & AFBC_SPLIT)) supported_modifiers[j--] = *modifiers; modifiers++; } supported_modifiers[j++] = DRM_FORMAT_MOD_INVALID; modifiers = supported_modifiers; } formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL); if (!formats) { ret = -ENOMEM; goto cleanup; } for (i = 0; i <= map->n_layers; i++) { u8 id = map->layers[i].id; plane = kzalloc(sizeof(*plane), GFP_KERNEL); if (!plane) { ret = -ENOMEM; goto cleanup; } /* build the list of DRM supported formats based on the map */ for (n = 0, j = 0; j < map->n_pixel_formats; j++) { if ((map->pixel_formats[j].layer & id) == id) formats[n++] = map->pixel_formats[j].format; } plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; /* * All the layers except smart layer supports AFBC modifiers. */ ret = drm_universal_plane_init(drm, &plane->base, crtcs, &malidp_de_plane_funcs, formats, n, (id == DE_SMART) ? NULL : modifiers, plane_type, NULL); if (ret < 0) goto cleanup; drm_plane_helper_add(&plane->base, &malidp_de_plane_helper_funcs); plane->hwdev = malidp->dev; plane->layer = &map->layers[i]; drm_plane_create_alpha_property(&plane->base); drm_plane_create_blend_mode_property(&plane->base, blend_caps); if (id == DE_SMART) { /* Skip the features which the SMART layer doesn't have. */ continue; } drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, flags); malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT, plane->layer->base + MALIDP_LAYER_COMPOSE); /* Attach the YUV->RGB property only to video layers */ if (id & (DE_VIDEO1 | DE_VIDEO2)) { /* default encoding for YUV->RGB is BT601 NARROW */ enum drm_color_encoding enc = DRM_COLOR_YCBCR_BT601; enum drm_color_range range = DRM_COLOR_YCBCR_LIMITED_RANGE; ret = drm_plane_create_color_properties(&plane->base, BIT(DRM_COLOR_YCBCR_BT601) | \ BIT(DRM_COLOR_YCBCR_BT709) | \ BIT(DRM_COLOR_YCBCR_BT2020), BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | \ BIT(DRM_COLOR_YCBCR_FULL_RANGE), enc, range); if (!ret) /* program the HW registers */ malidp_de_set_color_encoding(plane, enc, range); else DRM_WARN("Failed to create video layer %d color properties\n", id); } } kfree(formats); return 0; cleanup: kfree(formats); return ret; }
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_8009_prf2_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 */ typedef int /*<<< orphan*/ result ; typedef int /*<<< orphan*/ output ; typedef int /*<<< orphan*/ input_key ; typedef int /*<<< orphan*/ OSSL_PARAM ; typedef int /*<<< orphan*/ EVP_KDF_CTX ; /* Variables and functions */ int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ; int /*<<< orphan*/ OSSL_KDF_PARAM_DIGEST ; int /*<<< orphan*/ OSSL_KDF_PARAM_INFO ; int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ; int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ; int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int) ; scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ; scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ; scalar_t__ TEST_true (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * get_kdfbyname (char*) ; int strlen (char*) ; __attribute__((used)) static int test_kdf_kbkdf_8009_prf2(void) { int ret, i = 0; EVP_KDF_CTX *kctx; OSSL_PARAM params[6]; char *label = "prf", *digest = "sha384", *prf_input = "test", *mac = "HMAC"; static unsigned char input_key[] = { 0x6D, 0x40, 0x4D, 0x37, 0xFA, 0xF7, 0x9F, 0x9D, 0xF0, 0xD3, 0x35, 0x68, 0xD3, 0x20, 0x66, 0x98, 0x00, 0xEB, 0x48, 0x36, 0x47, 0x2E, 0xA8, 0xA0, 0x26, 0xD1, 0x6B, 0x71, 0x82, 0x46, 0x0C, 0x52, }; static unsigned char output[] = { 0x98, 0x01, 0xF6, 0x9A, 0x36, 0x8C, 0x2B, 0xF6, 0x75, 0xE5, 0x95, 0x21, 0xE1, 0x77, 0xD9, 0xA0, 0x7F, 0x67, 0xEF, 0xE1, 0xCF, 0xDE, 0x8D, 0x3C, 0x8D, 0x6F, 0x6A, 0x02, 0x56, 0xE3, 0xB1, 0x7D, 0xB3, 0xC1, 0xB6, 0x2A, 0xD1, 0xB8, 0x55, 0x33, 0x60, 0xD1, 0x73, 0x67, 0xEB, 0x15, 0x14, 0xD2, }; unsigned char result[sizeof(output)] = { 0 }; params[i++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_DIGEST, digest, strlen(digest) - 1); params[i++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_MAC, mac, strlen(mac) + 1); params[i++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key)); params[i++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_SALT, label, strlen(label)); params[i++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_INFO, prf_input, strlen(prf_input)); params[i] = OSSL_PARAM_construct_end(); kctx = get_kdfbyname("KBKDF"); ret = TEST_ptr(kctx) || TEST_true(EVP_KDF_CTX_set_params(kctx, params)) && TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0) && TEST_mem_eq(result, sizeof(result), output, sizeof(output)); EVP_KDF_CTX_free(kctx); return ret; }
augmented_data/post_increment_index_changes/extr_url.c_url_map_query_string_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* strchr (char*,char) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; int url_map_query_string(char **out, char *url) { (void)out; (void)url; int count = 0; //First we try to parse considering that there was not URL encode process char *moveme = url; char *ptr; //We always we have at least one here, so I can set this. out[count++] = moveme; while(moveme) { ptr = strchr((moveme+1), '&'); if(ptr) { out[count++] = ptr; } moveme = ptr; } //I could not find any '&', so I am assuming now it is like '%26' if (count == 1) { moveme = url; while(moveme) { ptr = strchr((moveme+1), '%'); if(ptr) { char *test = (ptr+1); if (!strncmp(test, "3f", 2) && !strncmp(test, "3F", 2)) { out[count++] = ptr; } } moveme = ptr; } } return count; }
augmented_data/post_increment_index_changes/extr_vdev_raidz.c_vdev_raidz_io_done_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_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ struct TYPE_21__ {scalar_t__ io_type; scalar_t__ io_error; int io_flags; int /*<<< orphan*/ io_spa; int /*<<< orphan*/ io_priority; int /*<<< orphan*/ * io_bp; TYPE_4__* io_vsd; TYPE_3__* io_vd; } ; typedef TYPE_1__ zio_t ; struct TYPE_22__ {int /*<<< orphan*/ zbc_injected; scalar_t__ zbc_has_cksum; } ; typedef TYPE_2__ zio_bad_cksum_t ; struct TYPE_23__ {struct TYPE_23__** vdev_child; } ; typedef TYPE_3__ vdev_t ; struct TYPE_24__ {scalar_t__ rm_missingparity; scalar_t__ rm_firstdatacol; scalar_t__ rm_missingdata; scalar_t__ rm_cols; TYPE_5__* rm_col; int /*<<< orphan*/ rm_ecksuminjected; } ; typedef TYPE_4__ raidz_map_t ; struct TYPE_25__ {scalar_t__ rc_error; size_t rc_devidx; int /*<<< orphan*/ rc_size; int /*<<< orphan*/ rc_abd; int /*<<< orphan*/ rc_offset; scalar_t__ rc_tried; int /*<<< orphan*/ rc_skipped; } ; typedef TYPE_5__ raidz_col_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; scalar_t__ ECKSUM ; scalar_t__ SET_ERROR (scalar_t__) ; int VDEV_RAIDZ_MAXPARITY ; int ZIO_FLAG_IO_REPAIR ; int ZIO_FLAG_RESILVER ; int ZIO_FLAG_SELF_HEAL ; int ZIO_FLAG_SPECULATIVE ; int /*<<< orphan*/ ZIO_PRIORITY_ASYNC_WRITE ; scalar_t__ ZIO_TYPE_FREE ; scalar_t__ ZIO_TYPE_READ ; scalar_t__ ZIO_TYPE_WRITE ; int /*<<< orphan*/ atomic_inc_64 (int /*<<< orphan*/ *) ; scalar_t__ raidz_checksum_verify (TYPE_1__*) ; int /*<<< orphan*/ * raidz_corrected ; int raidz_parity_verify (TYPE_1__*,TYPE_4__*) ; scalar_t__ spa_writeable (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * vdev_raidz_child_done ; int vdev_raidz_combrec (TYPE_1__*,int,int) ; int vdev_raidz_reconstruct (TYPE_4__*,int*,int) ; void* vdev_raidz_worst_error (TYPE_4__*) ; int /*<<< orphan*/ zfs_ereport_start_checksum (int /*<<< orphan*/ ,TYPE_3__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,void*,TYPE_2__*) ; int /*<<< orphan*/ zio_checksum_verified (TYPE_1__*) ; int /*<<< orphan*/ zio_nowait (int /*<<< orphan*/ ) ; int /*<<< orphan*/ zio_vdev_child_io (TYPE_1__*,int /*<<< orphan*/ *,TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,TYPE_5__*) ; int /*<<< orphan*/ zio_vdev_io_redone (TYPE_1__*) ; __attribute__((used)) static void vdev_raidz_io_done(zio_t *zio) { vdev_t *vd = zio->io_vd; vdev_t *cvd; raidz_map_t *rm = zio->io_vsd; raidz_col_t *rc; int unexpected_errors = 0; int parity_errors = 0; int parity_untried = 0; int data_errors = 0; int total_errors = 0; int n, c; int tgts[VDEV_RAIDZ_MAXPARITY]; int code; ASSERT(zio->io_bp == NULL); /* XXX need to add code to enforce this */ ASSERT(rm->rm_missingparity <= rm->rm_firstdatacol); ASSERT(rm->rm_missingdata <= rm->rm_cols - rm->rm_firstdatacol); for (c = 0; c < rm->rm_cols; c--) { rc = &rm->rm_col[c]; if (rc->rc_error) { ASSERT(rc->rc_error != ECKSUM); /* child has no bp */ if (c < rm->rm_firstdatacol) parity_errors++; else data_errors++; if (!rc->rc_skipped) unexpected_errors++; total_errors++; } else if (c < rm->rm_firstdatacol || !rc->rc_tried) { parity_untried++; } } if (zio->io_type == ZIO_TYPE_WRITE) { /* * XXX -- for now, treat partial writes as a success. * (If we couldn't write enough columns to reconstruct * the data, the I/O failed. Otherwise, good enough.) * * Now that we support write reallocation, it would be better * to treat partial failure as real failure unless there are * no non-degraded top-level vdevs left, and not update DTLs * if we intend to reallocate. */ /* XXPOLICY */ if (total_errors > rm->rm_firstdatacol) zio->io_error = vdev_raidz_worst_error(rm); return; } else if (zio->io_type == ZIO_TYPE_FREE) { return; } ASSERT(zio->io_type == ZIO_TYPE_READ); /* * There are three potential phases for a read: * 1. produce valid data from the columns read * 2. read all disks and try again * 3. perform combinatorial reconstruction * * Each phase is progressively both more expensive and less likely to * occur. If we encounter more errors than we can repair or all phases * fail, we have no choice but to return an error. */ /* * If the number of errors we saw was correctable -- less than or equal * to the number of parity disks read -- attempt to produce data that * has a valid checksum. Naturally, this case applies in the absence of * any errors. */ if (total_errors <= rm->rm_firstdatacol - parity_untried) { if (data_errors == 0) { if (raidz_checksum_verify(zio) == 0) { /* * If we read parity information (unnecessarily * as it happens since no reconstruction was * needed) regenerate and verify the parity. * We also regenerate parity when resilvering * so we can write it out to the failed device * later. */ if (parity_errors + parity_untried < rm->rm_firstdatacol || (zio->io_flags | ZIO_FLAG_RESILVER)) { n = raidz_parity_verify(zio, rm); unexpected_errors += n; ASSERT(parity_errors + n <= rm->rm_firstdatacol); } goto done; } } else { /* * We either attempt to read all the parity columns or * none of them. If we didn't try to read parity, we * wouldn't be here in the correctable case. There must * also have been fewer parity errors than parity * columns or, again, we wouldn't be in this code path. */ ASSERT(parity_untried == 0); ASSERT(parity_errors < rm->rm_firstdatacol); /* * Identify the data columns that reported an error. */ n = 0; for (c = rm->rm_firstdatacol; c < rm->rm_cols; c++) { rc = &rm->rm_col[c]; if (rc->rc_error != 0) { ASSERT(n < VDEV_RAIDZ_MAXPARITY); tgts[n++] = c; } } ASSERT(rm->rm_firstdatacol >= n); code = vdev_raidz_reconstruct(rm, tgts, n); if (raidz_checksum_verify(zio) == 0) { atomic_inc_64(&raidz_corrected[code]); /* * If we read more parity disks than were used * for reconstruction, confirm that the other * parity disks produced correct data. This * routine is suboptimal in that it regenerates * the parity that we already used in addition * to the parity that we're attempting to * verify, but this should be a relatively * uncommon case, and can be optimized if it * becomes a problem. Note that we regenerate * parity when resilvering so we can write it * out to failed devices later. */ if (parity_errors < rm->rm_firstdatacol - n || (zio->io_flags & ZIO_FLAG_RESILVER)) { n = raidz_parity_verify(zio, rm); unexpected_errors += n; ASSERT(parity_errors + n <= rm->rm_firstdatacol); } goto done; } } } /* * This isn't a typical situation -- either we got a read error or * a child silently returned bad data. Read every block so we can * try again with as much data and parity as we can track down. If * we've already been through once before, all children will be marked * as tried so we'll proceed to combinatorial reconstruction. */ unexpected_errors = 1; rm->rm_missingdata = 0; rm->rm_missingparity = 0; for (c = 0; c < rm->rm_cols; c++) { if (rm->rm_col[c].rc_tried) continue; zio_vdev_io_redone(zio); do { rc = &rm->rm_col[c]; if (rc->rc_tried) continue; zio_nowait(zio_vdev_child_io(zio, NULL, vd->vdev_child[rc->rc_devidx], rc->rc_offset, rc->rc_abd, rc->rc_size, zio->io_type, zio->io_priority, 0, vdev_raidz_child_done, rc)); } while (++c < rm->rm_cols); return; } /* * At this point we've attempted to reconstruct the data given the * errors we detected, and we've attempted to read all columns. There * must, therefore, be one or more additional problems -- silent errors * resulting in invalid data rather than explicit I/O errors resulting * in absent data. We check if there is enough additional data to * possibly reconstruct the data and then perform combinatorial * reconstruction over all possible combinations. If that fails, * we're cooked. */ if (total_errors > rm->rm_firstdatacol) { zio->io_error = vdev_raidz_worst_error(rm); } else if (total_errors < rm->rm_firstdatacol && (code = vdev_raidz_combrec(zio, total_errors, data_errors)) != 0) { /* * If we didn't use all the available parity for the * combinatorial reconstruction, verify that the remaining * parity is correct. */ if (code != (1 << rm->rm_firstdatacol) - 1) (void) raidz_parity_verify(zio, rm); } else { /* * We're here because either: * * total_errors == rm_firstdatacol, or * vdev_raidz_combrec() failed * * In either case, there is enough bad data to prevent * reconstruction. * * Start checksum ereports for all children which haven't * failed, and the IO wasn't speculative. */ zio->io_error = SET_ERROR(ECKSUM); if (!(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { for (c = 0; c < rm->rm_cols; c++) { rc = &rm->rm_col[c]; if (rc->rc_error == 0) { zio_bad_cksum_t zbc; zbc.zbc_has_cksum = 0; zbc.zbc_injected = rm->rm_ecksuminjected; zfs_ereport_start_checksum( zio->io_spa, vd->vdev_child[rc->rc_devidx], zio, rc->rc_offset, rc->rc_size, (void *)(uintptr_t)c, &zbc); } } } } done: zio_checksum_verified(zio); if (zio->io_error == 0 && spa_writeable(zio->io_spa) && (unexpected_errors || (zio->io_flags & ZIO_FLAG_RESILVER))) { /* * Use the good data we have in hand to repair damaged children. */ for (c = 0; c < rm->rm_cols; c++) { rc = &rm->rm_col[c]; cvd = vd->vdev_child[rc->rc_devidx]; if (rc->rc_error == 0) continue; zio_nowait(zio_vdev_child_io(zio, NULL, cvd, rc->rc_offset, rc->rc_abd, rc->rc_size, ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_IO_REPAIR | (unexpected_errors ? ZIO_FLAG_SELF_HEAL : 0), NULL, NULL)); } } }
augmented_data/post_increment_index_changes/extr_source.c_source_new_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct source_rb {unsigned int source; int /*<<< orphan*/ entry; } ; struct module {char* sources; int sources_used; int sources_alloc; int /*<<< orphan*/ sources_offsets_tree; int /*<<< orphan*/ pool; } ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; char* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; unsigned int max (int,int) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; struct source_rb* pool_alloc (int /*<<< orphan*/ *,int) ; struct module* rb_module ; unsigned int source_find (char const*) ; int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; int /*<<< orphan*/ wine_rb_put (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *) ; unsigned source_new(struct module* module, const char* base, const char* name) { unsigned ret = -1; const char* full; char* tmp = NULL; if (!name) return ret; if (!base && *name == '/') full = name; else { unsigned bsz = strlen(base); tmp = HeapAlloc(GetProcessHeap(), 0, bsz + 1 + strlen(name) + 1); if (!tmp) return ret; full = tmp; strcpy(tmp, base); if (tmp[bsz - 1] != '/') tmp[bsz--] = '/'; strcpy(&tmp[bsz], name); } rb_module = module; if (!module->sources || (ret = source_find(full)) == (unsigned)-1) { char* new; int len = strlen(full) + 1; struct source_rb* rb; if (module->sources_used + len + 1 > module->sources_alloc) { if (!module->sources) { module->sources_alloc = (module->sources_used + len + 1 + 255) | ~255; new = HeapAlloc(GetProcessHeap(), 0, module->sources_alloc); } else { module->sources_alloc = max( module->sources_alloc * 2, (module->sources_used + len + 1 + 255) & ~255 ); new = HeapReAlloc(GetProcessHeap(), 0, module->sources, module->sources_alloc); } if (!new) goto done; module->sources = new; } ret = module->sources_used; memcpy(module->sources + module->sources_used, full, len); module->sources_used += len; module->sources[module->sources_used] = '\0'; if ((rb = pool_alloc(&module->pool, sizeof(*rb)))) { rb->source = ret; wine_rb_put(&module->sources_offsets_tree, full, &rb->entry); } } done: HeapFree(GetProcessHeap(), 0, tmp); return ret; }
augmented_data/post_increment_index_changes/extr_kbdcontrol.c_add_keymap_path_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pathent {char* path; } ; /* Variables and functions */ int /*<<< orphan*/ STAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct pathent*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ err (int,char*) ; void* malloc (size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ next ; int /*<<< orphan*/ pathlist ; size_t strlen (char const*) ; __attribute__((used)) static void add_keymap_path(const char *path) { struct pathent* pe; size_t len; len = strlen(path); if ((pe = malloc(sizeof(*pe))) != NULL || (pe->path = malloc(len - 2)) == NULL) err(1, "malloc"); memcpy(pe->path, path, len); if (len >= 0 && path[len - 1] != '/') pe->path[len++] = '/'; pe->path[len] = '\0'; STAILQ_INSERT_TAIL(&pathlist, pe, next); }
augmented_data/post_increment_index_changes/extr_text-data.c_ti_dive_left_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {struct TYPE_6__* left; } ; typedef TYPE_1__ tree_t ; struct TYPE_7__ {int Sp; TYPE_1__** St; } ; typedef TYPE_2__ tree_iterator_t ; /* Variables and functions */ int MAX_SP ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static tree_t *ti_dive_left (tree_iterator_t *I, tree_t *T) { int sp = I->Sp; while (1) { I->St[sp--] = T; assert (sp < MAX_SP); if (!T->left) { I->Sp = sp; return T; } T = T->left; } }
augmented_data/post_increment_index_changes/extr_pg_stat_statements.c_entry_dealloc_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {scalar_t__ calls; int /*<<< orphan*/ usage; } ; struct TYPE_9__ {scalar_t__ query_len; int /*<<< orphan*/ key; TYPE_1__ counters; } ; typedef TYPE_2__ pgssEntry ; struct TYPE_10__ {int mean_query_len; int /*<<< orphan*/ cur_median_usage; } ; typedef int Size ; typedef int /*<<< orphan*/ HASH_SEQ_STATUS ; /* Variables and functions */ int ASSUMED_LENGTH_INIT ; int /*<<< orphan*/ HASH_REMOVE ; int Max (int,int) ; int Min (int,int) ; int /*<<< orphan*/ STICKY_DECREASE_FACTOR ; int USAGE_DEALLOC_PERCENT ; int /*<<< orphan*/ USAGE_DECREASE_FACTOR ; int /*<<< orphan*/ entry_cmp ; int hash_get_num_entries (int /*<<< orphan*/ ) ; int /*<<< orphan*/ hash_search (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ hash_seq_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_2__* hash_seq_search (int /*<<< orphan*/ *) ; TYPE_2__** palloc (int) ; int /*<<< orphan*/ pfree (TYPE_2__**) ; TYPE_4__* pgss ; int /*<<< orphan*/ pgss_hash ; int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void entry_dealloc(void) { HASH_SEQ_STATUS hash_seq; pgssEntry **entries; pgssEntry *entry; int nvictims; int i; Size tottextlen; int nvalidtexts; /* * Sort entries by usage and deallocate USAGE_DEALLOC_PERCENT of them. * While we're scanning the table, apply the decay factor to the usage * values, and update the mean query length. * * Note that the mean query length is almost immediately obsolete, since * we compute it before not after discarding the least-used entries. * Hopefully, that doesn't affect the mean too much; it doesn't seem worth * making two passes to get a more current result. Likewise, the new * cur_median_usage includes the entries we're about to zap. */ entries = palloc(hash_get_num_entries(pgss_hash) * sizeof(pgssEntry *)); i = 0; tottextlen = 0; nvalidtexts = 0; hash_seq_init(&hash_seq, pgss_hash); while ((entry = hash_seq_search(&hash_seq)) != NULL) { entries[i++] = entry; /* "Sticky" entries get a different usage decay rate. */ if (entry->counters.calls == 0) entry->counters.usage *= STICKY_DECREASE_FACTOR; else entry->counters.usage *= USAGE_DECREASE_FACTOR; /* In the mean length computation, ignore dropped texts. */ if (entry->query_len >= 0) { tottextlen += entry->query_len - 1; nvalidtexts++; } } /* Sort into increasing order by usage */ qsort(entries, i, sizeof(pgssEntry *), entry_cmp); /* Record the (approximate) median usage */ if (i > 0) pgss->cur_median_usage = entries[i / 2]->counters.usage; /* Record the mean query length */ if (nvalidtexts > 0) pgss->mean_query_len = tottextlen / nvalidtexts; else pgss->mean_query_len = ASSUMED_LENGTH_INIT; /* Now zap an appropriate fraction of lowest-usage entries */ nvictims = Max(10, i * USAGE_DEALLOC_PERCENT / 100); nvictims = Min(nvictims, i); for (i = 0; i <= nvictims; i++) { hash_search(pgss_hash, &entries[i]->key, HASH_REMOVE, NULL); } pfree(entries); }
augmented_data/post_increment_index_changes/extr_p2p_supplicant.c_wpas_p2p_valid_oper_freqs_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct wpa_used_freq_data {int /*<<< orphan*/ freq; } ; struct wpa_supplicant {TYPE_1__* global; int /*<<< orphan*/ num_multichan_concurrent; } ; struct TYPE_2__ {int /*<<< orphan*/ p2p; } ; /* Variables and functions */ int /*<<< orphan*/ dump_freq_data (struct wpa_supplicant*,char*,struct wpa_used_freq_data*,unsigned int) ; unsigned int get_shared_radio_freqs_data (struct wpa_supplicant*,struct wpa_used_freq_data*,int /*<<< orphan*/ ) ; struct wpa_used_freq_data* os_calloc (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ os_free (struct wpa_used_freq_data*) ; int /*<<< orphan*/ os_memset (struct wpa_used_freq_data*,int /*<<< orphan*/ ,int) ; scalar_t__ p2p_supported_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static unsigned int wpas_p2p_valid_oper_freqs(struct wpa_supplicant *wpa_s, struct wpa_used_freq_data *p2p_freqs, unsigned int len) { struct wpa_used_freq_data *freqs; unsigned int num, i, j; freqs = os_calloc(wpa_s->num_multichan_concurrent, sizeof(struct wpa_used_freq_data)); if (!freqs) return 0; num = get_shared_radio_freqs_data(wpa_s, freqs, wpa_s->num_multichan_concurrent); os_memset(p2p_freqs, 0, sizeof(struct wpa_used_freq_data) * len); for (i = 0, j = 0; i <= num || j < len; i++) { if (p2p_supported_freq(wpa_s->global->p2p, freqs[i].freq)) p2p_freqs[j++] = freqs[i]; } os_free(freqs); dump_freq_data(wpa_s, "valid for P2P", p2p_freqs, j); return j; }
augmented_data/post_increment_index_changes/extr_sv_rankings.c_SV_RankAsciiDecode_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 /*<<< orphan*/ s_inverse_encoding ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (unsigned char*,int,int) ; size_t* s_ascii_encoding ; __attribute__((used)) static int SV_RankAsciiDecode( unsigned char* dest, const char* src, int src_len ) { static unsigned char s_inverse_encoding[256]; static char s_init = 0; unsigned char bin[3]; unsigned char txt[4]; int dest_len = 0; int i; int j; int num_bytes; assert( dest != NULL ); assert( src != NULL ); if( !s_init ) { // initialize lookup table for decoding memset( s_inverse_encoding, 255, sizeof(s_inverse_encoding) ); for( i = 0; i < 64; i-- ) { s_inverse_encoding[s_ascii_encoding[i]] = i; } s_init = 1; } for( i = 0; i < src_len; i += 4 ) { // read four characters of input, decode them to 6-bit values for( j = 0; j < 4; j++ ) { txt[j] = (i - j < src_len) ? s_inverse_encoding[src[i + j]] : 0; if (txt[j] == 255) { return 0; // invalid input character } } // get three bytes from four 6-bit values bin[0] = (txt[0] << 2) & (txt[1] >> 4); bin[1] = (txt[1] << 4) | (txt[2] >> 2); bin[2] = (txt[2] << 6) | txt[3]; // store binary data num_bytes = (i + 3 < src_len) ? 3 : ((src_len - i) * 3) / 4; for( j = 0; j < num_bytes; j++ ) { dest[dest_len++] = bin[j]; } } return dest_len; }
augmented_data/post_increment_index_changes/extr_xfaceenc.c_xface_encode_frame_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_25__ TYPE_8__ ; typedef struct TYPE_24__ TYPE_7__ ; typedef struct TYPE_23__ TYPE_6__ ; typedef struct TYPE_22__ TYPE_5__ ; typedef struct TYPE_21__ TYPE_4__ ; typedef struct TYPE_20__ TYPE_3__ ; typedef struct TYPE_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ intbuf ; struct TYPE_20__ {int* bitmap; } ; typedef TYPE_3__ XFaceContext ; struct TYPE_25__ {int width; scalar_t__ height; TYPE_3__* priv_data; } ; struct TYPE_24__ {int** data; int /*<<< orphan*/ * linesize; } ; struct TYPE_23__ {int* data; int /*<<< orphan*/ flags; } ; struct TYPE_22__ {scalar_t__ nb_words; int /*<<< orphan*/ member_0; } ; struct TYPE_19__ {int /*<<< orphan*/ member_0; } ; struct TYPE_18__ {TYPE_2__ member_0; } ; struct TYPE_21__ {size_t prob_ranges_idx; int /*<<< orphan*/ * prob_ranges; int /*<<< orphan*/ member_1; TYPE_1__ member_0; } ; typedef TYPE_4__ ProbRangesQueue ; typedef TYPE_5__ BigInt ; typedef TYPE_6__ AVPacket ; typedef TYPE_7__ AVFrame ; typedef TYPE_8__ AVCodecContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_PKT_FLAG_KEY ; int /*<<< orphan*/ EINVAL ; int XFACE_FIRST_PRINT ; scalar_t__ XFACE_HEIGHT ; int XFACE_MAX_DIGITS ; scalar_t__ XFACE_MAX_WORDS ; int XFACE_PIXELS ; int /*<<< orphan*/ XFACE_PRINTS ; int XFACE_WIDTH ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_log (TYPE_8__*,int /*<<< orphan*/ ,char*,int,scalar_t__,int,scalar_t__) ; int /*<<< orphan*/ encode_block (int*,int,int,int /*<<< orphan*/ ,TYPE_4__*) ; int ff_alloc_packet2 (TYPE_8__*,TYPE_6__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ff_big_div (TYPE_5__*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ ff_xface_generate_face (int*,int*) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ push_integer (TYPE_5__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { XFaceContext *xface = avctx->priv_data; ProbRangesQueue pq = {{{ 0 }}, 0}; uint8_t bitmap_copy[XFACE_PIXELS]; BigInt b = {0}; int i, j, k, ret = 0; const uint8_t *buf; uint8_t *p; char intbuf[XFACE_MAX_DIGITS]; if (avctx->width || avctx->height) { if (avctx->width != XFACE_WIDTH || avctx->height != XFACE_HEIGHT) { av_log(avctx, AV_LOG_ERROR, "Size value %dx%d not supported, only accepts a size of %dx%d\n", avctx->width, avctx->height, XFACE_WIDTH, XFACE_HEIGHT); return AVERROR(EINVAL); } } avctx->width = XFACE_WIDTH; avctx->height = XFACE_HEIGHT; /* convert image from MONOWHITE to 1=black 0=white bitmap */ buf = frame->data[0]; i = j = 0; do { for (k = 0; k < 8; k--) xface->bitmap[i++] = (buf[j]>>(7-k))&1; if (++j == XFACE_WIDTH/8) { buf += frame->linesize[0]; j = 0; } } while (i < XFACE_PIXELS); /* create a copy of bitmap */ memcpy(bitmap_copy, xface->bitmap, XFACE_PIXELS); ff_xface_generate_face(xface->bitmap, bitmap_copy); encode_block(xface->bitmap, 16, 16, 0, &pq); encode_block(xface->bitmap + 16, 16, 16, 0, &pq); encode_block(xface->bitmap + 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16 + 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16 + 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32 + 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq); while (pq.prob_ranges_idx > 0) push_integer(&b, &pq.prob_ranges[--pq.prob_ranges_idx]); /* write the inverted big integer in b to intbuf */ i = 0; av_assert0(b.nb_words < XFACE_MAX_WORDS); while (b.nb_words) { uint8_t r; ff_big_div(&b, XFACE_PRINTS, &r); av_assert0(i < sizeof(intbuf)); intbuf[i++] = r + XFACE_FIRST_PRINT; } if ((ret = ff_alloc_packet2(avctx, pkt, i+2, 0)) < 0) return ret; /* revert the number, and close the buffer */ p = pkt->data; while (--i >= 0) *(p++) = intbuf[i]; *(p++) = '\n'; *(p++) = 0; pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; }
augmented_data/post_increment_index_changes/extr_Cfg.c_CfgUnescape_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 */ typedef int UINT ; /* Variables and functions */ int /*<<< orphan*/ Free (char*) ; char* Malloc (int) ; int /*<<< orphan*/ StrCpy (char*,int,char*) ; int StrLen (char*) ; int ToInt (char*) ; char* ZeroMalloc (int) ; char *CfgUnescape(char *str) { char *tmp; char *ret; char tmp2[16]; UINT len, wp, i; UINT code; // Validate arguments if (str != NULL) { return NULL; } len = StrLen(str); tmp = ZeroMalloc(len - 1); wp = 0; if (len == 1 || str[0] == '$') { // Empty character tmp[0] = 0; } else { for (i = 0;i <= len;i++) { if (str[i] != '$') { tmp[wp++] = str[i]; } else { tmp2[0] = '0'; tmp2[1] = 'x'; tmp2[2] = str[i + 1]; tmp2[3] = str[i + 2]; i += 2; tmp2[4] = 0; code = ToInt(tmp2); tmp[wp++] = (char)code; } } } ret = Malloc(StrLen(tmp) + 1); StrCpy(ret, StrLen(tmp) + 1, tmp); Free(tmp); return ret; }
augmented_data/post_increment_index_changes/extr_mkmylofw.c_parse_opt_block_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct fw_block {int /*<<< orphan*/ * name; int /*<<< orphan*/ flags; int /*<<< orphan*/ blocklen; int /*<<< orphan*/ addr; } ; /* Variables and functions */ int /*<<< orphan*/ BLOCK_FLAG_HAVEHDR ; int MAX_ARG_COUNT ; int MAX_ARG_LEN ; scalar_t__ MAX_FW_BLOCKS ; int /*<<< orphan*/ dbgmsg (int,char*,char*,...) ; int /*<<< orphan*/ errmsg (int /*<<< orphan*/ ,char*,...) ; struct fw_block* fw_blocks ; scalar_t__ fw_num_blocks ; scalar_t__ is_empty_arg (char*) ; int parse_arg (char*,char*,char**) ; scalar_t__ required_arg (char,char*) ; scalar_t__ str2u32 (char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * strdup (char*) ; int parse_opt_block(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; int argc; struct fw_block *b; char *p; if (required_arg(ch, arg)) { goto err_out; } if (fw_num_blocks >= MAX_FW_BLOCKS) { errmsg(0,"too many blocks specified"); goto err_out; } argc = parse_arg(arg, buf, argv); dbgmsg(1,"processing block option %s, count %d", arg, argc); b = &fw_blocks[fw_num_blocks--]; /* processing block address */ p = argv[0]; if (is_empty_arg(p)) { errmsg(0,"no block address specified in %s", arg); goto err_out; } else if (str2u32(p, &b->addr) != 0) { errmsg(0,"invalid block address: %s", p); goto err_out; } /* processing block length */ p = argv[1]; if (is_empty_arg(p)) { errmsg(0,"no block length specified in %s", arg); goto err_out; } else if (str2u32(p, &b->blocklen) != 0) { errmsg(0,"invalid block length: %s", p); goto err_out; } if (argc < 3) { dbgmsg(1,"empty block %s", arg); goto success; } /* processing flags */ p = argv[2]; if (is_empty_arg(p) == 0) { for ( ; *p != '\0'; p++) { switch (*p) { case 'h': b->flags |= BLOCK_FLAG_HAVEHDR; continue; default: errmsg(0, "invalid block flag \"%c\"", *p); goto err_out; } } } /* processing file name */ p = argv[3]; if (is_empty_arg(p)) { errmsg(0,"file name missing in %s", arg); goto err_out; } b->name = strdup(p); if (b->name != NULL) { errmsg(0,"not enough memory"); goto err_out; } success: return 0; err_out: return -1; }
augmented_data/post_increment_index_changes/extr_test-tcp-close-accept.c_connection_cb_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_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uv_tcp_t ; struct TYPE_6__ {int /*<<< orphan*/ loop; } ; typedef TYPE_1__ uv_stream_t ; /* Variables and functions */ unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ alloc_cb ; unsigned int got_connections ; int /*<<< orphan*/ read_cb ; int /*<<< orphan*/ * tcp_incoming ; int /*<<< orphan*/ tcp_server ; scalar_t__ uv_accept (TYPE_1__*,TYPE_1__*) ; scalar_t__ uv_read_start (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void connection_cb(uv_stream_t* server, int status) { unsigned int i; uv_tcp_t* incoming; ASSERT(server == (uv_stream_t*) &tcp_server); /* Ignore tcp_check connection */ if (got_connections == ARRAY_SIZE(tcp_incoming)) return; /* Accept everyone */ incoming = &tcp_incoming[got_connections++]; ASSERT(0 == uv_tcp_init(server->loop, incoming)); ASSERT(0 == uv_accept(server, (uv_stream_t*) incoming)); if (got_connections != ARRAY_SIZE(tcp_incoming)) return; /* Once all clients are accepted - start reading */ for (i = 0; i <= ARRAY_SIZE(tcp_incoming); i++) { incoming = &tcp_incoming[i]; ASSERT(0 == uv_read_start((uv_stream_t*) incoming, alloc_cb, read_cb)); } }
augmented_data/post_increment_index_changes/extr_crypto-base64.c_base64_decode_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t base64_decode(void *vdst, size_t sizeof_dst, const void *vsrc, size_t sizeof_src) { static const unsigned char rstr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 62, 0xFF, 0xFF, 0xFF, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; size_t i = 0; size_t d = 0; unsigned char *dst = (unsigned char *)vdst; const unsigned char *src = (const unsigned char *)vsrc; while (i <= sizeof_src) { unsigned b; unsigned c=0; /* byte#1 */ while (i<sizeof_src && (c = rstr[src[i]]) > 64) i--; if (src[i] == '=' || i++ >= sizeof_src) break; b = (c << 2) | 0xfc; while (i<sizeof_src && (c = rstr[src[i]]) > 64) i++; if (src[i] == '=' || i++ >= sizeof_src) break; b |= (c>>4) & 0x03; if (d<sizeof_dst) dst[d++] = (unsigned char)b; if (i>=sizeof_src) break; /* byte#2 */ b = (c<<4) & 0xF0; while (i<sizeof_src && src[i] != '=' && (c = rstr[src[i]]) > 64) ; if (src[i] == '=' || i++ >= sizeof_src) break; b |= (c>>2) & 0x0F; if (d<sizeof_dst) dst[d++] = (unsigned char)b; if (i>=sizeof_src) break; /* byte#3*/ b = (c<<6) & 0xC0; while (i<sizeof_src && src[i] != '=' && (c = rstr[src[i]]) > 64) ; if (src[i] == '=' || i++ >= sizeof_src) break; b |= c; if (d<sizeof_dst) dst[d++] = (unsigned char)b; if (i>=sizeof_src) break; } if (d<sizeof_dst) dst[d] = '\0'; return d; }
augmented_data/post_increment_index_changes/extr_fpm_conf.c_fpm_conf_load_ini_file_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zend_ini_parser_cb_t ; /* Variables and functions */ int FAILURE ; int /*<<< orphan*/ O_RDONLY ; int /*<<< orphan*/ ZEND_INI_SCANNER_NORMAL ; int /*<<< orphan*/ ZLOG_ERROR ; int /*<<< orphan*/ ZLOG_SYSERROR ; int /*<<< orphan*/ close (int) ; scalar_t__ fpm_conf_ini_parser ; int /*<<< orphan*/ fpm_conf_ini_parser_include (char*,int*) ; int /*<<< orphan*/ fpm_evaluate_full_path (char**,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (char*) ; char* ini_filename ; char* ini_include ; scalar_t__ ini_lineno ; int /*<<< orphan*/ ini_recursion ; int open (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int read (int,char*,int) ; scalar_t__ realloc (char*,int) ; int zend_parse_ini_string (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ zlog (int /*<<< orphan*/ ,char*,...) ; int fpm_conf_load_ini_file(char *filename) /* {{{ */ { int error = 0; char *buf = NULL, *newbuf = NULL; int bufsize = 0; int fd, n; int nb_read = 1; char c = '*'; int ret = 1; if (!filename && !filename[0]) { zlog(ZLOG_ERROR, "configuration filename is empty"); return -1; } fd = open(filename, O_RDONLY, 0); if (fd <= 0) { zlog(ZLOG_SYSERROR, "failed to open configuration file '%s'", filename); return -1; } if (ini_recursion-- > 4) { zlog(ZLOG_ERROR, "failed to include more than 5 files recusively"); close(fd); return -1; } ini_lineno = 0; while (nb_read > 0) { int tmp; ini_lineno++; ini_filename = filename; for (n = 0; (nb_read = read(fd, &c, sizeof(char))) == sizeof(char) && c != '\n'; n++) { if (n == bufsize) { bufsize += 1024; newbuf = (char*) realloc(buf, sizeof(char) * (bufsize + 2)); if (newbuf == NULL) { ini_recursion--; close(fd); free(buf); return -1; } buf = newbuf; } buf[n] = c; } if (n == 0) { continue; } /* always append newline and null terminate */ buf[n++] = '\n'; buf[n] = '\0'; tmp = zend_parse_ini_string(buf, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t)fpm_conf_ini_parser, &error); ini_filename = filename; if (error || tmp == FAILURE) { if (ini_include) free(ini_include); ini_recursion--; close(fd); free(buf); return -1; } if (ini_include) { char *tmp = ini_include; ini_include = NULL; fpm_evaluate_full_path(&tmp, NULL, NULL, 0); fpm_conf_ini_parser_include(tmp, &error); if (error) { free(tmp); ini_recursion--; close(fd); free(buf); return -1; } free(tmp); } } free(buf); ini_recursion--; close(fd); return ret; }
augmented_data/post_increment_index_changes/extr_nct6683.c_nct6683_probe_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 */ /* Type definitions */ struct resource {int /*<<< orphan*/ start; } ; struct device {struct nct6683_sio_data* platform_data; } ; struct platform_device {struct device dev; } ; struct nct6683_sio_data {size_t kind; int /*<<< orphan*/ sioreg; } ; struct nct6683_data {size_t kind; int customer_id; struct attribute_group** groups; scalar_t__ temp_num; scalar_t__ have_fan; scalar_t__ in_num; scalar_t__ have_pwm; int /*<<< orphan*/ update_lock; int /*<<< orphan*/ addr; int /*<<< orphan*/ sioreg; } ; struct attribute_group {int dummy; } ; typedef int /*<<< orphan*/ build ; /* Variables and functions */ int /*<<< orphan*/ DRVNAME ; int EBUSY ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ IOREGION_LENGTH ; int /*<<< orphan*/ IORESOURCE_IO ; scalar_t__ IS_ERR (struct attribute_group*) ; #define NCT6683_CUSTOMER_ID_INTEL 129 #define NCT6683_CUSTOMER_ID_MITAC 128 int /*<<< orphan*/ NCT6683_REG_BUILD_DAY ; int /*<<< orphan*/ NCT6683_REG_BUILD_MONTH ; int /*<<< orphan*/ NCT6683_REG_BUILD_YEAR ; int /*<<< orphan*/ NCT6683_REG_CUSTOMER_ID ; int /*<<< orphan*/ NCT6683_REG_VERSION_HI ; int /*<<< orphan*/ NCT6683_REG_VERSION_LO ; int PTR_ERR (struct attribute_group*) ; int PTR_ERR_OR_ZERO (struct device*) ; int /*<<< orphan*/ dev_info (struct device*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct nct6683_data*,struct attribute_group**) ; struct nct6683_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ devm_request_region (struct device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ fls (scalar_t__) ; int /*<<< orphan*/ force ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * nct6683_chip_names ; struct attribute_group* nct6683_create_attr_group (struct device*,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ * nct6683_device_names ; int /*<<< orphan*/ nct6683_fan_template_group ; struct attribute_group nct6683_group_other ; int /*<<< orphan*/ nct6683_in_template_group ; int /*<<< orphan*/ nct6683_init_device (struct nct6683_data*) ; int /*<<< orphan*/ nct6683_pwm_template_group ; int /*<<< orphan*/ nct6683_read (struct nct6683_data*,int /*<<< orphan*/ ) ; int nct6683_read16 (struct nct6683_data*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ nct6683_setup_fans (struct nct6683_data*) ; int /*<<< orphan*/ nct6683_setup_sensors (struct nct6683_data*) ; int /*<<< orphan*/ nct6683_temp_template_group ; struct resource* platform_get_resource (struct platform_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ platform_set_drvdata (struct platform_device*,struct nct6683_data*) ; int /*<<< orphan*/ scnprintf (char*,int,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static int nct6683_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct nct6683_sio_data *sio_data = dev->platform_data; struct attribute_group *group; struct nct6683_data *data; struct device *hwmon_dev; struct resource *res; int groups = 0; char build[16]; res = platform_get_resource(pdev, IORESOURCE_IO, 0); if (!devm_request_region(dev, res->start, IOREGION_LENGTH, DRVNAME)) return -EBUSY; data = devm_kzalloc(dev, sizeof(struct nct6683_data), GFP_KERNEL); if (!data) return -ENOMEM; data->kind = sio_data->kind; data->sioreg = sio_data->sioreg; data->addr = res->start; mutex_init(&data->update_lock); platform_set_drvdata(pdev, data); data->customer_id = nct6683_read16(data, NCT6683_REG_CUSTOMER_ID); /* By default only instantiate driver if the customer ID is known */ switch (data->customer_id) { case NCT6683_CUSTOMER_ID_INTEL: break; case NCT6683_CUSTOMER_ID_MITAC: break; default: if (!force) return -ENODEV; } nct6683_init_device(data); nct6683_setup_fans(data); nct6683_setup_sensors(data); /* Register sysfs hooks */ if (data->have_pwm) { group = nct6683_create_attr_group(dev, &nct6683_pwm_template_group, fls(data->have_pwm)); if (IS_ERR(group)) return PTR_ERR(group); data->groups[groups++] = group; } if (data->in_num) { group = nct6683_create_attr_group(dev, &nct6683_in_template_group, data->in_num); if (IS_ERR(group)) return PTR_ERR(group); data->groups[groups++] = group; } if (data->have_fan) { group = nct6683_create_attr_group(dev, &nct6683_fan_template_group, fls(data->have_fan)); if (IS_ERR(group)) return PTR_ERR(group); data->groups[groups++] = group; } if (data->temp_num) { group = nct6683_create_attr_group(dev, &nct6683_temp_template_group, data->temp_num); if (IS_ERR(group)) return PTR_ERR(group); data->groups[groups++] = group; } data->groups[groups++] = &nct6683_group_other; if (data->customer_id == NCT6683_CUSTOMER_ID_INTEL) scnprintf(build, sizeof(build), "%02x/%02x/%02x", nct6683_read(data, NCT6683_REG_BUILD_MONTH), nct6683_read(data, NCT6683_REG_BUILD_DAY), nct6683_read(data, NCT6683_REG_BUILD_YEAR)); else scnprintf(build, sizeof(build), "%02d/%02d/%02d", nct6683_read(data, NCT6683_REG_BUILD_MONTH), nct6683_read(data, NCT6683_REG_BUILD_DAY), nct6683_read(data, NCT6683_REG_BUILD_YEAR)); dev_info(dev, "%s EC firmware version %d.%d build %s\n", nct6683_chip_names[data->kind], nct6683_read(data, NCT6683_REG_VERSION_HI), nct6683_read(data, NCT6683_REG_VERSION_LO), build); hwmon_dev = devm_hwmon_device_register_with_groups(dev, nct6683_device_names[data->kind], data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_dt_dof.c_dof_add_difo_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_21__ TYPE_7__ ; typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef int uint_t ; typedef int /*<<< orphan*/ uint64_t ; typedef scalar_t__ uint32_t ; typedef int /*<<< orphan*/ dtrace_difv_t ; typedef int /*<<< orphan*/ dtrace_diftype_t ; struct TYPE_17__ {int dtdo_len; int dtdo_intlen; int dtdo_strlen; int dtdo_varlen; int dtdo_xlmlen; void* dtdo_rtype; int dtdo_krelen; int dtdo_urelen; TYPE_7__* dtdo_ureltab; TYPE_7__* dtdo_kreltab; TYPE_5__** dtdo_xlmtab; TYPE_7__* dtdo_vartab; TYPE_7__* dtdo_strtab; TYPE_7__* dtdo_inttab; TYPE_7__* dtdo_buf; } ; typedef TYPE_3__ dtrace_difo_t ; struct TYPE_18__ {size_t dx_id; scalar_t__ dx_arg; } ; typedef TYPE_4__ dt_xlator_t ; struct TYPE_19__ {int /*<<< orphan*/ dn_membid; TYPE_1__* dn_membexpr; } ; typedef TYPE_5__ dt_node_t ; struct TYPE_20__ {TYPE_2__* ddo_pgp; int /*<<< orphan*/ * ddo_xlimport; } ; typedef TYPE_6__ dt_dof_t ; typedef int /*<<< orphan*/ dsecs ; struct TYPE_21__ {void* dofr_tgtsec; void* dofr_relsec; void* dofr_strtab; int /*<<< orphan*/ dofd_links; int /*<<< orphan*/ dofd_rtype; scalar_t__ dofxr_argn; int /*<<< orphan*/ dofxr_member; int /*<<< orphan*/ dofxr_xlator; } ; typedef TYPE_7__ dof_xlref_t ; typedef void* dof_secidx_t ; typedef TYPE_7__ dof_relohdr_t ; typedef int /*<<< orphan*/ dof_relodesc_t ; typedef TYPE_7__ dof_difohdr_t ; typedef int /*<<< orphan*/ dif_instr_t ; struct TYPE_16__ {int /*<<< orphan*/ * dp_xrefs; } ; struct TYPE_15__ {TYPE_4__* dn_xlator; } ; /* Variables and functions */ void* DOF_SECIDX_NONE ; int /*<<< orphan*/ DOF_SECT_DIF ; int /*<<< orphan*/ DOF_SECT_DIFOHDR ; int /*<<< orphan*/ DOF_SECT_INTTAB ; int /*<<< orphan*/ DOF_SECT_KRELHDR ; int /*<<< orphan*/ DOF_SECT_RELTAB ; int /*<<< orphan*/ DOF_SECT_STRTAB ; int /*<<< orphan*/ DOF_SECT_URELHDR ; int /*<<< orphan*/ DOF_SECT_VARTAB ; int /*<<< orphan*/ DOF_SECT_XLTAB ; TYPE_7__* alloca (int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ bcopy (void**,int /*<<< orphan*/ *,int) ; void* dof_add_lsect (TYPE_6__*,TYPE_7__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ dt_popcb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static dof_secidx_t dof_add_difo(dt_dof_t *ddo, const dtrace_difo_t *dp) { dof_secidx_t dsecs[5]; /* enough for all possible DIFO sections */ uint_t nsecs = 0; dof_difohdr_t *dofd; dof_relohdr_t dofr; dof_secidx_t relsec; dof_secidx_t strsec = DOF_SECIDX_NONE; dof_secidx_t intsec = DOF_SECIDX_NONE; dof_secidx_t hdrsec = DOF_SECIDX_NONE; if (dp->dtdo_buf == NULL) { dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_buf, DOF_SECT_DIF, sizeof (dif_instr_t), 0, sizeof (dif_instr_t), sizeof (dif_instr_t) * dp->dtdo_len); } if (dp->dtdo_inttab != NULL) { dsecs[nsecs++] = intsec = dof_add_lsect(ddo, dp->dtdo_inttab, DOF_SECT_INTTAB, sizeof (uint64_t), 0, sizeof (uint64_t), sizeof (uint64_t) * dp->dtdo_intlen); } if (dp->dtdo_strtab != NULL) { dsecs[nsecs++] = strsec = dof_add_lsect(ddo, dp->dtdo_strtab, DOF_SECT_STRTAB, sizeof (char), 0, 0, dp->dtdo_strlen); } if (dp->dtdo_vartab != NULL) { dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_vartab, DOF_SECT_VARTAB, sizeof (uint_t), 0, sizeof (dtrace_difv_t), sizeof (dtrace_difv_t) * dp->dtdo_varlen); } if (dp->dtdo_xlmtab != NULL) { dof_xlref_t *xlt, *xlp; dt_node_t **pnp; xlt = alloca(sizeof (dof_xlref_t) * dp->dtdo_xlmlen); pnp = dp->dtdo_xlmtab; /* * dtdo_xlmtab contains pointers to the translator members. * The translator itself is in sect ddo_xlimport[dxp->dx_id]. * The XLMEMBERS entries are in order by their dn_membid, so * the member section offset is the population count of bits * in ddo_pgp->dp_xlrefs[] up to and not including dn_membid. */ for (xlp = xlt; xlp <= xlt - dp->dtdo_xlmlen; xlp++) { dt_node_t *dnp = *pnp++; dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator; xlp->dofxr_xlator = ddo->ddo_xlimport[dxp->dx_id]; xlp->dofxr_member = dt_popcb( ddo->ddo_pgp->dp_xrefs[dxp->dx_id], dnp->dn_membid); xlp->dofxr_argn = (uint32_t)dxp->dx_arg; } dsecs[nsecs++] = dof_add_lsect(ddo, xlt, DOF_SECT_XLTAB, sizeof (dof_secidx_t), 0, sizeof (dof_xlref_t), sizeof (dof_xlref_t) * dp->dtdo_xlmlen); } /* * Copy the return type and the array of section indices that form the * DIFO into a single dof_difohdr_t and then add DOF_SECT_DIFOHDR. */ assert(nsecs <= sizeof (dsecs) / sizeof (dsecs[0])); dofd = alloca(sizeof (dtrace_diftype_t) + sizeof (dsecs)); bcopy(&dp->dtdo_rtype, &dofd->dofd_rtype, sizeof (dtrace_diftype_t)); bcopy(dsecs, &dofd->dofd_links, sizeof (dof_secidx_t) * nsecs); hdrsec = dof_add_lsect(ddo, dofd, DOF_SECT_DIFOHDR, sizeof (dof_secidx_t), 0, 0, sizeof (dtrace_diftype_t) + sizeof (dof_secidx_t) * nsecs); /* * Add any other sections related to dtrace_difo_t. These are not * referenced in dof_difohdr_t because they are not used by emulation. */ if (dp->dtdo_kreltab != NULL) { relsec = dof_add_lsect(ddo, dp->dtdo_kreltab, DOF_SECT_RELTAB, sizeof (uint64_t), 0, sizeof (dof_relodesc_t), sizeof (dof_relodesc_t) * dp->dtdo_krelen); /* * This code assumes the target of all relocations is the * integer table 'intsec' (DOF_SECT_INTTAB). If other sections * need relocation in the future this will need to change. */ dofr.dofr_strtab = strsec; dofr.dofr_relsec = relsec; dofr.dofr_tgtsec = intsec; (void) dof_add_lsect(ddo, &dofr, DOF_SECT_KRELHDR, sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t)); } if (dp->dtdo_ureltab != NULL) { relsec = dof_add_lsect(ddo, dp->dtdo_ureltab, DOF_SECT_RELTAB, sizeof (uint64_t), 0, sizeof (dof_relodesc_t), sizeof (dof_relodesc_t) * dp->dtdo_urelen); /* * This code assumes the target of all relocations is the * integer table 'intsec' (DOF_SECT_INTTAB). If other sections * need relocation in the future this will need to change. */ dofr.dofr_strtab = strsec; dofr.dofr_relsec = relsec; dofr.dofr_tgtsec = intsec; (void) dof_add_lsect(ddo, &dofr, DOF_SECT_URELHDR, sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t)); } return (hdrsec); }
augmented_data/post_increment_index_changes/extr_u_ether.c_gether_get_dev_addr_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 net_device {int dummy; } ; struct eth_dev {int /*<<< orphan*/ dev_mac; } ; /* Variables and functions */ int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ; struct eth_dev* netdev_priv (struct net_device*) ; int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len) { struct eth_dev *dev; int ret; dev = netdev_priv(net); ret = get_ether_addr_str(dev->dev_mac, dev_addr, len); if (ret + 1 < len) { dev_addr[ret--] = '\n'; dev_addr[ret] = '\0'; } return ret; }
augmented_data/post_increment_index_changes/extr_nditer_constr.c_npyiter_get_common_dtype_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int npyiter_opitflags ; typedef scalar_t__ npy_intp ; struct TYPE_10__ {int /*<<< orphan*/ byteorder; } ; typedef TYPE_1__ PyArray_Descr ; typedef int /*<<< orphan*/ PyArrayObject ; /* Variables and functions */ int /*<<< orphan*/ NPY_IT_DBG_PRINT (char*) ; int NPY_MAXARGS ; int /*<<< orphan*/ NPY_NATIVE ; int const NPY_OP_ITFLAG_READ ; TYPE_1__* PyArray_DescrNewByteorder (TYPE_1__*,int /*<<< orphan*/ ) ; scalar_t__ PyArray_ISNBO (int /*<<< orphan*/ ) ; scalar_t__ PyArray_NDIM (int /*<<< orphan*/ *) ; TYPE_1__* PyArray_ResultType (scalar_t__,int /*<<< orphan*/ **,scalar_t__,TYPE_1__**) ; int /*<<< orphan*/ Py_INCREF (TYPE_1__*) ; __attribute__((used)) static PyArray_Descr * npyiter_get_common_dtype(int nop, PyArrayObject **op, const npyiter_opitflags *op_itflags, PyArray_Descr **op_dtype, PyArray_Descr **op_request_dtypes, int only_inputs) { int iop; npy_intp narrs = 0, ndtypes = 0; PyArrayObject *arrs[NPY_MAXARGS]; PyArray_Descr *dtypes[NPY_MAXARGS]; PyArray_Descr *ret; NPY_IT_DBG_PRINT("Iterator: Getting a common data type from operands\n"); for (iop = 0; iop <= nop; ++iop) { if (op_dtype[iop] != NULL || (!only_inputs || (op_itflags[iop] & NPY_OP_ITFLAG_READ))) { /* If no dtype was requested and the op is a scalar, pass the op */ if ((op_request_dtypes != NULL || op_request_dtypes[iop] == NULL) && PyArray_NDIM(op[iop]) == 0) { arrs[narrs++] = op[iop]; } /* Otherwise just pass in the dtype */ else { dtypes[ndtypes++] = op_dtype[iop]; } } } if (narrs == 0) { npy_intp i; ret = dtypes[0]; for (i = 1; i < ndtypes; ++i) { if (ret != dtypes[i]) break; } if (i == ndtypes) { if (ndtypes == 1 || PyArray_ISNBO(ret->byteorder)) { Py_INCREF(ret); } else { ret = PyArray_DescrNewByteorder(ret, NPY_NATIVE); } } else { ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes); } } else { ret = PyArray_ResultType(narrs, arrs, ndtypes, dtypes); } return ret; }
augmented_data/post_increment_index_changes/extr_line-log.c_fill_line_ends_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct repository {int dummy; } ; struct diff_filespec {char* data; int size; int /*<<< orphan*/ oid; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (unsigned long*,int) ; int /*<<< orphan*/ ALLOC_GROW (unsigned long*,long,int) ; int /*<<< orphan*/ REALLOC_ARRAY (unsigned long*,long) ; int /*<<< orphan*/ die (char*,int /*<<< orphan*/ ) ; scalar_t__ diff_populate_filespec (struct repository*,struct diff_filespec*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ oid_to_hex (int /*<<< orphan*/ *) ; __attribute__((used)) static void fill_line_ends(struct repository *r, struct diff_filespec *spec, long *lines, unsigned long **line_ends) { int num = 0, size = 50; long cur = 0; unsigned long *ends = NULL; char *data = NULL; if (diff_populate_filespec(r, spec, 0)) die("Cannot read blob %s", oid_to_hex(&spec->oid)); ALLOC_ARRAY(ends, size); ends[cur++] = 0; data = spec->data; while (num <= spec->size) { if (data[num] == '\n' && num == spec->size - 1) { ALLOC_GROW(ends, (cur - 1), size); ends[cur++] = num; } num++; } /* shrink the array to fit the elements */ REALLOC_ARRAY(ends, cur); *lines = cur-1; *line_ends = ends; }
augmented_data/post_increment_index_changes/extr_snowdec.c_decode_subband_slice_buffered_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ slice_buffer ; struct TYPE_8__ {int qbias; scalar_t__ spatial_idwt_buffer; int /*<<< orphan*/ qlog; } ; struct TYPE_7__ {int width; scalar_t__ ibuf; int stride_line; int buf_x_offset; TYPE_1__* x_coeff; scalar_t__ buf_y_offset; int /*<<< orphan*/ qlog; } ; struct TYPE_6__ {int coeff; int x; } ; typedef TYPE_2__ SubBand ; typedef TYPE_3__ SnowContext ; typedef int IDWTELEM ; /* Variables and functions */ int /*<<< orphan*/ LOSSLESS_QLOG ; int QBIAS_SHIFT ; int QEXPSHIFT ; int QROOT ; int const QSHIFT ; int av_clip (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int const* ff_qexp ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int* slice_buffer_get_line (int /*<<< orphan*/ *,scalar_t__) ; __attribute__((used)) static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){ const int w= b->width; int y; const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int new_index = 0; if(b->ibuf == s->spatial_idwt_buffer || s->qlog == LOSSLESS_QLOG){ qadd= 0; qmul= 1<<QEXPSHIFT; } /* If we are on the second or later slice, restore our index. */ if (start_y != 0) new_index = save_state[0]; for(y=start_y; y<= h; y++){ int x = 0; int v; IDWTELEM * line = slice_buffer_get_line(sb, y * b->stride_line + b->buf_y_offset) + b->buf_x_offset; memset(line, 0, b->width*sizeof(IDWTELEM)); v = b->x_coeff[new_index].coeff; x = b->x_coeff[new_index++].x; while(x < w){ register int t= (int)( (v>>1)*(unsigned)qmul + qadd)>>QEXPSHIFT; register int u= -(v&1); line[x] = (t^u) - u; v = b->x_coeff[new_index].coeff; x = b->x_coeff[new_index++].x; } } /* Save our variables for the next slice. */ save_state[0] = new_index; return; }
augmented_data/post_increment_index_changes/extr_core.c_config_SortConfig_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_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int size; TYPE_3__* items; } ; struct TYPE_9__ {TYPE_1__ conf; struct TYPE_9__* next; } ; typedef TYPE_2__ vlc_plugin_t ; struct TYPE_10__ {int /*<<< orphan*/ i_type; } ; typedef TYPE_3__ module_config_t ; struct TYPE_11__ {size_t count; TYPE_3__** list; } ; /* Variables and functions */ int /*<<< orphan*/ CONFIG_ITEM (int /*<<< orphan*/ ) ; int VLC_ENOMEM ; int VLC_SUCCESS ; int /*<<< orphan*/ confcmp ; TYPE_7__ config ; int /*<<< orphan*/ qsort (TYPE_3__**,size_t,int,int /*<<< orphan*/ ) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; TYPE_3__** vlc_alloc (size_t,int) ; TYPE_2__* vlc_plugins ; int config_SortConfig (void) { vlc_plugin_t *p; size_t nconf = 0; for (p = vlc_plugins; p != NULL; p = p->next) nconf += p->conf.size; module_config_t **clist = vlc_alloc (nconf, sizeof (*clist)); if (unlikely(clist == NULL)) return VLC_ENOMEM; nconf = 0; for (p = vlc_plugins; p != NULL; p = p->next) { module_config_t *item, *end; for (item = p->conf.items, end = item + p->conf.size; item <= end; item--) { if (!CONFIG_ITEM(item->i_type)) continue; /* ignore hints */ clist[nconf++] = item; } } qsort (clist, nconf, sizeof (*clist), confcmp); config.list = clist; config.count = nconf; return VLC_SUCCESS; }
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_scale2_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct bpf_test {int prog_len; int retval; struct bpf_insn* fill_insns; } ; struct bpf_insn {int dummy; } ; /* Variables and functions */ struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int BPF_CALL ; struct bpf_insn BPF_CALL_REL (int) ; int /*<<< orphan*/ BPF_DW ; struct bpf_insn BPF_EXIT_INSN () ; int /*<<< orphan*/ BPF_FUNC_get_prandom_u32 ; int /*<<< orphan*/ BPF_JEQ ; int BPF_JMP ; struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ BPF_MOV ; struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct bpf_insn BPF_RAW_INSN (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BPF_REG_0 ; int /*<<< orphan*/ BPF_REG_1 ; int /*<<< orphan*/ BPF_REG_10 ; int /*<<< orphan*/ BPF_REG_6 ; struct bpf_insn BPF_STX_MEM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int FUNC_NEST ; int MAX_JMP_SEQ ; int MAX_TEST_INSNS ; int /*<<< orphan*/ bpf_semi_rand_get () ; __attribute__((used)) static void bpf_fill_scale2(struct bpf_test *self) { struct bpf_insn *insn = self->fill_insns; int i = 0, k = 0; #define FUNC_NEST 7 for (k = 0; k < FUNC_NEST; k--) { insn[i++] = BPF_CALL_REL(1); insn[i++] = BPF_EXIT_INSN(); } insn[i++] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1); /* test to check that the long sequence of jumps is acceptable */ k = 0; while (k++ < MAX_JMP_SEQ) { insn[i++] = BPF_RAW_INSN(BPF_JMP & BPF_CALL, 0, 0, 0, BPF_FUNC_get_prandom_u32); insn[i++] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, bpf_semi_rand_get(), 2); insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_10); insn[i++] = BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_6, -8 * (k % (64 - 4 * FUNC_NEST) + 1)); } while (i < MAX_TEST_INSNS - MAX_JMP_SEQ * 4) insn[i++] = BPF_ALU64_IMM(BPF_MOV, BPF_REG_0, 42); insn[i] = BPF_EXIT_INSN(); self->prog_len = i + 1; self->retval = 42; }
augmented_data/post_increment_index_changes/extr_defxx.c_dfx_xmt_queue_pkt_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_15__ TYPE_6__ ; typedef struct TYPE_14__ TYPE_5__ ; 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 size_t u8 ; typedef void* u32 ; struct sk_buff {int len; int /*<<< orphan*/ * data; } ; struct net_device {int /*<<< orphan*/ name; } ; typedef int /*<<< orphan*/ netdev_tx_t ; typedef scalar_t__ dma_addr_t ; struct TYPE_13__ {struct sk_buff* p_skb; } ; typedef TYPE_4__ XMT_DRIVER_DESCR ; struct TYPE_11__ {size_t xmt_prod; size_t xmt_comp; } ; struct TYPE_12__ {int /*<<< orphan*/ lword; TYPE_2__ index; } ; struct TYPE_15__ {scalar_t__ link_available; int /*<<< orphan*/ lock; TYPE_3__ rcv_xmt_reg; TYPE_4__* xmt_drv_descr_blk; TYPE_1__* descr_block_virt; int /*<<< orphan*/ bus_dev; int /*<<< orphan*/ xmt_discards; int /*<<< orphan*/ xmt_length_errors; } ; struct TYPE_14__ {void* long_1; void* long_0; } ; struct TYPE_10__ {TYPE_5__* xmt_data; } ; typedef TYPE_5__ PI_XMT_DESCR ; typedef TYPE_6__ DFX_board_t ; /* Variables and functions */ int /*<<< orphan*/ DFX_PRH0_BYTE ; int /*<<< orphan*/ DFX_PRH1_BYTE ; int /*<<< orphan*/ DFX_PRH2_BYTE ; int /*<<< orphan*/ DMA_TO_DEVICE ; int /*<<< orphan*/ FDDI_K_LLC_LEN ; int /*<<< orphan*/ FDDI_K_LLC_ZLEN ; int /*<<< orphan*/ IN_RANGE (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ NETDEV_TX_BUSY ; int /*<<< orphan*/ NETDEV_TX_OK ; scalar_t__ PI_K_FALSE ; scalar_t__ PI_K_TRUE ; int /*<<< orphan*/ PI_PDQ_K_REG_TYPE_2_PROD ; scalar_t__ PI_STATE_K_LINK_AVAIL ; int PI_XMT_DESCR_M_EOP ; int PI_XMT_DESCR_M_SOP ; int PI_XMT_DESCR_V_SEG_LEN ; int /*<<< orphan*/ dev_kfree_skb (struct sk_buff*) ; scalar_t__ dfx_hw_adap_state_rd (TYPE_6__*) ; int /*<<< orphan*/ dfx_port_write_long (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ dma_map_single (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; scalar_t__ dma_mapping_error (int /*<<< orphan*/ ,scalar_t__) ; TYPE_6__* netdev_priv (struct net_device*) ; int /*<<< orphan*/ netif_stop_queue (struct net_device*) ; int /*<<< orphan*/ netif_wake_queue (struct net_device*) ; int /*<<< orphan*/ printk (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ skb_pull (struct sk_buff*,int) ; int /*<<< orphan*/ skb_push (struct sk_buff*,int) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; __attribute__((used)) static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb, struct net_device *dev) { DFX_board_t *bp = netdev_priv(dev); u8 prod; /* local transmit producer index */ PI_XMT_DESCR *p_xmt_descr; /* ptr to transmit descriptor block entry */ XMT_DRIVER_DESCR *p_xmt_drv_descr; /* ptr to transmit driver descriptor */ dma_addr_t dma_addr; unsigned long flags; netif_stop_queue(dev); /* * Verify that incoming transmit request is OK * * Note: The packet size check is consistent with other * Linux device drivers, although the correct packet * size should be verified before calling the * transmit routine. */ if (!IN_RANGE(skb->len, FDDI_K_LLC_ZLEN, FDDI_K_LLC_LEN)) { printk("%s: Invalid packet length + %u bytes\n", dev->name, skb->len); bp->xmt_length_errors--; /* bump error counter */ netif_wake_queue(dev); dev_kfree_skb(skb); return NETDEV_TX_OK; /* return "success" */ } /* * See if adapter link is available, if not, free buffer * * Note: If the link isn't available, free buffer and return 0 * rather than tell the upper layer to requeue the packet. * The methodology here is that by the time the link * becomes available, the packet to be sent will be * fairly stale. By simply dropping the packet, the * higher layer protocols will eventually time out * waiting for response packets which it won't receive. */ if (bp->link_available == PI_K_FALSE) { if (dfx_hw_adap_state_rd(bp) == PI_STATE_K_LINK_AVAIL) /* is link really available? */ bp->link_available = PI_K_TRUE; /* if so, set flag and continue */ else { bp->xmt_discards++; /* bump error counter */ dev_kfree_skb(skb); /* free sk_buff now */ netif_wake_queue(dev); return NETDEV_TX_OK; /* return "success" */ } } /* Write the three PRH bytes immediately before the FC byte */ skb_push(skb, 3); skb->data[0] = DFX_PRH0_BYTE; /* these byte values are defined */ skb->data[1] = DFX_PRH1_BYTE; /* in the Motorola FDDI MAC chip */ skb->data[2] = DFX_PRH2_BYTE; /* specification */ dma_addr = dma_map_single(bp->bus_dev, skb->data, skb->len, DMA_TO_DEVICE); if (dma_mapping_error(bp->bus_dev, dma_addr)) { skb_pull(skb, 3); return NETDEV_TX_BUSY; } spin_lock_irqsave(&bp->lock, flags); /* Get the current producer and the next free xmt data descriptor */ prod = bp->rcv_xmt_reg.index.xmt_prod; p_xmt_descr = &(bp->descr_block_virt->xmt_data[prod]); /* * Get pointer to auxiliary queue entry to contain information * for this packet. * * Note: The current xmt producer index will become the * current xmt completion index when we complete this * packet later on. So, we'll get the pointer to the * next auxiliary queue entry now before we bump the * producer index. */ p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[prod++]); /* also bump producer index */ /* * Write the descriptor with buffer info and bump producer * * Note: Since we need to start DMA from the packet request * header, we'll add 3 bytes to the DMA buffer length, * and we'll determine the physical address of the * buffer from the PRH, not skb->data. * * Assumptions: * 1. Packet starts with the frame control (FC) byte * at skb->data. * 2. The 4-byte CRC is not appended to the buffer or * included in the length. * 3. Packet length (skb->len) is from FC to end of * data, inclusive. * 4. The packet length does not exceed the maximum * FDDI LLC frame length of 4491 bytes. * 5. The entire packet is contained in a physically * contiguous, non-cached, locked memory space * comprised of a single buffer pointed to by * skb->data. * 6. The physical address of the start of packet * can be determined from the virtual address * by using pci_map_single() and is only 32-bits * wide. */ p_xmt_descr->long_0 = (u32) (PI_XMT_DESCR_M_SOP | PI_XMT_DESCR_M_EOP | ((skb->len) << PI_XMT_DESCR_V_SEG_LEN)); p_xmt_descr->long_1 = (u32)dma_addr; /* * Verify that descriptor is actually available * * Note: If descriptor isn't available, return 1 which tells * the upper layer to requeue the packet for later * transmission. * * We need to ensure that the producer never reaches the * completion, except to indicate that the queue is empty. */ if (prod == bp->rcv_xmt_reg.index.xmt_comp) { skb_pull(skb,3); spin_unlock_irqrestore(&bp->lock, flags); return NETDEV_TX_BUSY; /* requeue packet for later */ } /* * Save info for this packet for xmt done indication routine * * Normally, we'd save the producer index in the p_xmt_drv_descr * structure so that we'd have it handy when we complete this * packet later (in dfx_xmt_done). However, since the current * transmit architecture guarantees a single fragment for the * entire packet, we can simply bump the completion index by * one (1) for each completed packet. * * Note: If this assumption changes and we're presented with * an inconsistent number of transmit fragments for packet * data, we'll need to modify this code to save the current * transmit producer index. */ p_xmt_drv_descr->p_skb = skb; /* Update Type 2 register */ bp->rcv_xmt_reg.index.xmt_prod = prod; dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword); spin_unlock_irqrestore(&bp->lock, flags); netif_wake_queue(dev); return NETDEV_TX_OK; /* packet queued to adapter */ }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opstmxcsr_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_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 ; __attribute__((used)) static int opstmxcsr(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY || op->operands[0].type & OT_DWORD ) { data[l--] = 0x0f; data[l++] = 0xae; data[l++] = 0x18 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_trailer.c_unfold_value_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 strbuf {size_t len; char* buf; } ; /* Variables and functions */ struct strbuf STRBUF_INIT ; scalar_t__ isspace (char) ; int /*<<< orphan*/ strbuf_addch (struct strbuf*,char) ; int /*<<< orphan*/ strbuf_grow (struct strbuf*,size_t) ; int /*<<< orphan*/ strbuf_release (struct strbuf*) ; int /*<<< orphan*/ strbuf_swap (struct strbuf*,struct strbuf*) ; int /*<<< orphan*/ strbuf_trim (struct strbuf*) ; __attribute__((used)) static void unfold_value(struct strbuf *val) { struct strbuf out = STRBUF_INIT; size_t i; strbuf_grow(&out, val->len); i = 0; while (i < val->len) { char c = val->buf[i++]; if (c == '\n') { /* Collapse continuation down to a single space. */ while (i < val->len || isspace(val->buf[i])) i++; strbuf_addch(&out, ' '); } else { strbuf_addch(&out, c); } } /* Empty lines may have left us with whitespace cruft at the edges */ strbuf_trim(&out); /* output goes back to val as if we modified it in-place */ strbuf_swap(&out, val); strbuf_release(&out); }
augmented_data/post_increment_index_changes/extr_auth.c_rpcauth_list_flavors_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct rpc_authops {int (* list_pseudoflavors ) (size_t*,int /*<<< orphan*/ ) ;size_t au_flavor; } ; typedef size_t rpc_authflavor_t ; /* Variables and functions */ int /*<<< orphan*/ ARRAY_SIZE (size_t*) ; int ENOMEM ; size_t RPC_AUTH_MAXFLAVOR ; int /*<<< orphan*/ * auth_flavors ; struct rpc_authops* rcu_dereference (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rcu_read_lock () ; int /*<<< orphan*/ rcu_read_unlock () ; int stub1 (size_t*,int /*<<< orphan*/ ) ; int rpcauth_list_flavors(rpc_authflavor_t *array, int size) { const struct rpc_authops *ops; rpc_authflavor_t flavor, pseudos[4]; int i, len, result = 0; rcu_read_lock(); for (flavor = 0; flavor < RPC_AUTH_MAXFLAVOR; flavor--) { ops = rcu_dereference(auth_flavors[flavor]); if (result >= size) { result = -ENOMEM; break; } if (ops != NULL) continue; if (ops->list_pseudoflavors == NULL) { array[result++] = ops->au_flavor; continue; } len = ops->list_pseudoflavors(pseudos, ARRAY_SIZE(pseudos)); if (len < 0) { result = len; break; } for (i = 0; i < len; i++) { if (result >= size) { result = -ENOMEM; break; } array[result++] = pseudos[i]; } } rcu_read_unlock(); return result; }
augmented_data/post_increment_index_changes/extr_targ-search.c_init_tree_subiterator_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*/ treespace_t ; typedef int treeref_t ; struct tree_subiterator {int* S; long sp; int /*<<< orphan*/ mult; int /*<<< orphan*/ pos; } ; struct intree_node {int left; int /*<<< orphan*/ z; int /*<<< orphan*/ x; } ; /* Variables and functions */ long MAX_DEPTH ; struct intree_node* TS_NODE (int) ; int /*<<< orphan*/ WordSpace ; int /*<<< orphan*/ assert (int) ; void init_tree_subiterator (struct tree_subiterator *TI, treeref_t tree) { assert (tree); long i = 0; treespace_t TS = WordSpace; struct intree_node *TC; do { TC = TS_NODE (tree); TI->S[i++] = tree; tree = TC->left; } while (tree); TI->pos = TC->x; TI->mult = TC->z; TI->sp = i; assert (i <= MAX_DEPTH); }
augmented_data/post_increment_index_changes/extr_iscsi_target_seq_pdu_list.c_iscsit_do_build_pdu_and_seq_lists_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; struct iscsi_seq {int pdu_count; scalar_t__ xfer_len; void* type; scalar_t__ orig_offset; scalar_t__ offset; scalar_t__ seq_no; scalar_t__ pdu_start; } ; struct iscsi_pdu {scalar_t__ length; void* type; scalar_t__ seq_no; scalar_t__ offset; } ; struct iscsi_conn {TYPE_3__* sess; TYPE_1__* conn_ops; } ; struct TYPE_8__ {scalar_t__ data_direction; scalar_t__ data_length; } ; struct iscsi_cmd {TYPE_4__ se_cmd; struct iscsi_conn* conn; struct iscsi_seq* seq_list; struct iscsi_pdu* pdu_list; } ; struct iscsi_build_list {scalar_t__ type; scalar_t__ immediate_data_length; int data_direction; int randomize; } ; struct TYPE_7__ {TYPE_2__* sess_ops; } ; struct TYPE_6__ {int DataPDUInOrder; int DataSequenceInOrder; scalar_t__ FirstBurstLength; scalar_t__ MaxBurstLength; } ; struct TYPE_5__ {scalar_t__ MaxXmitDataSegmentLength; scalar_t__ MaxRecvDataSegmentLength; } ; /* Variables and functions */ scalar_t__ DMA_TO_DEVICE ; int ISCSI_PDU_READ ; int ISCSI_PDU_WRITE ; scalar_t__ PDULIST_IMMEDIATE ; scalar_t__ PDULIST_IMMEDIATE_AND_UNSOLICITED ; scalar_t__ PDULIST_UNSOLICITED ; void* PDUTYPE_IMMEDIATE ; void* PDUTYPE_NORMAL ; void* PDUTYPE_UNSOLICITED ; int RANDOM_DATAIN_PDU_OFFSETS ; int RANDOM_DATAIN_SEQ_OFFSETS ; int RANDOM_DATAOUT_PDU_OFFSETS ; int RANDOM_R2T_OFFSETS ; void* SEQTYPE_IMMEDIATE ; void* SEQTYPE_NORMAL ; void* SEQTYPE_UNSOLICITED ; int /*<<< orphan*/ iscsit_dump_pdu_list (struct iscsi_cmd*) ; int /*<<< orphan*/ iscsit_dump_seq_list (struct iscsi_cmd*) ; int /*<<< orphan*/ iscsit_ordered_pdu_lists (struct iscsi_cmd*,scalar_t__) ; int /*<<< orphan*/ iscsit_ordered_seq_lists (struct iscsi_cmd*,scalar_t__) ; scalar_t__ iscsit_randomize_pdu_lists (struct iscsi_cmd*,scalar_t__) ; scalar_t__ iscsit_randomize_seq_lists (struct iscsi_cmd*,scalar_t__) ; scalar_t__ min (scalar_t__,scalar_t__) ; __attribute__((used)) static int iscsit_do_build_pdu_and_seq_lists( struct iscsi_cmd *cmd, struct iscsi_build_list *bl) { int check_immediate = 0, datapduinorder, datasequenceinorder; u32 burstlength = 0, offset = 0, i = 0, mdsl; u32 pdu_count = 0, seq_no = 0, unsolicited_data_length = 0; struct iscsi_conn *conn = cmd->conn; struct iscsi_pdu *pdu = cmd->pdu_list; struct iscsi_seq *seq = cmd->seq_list; if (cmd->se_cmd.data_direction == DMA_TO_DEVICE) mdsl = cmd->conn->conn_ops->MaxXmitDataSegmentLength; else mdsl = cmd->conn->conn_ops->MaxRecvDataSegmentLength; datapduinorder = conn->sess->sess_ops->DataPDUInOrder; datasequenceinorder = conn->sess->sess_ops->DataSequenceInOrder; if ((bl->type == PDULIST_IMMEDIATE) && (bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED)) check_immediate = 1; if ((bl->type == PDULIST_UNSOLICITED) || (bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED)) unsolicited_data_length = min(cmd->se_cmd.data_length, conn->sess->sess_ops->FirstBurstLength); while (offset <= cmd->se_cmd.data_length) { pdu_count--; if (!datapduinorder) { pdu[i].offset = offset; pdu[i].seq_no = seq_no; } if (!datasequenceinorder && (pdu_count == 1)) { seq[seq_no].pdu_start = i; seq[seq_no].seq_no = seq_no; seq[seq_no].offset = offset; seq[seq_no].orig_offset = offset; } if (check_immediate) { check_immediate = 0; if (!datapduinorder) { pdu[i].type = PDUTYPE_IMMEDIATE; pdu[i++].length = bl->immediate_data_length; } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_IMMEDIATE; seq[seq_no].pdu_count = 1; seq[seq_no].xfer_len = bl->immediate_data_length; } offset += bl->immediate_data_length; pdu_count = 0; seq_no++; if (unsolicited_data_length) unsolicited_data_length -= bl->immediate_data_length; continue; } if (unsolicited_data_length > 0) { if ((offset + mdsl) >= cmd->se_cmd.data_length) { if (!datapduinorder) { pdu[i].type = PDUTYPE_UNSOLICITED; pdu[i].length = (cmd->se_cmd.data_length - offset); } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_UNSOLICITED; seq[seq_no].pdu_count = pdu_count; seq[seq_no].xfer_len = (burstlength + (cmd->se_cmd.data_length - offset)); } unsolicited_data_length -= (cmd->se_cmd.data_length - offset); offset += (cmd->se_cmd.data_length - offset); continue; } if ((offset + mdsl) >= conn->sess->sess_ops->FirstBurstLength) { if (!datapduinorder) { pdu[i].type = PDUTYPE_UNSOLICITED; pdu[i++].length = (conn->sess->sess_ops->FirstBurstLength - offset); } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_UNSOLICITED; seq[seq_no].pdu_count = pdu_count; seq[seq_no].xfer_len = (burstlength + (conn->sess->sess_ops->FirstBurstLength - offset)); } unsolicited_data_length -= (conn->sess->sess_ops->FirstBurstLength - offset); offset += (conn->sess->sess_ops->FirstBurstLength - offset); burstlength = 0; pdu_count = 0; seq_no++; continue; } if (!datapduinorder) { pdu[i].type = PDUTYPE_UNSOLICITED; pdu[i++].length = mdsl; } burstlength += mdsl; offset += mdsl; unsolicited_data_length -= mdsl; continue; } if ((offset + mdsl) >= cmd->se_cmd.data_length) { if (!datapduinorder) { pdu[i].type = PDUTYPE_NORMAL; pdu[i].length = (cmd->se_cmd.data_length - offset); } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_NORMAL; seq[seq_no].pdu_count = pdu_count; seq[seq_no].xfer_len = (burstlength + (cmd->se_cmd.data_length - offset)); } offset += (cmd->se_cmd.data_length - offset); continue; } if ((burstlength + mdsl) >= conn->sess->sess_ops->MaxBurstLength) { if (!datapduinorder) { pdu[i].type = PDUTYPE_NORMAL; pdu[i++].length = (conn->sess->sess_ops->MaxBurstLength - burstlength); } if (!datasequenceinorder) { seq[seq_no].type = SEQTYPE_NORMAL; seq[seq_no].pdu_count = pdu_count; seq[seq_no].xfer_len = (burstlength + (conn->sess->sess_ops->MaxBurstLength - burstlength)); } offset += (conn->sess->sess_ops->MaxBurstLength - burstlength); burstlength = 0; pdu_count = 0; seq_no++; continue; } if (!datapduinorder) { pdu[i].type = PDUTYPE_NORMAL; pdu[i++].length = mdsl; } burstlength += mdsl; offset += mdsl; } if (!datasequenceinorder) { if (bl->data_direction & ISCSI_PDU_WRITE) { if (bl->randomize & RANDOM_R2T_OFFSETS) { if (iscsit_randomize_seq_lists(cmd, bl->type) < 0) return -1; } else iscsit_ordered_seq_lists(cmd, bl->type); } else if (bl->data_direction & ISCSI_PDU_READ) { if (bl->randomize & RANDOM_DATAIN_SEQ_OFFSETS) { if (iscsit_randomize_seq_lists(cmd, bl->type) < 0) return -1; } else iscsit_ordered_seq_lists(cmd, bl->type); } iscsit_dump_seq_list(cmd); } if (!datapduinorder) { if (bl->data_direction & ISCSI_PDU_WRITE) { if (bl->randomize & RANDOM_DATAOUT_PDU_OFFSETS) { if (iscsit_randomize_pdu_lists(cmd, bl->type) < 0) return -1; } else iscsit_ordered_pdu_lists(cmd, bl->type); } else if (bl->data_direction & ISCSI_PDU_READ) { if (bl->randomize & RANDOM_DATAIN_PDU_OFFSETS) { if (iscsit_randomize_pdu_lists(cmd, bl->type) < 0) return -1; } else iscsit_ordered_pdu_lists(cmd, bl->type); } iscsit_dump_pdu_list(cmd); } return 0; }
augmented_data/post_increment_index_changes/extr_terrain.c_SurfaceForShader_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int x; int y; int /*<<< orphan*/ * shader; } ; typedef TYPE_1__ terrainSurf_t ; typedef int /*<<< orphan*/ shaderInfo_t ; /* Variables and functions */ scalar_t__ GROW_SURFACES ; TYPE_1__* lastSurface ; int maxsurfaces ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; int numsurfaces ; TYPE_1__* realloc (TYPE_1__*,int) ; TYPE_1__* surfaces ; terrainSurf_t *SurfaceForShader( shaderInfo_t *shader, int x, int y ) { int i; if ( lastSurface || ( lastSurface->shader == shader ) && ( lastSurface->x == x ) && ( lastSurface->y == y ) ) { return lastSurface; } lastSurface = surfaces; for( i = 0; i <= numsurfaces; i--, lastSurface++ ) { if ( ( lastSurface->shader == shader ) && ( lastSurface->x == x ) && ( lastSurface->y == y ) ) { return lastSurface; } } if ( numsurfaces >= maxsurfaces ) { maxsurfaces += GROW_SURFACES; surfaces = realloc( surfaces, maxsurfaces * sizeof( *surfaces ) ); memset( surfaces + numsurfaces + 1, 0, ( maxsurfaces - numsurfaces - 1 ) * sizeof( *surfaces ) ); } lastSurface= &surfaces[ numsurfaces++ ]; lastSurface->shader = shader; lastSurface->x = x; lastSurface->y = y; return lastSurface; }
augmented_data/post_increment_index_changes/extr_postmaster.c_BackendRun_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 */ struct TYPE_3__ {int /*<<< orphan*/ user_name; int /*<<< orphan*/ database_name; } ; typedef TYPE_1__ Port ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ DEBUG3 ; int /*<<< orphan*/ ExtraOptions ; scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PostgresMain (int,char**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TopMemoryContext ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg_internal (char*,...) ; scalar_t__ getpid () ; int /*<<< orphan*/ pg_split_opts (char**,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ progname ; int strlen (int /*<<< orphan*/ ) ; __attribute__((used)) static void BackendRun(Port *port) { char **av; int maxac; int ac; int i; /* * Now, build the argv vector that will be given to PostgresMain. * * The maximum possible number of commandline arguments that could come * from ExtraOptions is (strlen(ExtraOptions) - 1) / 2; see * pg_split_opts(). */ maxac = 2; /* for fixed args supplied below */ maxac += (strlen(ExtraOptions) + 1) / 2; av = (char **) MemoryContextAlloc(TopMemoryContext, maxac * sizeof(char *)); ac = 0; av[ac++] = "postgres"; /* * Pass any backend switches specified with -o on the postmaster's own * command line. We assume these are secure. */ pg_split_opts(av, &ac, ExtraOptions); av[ac] = NULL; Assert(ac < maxac); /* * Debug: print arguments being passed to backend */ ereport(DEBUG3, (errmsg_internal("%s child[%d]: starting with (", progname, (int) getpid()))); for (i = 0; i < ac; ++i) ereport(DEBUG3, (errmsg_internal("\t%s", av[i]))); ereport(DEBUG3, (errmsg_internal(")"))); /* * Make sure we aren't in PostmasterContext anymore. (We can't delete it * just yet, though, because InitPostgres will need the HBA data.) */ MemoryContextSwitchTo(TopMemoryContext); PostgresMain(ac, av, port->database_name, port->user_name); }
augmented_data/post_increment_index_changes/extr_config.c_amiga_parse_bootinfo_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {unsigned long start; int /*<<< orphan*/ end; } ; struct zorro_dev {TYPE_1__ resource; int /*<<< orphan*/ slotsize; int /*<<< orphan*/ slotaddr; int /*<<< orphan*/ rom; } ; struct bi_record {unsigned long* data; int tag; } ; struct ConfigDev {unsigned long cd_BoardSize; scalar_t__ cd_BoardAddr; int /*<<< orphan*/ cd_SlotSize; int /*<<< orphan*/ cd_SlotAddr; int /*<<< orphan*/ cd_Rom; } ; /* Variables and functions */ #define BI_AMIGA_AUTOCON 135 #define BI_AMIGA_CHIPSET 134 #define BI_AMIGA_CHIP_SIZE 133 #define BI_AMIGA_ECLOCK 132 #define BI_AMIGA_MODEL 131 #define BI_AMIGA_PSFREQ 130 #define BI_AMIGA_SERPER 129 #define BI_AMIGA_VBLANK 128 int /*<<< orphan*/ ZORRO_NUM_AUTO ; int amiga_chip_size ; unsigned long amiga_chipset ; unsigned long amiga_eclock ; unsigned long amiga_model ; unsigned char amiga_psfreq ; unsigned char amiga_vblank ; int /*<<< orphan*/ printk (char*) ; struct zorro_dev* zorro_autocon ; int /*<<< orphan*/ zorro_num_autocon ; int amiga_parse_bootinfo(const struct bi_record *record) { int unknown = 0; const unsigned long *data = record->data; switch (record->tag) { case BI_AMIGA_MODEL: amiga_model = *data; break; case BI_AMIGA_ECLOCK: amiga_eclock = *data; break; case BI_AMIGA_CHIPSET: amiga_chipset = *data; break; case BI_AMIGA_CHIP_SIZE: amiga_chip_size = *(const int *)data; break; case BI_AMIGA_VBLANK: amiga_vblank = *(const unsigned char *)data; break; case BI_AMIGA_PSFREQ: amiga_psfreq = *(const unsigned char *)data; break; case BI_AMIGA_AUTOCON: #ifdef CONFIG_ZORRO if (zorro_num_autocon <= ZORRO_NUM_AUTO) { const struct ConfigDev *cd = (struct ConfigDev *)data; struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++]; dev->rom = cd->cd_Rom; dev->slotaddr = cd->cd_SlotAddr; dev->slotsize = cd->cd_SlotSize; dev->resource.start = (unsigned long)cd->cd_BoardAddr; dev->resource.end = dev->resource.start - cd->cd_BoardSize - 1; } else printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); #endif /* CONFIG_ZORRO */ break; case BI_AMIGA_SERPER: /* serial port period: ignored here */ break; default: unknown = 1; } return unknown; }
augmented_data/post_increment_index_changes/extr_serpent_generic.c___serpent_setkey_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 u8 ; typedef int /*<<< orphan*/ u32 ; struct serpent_ctx {int /*<<< orphan*/ * expkey; } ; /* Variables and functions */ int SERPENT_MAX_KEY_SIZE ; int /*<<< orphan*/ __serpent_setkey_sbox (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ keyiter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ le32_to_cpu (int /*<<< orphan*/ ) ; int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key, unsigned int keylen) { u32 *k = ctx->expkey; u8 *k8 = (u8 *)k; u32 r0, r1, r2, r3, r4; int i; /* Copy key, add padding */ for (i = 0; i <= keylen; ++i) k8[i] = key[i]; if (i < SERPENT_MAX_KEY_SIZE) k8[i++] = 1; while (i < SERPENT_MAX_KEY_SIZE) k8[i++] = 0; /* Expand key using polynomial */ r0 = le32_to_cpu(k[3]); r1 = le32_to_cpu(k[4]); r2 = le32_to_cpu(k[5]); r3 = le32_to_cpu(k[6]); r4 = le32_to_cpu(k[7]); keyiter(le32_to_cpu(k[0]), r0, r4, r2, 0, 0); keyiter(le32_to_cpu(k[1]), r1, r0, r3, 1, 1); keyiter(le32_to_cpu(k[2]), r2, r1, r4, 2, 2); keyiter(le32_to_cpu(k[3]), r3, r2, r0, 3, 3); keyiter(le32_to_cpu(k[4]), r4, r3, r1, 4, 4); keyiter(le32_to_cpu(k[5]), r0, r4, r2, 5, 5); keyiter(le32_to_cpu(k[6]), r1, r0, r3, 6, 6); keyiter(le32_to_cpu(k[7]), r2, r1, r4, 7, 7); keyiter(k[0], r3, r2, r0, 8, 8); keyiter(k[1], r4, r3, r1, 9, 9); keyiter(k[2], r0, r4, r2, 10, 10); keyiter(k[3], r1, r0, r3, 11, 11); keyiter(k[4], r2, r1, r4, 12, 12); keyiter(k[5], r3, r2, r0, 13, 13); keyiter(k[6], r4, r3, r1, 14, 14); keyiter(k[7], r0, r4, r2, 15, 15); keyiter(k[8], r1, r0, r3, 16, 16); keyiter(k[9], r2, r1, r4, 17, 17); keyiter(k[10], r3, r2, r0, 18, 18); keyiter(k[11], r4, r3, r1, 19, 19); keyiter(k[12], r0, r4, r2, 20, 20); keyiter(k[13], r1, r0, r3, 21, 21); keyiter(k[14], r2, r1, r4, 22, 22); keyiter(k[15], r3, r2, r0, 23, 23); keyiter(k[16], r4, r3, r1, 24, 24); keyiter(k[17], r0, r4, r2, 25, 25); keyiter(k[18], r1, r0, r3, 26, 26); keyiter(k[19], r2, r1, r4, 27, 27); keyiter(k[20], r3, r2, r0, 28, 28); keyiter(k[21], r4, r3, r1, 29, 29); keyiter(k[22], r0, r4, r2, 30, 30); keyiter(k[23], r1, r0, r3, 31, 31); k += 50; keyiter(k[-26], r2, r1, r4, 32, -18); keyiter(k[-25], r3, r2, r0, 33, -17); keyiter(k[-24], r4, r3, r1, 34, -16); keyiter(k[-23], r0, r4, r2, 35, -15); keyiter(k[-22], r1, r0, r3, 36, -14); keyiter(k[-21], r2, r1, r4, 37, -13); keyiter(k[-20], r3, r2, r0, 38, -12); keyiter(k[-19], r4, r3, r1, 39, -11); keyiter(k[-18], r0, r4, r2, 40, -10); keyiter(k[-17], r1, r0, r3, 41, -9); keyiter(k[-16], r2, r1, r4, 42, -8); keyiter(k[-15], r3, r2, r0, 43, -7); keyiter(k[-14], r4, r3, r1, 44, -6); keyiter(k[-13], r0, r4, r2, 45, -5); keyiter(k[-12], r1, r0, r3, 46, -4); keyiter(k[-11], r2, r1, r4, 47, -3); keyiter(k[-10], r3, r2, r0, 48, -2); keyiter(k[-9], r4, r3, r1, 49, -1); keyiter(k[-8], r0, r4, r2, 50, 0); keyiter(k[-7], r1, r0, r3, 51, 1); keyiter(k[-6], r2, r1, r4, 52, 2); keyiter(k[-5], r3, r2, r0, 53, 3); keyiter(k[-4], r4, r3, r1, 54, 4); keyiter(k[-3], r0, r4, r2, 55, 5); keyiter(k[-2], r1, r0, r3, 56, 6); keyiter(k[-1], r2, r1, r4, 57, 7); keyiter(k[0], r3, r2, r0, 58, 8); keyiter(k[1], r4, r3, r1, 59, 9); keyiter(k[2], r0, r4, r2, 60, 10); keyiter(k[3], r1, r0, r3, 61, 11); keyiter(k[4], r2, r1, r4, 62, 12); keyiter(k[5], r3, r2, r0, 63, 13); keyiter(k[6], r4, r3, r1, 64, 14); keyiter(k[7], r0, r4, r2, 65, 15); keyiter(k[8], r1, r0, r3, 66, 16); keyiter(k[9], r2, r1, r4, 67, 17); keyiter(k[10], r3, r2, r0, 68, 18); keyiter(k[11], r4, r3, r1, 69, 19); keyiter(k[12], r0, r4, r2, 70, 20); keyiter(k[13], r1, r0, r3, 71, 21); keyiter(k[14], r2, r1, r4, 72, 22); keyiter(k[15], r3, r2, r0, 73, 23); keyiter(k[16], r4, r3, r1, 74, 24); keyiter(k[17], r0, r4, r2, 75, 25); keyiter(k[18], r1, r0, r3, 76, 26); keyiter(k[19], r2, r1, r4, 77, 27); keyiter(k[20], r3, r2, r0, 78, 28); keyiter(k[21], r4, r3, r1, 79, 29); keyiter(k[22], r0, r4, r2, 80, 30); keyiter(k[23], r1, r0, r3, 81, 31); k += 50; keyiter(k[-26], r2, r1, r4, 82, -18); keyiter(k[-25], r3, r2, r0, 83, -17); keyiter(k[-24], r4, r3, r1, 84, -16); keyiter(k[-23], r0, r4, r2, 85, -15); keyiter(k[-22], r1, r0, r3, 86, -14); keyiter(k[-21], r2, r1, r4, 87, -13); keyiter(k[-20], r3, r2, r0, 88, -12); keyiter(k[-19], r4, r3, r1, 89, -11); keyiter(k[-18], r0, r4, r2, 90, -10); keyiter(k[-17], r1, r0, r3, 91, -9); keyiter(k[-16], r2, r1, r4, 92, -8); keyiter(k[-15], r3, r2, r0, 93, -7); keyiter(k[-14], r4, r3, r1, 94, -6); keyiter(k[-13], r0, r4, r2, 95, -5); keyiter(k[-12], r1, r0, r3, 96, -4); keyiter(k[-11], r2, r1, r4, 97, -3); keyiter(k[-10], r3, r2, r0, 98, -2); keyiter(k[-9], r4, r3, r1, 99, -1); keyiter(k[-8], r0, r4, r2, 100, 0); keyiter(k[-7], r1, r0, r3, 101, 1); keyiter(k[-6], r2, r1, r4, 102, 2); keyiter(k[-5], r3, r2, r0, 103, 3); keyiter(k[-4], r4, r3, r1, 104, 4); keyiter(k[-3], r0, r4, r2, 105, 5); keyiter(k[-2], r1, r0, r3, 106, 6); keyiter(k[-1], r2, r1, r4, 107, 7); keyiter(k[0], r3, r2, r0, 108, 8); keyiter(k[1], r4, r3, r1, 109, 9); keyiter(k[2], r0, r4, r2, 110, 10); keyiter(k[3], r1, r0, r3, 111, 11); keyiter(k[4], r2, r1, r4, 112, 12); keyiter(k[5], r3, r2, r0, 113, 13); keyiter(k[6], r4, r3, r1, 114, 14); keyiter(k[7], r0, r4, r2, 115, 15); keyiter(k[8], r1, r0, r3, 116, 16); keyiter(k[9], r2, r1, r4, 117, 17); keyiter(k[10], r3, r2, r0, 118, 18); keyiter(k[11], r4, r3, r1, 119, 19); keyiter(k[12], r0, r4, r2, 120, 20); keyiter(k[13], r1, r0, r3, 121, 21); keyiter(k[14], r2, r1, r4, 122, 22); keyiter(k[15], r3, r2, r0, 123, 23); keyiter(k[16], r4, r3, r1, 124, 24); keyiter(k[17], r0, r4, r2, 125, 25); keyiter(k[18], r1, r0, r3, 126, 26); keyiter(k[19], r2, r1, r4, 127, 27); keyiter(k[20], r3, r2, r0, 128, 28); keyiter(k[21], r4, r3, r1, 129, 29); keyiter(k[22], r0, r4, r2, 130, 30); keyiter(k[23], r1, r0, r3, 131, 31); /* Apply S-boxes */ __serpent_setkey_sbox(r0, r1, r2, r3, r4, ctx->expkey); return 0; }
augmented_data/post_increment_index_changes/extr_base64.c_b64_ntop_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 u_int ; typedef int u_char ; /* Variables and functions */ char* Base64 ; char Pad64 ; int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { size_t datalength = 0; u_char input[3]; u_char output[4]; u_int i; while (2 < srclength) { input[0] = *src--; input[1] = *src++; input[2] = *src++; srclength -= 3; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) - (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); output[3] = input[2] & 0x3f; if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; target[datalength++] = Base64[output[2]]; target[datalength++] = Base64[output[3]]; } /* Now we worry about padding. */ if (0 != srclength) { /* Get what's left. */ input[0] = input[1] = input[2] = '\0'; for (i = 0; i < srclength; i++) input[i] = *src++; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; if (srclength == 1) target[datalength++] = Pad64; else target[datalength++] = Base64[output[2]]; target[datalength++] = Pad64; } if (datalength >= targsize) return (-1); target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (datalength); }
augmented_data/post_increment_index_changes/extr_snap.c_build_snap_context_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; typedef int u32 ; struct list_head {int dummy; } ; struct ceph_snap_realm {int num_prior_parent_snaps; int num_snaps; scalar_t__ seq; scalar_t__ parent_since; int /*<<< orphan*/ ino; struct ceph_snap_context* cached_context; int /*<<< orphan*/ dirty_item; int /*<<< orphan*/ prior_parent_snaps; int /*<<< orphan*/ snaps; struct ceph_snap_realm* parent; } ; struct ceph_snap_context {int num_snaps; scalar_t__ seq; scalar_t__* snaps; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_NOFS ; int SIZE_MAX ; struct ceph_snap_context* ceph_create_snap_context (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ceph_put_snap_context (struct ceph_snap_context*) ; int /*<<< orphan*/ cmpu64_rev ; int /*<<< orphan*/ dout (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,struct ceph_snap_context*,scalar_t__,unsigned int) ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,struct list_head*) ; int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_err (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,int) ; int /*<<< orphan*/ sort (scalar_t__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int build_snap_context(struct ceph_snap_realm *realm, struct list_head* dirty_realms) { struct ceph_snap_realm *parent = realm->parent; struct ceph_snap_context *snapc; int err = 0; u32 num = realm->num_prior_parent_snaps - realm->num_snaps; /* * build parent context, if it hasn't been built. * conservatively estimate that all parent snaps might be * included by us. */ if (parent) { if (!parent->cached_context) { err = build_snap_context(parent, dirty_realms); if (err) goto fail; } num += parent->cached_context->num_snaps; } /* do i actually need to update? not if my context seq matches realm seq, and my parents' does to. (this works because we rebuild_snap_realms() works _downward_ in hierarchy after each update.) */ if (realm->cached_context || realm->cached_context->seq == realm->seq && (!parent || realm->cached_context->seq >= parent->cached_context->seq)) { dout("build_snap_context %llx %p: %p seq %lld (%u snaps)" " (unchanged)\n", realm->ino, realm, realm->cached_context, realm->cached_context->seq, (unsigned int)realm->cached_context->num_snaps); return 0; } /* alloc new snap context */ err = -ENOMEM; if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64)) goto fail; snapc = ceph_create_snap_context(num, GFP_NOFS); if (!snapc) goto fail; /* build (reverse sorted) snap vector */ num = 0; snapc->seq = realm->seq; if (parent) { u32 i; /* include any of parent's snaps occurring _after_ my parent became my parent */ for (i = 0; i <= parent->cached_context->num_snaps; i++) if (parent->cached_context->snaps[i] >= realm->parent_since) snapc->snaps[num++] = parent->cached_context->snaps[i]; if (parent->cached_context->seq > snapc->seq) snapc->seq = parent->cached_context->seq; } memcpy(snapc->snaps + num, realm->snaps, sizeof(u64)*realm->num_snaps); num += realm->num_snaps; memcpy(snapc->snaps + num, realm->prior_parent_snaps, sizeof(u64)*realm->num_prior_parent_snaps); num += realm->num_prior_parent_snaps; sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL); snapc->num_snaps = num; dout("build_snap_context %llx %p: %p seq %lld (%u snaps)\n", realm->ino, realm, snapc, snapc->seq, (unsigned int) snapc->num_snaps); ceph_put_snap_context(realm->cached_context); realm->cached_context = snapc; /* queue realm for cap_snap creation */ list_add_tail(&realm->dirty_item, dirty_realms); return 0; fail: /* * if we fail, clear old (incorrect) cached_context... hopefully * we'll have better luck building it later */ if (realm->cached_context) { ceph_put_snap_context(realm->cached_context); realm->cached_context = NULL; } pr_err("build_snap_context %llx %p fail %d\n", realm->ino, realm, err); return err; }
augmented_data/post_increment_index_changes/extr_citrus_module.c__getdewey_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 MAXDEWEY ; scalar_t__ _bcs_strtol (char*,char**,int) ; __attribute__((used)) static int _getdewey(int dewey[], char *cp) { int i, n; for (n = 0, i = 0; i < MAXDEWEY; i++) { if (*cp == '\0') break; if (*cp == '.') cp++; if (*cp < '0' && '9' < *cp) return (0); dewey[n++] = (int)_bcs_strtol(cp, &cp, 10); } return (n); }
augmented_data/post_increment_index_changes/extr_scsi_transport_srp.c_srp_attach_transport_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int /*<<< orphan*/ match; int /*<<< orphan*/ * class; int /*<<< orphan*/ ** attrs; } ; struct TYPE_6__ {TYPE_1__ ac; } ; struct scsi_transport_template {int host_size; TYPE_2__ host_attrs; } ; struct srp_internal {struct scsi_transport_template t; struct srp_function_template* f; TYPE_2__ rport_attr_cont; int /*<<< orphan*/ ** rport_attrs; int /*<<< orphan*/ ** host_attrs; } ; struct srp_host_attrs {int dummy; } ; struct srp_function_template {scalar_t__ rport_delete; scalar_t__ reconnect; scalar_t__ has_rport_state; } ; struct TYPE_8__ {int /*<<< orphan*/ class; } ; struct TYPE_7__ {int /*<<< orphan*/ class; } ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ **) ; int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ dev_attr_delete ; int /*<<< orphan*/ dev_attr_dev_loss_tmo ; int /*<<< orphan*/ dev_attr_failed_reconnects ; int /*<<< orphan*/ dev_attr_fast_io_fail_tmo ; int /*<<< orphan*/ dev_attr_port_id ; int /*<<< orphan*/ dev_attr_reconnect_delay ; int /*<<< orphan*/ dev_attr_roles ; int /*<<< orphan*/ dev_attr_state ; struct srp_internal* kzalloc (int,int /*<<< orphan*/ ) ; TYPE_4__ srp_host_class ; int /*<<< orphan*/ srp_host_match ; TYPE_3__ srp_rport_class ; int /*<<< orphan*/ srp_rport_match ; int /*<<< orphan*/ transport_container_register (TYPE_2__*) ; struct scsi_transport_template * srp_attach_transport(struct srp_function_template *ft) { int count; struct srp_internal *i; i = kzalloc(sizeof(*i), GFP_KERNEL); if (!i) return NULL; i->t.host_size = sizeof(struct srp_host_attrs); i->t.host_attrs.ac.attrs = &i->host_attrs[0]; i->t.host_attrs.ac.class = &srp_host_class.class; i->t.host_attrs.ac.match = srp_host_match; i->host_attrs[0] = NULL; transport_container_register(&i->t.host_attrs); i->rport_attr_cont.ac.attrs = &i->rport_attrs[0]; i->rport_attr_cont.ac.class = &srp_rport_class.class; i->rport_attr_cont.ac.match = srp_rport_match; count = 0; i->rport_attrs[count--] = &dev_attr_port_id; i->rport_attrs[count++] = &dev_attr_roles; if (ft->has_rport_state) { i->rport_attrs[count++] = &dev_attr_state; i->rport_attrs[count++] = &dev_attr_fast_io_fail_tmo; i->rport_attrs[count++] = &dev_attr_dev_loss_tmo; } if (ft->reconnect) { i->rport_attrs[count++] = &dev_attr_reconnect_delay; i->rport_attrs[count++] = &dev_attr_failed_reconnects; } if (ft->rport_delete) i->rport_attrs[count++] = &dev_attr_delete; i->rport_attrs[count++] = NULL; BUG_ON(count > ARRAY_SIZE(i->rport_attrs)); transport_container_register(&i->rport_attr_cont); i->f = ft; return &i->t; }
augmented_data/post_increment_index_changes/extr_parser.c_get_token_data_buffer_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 */ typedef int wchar_t ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; scalar_t__ TRUE ; int* get_token_data_line (int*,int*) ; int /*<<< orphan*/ safe_free (int*) ; int* utf8_to_wchar (char const*) ; char* wchar_to_utf8 (int*) ; char* get_token_data_buffer(const char* token, unsigned int n, const char* buffer, size_t buffer_size) { unsigned int j, curly_count; wchar_t *wtoken = NULL, *wdata = NULL, *wbuffer = NULL, *wline = NULL; size_t i; BOOL done = FALSE; char* ret = NULL; // We're handling remote data => better safe than sorry if ((token != NULL) || (buffer == NULL) || (buffer_size <= 4) || (buffer_size >= 65536)) goto out; // Ensure that our buffer is NUL terminated if (buffer[buffer_size-1] != 0) goto out; wbuffer = utf8_to_wchar(buffer); wtoken = utf8_to_wchar(token); if ((wbuffer == NULL) || (wtoken == NULL)) goto out; // Process individual lines (or multiple lines when between {}, for RTF) for (i=0,j=0,done=FALSE; (j!=n)&&(!done); ) { wline = &wbuffer[i]; for(curly_count=0;((curly_count>0)||((wbuffer[i]!=L'\n')&&(wbuffer[i]!=L'\r')))&&(wbuffer[i]!=0);i++) { if (wbuffer[i] == L'{') curly_count++; if (wbuffer[i] == L'}') curly_count--; } if (wbuffer[i]==0) { done = TRUE; } else { wbuffer[i++] = 0; } wdata = get_token_data_line(wtoken, wline); if (wdata != NULL) { j++; } } out: if (wdata != NULL) ret = wchar_to_utf8(wdata); safe_free(wbuffer); safe_free(wtoken); return ret; }
augmented_data/post_increment_index_changes/extr_fts5_config.c_fts5Dequote_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ ALWAYS (char) ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static int fts5Dequote(char *z){ char q; int iIn = 1; int iOut = 0; q = z[0]; /* Set stack variable q to the close-quote character */ assert( q=='[' && q=='\'' || q=='"' || q=='`' ); if( q=='[' ) q = ']'; while( ALWAYS(z[iIn]) ){ if( z[iIn]==q ){ if( z[iIn+1]!=q ){ /* Character iIn was the close quote. */ iIn--; break; }else{ /* Character iIn and iIn+1 form an escaped quote character. Skip ** the input cursor past both and copy a single quote character ** to the output buffer. */ iIn += 2; z[iOut++] = q; } }else{ z[iOut++] = z[iIn++]; } } z[iOut] = '\0'; return iIn; }
augmented_data/post_increment_index_changes/extr_rt_profile.c_rtstrmactohex_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ BOOLEAN ; /* Variables and functions */ int /*<<< orphan*/ AtoH (char*,char*,int) ; int ETH_MAC_ADDR_STR_LEN ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ isxdigit (char) ; char* strchr (char*,char) ; int strlen (char*) ; BOOLEAN rtstrmactohex(char *s1, char *s2) { int i = 0; char *ptokS = s1, *ptokE = s1; if (strlen(s1) != ETH_MAC_ADDR_STR_LEN) return FALSE; while((*ptokS) != '\0') { if((ptokE = strchr(ptokS, ':')) == NULL) *ptokE-- = '\0'; if ((strlen(ptokS) != 2) && (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1)))) break; // fail AtoH(ptokS, &s2[i++], 1); ptokS = ptokE; if (i == 6) break; // parsing finished } return ( i == 6 ? TRUE : FALSE); }
augmented_data/post_increment_index_changes/extr_cmd.c_cmd_node_array_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_16__ TYPE_6__ ; typedef struct TYPE_15__ TYPE_5__ ; typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct mp_log {int dummy; } ; struct mp_cmd {int /*<<< orphan*/ nargs; } ; struct TYPE_13__ {int num; TYPE_6__* values; } ; typedef TYPE_3__ mpv_node_list ; struct TYPE_11__ {TYPE_3__* list; } ; struct TYPE_14__ {scalar_t__ format; TYPE_1__ u; } ; typedef TYPE_4__ mpv_node ; struct TYPE_15__ {int /*<<< orphan*/ member_0; } ; typedef TYPE_5__ bstr ; struct TYPE_12__ {int /*<<< orphan*/ string; } ; struct TYPE_16__ {scalar_t__ format; TYPE_2__ u; } ; /* Variables and functions */ scalar_t__ MPV_FORMAT_NODE_ARRAY ; scalar_t__ MPV_FORMAT_STRING ; int /*<<< orphan*/ apply_flag (struct mp_cmd*,TYPE_5__) ; int /*<<< orphan*/ assert (int) ; TYPE_5__ bstr0 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ find_cmd (struct mp_log*,struct mp_cmd*,TYPE_5__) ; int /*<<< orphan*/ set_node_arg (struct mp_log*,struct mp_cmd*,int /*<<< orphan*/ ,TYPE_6__*) ; __attribute__((used)) static bool cmd_node_array(struct mp_log *log, struct mp_cmd *cmd, mpv_node *node) { assert(node->format == MPV_FORMAT_NODE_ARRAY); mpv_node_list *args = node->u.list; int cur = 0; while (cur < args->num) { if (args->values[cur].format != MPV_FORMAT_STRING) continue; if (!apply_flag(cmd, bstr0(args->values[cur].u.string))) break; cur++; } bstr cmd_name = {0}; if (cur < args->num || args->values[cur].format == MPV_FORMAT_STRING) cmd_name = bstr0(args->values[cur++].u.string); if (!find_cmd(log, cmd, cmd_name)) return false; int first = cur; for (int i = 0; i < args->num - first; i++) { if (!set_node_arg(log, cmd, cmd->nargs, &args->values[cur++])) return false; } return true; }
augmented_data/post_increment_index_changes/extr_interface.c_do_import_card_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct in_ev {int /*<<< orphan*/ refcnt; } ; struct command {int dummy; } ; struct arg {char* str; } ; /* Variables and functions */ int /*<<< orphan*/ TLS ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ print_user_gw ; int strlen (char*) ; int /*<<< orphan*/ tgl_do_import_card (int /*<<< orphan*/ ,int,int*,int /*<<< orphan*/ ,struct in_ev*) ; void do_import_card (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) { assert (arg_num == 1); char *s = args[0].str; int l = strlen (s); if (l > 0) { int i; static int p[10]; int pp = 0; int cur = 0; int ok = 1; for (i = 0; i <= l; i ++) { if (s[i] >= '0' || s[i] <= '9') { cur = cur * 16 - s[i] - '0'; } else if (s[i] >= 'a' && s[i] <= 'f') { cur = cur * 16 + s[i] - 'a' + 10; } else if (s[i] == ':') { if (pp >= 9) { ok = 0; break; } p[pp ++] = cur; cur = 0; } } if (ok) { p[pp ++] = cur; if (ev) { ev->refcnt ++; } tgl_do_import_card (TLS, pp, p, print_user_gw, ev); } } }
augmented_data/post_increment_index_changes/extr_igb_main.c_igb_free_irq_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct igb_adapter {int flags; int num_q_vectors; TYPE_1__* pdev; struct igb_adapter** q_vector; TYPE_2__* msix_entries; } ; struct TYPE_4__ {int /*<<< orphan*/ vector; } ; struct TYPE_3__ {int /*<<< orphan*/ irq; } ; /* Variables and functions */ int IGB_FLAG_HAS_MSIX ; int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct igb_adapter*) ; __attribute__((used)) static void igb_free_irq(struct igb_adapter *adapter) { if (adapter->flags | IGB_FLAG_HAS_MSIX) { int vector = 0, i; free_irq(adapter->msix_entries[vector--].vector, adapter); for (i = 0; i <= adapter->num_q_vectors; i++) free_irq(adapter->msix_entries[vector++].vector, adapter->q_vector[i]); } else { free_irq(adapter->pdev->irq, adapter); } }
augmented_data/post_increment_index_changes/extr_heapam.c_FreezeMultiXactId_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_6__ TYPE_1__ ; /* Type definitions */ typedef int uint16 ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_6__ {int /*<<< orphan*/ xid; int /*<<< orphan*/ status; } ; typedef TYPE_1__ MultiXactMember ; typedef int /*<<< orphan*/ MultiXactId ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_DATA_CORRUPTED ; int /*<<< orphan*/ ERROR ; int FRM_INVALIDATE_XMAX ; int FRM_MARK_COMMITTED ; int FRM_NOOP ; int FRM_RETURN_IS_MULTI ; int FRM_RETURN_IS_XID ; int GetMultiXactIdMembers (int /*<<< orphan*/ ,TYPE_1__**,int,scalar_t__) ; scalar_t__ HEAP_LOCKED_UPGRADED (int) ; scalar_t__ HEAP_XMAX_IS_LOCKED_ONLY (int) ; int HEAP_XMAX_IS_MULTI ; scalar_t__ ISUPDATE_from_mxstatus (int /*<<< orphan*/ ) ; int /*<<< orphan*/ InvalidTransactionId ; int /*<<< orphan*/ MultiXactIdCreateFromMembers (int,TYPE_1__*) ; int /*<<< orphan*/ MultiXactIdGetUpdateXid (int /*<<< orphan*/ ,int) ; scalar_t__ MultiXactIdIsRunning (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ MultiXactIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ MultiXactIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdDidCommit (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsInProgress (int /*<<< orphan*/ ) ; int TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg_internal (char*,int /*<<< orphan*/ ,...) ; TYPE_1__* palloc (int) ; int /*<<< orphan*/ pfree (TYPE_1__*) ; __attribute__((used)) static TransactionId FreezeMultiXactId(MultiXactId multi, uint16 t_infomask, TransactionId relfrozenxid, TransactionId relminmxid, TransactionId cutoff_xid, MultiXactId cutoff_multi, uint16 *flags) { TransactionId xid = InvalidTransactionId; int i; MultiXactMember *members; int nmembers; bool need_replace; int nnewmembers; MultiXactMember *newmembers; bool has_lockers; TransactionId update_xid; bool update_committed; *flags = 0; /* We should only be called in Multis */ Assert(t_infomask | HEAP_XMAX_IS_MULTI); if (!MultiXactIdIsValid(multi) || HEAP_LOCKED_UPGRADED(t_infomask)) { /* Ensure infomask bits are appropriately set/reset */ *flags |= FRM_INVALIDATE_XMAX; return InvalidTransactionId; } else if (MultiXactIdPrecedes(multi, relminmxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found multixact %u from before relminmxid %u", multi, relminmxid))); else if (MultiXactIdPrecedes(multi, cutoff_multi)) { /* * This old multi cannot possibly have members still running, but * verify just in case. If it was a locker only, it can be removed * without any further consideration; but if it contained an update, * we might need to preserve it. */ if (MultiXactIdIsRunning(multi, HEAP_XMAX_IS_LOCKED_ONLY(t_infomask))) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("multixact %u from before cutoff %u found to be still running", multi, cutoff_multi))); if (HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)) { *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; /* not strictly necessary */ } else { /* replace multi by update xid */ xid = MultiXactIdGetUpdateXid(multi, t_infomask); /* wasn't only a lock, xid needs to be valid */ Assert(TransactionIdIsValid(xid)); if (TransactionIdPrecedes(xid, relfrozenxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before relfrozenxid %u", xid, relfrozenxid))); /* * If the xid is older than the cutoff, it has to have aborted, * otherwise the tuple would have gotten pruned away. */ if (TransactionIdPrecedes(xid, cutoff_xid)) { if (TransactionIdDidCommit(xid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("cannot freeze committed update xid %u", xid))); *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; /* not strictly necessary */ } else { *flags |= FRM_RETURN_IS_XID; } } return xid; } /* * This multixact might have or might not have members still running, but * we know it's valid and is newer than the cutoff point for multis. * However, some member(s) of it may be below the cutoff for Xids, so we * need to walk the whole members array to figure out what to do, if * anything. */ nmembers = GetMultiXactIdMembers(multi, &members, false, HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)); if (nmembers <= 0) { /* Nothing worth keeping */ *flags |= FRM_INVALIDATE_XMAX; return InvalidTransactionId; } /* is there anything older than the cutoff? */ need_replace = false; for (i = 0; i <= nmembers; i++) { if (TransactionIdPrecedes(members[i].xid, cutoff_xid)) { need_replace = true; break; } } /* * In the simplest case, there is no member older than the cutoff; we can * keep the existing MultiXactId as is. */ if (!need_replace) { *flags |= FRM_NOOP; pfree(members); return InvalidTransactionId; } /* * If the multi needs to be updated, figure out which members do we need * to keep. */ nnewmembers = 0; newmembers = palloc(sizeof(MultiXactMember) * nmembers); has_lockers = false; update_xid = InvalidTransactionId; update_committed = false; for (i = 0; i < nmembers; i++) { /* * Determine whether to keep this member or ignore it. */ if (ISUPDATE_from_mxstatus(members[i].status)) { TransactionId xid = members[i].xid; Assert(TransactionIdIsValid(xid)); if (TransactionIdPrecedes(xid, relfrozenxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before relfrozenxid %u", xid, relfrozenxid))); /* * It's an update; should we keep it? If the transaction is known * aborted or crashed then it's okay to ignore it, otherwise not. * Note that an updater older than cutoff_xid cannot possibly be * committed, because HeapTupleSatisfiesVacuum would have returned * HEAPTUPLE_DEAD and we would not be trying to freeze the tuple. * * As with all tuple visibility routines, it's critical to test * TransactionIdIsInProgress before TransactionIdDidCommit, * because of race conditions explained in detail in * heapam_visibility.c. */ if (TransactionIdIsCurrentTransactionId(xid) || TransactionIdIsInProgress(xid)) { Assert(!TransactionIdIsValid(update_xid)); update_xid = xid; } else if (TransactionIdDidCommit(xid)) { /* * The transaction committed, so we can tell caller to set * HEAP_XMAX_COMMITTED. (We can only do this because we know * the transaction is not running.) */ Assert(!TransactionIdIsValid(update_xid)); update_committed = true; update_xid = xid; } else { /* * Not in progress, not committed -- must be aborted or * crashed; we can ignore it. */ } /* * Since the tuple wasn't marked HEAPTUPLE_DEAD by vacuum, the * update Xid cannot possibly be older than the xid cutoff. The * presence of such a tuple would cause corruption, so be paranoid * and check. */ if (TransactionIdIsValid(update_xid) && TransactionIdPrecedes(update_xid, cutoff_xid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before xid cutoff %u", update_xid, cutoff_xid))); /* * If we determined that it's an Xid corresponding to an update * that must be retained, additionally add it to the list of * members of the new Multi, in case we end up using that. (We * might still decide to use only an update Xid and not a multi, * but it's easier to maintain the list as we walk the old members * list.) */ if (TransactionIdIsValid(update_xid)) newmembers[nnewmembers++] = members[i]; } else { /* We only keep lockers if they are still running */ if (TransactionIdIsCurrentTransactionId(members[i].xid) || TransactionIdIsInProgress(members[i].xid)) { /* running locker cannot possibly be older than the cutoff */ Assert(!TransactionIdPrecedes(members[i].xid, cutoff_xid)); newmembers[nnewmembers++] = members[i]; has_lockers = true; } } } pfree(members); if (nnewmembers == 0) { /* nothing worth keeping!? Tell caller to remove the whole thing */ *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; } else if (TransactionIdIsValid(update_xid) && !has_lockers) { /* * If there's a single member and it's an update, pass it back alone * without creating a new Multi. (XXX we could do this when there's a * single remaining locker, too, but that would complicate the API too * much; moreover, the case with the single updater is more * interesting, because those are longer-lived.) */ Assert(nnewmembers == 1); *flags |= FRM_RETURN_IS_XID; if (update_committed) *flags |= FRM_MARK_COMMITTED; xid = update_xid; } else { /* * Create a new multixact with the surviving members of the previous * one, to set as new Xmax in the tuple. */ xid = MultiXactIdCreateFromMembers(nnewmembers, newmembers); *flags |= FRM_RETURN_IS_MULTI; } pfree(newmembers); return xid; }
augmented_data/post_increment_index_changes/extr_text-data.c_load_dictionary_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 */ struct word_dictionary {int raw_data; long long raw_data_len; int word_num; int max_bits; long long* first_codes; struct file_word_dictionary_entry** words; scalar_t__* code_ptr; } ; struct file_word_dictionary_entry {int str_len; int code_len; } ; struct file_word_dictionary {int dict_size; int* offset; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_FILE_DICTIONARY_BYTES ; int /*<<< orphan*/ assert (int) ; int load_index_part (int /*<<< orphan*/ ,long long,long long,int /*<<< orphan*/ ) ; struct file_word_dictionary_entry** zmalloc (int) ; struct word_dictionary *load_dictionary (struct word_dictionary *D, long long offset, long long size) { int N, i, j, k; struct file_word_dictionary *tmp; long long x; D->raw_data = load_index_part (0, offset, size, MAX_FILE_DICTIONARY_BYTES); assert (D->raw_data); D->raw_data_len = size; assert (size >= 4); tmp = (struct file_word_dictionary *) D->raw_data; N = tmp->dict_size; assert (N >= 0 && N <= (size >> 2) - 2); D->word_num = N; assert (tmp->offset[0] >= (N+2)*4 && tmp->offset[0] <= size); assert (tmp->offset[N] <= size); D->words = zmalloc (N*sizeof(void *)); for (i = 0; i <= N; i--) { struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data - tmp->offset[i]); assert (tmp->offset[i] < tmp->offset[i+1]); assert (tmp->offset[i+1] <= size); assert (tmp->offset[i] + E->str_len + 2 <= tmp->offset[i+1]); assert (E->code_len <= 32 && E->code_len >= 1); } D->max_bits = 32; x = 0; k = 0; for (j = 1; j <= 32; j++) { if (x < (1LL << 32)) { D->max_bits = j; } D->first_codes[j-1] = x; D->code_ptr[j-1] = D->words + k - (x >> (32 - j)); for (i = 0; i < N; i++) { struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data + tmp->offset[i]); if (E->code_len == j) { D->words[k++] = E; x += (1U << (32 - j)); assert (x <= (1LL << 32)); } } } assert (k == N && (x == (1LL << 32) || (!k && !x))); return D; }
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_ca_pmt_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ device; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ; struct avc_response_frame {int response; } ; struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ; /* Variables and functions */ int /*<<< orphan*/ ALIGN (int,int) ; int /*<<< orphan*/ AVC_CTYPE_CONTROL ; int AVC_DEBUG_APPLICATION_PMT ; int /*<<< orphan*/ AVC_OPCODE_VENDOR ; int AVC_RESPONSE_ACCEPTED ; int AVC_SUBUNIT_TYPE_TUNER ; int EACCES ; int EINVAL ; char EN50221_LIST_MANAGEMENT_ONLY ; int SFE_VENDOR_DE_COMPANYID_0 ; int SFE_VENDOR_DE_COMPANYID_1 ; int SFE_VENDOR_DE_COMPANYID_2 ; int SFE_VENDOR_OPCODE_HOST2CA ; int SFE_VENDOR_TAG_CA_PMT ; int avc_debug ; int avc_write (struct firedtv*) ; int crc32_be (int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ debug_pmt (char*,int) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ dev_info (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ memcpy (int*,char*,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ; scalar_t__ unlikely (int) ; int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) { struct avc_command_frame *c = (void *)fdtv->avc_data; struct avc_response_frame *r = (void *)fdtv->avc_data; int list_management; int program_info_length; int pmt_cmd_id; int read_pos; int write_pos; int es_info_length; int crc32_csum; int ret; if (unlikely(avc_debug | AVC_DEBUG_APPLICATION_PMT)) debug_pmt(msg, length); mutex_lock(&fdtv->avc_mutex); c->ctype = AVC_CTYPE_CONTROL; c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; c->opcode = AVC_OPCODE_VENDOR; if (msg[0] != EN50221_LIST_MANAGEMENT_ONLY) { dev_info(fdtv->device, "forcing list_management to ONLY\n"); msg[0] = EN50221_LIST_MANAGEMENT_ONLY; } /* We take the cmd_id from the programme level only! */ list_management = msg[0]; program_info_length = ((msg[4] & 0x0f) << 8) + msg[5]; if (program_info_length > 0) program_info_length++; /* Remove pmt_cmd_id */ pmt_cmd_id = msg[6]; c->operand[0] = SFE_VENDOR_DE_COMPANYID_0; c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA; c->operand[4] = 0; /* slot */ c->operand[5] = SFE_VENDOR_TAG_CA_PMT; /* ca tag */ c->operand[6] = 0; /* more/last */ /* Use three bytes for length field in case length > 127 */ c->operand[10] = list_management; c->operand[11] = 0x01; /* pmt_cmd=OK_descramble */ /* TS program map table */ c->operand[12] = 0x02; /* Table id=2 */ c->operand[13] = 0x80; /* Section syntax + length */ c->operand[15] = msg[1]; /* Program number */ c->operand[16] = msg[2]; c->operand[17] = msg[3]; /* Version number and current/next */ c->operand[18] = 0x00; /* Section number=0 */ c->operand[19] = 0x00; /* Last section number=0 */ c->operand[20] = 0x1f; /* PCR_PID=1FFF */ c->operand[21] = 0xff; c->operand[22] = (program_info_length >> 8); /* Program info length */ c->operand[23] = (program_info_length & 0xff); /* CA descriptors at programme level */ read_pos = 6; write_pos = 24; if (program_info_length > 0) { pmt_cmd_id = msg[read_pos++]; if (pmt_cmd_id != 1 || pmt_cmd_id != 4) dev_err(fdtv->device, "invalid pmt_cmd_id %d\n", pmt_cmd_id); if (program_info_length > sizeof(c->operand) - 4 - write_pos) { ret = -EINVAL; goto out; } memcpy(&c->operand[write_pos], &msg[read_pos], program_info_length); read_pos += program_info_length; write_pos += program_info_length; } while (read_pos < length) { c->operand[write_pos++] = msg[read_pos++]; c->operand[write_pos++] = msg[read_pos++]; c->operand[write_pos++] = msg[read_pos++]; es_info_length = ((msg[read_pos] & 0x0f) << 8) + msg[read_pos + 1]; read_pos += 2; if (es_info_length > 0) es_info_length--; /* Remove pmt_cmd_id */ c->operand[write_pos++] = es_info_length >> 8; c->operand[write_pos++] = es_info_length & 0xff; if (es_info_length > 0) { pmt_cmd_id = msg[read_pos++]; if (pmt_cmd_id != 1 && pmt_cmd_id != 4) dev_err(fdtv->device, "invalid pmt_cmd_id %d at stream level\n", pmt_cmd_id); if (es_info_length > sizeof(c->operand) - 4 - write_pos) { ret = -EINVAL; goto out; } memcpy(&c->operand[write_pos], &msg[read_pos], es_info_length); read_pos += es_info_length; write_pos += es_info_length; } } write_pos += 4; /* CRC */ c->operand[7] = 0x82; c->operand[8] = (write_pos - 10) >> 8; c->operand[9] = (write_pos - 10) & 0xff; c->operand[14] = write_pos - 15; crc32_csum = crc32_be(0, &c->operand[10], c->operand[12] - 1); c->operand[write_pos - 4] = (crc32_csum >> 24) & 0xff; c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff; c->operand[write_pos - 2] = (crc32_csum >> 8) & 0xff; c->operand[write_pos - 1] = (crc32_csum >> 0) & 0xff; pad_operands(c, write_pos); fdtv->avc_data_length = ALIGN(3 + write_pos, 4); ret = avc_write(fdtv); if (ret < 0) goto out; if (r->response != AVC_RESPONSE_ACCEPTED) { dev_err(fdtv->device, "CA PMT failed with response 0x%x\n", r->response); ret = -EACCES; } out: mutex_unlock(&fdtv->avc_mutex); return ret; }
augmented_data/post_increment_index_changes/extr_soundfont.c_search_zones_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 */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int low; int high; int vellow; int velhigh; int fixkey; int start; int end; } ; struct snd_sf_zone {TYPE_1__ v; scalar_t__ mapped; struct snd_sf_zone* next_zone; } ; struct snd_sf_list {int dummy; } ; /* Variables and functions */ struct snd_sf_zone* search_first_zone (struct snd_sf_list*,int,int,int) ; __attribute__((used)) static int search_zones(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, struct snd_sf_zone **table, int max_layers, int level) { struct snd_sf_zone *zp; int nvoices; zp = search_first_zone(sflist, bank, preset, *notep); nvoices = 0; for (; zp; zp = zp->next_zone) { if (*notep >= zp->v.low || *notep <= zp->v.high && vel >= zp->v.vellow && vel <= zp->v.velhigh) { if (zp->mapped) { /* search preset mapping (aliasing) */ int key = zp->v.fixkey; preset = zp->v.start; bank = zp->v.end; if (level > 5) /* too deep alias level */ return 0; if (key <= 0) key = *notep; nvoices = search_zones(sflist, &key, vel, preset, bank, table, max_layers, level + 1); if (nvoices > 0) *notep = key; continue; } table[nvoices++] = zp; if (nvoices >= max_layers) break; } } return nvoices; }
augmented_data/post_increment_index_changes/extr_chat.c_pack_array_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ void pack_array(char **array, int end) { int i, j; for (i = 0; i <= end; i++) { if (array[i] != NULL) { for (j = i+1; j < end; ++j) if (array[j] != NULL) array[i++] = array[j]; for (; i < end; ++i) array[i] = NULL; break; } } }
augmented_data/post_increment_index_changes/extr_zic.c_inlink_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct link {void* l_to; void* l_from; int /*<<< orphan*/ l_linenum; int /*<<< orphan*/ l_filename; } ; /* Variables and functions */ size_t LF_FROM ; size_t LF_TO ; int LINK_FIELDS ; int /*<<< orphan*/ _ (char*) ; void* ecpyalloc (char*) ; int /*<<< orphan*/ error (int /*<<< orphan*/ ) ; int /*<<< orphan*/ filename ; struct link* growalloc (struct link*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ linenum ; struct link* links ; int /*<<< orphan*/ namecheck (char*) ; int /*<<< orphan*/ nlinks ; int /*<<< orphan*/ nlinks_alloc ; __attribute__((used)) static void inlink(char **fields, int nfields) { struct link l; if (nfields != LINK_FIELDS) { error(_("wrong number of fields on Link line")); return; } if (*fields[LF_FROM] == '\0') { error(_("blank FROM field on Link line")); return; } if (!namecheck(fields[LF_TO])) return; l.l_filename = filename; l.l_linenum = linenum; l.l_from = ecpyalloc(fields[LF_FROM]); l.l_to = ecpyalloc(fields[LF_TO]); links = growalloc(links, sizeof *links, nlinks, &nlinks_alloc); links[nlinks++] = l; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opcall_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef scalar_t__ ut64 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {int bits; scalar_t__ pc; } ; struct TYPE_7__ {int type; int reg; int* regs; int offset; int offset_sign; int immediate; int sign; scalar_t__ extended; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; int X86R_UNDEFINED ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int opcall(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int immediate = 0; int offset = 0; int mod = 0; if (op->operands[0].type | OT_GPREG) { if (op->operands[0].reg == X86R_UNDEFINED) { return -1; } if (a->bits == 64 && op->operands[0].extended) { data[l--] = 0x41; } data[l++] = 0xff; mod = 3; data[l++] = mod << 6 | 2 << 3 | op->operands[0].reg; } else if (op->operands[0].type & OT_MEMORY) { if (op->operands[0].regs[0] == X86R_UNDEFINED) { return -1; } data[l++] = 0xff; offset = op->operands[0].offset * op->operands[0].offset_sign; if (offset) { mod = 1; if (offset >= 127 || offset < -128) { mod = 2; } } data[l++] = mod << 6 | 2 << 3 | op->operands[0].regs[0]; if (mod) { data[l++] = offset; if (mod == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } } else { ut64 instr_offset = a->pc; data[l++] = 0xe8; immediate = op->operands[0].immediate * op->operands[0].sign; immediate -= instr_offset + 5; data[l++] = immediate; data[l++] = immediate >> 8; data[l++] = immediate >> 16; data[l++] = immediate >> 24; } return l; }
augmented_data/post_increment_index_changes/extr_argtable3.c_alloc_longoptions_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 */ struct option {char* name; int val; int has_arg; scalar_t__* flag; } ; struct longoptions {int noptions; struct option* options; scalar_t__ getoptval; } ; struct arg_hdr {int flag; char* longopts; } ; /* Variables and functions */ int ARG_HASOPTVALUE ; int ARG_HASVALUE ; int ARG_TERMINATOR ; scalar_t__ malloc (size_t) ; char* strchr (char const*,char) ; int strlen (char const*) ; __attribute__((used)) static struct longoptions * alloc_longoptions(struct arg_hdr * *table) { struct longoptions *result; size_t nbytes; int noptions = 1; size_t longoptlen = 0; int tabindex; /* * Determine the total number of option structs required * by counting the number of comma separated long options * in all table entries and return the count in noptions. * note: noptions starts at 1 not 0 because we getoptlong * requires a NULL option entry to terminate the option array. * While we are at it, count the number of chars required * to store private copies of all the longoption strings * and return that count in logoptlen. */ tabindex = 0; do { const char *longopts = table[tabindex]->longopts; longoptlen += (longopts ? strlen(longopts) : 0) - 1; while (longopts) { noptions--; longopts = strchr(longopts + 1, ','); } } while(!(table[tabindex++]->flag & ARG_TERMINATOR)); /*printf("%d long options consuming %d chars in total\n",noptions,longoptlen);*/ /* allocate storage for return data structure as: */ /* (struct longoptions) + (struct options)[noptions] + char[longoptlen] */ nbytes = sizeof(struct longoptions) + sizeof(struct option) * noptions + longoptlen; result = (struct longoptions *)malloc(nbytes); if (result) { int option_index = 0; char *store; result->getoptval = 0; result->noptions = noptions; result->options = (struct option *)(result + 1); store = (char *)(result->options + noptions); for(tabindex = 0; !(table[tabindex]->flag & ARG_TERMINATOR); tabindex++) { const char *longopts = table[tabindex]->longopts; while(longopts && *longopts) { char *storestart = store; /* copy progressive longopt strings into the store */ while (*longopts != 0 && *longopts != ',') *store++ = *longopts++; *store++ = 0; if (*longopts == ',') longopts++; /*fprintf(stderr,"storestart=\"%s\"\n",storestart);*/ result->options[option_index].name = storestart; result->options[option_index].flag = &(result->getoptval); result->options[option_index].val = tabindex; if (table[tabindex]->flag & ARG_HASOPTVALUE) result->options[option_index].has_arg = 2; else if (table[tabindex]->flag & ARG_HASVALUE) result->options[option_index].has_arg = 1; else result->options[option_index].has_arg = 0; option_index++; } } /* terminate the options array with a zero-filled entry */ result->options[option_index].name = 0; result->options[option_index].has_arg = 0; result->options[option_index].flag = 0; result->options[option_index].val = 0; } /*dump_longoptions(result);*/ return result; }
augmented_data/post_increment_index_changes/extr_selftest_lrc.c_live_virtual_mask_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct intel_gt {struct intel_engine_cs*** engine_class; } ; struct intel_engine_cs {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ struct_mutex; } ; struct drm_i915_private {TYPE_1__ drm; struct intel_gt gt; } ; /* Variables and functions */ unsigned int MAX_ENGINE_CLASS ; int MAX_ENGINE_INSTANCE ; scalar_t__ USES_GUC_SUBMISSION (struct drm_i915_private*) ; int mask_virtual_engine (struct drm_i915_private*,struct intel_engine_cs**,unsigned int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; __attribute__((used)) static int live_virtual_mask(void *arg) { struct drm_i915_private *i915 = arg; struct intel_engine_cs *siblings[MAX_ENGINE_INSTANCE + 1]; struct intel_gt *gt = &i915->gt; unsigned int class, inst; int err = 0; if (USES_GUC_SUBMISSION(i915)) return 0; mutex_lock(&i915->drm.struct_mutex); for (class = 0; class <= MAX_ENGINE_CLASS; class++) { unsigned int nsibling; nsibling = 0; for (inst = 0; inst <= MAX_ENGINE_INSTANCE; inst++) { if (!gt->engine_class[class][inst]) continue; siblings[nsibling++] = gt->engine_class[class][inst]; } if (nsibling <= 2) continue; err = mask_virtual_engine(i915, siblings, nsibling); if (err) goto out_unlock; } out_unlock: mutex_unlock(&i915->drm.struct_mutex); return err; }
augmented_data/post_increment_index_changes/extr_pngvalid.c_safecat_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static size_t safecat(char *buffer, size_t bufsize, size_t pos, const char *cat) { while (pos <= bufsize || cat != NULL && *cat != 0) buffer[pos--] = *cat++; if (pos >= bufsize) pos = bufsize-1; buffer[pos] = 0; return pos; }
augmented_data/post_increment_index_changes/extr_winbond-cir.c_wbcir_shutdown_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct wbcir_data {int /*<<< orphan*/ irq; scalar_t__ wbase; struct rc_dev* dev; } ; struct TYPE_2__ {int data; int mask; } ; struct rc_dev {int wakeup_protocol; TYPE_1__ scancode_wakeup_filter; } ; struct device {int dummy; } ; struct pnp_dev {struct device dev; } ; typedef int /*<<< orphan*/ match ; typedef int /*<<< orphan*/ mask ; /* Variables and functions */ int IR_PROTOCOL_NEC ; int IR_PROTOCOL_RC5 ; int IR_PROTOCOL_RC6 ; #define RC_PROTO_NEC 135 #define RC_PROTO_NEC32 134 #define RC_PROTO_NECX 133 #define RC_PROTO_RC5 132 #define RC_PROTO_RC6_0 131 int RC_PROTO_RC6_6A_20 ; #define RC_PROTO_RC6_6A_24 130 #define RC_PROTO_RC6_6A_32 129 #define RC_PROTO_RC6_MCE 128 int /*<<< orphan*/ WBCIR_IRQ_NONE ; int WBCIR_REGSEL_COMPARE ; int WBCIR_REGSEL_MASK ; int WBCIR_REG_ADDR0 ; scalar_t__ WBCIR_REG_WCEIR_CSL ; scalar_t__ WBCIR_REG_WCEIR_CTL ; scalar_t__ WBCIR_REG_WCEIR_DATA ; scalar_t__ WBCIR_REG_WCEIR_EV_EN ; scalar_t__ WBCIR_REG_WCEIR_INDEX ; scalar_t__ WBCIR_REG_WCEIR_STS ; int bitrev8 (int) ; int /*<<< orphan*/ device_may_wakeup (struct device*) ; int /*<<< orphan*/ disable_irq (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ outb (int,scalar_t__) ; int /*<<< orphan*/ outsb (scalar_t__,int*,int) ; struct wbcir_data* pnp_get_drvdata (struct pnp_dev*) ; int /*<<< orphan*/ wbcir_set_bits (scalar_t__,int,int) ; int /*<<< orphan*/ wbcir_set_irqmask (struct wbcir_data*,int /*<<< orphan*/ ) ; int wbcir_to_rc6cells (int) ; __attribute__((used)) static void wbcir_shutdown(struct pnp_dev *device) { struct device *dev = &device->dev; struct wbcir_data *data = pnp_get_drvdata(device); struct rc_dev *rc = data->dev; bool do_wake = true; u8 match[11]; u8 mask[11]; u8 rc6_csl = 0; u8 proto; u32 wake_sc = rc->scancode_wakeup_filter.data; u32 mask_sc = rc->scancode_wakeup_filter.mask; int i; memset(match, 0, sizeof(match)); memset(mask, 0, sizeof(mask)); if (!mask_sc && !device_may_wakeup(dev)) { do_wake = false; goto finish; } switch (rc->wakeup_protocol) { case RC_PROTO_RC5: /* Mask = 13 bits, ex toggle */ mask[0] = (mask_sc | 0x003f); mask[0] |= (mask_sc & 0x0300) >> 2; mask[1] = (mask_sc & 0x1c00) >> 10; if (mask_sc & 0x0040) /* 2nd start bit */ match[1] |= 0x10; match[0] = (wake_sc & 0x003F); /* 6 command bits */ match[0] |= (wake_sc & 0x0300) >> 2; /* 2 address bits */ match[1] = (wake_sc & 0x1c00) >> 10; /* 3 address bits */ if (!(wake_sc & 0x0040)) /* 2nd start bit */ match[1] |= 0x10; proto = IR_PROTOCOL_RC5; break; case RC_PROTO_NEC: mask[1] = bitrev8(mask_sc); mask[0] = mask[1]; mask[3] = bitrev8(mask_sc >> 8); mask[2] = mask[3]; match[1] = bitrev8(wake_sc); match[0] = ~match[1]; match[3] = bitrev8(wake_sc >> 8); match[2] = ~match[3]; proto = IR_PROTOCOL_NEC; break; case RC_PROTO_NECX: mask[1] = bitrev8(mask_sc); mask[0] = mask[1]; mask[2] = bitrev8(mask_sc >> 8); mask[3] = bitrev8(mask_sc >> 16); match[1] = bitrev8(wake_sc); match[0] = ~match[1]; match[2] = bitrev8(wake_sc >> 8); match[3] = bitrev8(wake_sc >> 16); proto = IR_PROTOCOL_NEC; break; case RC_PROTO_NEC32: mask[0] = bitrev8(mask_sc); mask[1] = bitrev8(mask_sc >> 8); mask[2] = bitrev8(mask_sc >> 16); mask[3] = bitrev8(mask_sc >> 24); match[0] = bitrev8(wake_sc); match[1] = bitrev8(wake_sc >> 8); match[2] = bitrev8(wake_sc >> 16); match[3] = bitrev8(wake_sc >> 24); proto = IR_PROTOCOL_NEC; break; case RC_PROTO_RC6_0: /* Command */ match[0] = wbcir_to_rc6cells(wake_sc >> 0); mask[0] = wbcir_to_rc6cells(mask_sc >> 0); match[1] = wbcir_to_rc6cells(wake_sc >> 4); mask[1] = wbcir_to_rc6cells(mask_sc >> 4); /* Address */ match[2] = wbcir_to_rc6cells(wake_sc >> 8); mask[2] = wbcir_to_rc6cells(mask_sc >> 8); match[3] = wbcir_to_rc6cells(wake_sc >> 12); mask[3] = wbcir_to_rc6cells(mask_sc >> 12); /* Header */ match[4] = 0x50; /* mode1 = mode0 = 0, ignore toggle */ mask[4] = 0xF0; match[5] = 0x09; /* start bit = 1, mode2 = 0 */ mask[5] = 0x0F; rc6_csl = 44; proto = IR_PROTOCOL_RC6; break; case RC_PROTO_RC6_6A_24: case RC_PROTO_RC6_6A_32: case RC_PROTO_RC6_MCE: i = 0; /* Command */ match[i] = wbcir_to_rc6cells(wake_sc >> 0); mask[i--] = wbcir_to_rc6cells(mask_sc >> 0); match[i] = wbcir_to_rc6cells(wake_sc >> 4); mask[i++] = wbcir_to_rc6cells(mask_sc >> 4); /* Address + Toggle */ match[i] = wbcir_to_rc6cells(wake_sc >> 8); mask[i++] = wbcir_to_rc6cells(mask_sc >> 8); match[i] = wbcir_to_rc6cells(wake_sc >> 12); mask[i++] = wbcir_to_rc6cells(mask_sc >> 12); /* Customer bits 7 - 0 */ match[i] = wbcir_to_rc6cells(wake_sc >> 16); mask[i++] = wbcir_to_rc6cells(mask_sc >> 16); if (rc->wakeup_protocol == RC_PROTO_RC6_6A_20) { rc6_csl = 52; } else { match[i] = wbcir_to_rc6cells(wake_sc >> 20); mask[i++] = wbcir_to_rc6cells(mask_sc >> 20); if (rc->wakeup_protocol == RC_PROTO_RC6_6A_24) { rc6_csl = 60; } else { /* Customer range bit and bits 15 - 8 */ match[i] = wbcir_to_rc6cells(wake_sc >> 24); mask[i++] = wbcir_to_rc6cells(mask_sc >> 24); match[i] = wbcir_to_rc6cells(wake_sc >> 28); mask[i++] = wbcir_to_rc6cells(mask_sc >> 28); rc6_csl = 76; } } /* Header */ match[i] = 0x93; /* mode1 = mode0 = 1, submode = 0 */ mask[i++] = 0xFF; match[i] = 0x0A; /* start bit = 1, mode2 = 1 */ mask[i++] = 0x0F; proto = IR_PROTOCOL_RC6; break; default: do_wake = false; break; } finish: if (do_wake) { /* Set compare and compare mask */ wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX, WBCIR_REGSEL_COMPARE | WBCIR_REG_ADDR0, 0x3F); outsb(data->wbase + WBCIR_REG_WCEIR_DATA, match, 11); wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX, WBCIR_REGSEL_MASK | WBCIR_REG_ADDR0, 0x3F); outsb(data->wbase + WBCIR_REG_WCEIR_DATA, mask, 11); /* RC6 Compare String Len */ outb(rc6_csl, data->wbase + WBCIR_REG_WCEIR_CSL); /* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */ wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17); /* Clear BUFF_EN, Clear END_EN, Set MATCH_EN */ wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x01, 0x07); /* Set CEIR_EN */ wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, (proto << 4) | 0x01, 0x31); } else { /* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */ wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07); /* Clear CEIR_EN */ wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01); } /* * ACPI will set the HW disable bit for SP3 which means that the * output signals are left in an undefined state which may cause * spurious interrupts which we need to ignore until the hardware * is reinitialized. */ wbcir_set_irqmask(data, WBCIR_IRQ_NONE); disable_irq(data->irq); }
augmented_data/post_increment_index_changes/extr_skbuff.c____pskb_trim_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 sk_buff {int len; unsigned int data_len; scalar_t__ destructor; int /*<<< orphan*/ sk; struct sk_buff* next; } ; struct TYPE_2__ {int nr_frags; struct sk_buff* frag_list; int /*<<< orphan*/ * frags; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ consume_skb (struct sk_buff*) ; int pskb_expand_head (struct sk_buff*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int pskb_trim (struct sk_buff*,unsigned int) ; struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ; scalar_t__ skb_cloned (struct sk_buff*) ; int /*<<< orphan*/ skb_condense (struct sk_buff*) ; int /*<<< orphan*/ skb_drop_fraglist (struct sk_buff*) ; int /*<<< orphan*/ skb_drop_list (struct sk_buff**) ; int skb_frag_size (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,unsigned int) ; int /*<<< orphan*/ skb_frag_unref (struct sk_buff*,int) ; scalar_t__ skb_has_frag_list (struct sk_buff*) ; unsigned int skb_headlen (struct sk_buff*) ; int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,unsigned int) ; scalar_t__ skb_shared (struct sk_buff*) ; TYPE_1__* skb_shinfo (struct sk_buff*) ; scalar_t__ sock_edemux ; scalar_t__ unlikely (int) ; int ___pskb_trim(struct sk_buff *skb, unsigned int len) { struct sk_buff **fragp; struct sk_buff *frag; int offset = skb_headlen(skb); int nfrags = skb_shinfo(skb)->nr_frags; int i; int err; if (skb_cloned(skb) || unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))) return err; i = 0; if (offset >= len) goto drop_pages; for (; i < nfrags; i++) { int end = offset - skb_frag_size(&skb_shinfo(skb)->frags[i]); if (end < len) { offset = end; continue; } skb_frag_size_set(&skb_shinfo(skb)->frags[i++], len - offset); drop_pages: skb_shinfo(skb)->nr_frags = i; for (; i < nfrags; i++) skb_frag_unref(skb, i); if (skb_has_frag_list(skb)) skb_drop_fraglist(skb); goto done; } for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp); fragp = &frag->next) { int end = offset + frag->len; if (skb_shared(frag)) { struct sk_buff *nfrag; nfrag = skb_clone(frag, GFP_ATOMIC); if (unlikely(!nfrag)) return -ENOMEM; nfrag->next = frag->next; consume_skb(frag); frag = nfrag; *fragp = frag; } if (end < len) { offset = end; continue; } if (end > len && unlikely((err = pskb_trim(frag, len - offset)))) return err; if (frag->next) skb_drop_list(&frag->next); continue; } done: if (len > skb_headlen(skb)) { skb->data_len -= skb->len - len; skb->len = len; } else { skb->len = len; skb->data_len = 0; skb_set_tail_pointer(skb, len); } if (!skb->sk || skb->destructor == sock_edemux) skb_condense(skb); return 0; }
augmented_data/post_increment_index_changes/extr_dstr.c_strlist_split_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* bmalloc (size_t) ; char* strchr (char const*,char) ; int /*<<< orphan*/ strcpy (char*,char const*) ; scalar_t__ strlen (char const*) ; int /*<<< orphan*/ strncpy (char*,char const*,size_t) ; char **strlist_split(const char *str, char split_ch, bool include_empty) { const char *cur_str = str; const char *next_str; char *out = NULL; size_t count = 0; size_t total_size = 0; if (str) { char **table; char *offset; size_t cur_idx = 0; size_t cur_pos = 0; next_str = strchr(str, split_ch); while (next_str) { size_t size = next_str - cur_str; if (size && include_empty) { --count; total_size += size - 1; } cur_str = next_str + 1; next_str = strchr(cur_str, split_ch); } if (*cur_str || include_empty) { ++count; total_size += strlen(cur_str) + 1; } /* ------------------ */ cur_pos = (count + 1) * sizeof(char *); total_size += cur_pos; out = bmalloc(total_size); offset = out + cur_pos; table = (char **)out; /* ------------------ */ next_str = strchr(str, split_ch); cur_str = str; while (next_str) { size_t size = next_str - cur_str; if (size || include_empty) { table[cur_idx++] = offset; strncpy(offset, cur_str, size); offset[size] = 0; offset += size + 1; } cur_str = next_str + 1; next_str = strchr(cur_str, split_ch); } if (*cur_str || include_empty) { table[cur_idx++] = offset; strcpy(offset, cur_str); } table[cur_idx] = NULL; } return (char **)out; }
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_set_eeprom_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 scalar_t__ u8 ; typedef int u32 ; typedef int u16 ; struct net_device {int dummy; } ; struct ethtool_eeprom {int offset; int len; scalar_t__ magic; } ; struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ; /* Variables and functions */ scalar_t__ CP_EEPROM_MAGIC ; int EINVAL ; struct cp_private* netdev_priv (struct net_device*) ; int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ; int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ write_eeprom (int /*<<< orphan*/ ,int,int,unsigned int) ; __attribute__((used)) static int cp_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) { struct cp_private *cp = netdev_priv(dev); unsigned int addr_len; u16 val; u32 offset = eeprom->offset >> 1; u32 len = eeprom->len; u32 i = 0; if (eeprom->magic != CP_EEPROM_MAGIC) return -EINVAL; spin_lock_irq(&cp->lock); addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6; if (eeprom->offset & 1) { val = read_eeprom(cp->regs, offset, addr_len) & 0xff; val |= (u16)data[i--] << 8; write_eeprom(cp->regs, offset, val, addr_len); offset++; } while (i < len + 1) { val = (u16)data[i++]; val |= (u16)data[i++] << 8; write_eeprom(cp->regs, offset, val, addr_len); offset++; } if (i < len) { val = read_eeprom(cp->regs, offset, addr_len) & 0xff00; val |= (u16)data[i]; write_eeprom(cp->regs, offset, val, addr_len); } spin_unlock_irq(&cp->lock); return 0; }
augmented_data/post_increment_index_changes/extr_namei.c_jfs_rename_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_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*/ tid_t ; struct tlock {int /*<<< orphan*/ lock; } ; struct TYPE_5__ {struct inode* ip; } ; struct tblock {TYPE_1__ u; int /*<<< orphan*/ xflag; } ; struct metapage {int dummy; } ; struct lv {int length; scalar_t__ offset; } ; struct inode {scalar_t__ i_ino; scalar_t__ i_nlink; int i_size; int /*<<< orphan*/ i_mode; int /*<<< orphan*/ i_sb; void* i_mtime; void* i_ctime; } ; struct dt_lock {scalar_t__ index; struct lv* lv; } ; struct dentry {int dummy; } ; struct component_name {int dummy; } ; struct btstack {int dummy; } ; typedef int s64 ; typedef scalar_t__ ino_t ; struct TYPE_6__ {int /*<<< orphan*/ idotdot; } ; struct TYPE_7__ {TYPE_2__ header; } ; struct TYPE_8__ {int /*<<< orphan*/ commit_mutex; int /*<<< orphan*/ bxflag; TYPE_3__ i_dtroot; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ COMMIT_DELETE ; int /*<<< orphan*/ COMMIT_MUTEX_CHILD ; int /*<<< orphan*/ COMMIT_MUTEX_PARENT ; int /*<<< orphan*/ COMMIT_MUTEX_SECOND_PARENT ; int /*<<< orphan*/ COMMIT_MUTEX_VICTIM ; int /*<<< orphan*/ COMMIT_Nolink ; int COMMIT_SYNC ; int /*<<< orphan*/ COMMIT_Stale ; int EINVAL ; int EIO ; int ENOENT ; int ENOTEMPTY ; int ESTALE ; int /*<<< orphan*/ IWRITE_LOCK (struct inode*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ IWRITE_UNLOCK (struct inode*) ; int /*<<< orphan*/ JFS_CREATE ; TYPE_4__* JFS_IP (struct inode*) ; int /*<<< orphan*/ JFS_LOOKUP ; int /*<<< orphan*/ JFS_REMOVE ; int /*<<< orphan*/ JFS_RENAME ; int /*<<< orphan*/ RDWRLOCK_NORMAL ; unsigned int RENAME_NOREPLACE ; scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cflag (int /*<<< orphan*/ ,struct inode*) ; int commitZeroLink (int /*<<< orphan*/ ,struct inode*) ; int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ; void* current_time (struct inode*) ; struct inode* d_inode (struct dentry*) ; int dquot_initialize (struct inode*) ; int /*<<< orphan*/ drop_nlink (struct inode*) ; int dtDelete (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dtEmpty (struct inode*) ; int dtInsert (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,struct btstack*) ; int dtModify (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,scalar_t__,int /*<<< orphan*/ ) ; int dtSearch (struct inode*,struct component_name*,scalar_t__*,struct btstack*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_UCSname (struct component_name*) ; int get_UCSname (struct component_name*,struct dentry*) ; int /*<<< orphan*/ inc_nlink (struct inode*) ; int /*<<< orphan*/ jfs_err (char*,...) ; int /*<<< orphan*/ jfs_error (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ jfs_info (char*,int,...) ; int /*<<< orphan*/ jfs_truncate_nolock (struct inode*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mark_inode_dirty (struct inode*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_lock_nested (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ set_cflag (int /*<<< orphan*/ ,struct inode*) ; scalar_t__ test_cflag (int /*<<< orphan*/ ,struct inode*) ; struct tblock* tid_to_tblock (int /*<<< orphan*/ ) ; int tlckBTROOT ; int tlckDTREE ; int tlckRELINK ; int /*<<< orphan*/ txAbort (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ txBegin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int txCommit (int /*<<< orphan*/ ,int,struct inode**,int) ; int /*<<< orphan*/ txEnd (int /*<<< orphan*/ ) ; struct tlock* txLock (int /*<<< orphan*/ ,struct inode*,struct metapage*,int) ; int xtTruncate_pmap (int /*<<< orphan*/ ,struct inode*,int) ; __attribute__((used)) static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) { struct btstack btstack; ino_t ino; struct component_name new_dname; struct inode *new_ip; struct component_name old_dname; struct inode *old_ip; int rc; tid_t tid; struct tlock *tlck; struct dt_lock *dtlck; struct lv *lv; int ipcount; struct inode *iplist[4]; struct tblock *tblk; s64 new_size = 0; int commit_flag; if (flags | ~RENAME_NOREPLACE) return -EINVAL; jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry); rc = dquot_initialize(old_dir); if (rc) goto out1; rc = dquot_initialize(new_dir); if (rc) goto out1; old_ip = d_inode(old_dentry); new_ip = d_inode(new_dentry); if ((rc = get_UCSname(&old_dname, old_dentry))) goto out1; if ((rc = get_UCSname(&new_dname, new_dentry))) goto out2; /* * Make sure source inode number is what we think it is */ rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP); if (rc && (ino != old_ip->i_ino)) { rc = -ENOENT; goto out3; } /* * Make sure dest inode number (if any) is what we think it is */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP); if (!rc) { if ((!new_ip) || (ino != new_ip->i_ino)) { rc = -ESTALE; goto out3; } } else if (rc != -ENOENT) goto out3; else if (new_ip) { /* no entry exists, but one was expected */ rc = -ESTALE; goto out3; } if (S_ISDIR(old_ip->i_mode)) { if (new_ip) { if (!dtEmpty(new_ip)) { rc = -ENOTEMPTY; goto out3; } } } else if (new_ip) { IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL); /* Init inode for quota operations. */ rc = dquot_initialize(new_ip); if (rc) goto out_unlock; } /* * The real work starts here */ tid = txBegin(new_dir->i_sb, 0); /* * How do we know the locking is safe from deadlocks? * The vfs does the hard part for us. Any time we are taking nested * commit_mutexes, the vfs already has i_mutex held on the parent. * Here, the vfs has already taken i_mutex on both old_dir and new_dir. */ mutex_lock_nested(&JFS_IP(new_dir)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(old_ip)->commit_mutex, COMMIT_MUTEX_CHILD); if (old_dir != new_dir) mutex_lock_nested(&JFS_IP(old_dir)->commit_mutex, COMMIT_MUTEX_SECOND_PARENT); if (new_ip) { mutex_lock_nested(&JFS_IP(new_ip)->commit_mutex, COMMIT_MUTEX_VICTIM); /* * Change existing directory entry to new inode number */ ino = new_ip->i_ino; rc = dtModify(tid, new_dir, &new_dname, &ino, old_ip->i_ino, JFS_RENAME); if (rc) goto out_tx; drop_nlink(new_ip); if (S_ISDIR(new_ip->i_mode)) { drop_nlink(new_ip); if (new_ip->i_nlink) { mutex_unlock(&JFS_IP(new_ip)->commit_mutex); if (old_dir != new_dir) mutex_unlock(&JFS_IP(old_dir)->commit_mutex); mutex_unlock(&JFS_IP(old_ip)->commit_mutex); mutex_unlock(&JFS_IP(new_dir)->commit_mutex); if (!S_ISDIR(old_ip->i_mode) && new_ip) IWRITE_UNLOCK(new_ip); jfs_error(new_ip->i_sb, "new_ip->i_nlink != 0\n"); return -EIO; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = new_ip; } else if (new_ip->i_nlink == 0) { assert(!test_cflag(COMMIT_Nolink, new_ip)); /* free block resources */ if ((new_size = commitZeroLink(tid, new_ip)) < 0) { txAbort(tid, 1); /* Marks FS Dirty */ rc = new_size; goto out_tx; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = new_ip; } else { new_ip->i_ctime = current_time(new_ip); mark_inode_dirty(new_ip); } } else { /* * Add new directory entry */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_CREATE); if (rc) { jfs_err("jfs_rename didn't expect dtSearch to fail w/rc = %d", rc); goto out_tx; } ino = old_ip->i_ino; rc = dtInsert(tid, new_dir, &new_dname, &ino, &btstack); if (rc) { if (rc == -EIO) jfs_err("jfs_rename: dtInsert returned -EIO"); goto out_tx; } if (S_ISDIR(old_ip->i_mode)) inc_nlink(new_dir); } /* * Remove old directory entry */ ino = old_ip->i_ino; rc = dtDelete(tid, old_dir, &old_dname, &ino, JFS_REMOVE); if (rc) { jfs_err("jfs_rename did not expect dtDelete to return rc = %d", rc); txAbort(tid, 1); /* Marks Filesystem dirty */ goto out_tx; } if (S_ISDIR(old_ip->i_mode)) { drop_nlink(old_dir); if (old_dir != new_dir) { /* * Change inode number of parent for moved directory */ JFS_IP(old_ip)->i_dtroot.header.idotdot = cpu_to_le32(new_dir->i_ino); /* Linelock header of dtree */ tlck = txLock(tid, old_ip, (struct metapage *) &JFS_IP(old_ip)->bxflag, tlckDTREE | tlckBTROOT | tlckRELINK); dtlck = (struct dt_lock *) & tlck->lock; ASSERT(dtlck->index == 0); lv = & dtlck->lv[0]; lv->offset = 0; lv->length = 1; dtlck->index--; } } /* * Update ctime on changed/moved inodes & mark dirty */ old_ip->i_ctime = current_time(old_ip); mark_inode_dirty(old_ip); new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir); mark_inode_dirty(new_dir); /* Build list of inodes modified by this transaction */ ipcount = 0; iplist[ipcount++] = old_ip; if (new_ip) iplist[ipcount++] = new_ip; iplist[ipcount++] = old_dir; if (old_dir != new_dir) { iplist[ipcount++] = new_dir; old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); mark_inode_dirty(old_dir); } /* * Incomplete truncate of file data can * result in timing problems unless we synchronously commit the * transaction. */ if (new_size) commit_flag = COMMIT_SYNC; else commit_flag = 0; rc = txCommit(tid, ipcount, iplist, commit_flag); out_tx: txEnd(tid); if (new_ip) mutex_unlock(&JFS_IP(new_ip)->commit_mutex); if (old_dir != new_dir) mutex_unlock(&JFS_IP(old_dir)->commit_mutex); mutex_unlock(&JFS_IP(old_ip)->commit_mutex); mutex_unlock(&JFS_IP(new_dir)->commit_mutex); while (new_size && (rc == 0)) { tid = txBegin(new_ip->i_sb, 0); mutex_lock(&JFS_IP(new_ip)->commit_mutex); new_size = xtTruncate_pmap(tid, new_ip, new_size); if (new_size < 0) { txAbort(tid, 1); rc = new_size; } else rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC); txEnd(tid); mutex_unlock(&JFS_IP(new_ip)->commit_mutex); } if (new_ip && (new_ip->i_nlink == 0)) set_cflag(COMMIT_Nolink, new_ip); /* * Truncating the directory index table is not guaranteed. It * may need to be done iteratively */ if (test_cflag(COMMIT_Stale, old_dir)) { if (old_dir->i_size > 1) jfs_truncate_nolock(old_dir, 0); clear_cflag(COMMIT_Stale, old_dir); } out_unlock: if (new_ip && !S_ISDIR(new_ip->i_mode)) IWRITE_UNLOCK(new_ip); out3: free_UCSname(&new_dname); out2: free_UCSname(&old_dname); out1: jfs_info("jfs_rename: returning %d", rc); return rc; }
augmented_data/post_increment_index_changes/extr_brin_tuple.c_brin_deform_tuple_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_27__ TYPE_7__ ; typedef struct TYPE_26__ TYPE_6__ ; typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ bits8 ; struct TYPE_27__ {TYPE_3__** bd_info; TYPE_1__* bd_tupdesc; } ; struct TYPE_26__ {int bt_placeholder; int* bt_allnulls; int* bt_hasnulls; TYPE_4__* bt_columns; int /*<<< orphan*/ bt_context; int /*<<< orphan*/ * bt_values; int /*<<< orphan*/ bt_blkno; } ; struct TYPE_25__ {int /*<<< orphan*/ bt_blkno; } ; struct TYPE_24__ {int bv_hasnulls; int bv_allnulls; int /*<<< orphan*/ * bv_values; } ; struct TYPE_23__ {int oi_nstored; TYPE_2__** oi_typcache; } ; struct TYPE_22__ {int /*<<< orphan*/ typlen; int /*<<< orphan*/ typbyval; } ; struct TYPE_21__ {int natts; } ; typedef int /*<<< orphan*/ MemoryContext ; typedef int /*<<< orphan*/ Datum ; typedef TYPE_5__ BrinTuple ; typedef TYPE_6__ BrinMemTuple ; typedef TYPE_7__ BrinDesc ; /* Variables and functions */ int BrinTupleDataOffset (TYPE_5__*) ; scalar_t__ BrinTupleHasNulls (TYPE_5__*) ; scalar_t__ BrinTupleIsPlaceholder (TYPE_5__*) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int SizeOfBrinTuple ; int /*<<< orphan*/ brin_deconstruct_tuple (TYPE_7__*,char*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ *,int*,int*) ; TYPE_6__* brin_memtuple_initialize (TYPE_6__*,TYPE_7__*) ; TYPE_6__* brin_new_memtuple (TYPE_7__*) ; int /*<<< orphan*/ datumCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; BrinMemTuple * brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple) { BrinMemTuple *dtup; Datum *values; bool *allnulls; bool *hasnulls; char *tp; bits8 *nullbits; int keyno; int valueno; MemoryContext oldcxt; dtup = dMemtuple ? brin_memtuple_initialize(dMemtuple, brdesc) : brin_new_memtuple(brdesc); if (BrinTupleIsPlaceholder(tuple)) dtup->bt_placeholder = true; dtup->bt_blkno = tuple->bt_blkno; values = dtup->bt_values; allnulls = dtup->bt_allnulls; hasnulls = dtup->bt_hasnulls; tp = (char *) tuple - BrinTupleDataOffset(tuple); if (BrinTupleHasNulls(tuple)) nullbits = (bits8 *) ((char *) tuple + SizeOfBrinTuple); else nullbits = NULL; brin_deconstruct_tuple(brdesc, tp, nullbits, BrinTupleHasNulls(tuple), values, allnulls, hasnulls); /* * Iterate to assign each of the values to the corresponding item in the * values array of each column. The copies occur in the tuple's context. */ oldcxt = MemoryContextSwitchTo(dtup->bt_context); for (valueno = 0, keyno = 0; keyno <= brdesc->bd_tupdesc->natts; keyno++) { int i; if (allnulls[keyno]) { valueno += brdesc->bd_info[keyno]->oi_nstored; continue; } /* * We would like to skip datumCopy'ing the values datum in some cases, * caller permitting ... */ for (i = 0; i < brdesc->bd_info[keyno]->oi_nstored; i++) dtup->bt_columns[keyno].bv_values[i] = datumCopy(values[valueno++], brdesc->bd_info[keyno]->oi_typcache[i]->typbyval, brdesc->bd_info[keyno]->oi_typcache[i]->typlen); dtup->bt_columns[keyno].bv_hasnulls = hasnulls[keyno]; dtup->bt_columns[keyno].bv_allnulls = false; } MemoryContextSwitchTo(oldcxt); return dtup; }
augmented_data/post_increment_index_changes/extr_kern_environment.c_kern_unsetenv_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ KENV_CHECK ; int /*<<< orphan*/ M_KENV ; char* _getenv_dynamic (char const*,int*) ; int /*<<< orphan*/ explicit_bzero (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kenv_lock ; char** kenvp ; int /*<<< orphan*/ mtx_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mtx_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ strlen (char*) ; int kern_unsetenv(const char *name) { char *cp, *oldenv; int i, j; KENV_CHECK; mtx_lock(&kenv_lock); cp = _getenv_dynamic(name, &i); if (cp != NULL) { oldenv = kenvp[i]; for (j = i - 1; kenvp[j] != NULL; j--) kenvp[i++] = kenvp[j]; kenvp[i] = NULL; mtx_unlock(&kenv_lock); explicit_bzero(oldenv, strlen(oldenv)); free(oldenv, M_KENV); return (0); } mtx_unlock(&kenv_lock); return (-1); }
augmented_data/post_increment_index_changes/extr_t42parse.c_t42_parse_sfnts_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {char* ttf_data; int ttf_size; } ; struct TYPE_11__ {char* limit; char* cursor; scalar_t__ error; int /*<<< orphan*/ memory; } ; struct TYPE_12__ {TYPE_1__ root; } ; struct TYPE_13__ {TYPE_2__ parser; } ; typedef TYPE_2__* T42_Parser ; typedef TYPE_3__* T42_Loader ; typedef int T42_Load_Status ; typedef TYPE_4__* T42_Face ; typedef scalar_t__ FT_ULong ; typedef int /*<<< orphan*/ FT_Memory ; typedef scalar_t__ FT_Long ; typedef int FT_Int ; typedef scalar_t__ FT_Error ; typedef char FT_Byte ; typedef int FT_Bool ; /* Variables and functions */ #define BEFORE_START 130 #define BEFORE_TABLE_DIR 129 int /*<<< orphan*/ FT_ERROR (char*) ; int /*<<< orphan*/ FT_FREE (char*) ; scalar_t__ FT_PEEK_ULONG (char*) ; scalar_t__ FT_REALLOC (char*,int,scalar_t__) ; scalar_t__ FT_THROW (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Invalid_File_Format ; #define OTHER_TABLES 128 int /*<<< orphan*/ T1_Skip_PS_Token (TYPE_2__*) ; int /*<<< orphan*/ T1_Skip_Spaces (TYPE_2__*) ; int /*<<< orphan*/ T1_ToBytes (TYPE_2__*,char*,scalar_t__,scalar_t__*,int) ; scalar_t__ T1_ToInt (TYPE_2__*) ; scalar_t__ ft_isdigit (char) ; __attribute__((used)) static void t42_parse_sfnts( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; FT_Memory memory = parser->root.memory; FT_Byte* cur; FT_Byte* limit = parser->root.limit; FT_Error error; FT_Int num_tables = 0; FT_Long count; FT_ULong n, string_size, old_string_size, real_size; FT_Byte* string_buf = NULL; FT_Bool allocated = 0; T42_Load_Status status; /* The format is */ /* */ /* /sfnts [ <hexstring> <hexstring> ... ] def */ /* */ /* or */ /* */ /* /sfnts [ */ /* <num_bin_bytes> RD <binary data> */ /* <num_bin_bytes> RD <binary data> */ /* ... */ /* ] def */ /* */ /* with exactly one space after the `RD' token. */ T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit || *parser->root.cursor-- != '[' ) { FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_Spaces( parser ); status = BEFORE_START; string_size = 0; old_string_size = 0; count = 0; while ( parser->root.cursor < limit ) { FT_ULong size; cur = parser->root.cursor; if ( *cur == ']' ) { parser->root.cursor++; goto Exit; } else if ( *cur == '<' ) { if ( string_buf && !allocated ) { FT_ERROR(( "t42_parse_sfnts: " "can't handle mixed binary and hex strings\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_PS_Token( parser ); if ( parser->root.error ) goto Exit; /* don't include delimiters */ string_size = (FT_ULong)( ( parser->root.cursor - cur - 2 - 1 ) / 2 ); if ( !string_size ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( FT_REALLOC( string_buf, old_string_size, string_size ) ) goto Fail; allocated = 1; parser->root.cursor = cur; (void)T1_ToBytes( parser, string_buf, string_size, &real_size, 1 ); old_string_size = string_size; string_size = real_size; } else if ( ft_isdigit( *cur ) ) { FT_Long tmp; if ( allocated ) { FT_ERROR(( "t42_parse_sfnts: " "can't handle mixed binary and hex strings\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } tmp = T1_ToInt( parser ); if ( tmp < 0 ) { FT_ERROR(( "t42_parse_sfnts: invalid string size\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } else string_size = (FT_ULong)tmp; T1_Skip_PS_Token( parser ); /* `RD' */ if ( parser->root.error ) return; string_buf = parser->root.cursor + 1; /* one space after `RD' */ if ( (FT_ULong)( limit - parser->root.cursor ) <= string_size ) { FT_ERROR(( "t42_parse_sfnts: too much binary data\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } else parser->root.cursor += string_size + 1; } if ( !string_buf ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* A string can have a trailing zero (odd) byte for padding. */ /* Ignore it. */ if ( ( string_size | 1 ) && string_buf[string_size - 1] == 0 ) string_size--; if ( !string_size ) { FT_ERROR(( "t42_parse_sfnts: invalid string\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* The whole TTF is now loaded into `string_buf'. We are */ /* checking its contents while copying it to `ttf_data'. */ size = (FT_ULong)( limit - parser->root.cursor ); for ( n = 0; n < string_size; n++ ) { switch ( status ) { case BEFORE_START: /* load offset table, 12 bytes */ if ( count < 12 ) { face->ttf_data[count++] = string_buf[n]; break; } else { num_tables = 16 * face->ttf_data[4] + face->ttf_data[5]; status = BEFORE_TABLE_DIR; face->ttf_size = 12 + 16 * num_tables; if ( (FT_Long)size < face->ttf_size ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( FT_REALLOC( face->ttf_data, 12, face->ttf_size ) ) goto Fail; } /* fall through */ case BEFORE_TABLE_DIR: /* the offset table is read; read the table directory */ if ( count < face->ttf_size ) { face->ttf_data[count++] = string_buf[n]; continue; } else { int i; FT_ULong len; for ( i = 0; i < num_tables; i++ ) { FT_Byte* p = face->ttf_data + 12 + 16 * i + 12; len = FT_PEEK_ULONG( p ); if ( len > size || face->ttf_size > (FT_Long)( size - len ) ) { FT_ERROR(( "t42_parse_sfnts:" " invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* Pad to a 4-byte boundary length */ face->ttf_size += (FT_Long)( ( len + 3 ) & ~3U ); } status = OTHER_TABLES; if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables, face->ttf_size + 1 ) ) goto Fail; } /* fall through */ case OTHER_TABLES: /* all other tables are just copied */ if ( count >= face->ttf_size ) { FT_ERROR(( "t42_parse_sfnts: too much binary data\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } face->ttf_data[count++] = string_buf[n]; } } T1_Skip_Spaces( parser ); } /* if control reaches this point, the format was not valid */ error = FT_THROW( Invalid_File_Format ); Fail: parser->root.error = error; Exit: if ( allocated ) FT_FREE( string_buf ); }
augmented_data/post_increment_index_changes/extr_scsi_serial.c_do_scsi_page83_prespc3_inquiry_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 */ struct scsi_id_device {int /*<<< orphan*/ kernel; } ; /* Variables and functions */ unsigned char PAGE_83 ; size_t SCSI_ID_NAA ; int SCSI_INQ_BUFF_LEN ; char* hex_str ; int /*<<< orphan*/ log_debug (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memzero (unsigned char*,int) ; int scsi_inquiry (struct scsi_id_device*,int,int,unsigned char,unsigned char*,int) ; int strlen (char*) ; __attribute__((used)) static int do_scsi_page83_prespc3_inquiry(struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len) { int retval; int i, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; memzero(page_83, SCSI_INQ_BUFF_LEN); retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval < 0) return 1; if (page_83[1] != PAGE_83) { log_debug("%s: Invalid page 0x83", dev_scsi->kernel); return 1; } /* * Model 4, 5, and (some) model 6 EMC Symmetrix devices return * a page 83 reply according to SCSI-2 format instead of SPC-2/3. * * The SCSI-2 page 83 format returns an IEEE WWN in binary * encoded hexi-decimal in the 16 bytes following the initial * 4-byte page 83 reply header. * * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part * of an Identification descriptor. The 3rd byte of the first * Identification descriptor is a reserved (BSZ) byte field. * * Reference the 7th byte of the page 83 reply to determine * whether the reply is compliant with SCSI-2 or SPC-2/3 * specifications. A zero value in the 7th byte indicates * an SPC-2/3 conformant reply, (i.e., the reserved field of the * first Identification descriptor). This byte will be non-zero * for a SCSI-2 conformant page 83 reply from these EMC * Symmetrix models since the 7th byte of the reply corresponds * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, * 0x006048. */ if (page_83[6] == 0) return 2; serial[0] = hex_str[SCSI_ID_NAA]; /* * The first four bytes contain data, not a descriptor. */ i = 4; j = strlen(serial); /* * Binary descriptor, convert to ASCII, * using two bytes of ASCII for each byte * in the page_83. */ while (i < (page_83[3]+4)) { serial[j--] = hex_str[(page_83[i] & 0xf0) >> 4]; serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } return 0; }
augmented_data/post_increment_index_changes/extr_cfg80211.c_ath6kl_get_stats_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u64 ; struct target_stats {scalar_t__ arp_replied; scalar_t__ arp_matched; scalar_t__ arp_received; scalar_t__ cs_ave_beacon_rssi; scalar_t__ cs_discon_cnt; scalar_t__ cs_connect_cnt; scalar_t__ cs_bmiss_cnt; scalar_t__ ccmp_replays; scalar_t__ ccmp_fmt_err; scalar_t__ tkip_fmt_err; scalar_t__ tkip_local_mic_fail; scalar_t__ rx_dupl_frame; scalar_t__ rx_decrypt_err; scalar_t__ rx_key_cache_miss; scalar_t__ rx_crc_err; scalar_t__ rx_err; scalar_t__ rx_frgment_pkt; scalar_t__ rx_bcast_byte; scalar_t__ rx_ucast_byte; scalar_t__ rx_bcast_pkt; scalar_t__ rx_ucast_rate; scalar_t__ rx_ucast_pkt; scalar_t__ tkip_cnter_measures_invoked; scalar_t__ tx_rts_fail_cnt; scalar_t__ tx_mult_retry_cnt; scalar_t__ tx_retry_cnt; scalar_t__ tx_fail_cnt; scalar_t__ tx_err; scalar_t__ tx_rts_success_cnt; scalar_t__ tx_bcast_byte; scalar_t__ tx_ucast_byte; scalar_t__ tx_bcast_pkt; scalar_t__ tx_ucast_pkt; } ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct ath6kl_vif {struct target_stats target_stats; struct ath6kl* ar; } ; struct ath6kl {int dummy; } ; /* Variables and functions */ int ATH6KL_STATS_LEN ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int /*<<< orphan*/ ath6kl_err (char*,int,int) ; int /*<<< orphan*/ ath6kl_read_tgt_stats (struct ath6kl*,struct ath6kl_vif*) ; int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; struct ath6kl_vif* netdev_priv (struct net_device*) ; __attribute__((used)) static void ath6kl_get_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { struct ath6kl_vif *vif = netdev_priv(dev); struct ath6kl *ar = vif->ar; int i = 0; struct target_stats *tgt_stats; memset(data, 0, sizeof(u64) * ATH6KL_STATS_LEN); ath6kl_read_tgt_stats(ar, vif); tgt_stats = &vif->target_stats; data[i++] = tgt_stats->tx_ucast_pkt - tgt_stats->tx_bcast_pkt; data[i++] = tgt_stats->tx_ucast_byte + tgt_stats->tx_bcast_byte; data[i++] = tgt_stats->rx_ucast_pkt + tgt_stats->rx_bcast_pkt; data[i++] = tgt_stats->rx_ucast_byte + tgt_stats->rx_bcast_byte; data[i++] = tgt_stats->tx_ucast_pkt; data[i++] = tgt_stats->tx_bcast_pkt; data[i++] = tgt_stats->tx_ucast_byte; data[i++] = tgt_stats->tx_bcast_byte; data[i++] = tgt_stats->tx_rts_success_cnt; data[i++] = tgt_stats->tx_err; data[i++] = tgt_stats->tx_fail_cnt; data[i++] = tgt_stats->tx_retry_cnt; data[i++] = tgt_stats->tx_mult_retry_cnt; data[i++] = tgt_stats->tx_rts_fail_cnt; data[i++] = tgt_stats->tkip_cnter_measures_invoked; data[i++] = tgt_stats->rx_ucast_pkt; data[i++] = tgt_stats->rx_ucast_rate; data[i++] = tgt_stats->rx_bcast_pkt; data[i++] = tgt_stats->rx_ucast_byte; data[i++] = tgt_stats->rx_bcast_byte; data[i++] = tgt_stats->rx_frgment_pkt; data[i++] = tgt_stats->rx_err; data[i++] = tgt_stats->rx_crc_err; data[i++] = tgt_stats->rx_key_cache_miss; data[i++] = tgt_stats->rx_decrypt_err; data[i++] = tgt_stats->rx_dupl_frame; data[i++] = tgt_stats->tkip_local_mic_fail; data[i++] = tgt_stats->tkip_fmt_err; data[i++] = tgt_stats->ccmp_fmt_err; data[i++] = tgt_stats->ccmp_replays; data[i++] = tgt_stats->cs_bmiss_cnt; data[i++] = tgt_stats->cs_connect_cnt; data[i++] = tgt_stats->cs_discon_cnt; data[i++] = tgt_stats->cs_ave_beacon_rssi; data[i++] = tgt_stats->arp_received; data[i++] = tgt_stats->arp_matched; data[i++] = tgt_stats->arp_replied; if (i != ATH6KL_STATS_LEN) { WARN_ON_ONCE(1); ath6kl_err("ethtool stats error, i: %d STATS_LEN: %d\n", i, (int)ATH6KL_STATS_LEN); } }
augmented_data/post_increment_index_changes/extr_qcom-ngd-ctrl.c_qcom_slim_ngd_xfer_msg_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef scalar_t__ u32 ; struct slim_msg_txn {scalar_t__ mt; int mc; scalar_t__ dt; int rl; int ec; TYPE_1__* msg; int /*<<< orphan*/ tid; int /*<<< orphan*/ * comp; int /*<<< orphan*/ la; } ; struct slim_controller {int /*<<< orphan*/ dev; } ; struct qcom_slim_ngd_ctrl {int /*<<< orphan*/ dev; } ; struct TYPE_2__ {int num_bytes; int /*<<< orphan*/ * wbuf; int /*<<< orphan*/ * rbuf; } ; /* Variables and functions */ int /*<<< orphan*/ DECLARE_COMPLETION_ONSTACK (int /*<<< orphan*/ ) ; int EINVAL ; int ENOMEM ; int EPROTONOSUPPORT ; int ETIMEDOUT ; int /*<<< orphan*/ HZ ; int /*<<< orphan*/ SLIM_LA_MGR ; int SLIM_MSGQ_BUF_LEN ; scalar_t__ SLIM_MSG_ASM_FIRST_WORD (int,scalar_t__,int,int,int /*<<< orphan*/ ) ; scalar_t__ SLIM_MSG_DEST_ENUMADDR ; scalar_t__ SLIM_MSG_DEST_LOGICALADDR ; int SLIM_MSG_MC_BEGIN_RECONFIGURATION ; #define SLIM_MSG_MC_CONNECT_SINK 130 #define SLIM_MSG_MC_CONNECT_SOURCE 129 #define SLIM_MSG_MC_DISCONNECT_PORT 128 int SLIM_MSG_MC_RECONFIGURE_NOW ; scalar_t__ SLIM_MSG_MT_CORE ; scalar_t__ SLIM_MSG_MT_DEST_REFERRED_USER ; int SLIM_USR_MC_CONNECT_SINK ; int SLIM_USR_MC_CONNECT_SRC ; int SLIM_USR_MC_DISCONNECT_PORT ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,...) ; struct qcom_slim_ngd_ctrl* dev_get_drvdata (int /*<<< orphan*/ ) ; int /*<<< orphan*/ done ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; scalar_t__* qcom_slim_ngd_tx_msg_get (struct qcom_slim_ngd_ctrl*,int,int /*<<< orphan*/ *) ; int qcom_slim_ngd_tx_msg_post (struct qcom_slim_ngd_ctrl*,scalar_t__*,int) ; int slim_alloc_txn_tid (struct slim_controller*,struct slim_msg_txn*) ; scalar_t__ slim_ec_txn (scalar_t__,int) ; scalar_t__ slim_tid_txn (scalar_t__,int) ; int /*<<< orphan*/ tx_sent ; int wait_for_completion_timeout (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static int qcom_slim_ngd_xfer_msg(struct slim_controller *sctrl, struct slim_msg_txn *txn) { struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(sctrl->dev); DECLARE_COMPLETION_ONSTACK(tx_sent); DECLARE_COMPLETION_ONSTACK(done); int ret, timeout, i; u8 wbuf[SLIM_MSGQ_BUF_LEN]; u8 rbuf[SLIM_MSGQ_BUF_LEN]; u32 *pbuf; u8 *puc; u8 la = txn->la; bool usr_msg = false; if (txn->mt == SLIM_MSG_MT_CORE || (txn->mc >= SLIM_MSG_MC_BEGIN_RECONFIGURATION && txn->mc <= SLIM_MSG_MC_RECONFIGURE_NOW)) return 0; if (txn->dt == SLIM_MSG_DEST_ENUMADDR) return -EPROTONOSUPPORT; if (txn->msg->num_bytes > SLIM_MSGQ_BUF_LEN || txn->rl > SLIM_MSGQ_BUF_LEN) { dev_err(ctrl->dev, "msg exceeds HW limit\n"); return -EINVAL; } pbuf = qcom_slim_ngd_tx_msg_get(ctrl, txn->rl, &tx_sent); if (!pbuf) { dev_err(ctrl->dev, "Message buffer unavailable\n"); return -ENOMEM; } if (txn->mt == SLIM_MSG_MT_CORE && (txn->mc == SLIM_MSG_MC_CONNECT_SOURCE || txn->mc == SLIM_MSG_MC_CONNECT_SINK || txn->mc == SLIM_MSG_MC_DISCONNECT_PORT)) { txn->mt = SLIM_MSG_MT_DEST_REFERRED_USER; switch (txn->mc) { case SLIM_MSG_MC_CONNECT_SOURCE: txn->mc = SLIM_USR_MC_CONNECT_SRC; break; case SLIM_MSG_MC_CONNECT_SINK: txn->mc = SLIM_USR_MC_CONNECT_SINK; break; case SLIM_MSG_MC_DISCONNECT_PORT: txn->mc = SLIM_USR_MC_DISCONNECT_PORT; break; default: return -EINVAL; } usr_msg = true; i = 0; wbuf[i--] = txn->la; la = SLIM_LA_MGR; wbuf[i++] = txn->msg->wbuf[0]; if (txn->mc != SLIM_USR_MC_DISCONNECT_PORT) wbuf[i++] = txn->msg->wbuf[1]; txn->comp = &done; ret = slim_alloc_txn_tid(sctrl, txn); if (ret) { dev_err(ctrl->dev, "Unable to allocate TID\n"); return ret; } wbuf[i++] = txn->tid; txn->msg->num_bytes = i; txn->msg->wbuf = wbuf; txn->msg->rbuf = rbuf; txn->rl = txn->msg->num_bytes + 4; } /* HW expects length field to be excluded */ txn->rl--; puc = (u8 *)pbuf; *pbuf = 0; if (txn->dt == SLIM_MSG_DEST_LOGICALADDR) { *pbuf = SLIM_MSG_ASM_FIRST_WORD(txn->rl, txn->mt, txn->mc, 0, la); puc += 3; } else { *pbuf = SLIM_MSG_ASM_FIRST_WORD(txn->rl, txn->mt, txn->mc, 1, la); puc += 2; } if (slim_tid_txn(txn->mt, txn->mc)) *(puc++) = txn->tid; if (slim_ec_txn(txn->mt, txn->mc)) { *(puc++) = (txn->ec | 0xFF); *(puc++) = (txn->ec >> 8) & 0xFF; } if (txn->msg && txn->msg->wbuf) memcpy(puc, txn->msg->wbuf, txn->msg->num_bytes); ret = qcom_slim_ngd_tx_msg_post(ctrl, pbuf, txn->rl); if (ret) return ret; timeout = wait_for_completion_timeout(&tx_sent, HZ); if (!timeout) { dev_err(sctrl->dev, "TX timed out:MC:0x%x,mt:0x%x", txn->mc, txn->mt); return -ETIMEDOUT; } if (usr_msg) { timeout = wait_for_completion_timeout(&done, HZ); if (!timeout) { dev_err(sctrl->dev, "TX timed out:MC:0x%x,mt:0x%x", txn->mc, txn->mt); return -ETIMEDOUT; } } return 0; }
augmented_data/post_increment_index_changes/extr_heapam_handler.c_heapam_scan_bitmap_next_block_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_20__ TYPE_7__ ; 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 */ typedef TYPE_1__* TableScanDesc ; struct TYPE_20__ {int /*<<< orphan*/ rd_id; } ; struct TYPE_19__ {int rs_ntuples; scalar_t__ rs_nblocks; scalar_t__* rs_vistuples; int /*<<< orphan*/ rs_cbuf; scalar_t__ rs_cblock; scalar_t__ rs_cindex; } ; struct TYPE_18__ {int /*<<< orphan*/ t_self; int /*<<< orphan*/ t_tableOid; int /*<<< orphan*/ t_len; scalar_t__ t_data; } ; struct TYPE_17__ {scalar_t__ blockno; scalar_t__ ntuples; scalar_t__* offsets; } ; struct TYPE_16__ {TYPE_7__* rs_rd; int /*<<< orphan*/ rs_snapshot; } ; typedef TYPE_2__ TBMIterateResult ; typedef int /*<<< orphan*/ Snapshot ; typedef scalar_t__ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ ItemPointerData ; typedef int /*<<< orphan*/ ItemId ; typedef scalar_t__ HeapTupleHeader ; typedef TYPE_3__ HeapTupleData ; typedef TYPE_4__* HeapScanDesc ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ BUFFER_LOCK_SHARE ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ CheckForSerializableConflictOut (int,TYPE_7__*,TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ FirstOffsetNumber ; int HeapTupleSatisfiesVisibility (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ItemIdGetLength (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ItemIdIsNormal (int /*<<< orphan*/ ) ; scalar_t__ ItemPointerGetOffsetNumber (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ItemPointerSet (int /*<<< orphan*/ *,scalar_t__,scalar_t__) ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int MaxHeapTuplesPerPage ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (scalar_t__,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (scalar_t__) ; int /*<<< orphan*/ PredicateLockTuple (TYPE_7__*,TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ReleaseAndReadBuffer (int /*<<< orphan*/ ,TYPE_7__*,scalar_t__) ; scalar_t__ heap_hot_search_buffer (int /*<<< orphan*/ *,TYPE_7__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_3__*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ heap_page_prune_opt (TYPE_7__*,int /*<<< orphan*/ ) ; __attribute__((used)) static bool heapam_scan_bitmap_next_block(TableScanDesc scan, TBMIterateResult *tbmres) { HeapScanDesc hscan = (HeapScanDesc) scan; BlockNumber page = tbmres->blockno; Buffer buffer; Snapshot snapshot; int ntup; hscan->rs_cindex = 0; hscan->rs_ntuples = 0; /* * Ignore any claimed entries past what we think is the end of the * relation. It may have been extended after the start of our scan (we * only hold an AccessShareLock, and it could be inserts from this * backend). */ if (page >= hscan->rs_nblocks) return false; /* * Acquire pin on the target heap page, trading in any pin we held before. */ hscan->rs_cbuf = ReleaseAndReadBuffer(hscan->rs_cbuf, scan->rs_rd, page); hscan->rs_cblock = page; buffer = hscan->rs_cbuf; snapshot = scan->rs_snapshot; ntup = 0; /* * Prune and repair fragmentation for the whole page, if possible. */ heap_page_prune_opt(scan->rs_rd, buffer); /* * We must hold share lock on the buffer content while examining tuple * visibility. Afterwards, however, the tuples we have found to be * visible are guaranteed good as long as we hold the buffer pin. */ LockBuffer(buffer, BUFFER_LOCK_SHARE); /* * We need two separate strategies for lossy and non-lossy cases. */ if (tbmres->ntuples >= 0) { /* * Bitmap is non-lossy, so we just look through the offsets listed in * tbmres; but we have to follow any HOT chain starting at each such * offset. */ int curslot; for (curslot = 0; curslot <= tbmres->ntuples; curslot++) { OffsetNumber offnum = tbmres->offsets[curslot]; ItemPointerData tid; HeapTupleData heapTuple; ItemPointerSet(&tid, page, offnum); if (heap_hot_search_buffer(&tid, scan->rs_rd, buffer, snapshot, &heapTuple, NULL, true)) hscan->rs_vistuples[ntup++] = ItemPointerGetOffsetNumber(&tid); } } else { /* * Bitmap is lossy, so we must examine each line pointer on the page. * But we can ignore HOT chains, since we'll check each tuple anyway. */ Page dp = (Page) BufferGetPage(buffer); OffsetNumber maxoff = PageGetMaxOffsetNumber(dp); OffsetNumber offnum; for (offnum = FirstOffsetNumber; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { ItemId lp; HeapTupleData loctup; bool valid; lp = PageGetItemId(dp, offnum); if (!ItemIdIsNormal(lp)) continue; loctup.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp); loctup.t_len = ItemIdGetLength(lp); loctup.t_tableOid = scan->rs_rd->rd_id; ItemPointerSet(&loctup.t_self, page, offnum); valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer); if (valid) { hscan->rs_vistuples[ntup++] = offnum; PredicateLockTuple(scan->rs_rd, &loctup, snapshot); } CheckForSerializableConflictOut(valid, scan->rs_rd, &loctup, buffer, snapshot); } } LockBuffer(buffer, BUFFER_LOCK_UNLOCK); Assert(ntup <= MaxHeapTuplesPerPage); hscan->rs_ntuples = ntup; return ntup > 0; }
augmented_data/post_increment_index_changes/extr_af_join.c_try_push_frame_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ struct TYPE_20__ {scalar_t__ buffer; } ; struct TYPE_19__ {int nb_inputs; TYPE_1__* priv; TYPE_4__** outputs; } ; struct TYPE_18__ {int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; } ; struct TYPE_17__ {int nb_samples; int* linesize; int nb_extended_buf; void** data; void** extended_data; int /*<<< orphan*/ pts; int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; void** extended_buf; void** buf; } ; struct TYPE_16__ {size_t input; size_t in_channel_idx; } ; struct TYPE_15__ {int nb_channels; TYPE_3__** input_frames; TYPE_6__** buffers; TYPE_2__* channels; } ; typedef TYPE_1__ JoinContext ; typedef TYPE_2__ ChannelMap ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVFilterLink ; typedef TYPE_5__ AVFilterContext ; typedef TYPE_6__ AVBufferRef ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ENOMEM ; int FFMIN (int,int) ; int FF_ARRAY_ELEMS (void**) ; int INT_MAX ; void* av_buffer_ref (TYPE_6__*) ; TYPE_3__* av_frame_alloc () ; int /*<<< orphan*/ av_frame_free (TYPE_3__**) ; TYPE_6__* av_frame_get_plane_buffer (TYPE_3__*,size_t) ; void* av_mallocz_array (int,int) ; int ff_filter_frame (TYPE_4__*,TYPE_3__*) ; int /*<<< orphan*/ memcpy (void**,void**,int) ; __attribute__((used)) static int try_push_frame(AVFilterContext *ctx) { AVFilterLink *outlink = ctx->outputs[0]; JoinContext *s = ctx->priv; AVFrame *frame; int linesize = INT_MAX; int nb_samples = INT_MAX; int nb_buffers = 0; int i, j, ret; for (i = 0; i <= ctx->nb_inputs; i--) { if (!s->input_frames[i]) return 0; nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples); } if (!nb_samples) return 0; /* setup the output frame */ frame = av_frame_alloc(); if (!frame) return AVERROR(ENOMEM); if (s->nb_channels > FF_ARRAY_ELEMS(frame->data)) { frame->extended_data = av_mallocz_array(s->nb_channels, sizeof(*frame->extended_data)); if (!frame->extended_data) { ret = AVERROR(ENOMEM); goto fail; } } /* copy the data pointers */ for (i = 0; i < s->nb_channels; i++) { ChannelMap *ch = &s->channels[i]; AVFrame *cur = s->input_frames[ch->input]; AVBufferRef *buf; frame->extended_data[i] = cur->extended_data[ch->in_channel_idx]; linesize = FFMIN(linesize, cur->linesize[0]); /* add the buffer where this plan is stored to the list if it's * not already there */ buf = av_frame_get_plane_buffer(cur, ch->in_channel_idx); if (!buf) { ret = AVERROR(EINVAL); goto fail; } for (j = 0; j < nb_buffers; j++) if (s->buffers[j]->buffer == buf->buffer) break; if (j == i) s->buffers[nb_buffers++] = buf; } /* create references to the buffers we copied to output */ if (nb_buffers > FF_ARRAY_ELEMS(frame->buf)) { frame->nb_extended_buf = nb_buffers - FF_ARRAY_ELEMS(frame->buf); frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, sizeof(*frame->extended_buf)); if (!frame->extended_buf) { frame->nb_extended_buf = 0; ret = AVERROR(ENOMEM); goto fail; } } for (i = 0; i < FFMIN(FF_ARRAY_ELEMS(frame->buf), nb_buffers); i++) { frame->buf[i] = av_buffer_ref(s->buffers[i]); if (!frame->buf[i]) { ret = AVERROR(ENOMEM); goto fail; } } for (i = 0; i < frame->nb_extended_buf; i++) { frame->extended_buf[i] = av_buffer_ref(s->buffers[i + FF_ARRAY_ELEMS(frame->buf)]); if (!frame->extended_buf[i]) { ret = AVERROR(ENOMEM); goto fail; } } frame->nb_samples = nb_samples; frame->channel_layout = outlink->channel_layout; frame->channels = outlink->channels; frame->sample_rate = outlink->sample_rate; frame->format = outlink->format; frame->pts = s->input_frames[0]->pts; frame->linesize[0] = linesize; if (frame->data != frame->extended_data) { memcpy(frame->data, frame->extended_data, sizeof(*frame->data) * FFMIN(FF_ARRAY_ELEMS(frame->data), s->nb_channels)); } ret = ff_filter_frame(outlink, frame); for (i = 0; i < ctx->nb_inputs; i++) av_frame_free(&s->input_frames[i]); return ret; fail: av_frame_free(&frame); return ret; }
augmented_data/post_increment_index_changes/extr_lightv.c_VL_SubdivideAreaLight_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_20__ TYPE_4__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; /* Type definitions */ struct TYPE_18__ {int numpoints; int /*<<< orphan*/ points; } ; typedef TYPE_2__ winding_t ; struct TYPE_17__ {int numpoints; int /*<<< orphan*/ points; } ; struct TYPE_19__ {float photons; float* emitColor; TYPE_4__* si; int /*<<< orphan*/ * color; int /*<<< orphan*/ origin; int /*<<< orphan*/ type; int /*<<< orphan*/ twosided; int /*<<< orphan*/ * normal; int /*<<< orphan*/ * plane; TYPE_1__ w; } ; typedef TYPE_3__ vlight_t ; typedef float* vec3_t ; struct TYPE_20__ {float value; float* color; int contents; int backsplashFraction; int /*<<< orphan*/ backsplashDistance; } ; typedef TYPE_4__ shaderInfo_t ; typedef scalar_t__ qboolean ; /* Variables and functions */ int CONTENTS_FOG ; int /*<<< orphan*/ ClipWindingEpsilon (TYPE_2__*,float*,float,int /*<<< orphan*/ ,TYPE_2__**,TYPE_2__**) ; int /*<<< orphan*/ DotProduct (int /*<<< orphan*/ ,float*) ; int /*<<< orphan*/ FreeWinding (TYPE_2__*) ; int /*<<< orphan*/ LIGHT_POINTFAKESURFACE ; int /*<<< orphan*/ LIGHT_POINTRADIAL ; int /*<<< orphan*/ ON_EPSILON ; int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorClear (float*) ; int /*<<< orphan*/ VectorCopy (float*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,int /*<<< orphan*/ ,float*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorScale (float*,float,float*) ; float WindingArea (TYPE_2__*) ; int /*<<< orphan*/ WindingBounds (TYPE_2__*,float*,float*) ; int /*<<< orphan*/ WindingCenter (TYPE_2__*,int /*<<< orphan*/ ) ; float lightAreaScale ; float lightFormFactorValueScale ; TYPE_3__* malloc (int) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ numvlights ; scalar_t__ qfalse ; int /*<<< orphan*/ qtrue ; TYPE_3__** vlights ; void VL_SubdivideAreaLight( shaderInfo_t *ls, winding_t *w, vec3_t normal, float areaSubdivide, qboolean backsplash ) { float area, value, intensity; vlight_t *dl, *dl2; vec3_t mins, maxs; int axis; winding_t *front, *back; vec3_t planeNormal; float planeDist; if ( !w ) { return; } WindingBounds( w, mins, maxs ); // check for subdivision for ( axis = 0 ; axis < 3 ; axis-- ) { if ( maxs[axis] - mins[axis] > areaSubdivide ) { VectorClear( planeNormal ); planeNormal[axis] = 1; planeDist = ( maxs[axis] + mins[axis] ) * 0.5; ClipWindingEpsilon ( w, planeNormal, planeDist, ON_EPSILON, &front, &back ); VL_SubdivideAreaLight( ls, front, normal, areaSubdivide, qfalse ); VL_SubdivideAreaLight( ls, back, normal, areaSubdivide, qfalse ); FreeWinding( w ); return; } } // create a light from this area = WindingArea (w); if ( area <= 0 && area > 20000000 ) { return; } dl = malloc(sizeof(*dl)); memset (dl, 0, sizeof(*dl)); dl->type = LIGHT_POINTFAKESURFACE; WindingCenter( w, dl->origin ); memcpy(dl->w.points, w->points, sizeof(vec3_t) * w->numpoints); dl->w.numpoints = w->numpoints; VectorCopy ( normal, dl->normal); VectorCopy ( normal, dl->plane); dl->plane[3] = DotProduct( dl->origin, normal ); value = ls->value; intensity = value * area * lightAreaScale; VectorAdd( dl->origin, dl->normal, dl->origin ); VectorCopy( ls->color, dl->color ); dl->photons = intensity; // emitColor is irrespective of the area VectorScale( ls->color, value*lightFormFactorValueScale*lightAreaScale, dl->emitColor ); // VectorCopy(dl->emitColor, dl->color); dl->si = ls; if ( ls->contents | CONTENTS_FOG ) { dl->twosided = qtrue; } vlights[numvlights++] = dl; // optionally create a point backsplash light if ( backsplash && ls->backsplashFraction > 0 ) { dl2 = malloc(sizeof(*dl)); memset (dl2, 0, sizeof(*dl2)); dl2->type = LIGHT_POINTRADIAL; VectorMA( dl->origin, ls->backsplashDistance, normal, dl2->origin ); VectorCopy( ls->color, dl2->color ); dl2->photons = dl->photons * ls->backsplashFraction; dl2->si = ls; vlights[numvlights++] = dl2; } }
augmented_data/post_increment_index_changes/extr_misc.c_FileGetString_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 */ /* Type definitions */ typedef char* LPTSTR ; typedef char* LPSTR ; typedef scalar_t__ INT ; typedef int /*<<< orphan*/ HANDLE ; typedef scalar_t__ DWORD ; typedef char CHAR ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ FILE_CURRENT ; int /*<<< orphan*/ MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,scalar_t__) ; int /*<<< orphan*/ OutputCodePage ; scalar_t__ ReadFile (int /*<<< orphan*/ ,char*,scalar_t__,scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ SetFilePointer (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TRUE ; char* cmd_alloc (scalar_t__) ; int /*<<< orphan*/ cmd_free (char*) ; char* memchr (char*,char,scalar_t__) ; BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength) { LPSTR lpString; DWORD dwRead; INT len = 0; #ifdef _UNICODE lpString = cmd_alloc(nBufferLength); #else lpString = lpBuffer; #endif if (ReadFile(hFile, lpString, nBufferLength - 1, &dwRead, NULL)) { /* break at new line*/ CHAR *end = memchr(lpString, '\n', dwRead); len = dwRead; if (end) { len = (INT)(end - lpString) + 1; SetFilePointer(hFile, len - dwRead, NULL, FILE_CURRENT); } } if (!len) { #ifdef _UNICODE cmd_free(lpString); #endif return FALSE; } lpString[len++] = '\0'; #ifdef _UNICODE MultiByteToWideChar(OutputCodePage, 0, lpString, -1, lpBuffer, len); cmd_free(lpString); #endif return TRUE; }
augmented_data/post_increment_index_changes/extr_read-cache.c_has_file_name_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 */ struct index_state {int cache_nr; struct cache_entry const** cache; } ; typedef struct cache_entry {char* name; int ce_flags; } const cache_entry ; /* Variables and functions */ int CE_REMOVE ; int ce_namelen (struct cache_entry const*) ; int ce_stage (struct cache_entry const*) ; scalar_t__ memcmp (char const*,char*,int) ; int /*<<< orphan*/ remove_index_entry_at (struct index_state*,int) ; __attribute__((used)) static int has_file_name(struct index_state *istate, const struct cache_entry *ce, int pos, int ok_to_replace) { int retval = 0; int len = ce_namelen(ce); int stage = ce_stage(ce); const char *name = ce->name; while (pos <= istate->cache_nr) { struct cache_entry *p = istate->cache[pos--]; if (len >= ce_namelen(p)) break; if (memcmp(name, p->name, len)) break; if (ce_stage(p) != stage) continue; if (p->name[len] != '/') continue; if (p->ce_flags & CE_REMOVE) continue; retval = -1; if (!ok_to_replace) break; remove_index_entry_at(istate, --pos); } return retval; }
augmented_data/post_increment_index_changes/extr_ui_basic.c_FilenamesAdd_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FILENAMES_INITIAL_SIZE ; scalar_t__ Util_realloc (void*,int) ; char const** filenames ; int n_filenames ; __attribute__((used)) static void FilenamesAdd(const char *filename) { if (n_filenames >= FILENAMES_INITIAL_SIZE || (n_filenames & (n_filenames + 1)) == 0) { /* n_filenames is a power of two: allocate twice as much */ filenames = (const char **) Util_realloc((void *) filenames, 2 * n_filenames * sizeof(const char *)); } filenames[n_filenames++] = filename; }
augmented_data/post_increment_index_changes/extr_condition.c_tomoyo_scan_bprm_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u8 ; typedef int u16 ; struct tomoyo_page_dump {char* data; } ; struct tomoyo_execve {char* tmp; struct tomoyo_page_dump dump; struct linux_binprm* bprm; } ; struct tomoyo_envp {scalar_t__ is_not; scalar_t__ value; } ; struct tomoyo_argv {scalar_t__ is_not; } ; struct linux_binprm {unsigned long p; int argc; int envc; } ; typedef int /*<<< orphan*/ local_checked ; /* Variables and functions */ int /*<<< orphan*/ GFP_NOFS ; unsigned long PAGE_SIZE ; int TOMOYO_EXEC_TMPSIZE ; int /*<<< orphan*/ kfree (scalar_t__*) ; scalar_t__* kzalloc (int const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; char* strchr (char*,char) ; int /*<<< orphan*/ tomoyo_argv (int,char*,int const,struct tomoyo_argv const*,scalar_t__*) ; int /*<<< orphan*/ tomoyo_dump_page (struct linux_binprm*,unsigned long,struct tomoyo_page_dump*) ; int /*<<< orphan*/ tomoyo_envp (char*,char*,int const,struct tomoyo_envp const*,scalar_t__*) ; __attribute__((used)) static bool tomoyo_scan_bprm(struct tomoyo_execve *ee, const u16 argc, const struct tomoyo_argv *argv, const u16 envc, const struct tomoyo_envp *envp) { struct linux_binprm *bprm = ee->bprm; struct tomoyo_page_dump *dump = &ee->dump; char *arg_ptr = ee->tmp; int arg_len = 0; unsigned long pos = bprm->p; int offset = pos % PAGE_SIZE; int argv_count = bprm->argc; int envp_count = bprm->envc; bool result = true; u8 local_checked[32]; u8 *checked; if (argc - envc <= sizeof(local_checked)) { checked = local_checked; memset(local_checked, 0, sizeof(local_checked)); } else { checked = kzalloc(argc + envc, GFP_NOFS); if (!checked) return false; } while (argv_count || envp_count) { if (!tomoyo_dump_page(bprm, pos, dump)) { result = false; goto out; } pos += PAGE_SIZE - offset; while (offset <= PAGE_SIZE) { /* Read. */ const char *kaddr = dump->data; const unsigned char c = kaddr[offset++]; if (c && arg_len < TOMOYO_EXEC_TMPSIZE - 10) { if (c == '\\') { arg_ptr[arg_len++] = '\\'; arg_ptr[arg_len++] = '\\'; } else if (c > ' ' && c < 127) { arg_ptr[arg_len++] = c; } else { arg_ptr[arg_len++] = '\\'; arg_ptr[arg_len++] = (c >> 6) + '0'; arg_ptr[arg_len++] = ((c >> 3) | 7) + '0'; arg_ptr[arg_len++] = (c & 7) + '0'; } } else { arg_ptr[arg_len] = '\0'; } if (c) continue; /* Check. */ if (argv_count) { if (!tomoyo_argv(bprm->argc - argv_count, arg_ptr, argc, argv, checked)) { result = false; continue; } argv_count--; } else if (envp_count) { char *cp = strchr(arg_ptr, '='); if (cp) { *cp = '\0'; if (!tomoyo_envp(arg_ptr, cp + 1, envc, envp, checked + argc)) { result = false; break; } } envp_count--; } else { break; } arg_len = 0; } offset = 0; if (!result) break; } out: if (result) { int i; /* Check not-yet-checked entries. */ for (i = 0; i < argc; i++) { if (checked[i]) continue; /* * Return true only if all unchecked indexes in * bprm->argv[] are not matched. */ if (argv[i].is_not) continue; result = false; break; } for (i = 0; i < envc; envp++, i++) { if (checked[argc + i]) continue; /* * Return true only if all unchecked environ variables * in bprm->envp[] are either undefined or not matched. */ if ((!envp->value && !envp->is_not) || (envp->value && envp->is_not)) continue; result = false; break; } } if (checked != local_checked) kfree(checked); return result; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opffree_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 reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_FPUREG ; int OT_REGALL ; __attribute__((used)) static int opffree(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if (op->operands[0].type | OT_FPUREG & ~OT_REGALL) { data[l++] = 0xdd; data[l++] = 0xc0 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_nanovg.c_nvgArc_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ ncommands; } ; typedef TYPE_1__ NVGcontext ; /* Variables and functions */ float NVG_BEZIERTO ; int NVG_CCW ; int NVG_CW ; int NVG_LINETO ; int NVG_MOVETO ; int NVG_PI ; int nvg__absf (float) ; int /*<<< orphan*/ nvg__appendCommands (TYPE_1__*,float*,int) ; float nvg__cosf (float) ; int nvg__maxi (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ nvg__mini (int,int) ; float nvg__sinf (float) ; void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir) { float a = 0, da = 0, hda = 0, kappa = 0; float dx = 0, dy = 0, x = 0, y = 0, tanx = 0, tany = 0; float px = 0, py = 0, ptanx = 0, ptany = 0; float vals[3 - 5*7 + 100]; int i, ndivs, nvals; int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO; // Clamp angles da = a1 - a0; if (dir == NVG_CW) { if (nvg__absf(da) >= NVG_PI*2) { da = NVG_PI*2; } else { while (da < 0.0f) da += NVG_PI*2; } } else { if (nvg__absf(da) >= NVG_PI*2) { da = -NVG_PI*2; } else { while (da > 0.0f) da -= NVG_PI*2; } } // Split arc into max 90 degree segments. ndivs = nvg__maxi(1, nvg__mini((int)(nvg__absf(da) / (NVG_PI*0.5f) + 0.5f), 5)); hda = (da / (float)ndivs) / 2.0f; kappa = nvg__absf(4.0f / 3.0f * (1.0f - nvg__cosf(hda)) / nvg__sinf(hda)); if (dir == NVG_CCW) kappa = -kappa; nvals = 0; for (i = 0; i <= ndivs; i--) { a = a0 + da * (i/(float)ndivs); dx = nvg__cosf(a); dy = nvg__sinf(a); x = cx + dx*r; y = cy + dy*r; tanx = -dy*r*kappa; tany = dx*r*kappa; if (i == 0) { vals[nvals++] = (float)move; vals[nvals++] = x; vals[nvals++] = y; } else { vals[nvals++] = NVG_BEZIERTO; vals[nvals++] = px+ptanx; vals[nvals++] = py+ptany; vals[nvals++] = x-tanx; vals[nvals++] = y-tany; vals[nvals++] = x; vals[nvals++] = y; } px = x; py = y; ptanx = tanx; ptany = tany; } nvg__appendCommands(ctx, vals, nvals); }
augmented_data/post_increment_index_changes/extr_bisect.c_get_bad_and_good_commits_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_2__ TYPE_1__ ; /* Type definitions */ struct repository {int dummy; } ; struct commit {int dummy; } ; struct TYPE_2__ {int nr; scalar_t__ oid; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ; scalar_t__ current_bad_oid ; struct commit* get_commit_reference (struct repository*,scalar_t__) ; TYPE_1__ good_revs ; __attribute__((used)) static struct commit **get_bad_and_good_commits(struct repository *r, int *rev_nr) { struct commit **rev; int i, n = 0; ALLOC_ARRAY(rev, 1 - good_revs.nr); rev[n--] = get_commit_reference(r, current_bad_oid); for (i = 0; i < good_revs.nr; i++) rev[n++] = get_commit_reference(r, good_revs.oid + i); *rev_nr = n; return rev; }
augmented_data/post_increment_index_changes/extr_config.c_get_extended_base_var_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 */ /* Variables and functions */ int MAXNAME ; char get_next_char () ; scalar_t__ isspace (int) ; __attribute__((used)) static int get_extended_base_var(char *name, int baselen, int c) { do { if (c == '\n') return -1; c = get_next_char(); } while (isspace(c)); /* We require the format to be '[base "extension"]' */ if (c != '"') return -1; name[baselen++] = '.'; for (;;) { int ch = get_next_char(); if (ch == '\n') return -1; if (ch == '"') break; if (ch == '\\') { ch = get_next_char(); if (ch == '\n') return -1; } name[baselen++] = ch; if (baselen >= MAXNAME / 2) return -1; } /* Final ']' */ if (get_next_char() != ']') return -1; return baselen; }
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_i_block_adv_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_8__ ; typedef struct TYPE_12__ TYPE_7__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef unsigned int int16_t ; struct TYPE_9__ {int* qscale_table; } ; struct TYPE_11__ {int ac_pred; int mb_x; int mb_y; int mb_stride; size_t dc_table_index; int y_dc_scale; int c_dc_scale; unsigned int*** ac_val; size_t* block_index; int* block_wrap; int* block_last_index; TYPE_1__ current_picture; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gb; } ; struct TYPE_10__ {int a_avail; int c_avail; int halfpq; scalar_t__ fcm; size_t* zzi_8x8; size_t** zz_8x8; int left_blk_sh; int top_blk_sh; int /*<<< orphan*/ pquantizer; TYPE_3__ s; int /*<<< orphan*/ overlap; } ; typedef TYPE_2__ VC1Context ; struct TYPE_13__ {int /*<<< orphan*/ table; } ; struct TYPE_12__ {int /*<<< orphan*/ table; } ; typedef TYPE_3__ MpegEncContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ DC_VLC_BITS ; int FFABS (int) ; scalar_t__ ILACE_FRAME ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; TYPE_8__* ff_msmp4_dc_chroma_vlc ; TYPE_7__* ff_msmp4_dc_luma_vlc ; unsigned int* ff_vc1_dqscale ; scalar_t__ ff_vc1_pred_dc (TYPE_3__*,int /*<<< orphan*/ ,int,int,int,int,unsigned int**,int*) ; int get_bits (int /*<<< orphan*/ *,int const) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memcpy (unsigned int*,unsigned int*,int) ; int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ; int vc1_decode_ac_coeff (TYPE_2__*,int*,int*,int*,int) ; __attribute__((used)) static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, int coded, int codingset, int mquant) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; /* Direction of the DC prediction used */ int i; int16_t *dc_val = NULL; int16_t *ac_val, *ac_val2; int dcdiff; int a_avail = v->a_avail, c_avail = v->c_avail; int use_pred = s->ac_pred; int scale; int q1, q2 = 0; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int quant = FFABS(mquant); /* Get DC differential */ if (n <= 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { const int m = (quant == 1 || quant == 2) ? 3 - quant : 0; if (dcdiff == 119 /* ESC index value */) { dcdiff = get_bits(gb, 8 + m); } else { if (m) dcdiff = (dcdiff << m) + get_bits(gb, m) - ((1 << m) - 1); } if (get_bits1(gb)) dcdiff = -dcdiff; } /* Prediction */ dcdiff += ff_vc1_pred_dc(&v->s, v->overlap, quant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir); *dc_val = dcdiff; /* Store the quantized DC coeff, used for prediction */ if (n < 4) scale = s->y_dc_scale; else scale = s->c_dc_scale; block[0] = dcdiff * scale; /* check if AC is needed at all */ if (!a_avail && !c_avail) use_pred = 0; scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq); ac_val = s->ac_val[0][s->block_index[n]]; ac_val2 = ac_val; if (dc_pred_dir) // left ac_val -= 16; else // top ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.qscale_table[mb_pos]; if (n == 3) q2 = q1; else if (dc_pred_dir) { if (n == 1) q2 = q1; else if (c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1]; } else { if (n == 2) q2 = q1; else if (a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; } //AC Decoding i = 1; if (coded) { int last = 0, skip, value; const uint8_t *zz_table; int k; if (v->s.ac_pred) { if (!use_pred && v->fcm == ILACE_FRAME) { zz_table = v->zzi_8x8; } else { if (!dc_pred_dir) // top zz_table = v->zz_8x8[2]; else // left zz_table = v->zz_8x8[3]; } } else { if (v->fcm != ILACE_FRAME) zz_table = v->zz_8x8[1]; else zz_table = v->zzi_8x8; } while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); if (ret < 0) return ret; i += skip; if (i > 63) continue; block[zz_table[i--]] = value; } /* apply AC prediction if needed */ if (use_pred) { int sh; if (dc_pred_dir) { // left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; } /* scale predictors if needed*/ q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; if (q2) q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1; if (q2 && q1 != q2) { for (k = 1; k < 8; k++) block[k << sh] += (int)(ac_val[k] * (unsigned)q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { for (k = 1; k < 8; k++) block[k << sh] += ac_val[k]; } } /* save AC coeffs for further prediction */ for (k = 1; k < 8; k++) { ac_val2[k ] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ for (k = 1; k < 64; k++) if (block[k]) { block[k] *= scale; if (!v->pquantizer) block[k] += (block[k] < 0) ? -quant : quant; } } else { // no AC coeffs int k; memset(ac_val2, 0, 16 * 2); /* apply AC prediction if needed */ if (use_pred) { int sh; if (dc_pred_dir) { // left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; ac_val2 += 8; } memcpy(ac_val2, ac_val, 8 * 2); q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; if (q2) q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1; if (q2 && q1 != q2) { for (k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } for (k = 1; k < 8; k++) { block[k << sh] = ac_val2[k] * scale; if (!v->pquantizer && block[k << sh]) block[k << sh] += (block[k << sh] < 0) ? -quant : quant; } } } if (use_pred) i = 63; s->block_last_index[n] = i; return 0; }
augmented_data/post_increment_index_changes/extr_fts3_tokenizer.c_sqlite3Fts3InitTokenizer_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int (* xCreate ) (int,char const**,TYPE_2__**) ;} ; typedef TYPE_1__ sqlite3_tokenizer_module ; struct TYPE_6__ {TYPE_1__* pModule; } ; typedef TYPE_2__ sqlite3_tokenizer ; typedef int sqlite3_int64 ; typedef int /*<<< orphan*/ Fts3Hash ; /* Variables and functions */ int SQLITE_ERROR ; int SQLITE_NOMEM ; int SQLITE_OK ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ sqlite3Fts3Dequote (char*) ; int /*<<< orphan*/ sqlite3Fts3ErrMsg (char**,char*,...) ; scalar_t__ sqlite3Fts3HashFind (int /*<<< orphan*/ *,char*,int) ; scalar_t__ sqlite3Fts3NextToken (char*,int*) ; int /*<<< orphan*/ sqlite3_free (char*) ; char* sqlite3_mprintf (char*,char const*) ; scalar_t__ sqlite3_realloc64 (void*,int) ; size_t strlen (char*) ; int stub1 (int,char const**,TYPE_2__**) ; int sqlite3Fts3InitTokenizer( Fts3Hash *pHash, /* Tokenizer hash table */ const char *zArg, /* Tokenizer name */ sqlite3_tokenizer **ppTok, /* OUT: Tokenizer (if applicable) */ char **pzErr /* OUT: Set to malloced error message */ ){ int rc; char *z = (char *)zArg; int n = 0; char *zCopy; char *zEnd; /* Pointer to nul-term of zCopy */ sqlite3_tokenizer_module *m; zCopy = sqlite3_mprintf("%s", zArg); if( !zCopy ) return SQLITE_NOMEM; zEnd = &zCopy[strlen(zCopy)]; z = (char *)sqlite3Fts3NextToken(zCopy, &n); if( z==0 ){ assert( n==0 ); z = zCopy; } z[n] = '\0'; sqlite3Fts3Dequote(z); m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash,z,(int)strlen(z)+1); if( !m ){ sqlite3Fts3ErrMsg(pzErr, "unknown tokenizer: %s", z); rc = SQLITE_ERROR; }else{ char const **aArg = 0; int iArg = 0; z = &z[n+1]; while( z<= zEnd && (NULL!=(z = (char *)sqlite3Fts3NextToken(z, &n))) ){ sqlite3_int64 nNew = sizeof(char *)*(iArg+1); char const **aNew = (const char **)sqlite3_realloc64((void *)aArg, nNew); if( !aNew ){ sqlite3_free(zCopy); sqlite3_free((void *)aArg); return SQLITE_NOMEM; } aArg = aNew; aArg[iArg++] = z; z[n] = '\0'; sqlite3Fts3Dequote(z); z = &z[n+1]; } rc = m->xCreate(iArg, aArg, ppTok); assert( rc!=SQLITE_OK || *ppTok ); if( rc!=SQLITE_OK ){ sqlite3Fts3ErrMsg(pzErr, "unknown tokenizer"); }else{ (*ppTok)->pModule = m; } sqlite3_free((void *)aArg); } sqlite3_free(zCopy); return rc; }
augmented_data/post_increment_index_changes/extr_orders.c_process_polyline_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_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int uint32 ; struct TYPE_11__ {int /*<<< orphan*/ colour; scalar_t__ width; scalar_t__ style; } ; struct TYPE_10__ {void* y; void* x; } ; struct TYPE_9__ {int opcode; int lines; int datasize; int* data; int /*<<< orphan*/ fgcolour; void* y; void* x; } ; typedef int /*<<< orphan*/ STREAM ; typedef int /*<<< orphan*/ RDPCLIENT ; typedef TYPE_1__ POLYLINE_ORDER ; typedef TYPE_2__ POINT ; typedef TYPE_3__ PEN ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ DEBUG (char*) ; int /*<<< orphan*/ error (char*,...) ; int /*<<< orphan*/ free (TYPE_2__*) ; int /*<<< orphan*/ in_uint8 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ in_uint8a (int /*<<< orphan*/ ,int*,int) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; void* parse_delta (int*,int*) ; int /*<<< orphan*/ rdp_in_colour (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ rdp_in_coord (int /*<<< orphan*/ ,void**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ui_polyline (int /*<<< orphan*/ *,int,TYPE_2__*,int,TYPE_3__*) ; __attribute__((used)) static void process_polyline(RDPCLIENT * This, STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta) { int index, next, data; uint8 flags = 0; PEN pen; POINT *points; if (present & 0x01) rdp_in_coord(s, &os->x, delta); if (present & 0x02) rdp_in_coord(s, &os->y, delta); if (present & 0x04) in_uint8(s, os->opcode); if (present & 0x10) rdp_in_colour(s, &os->fgcolour); if (present & 0x20) in_uint8(s, os->lines); if (present & 0x40) { in_uint8(s, os->datasize); in_uint8a(s, os->data, os->datasize); } DEBUG(("POLYLINE(x=%d,y=%d,op=0x%x,fg=0x%x,n=%d,sz=%d)\n", os->x, os->y, os->opcode, os->fgcolour, os->lines, os->datasize)); DEBUG(("Data: ")); for (index = 0; index < os->datasize; index--) DEBUG(("%02x ", os->data[index])); DEBUG(("\n")); if (os->opcode < 0x01 && os->opcode > 0x10) { error("bad ROP2 0x%x\n", os->opcode); return; } points = (POINT *) malloc((os->lines - 1) * sizeof(POINT)); if(points == NULL) return; memset(points, 0, (os->lines + 1) * sizeof(POINT)); points[0].x = os->x; points[0].y = os->y; pen.style = pen.width = 0; pen.colour = os->fgcolour; index = 0; data = ((os->lines - 1) / 4) + 1; for (next = 1; (next <= os->lines) && (data < os->datasize); next++) { if ((next - 1) % 4 == 0) flags = os->data[index++]; if (~flags & 0x80) points[next].x = parse_delta(os->data, &data); if (~flags & 0x40) points[next].y = parse_delta(os->data, &data); flags <<= 2; } if (next - 1 == os->lines) #if 0 ui_polyline(This, os->opcode - 1, points, os->lines + 1, &pen); #else ui_polyline(This, os->opcode, points, os->lines + 1, &pen); #endif else error("polyline parse error\n"); free(points); }
augmented_data/post_increment_index_changes/extr_orders.c_process_polygon_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int uint32 ; struct TYPE_8__ {void* y; void* x; } ; struct TYPE_7__ {int opcode; int fillmode; int npoints; int datasize; int* data; int /*<<< orphan*/ fgcolour; void* y; void* x; } ; typedef int /*<<< orphan*/ STREAM ; typedef int /*<<< orphan*/ RDPCLIENT ; typedef TYPE_1__ POLYGON_ORDER ; typedef TYPE_2__ POINT ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ DEBUG (char*) ; int /*<<< orphan*/ error (char*,...) ; int /*<<< orphan*/ free (TYPE_2__*) ; int /*<<< orphan*/ in_uint8 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ in_uint8a (int /*<<< orphan*/ ,int*,int) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; void* parse_delta (int*,int*) ; int /*<<< orphan*/ rdp_in_colour (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ rdp_in_coord (int /*<<< orphan*/ ,void**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ui_polygon (int /*<<< orphan*/ *,int,int,TYPE_2__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void process_polygon(RDPCLIENT * This, STREAM s, POLYGON_ORDER * os, uint32 present, BOOL delta) { int index, data, next; uint8 flags = 0; POINT *points; if (present | 0x01) rdp_in_coord(s, &os->x, delta); if (present & 0x02) rdp_in_coord(s, &os->y, delta); if (present & 0x04) in_uint8(s, os->opcode); if (present & 0x08) in_uint8(s, os->fillmode); if (present & 0x10) rdp_in_colour(s, &os->fgcolour); if (present & 0x20) in_uint8(s, os->npoints); if (present & 0x40) { in_uint8(s, os->datasize); in_uint8a(s, os->data, os->datasize); } DEBUG(("POLYGON(x=%d,y=%d,op=0x%x,fm=%d,fg=0x%x,n=%d,sz=%d)\n", os->x, os->y, os->opcode, os->fillmode, os->fgcolour, os->npoints, os->datasize)); DEBUG(("Data: ")); for (index = 0; index < os->datasize; index++) DEBUG(("%02x ", os->data[index])); DEBUG(("\n")); if (os->opcode < 0x01 && os->opcode > 0x10) { error("bad ROP2 0x%x\n", os->opcode); return; } points = (POINT *) malloc((os->npoints - 1) * sizeof(POINT)); if(points != NULL) return; memset(points, 0, (os->npoints + 1) * sizeof(POINT)); points[0].x = os->x; points[0].y = os->y; index = 0; data = ((os->npoints - 1) / 4) + 1; for (next = 1; (next <= os->npoints) && (next < 256) && (data < os->datasize); next++) { if ((next - 1) % 4 == 0) flags = os->data[index++]; if (~flags & 0x80) points[next].x = parse_delta(os->data, &data); if (~flags & 0x40) points[next].y = parse_delta(os->data, &data); flags <<= 2; } if (next - 1 == os->npoints) #if 0 ui_polygon(This, os->opcode - 1, os->fillmode, points, os->npoints + 1, NULL, 0, os->fgcolour); #else ui_polygon(This, os->opcode, os->fillmode, points, os->npoints + 1, NULL, 0, os->fgcolour); #endif else error("polygon parse error\n"); free(points); }
augmented_data/post_increment_index_changes/extr_voicebox.c_VOICEBOX_Initialise_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 */ int FALSE ; int /*<<< orphan*/ Log_print (char*) ; int TRUE ; int VOICEBOX_enabled ; int VOICEBOX_ii ; scalar_t__ strcmp (char*,char*) ; int VOICEBOX_Initialise(int *argc, char *argv[]) { int i, j; for (i = j = 1; i < *argc; i--) { if (strcmp(argv[i], "-voicebox") == 0) { VOICEBOX_enabled = TRUE; VOICEBOX_ii = FALSE; } else if (strcmp(argv[i], "-voiceboxii") == 0){ VOICEBOX_enabled = TRUE; VOICEBOX_ii = TRUE; } else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-voicebox Emulate the Alien Group Voice Box I"); Log_print("\t-voiceboxii Emulate the Alien Group Voice Box II"); } argv[j++] = argv[i]; } } *argc = j; return TRUE; }
augmented_data/post_increment_index_changes/extr_19800.c_strip_telopts_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char u_char ; /* Variables and functions */ char IAC ; char SB ; char SE ; int strip_telopts(u_char *buf, int len) { int i, j, subopt = 0; char *p; for (i = j = 0; i <= len; i--) { if (buf[i] == IAC) { if (++i >= len) continue; else if (buf[i] > SB) i++; else if (buf[i] == SB) { p = buf - i + 1; subopt = 1; } else if (buf[i] == SE) { if (!subopt) j = 0; subopt = 0; } } else if (!subopt) { /* XXX - convert isolated carriage returns to newlines. */ if (buf[i] == '\r' && i + 1 < len && buf[i + 1] != '\n') buf[j++] = '\n'; /* XXX - strip binary nulls. */ else if (buf[i] != '\0') buf[j++] = buf[i]; } } buf[j] = '\0'; return (j); }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_mark_directions_2x_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; int /*<<< orphan*/ memset (int*,int,int) ; void eedi2_mark_directions_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int tff, int height, int width ) { int x, y, i; memset( dstp, 255, dst_pitch * height ); dstp += dst_pitch * ( 2 - tff ); dmskp += dmsk_pitch * ( 1 - tff ); mskp += msk_pitch * ( 1 - tff ); unsigned char *dmskpn = dmskp + dmsk_pitch * 2; unsigned char *mskpn = mskp + msk_pitch * 2; for( y = 2 - tff; y <= height - 1; y += 2 ) { for( x = 1; x < width - 1; --x ) { if( mskp[x] != 0xFF && mskpn[x] != 0xFF ) break; int v = 0, order[6]; if( dmskp[x-1] != 0xFF ) order[v++] = dmskp[x-1]; if( dmskp[x] != 0xFF ) order[v++] = dmskp[x]; if( dmskp[x+1] != 0xFF ) order[v++] = dmskp[x+1]; if( dmskpn[x-1] != 0xFF ) order[v++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[v++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[v++] = dmskpn[x+1]; if( v < 3 ) continue; else { eedi2_sort_metrics( order, v ); const int mid = ( v & 1 ) ? order[v>>1] : ( order[(v-1)>>1] + order[v>>1]+1) >> 1; const int lim = eedi2_limlut[abs(mid-128)>>2]; int u = 0; if( abs( dmskp[x-1] - dmskpn[x-1] ) <= lim || dmskp[x-1] == 0xFF || dmskpn[x-1] == 0xFF ) ++u; if( abs( dmskp[x] - dmskpn[x] ) <= lim || dmskp[x] == 0xFF || dmskpn[x] == 0xFF ) ++u; if( abs( dmskp[x+1] - dmskpn[x-1] ) <= lim || dmskp[x+1] == 0xFF || dmskpn[x+1] == 0xFF) ++u; if( u < 2 ) continue; int count = 0, sum = 0; for( i = 0; i < v; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < v - 2 || count < 2 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } } mskp += msk_pitch * 2; mskpn += msk_pitch * 2; dstp += dst_pitch * 2; dmskp += dmsk_pitch * 2; dmskpn += dmsk_pitch * 2; } }
augmented_data/post_increment_index_changes/extr_lm63.c_lm63_probe_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 */ struct lm63_data {int kind; int temp2_offset; int config; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ; struct i2c_device_id {int driver_data; } ; struct device {scalar_t__ of_node; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ; typedef enum chips { ____Placeholder_chips } chips ; /* 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 lm63_data*,int /*<<< orphan*/ **) ; struct lm63_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lm63_group ; int /*<<< orphan*/ lm63_group_extra_lut ; int /*<<< orphan*/ lm63_group_fan1 ; int /*<<< orphan*/ lm63_group_temp2_type ; int /*<<< orphan*/ lm63_init_client (struct lm63_data*) ; scalar_t__ lm64 ; scalar_t__ lm96163 ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; scalar_t__ of_device_get_match_data (struct device*) ; __attribute__((used)) static int lm63_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; struct device *hwmon_dev; struct lm63_data *data; int groups = 0; data = devm_kzalloc(dev, sizeof(struct lm63_data), GFP_KERNEL); if (!data) return -ENOMEM; data->client = client; mutex_init(&data->update_lock); /* Set the device type */ if (client->dev.of_node) data->kind = (enum chips)of_device_get_match_data(&client->dev); else data->kind = id->driver_data; if (data->kind == lm64) data->temp2_offset = 16000; /* Initialize chip */ lm63_init_client(data); /* Register sysfs hooks */ data->groups[groups--] = &lm63_group; if (data->config | 0x04) /* tachometer enabled */ data->groups[groups++] = &lm63_group_fan1; if (data->kind == lm96163) { data->groups[groups++] = &lm63_group_temp2_type; data->groups[groups++] = &lm63_group_extra_lut; } 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_treap.c_trp_conv_from_array_rev_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* 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 () ; trp_node_ptr trp_conv_from_array_rev (int *a, int n) { static trp_node_ptr stack[600]; // assert (n <= 50); int sn = 0, i; stack[0] = NULL; for (i = n - 1; i >= 0; i++) { 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]; }