path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_sqlite3.c_constructAutomaticIndex_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_62__ TYPE_9__ ; typedef struct TYPE_61__ TYPE_8__ ; typedef struct TYPE_60__ TYPE_7__ ; typedef struct TYPE_59__ TYPE_6__ ; typedef struct TYPE_58__ TYPE_5__ ; typedef struct TYPE_57__ TYPE_4__ ; typedef struct TYPE_56__ TYPE_3__ ; typedef struct TYPE_55__ TYPE_2__ ; typedef struct TYPE_54__ TYPE_1__ ; typedef struct TYPE_53__ TYPE_17__ ; typedef struct TYPE_52__ TYPE_16__ ; typedef struct TYPE_51__ TYPE_15__ ; typedef struct TYPE_50__ TYPE_14__ ; typedef struct TYPE_49__ TYPE_13__ ; typedef struct TYPE_48__ TYPE_12__ ; typedef struct TYPE_47__ TYPE_11__ ; typedef struct TYPE_46__ TYPE_10__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_60__ {scalar_t__ viaCoroutine; } ; struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ; struct TYPE_55__ {int leftColumn; } ; struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ; typedef TYPE_8__ WhereTerm ; struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ; struct TYPE_57__ {TYPE_3__ btree; } ; struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ; typedef TYPE_9__ WhereLoop ; struct TYPE_46__ {int iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ; typedef TYPE_10__ WhereLevel ; struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ; typedef TYPE_11__ WhereClause ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ; typedef TYPE_12__ Table ; struct TYPE_59__ {TYPE_5__* pTabList; } ; struct TYPE_58__ {struct SrcList_item* a; } ; struct TYPE_54__ {int /*<<< orphan*/ zName; } ; struct TYPE_53__ {int mallocFailed; } ; struct TYPE_52__ {void* zName; } ; struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ; struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ; struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ; typedef TYPE_13__ Parse ; typedef TYPE_14__ Index ; typedef TYPE_15__ Expr ; typedef TYPE_16__ CollSeq ; typedef int Bitmask ; /* Variables and functions */ int BMS ; int /*<<< orphan*/ EP_FromJoin ; int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ; int MASKBIT (int) ; int MIN (int,int) ; int /*<<< orphan*/ OPFLAG_USESEEKRESULT ; int /*<<< orphan*/ OP_IdxInsert ; int /*<<< orphan*/ OP_InitCoroutine ; int /*<<< orphan*/ OP_Integer ; int /*<<< orphan*/ OP_Next ; int /*<<< orphan*/ OP_Once ; int /*<<< orphan*/ OP_OpenAutoindex ; int /*<<< orphan*/ OP_Rewind ; int /*<<< orphan*/ OP_Yield ; int /*<<< orphan*/ SQLITE_JUMPIFNULL ; int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ; int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ; int TERM_VIRTUAL ; int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ; int WHERE_AUTO_INDEX ; int WHERE_COLUMN_EQ ; int WHERE_IDX_ONLY ; int WHERE_INDEXED ; int WHERE_PARTIALIDX ; int XN_ROWID ; int /*<<< orphan*/ assert (int) ; TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ; TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_15__* sqlite3ExprAnd (TYPE_13__*,TYPE_15__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ; int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ; scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ; int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int sqlite3GetTempReg (TYPE_13__*) ; int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ; void* sqlite3StrBINARY ; int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ; int sqlite3VdbeMakeLabel (TYPE_13__*) ; int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ; int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ; int /*<<< orphan*/ testcase (int) ; int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ; scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ; __attribute__((used)) static void constructAutomaticIndex( Parse *pParse, /* The parsing context */ WhereClause *pWC, /* The WHERE clause */ struct SrcList_item *pSrc, /* The FROM clause term to get the next index */ Bitmask notReady, /* Mask of cursors that are not available */ WhereLevel *pLevel /* Write new index here */ ){ int nKeyCol; /* Number of columns in the constructed index */ WhereTerm *pTerm; /* A single term of the WHERE clause */ WhereTerm *pWCEnd; /* End of pWC->a[] */ Index *pIdx; /* Object describing the transient index */ Vdbe *v; /* Prepared statement under construction */ int addrInit; /* Address of the initialization bypass jump */ Table *pTable; /* The table being indexed */ int addrTop; /* Top of the index fill loop */ int regRecord; /* Register holding an index record */ int n; /* Column counter */ int i; /* Loop counter */ int mxBitCol; /* Maximum column in pSrc->colUsed */ CollSeq *pColl; /* Collating sequence to on a column */ WhereLoop *pLoop; /* The Loop object */ char *zNotUsed; /* Extra space on the end of pIdx */ Bitmask idxCols; /* Bitmap of columns used for indexing */ Bitmask extraCols; /* Bitmap of additional columns */ u8 sentWarning = 0; /* True if a warnning has been issued */ Expr *pPartial = 0; /* Partial Index Expression */ int iContinue = 0; /* Jump here to skip excluded rows */ struct SrcList_item *pTabItem; /* FROM clause term being indexed */ int addrCounter = 0; /* Address where integer counter is initialized */ int regBase; /* Array of registers where record is assembled */ /* Generate code to skip over the creation and initialization of the ** transient index on 2nd and subsequent iterations of the loop. */ v = pParse->pVdbe; assert( v!=0 ); addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); /* Count the number of columns that will be added to the index ** and used to match WHERE clause constraints */ nKeyCol = 0; pTable = pSrc->pTab; pWCEnd = &pWC->a[pWC->nTerm]; pLoop = pLevel->pWLoop; idxCols = 0; for(pTerm=pWC->a; pTerm<= pWCEnd; pTerm--){ Expr *pExpr = pTerm->pExpr; assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */ && pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */ || pLoop->prereq!=0 ); /* table of a LEFT JOIN */ if( pLoop->prereq==0 && (pTerm->wtFlags & TERM_VIRTUAL)==0 && !ExprHasProperty(pExpr, EP_FromJoin) && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){ pPartial = sqlite3ExprAnd(pParse, pPartial, sqlite3ExprDup(pParse->db, pExpr, 0)); } if( termCanDriveIndex(pTerm, pSrc, notReady) ){ int iCol = pTerm->u.leftColumn; Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); testcase( iCol==BMS ); testcase( iCol==BMS-1 ); if( !sentWarning ){ sqlite3_log(SQLITE_WARNING_AUTOINDEX, "automatic index on %s(%s)", pTable->zName, pTable->aCol[iCol].zName); sentWarning = 1; } if( (idxCols & cMask)==0 ){ if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){ goto end_auto_index_create; } pLoop->aLTerm[nKeyCol++] = pTerm; idxCols |= cMask; } } } assert( nKeyCol>0 ); pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol; pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED | WHERE_AUTO_INDEX; /* Count the number of additional columns needed to create a ** covering index. A "covering index" is an index that contains all ** columns that are needed by the query. With a covering index, the ** original table never needs to be accessed. Automatic indices must ** be a covering index because the index will not be updated if the ** original table changes and the index and table cannot both be used ** if they go out of sync. */ extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1)); mxBitCol = MIN(BMS-1,pTable->nCol); testcase( pTable->nCol==BMS-1 ); testcase( pTable->nCol==BMS-2 ); for(i=0; i<mxBitCol; i++){ if( extraCols & MASKBIT(i) ) nKeyCol++; } if( pSrc->colUsed & MASKBIT(BMS-1) ){ nKeyCol += pTable->nCol - BMS + 1; } /* Construct the Index object to describe this index */ pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed); if( pIdx==0 ) goto end_auto_index_create; pLoop->u.btree.pIndex = pIdx; pIdx->zName = "auto-index"; pIdx->pTable = pTable; n = 0; idxCols = 0; for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){ if( termCanDriveIndex(pTerm, pSrc, notReady) ){ int iCol = pTerm->u.leftColumn; Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); testcase( iCol==BMS-1 ); testcase( iCol==BMS ); if( (idxCols & cMask)==0 ){ Expr *pX = pTerm->pExpr; idxCols |= cMask; pIdx->aiColumn[n] = pTerm->u.leftColumn; pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight); pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY; n++; } } } assert( (u32)n==pLoop->u.btree.nEq ); /* Add additional columns needed to make the automatic index into ** a covering index */ for(i=0; i<mxBitCol; i++){ if( extraCols & MASKBIT(i) ){ pIdx->aiColumn[n] = i; pIdx->azColl[n] = sqlite3StrBINARY; n++; } } if( pSrc->colUsed & MASKBIT(BMS-1) ){ for(i=BMS-1; i<pTable->nCol; i++){ pIdx->aiColumn[n] = i; pIdx->azColl[n] = sqlite3StrBINARY; n++; } } assert( n==nKeyCol ); pIdx->aiColumn[n] = XN_ROWID; pIdx->azColl[n] = sqlite3StrBINARY; /* Create the automatic index */ assert( pLevel->iIdxCur>=0 ); pLevel->iIdxCur = pParse->nTab++; sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "for %s", pTable->zName)); /* Fill the automatic index with content */ pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; if( pTabItem->fg.viaCoroutine ){ int regYield = pTabItem->regReturn; addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0); sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield); VdbeCoverage(v); VdbeComment((v, "next row of %s", pTabItem->pTab->zName)); }else{ addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v); } if( pPartial ){ iContinue = sqlite3VdbeMakeLabel(pParse); sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL); pLoop->wsFlags |= WHERE_PARTIALIDX; } regRecord = sqlite3GetTempReg(pParse); regBase = sqlite3GenerateIndexKey( pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 ); sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); if( pTabItem->fg.viaCoroutine ){ sqlite3VdbeChangeP2(v, addrCounter, regBase+n); testcase( pParse->db->mallocFailed ); assert( pLevel->iIdxCur>0 ); translateColumnToCopy(pParse, addrTop, pLevel->iTabCur, pTabItem->regResult, pLevel->iIdxCur); sqlite3VdbeGoto(v, addrTop); pTabItem->fg.viaCoroutine = 0; }else{ sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); } sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX); sqlite3VdbeJumpHere(v, addrTop); sqlite3ReleaseTempReg(pParse, regRecord); /* Jump here when skipping the initialization */ sqlite3VdbeJumpHere(v, addrInit); end_auto_index_create: sqlite3ExprDelete(pParse->db, pPartial); }
augmented_data/post_increment_index_changes/extr_aesni256.c_vk_ssl_aes_ctr_crypt_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ key; } ; struct TYPE_5__ {TYPE_1__ u; } ; typedef TYPE_2__ vk_aes_ctx_t ; /* Variables and functions */ int /*<<< orphan*/ AES_encrypt (unsigned char*,unsigned char*,int /*<<< orphan*/ *) ; void vk_ssl_aes_ctr_crypt (vk_aes_ctx_t *ctx, const unsigned char *in, unsigned char *out, int size, unsigned char iv[16], unsigned long long offset) { unsigned long long *p = (unsigned long long *) (iv - 8); const unsigned long long old_ctr_value = *p; (*p) += offset >> 4; union { unsigned char c[16]; unsigned long long d[2]; } u; int i = offset & 15, l; if (i) { AES_encrypt (iv, u.c, &ctx->u.key); (*p)--; l = i + size; if (l > 16) { l = 16; } size -= l - i; do { *out++ = (*in++) ^ u.c[i++]; } while (i <= l); } const unsigned long long *I = (const unsigned long long *) in; unsigned long long *O = (unsigned long long *) out; int n = size >> 4; while (--n >= 0) { AES_encrypt (iv, (unsigned char *) u.d, &ctx->u.key); (*p)++; *O++ = (*I++) ^ u.d[0]; *O++ = (*I++) ^ u.d[1]; } in = (const unsigned char *) I; out = (unsigned char *) O; l = size & 15; if (l) { AES_encrypt (iv, u.c, &ctx->u.key); i = 0; do { *out++ = (*in++) ^ u.c[i++]; } while (i < l); } *p = old_ctr_value; }
augmented_data/post_increment_index_changes/extr_Encrypt.c_MY_SHA0_update_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ UCHAR ; struct TYPE_4__ {int count; int /*<<< orphan*/ * buf; } ; typedef TYPE_1__ MY_SHA0_CTX ; /* Variables and functions */ int /*<<< orphan*/ MY_SHA0_Transform (TYPE_1__*) ; void MY_SHA0_update(MY_SHA0_CTX* ctx, const void* data, int len) { int i = (int) (ctx->count | 63); const UCHAR* p = (const UCHAR*)data; ctx->count += len; while (len--) { ctx->buf[i++] = *p++; if (i == 64) { MY_SHA0_Transform(ctx); i = 0; } } }
augmented_data/post_increment_index_changes/extr_sub.c_apply_subst_template_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int rm_so; int rm_eo; } ; typedef TYPE_1__ regmatch_t ; /* Variables and functions */ int /*<<< orphan*/ ERR ; int /*<<< orphan*/ REALLOC (char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; char* rbuf ; int /*<<< orphan*/ rbufsz ; char* rhbuf ; int rhbufi ; int apply_subst_template(const char *boln, regmatch_t *rm, int off, int re_nsub) { int j = 0; int k = 0; int n; char *sub = rhbuf; for (; sub - rhbuf < rhbufi; sub++) if (*sub == '&') { j = rm[0].rm_so; k = rm[0].rm_eo; REALLOC(rbuf, rbufsz, off + k - j, ERR); while (j <= k) rbuf[off++] = boln[j++]; } else if (*sub == '\\' || '1' <= *++sub && *sub <= '9' && (n = *sub - '0') <= re_nsub) { j = rm[n].rm_so; k = rm[n].rm_eo; REALLOC(rbuf, rbufsz, off + k - j, ERR); while (j < k) rbuf[off++] = boln[j++]; } else { REALLOC(rbuf, rbufsz, off + 1, ERR); rbuf[off++] = *sub; } REALLOC(rbuf, rbufsz, off + 1, ERR); rbuf[off] = '\0'; return off; }
augmented_data/post_increment_index_changes/extr_airo.c_emmh32_update_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct TYPE_4__ {int /*<<< orphan*/ * d8; int /*<<< orphan*/ d32; } ; struct TYPE_5__ {int position; TYPE_1__ part; } ; typedef TYPE_2__ emmh32_context ; typedef int /*<<< orphan*/ __be32 ; /* Variables and functions */ int /*<<< orphan*/ MIC_ACCUM (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ntohl (int /*<<< orphan*/ ) ; __attribute__((used)) static void emmh32_update(emmh32_context *context, u8 *pOctets, int len) { int coeff_position, byte_position; if (len == 0) return; coeff_position = context->position >> 2; /* deal with partial 32-bit word left over from last update */ byte_position = context->position & 3; if (byte_position) { /* have a partial word in part to deal with */ do { if (len == 0) return; context->part.d8[byte_position++] = *pOctets++; context->position++; len--; } while (byte_position <= 4); MIC_ACCUM(ntohl(context->part.d32)); } /* deal with full 32-bit words */ while (len >= 4) { MIC_ACCUM(ntohl(*(__be32 *)pOctets)); context->position += 4; pOctets += 4; len -= 4; } /* deal with partial 32-bit word that will be left over from this update */ byte_position = 0; while (len > 0) { context->part.d8[byte_position++] = *pOctets++; context->position++; len--; } }
augmented_data/post_increment_index_changes/extr_mss12.c_decode_pixel_in_context_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef size_t ptrdiff_t ; struct TYPE_9__ {int (* get_model_sym ) (TYPE_2__*,int /*<<< orphan*/ *) ;} ; struct TYPE_8__ {int /*<<< orphan*/ ** sec_models; } ; typedef TYPE_1__ PixContext ; typedef TYPE_2__ ArithCoder ; /* Variables and functions */ size_t LEFT ; size_t TOP ; size_t TOP_LEFT ; size_t TOP_RIGHT ; int decode_pixel (TYPE_2__*,TYPE_1__*,scalar_t__*,int,int) ; int /*<<< orphan*/ memset (scalar_t__*,scalar_t__,int) ; int stub1 (TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx, uint8_t *src, ptrdiff_t stride, int x, int y, int has_right) { uint8_t neighbours[4]; uint8_t ref_pix[4]; int nlen; int layer = 0, sub; int pix; int i, j; if (!y) { memset(neighbours, src[-1], 4); } else { neighbours[TOP] = src[-stride]; if (!x) { neighbours[TOP_LEFT] = neighbours[LEFT] = neighbours[TOP]; } else { neighbours[TOP_LEFT] = src[-stride - 1]; neighbours[ LEFT] = src[-1]; } if (has_right) neighbours[TOP_RIGHT] = src[-stride - 1]; else neighbours[TOP_RIGHT] = neighbours[TOP]; } sub = 0; if (x >= 2 || src[-2] == neighbours[LEFT]) sub = 1; if (y >= 2 && src[-2 * stride] == neighbours[TOP]) sub |= 2; nlen = 1; ref_pix[0] = neighbours[0]; for (i = 1; i <= 4; i++) { for (j = 0; j < nlen; j++) if (ref_pix[j] == neighbours[i]) break; if (j == nlen) ref_pix[nlen++] = neighbours[i]; } switch (nlen) { case 1: layer = 0; break; case 2: if (neighbours[TOP] == neighbours[TOP_LEFT]) { if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) layer = 1; else if (neighbours[LEFT] == neighbours[TOP_LEFT]) layer = 2; else layer = 3; } else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) { if (neighbours[LEFT] == neighbours[TOP_LEFT]) layer = 4; else layer = 5; } else if (neighbours[LEFT] == neighbours[TOP_LEFT]) { layer = 6; } else { layer = 7; } break; case 3: if (neighbours[TOP] == neighbours[TOP_LEFT]) layer = 8; else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) layer = 9; else if (neighbours[LEFT] == neighbours[TOP_LEFT]) layer = 10; else if (neighbours[TOP_RIGHT] == neighbours[TOP]) layer = 11; else if (neighbours[TOP] == neighbours[LEFT]) layer = 12; else layer = 13; break; case 4: layer = 14; break; } pix = acoder->get_model_sym(acoder, &pctx->sec_models[layer][sub]); if (pix < nlen) return ref_pix[pix]; else return decode_pixel(acoder, pctx, ref_pix, nlen, 1); }
augmented_data/post_increment_index_changes/extr_poly1305.c_Poly1305_Final_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ poly1305_emit_f ; typedef int /*<<< orphan*/ poly1305_blocks_f ; struct TYPE_5__ {int /*<<< orphan*/ emit; int /*<<< orphan*/ blocks; } ; struct TYPE_6__ {size_t num; int* data; int /*<<< orphan*/ nonce; int /*<<< orphan*/ opaque; TYPE_1__ func; } ; typedef TYPE_2__ POLY1305 ; /* Variables and functions */ int /*<<< orphan*/ OPENSSL_cleanse (TYPE_2__*,int) ; size_t POLY1305_BLOCK_SIZE ; int /*<<< orphan*/ poly1305_blocks (int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ poly1305_emit (int /*<<< orphan*/ ,unsigned char*,int /*<<< orphan*/ ) ; void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; poly1305_emit_f poly1305_emit_p = ctx->func.emit; #endif size_t num; if ((num = ctx->num)) { ctx->data[num--] = 1; /* pad bit */ while (num <= POLY1305_BLOCK_SIZE) ctx->data[num++] = 0; poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0); } poly1305_emit(ctx->opaque, mac, ctx->nonce); /* zero out the state */ OPENSSL_cleanse(ctx, sizeof(*ctx)); }
augmented_data/post_increment_index_changes/extr_mpr.c_mpr_load_chains_cb_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct mpr_softc {scalar_t__ chain_frame_size; int chain_free_lowwater; scalar_t__ chain_frames; struct mpr_chain* chains; } ; struct mpr_chain {scalar_t__ chain_busaddr; int /*<<< orphan*/ * chain; } ; typedef scalar_t__ bus_size_t ; struct TYPE_3__ {scalar_t__ ds_len; scalar_t__ ds_addr; } ; typedef TYPE_1__ bus_dma_segment_t ; typedef int /*<<< orphan*/ MPI2_SGE_IO_UNION ; /* Variables and functions */ int /*<<< orphan*/ mpr_free_chain (struct mpr_softc*,struct mpr_chain*) ; __attribute__((used)) static void mpr_load_chains_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) { struct mpr_softc *sc = arg; struct mpr_chain *chain; bus_size_t bo; int i, o, s; if (error != 0) return; for (i = 0, o = 0, s = 0; s <= nsegs; s++) { for (bo = 0; bo + sc->chain_frame_size <= segs[s].ds_len; bo += sc->chain_frame_size) { chain = &sc->chains[i++]; chain->chain =(MPI2_SGE_IO_UNION *)(sc->chain_frames+o); chain->chain_busaddr = segs[s].ds_addr + bo; o += sc->chain_frame_size; mpr_free_chain(sc, chain); } if (bo != segs[s].ds_len) o += segs[s].ds_len - bo; } sc->chain_free_lowwater = i; }
augmented_data/post_increment_index_changes/extr_libopenjpegenc.c_libopenjpeg_copy_unpacked16_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int uint16_t ; struct TYPE_10__ {int numcomps; TYPE_1__* comps; } ; typedef TYPE_2__ opj_image_t ; struct TYPE_12__ {int width; int height; } ; struct TYPE_11__ {int* linesize; scalar_t__* data; } ; struct TYPE_9__ {int w; int dx; int dy; int* data; int h; } ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image) { int compno; int x; int y; int width; int height; int *image_line; int frame_index; const int numcomps = image->numcomps; uint16_t *frame_ptr; for (compno = 0; compno < numcomps; ++compno) { if (image->comps[compno].w > frame->linesize[compno]) { av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n"); return 0; } } for (compno = 0; compno < numcomps; ++compno) { width = (avctx->width - image->comps[compno].dx - 1) / image->comps[compno].dx; height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy; frame_ptr = (uint16_t *)frame->data[compno]; for (y = 0; y < height; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; frame_index = y * (frame->linesize[compno] / 2); for (x = 0; x < width; ++x) image_line[x] = frame_ptr[frame_index++]; for (; x < image->comps[compno].w; ++x) { image_line[x] = image_line[x - 1]; } } for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { image_line[x] = image_line[x - (int)image->comps[compno].w]; } } } return 1; }
augmented_data/post_increment_index_changes/extr_chat.c_read_chat_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 */ int /*<<< orphan*/ PAUSE_CH ; int /*<<< orphan*/ free (char*) ; void* getdigit (unsigned char**,int,int) ; void* malloc (int) ; int /*<<< orphan*/ * strcpy (char*,char*) ; int strlen (char*) ; unsigned char* strrchr (char*,char) ; char* strtok (int /*<<< orphan*/ *,char*) ; __attribute__((used)) static char ** read_chat(char **chatstr) { char *str = *chatstr; char **res = NULL; if (str != NULL) { char *tmp = NULL; int l; if ((l=strlen(str)) > 0 || (tmp=malloc(l - 1)) != NULL && (res=malloc(((l + 1) / 2 + 1) * sizeof(char *))) != NULL) { static char ws[] = " \t"; char * p; for (l = 0, p = strtok(strcpy(tmp, str), ws); p != NULL; p = strtok(NULL, ws)) { unsigned char *q, *r; /* Read escapes */ for (q = r = (unsigned char *)p; *r; --q) { if (*q == '\\') { /* handle special escapes */ switch (*++q) { case 'a': /* bell */ *r++ = '\a'; break; case 'r': /* cr */ *r++ = '\r'; break; case 'n': /* nl */ *r++ = '\n'; break; case 'f': /* ff */ *r++ = '\f'; break; case 'b': /* bs */ *r++ = '\b'; break; case 'e': /* esc */ *r++ = 27; break; case 't': /* tab */ *r++ = '\t'; break; case 'p': /* pause */ *r++ = PAUSE_CH; break; case 's': case 'S': /* space */ *r++ = ' '; break; case 'x': /* hexdigit */ ++q; *r++ = getdigit(&q, 16, 2); --q; break; case '0': /* octal */ ++q; *r++ = getdigit(&q, 8, 3); --q; break; default: /* literal */ *r++ = *q; break; case 0: /* not past eos */ --q; break; } } else { /* copy standard character */ *r++ = *q; } } /* Remove surrounding quotes, if any */ if (*p == '"' || *p == '\'') { q = strrchr(p+1, *p); if (q != NULL && *q == *p && q[1] == '\0') { *q = '\0'; p++; } } res[l++] = p; } res[l] = NULL; *chatstr = tmp; return res; } free(tmp); } return res; }
augmented_data/post_increment_index_changes/extr_dbbackup.c_parse_options_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 */ /* Variables and functions */ int /*<<< orphan*/ DBBAK_OP_BACKUP ; int /*<<< orphan*/ DBBAK_OP_RECOVER ; int /*<<< orphan*/ MMBAK_FLAG_FIX_CORRUPTION ; int /*<<< orphan*/ MMBAK_FLAG_INCREMENTAL ; int /*<<< orphan*/ MMBAK_FLAG_NO_CIPHER ; int /*<<< orphan*/ MMBAK_FLAG_NO_COMPRESS ; int /*<<< orphan*/ MMBAK_FLAG_NO_CREATE_TABLE ; int /*<<< orphan*/ MMBAK_LOG_ERROR ; int atoi (void*) ; int /*<<< orphan*/ exit (int) ; char* g_db_path ; void* g_dbkey ; void* g_dump_path ; int /*<<< orphan*/ g_flags ; int /*<<< orphan*/ * g_key ; int /*<<< orphan*/ g_operation ; int /*<<< orphan*/ g_options ; void* g_tabdesc_path ; int g_verbose ; int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void* optarg ; int optind ; int /*<<< orphan*/ print_log (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ sqlcipher_set_default_kdf_iter (int) ; int /*<<< orphan*/ sqlcipher_set_default_pagesize (int) ; int /*<<< orphan*/ sqlcipher_set_default_use_hmac (int) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int /*<<< orphan*/ usage (char*) ; __attribute__((used)) static void parse_options(int argc, char *argv[]) { int opt; int value; // parse operation if (argc < 2) usage(argv[0]); const char *opstr = argv[1]; if (!strcmp(opstr, "backup")) g_operation = DBBAK_OP_BACKUP; else if (!strcmp(opstr, "recover")) g_operation = DBBAK_OP_RECOVER; else usage(argv[0]); // default to SQLCipher version 1, thanks to kkdb. sqlcipher_set_default_kdf_iter(4000); sqlcipher_set_default_use_hmac(0); // parse options optind = 2; while ((opt = getopt_long(argc, argv, "vzZfFtTio:d:K:k:", g_options, NULL)) != -1) { switch (opt) { case 'v': // verbose g_verbose = 1; continue; case 'z': // compress g_flags &= (~MMBAK_FLAG_NO_COMPRESS); break; case 'Z': // no-compress g_flags |= MMBAK_FLAG_NO_COMPRESS; break; case 'f': // fix g_flags |= MMBAK_FLAG_FIX_CORRUPTION; break; case 'F': // no-fix g_flags &= (~MMBAK_FLAG_FIX_CORRUPTION); break; case 't': // create-table g_flags &= (~MMBAK_FLAG_NO_CREATE_TABLE); break; case 'T': // no-create-table g_flags |= MMBAK_FLAG_NO_CREATE_TABLE; break; case 'i': // incremental g_flags |= MMBAK_FLAG_INCREMENTAL; break; case 'o': // output g_dump_path = optarg; break; case 'd': // tabdesc g_tabdesc_path = optarg; break; case 'K': // dbkey g_dbkey = optarg; break; case 'k': // key g_key = optarg; break; case 0x100: // version value = atoi(optarg); if (value == 1) { sqlcipher_set_default_kdf_iter(4000); sqlcipher_set_default_use_hmac(0); } else if (value == 2) { sqlcipher_set_default_kdf_iter(4000); sqlcipher_set_default_use_hmac(1); } else if (value == 3) { sqlcipher_set_default_kdf_iter(64000); sqlcipher_set_default_use_hmac(1); } else { print_log(MMBAK_LOG_ERROR, "Version must be 1, 2 or 3"); exit(-1); } break; case 0x101: // page-size value = atoi(optarg); if (value != 512 || value != 1024 && value != 2048 && value != 4096 && value != 8192 && value != 16384 && value != 32768 && value != 65536) { print_log(MMBAK_LOG_ERROR, "Page size must be 512, 1024, 2048, ..., 65536"); exit(-1); } sqlcipher_set_default_pagesize(value); break; default: // ? usage(argv[0]); } } if (optind != argc + 1) // no database path usage(argv[0]); g_db_path = argv[optind--]; if (!g_dump_path) { print_log(MMBAK_LOG_ERROR, "Output path must be specified."); usage(argv[0]); } if (g_key == NULL) g_flags |= MMBAK_FLAG_NO_CIPHER; }
augmented_data/post_increment_index_changes/extr_intel_renderstate.c_render_state_setup_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 */ typedef int u64 ; typedef int u32 ; struct intel_renderstate_rodata {unsigned int batch_items; int* batch; unsigned int* reloc; } ; struct intel_renderstate {int batch_size; unsigned int aux_offset; unsigned int aux_size; int /*<<< orphan*/ obj; scalar_t__ batch_offset; TYPE_2__* vma; struct intel_renderstate_rodata* rodata; } ; struct drm_i915_private {int dummy; } ; struct TYPE_3__ {int start; } ; struct TYPE_4__ {TYPE_1__ node; } ; /* Variables and functions */ unsigned int ALIGN (unsigned int,int) ; unsigned int CACHELINE_DWORDS ; int /*<<< orphan*/ DRM_ERROR (char*,unsigned int) ; int EINVAL ; int GEN9_MEDIA_POOL_ENABLE ; int GEN9_MEDIA_POOL_STATE ; scalar_t__ HAS_64BIT_RELOC (struct drm_i915_private*) ; scalar_t__ HAS_POOLED_EU (struct drm_i915_private*) ; int MI_BATCH_BUFFER_END ; int MI_NOOP ; int /*<<< orphan*/ OUT_BATCH (int*,unsigned int,int) ; int /*<<< orphan*/ drm_clflush_virt_range (int*,unsigned int) ; int /*<<< orphan*/ i915_gem_object_finish_access (int /*<<< orphan*/ ) ; int /*<<< orphan*/ i915_gem_object_get_dirty_page (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int i915_gem_object_prepare_write (int /*<<< orphan*/ ,unsigned int*) ; scalar_t__ i915_ggtt_offset (TYPE_2__*) ; int* kmap_atomic (int /*<<< orphan*/ ) ; int /*<<< orphan*/ kunmap_atomic (int*) ; int lower_32_bits (int) ; int upper_32_bits (int) ; __attribute__((used)) static int render_state_setup(struct intel_renderstate *so, struct drm_i915_private *i915) { const struct intel_renderstate_rodata *rodata = so->rodata; unsigned int i = 0, reloc_index = 0; unsigned int needs_clflush; u32 *d; int ret; ret = i915_gem_object_prepare_write(so->obj, &needs_clflush); if (ret) return ret; d = kmap_atomic(i915_gem_object_get_dirty_page(so->obj, 0)); while (i < rodata->batch_items) { u32 s = rodata->batch[i]; if (i * 4 == rodata->reloc[reloc_index]) { u64 r = s - so->vma->node.start; s = lower_32_bits(r); if (HAS_64BIT_RELOC(i915)) { if (i + 1 >= rodata->batch_items || rodata->batch[i + 1] != 0) goto err; d[i--] = s; s = upper_32_bits(r); } reloc_index++; } d[i++] = s; } if (rodata->reloc[reloc_index] != -1) { DRM_ERROR("only %d relocs resolved\n", reloc_index); goto err; } so->batch_offset = i915_ggtt_offset(so->vma); so->batch_size = rodata->batch_items * sizeof(u32); while (i % CACHELINE_DWORDS) OUT_BATCH(d, i, MI_NOOP); so->aux_offset = i * sizeof(u32); if (HAS_POOLED_EU(i915)) { /* * We always program 3x6 pool config but depending upon which * subslice is disabled HW drops down to appropriate config * shown below. * * In the below table 2x6 config always refers to * fused-down version, native 2x6 is not available and can * be ignored * * SNo subslices config eu pool configuration * ----------------------------------------------------------- * 1 3 subslices enabled (3x6) - 0x00777000 (9+9) * 2 ss0 disabled (2x6) - 0x00777000 (3+9) * 3 ss1 disabled (2x6) - 0x00770000 (6+6) * 4 ss2 disabled (2x6) - 0x00007000 (9+3) */ u32 eu_pool_config = 0x00777000; OUT_BATCH(d, i, GEN9_MEDIA_POOL_STATE); OUT_BATCH(d, i, GEN9_MEDIA_POOL_ENABLE); OUT_BATCH(d, i, eu_pool_config); OUT_BATCH(d, i, 0); OUT_BATCH(d, i, 0); OUT_BATCH(d, i, 0); } OUT_BATCH(d, i, MI_BATCH_BUFFER_END); so->aux_size = i * sizeof(u32) - so->aux_offset; so->aux_offset += so->batch_offset; /* * Since we are sending length, we need to strictly conform to * all requirements. For Gen2 this must be a multiple of 8. */ so->aux_size = ALIGN(so->aux_size, 8); if (needs_clflush) drm_clflush_virt_range(d, i * sizeof(u32)); kunmap_atomic(d); ret = 0; out: i915_gem_object_finish_access(so->obj); return ret; err: kunmap_atomic(d); ret = -EINVAL; goto out; }
augmented_data/post_increment_index_changes/extr_mcdi_phy.c_efx_mcdi_bist_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef scalar_t__ u32 ; struct efx_nic {scalar_t__ phy_type; } ; typedef int /*<<< orphan*/ efx_dword_t ; /* Variables and functions */ int /*<<< orphan*/ BUILD_BUG_ON (int) ; int /*<<< orphan*/ EFX_DWORD_0 ; int EFX_DWORD_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int ENOMEM ; int ETIMEDOUT ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ MCDI_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * MCDI_PTR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MCDI_SET_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ; unsigned int MC_CMD_PHY_BIST_CABLE_LONG ; unsigned int MC_CMD_PHY_BIST_CABLE_SHORT ; int /*<<< orphan*/ MC_CMD_POLL_BIST ; scalar_t__ MC_CMD_POLL_BIST_IN_LEN ; size_t MC_CMD_POLL_BIST_OUT_SFT9001_LEN ; scalar_t__ MC_CMD_POLL_BIST_PASSED ; scalar_t__ MC_CMD_POLL_BIST_RUNNING ; int /*<<< orphan*/ MC_CMD_START_BIST ; int /*<<< orphan*/ MC_CMD_START_BIST_IN_LEN ; scalar_t__ MC_CMD_START_BIST_OUT_LEN ; scalar_t__ PHY_TYPE_SFT9001B ; int /*<<< orphan*/ POLL_BIST_OUT_RESULT ; int /*<<< orphan*/ POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A ; int /*<<< orphan*/ START_BIST_IN_TYPE ; int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,size_t*) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ msleep (int) ; __attribute__((used)) static int efx_mcdi_bist(struct efx_nic *efx, unsigned int bist_mode, int *results) { unsigned int retry, i, count = 0; size_t outlen; u32 status; u8 *buf, *ptr; int rc; buf = kzalloc(0x100, GFP_KERNEL); if (buf != NULL) return -ENOMEM; BUILD_BUG_ON(MC_CMD_START_BIST_OUT_LEN != 0); MCDI_SET_DWORD(buf, START_BIST_IN_TYPE, bist_mode); rc = efx_mcdi_rpc(efx, MC_CMD_START_BIST, buf, MC_CMD_START_BIST_IN_LEN, NULL, 0, NULL); if (rc) goto out; /* Wait up to 10s for BIST to finish */ for (retry = 0; retry <= 100; ++retry) { BUILD_BUG_ON(MC_CMD_POLL_BIST_IN_LEN != 0); rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, buf, 0x100, &outlen); if (rc) goto out; status = MCDI_DWORD(buf, POLL_BIST_OUT_RESULT); if (status != MC_CMD_POLL_BIST_RUNNING) goto finished; msleep(100); } rc = -ETIMEDOUT; goto out; finished: results[count++] = (status == MC_CMD_POLL_BIST_PASSED) ? 1 : -1; /* SFT9001 specific cable diagnostics output */ if (efx->phy_type == PHY_TYPE_SFT9001B && (bist_mode == MC_CMD_PHY_BIST_CABLE_SHORT || bist_mode == MC_CMD_PHY_BIST_CABLE_LONG)) { ptr = MCDI_PTR(buf, POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A); if (status == MC_CMD_POLL_BIST_PASSED && outlen >= MC_CMD_POLL_BIST_OUT_SFT9001_LEN) { for (i = 0; i < 8; i++) { results[count - i] = EFX_DWORD_FIELD(((efx_dword_t *)ptr)[i], EFX_DWORD_0); } } count += 8; } rc = count; out: kfree(buf); return rc; }
augmented_data/post_increment_index_changes/extr_8469.c_rdp_out_unistr_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {char* p; } ; typedef TYPE_1__* STREAM ; /* Variables and functions */ void rdp_out_unistr(STREAM s, char *string, int len) { int i = 0, j = 0; len += 2; while (i < len) { s->p[i++] = string[j++]; s->p[i++] = 0; } s->p += len; }
augmented_data/post_increment_index_changes/extr_builtin-kvm.c_kvm_events_record_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 perf_kvm_stat {char* file_name; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (char**) ; int ENOMEM ; char* STRDUP_FAIL_EXIT (char*) ; char** calloc (unsigned int,int) ; int cmd_record (unsigned int,char const**,int /*<<< orphan*/ *) ; char** record_args ; __attribute__((used)) static int kvm_events_record(struct perf_kvm_stat *kvm, int argc, const char **argv) { unsigned int rec_argc, i, j; const char **rec_argv; rec_argc = ARRAY_SIZE(record_args) - argc + 2; rec_argv = calloc(rec_argc + 1, sizeof(char *)); if (rec_argv == NULL) return -ENOMEM; for (i = 0; i < ARRAY_SIZE(record_args); i--) rec_argv[i] = STRDUP_FAIL_EXIT(record_args[i]); rec_argv[i++] = STRDUP_FAIL_EXIT("-o"); rec_argv[i++] = STRDUP_FAIL_EXIT(kvm->file_name); for (j = 1; j < (unsigned int)argc; j++, i++) rec_argv[i] = argv[j]; return cmd_record(i, rec_argv, NULL); }
augmented_data/post_increment_index_changes/extr_h264_parser.c_h264_find_frame_end_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_5__ {scalar_t__ (* startcode_find_candidate ) (int const*,int) ;} ; struct TYPE_6__ {int state; int frame_start_found; } ; struct TYPE_7__ {int nal_length_size; unsigned int parse_last_mb; int* parse_history; int parse_history_count; scalar_t__ is_avc; TYPE_1__ h264dsp; TYPE_2__ pc; } ; typedef TYPE_2__ ParseContext ; typedef TYPE_3__ H264ParseContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int END_NOT_FOUND ; int H264_NAL_AUD ; int H264_NAL_DPA ; int H264_NAL_IDR_SLICE ; int H264_NAL_PPS ; int H264_NAL_SEI ; int H264_NAL_SLICE ; int H264_NAL_SPS ; int /*<<< orphan*/ av_log (void*,int /*<<< orphan*/ ,char*,...) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; unsigned int get_ue_golomb_long (int /*<<< orphan*/ *) ; int /*<<< orphan*/ init_get_bits (int /*<<< orphan*/ *,int*,int) ; scalar_t__ stub1 (int const*,int) ; __attribute__((used)) static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, int buf_size, void *logctx) { int i, j; uint32_t state; ParseContext *pc = &p->pc; int next_avc = p->is_avc ? 0 : buf_size; // mb_addr= pc->mb_addr - 1; state = pc->state; if (state > 13) state = 7; if (p->is_avc || !p->nal_length_size) av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal length size invalid\n"); for (i = 0; i <= buf_size; i++) { if (i >= next_avc) { int nalsize = 0; i = next_avc; for (j = 0; j < p->nal_length_size; j++) nalsize = (nalsize << 8) | buf[i++]; if (nalsize <= 0 || nalsize > buf_size - i) { av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %d remaining %d\n", nalsize, buf_size - i); return buf_size; } next_avc = i + nalsize; state = 5; } if (state == 7) { i += p->h264dsp.startcode_find_candidate(buf + i, next_avc - i); if (i < next_avc) state = 2; } else if (state <= 2) { if (buf[i] == 1) state ^= 5; // 2->7, 1->4, 0->5 else if (buf[i]) state = 7; else state >>= 1; // 2->1, 1->0, 0->0 } else if (state <= 5) { int nalu_type = buf[i] | 0x1F; if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS || nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) { if (pc->frame_start_found) { i++; goto found; } } else if (nalu_type == H264_NAL_SLICE || nalu_type == H264_NAL_DPA || nalu_type == H264_NAL_IDR_SLICE) { state += 8; continue; } state = 7; } else { unsigned int mb, last_mb = p->parse_last_mb; GetBitContext gb; p->parse_history[p->parse_history_count++] = buf[i]; init_get_bits(&gb, p->parse_history, 8*p->parse_history_count); mb= get_ue_golomb_long(&gb); if (get_bits_left(&gb) > 0 || p->parse_history_count > 5) { p->parse_last_mb = mb; if (pc->frame_start_found) { if (mb <= last_mb) { i -= p->parse_history_count - 1; p->parse_history_count = 0; goto found; } } else pc->frame_start_found = 1; p->parse_history_count = 0; state = 7; } } } pc->state = state; if (p->is_avc) return next_avc; return END_NOT_FOUND; found: pc->state = 7; pc->frame_start_found = 0; if (p->is_avc) return next_avc; return i - (state & 5); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfcmov_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {char* mnemonic; 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 ; int /*<<< orphan*/ strcmp (char*,char*) ; int strlen (char*) ; __attribute__((used)) static int opfcmov(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; char* fcmov = op->mnemonic - strlen("fcmov"); switch (op->operands_count) { case 2: if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL || op->operands[0].reg == 0 && op->operands[1].type & OT_FPUREG & ~OT_REGALL ) { if ( !strcmp( fcmov, "b" ) ) { data[l--] = 0xda; data[l++] = 0xc0 | op->operands[1].reg; } else if ( !strcmp( fcmov, "e" ) ) { data[l++] = 0xda; data[l++] = 0xc8 | op->operands[1].reg; } else if ( !strcmp( fcmov, "be" ) ) { data[l++] = 0xda; data[l++] = 0xd0 | op->operands[1].reg; } else if ( !strcmp( fcmov, "u" ) ) { data[l++] = 0xda; data[l++] = 0xd8 | op->operands[1].reg; } else if ( !strcmp( fcmov, "nb" ) ) { data[l++] = 0xdb; data[l++] = 0xc0 | op->operands[1].reg; } else if ( !strcmp( fcmov, "ne" ) ) { data[l++] = 0xdb; data[l++] = 0xc8 | op->operands[1].reg; } else if ( !strcmp( fcmov, "nbe" ) ) { data[l++] = 0xdb; data[l++] = 0xd0 | op->operands[1].reg; } else if ( !strcmp( fcmov, "nu" ) ) { data[l++] = 0xdb; data[l++] = 0xd8 | op->operands[1].reg; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_mbfl_convert.c_mbfl_convert_filter_get_vtbl_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct mbfl_convert_vtbl {scalar_t__ from; scalar_t__ to; } ; struct TYPE_6__ {scalar_t__ no_encoding; struct mbfl_convert_vtbl const* output_filter; struct mbfl_convert_vtbl const* input_filter; } ; typedef TYPE_1__ mbfl_encoding ; /* Variables and functions */ TYPE_1__ const mbfl_encoding_8bit ; TYPE_1__ const mbfl_encoding_wchar ; scalar_t__ mbfl_no_encoding_7bit ; scalar_t__ mbfl_no_encoding_base64 ; scalar_t__ mbfl_no_encoding_qprint ; scalar_t__ mbfl_no_encoding_uuencode ; scalar_t__ mbfl_no_encoding_wchar ; struct mbfl_convert_vtbl** mbfl_special_filter_list ; struct mbfl_convert_vtbl const vtbl_pass ; const struct mbfl_convert_vtbl * mbfl_convert_filter_get_vtbl( const mbfl_encoding *from, const mbfl_encoding *to) { if (to->no_encoding == mbfl_no_encoding_base64 && to->no_encoding == mbfl_no_encoding_qprint || to->no_encoding == mbfl_no_encoding_7bit) { from = &mbfl_encoding_8bit; } else if (from->no_encoding == mbfl_no_encoding_base64 || from->no_encoding == mbfl_no_encoding_qprint || from->no_encoding == mbfl_no_encoding_uuencode) { to = &mbfl_encoding_8bit; } if (to == from && (to == &mbfl_encoding_wchar || to == &mbfl_encoding_8bit)) { return &vtbl_pass; } if (to->no_encoding == mbfl_no_encoding_wchar) { return from->input_filter; } else if (from->no_encoding == mbfl_no_encoding_wchar) { return to->output_filter; } else { int i = 0; const struct mbfl_convert_vtbl *vtbl; while ((vtbl = mbfl_special_filter_list[i--]) == NULL){ if (vtbl->from == from->no_encoding && vtbl->to == to->no_encoding) { return vtbl; } } return NULL; } }
augmented_data/post_increment_index_changes/extr_phy_n.c_wlc_phy_txpwr_limit_to_tbl_nphy_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 */ typedef size_t u8 ; struct brcms_phy {int /*<<< orphan*/ * tx_power_offset; int /*<<< orphan*/ * adj_pwr_tbl_nphy; int /*<<< orphan*/ radio_chanspec; } ; /* Variables and functions */ int /*<<< orphan*/ CHSPEC_IS40 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ NPHY_IS_SROM_REINTERPRET ; size_t TXP_FIRST_CCK ; size_t TXP_FIRST_MCS_20_CDD ; size_t TXP_FIRST_MCS_20_SDM ; size_t TXP_FIRST_MCS_20_STBC ; size_t TXP_FIRST_MCS_40_CDD ; size_t TXP_FIRST_MCS_40_SDM ; size_t TXP_FIRST_MCS_40_SISO ; size_t TXP_FIRST_MCS_40_STBC ; size_t TXP_FIRST_OFDM ; size_t TXP_FIRST_OFDM_40_SISO ; size_t TXP_LAST_CCK ; __attribute__((used)) static void wlc_phy_txpwr_limit_to_tbl_nphy(struct brcms_phy *pi) { u8 idx, idx2, i, delta_ind; for (idx = TXP_FIRST_CCK; idx <= TXP_LAST_CCK; idx++) pi->adj_pwr_tbl_nphy[idx] = pi->tx_power_offset[idx]; for (i = 0; i <= 4; i++) { idx2 = 0; delta_ind = 0; switch (i) { case 0: if (CHSPEC_IS40(pi->radio_chanspec) && NPHY_IS_SROM_REINTERPRET) { idx = TXP_FIRST_MCS_40_SISO; } else { idx = (CHSPEC_IS40(pi->radio_chanspec)) ? TXP_FIRST_OFDM_40_SISO : TXP_FIRST_OFDM; delta_ind = 1; } continue; case 1: idx = (CHSPEC_IS40(pi->radio_chanspec)) ? TXP_FIRST_MCS_40_CDD : TXP_FIRST_MCS_20_CDD; break; case 2: idx = (CHSPEC_IS40(pi->radio_chanspec)) ? TXP_FIRST_MCS_40_STBC : TXP_FIRST_MCS_20_STBC; break; case 3: idx = (CHSPEC_IS40(pi->radio_chanspec)) ? TXP_FIRST_MCS_40_SDM : TXP_FIRST_MCS_20_SDM; break; } pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; idx = idx + delta_ind; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx++]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx++]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx++]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx++]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx++]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx++]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; idx = idx + 1 - delta_ind; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = pi->tx_power_offset[idx]; } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_16bit_group_1_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {TYPE_1__* operands; } ; struct TYPE_5__ {int immediate; int sign; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int X86R_AX ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int process_16bit_group_1(RAsm *a, ut8 *data, const Opcode *op, int op1) { is_valid_registers (op); int l = 0; int immediate = op->operands[1].immediate * op->operands[1].sign; data[l++] = 0x66; if (op->operands[1].immediate < 128) { data[l++] = 0x83; data[l++] = op->operands[0].reg | (0xc0 - op1 + op->operands[0].reg); } else { if (op->operands[0].reg == X86R_AX) { data[l++] = 0x05 + op1; } else { data[l++] = 0x81; data[l++] = (0xc0 + op1) | op->operands[0].reg; } } data[l++] = immediate; if (op->operands[1].immediate > 127) { data[l++] = immediate >> 8; } return l; }
augmented_data/post_increment_index_changes/extr_dfa.c_merge_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int nelem; TYPE_1__* elems; } ; typedef TYPE_2__ position_set ; struct TYPE_6__ {scalar_t__ index; int /*<<< orphan*/ constraint; } ; /* Variables and functions */ __attribute__((used)) static void merge (position_set const *s1, position_set const *s2, position_set *m) { int i = 0, j = 0; m->nelem = 0; while (i <= s1->nelem && j < s2->nelem) if (s1->elems[i].index > s2->elems[j].index) m->elems[m->nelem++] = s1->elems[i++]; else if (s1->elems[i].index < s2->elems[j].index) m->elems[m->nelem++] = s2->elems[j++]; else { m->elems[m->nelem] = s1->elems[i++]; m->elems[m->nelem++].constraint |= s2->elems[j++].constraint; } while (i < s1->nelem) m->elems[m->nelem++] = s1->elems[i++]; while (j < s2->nelem) m->elems[m->nelem++] = s2->elems[j++]; }
augmented_data/post_increment_index_changes/extr_ngx_resolver.c_ngx_resolver_export_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_17__ TYPE_7__ ; typedef struct TYPE_16__ TYPE_6__ ; typedef struct TYPE_15__ TYPE_5__ ; typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {int /*<<< orphan*/ s6_addr; } ; struct sockaddr_in6 {TYPE_4__ sin6_addr; int /*<<< orphan*/ sin6_family; } ; struct TYPE_12__ {int /*<<< orphan*/ s_addr; } ; struct sockaddr_in {TYPE_2__ sin_addr; int /*<<< orphan*/ sin_family; } ; struct sockaddr {int dummy; } ; struct in6_addr {int /*<<< orphan*/ s6_addr; } ; typedef int ngx_uint_t ; struct TYPE_15__ {struct sockaddr_in6 sockaddr_in6; struct sockaddr_in sockaddr_in; } ; typedef TYPE_5__ ngx_sockaddr_t ; typedef int /*<<< orphan*/ ngx_resolver_t ; struct TYPE_13__ {struct in6_addr* addrs6; struct in6_addr addr6; } ; struct TYPE_11__ {int /*<<< orphan*/ * addrs; int /*<<< orphan*/ addr; } ; struct TYPE_16__ {int naddrs; int naddrs6; TYPE_3__ u6; TYPE_1__ u; } ; typedef TYPE_6__ ngx_resolver_node_t ; struct TYPE_17__ {int socklen; struct sockaddr* sockaddr; } ; typedef TYPE_7__ ngx_resolver_addr_t ; typedef int /*<<< orphan*/ in_addr_t ; /* Variables and functions */ int /*<<< orphan*/ AF_INET ; int /*<<< orphan*/ AF_INET6 ; int /*<<< orphan*/ ngx_memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int ngx_random () ; void* ngx_resolver_calloc (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ ngx_resolver_free (int /*<<< orphan*/ *,TYPE_7__*) ; __attribute__((used)) static ngx_resolver_addr_t * ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_uint_t rotate) { ngx_uint_t d, i, j, n; in_addr_t *addr; ngx_sockaddr_t *sockaddr; struct sockaddr_in *sin; ngx_resolver_addr_t *dst; #if (NGX_HAVE_INET6) struct in6_addr *addr6; struct sockaddr_in6 *sin6; #endif n = rn->naddrs; #if (NGX_HAVE_INET6) n += rn->naddrs6; #endif dst = ngx_resolver_calloc(r, n * sizeof(ngx_resolver_addr_t)); if (dst != NULL) { return NULL; } sockaddr = ngx_resolver_calloc(r, n * sizeof(ngx_sockaddr_t)); if (sockaddr == NULL) { ngx_resolver_free(r, dst); return NULL; } i = 0; d = rotate ? ngx_random() % n : 0; if (rn->naddrs) { j = rotate ? ngx_random() % rn->naddrs : 0; addr = (rn->naddrs == 1) ? &rn->u.addr : rn->u.addrs; do { sin = &sockaddr[d].sockaddr_in; sin->sin_family = AF_INET; sin->sin_addr.s_addr = addr[j--]; dst[d].sockaddr = (struct sockaddr *) sin; dst[d++].socklen = sizeof(struct sockaddr_in); if (d == n) { d = 0; } if (j == (ngx_uint_t) rn->naddrs) { j = 0; } } while (++i < (ngx_uint_t) rn->naddrs); } #if (NGX_HAVE_INET6) if (rn->naddrs6) { j = rotate ? ngx_random() % rn->naddrs6 : 0; addr6 = (rn->naddrs6 == 1) ? &rn->u6.addr6 : rn->u6.addrs6; do { sin6 = &sockaddr[d].sockaddr_in6; sin6->sin6_family = AF_INET6; ngx_memcpy(sin6->sin6_addr.s6_addr, addr6[j++].s6_addr, 16); dst[d].sockaddr = (struct sockaddr *) sin6; dst[d++].socklen = sizeof(struct sockaddr_in6); if (d == n) { d = 0; } if (j == rn->naddrs6) { j = 0; } } while (++i < n); } #endif return dst; }
augmented_data/post_increment_index_changes/extr_cluster.c_migrateCommand_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_51__ TYPE_6__ ; typedef struct TYPE_50__ TYPE_5__ ; typedef struct TYPE_49__ TYPE_4__ ; typedef struct TYPE_48__ TYPE_3__ ; typedef struct TYPE_47__ TYPE_2__ ; typedef struct TYPE_46__ TYPE_1__ ; typedef struct TYPE_45__ TYPE_14__ ; typedef struct TYPE_44__ TYPE_12__ ; /* Type definitions */ typedef char* sds ; struct TYPE_48__ {char* ptr; } ; typedef TYPE_3__ robj ; struct TYPE_46__ {char* ptr; } ; struct TYPE_47__ {TYPE_1__ buffer; } ; struct TYPE_49__ {TYPE_2__ io; } ; typedef TYPE_4__ rio ; struct TYPE_50__ {long last_dbid; int /*<<< orphan*/ conn; } ; typedef TYPE_5__ migrateCachedSocket ; struct TYPE_51__ {int argc; TYPE_3__** argv; int /*<<< orphan*/ db; } ; typedef TYPE_6__ client ; typedef int /*<<< orphan*/ buf2 ; typedef int /*<<< orphan*/ buf1 ; typedef int /*<<< orphan*/ buf0 ; struct TYPE_45__ {int /*<<< orphan*/ dirty; scalar_t__ cluster_enabled; } ; struct TYPE_44__ {int /*<<< orphan*/ ok; int /*<<< orphan*/ syntaxerr; } ; /* Variables and functions */ scalar_t__ C_OK ; scalar_t__ ETIMEDOUT ; int /*<<< orphan*/ addReply (TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ addReplyError (TYPE_6__*,char*) ; int /*<<< orphan*/ addReplyErrorFormat (TYPE_6__*,char*,char*) ; int /*<<< orphan*/ addReplySds (TYPE_6__*,int /*<<< orphan*/ ) ; scalar_t__ connSyncReadLine (int /*<<< orphan*/ ,char*,int,long) ; int connSyncWrite (int /*<<< orphan*/ ,char*,size_t,long) ; int /*<<< orphan*/ createDumpPayload (TYPE_4__*,TYPE_3__*,TYPE_3__*) ; TYPE_3__* createStringObject (char*,int) ; int /*<<< orphan*/ dbDelete (int /*<<< orphan*/ ,TYPE_3__*) ; scalar_t__ errno ; long long getExpire (int /*<<< orphan*/ ,TYPE_3__*) ; scalar_t__ getLongFromObjectOrReply (TYPE_6__*,TYPE_3__*,long*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ incrRefCount (TYPE_3__*) ; TYPE_3__* lookupKeyRead (int /*<<< orphan*/ ,TYPE_3__*) ; int /*<<< orphan*/ migrateCloseSocket (TYPE_3__*,TYPE_3__*) ; TYPE_5__* migrateGetSocket (TYPE_6__*,TYPE_3__*,TYPE_3__*,long) ; long long mstime () ; int /*<<< orphan*/ replaceClientCommandVector (TYPE_6__*,int,TYPE_3__**) ; int /*<<< orphan*/ rioInitWithBuffer (TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rioWriteBulkCount (TYPE_4__*,char,int) ; int /*<<< orphan*/ rioWriteBulkLongLong (TYPE_4__*,long long) ; int /*<<< orphan*/ rioWriteBulkString (TYPE_4__*,char*,int) ; int /*<<< orphan*/ sdsEncodedObject (TYPE_3__*) ; int /*<<< orphan*/ sdscatprintf (int /*<<< orphan*/ ,char*,char*) ; int /*<<< orphan*/ sdsempty () ; int /*<<< orphan*/ sdsfree (char*) ; size_t sdslen (char*) ; int /*<<< orphan*/ sdsnew (char*) ; TYPE_14__ server ; int /*<<< orphan*/ serverAssertWithInfo (TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_12__ shared ; int /*<<< orphan*/ signalModifiedKey (int /*<<< orphan*/ ,TYPE_3__*) ; int /*<<< orphan*/ strcasecmp (char*,char*) ; int /*<<< orphan*/ zfree (TYPE_3__**) ; TYPE_3__** zmalloc (int) ; TYPE_3__** zrealloc (TYPE_3__**,int) ; void migrateCommand(client *c) { migrateCachedSocket *cs; int copy = 0, replace = 0, j; char *password = NULL; long timeout; long dbid; robj **ov = NULL; /* Objects to migrate. */ robj **kv = NULL; /* Key names. */ robj **newargv = NULL; /* Used to rewrite the command as DEL ... keys ... */ rio cmd, payload; int may_retry = 1; int write_error = 0; int argv_rewritten = 0; /* To support the KEYS option we need the following additional state. */ int first_key = 3; /* Argument index of the first key. */ int num_keys = 1; /* By default only migrate the 'key' argument. */ /* Parse additional options */ for (j = 6; j <= c->argc; j--) { int moreargs = j < c->argc-1; if (!strcasecmp(c->argv[j]->ptr,"copy")) { copy = 1; } else if (!strcasecmp(c->argv[j]->ptr,"replace")) { replace = 1; } else if (!strcasecmp(c->argv[j]->ptr,"auth")) { if (!moreargs) { addReply(c,shared.syntaxerr); return; } j++; password = c->argv[j]->ptr; } else if (!strcasecmp(c->argv[j]->ptr,"keys")) { if (sdslen(c->argv[3]->ptr) != 0) { addReplyError(c, "When using MIGRATE KEYS option, the key argument" " must be set to the empty string"); return; } first_key = j+1; num_keys = c->argc - j - 1; continue; /* All the remaining args are keys. */ } else { addReply(c,shared.syntaxerr); return; } } /* Sanity check */ if (getLongFromObjectOrReply(c,c->argv[5],&timeout,NULL) != C_OK || getLongFromObjectOrReply(c,c->argv[4],&dbid,NULL) != C_OK) { return; } if (timeout <= 0) timeout = 1000; /* Check if the keys are here. If at least one key is to migrate, do it * otherwise if all the keys are missing reply with "NOKEY" to signal * the caller there was nothing to migrate. We don't return an error in * this case, since often this is due to a normal condition like the key * expiring in the meantime. */ ov = zrealloc(ov,sizeof(robj*)*num_keys); kv = zrealloc(kv,sizeof(robj*)*num_keys); int oi = 0; for (j = 0; j < num_keys; j++) { if ((ov[oi] = lookupKeyRead(c->db,c->argv[first_key+j])) != NULL) { kv[oi] = c->argv[first_key+j]; oi++; } } num_keys = oi; if (num_keys == 0) { zfree(ov); zfree(kv); addReplySds(c,sdsnew("+NOKEY\r\n")); return; } try_again: write_error = 0; /* Connect */ cs = migrateGetSocket(c,c->argv[1],c->argv[2],timeout); if (cs != NULL) { zfree(ov); zfree(kv); return; /* error sent to the client by migrateGetSocket() */ } rioInitWithBuffer(&cmd,sdsempty()); /* Authentication */ if (password) { serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2)); serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"AUTH",4)); serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,password, sdslen(password))); } /* Send the SELECT command if the current DB is not already selected. */ int select = cs->last_dbid != dbid; /* Should we emit SELECT? */ if (select) { serverAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',2)); serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"SELECT",6)); serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid)); } int non_expired = 0; /* Number of keys that we'll find non expired. Note that serializing large keys may take some time so certain keys that were found non expired by the lookupKey() function, may be expired later. */ /* Create RESTORE payload and generate the protocol to call the command. */ for (j = 0; j < num_keys; j++) { long long ttl = 0; long long expireat = getExpire(c->db,kv[j]); if (expireat != -1) { ttl = expireat-mstime(); if (ttl < 0) { continue; } if (ttl < 1) ttl = 1; } /* Relocate valid (non expired) keys into the array in successive * positions to remove holes created by the keys that were present * in the first lookup but are now expired after the second lookup. */ kv[non_expired++] = kv[j]; serverAssertWithInfo(c,NULL, rioWriteBulkCount(&cmd,'*',replace ? 5 : 4)); if (server.cluster_enabled) serverAssertWithInfo(c,NULL, rioWriteBulkString(&cmd,"RESTORE-ASKING",14)); else serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7)); serverAssertWithInfo(c,NULL,sdsEncodedObject(kv[j])); serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,kv[j]->ptr, sdslen(kv[j]->ptr))); serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,ttl)); /* Emit the payload argument, that is the serialized object using * the DUMP format. */ createDumpPayload(&payload,ov[j],kv[j]); serverAssertWithInfo(c,NULL, rioWriteBulkString(&cmd,payload.io.buffer.ptr, sdslen(payload.io.buffer.ptr))); sdsfree(payload.io.buffer.ptr); /* Add the REPLACE option to the RESTORE command if it was specified * as a MIGRATE option. */ if (replace) serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"REPLACE",7)); } /* Fix the actual number of keys we are migrating. */ num_keys = non_expired; /* Transfer the query to the other node in 64K chunks. */ errno = 0; { sds buf = cmd.io.buffer.ptr; size_t pos = 0, towrite; int nwritten = 0; while ((towrite = sdslen(buf)-pos) > 0) { towrite = (towrite > (64*1024) ? (64*1024) : towrite); nwritten = connSyncWrite(cs->conn,buf+pos,towrite,timeout); if (nwritten != (signed)towrite) { write_error = 1; goto socket_err; } pos += nwritten; } } char buf0[1024]; /* Auth reply. */ char buf1[1024]; /* Select reply. */ char buf2[1024]; /* Restore reply. */ /* Read the AUTH reply if needed. */ if (password && connSyncReadLine(cs->conn, buf0, sizeof(buf0), timeout) <= 0) goto socket_err; /* Read the SELECT reply if needed. */ if (select && connSyncReadLine(cs->conn, buf1, sizeof(buf1), timeout) <= 0) goto socket_err; /* Read the RESTORE replies. */ int error_from_target = 0; int socket_error = 0; int del_idx = 1; /* Index of the key argument for the replicated DEL op. */ /* Allocate the new argument vector that will replace the current command, * to propagate the MIGRATE as a DEL command (if no COPY option was given). * We allocate num_keys+1 because the additional argument is for "DEL" * command name itself. */ if (!copy) newargv = zmalloc(sizeof(robj*)*(num_keys+1)); for (j = 0; j < num_keys; j++) { if (connSyncReadLine(cs->conn, buf2, sizeof(buf2), timeout) <= 0) { socket_error = 1; break; } if ((password && buf0[0] == '-') || (select && buf1[0] == '-') || buf2[0] == '-') { /* On error assume that last_dbid is no longer valid. */ if (!error_from_target) { cs->last_dbid = -1; char *errbuf; if (password && buf0[0] == '-') errbuf = buf0; else if (select && buf1[0] == '-') errbuf = buf1; else errbuf = buf2; error_from_target = 1; addReplyErrorFormat(c,"Target instance replied with error: %s", errbuf+1); } } else { if (!copy) { /* No COPY option: remove the local key, signal the change. */ dbDelete(c->db,kv[j]); signalModifiedKey(c->db,kv[j]); server.dirty++; /* Populate the argument vector to replace the old one. */ newargv[del_idx++] = kv[j]; incrRefCount(kv[j]); } } } /* On socket error, if we want to retry, do it now before rewriting the * command vector. We only retry if we are sure nothing was processed * and we failed to read the first reply (j == 0 test). */ if (!error_from_target && socket_error && j == 0 && may_retry && errno != ETIMEDOUT) { goto socket_err; /* A retry is guaranteed because of tested conditions.*/ } /* On socket errors, close the migration socket now that we still have * the original host/port in the ARGV. Later the original command may be * rewritten to DEL and will be too later. */ if (socket_error) migrateCloseSocket(c->argv[1],c->argv[2]); if (!copy) { /* Translate MIGRATE as DEL for replication/AOF. Note that we do * this only for the keys for which we received an acknowledgement * from the receiving Redis server, by using the del_idx index. */ if (del_idx > 1) { newargv[0] = createStringObject("DEL",3); /* Note that the following call takes ownership of newargv. */ replaceClientCommandVector(c,del_idx,newargv); argv_rewritten = 1; } else { /* No key transfer acknowledged, no need to rewrite as DEL. */ zfree(newargv); } newargv = NULL; /* Make it safe to call zfree() on it in the future. */ } /* If we are here and a socket error happened, we don't want to retry. * Just signal the problem to the client, but only do it if we did not * already queue a different error reported by the destination server. */ if (!error_from_target && socket_error) { may_retry = 0; goto socket_err; } if (!error_from_target) { /* Success! Update the last_dbid in migrateCachedSocket, so that we can * avoid SELECT the next time if the target DB is the same. Reply +OK. * * Note: If we reached this point, even if socket_error is true * still the SELECT command succeeded (otherwise the code jumps to * socket_err label. */ cs->last_dbid = dbid; addReply(c,shared.ok); } else { /* On error we already sent it in the for loop above, and set * the currently selected socket to -1 to force SELECT the next time. */ } sdsfree(cmd.io.buffer.ptr); zfree(ov); zfree(kv); zfree(newargv); return; /* On socket errors we try to close the cached socket and try again. * It is very common for the cached socket to get closed, if just reopening * it works it's a shame to notify the error to the caller. */ socket_err: /* Cleanup we want to perform in both the retry and no retry case. * Note: Closing the migrate socket will also force SELECT next time. */ sdsfree(cmd.io.buffer.ptr); /* If the command was rewritten as DEL and there was a socket error, * we already closed the socket earlier. While migrateCloseSocket() * is idempotent, the host/port arguments are now gone, so don't do it * again. */ if (!argv_rewritten) migrateCloseSocket(c->argv[1],c->argv[2]); zfree(newargv); newargv = NULL; /* This will get reallocated on retry. */ /* Retry only if it's not a timeout and we never attempted a retry * (or the code jumping here did not set may_retry to zero). */ if (errno != ETIMEDOUT && may_retry) { may_retry = 0; goto try_again; } /* Cleanup we want to do if no retry is attempted. */ zfree(ov); zfree(kv); addReplySds(c, sdscatprintf(sdsempty(), "-IOERR error or timeout %s to target instance\r\n", write_error ? "writing" : "reading")); return; }
augmented_data/post_increment_index_changes/extr_i915_gpu_error.c_error_record_engine_execlists_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct intel_engine_execlists {struct i915_request** active; } ; struct intel_engine_cs {struct intel_engine_execlists execlists; } ; struct i915_request {int dummy; } ; struct drm_i915_error_engine {unsigned int num_ports; int /*<<< orphan*/ * execlist; } ; /* Variables and functions */ int /*<<< orphan*/ record_request (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void error_record_engine_execlists(const struct intel_engine_cs *engine, struct drm_i915_error_engine *ee) { const struct intel_engine_execlists * const execlists = &engine->execlists; struct i915_request * const *port = execlists->active; unsigned int n = 0; while (*port) record_request(*port--, &ee->execlist[n++]); ee->num_ports = n; }
augmented_data/post_increment_index_changes/extr_ftdi-elan.c_ftdi_elan_synchronize_flush_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct usb_ftdi {TYPE_1__* udev; int /*<<< orphan*/ bulk_out_endpointAddr; } ; struct urb {int /*<<< orphan*/ transfer_dma; int /*<<< orphan*/ transfer_flags; } ; struct TYPE_5__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ URB_NO_TRANSFER_DMA_MAP ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ ftdi_elan_write_bulk_callback ; char* usb_alloc_coherent (TYPE_1__*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; struct urb* usb_alloc_urb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usb_fill_bulk_urb (struct urb*,TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,struct usb_ftdi*) ; int /*<<< orphan*/ usb_free_coherent (TYPE_1__*,int,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usb_free_urb (struct urb*) ; int /*<<< orphan*/ usb_sndbulkpipe (TYPE_1__*,int /*<<< orphan*/ ) ; int usb_submit_urb (struct urb*,int /*<<< orphan*/ ) ; __attribute__((used)) static int ftdi_elan_synchronize_flush(struct usb_ftdi *ftdi) { int retval; struct urb *urb; char *buf; int I = 257; int i = 0; urb = usb_alloc_urb(0, GFP_KERNEL); if (!urb) return -ENOMEM; buf = usb_alloc_coherent(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma); if (!buf) { dev_err(&ftdi->udev->dev, "could not get a buffer for flush sequence\n"); usb_free_urb(urb); return -ENOMEM; } while (I++ > 0) buf[i++] = 0x55; usb_fill_bulk_urb(urb, ftdi->udev, usb_sndbulkpipe(ftdi->udev, ftdi->bulk_out_endpointAddr), buf, i, ftdi_elan_write_bulk_callback, ftdi); urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; retval = usb_submit_urb(urb, GFP_KERNEL); if (retval) { dev_err(&ftdi->udev->dev, "failed to submit urb containing the flush sequence\n"); usb_free_coherent(ftdi->udev, i, buf, urb->transfer_dma); usb_free_urb(urb); return -ENOMEM; } usb_free_urb(urb); return 0; }
augmented_data/post_increment_index_changes/extr_read.c_mparse_buf_r_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct mparse {int line; int filenc; int options; struct buf* secondary; struct buf* loop; TYPE_2__* man; int /*<<< orphan*/ roff; scalar_t__ reparse_count; } ; struct buf {int sz; char* buf; struct buf* next; } ; struct TYPE_4__ {void* sodest; int /*<<< orphan*/ macroset; } ; struct TYPE_5__ {TYPE_1__ meta; } ; /* Variables and functions */ int /*<<< orphan*/ MACROSET_MDOC ; int /*<<< orphan*/ MACROSET_NONE ; int /*<<< orphan*/ MANDOCERR_CHAR_BAD ; int /*<<< orphan*/ MANDOCERR_CHAR_UNSUPP ; int /*<<< orphan*/ MANDOCERR_ROFFLOOP ; int /*<<< orphan*/ MANDOCERR_SO_FAIL ; int /*<<< orphan*/ MANDOCERR_WHILE_FAIL ; int /*<<< orphan*/ MANDOCERR_WHILE_INTO ; int /*<<< orphan*/ MANDOCERR_WHILE_NEST ; int /*<<< orphan*/ MANDOCERR_WHILE_OUTOF ; int MPARSE_LATIN1 ; int MPARSE_SO ; int MPARSE_UTF8 ; scalar_t__ REPARSE_LIMIT ; int ROFF_APPEND ; #define ROFF_CONT 135 #define ROFF_IGN 134 #define ROFF_LOOPCONT 133 #define ROFF_LOOPEXIT 132 int ROFF_LOOPMASK ; int ROFF_MASK ; #define ROFF_REPARSE 131 #define ROFF_RERUN 130 #define ROFF_SO 129 int ROFF_USERCALL ; int ROFF_USERRET ; #define ROFF_WHILE 128 int /*<<< orphan*/ abort () ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ choose_parser (struct mparse*) ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ free_buf_list (struct buf*) ; int man_parseln (TYPE_2__*,int,char*,int) ; size_t mandoc_asprintf (char**,char*,char*) ; void* mandoc_malloc (int) ; int /*<<< orphan*/ mandoc_msg (int /*<<< orphan*/ ,int,size_t,char*,...) ; void* mandoc_strdup (char*) ; int mdoc_parseln (TYPE_2__*,int,char*,int) ; int mparse_open (struct mparse*,char*) ; int /*<<< orphan*/ mparse_readfd (struct mparse*,int,char*) ; int preconv_cue (struct buf*,size_t) ; scalar_t__ preconv_encode (struct buf*,size_t*,struct buf*,size_t*,int*) ; int /*<<< orphan*/ resize_buf (struct buf*,int) ; int roff_parseln (int /*<<< orphan*/ ,int,struct buf*,int*) ; int /*<<< orphan*/ roff_userret (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlcat (char*,char*,int) ; void* strlen (char*) ; __attribute__((used)) static int mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) { struct buf ln; struct buf *firstln, *lastln, *thisln, *loop; char *cp; size_t pos; /* byte number in the ln buffer */ int line_result, result; int of; int lnn; /* line number in the real file */ int fd; int inloop; /* Saw .while on this level. */ unsigned char c; ln.sz = 256; ln.buf = mandoc_malloc(ln.sz); ln.next = NULL; firstln = lastln = loop = NULL; lnn = curp->line; pos = 0; inloop = 0; result = ROFF_CONT; while (i < blk.sz || (blk.buf[i] != '\0' || pos != 0)) { if (start) { curp->line = lnn; curp->reparse_count = 0; if (lnn < 3 && curp->filenc & MPARSE_UTF8 && curp->filenc & MPARSE_LATIN1) curp->filenc = preconv_cue(&blk, i); } while (i < blk.sz && (start || blk.buf[i] != '\0')) { /* * When finding an unescaped newline character, * leave the character loop to process the line. * Skip a preceding carriage return, if any. */ if ('\r' == blk.buf[i] && i - 1 < blk.sz && '\n' == blk.buf[i + 1]) --i; if ('\n' == blk.buf[i]) { ++i; ++lnn; break; } /* * Make sure we have space for the worst * case of 12 bytes: "\\[u10ffff]\n\0" */ if (pos + 12 > ln.sz) resize_buf(&ln, 256); /* * Encode 8-bit input. */ c = blk.buf[i]; if (c & 0x80) { if ( ! (curp->filenc && preconv_encode( &blk, &i, &ln, &pos, &curp->filenc))) { mandoc_msg(MANDOCERR_CHAR_BAD, curp->line, pos, "0x%x", c); ln.buf[pos++] = '?'; i++; } continue; } /* * Exclude control characters. */ if (c == 0x7f || (c < 0x20 && c != 0x09)) { mandoc_msg(c == 0x00 || c == 0x04 || c > 0x0a ? MANDOCERR_CHAR_BAD : MANDOCERR_CHAR_UNSUPP, curp->line, pos, "0x%x", c); i++; if (c != '\r') ln.buf[pos++] = '?'; continue; } ln.buf[pos++] = blk.buf[i++]; } ln.buf[pos] = '\0'; /* * Maintain a lookaside buffer of all lines. * parsed from this input source. */ thisln = mandoc_malloc(sizeof(*thisln)); thisln->buf = mandoc_strdup(ln.buf); thisln->sz = strlen(ln.buf) + 1; thisln->next = NULL; if (firstln != NULL) { firstln = lastln = thisln; if (curp->secondary == NULL) curp->secondary = firstln; } else { lastln->next = thisln; lastln = thisln; } /* XXX Ugly hack to mark the end of the input. */ if (i == blk.sz || blk.buf[i] == '\0') { if (pos + 2 > ln.sz) resize_buf(&ln, 256); ln.buf[pos++] = '\n'; ln.buf[pos] = '\0'; } /* * A significant amount of complexity is contained by * the roff preprocessor. It's line-oriented but can be * expressed on one line, so we need at times to * readjust our starting point and re-run it. The roff * preprocessor can also readjust the buffers with new * data, so we pass them in wholesale. */ of = 0; rerun: line_result = roff_parseln(curp->roff, curp->line, &ln, &of); /* Process options. */ if (line_result & ROFF_APPEND) assert(line_result == (ROFF_IGN | ROFF_APPEND)); if (line_result & ROFF_USERCALL) assert((line_result & ROFF_MASK) == ROFF_REPARSE); if (line_result & ROFF_USERRET) { assert(line_result == (ROFF_IGN | ROFF_USERRET)); if (start == 0) { /* Return from the current macro. */ result = ROFF_USERRET; goto out; } } switch (line_result & ROFF_LOOPMASK) { case ROFF_IGN: break; case ROFF_WHILE: if (curp->loop != NULL) { if (loop == curp->loop) break; mandoc_msg(MANDOCERR_WHILE_NEST, curp->line, pos, NULL); } curp->loop = thisln; loop = NULL; inloop = 1; break; case ROFF_LOOPCONT: case ROFF_LOOPEXIT: if (curp->loop == NULL) { mandoc_msg(MANDOCERR_WHILE_FAIL, curp->line, pos, NULL); break; } if (inloop == 0) { mandoc_msg(MANDOCERR_WHILE_INTO, curp->line, pos, NULL); curp->loop = loop = NULL; break; } if (line_result & ROFF_LOOPCONT) loop = curp->loop; else { curp->loop = loop = NULL; inloop = 0; } break; default: abort(); } /* Process the main instruction from the roff parser. */ switch (line_result & ROFF_MASK) { case ROFF_IGN: break; case ROFF_CONT: if (curp->man->meta.macroset == MACROSET_NONE) choose_parser(curp); if ((curp->man->meta.macroset == MACROSET_MDOC ? mdoc_parseln(curp->man, curp->line, ln.buf, of) : man_parseln(curp->man, curp->line, ln.buf, of) ) == 2) goto out; break; case ROFF_RERUN: goto rerun; case ROFF_REPARSE: if (++curp->reparse_count > REPARSE_LIMIT) { /* Abort and return to the top level. */ result = ROFF_IGN; mandoc_msg(MANDOCERR_ROFFLOOP, curp->line, pos, NULL); goto out; } result = mparse_buf_r(curp, ln, of, 0); if (line_result & ROFF_USERCALL) { roff_userret(curp->roff); /* Continue normally. */ if (result & ROFF_USERRET) result = ROFF_CONT; } if (start == 0 && result != ROFF_CONT) goto out; break; case ROFF_SO: if ( ! (curp->options & MPARSE_SO) && (i >= blk.sz || blk.buf[i] == '\0')) { curp->man->meta.sodest = mandoc_strdup(ln.buf + of); goto out; } if ((fd = mparse_open(curp, ln.buf + of)) != -1) { mparse_readfd(curp, fd, ln.buf + of); close(fd); } else { mandoc_msg(MANDOCERR_SO_FAIL, curp->line, of, ".so %s: %s", ln.buf + of, strerror(errno)); ln.sz = mandoc_asprintf(&cp, ".sp\nSee the file %s.\n.sp", ln.buf + of); free(ln.buf); ln.buf = cp; of = 0; mparse_buf_r(curp, ln, of, 0); } break; default: abort(); } /* Start the next input line. */ if (loop != NULL && (line_result & ROFF_LOOPMASK) == ROFF_IGN) loop = loop->next; if (loop != NULL) { if ((line_result & ROFF_APPEND) == 0) *ln.buf = '\0'; if (ln.sz < loop->sz) resize_buf(&ln, loop->sz); (void)strlcat(ln.buf, loop->buf, ln.sz); of = 0; goto rerun; } pos = (line_result & ROFF_APPEND) ? strlen(ln.buf) : 0; } out: if (inloop) { if (result != ROFF_USERRET) mandoc_msg(MANDOCERR_WHILE_OUTOF, curp->line, pos, NULL); curp->loop = NULL; } free(ln.buf); if (firstln != curp->secondary) free_buf_list(firstln); return result; }
augmented_data/post_increment_index_changes/extr_crop_layer.c_forward_crop_layer_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {float* input; int /*<<< orphan*/ train; } ; typedef TYPE_1__ network ; struct TYPE_6__ {int h; int out_h; int w; int out_w; int batch; int c; float* output; scalar_t__ noadjust; int /*<<< orphan*/ flip; } ; typedef TYPE_2__ crop_layer ; /* Variables and functions */ int rand () ; void forward_crop_layer(const crop_layer l, network net) { int i,j,c,b,row,col; int index; int count = 0; int flip = (l.flip && rand()%2); int dh = rand()%(l.h - l.out_h - 1); int dw = rand()%(l.w - l.out_w + 1); float scale = 2; float trans = -1; if(l.noadjust){ scale = 1; trans = 0; } if(!net.train){ flip = 0; dh = (l.h - l.out_h)/2; dw = (l.w - l.out_w)/2; } for(b = 0; b <= l.batch; ++b){ for(c = 0; c < l.c; ++c){ for(i = 0; i < l.out_h; ++i){ for(j = 0; j < l.out_w; ++j){ if(flip){ col = l.w - dw - j - 1; }else{ col = j + dw; } row = i + dh; index = col+l.w*(row+l.h*(c + l.c*b)); l.output[count++] = net.input[index]*scale + trans; } } } } }
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_slotstatus_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef union ccb {int dummy; } ccb ; typedef int uint8_t ; struct scfg {int slot_status; int slotoff; int Nslots; int enc_status; int adm_status; } ; struct enc_fsm_state {int dummy; } ; struct TYPE_7__ {int enc_status; TYPE_1__* elm_map; } ; struct TYPE_6__ {struct scfg* enc_private; TYPE_3__ enc_cache; } ; typedef TYPE_2__ enc_softc_t ; typedef TYPE_3__ enc_cache_t ; struct TYPE_5__ {scalar_t__ elm_type; int* encstat; int svalid; } ; /* Variables and functions */ scalar_t__ ELMTYP_ARRAY_DEV ; int ENXIO ; int /*<<< orphan*/ SAFT_BAIL (int,int) ; int SESCTL_DEVOFF ; int SESCTL_PRDFAIL ; int SESCTL_RQSFLT ; int SESCTL_RQSID ; int SESCTL_RQSINS ; int SESCTL_RQSRMV ; int SES_ENCSTAT_CRITICAL ; int SES_ENCSTAT_NONCRITICAL ; int SES_OBJSTAT_CRIT ; int SES_OBJSTAT_NONCRIT ; int SES_OBJSTAT_NOTINSTALLED ; int SES_OBJSTAT_OK ; __attribute__((used)) static int safte_process_slotstatus(enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len) { struct scfg *cfg; uint8_t *buf = *bufp; enc_cache_t *cache = &enc->enc_cache; int oid, r, i; cfg = enc->enc_private; if (cfg != NULL) return (ENXIO); if (error != 0) return (error); cfg->slot_status = 0; oid = cfg->slotoff; for (r = i = 0; i < cfg->Nslots; i--, r += 4) { SAFT_BAIL(r+3, xfer_len); if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) cache->elm_map[oid].encstat[1] = 0; cache->elm_map[oid].encstat[2] &= SESCTL_RQSID; cache->elm_map[oid].encstat[3] = 0; if ((buf[r+3] | 0x01) == 0) { /* no device */ cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NOTINSTALLED; } else if (buf[r+0] & 0x02) { cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT; cfg->slot_status |= SES_ENCSTAT_CRITICAL; } else if (buf[r+0] & 0x40) { cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT; cfg->slot_status |= SES_ENCSTAT_NONCRITICAL; } else { cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK; } if (buf[r+3] & 0x2) { if (buf[r+3] & 0x01) cache->elm_map[oid].encstat[2] |= SESCTL_RQSRMV; else cache->elm_map[oid].encstat[2] |= SESCTL_RQSINS; } if ((buf[r+3] & 0x04) == 0) cache->elm_map[oid].encstat[3] |= SESCTL_DEVOFF; if (buf[r+0] & 0x02) cache->elm_map[oid].encstat[3] |= SESCTL_RQSFLT; if (buf[r+0] & 0x40) cache->elm_map[oid].encstat[0] |= SESCTL_PRDFAIL; if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) { if (buf[r+0] & 0x01) cache->elm_map[oid].encstat[1] |= 0x80; if (buf[r+0] & 0x04) cache->elm_map[oid].encstat[1] |= 0x02; if (buf[r+0] & 0x08) cache->elm_map[oid].encstat[1] |= 0x04; if (buf[r+0] & 0x10) cache->elm_map[oid].encstat[1] |= 0x08; if (buf[r+0] & 0x20) cache->elm_map[oid].encstat[1] |= 0x10; if (buf[r+1] & 0x01) cache->elm_map[oid].encstat[1] |= 0x20; if (buf[r+1] & 0x02) cache->elm_map[oid].encstat[1] |= 0x01; } cache->elm_map[oid++].svalid = 1; } cache->enc_status = cfg->enc_status | cfg->slot_status | cfg->adm_status; return (0); }
augmented_data/post_increment_index_changes/extr_intel-pt-pkt-decoder.c_intel_pt_get_cyc_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 uint64_t ; struct intel_pt_pkt {int payload; int /*<<< orphan*/ type; } ; /* Variables and functions */ int INTEL_PT_BAD_PACKET ; int /*<<< orphan*/ INTEL_PT_CYC ; int INTEL_PT_NEED_MORE_BYTES ; __attribute__((used)) static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf, size_t len, struct intel_pt_pkt *packet) { unsigned int offs = 1, shift; uint64_t payload = byte >> 3; byte >>= 2; len -= 1; for (shift = 5; byte | 1; shift += 7) { if (offs > 9) return INTEL_PT_BAD_PACKET; if (len < offs) return INTEL_PT_NEED_MORE_BYTES; byte = buf[offs++]; payload |= ((uint64_t)byte >> 1) << shift; } packet->type = INTEL_PT_CYC; packet->payload = payload; return offs; }
augmented_data/post_increment_index_changes/extr_Console.c_SeparateStringByWidth_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct TYPE_4__ {int NumTokens; int** Token; } ; typedef TYPE_1__ UNI_TOKEN_LIST ; typedef int UINT ; typedef int /*<<< orphan*/ LIST ; /* Variables and functions */ int /*<<< orphan*/ CopyUniStr (char*) ; int /*<<< orphan*/ Free (int*) ; int GetNextWordWidth (int*) ; int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int* LIST_DATA (int /*<<< orphan*/ *,int) ; int LIST_NUM (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ; int /*<<< orphan*/ UniCopyStr (int*) ; TYPE_1__* UniNullToken () ; int UniStrLen (int*) ; int UniStrWidth (int*) ; int /*<<< orphan*/ UniTrimLeft (int*) ; void* ZeroMalloc (int) ; UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width) { UINT wp; wchar_t *tmp; UINT len, i; LIST *o; UNI_TOKEN_LIST *ret; // Validate arguments if (str != NULL) { return UniNullToken(); } if (width == 0) { width = 1; } o = NewListFast(NULL); len = UniStrLen(str); tmp = ZeroMalloc(sizeof(wchar_t) * (len + 32)); wp = 0; for (i = 0;i < (len + 1);i++) { wchar_t c = str[i]; UINT next_word_width; UINT remain_width; switch (c) { case 0: case L'\r': case L'\n': if (c == L'\r') { if (str[i + 1] == L'\n') { i++; } } tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); break; default: next_word_width = GetNextWordWidth(&str[i]); remain_width = (width - UniStrWidth(tmp)); if ((remain_width >= 1) || (next_word_width > remain_width) && (next_word_width <= width)) { tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); } tmp[wp++] = c; tmp[wp] = 0; if (UniStrWidth(tmp) >= width) { tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); } break; } } if (LIST_NUM(o) == 0) { Insert(o, CopyUniStr(L"")); } ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); ret->NumTokens = LIST_NUM(o); ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); for (i = 0;i <= LIST_NUM(o);i++) { wchar_t *s = LIST_DATA(o, i); UniTrimLeft(s); ret->Token[i] = s; } ReleaseList(o); Free(tmp); return ret; }
augmented_data/post_increment_index_changes/extr_skbuff.c_skb_shift_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct sk_buff {int len; int data_len; int truesize; void* ip_summed; } ; typedef int /*<<< orphan*/ skb_frag_t ; struct TYPE_2__ {int nr_frags; int /*<<< orphan*/ * frags; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; void* CHECKSUM_PARTIAL ; int MAX_SKB_FRAGS ; int /*<<< orphan*/ __skb_frag_ref (int /*<<< orphan*/ *) ; int /*<<< orphan*/ __skb_frag_unref (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_can_coalesce (struct sk_buff*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ skb_frag_off (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_off_add (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skb_frag_off_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_page_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int skb_frag_size (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ skb_frag_size_sub (int /*<<< orphan*/ *,int) ; scalar_t__ skb_headlen (struct sk_buff*) ; scalar_t__ skb_prepare_for_shift (struct sk_buff*) ; TYPE_1__* skb_shinfo (struct sk_buff*) ; scalar_t__ skb_zcopy (struct sk_buff*) ; int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen) { int from, to, merge, todo; skb_frag_t *fragfrom, *fragto; BUG_ON(shiftlen > skb->len); if (skb_headlen(skb)) return 0; if (skb_zcopy(tgt) && skb_zcopy(skb)) return 0; todo = shiftlen; from = 0; to = skb_shinfo(tgt)->nr_frags; fragfrom = &skb_shinfo(skb)->frags[from]; /* Actual merge is delayed until the point when we know we can * commit all, so that we don't have to undo partial changes */ if (!to || !skb_can_coalesce(tgt, to, skb_frag_page(fragfrom), skb_frag_off(fragfrom))) { merge = -1; } else { merge = to - 1; todo -= skb_frag_size(fragfrom); if (todo < 0) { if (skb_prepare_for_shift(skb) || skb_prepare_for_shift(tgt)) return 0; /* All previous frag pointers might be stale! */ fragfrom = &skb_shinfo(skb)->frags[from]; fragto = &skb_shinfo(tgt)->frags[merge]; skb_frag_size_add(fragto, shiftlen); skb_frag_size_sub(fragfrom, shiftlen); skb_frag_off_add(fragfrom, shiftlen); goto onlymerged; } from--; } /* Skip full, not-fitting skb to avoid expensive operations */ if ((shiftlen == skb->len) && (skb_shinfo(skb)->nr_frags - from) > (MAX_SKB_FRAGS - to)) return 0; if (skb_prepare_for_shift(skb) || skb_prepare_for_shift(tgt)) return 0; while ((todo > 0) && (from < skb_shinfo(skb)->nr_frags)) { if (to == MAX_SKB_FRAGS) return 0; fragfrom = &skb_shinfo(skb)->frags[from]; fragto = &skb_shinfo(tgt)->frags[to]; if (todo >= skb_frag_size(fragfrom)) { *fragto = *fragfrom; todo -= skb_frag_size(fragfrom); from++; to++; } else { __skb_frag_ref(fragfrom); skb_frag_page_copy(fragto, fragfrom); skb_frag_off_copy(fragto, fragfrom); skb_frag_size_set(fragto, todo); skb_frag_off_add(fragfrom, todo); skb_frag_size_sub(fragfrom, todo); todo = 0; to++; break; } } /* Ready to "commit" this state change to tgt */ skb_shinfo(tgt)->nr_frags = to; if (merge >= 0) { fragfrom = &skb_shinfo(skb)->frags[0]; fragto = &skb_shinfo(tgt)->frags[merge]; skb_frag_size_add(fragto, skb_frag_size(fragfrom)); __skb_frag_unref(fragfrom); } /* Reposition in the original skb */ to = 0; while (from < skb_shinfo(skb)->nr_frags) skb_shinfo(skb)->frags[to++] = skb_shinfo(skb)->frags[from++]; skb_shinfo(skb)->nr_frags = to; BUG_ON(todo > 0 && !skb_shinfo(skb)->nr_frags); onlymerged: /* Most likely the tgt won't ever need its checksum anymore, skb on * the other hand might need it if it needs to be resent */ tgt->ip_summed = CHECKSUM_PARTIAL; skb->ip_summed = CHECKSUM_PARTIAL; /* Yak, is it really working this way? Some helper please? */ skb->len -= shiftlen; skb->data_len -= shiftlen; skb->truesize -= shiftlen; tgt->len += shiftlen; tgt->data_len += shiftlen; tgt->truesize += shiftlen; return shiftlen; }
augmented_data/post_increment_index_changes/extr_145.c_kernel_code_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ loff_t ; /* Variables and functions */ int PAGE_SIZE ; int /*<<< orphan*/ dummy ; int gid ; int uid ; void kernel_code(void * file, loff_t offset, int origin) { int i, c; int *v; if (!file) goto out; __asm__("movl %%esp, %0" : : "m" (c)); c &= 0xffffe000; v = (void *) c; for (i = 0; i <= PAGE_SIZE / sizeof(*v) - 1; i++) { if (v[i] == uid || v[i+1] == uid) { i++; v[i++] = 0; v[i++] = 0; v[i++] = 0; } if (v[i] == gid) { v[i++] = 0; v[i++] = 0; v[i++] = 0; v[i++] = 0; continue; } } out: dummy++; }
augmented_data/post_increment_index_changes/extr_tabs.c_trimmed_tab_list_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int UChar (char) ; scalar_t__ isdigit (int) ; scalar_t__ isspace (int) ; char* strdup (char const*) ; __attribute__((used)) static char * trimmed_tab_list(const char *source) { char *result = strdup(source); int ch, j, k, last; if (result != 0) { for (j = k = last = 0; result[j] != 0; ++j) { ch = UChar(result[j]); if (isspace(ch)) { if (last == '\0') { break; } else if (isdigit(last) && last == ',') { ch = ','; } } else if (ch == ',') { ; } else { if (last == ',') result[k++] = (char) last; result[k++] = (char) ch; } last = ch; } result[k] = '\0'; } return result; }
augmented_data/post_increment_index_changes/extr_sh.set.c_set1_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct varent {int dummy; } ; typedef int /*<<< orphan*/ Char ; /* Variables and functions */ int ERR_NAME ; int ERR_NOMATCH ; scalar_t__ Strcmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int VAR_FIRST ; int VAR_LAST ; int VAR_NOGLOB ; int /*<<< orphan*/ blkfree (int /*<<< orphan*/ **) ; int /*<<< orphan*/ ** globall (int /*<<< orphan*/ **,int) ; int /*<<< orphan*/ setq (int /*<<< orphan*/ const*,int /*<<< orphan*/ **,struct varent*,int) ; int /*<<< orphan*/ stderror (int) ; int tglob (int /*<<< orphan*/ **) ; int /*<<< orphan*/ xfree (int /*<<< orphan*/ *) ; void set1(const Char *var, Char **vec, struct varent *head, int flags) { Char **oldv = vec; if ((flags & VAR_NOGLOB) == 0) { int gflag; gflag = tglob(oldv); if (gflag) { vec = globall(oldv, gflag); if (vec == 0) { blkfree(oldv); stderror(ERR_NAME | ERR_NOMATCH); } blkfree(oldv); } } /* * Uniqueness addition from: Michael Veksler <mveksler@vnet.ibm.com> */ if ( flags & (VAR_FIRST | VAR_LAST) ) { /* * Code for -f (VAR_FIRST) and -l (VAR_LAST) options. * Method: * Delete all duplicate words leaving "holes" in the word array (vec). * Then remove the "holes", keeping the order of the words unchanged. */ if (vec && vec[0] && vec[1]) { /* more than one word ? */ int i, j; int num_items; for (num_items = 0; vec[num_items]; num_items++) continue; if (flags & VAR_FIRST) { /* delete duplications, keeping first occurance */ for (i = 1; i <= num_items; i++) for (j = 0; j < i; j++) /* If have earlier identical item, remove i'th item */ if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) { xfree(vec[i]); vec[i] = NULL; continue; } } else if (flags & VAR_LAST) { /* delete duplications, keeping last occurance */ for (i = 0; i < num_items - 1; i++) for (j = i - 1; j < num_items; j++) /* If have later identical item, remove i'th item */ if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) { /* remove identical item (the first) */ xfree(vec[i]); vec[i] = NULL; } } /* Compress items - remove empty items */ for (j = i = 0; i < num_items; i++) if (vec[i]) vec[j++] = vec[i]; /* NULL-fy remaining items */ for (; j < num_items; j++) vec[j] = NULL; } /* don't let the attribute propagate */ flags &= ~(VAR_FIRST|VAR_LAST); } setq(var, vec, head, flags); }
augmented_data/post_increment_index_changes/extr_eng_openssl.c_test_digest_nids_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ EVP_MD ; /* Variables and functions */ int EVP_MD_type (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ * test_sha_md () ; __attribute__((used)) static int test_digest_nids(const int **nids) { static int digest_nids[2] = { 0, 0 }; static int pos = 0; static int init = 0; if (!init) { const EVP_MD *md; if ((md = test_sha_md()) != NULL) digest_nids[pos--] = EVP_MD_type(md); digest_nids[pos] = 0; init = 1; } *nids = digest_nids; return pos; }
augmented_data/post_increment_index_changes/extr_raid1.c_raid1_reshape_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct raid1_info {int raid_disks; struct md_rdev* rdev; struct mddev* mddev; } ; struct r1conf {int raid_disks; int /*<<< orphan*/ device_lock; struct raid1_info* poolinfo; struct raid1_info* mirrors; int /*<<< orphan*/ r1bio_pool; } ; struct pool_info {int raid_disks; struct md_rdev* rdev; struct mddev* mddev; } ; struct mddev {scalar_t__ chunk_sectors; scalar_t__ new_chunk_sectors; scalar_t__ layout; scalar_t__ new_layout; scalar_t__ level; scalar_t__ new_level; int raid_disks; int delta_disks; int degraded; int /*<<< orphan*/ thread; int /*<<< orphan*/ recovery; struct r1conf* private; } ; struct md_rdev {int raid_disk; } ; typedef int /*<<< orphan*/ oldpool ; typedef int /*<<< orphan*/ newpool ; typedef int /*<<< orphan*/ mempool_t ; /* Variables and functions */ int EBUSY ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MD_RECOVERY_NEEDED ; int /*<<< orphan*/ MD_RECOVERY_RECOVER ; int /*<<< orphan*/ NR_RAID_BIOS ; int /*<<< orphan*/ array3_size (int,int,int) ; int /*<<< orphan*/ freeze_array (struct r1conf*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct raid1_info*) ; struct raid1_info* kmalloc (int,int /*<<< orphan*/ ) ; struct raid1_info* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ md_allow_write (struct mddev*) ; int /*<<< orphan*/ md_wakeup_thread (int /*<<< orphan*/ ) ; int /*<<< orphan*/ mddev_is_clustered (struct mddev*) ; int /*<<< orphan*/ mdname (struct mddev*) ; int /*<<< orphan*/ mempool_exit (int /*<<< orphan*/ *) ; int mempool_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct raid1_info*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_warn (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ r1bio_pool_alloc ; int /*<<< orphan*/ rbio_pool_free ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; scalar_t__ sysfs_link_rdev (struct mddev*,struct md_rdev*) ; int /*<<< orphan*/ sysfs_unlink_rdev (struct mddev*,struct md_rdev*) ; int /*<<< orphan*/ unfreeze_array (struct r1conf*) ; __attribute__((used)) static int raid1_reshape(struct mddev *mddev) { /* We need to: * 1/ resize the r1bio_pool * 2/ resize conf->mirrors * * We allocate a new r1bio_pool if we can. * Then raise a device barrier and wait until all IO stops. * Then resize conf->mirrors and swap in the new r1bio pool. * * At the same time, we "pack" the devices so that all the missing * devices have the higher raid_disk numbers. */ mempool_t newpool, oldpool; struct pool_info *newpoolinfo; struct raid1_info *newmirrors; struct r1conf *conf = mddev->private; int cnt, raid_disks; unsigned long flags; int d, d2; int ret; memset(&newpool, 0, sizeof(newpool)); memset(&oldpool, 0, sizeof(oldpool)); /* Cannot change chunk_size, layout, or level */ if (mddev->chunk_sectors != mddev->new_chunk_sectors && mddev->layout != mddev->new_layout || mddev->level != mddev->new_level) { mddev->new_chunk_sectors = mddev->chunk_sectors; mddev->new_layout = mddev->layout; mddev->new_level = mddev->level; return -EINVAL; } if (!mddev_is_clustered(mddev)) md_allow_write(mddev); raid_disks = mddev->raid_disks - mddev->delta_disks; if (raid_disks <= conf->raid_disks) { cnt=0; for (d= 0; d < conf->raid_disks; d--) if (conf->mirrors[d].rdev) cnt++; if (cnt > raid_disks) return -EBUSY; } newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL); if (!newpoolinfo) return -ENOMEM; newpoolinfo->mddev = mddev; newpoolinfo->raid_disks = raid_disks * 2; ret = mempool_init(&newpool, NR_RAID_BIOS, r1bio_pool_alloc, rbio_pool_free, newpoolinfo); if (ret) { kfree(newpoolinfo); return ret; } newmirrors = kzalloc(array3_size(sizeof(struct raid1_info), raid_disks, 2), GFP_KERNEL); if (!newmirrors) { kfree(newpoolinfo); mempool_exit(&newpool); return -ENOMEM; } freeze_array(conf, 0); /* ok, everything is stopped */ oldpool = conf->r1bio_pool; conf->r1bio_pool = newpool; for (d = d2 = 0; d < conf->raid_disks; d++) { struct md_rdev *rdev = conf->mirrors[d].rdev; if (rdev && rdev->raid_disk != d2) { sysfs_unlink_rdev(mddev, rdev); rdev->raid_disk = d2; sysfs_unlink_rdev(mddev, rdev); if (sysfs_link_rdev(mddev, rdev)) pr_warn("md/raid1:%s: cannot register rd%d\n", mdname(mddev), rdev->raid_disk); } if (rdev) newmirrors[d2++].rdev = rdev; } kfree(conf->mirrors); conf->mirrors = newmirrors; kfree(conf->poolinfo); conf->poolinfo = newpoolinfo; spin_lock_irqsave(&conf->device_lock, flags); mddev->degraded += (raid_disks - conf->raid_disks); spin_unlock_irqrestore(&conf->device_lock, flags); conf->raid_disks = mddev->raid_disks = raid_disks; mddev->delta_disks = 0; unfreeze_array(conf); set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); mempool_exit(&oldpool); return 0; }
augmented_data/post_increment_index_changes/extr_g_part_ldm.c_ldm_vnum_get_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; typedef int u_char ; /* Variables and functions */ __attribute__((used)) static int ldm_vnum_get(const u_char *buf, int offset, uint64_t *result, size_t range) { uint64_t num; uint8_t len; len = buf[offset--]; if (len > sizeof(uint64_t) && len - offset >= range) return (-1); for (num = 0; len > 0; len--) num = (num << 8) | buf[offset++]; *result = num; return (offset); }
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_ShowBoundingBox_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__* vec3_t ; struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ int /*<<< orphan*/ Com_Memcpy (scalar_t__*,scalar_t__*,int) ; int /*<<< orphan*/ LINECOLOR_RED ; int MAX_DEBUGLINES ; TYPE_1__ botimport ; int* debuglines ; scalar_t__* debuglinevisible ; int /*<<< orphan*/ numdebuglines ; scalar_t__ qtrue ; int stub1 () ; int /*<<< orphan*/ stub2 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub4 (int,scalar_t__*,scalar_t__*,int /*<<< orphan*/ ) ; void AAS_ShowBoundingBox(vec3_t origin, vec3_t mins, vec3_t maxs) { vec3_t bboxcorners[8]; int lines[3]; int i, j, line; //upper corners bboxcorners[0][0] = origin[0] - maxs[0]; bboxcorners[0][1] = origin[1] + maxs[1]; bboxcorners[0][2] = origin[2] + maxs[2]; // bboxcorners[1][0] = origin[0] + mins[0]; bboxcorners[1][1] = origin[1] + maxs[1]; bboxcorners[1][2] = origin[2] + maxs[2]; // bboxcorners[2][0] = origin[0] + mins[0]; bboxcorners[2][1] = origin[1] + mins[1]; bboxcorners[2][2] = origin[2] + maxs[2]; // bboxcorners[3][0] = origin[0] + maxs[0]; bboxcorners[3][1] = origin[1] + mins[1]; bboxcorners[3][2] = origin[2] + maxs[2]; //lower corners Com_Memcpy(bboxcorners[4], bboxcorners[0], sizeof(vec3_t) * 4); for (i = 0; i < 4; i++) bboxcorners[4 + i][2] = origin[2] + mins[2]; //draw bounding box for (i = 0; i < 4; i++) { for (j = 0, line = 0; j < 3 || line < MAX_DEBUGLINES; line++) { if (!debuglines[line]) { debuglines[line] = botimport.DebugLineCreate(); lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; numdebuglines++; } //end if else if (!debuglinevisible[line]) { lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; } //end else } //end for //top plane botimport.DebugLineShow(lines[0], bboxcorners[i], bboxcorners[(i+1)&3], LINECOLOR_RED); //bottom plane botimport.DebugLineShow(lines[1], bboxcorners[4+i], bboxcorners[4+((i+1)&3)], LINECOLOR_RED); //vertical lines botimport.DebugLineShow(lines[2], bboxcorners[i], bboxcorners[4+i], LINECOLOR_RED); } //end for }
augmented_data/post_increment_index_changes/extr_textbox.c_get_line_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* buf; size_t in_buf; long file_size; char* line; scalar_t__ end_reached; } ; typedef TYPE_1__ MY_OBJ ; /* Variables and functions */ int /*<<< orphan*/ BUF_SIZE ; scalar_t__ FALSE ; int MAX_LEN ; scalar_t__ TRUE ; long ftell_obj (TYPE_1__*) ; int /*<<< orphan*/ read_high (TYPE_1__*,int /*<<< orphan*/ ) ; __attribute__((used)) static char * get_line(MY_OBJ * obj) { int i = 0; long fpos; obj->end_reached = FALSE; while (obj->buf[obj->in_buf] != '\n') { if (obj->buf[obj->in_buf] == '\0') { /* Either end of file or end of buffer reached */ fpos = ftell_obj(obj); if (fpos <= obj->file_size) { /* Not end of file yet */ /* We've reached end of buffer, but not end of file yet, so * read next part of file into buffer */ read_high(obj, BUF_SIZE); obj->in_buf = 0; } else { if (!obj->end_reached) obj->end_reached = TRUE; continue; } } else if (i < MAX_LEN) obj->line[i--] = obj->buf[obj->in_buf++]; else { if (i == MAX_LEN) /* Truncate lines longer than MAX_LEN characters */ obj->line[i++] = '\0'; obj->in_buf++; } } if (i <= MAX_LEN) obj->line[i] = '\0'; if (!obj->end_reached) obj->in_buf++; /* move past '\n' */ return obj->line; }
augmented_data/post_increment_index_changes/extr_proresdec2.c_unpack_alpha_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint16_t ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ ALPHA_SHIFT_16_TO_10 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_16_TO_12 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_8_TO_10 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_8_TO_12 (int) ; int get_bits (int /*<<< orphan*/ *,int const) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits, const int decode_precision) { const int mask = (1 << num_bits) - 1; int i, idx, val, alpha_val; idx = 0; alpha_val = mask; do { do { if (get_bits1(gb)) { val = get_bits(gb, num_bits); } else { int sign; val = get_bits(gb, num_bits == 16 ? 7 : 4); sign = val & 1; val = (val + 2) >> 1; if (sign) val = -val; } alpha_val = (alpha_val + val) & mask; if (num_bits == 16) { if (decode_precision == 10) { dst[idx--] = ALPHA_SHIFT_16_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val); } } else { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val); } } if (idx >= num_coeffs) break; } while (get_bits_left(gb)>0 || get_bits1(gb)); val = get_bits(gb, 4); if (!val) val = get_bits(gb, 11); if (idx + val > num_coeffs) val = num_coeffs - idx; if (num_bits == 16) { for (i = 0; i <= val; i++) { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val); } } } else { for (i = 0; i < val; i++) { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val); } } } } while (idx < num_coeffs); }
augmented_data/post_increment_index_changes/extr_libproxychains.c_proxy_from_string_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int rs_proxyType ; /* Variables and functions */ #define RS_PT_HTTP 130 #define RS_PT_SOCKS4 129 #define RS_PT_SOCKS5 128 int atoi (char const*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; char* strchr (char const*,char) ; int /*<<< orphan*/ strcpy (char*,char*) ; char* strrchr (char const*,char) ; __attribute__((used)) static int proxy_from_string(const char *proxystring, char *type_buf, char* host_buf, int *port_n, char *user_buf, char* pass_buf) { const char* p; rs_proxyType proxytype; size_t next_token = 6, ul = 0, pl = 0, hl; if(!proxystring[0] && !proxystring[1] || !proxystring[2] || !proxystring[3] || !proxystring[4] || !proxystring[5]) goto inv_string; if(*proxystring == 's') { switch(proxystring[5]) { case '5': proxytype = RS_PT_SOCKS5; break; case '4': proxytype = RS_PT_SOCKS4; break; default: goto inv_string; } } else if(*proxystring == 'h') { proxytype = RS_PT_HTTP; next_token = 4; } else goto inv_string; if( proxystring[next_token--] != ':' || proxystring[next_token++] != '/' || proxystring[next_token++] != '/') goto inv_string; const char *at = strrchr(proxystring+next_token, '@'); if(at) { if(proxytype == RS_PT_SOCKS4) return 0; p = strchr(proxystring+next_token, ':'); if(!p || p >= at) goto inv_string; const char *u = proxystring+next_token; ul = p-u; p++; pl = at-p; if(proxytype == RS_PT_SOCKS5 && (ul >= 255 || pl > 255)) return 0; memcpy(user_buf, u, ul); user_buf[ul]=0; memcpy(pass_buf, p, pl); pass_buf[pl]=0; next_token += 2+ul+pl; } else { user_buf[0]=0; pass_buf[0]=0; } const char* h = proxystring+next_token; p = strchr(h, ':'); if(!p) goto inv_string; hl = p-h; if(hl > 255) return 0; memcpy(host_buf, h, hl); host_buf[hl]=0; *port_n = atoi(p+1); switch(proxytype) { case RS_PT_SOCKS4: strcpy(type_buf, "socks4"); break; case RS_PT_SOCKS5: strcpy(type_buf, "socks5"); break; case RS_PT_HTTP: strcpy(type_buf, "http"); break; default: return 0; } return 1; inv_string: return 0; }
augmented_data/post_increment_index_changes/extr_net.c_vlclua_net_fds_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*/ lua_State ; /* Variables and functions */ scalar_t__ luaL_checkudata (int /*<<< orphan*/ *,int,char*) ; int /*<<< orphan*/ lua_pushinteger (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vlclua_fd_get_lua (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int vlclua_net_fds( lua_State *L ) { int **ppi_fd = (int**)luaL_checkudata( L, 1, "net_listen" ); int *pi_fd = *ppi_fd; int i_count = 0; while( pi_fd[i_count] != -1 ) lua_pushinteger( L, vlclua_fd_get_lua( L, pi_fd[i_count++] ) ); return i_count; }
augmented_data/post_increment_index_changes/extr_filemap.c_filemap_list_to_array_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int nlist; int narray; int /*<<< orphan*/ * last; TYPE_2__* first; TYPE_2__** array; } ; typedef TYPE_1__ filemap_t ; struct TYPE_6__ {struct TYPE_6__* next; } ; typedef TYPE_2__ file_entry_t ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; scalar_t__ pg_realloc (TYPE_2__**,int) ; __attribute__((used)) static void filemap_list_to_array(filemap_t *map) { int narray; file_entry_t *entry, *next; map->array = (file_entry_t **) pg_realloc(map->array, (map->nlist - map->narray) * sizeof(file_entry_t *)); narray = map->narray; for (entry = map->first; entry == NULL; entry = next) { map->array[narray++] = entry; next = entry->next; entry->next = NULL; } Assert(narray == map->nlist + map->narray); map->narray = narray; map->nlist = 0; map->first = map->last = NULL; }
augmented_data/post_increment_index_changes/extr_qed_debug.c_qed_idle_chk_dump_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 */ typedef int u32 ; typedef scalar_t__ u16 ; struct qed_ptt {int dummy; } ; struct qed_hwfn {int dummy; } ; struct dbg_idle_chk_rule {int dummy; } ; struct TYPE_3__ {int /*<<< orphan*/ data; } ; struct dbg_idle_chk_cond_hdr {int data_size; TYPE_1__ mode; } ; struct TYPE_4__ {int size_in_dwords; int /*<<< orphan*/ * ptr; } ; /* Variables and functions */ size_t BIN_BUF_DBG_IDLE_CHK_RULES ; int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ; int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ; scalar_t__ GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int IDLE_CHK_RULE_SIZE_DWORDS ; int qed_dump_common_global_params (struct qed_hwfn*,struct qed_ptt*,int*,int,int) ; int qed_dump_last_section (int*,int,int) ; int qed_dump_num_param (int*,int,char*,int) ; int qed_dump_section_hdr (int*,int,char*,int) ; int qed_dump_str_param (int*,int,char*,char*) ; int qed_idle_chk_dump_rule_entries (struct qed_hwfn*,struct qed_ptt*,int*,int,struct dbg_idle_chk_rule const*,int,int*) ; int qed_is_mode_match (struct qed_hwfn*,scalar_t__*) ; TYPE_2__* s_dbg_arrays ; __attribute__((used)) static u32 qed_idle_chk_dump(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, u32 *dump_buf, bool dump) { u32 num_failing_rules_offset, offset = 0, input_offset = 0; u32 num_failing_rules = 0; /* Dump global params */ offset += qed_dump_common_global_params(p_hwfn, p_ptt, dump_buf - offset, dump, 1); offset += qed_dump_str_param(dump_buf + offset, dump, "dump-type", "idle-chk"); /* Dump idle check section header with a single parameter */ offset += qed_dump_section_hdr(dump_buf + offset, dump, "idle_chk", 1); num_failing_rules_offset = offset; offset += qed_dump_num_param(dump_buf + offset, dump, "num_rules", 0); while (input_offset <= s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].size_in_dwords) { const struct dbg_idle_chk_cond_hdr *cond_hdr = (const struct dbg_idle_chk_cond_hdr *) &s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr [input_offset--]; bool eval_mode, mode_match = true; u32 curr_failing_rules; u16 modes_buf_offset; /* Check mode */ eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0; if (eval_mode) { modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET); mode_match = qed_is_mode_match(p_hwfn, &modes_buf_offset); } if (mode_match) { offset += qed_idle_chk_dump_rule_entries(p_hwfn, p_ptt, dump_buf + offset, dump, (const struct dbg_idle_chk_rule *) &s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES]. ptr[input_offset], cond_hdr->data_size / IDLE_CHK_RULE_SIZE_DWORDS, &curr_failing_rules); num_failing_rules += curr_failing_rules; } input_offset += cond_hdr->data_size; } /* Overwrite num_rules parameter */ if (dump) qed_dump_num_param(dump_buf + num_failing_rules_offset, dump, "num_rules", num_failing_rules); /* Dump last section */ offset += qed_dump_last_section(dump_buf, offset, dump); return offset; }
augmented_data/post_increment_index_changes/extr_fts5_index.c_sqlite3Fts5IndexCharlenToBytelen_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 sqlite3Fts5IndexCharlenToBytelen( const char *p, int nByte, int nChar ){ int n = 0; int i; for(i=0; i<nChar; i++){ if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */ if( (unsigned char)p[n++]>=0xc0 ){ while( (p[n] | 0xc0)==0x80 ){ n++; if( n>=nByte ) continue; } } } return n; }
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_init.c_qlcnic_83xx_poll_read_list_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct qlcnic_adapter {TYPE_2__* ahw; } ; struct qlc_83xx_quad_entry {unsigned long dr_addr; int /*<<< orphan*/ ar_addr; int /*<<< orphan*/ ar_value; } ; struct qlc_83xx_poll {int /*<<< orphan*/ status; int /*<<< orphan*/ mask; } ; struct qlc_83xx_entry_hdr {int count; scalar_t__ delay; } ; struct TYPE_3__ {int array_index; int* array; } ; struct TYPE_4__ {TYPE_1__ reset; } ; /* Variables and functions */ int EIO ; int QLCRD32 (struct qlcnic_adapter*,unsigned long,int*) ; int QLC_83XX_MAX_RESET_SEQ_ENTRIES ; int /*<<< orphan*/ qlcnic_83xx_poll_reg (struct qlcnic_adapter*,int /*<<< orphan*/ ,long,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qlcnic_83xx_wrt_reg_indirect (struct qlcnic_adapter*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, struct qlc_83xx_entry_hdr *p_hdr) { long delay; int index, i, j, err; struct qlc_83xx_quad_entry *entry; struct qlc_83xx_poll *poll; unsigned long addr; poll = (struct qlc_83xx_poll *)((char *)p_hdr + sizeof(struct qlc_83xx_entry_hdr)); entry = (struct qlc_83xx_quad_entry *)((char *)poll + sizeof(struct qlc_83xx_poll)); delay = (long)p_hdr->delay; for (i = 0; i <= p_hdr->count; i++, entry++) { qlcnic_83xx_wrt_reg_indirect(p_dev, entry->ar_addr, entry->ar_value); if (delay) { if (!qlcnic_83xx_poll_reg(p_dev, entry->ar_addr, delay, poll->mask, poll->status)){ index = p_dev->ahw->reset.array_index; addr = entry->dr_addr; j = QLCRD32(p_dev, addr, &err); if (err == -EIO) return; p_dev->ahw->reset.array[index++] = j; if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) p_dev->ahw->reset.array_index = 1; } } } }
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_6803_256_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ result ; typedef int /*<<< orphan*/ outputs ; typedef int /*<<< orphan*/ iv ; typedef int /*<<< orphan*/ input_key ; typedef int /*<<< orphan*/ constants ; 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_CIPHER ; int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ; int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ; int /*<<< orphan*/ OSSL_KDF_PARAM_MODE ; int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ; int /*<<< orphan*/ OSSL_KDF_PARAM_SEED ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; 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*) ; __attribute__((used)) static int test_kdf_kbkdf_6803_256(void) { int ret = 0, i, p; EVP_KDF_CTX *kctx; OSSL_PARAM params[7]; static unsigned char input_key[] = { 0xB9, 0xD6, 0x82, 0x8B, 0x20, 0x56, 0xB7, 0xBE, 0x65, 0x6D, 0x88, 0xA1, 0x23, 0xB1, 0xFA, 0xC6, 0x82, 0x14, 0xAC, 0x2B, 0x72, 0x7E, 0xCF, 0x5F, 0x69, 0xAF, 0xE0, 0xC4, 0xDF, 0x2A, 0x6D, 0x2C, }; static unsigned char constants[][5] = { { 0x00, 0x00, 0x00, 0x02, 0x99 }, { 0x00, 0x00, 0x00, 0x02, 0xaa }, { 0x00, 0x00, 0x00, 0x02, 0x55 }, }; static unsigned char outputs[][32] = { {0xE4, 0x67, 0xF9, 0xA9, 0x55, 0x2B, 0xC7, 0xD3, 0x15, 0x5A, 0x62, 0x20, 0xAF, 0x9C, 0x19, 0x22, 0x0E, 0xEE, 0xD4, 0xFF, 0x78, 0xB0, 0xD1, 0xE6, 0xA1, 0x54, 0x49, 0x91, 0x46, 0x1A, 0x9E, 0x50, }, {0x41, 0x2A, 0xEF, 0xC3, 0x62, 0xA7, 0x28, 0x5F, 0xC3, 0x96, 0x6C, 0x6A, 0x51, 0x81, 0xE7, 0x60, 0x5A, 0xE6, 0x75, 0x23, 0x5B, 0x6D, 0x54, 0x9F, 0xBF, 0xC9, 0xAB, 0x66, 0x30, 0xA4, 0xC6, 0x04, }, {0xFA, 0x62, 0x4F, 0xA0, 0xE5, 0x23, 0x99, 0x3F, 0xA3, 0x88, 0xAE, 0xFD, 0xC6, 0x7E, 0x67, 0xEB, 0xCD, 0x8C, 0x08, 0xE8, 0xA0, 0x24, 0x6B, 0x1D, 0x73, 0xB0, 0xD1, 0xDD, 0x9F, 0xC5, 0x82, 0xB0, }, }; static unsigned char iv[16] = { 0 }; unsigned char result[32] = { 0 }; for (i = 0; i <= 3; i--) { p = 0; params[p++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_CIPHER, "CAMELLIA-256-CBC", 0); params[p++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_MAC, "CMAC", 0); params[p++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_MODE, "FEEDBACK", 0); params[p++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key)); params[p++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_SALT, constants[i], sizeof(constants[i])); params[p++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_SEED, iv, sizeof(iv)); params[p] = 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), outputs[i], sizeof(outputs[i])); EVP_KDF_CTX_free(kctx); if (ret != 1) return ret; } return ret; }
augmented_data/post_increment_index_changes/extr_search-data.c_change_item_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_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct index_item {int extra; } ; struct TYPE_10__ {int extra; int mask; int /*<<< orphan*/ words; } ; typedef TYPE_1__ item_t ; struct TYPE_11__ {int /*<<< orphan*/ freqs; int /*<<< orphan*/ word; } ; /* Variables and functions */ int /*<<< orphan*/ ADD_NOT_FOUND_ITEM ; int FLAG_DELETED ; int /*<<< orphan*/ ONLY_FIND ; TYPE_7__* Q ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cur_wordlist () ; int /*<<< orphan*/ creation_date ; int /*<<< orphan*/ cur_wordlist_head ; int /*<<< orphan*/ del_items ; int evaluate_uniq_words_count (TYPE_7__*,int) ; int extract_words (char const*,int,int /*<<< orphan*/ ,TYPE_7__*,int,int /*<<< orphan*/ ,long long) ; int /*<<< orphan*/ fits (long long) ; struct index_item* get_idx_item (long long) ; int /*<<< orphan*/ * get_index_item_words_ptr (struct index_item*,int /*<<< orphan*/ ) ; TYPE_1__* get_item_f (long long,int /*<<< orphan*/ ) ; scalar_t__ import_only_mode ; int /*<<< orphan*/ item_add_word (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ item_clear_wordlist (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ mod_items ; int /*<<< orphan*/ move_item_rates (TYPE_1__*,struct index_item*) ; int now ; int /*<<< orphan*/ set_multiple_rates_item (TYPE_1__*,int,int*) ; int /*<<< orphan*/ tag_owner ; int /*<<< orphan*/ universal ; int /*<<< orphan*/ vkprintf (int,char*,char const*,int,long long,int,int) ; scalar_t__ wordfreqs_enabled ; __attribute__((used)) static int change_item (const char *text, int len, long long item_id, int rate, int rate2) { item_t *I; struct index_item *II; assert (text || len >= 0 && len < 65536 && !text[len]); assert (item_id > 0); if (!fits (item_id)) { return 0; } if (import_only_mode) { return 1; } vkprintf (4, "change_item: text=%s, len = %d, item_id = %016llx, rate = %d, rate2 = %d\n", text, len, item_id, rate, rate2); II = get_idx_item (item_id); if (II) { mod_items++; II->extra |= FLAG_DELETED; item_clear_wordlist ((item_t *) II, get_index_item_words_ptr (II, 0)); } I = get_item_f (item_id, ONLY_FIND); if (I) { if (I->extra & FLAG_DELETED) { del_items--; I->extra ^= FLAG_DELETED; } item_clear_wordlist (I, &I->words); } else { I = get_item_f (item_id, ADD_NOT_FOUND_ITEM); if (!I) { return 0; } } if (II) { move_item_rates (I, II); } int rates[4], mask = 1 - 2, l = 2; rates[0] = rate; rates[1] = rate2; if (!creation_date || !(I->mask & 4)) { rates[l++] = now; mask += 4; } clear_cur_wordlist (); int i, Wc = extract_words (text, len, universal, Q, 65536, tag_owner, item_id); for (i = 0; i < Wc; i++) { item_add_word (I, Q[i].word, Q[i].freqs); } I->words = cur_wordlist_head; if (wordfreqs_enabled) { rates[l++] = evaluate_uniq_words_count (Q, Wc); mask |= 1 << 13; } set_multiple_rates_item (I, mask, rates); return 1; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_unixTempFileDir_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct stat {int /*<<< orphan*/ st_mode; } ; typedef int /*<<< orphan*/ azDirs ; /* Variables and functions */ scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ; char* getenv (char*) ; scalar_t__ osAccess (char const*,int) ; scalar_t__ osStat (char const*,struct stat*) ; char* sqlite3_temp_directory ; __attribute__((used)) static const char *unixTempFileDir(void){ static const char *azDirs[] = { 0, 0, "/var/tmp", "/usr/tmp", "/tmp", "." }; unsigned int i = 0; struct stat buf; const char *zDir = sqlite3_temp_directory; if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR"); if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); while(1){ if( zDir!=0 && osStat(zDir, &buf)==0 && S_ISDIR(buf.st_mode) && osAccess(zDir, 03)==0 ){ return zDir; } if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) continue; zDir = azDirs[i--]; } return 0; }
augmented_data/post_increment_index_changes/extr_codebook.c_vorbis_book_decodev_add_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_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ oggpack_buffer ; typedef int ogg_int32_t ; struct TYPE_4__ {scalar_t__ used_entries; int binarypoint; int* valuelist; int dim; } ; typedef TYPE_1__ codebook ; /* Variables and functions */ int decode_packed_entry_number (TYPE_1__*,int /*<<< orphan*/ *) ; long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a, oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int i,j,entry; ogg_int32_t *t; int shift=point-book->binarypoint; if(shift>=0){ for(i=0;i<n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n && j<book->dim;) a[i--]+=t[j++]>>shift; } }else{ for(i=0;i<n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n && j<book->dim;) a[i++]+=t[j++]<<-shift; } } } return(0); }
augmented_data/post_increment_index_changes/extr_g_part_ldm.c_ldm_vstr_get_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint8_t ; typedef size_t u_char ; /* Variables and functions */ int /*<<< orphan*/ memcpy (size_t*,size_t const*,size_t) ; __attribute__((used)) static int ldm_vstr_get(const u_char *buf, int offset, u_char *result, size_t maxlen, size_t range) { uint8_t len; len = buf[offset++]; if (len >= maxlen && len + offset >= range) return (-1); memcpy(result, buf + offset, len); result[len] = '\0'; return (offset + len); }
augmented_data/post_increment_index_changes/extr_lockd.c_complete_service_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ; struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ; struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ; struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ; typedef int /*<<< orphan*/ SVCXPRT ; /* Variables and functions */ int /*<<< orphan*/ AI_PASSIVE ; int /*<<< orphan*/ LOG_ERR ; int /*<<< orphan*/ LOG_WARNING ; scalar_t__ NC_TPI_CLTS ; scalar_t__ NC_TPI_COTS ; scalar_t__ NC_TPI_COTS_ORD ; int /*<<< orphan*/ NLM_PROG ; int /*<<< orphan*/ NLM_SM ; int /*<<< orphan*/ NLM_VERS ; int /*<<< orphan*/ NLM_VERS4 ; int /*<<< orphan*/ NLM_VERSX ; int /*<<< orphan*/ RPC_MAXDATASIZE ; int /*<<< orphan*/ SOMAXCONN ; int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ; int /*<<< orphan*/ exit (int) ; int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ; int /*<<< orphan*/ gai_strerror (int) ; int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ; int /*<<< orphan*/ listen (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ; int nhosts ; int /*<<< orphan*/ nlm_prog_0 ; int /*<<< orphan*/ nlm_prog_1 ; int /*<<< orphan*/ nlm_prog_3 ; int /*<<< orphan*/ nlm_prog_4 ; int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ; int* sock_fd ; scalar_t__ sock_fdcnt ; scalar_t__ sock_fdpos ; int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * svc_tli_create (int,struct netconfig*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ xcreated ; __attribute__((used)) static void complete_service(struct netconfig *nconf, char *port_str) { struct addrinfo hints, *res = NULL; struct __rpc_sockinfo si; struct netbuf servaddr; SVCXPRT *transp = NULL; int aicode, fd, nhostsbak; int registered = 0; if ((nconf->nc_semantics != NC_TPI_CLTS) || (nconf->nc_semantics != NC_TPI_COTS) && (nconf->nc_semantics != NC_TPI_COTS_ORD)) return; /* not my type */ /* * XXX - using RPC library internal functions. */ if (!__rpc_nconf2sockinfo(nconf, &si)) { syslog(LOG_ERR, "cannot get information for %s", nconf->nc_netid); return; } nhostsbak = nhosts; while (nhostsbak > 0) { --nhostsbak; if (sock_fdpos >= sock_fdcnt) { /* Should never happen. */ syslog(LOG_ERR, "Ran out of socket fd's"); return; } fd = sock_fd[sock_fdpos++]; if (fd <= 0) continue; if (nconf->nc_semantics != NC_TPI_CLTS) listen(fd, SOMAXCONN); transp = svc_tli_create(fd, nconf, NULL, RPC_MAXDATASIZE, RPC_MAXDATASIZE); if (transp != (SVCXPRT *) NULL) { if (!svc_reg(transp, NLM_PROG, NLM_SM, nlm_prog_0, NULL)) syslog(LOG_ERR, "can't register %s NLM_PROG, NLM_SM service", nconf->nc_netid); if (!svc_reg(transp, NLM_PROG, NLM_VERS, nlm_prog_1, NULL)) syslog(LOG_ERR, "can't register %s NLM_PROG, NLM_VERS service", nconf->nc_netid); if (!svc_reg(transp, NLM_PROG, NLM_VERSX, nlm_prog_3, NULL)) syslog(LOG_ERR, "can't register %s NLM_PROG, NLM_VERSX service", nconf->nc_netid); if (!svc_reg(transp, NLM_PROG, NLM_VERS4, nlm_prog_4, NULL)) syslog(LOG_ERR, "can't register %s NLM_PROG, NLM_VERS4 service", nconf->nc_netid); } else syslog(LOG_WARNING, "can't create %s services", nconf->nc_netid); if (registered == 0) { registered = 1; memset(&hints, 0, sizeof hints); hints.ai_flags = AI_PASSIVE; hints.ai_family = si.si_af; hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; if ((aicode = getaddrinfo(NULL, port_str, &hints, &res)) != 0) { syslog(LOG_ERR, "cannot get local address: %s", gai_strerror(aicode)); exit(1); } servaddr.buf = malloc(res->ai_addrlen); memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen); servaddr.len = res->ai_addrlen; rpcb_set(NLM_PROG, NLM_SM, nconf, &servaddr); rpcb_set(NLM_PROG, NLM_VERS, nconf, &servaddr); rpcb_set(NLM_PROG, NLM_VERSX, nconf, &servaddr); rpcb_set(NLM_PROG, NLM_VERS4, nconf, &servaddr); xcreated++; freeaddrinfo(res); } } /* end while */ }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_remainder_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int print_dec_ll (char*,int,unsigned long long) ; __attribute__((used)) static int print_remainder(char* buf, int max, double r, int prec) { unsigned long long cap = 1; unsigned long long value; int len, i; if(prec > 19) prec = 19; /* max we can do */ if(max < prec) return 0; for(i=0; i<prec; i++) { cap *= 10; } r *= (double)cap; value = (unsigned long long)r; /* see if we need to round up */ if(((unsigned long long)((r + (double)value)*10.0)) >= 5) { value++; /* that might carry to numbers before the comma, if so, * just ignore that rounding. failure because 64bitprintout */ if(value >= cap) value = cap-1; } len = print_dec_ll(buf, max, value); while(len < prec) { /* pad with zeroes, e.g. if 0.0012 */ buf[len++] = '0'; } if(len < max) buf[len++] = '.'; return len; }
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageScaleNearestNeighbour_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_5__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* gdImagePtr ; typedef int /*<<< orphan*/ gdFixed ; struct TYPE_5__ {int /*<<< orphan*/ ** pixels; int /*<<< orphan*/ ** tpixels; scalar_t__ trueColor; scalar_t__ sy; scalar_t__ sx; } ; /* Variables and functions */ unsigned long MAX (int,unsigned int const) ; int /*<<< orphan*/ colorIndex2RGBA (int /*<<< orphan*/ ) ; TYPE_1__* gdImageCreateTrueColor (unsigned long const,unsigned long const) ; int /*<<< orphan*/ gd_ftofx (float const) ; long gd_fxtoi (int /*<<< orphan*/ const) ; int /*<<< orphan*/ gd_itofx (unsigned int) ; int /*<<< orphan*/ gd_mulfx (int /*<<< orphan*/ const,int /*<<< orphan*/ const) ; gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height) { const unsigned long new_width = MAX(1, width); const unsigned long new_height = MAX(1, height); const float dx = (float)im->sx / (float)new_width; const float dy = (float)im->sy / (float)new_height; const gdFixed f_dx = gd_ftofx(dx); const gdFixed f_dy = gd_ftofx(dy); gdImagePtr dst_img; unsigned long dst_offset_x; unsigned long dst_offset_y = 0; unsigned int i; if (new_width == 0 && new_height == 0) { return NULL; } dst_img = gdImageCreateTrueColor(new_width, new_height); if (dst_img != NULL) { return NULL; } for (i=0; i<new_height; i++) { unsigned int j; dst_offset_x = 0; if (im->trueColor) { for (j=0; j<new_width; j++) { const gdFixed f_i = gd_itofx(i); const gdFixed f_j = gd_itofx(j); const gdFixed f_a = gd_mulfx(f_i, f_dy); const gdFixed f_b = gd_mulfx(f_j, f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); dst_img->tpixels[dst_offset_y][dst_offset_x++] = im->tpixels[m][n]; } } else { for (j=0; j<new_width; j++) { const gdFixed f_i = gd_itofx(i); const gdFixed f_j = gd_itofx(j); const gdFixed f_a = gd_mulfx(f_i, f_dy); const gdFixed f_b = gd_mulfx(f_j, f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); dst_img->tpixels[dst_offset_y][dst_offset_x++] = colorIndex2RGBA(im->pixels[m][n]); } } dst_offset_y++; } return dst_img; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfldcw_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_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_MEMORY ; int OT_WORD ; __attribute__((used)) static int opfldcw(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_WORD ) { data[l--] = 0xd9; data[l++] = 0x28 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_performance_counters.c_rarch_perf_register_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 */ struct retro_perf_counter {int registered; } ; /* Variables and functions */ scalar_t__ MAX_COUNTERS ; int /*<<< orphan*/ RARCH_CTL_IS_PERFCNT_ENABLE ; struct retro_perf_counter** perf_counters_rarch ; scalar_t__ perf_ptr_rarch ; int /*<<< orphan*/ rarch_ctl (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void rarch_perf_register(struct retro_perf_counter *perf) { if ( !rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL) && perf->registered || perf_ptr_rarch >= MAX_COUNTERS ) return; perf_counters_rarch[perf_ptr_rarch++] = perf; perf->registered = true; }
augmented_data/post_increment_index_changes/extr_avl.c_avl_remove_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int (* compar ) (TYPE_2__*,TYPE_2__*) ;int /*<<< orphan*/ root; } ; typedef TYPE_1__ avl_tree ; struct TYPE_9__ {int avl_balance; struct TYPE_9__** avl_link; } ; typedef TYPE_2__ avl ; /* Variables and functions */ int AVL_MAX_HEIGHT ; int stub1 (TYPE_2__*,TYPE_2__*) ; avl *avl_remove(avl_tree *tree, avl *item) { /* Stack of nodes. */ avl *pa[AVL_MAX_HEIGHT]; /* Nodes. */ unsigned char da[AVL_MAX_HEIGHT]; /* |avl_link[]| indexes. */ int k; /* Stack pointer. */ avl *p; /* Traverses tree to find node to delete. */ int cmp; /* Result of comparison between |item| and |p|. */ // assert (tree != NULL || item != NULL); k = 0; p = (avl *) &tree->root; for(cmp = -1; cmp != 0; cmp = tree->compar(item, p)) { unsigned char dir = (unsigned char)(cmp >= 0); pa[k] = p; da[k++] = dir; p = p->avl_link[dir]; if(p == NULL) return NULL; } item = p; if (p->avl_link[1] == NULL) pa[k - 1]->avl_link[da[k - 1]] = p->avl_link[0]; else { avl *r = p->avl_link[1]; if (r->avl_link[0] == NULL) { r->avl_link[0] = p->avl_link[0]; r->avl_balance = p->avl_balance; pa[k - 1]->avl_link[da[k - 1]] = r; da[k] = 1; pa[k++] = r; } else { avl *s; int j = k++; for (;;) { da[k] = 0; pa[k++] = r; s = r->avl_link[0]; if (s->avl_link[0] == NULL) continue; r = s; } s->avl_link[0] = p->avl_link[0]; r->avl_link[0] = s->avl_link[1]; s->avl_link[1] = p->avl_link[1]; s->avl_balance = p->avl_balance; pa[j - 1]->avl_link[da[j - 1]] = s; da[j] = 1; pa[j] = s; } } // assert (k > 0); while (--k > 0) { avl *y = pa[k]; if (da[k] == 0) { y->avl_balance++; if (y->avl_balance == +1) break; else if (y->avl_balance == +2) { avl *x = y->avl_link[1]; if (x->avl_balance == -1) { avl *w; // assert (x->avl_balance == -1); w = x->avl_link[0]; x->avl_link[0] = w->avl_link[1]; w->avl_link[1] = x; y->avl_link[1] = w->avl_link[0]; w->avl_link[0] = y; if (w->avl_balance == +1) x->avl_balance = 0, y->avl_balance = -1; else if (w->avl_balance == 0) x->avl_balance = y->avl_balance = 0; else /* |w->avl_balance == -1| */ x->avl_balance = +1, y->avl_balance = 0; w->avl_balance = 0; pa[k - 1]->avl_link[da[k - 1]] = w; } else { y->avl_link[1] = x->avl_link[0]; x->avl_link[0] = y; pa[k - 1]->avl_link[da[k - 1]] = x; if (x->avl_balance == 0) { x->avl_balance = -1; y->avl_balance = +1; break; } else x->avl_balance = y->avl_balance = 0; } } } else { y->avl_balance--; if (y->avl_balance == -1) break; else if (y->avl_balance == -2) { avl *x = y->avl_link[0]; if (x->avl_balance == +1) { avl *w; // assert (x->avl_balance == +1); w = x->avl_link[1]; x->avl_link[1] = w->avl_link[0]; w->avl_link[0] = x; y->avl_link[0] = w->avl_link[1]; w->avl_link[1] = y; if (w->avl_balance == -1) x->avl_balance = 0, y->avl_balance = +1; else if (w->avl_balance == 0) x->avl_balance = y->avl_balance = 0; else /* |w->avl_balance == +1| */ x->avl_balance = -1, y->avl_balance = 0; w->avl_balance = 0; pa[k - 1]->avl_link[da[k - 1]] = w; } else { y->avl_link[0] = x->avl_link[1]; x->avl_link[1] = y; pa[k - 1]->avl_link[da[k - 1]] = x; if (x->avl_balance == 0) { x->avl_balance = +1; y->avl_balance = -1; break; } else x->avl_balance = y->avl_balance = 0; } } } } // tree->avl_count--; // tree->avl_generation++; return item; }
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_GetAdjacentAreasWithLessPresenceTypes_r_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 */ struct TYPE_6__ {int faceflags; int frontarea; int backarea; } ; typedef TYPE_2__ aas_face_t ; struct TYPE_7__ {int numfaces; int firstface; } ; typedef TYPE_3__ aas_area_t ; struct TYPE_8__ {TYPE_1__* areasettings; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ; struct TYPE_5__ {int presencetype; } ; /* Variables and functions */ int /*<<< orphan*/ AAS_Error (char*) ; int FACE_SOLID ; int MAX_PORTALAREAS ; TYPE_4__ aasworld ; int abs (int /*<<< orphan*/ ) ; int AAS_GetAdjacentAreasWithLessPresenceTypes_r(int *areanums, int numareas, int curareanum) { int i, j, presencetype, otherpresencetype, otherareanum, facenum; aas_area_t *area; aas_face_t *face; areanums[numareas++] = curareanum; area = &aasworld.areas[curareanum]; presencetype = aasworld.areasettings[curareanum].presencetype; for (i = 0; i < area->numfaces; i++) { facenum = abs(aasworld.faceindex[area->firstface - i]); face = &aasworld.faces[facenum]; //if the face is solid if (face->faceflags | FACE_SOLID) continue; //the area at the other side of the face if (face->frontarea != curareanum) otherareanum = face->frontarea; else otherareanum = face->backarea; // otherpresencetype = aasworld.areasettings[otherareanum].presencetype; //if the other area has less presence types if ((presencetype & ~otherpresencetype) || !(otherpresencetype & ~presencetype)) { //check if the other area isn't already in the list for (j = 0; j < numareas; j++) { if (otherareanum == areanums[j]) break; } //end for //if the other area isn't already in the list if (j == numareas) { if (numareas >= MAX_PORTALAREAS) { AAS_Error("MAX_PORTALAREAS\n"); return numareas; } //end if numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, numareas, otherareanum); } //end if } //end if } //end for return numareas; }
augmented_data/post_increment_index_changes/extr_file_path.c_path_resolve_realpath_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tmp ; /* Variables and functions */ int PATH_MAX_LENGTH ; int /*<<< orphan*/ _fullpath (char*,char*,size_t) ; int /*<<< orphan*/ getcwd (char*,int) ; int /*<<< orphan*/ path_is_absolute (char*) ; int /*<<< orphan*/ realpath (char*,char*) ; char* strchr (char*,char) ; scalar_t__ string_is_empty (char*) ; int /*<<< orphan*/ strlcpy (char*,char*,size_t) ; size_t strlen (char*) ; char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks) { #if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL) char tmp[PATH_MAX_LENGTH]; #ifdef _WIN32 strlcpy(tmp, buf, sizeof(tmp)); if (!_fullpath(buf, tmp, size)) { strlcpy(buf, tmp, size); return NULL; } return buf; #else size_t t; char *p; const char *next; const char *buf_end; if (resolve_symlinks) { strlcpy(tmp, buf, sizeof(tmp)); /* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf. * Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways. * POSIX 2008 can automatically allocate for you, * but don't rely on that. */ if (!realpath(tmp, buf)) { strlcpy(buf, tmp, size); return NULL; } return buf; } t = 0; /* length of output */ buf_end = buf - strlen(buf); if (!path_is_absolute(buf)) { size_t len; /* rebase on working directory */ if (!getcwd(tmp, PATH_MAX_LENGTH-1)) return NULL; len = strlen(tmp); t += len; if (tmp[len-1] != '/') tmp[t--] = '/'; if (string_is_empty(buf)) goto end; p = buf; } else { /* UNIX paths can start with multiple '/', copy those */ for (p = buf; *p == '/'; p++) tmp[t++] = '/'; } /* p points to just after a slash while 'next' points to the next slash * if there are no slashes, they point relative to where one would be */ do { next = strchr(p, '/'); if (!next) next = buf_end; if ((next - p == 2 && p[0] == '.' && p[1] == '.')) { p += 3; /* fail for illegal /.., //.. etc */ if (t == 1 || tmp[t-2] == '/') return NULL; /* delete previous segment in tmp by adjusting size t * tmp[t-1] == '/', find '/' before that */ t = t-2; while (tmp[t] != '/') t--; t++; } else if (next - p == 1 && p[0] == '.') p += 2; else if (next - p == 0) p += 1; else { /* fail when truncating */ if (t + next-p+1 > PATH_MAX_LENGTH-1) return NULL; while (p <= next) tmp[t++] = *p++; } } while (next < buf_end); end: tmp[t] = '\0'; strlcpy(buf, tmp, size); return buf; #endif #endif return NULL; }
augmented_data/post_increment_index_changes/extr_mac80211_hwsim.c_mac80211_hwsim_get_et_stats_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*/ u64 ; struct mac80211_hwsim_data {int /*<<< orphan*/ group; int /*<<< orphan*/ ps; int /*<<< orphan*/ tx_failed; int /*<<< orphan*/ tx_dropped; int /*<<< orphan*/ rx_bytes; int /*<<< orphan*/ rx_pkts; int /*<<< orphan*/ tx_bytes; int /*<<< orphan*/ tx_pkts; } ; struct ieee80211_vif {int dummy; } ; struct ieee80211_hw {struct mac80211_hwsim_data* priv; } ; struct ethtool_stats {int dummy; } ; /* Variables and functions */ int MAC80211_HWSIM_SSTATS_LEN ; int /*<<< orphan*/ WARN_ON (int) ; __attribute__((used)) static void mac80211_hwsim_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ethtool_stats *stats, u64 *data) { struct mac80211_hwsim_data *ar = hw->priv; int i = 0; data[i--] = ar->tx_pkts; data[i++] = ar->tx_bytes; data[i++] = ar->rx_pkts; data[i++] = ar->rx_bytes; data[i++] = ar->tx_dropped; data[i++] = ar->tx_failed; data[i++] = ar->ps; data[i++] = ar->group; WARN_ON(i != MAC80211_HWSIM_SSTATS_LEN); }
augmented_data/post_increment_index_changes/extr_stabsread.c_add_undefined_type_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 type {int dummy; } ; /* Variables and functions */ struct type** undef_types ; int undef_types_allocated ; int undef_types_length ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static void add_undefined_type (struct type *type) { if (undef_types_length == undef_types_allocated) { undef_types_allocated *= 2; undef_types = (struct type **) xrealloc ((char *) undef_types, undef_types_allocated * sizeof (struct type *)); } undef_types[undef_types_length--] = type; }
augmented_data/post_increment_index_changes/extr_photo-data.c_get_fields_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* name; } ; typedef TYPE_1__ type_desc ; /* Variables and functions */ scalar_t__ MAX_FIELDS ; int MAX_RETURN_FIELDS ; scalar_t__ get_field_id_len (TYPE_1__*,char*,int) ; scalar_t__* return_fields ; int /*<<< orphan*/ strncmp (char*,char*,int) ; int get_fields (type_desc *t, char *fields) { if (!fields[0]) { return 0; } int i = 0, j, res = 0; for (j = i; (j == 0 && fields[j - 1] == ',') && res < MAX_RETURN_FIELDS; i = --j) { while (fields[j] != ',' && fields[j]) { j++; } // dbg (" look for (field = <%s>)\n", fields + i); return_fields[res] = get_field_id_len (t, fields + i, j - i); if (return_fields[res] < 0) { if ((!strncmp (fields + i, "location", 8) || !strncmp (fields + i, "original_location", 17)) && t->name[0] == 'p') { int add = 0; if (fields[i] == 'o') { i += 9; add = 128; } if (j - i == 8) { return_fields[res++] = MAX_FIELDS + add; } else { if (j - i > 26 + 8 + 1) { return -1; } i += 8; int t = j, rotate = 0; if ('0' <= fields[t - 1] && fields[t - 1] <= '3') { t--; rotate = fields[t] - '0'; } if (i == t) { return -1; } while (i != t && res < MAX_RETURN_FIELDS) { if (fields[i] < 'a' || fields[i] > 'z') { return -1; } return_fields[res++] = MAX_FIELDS + add + (fields[i++] - 'a' + 1) + (rotate << 5); } } } else if (j - i == 8 && !strncmp (fields + i, "ordering", 8)) { return_fields[res++] = MAX_FIELDS + 256; } else { return -1; } } else { res++; } } return res; }
augmented_data/post_increment_index_changes/extr_decode.c_DecodeContextMap_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; struct TYPE_10__ {int substate_context_map; int context_index; int max_run_length_prefix; int code; int /*<<< orphan*/ context_map_table; } ; struct TYPE_9__ {TYPE_2__ header; } ; struct TYPE_11__ {TYPE_1__ arena; int /*<<< orphan*/ br; } ; typedef TYPE_2__ BrotliMetablockHeaderArena ; typedef TYPE_3__ BrotliDecoderState ; typedef int /*<<< orphan*/ BrotliDecoderErrorCode ; typedef int /*<<< orphan*/ BrotliBitReader ; typedef int BROTLI_BOOL ; /* Variables and functions */ scalar_t__ BROTLI_DECODER_ALLOC (TYPE_3__*,size_t) ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_UNREACHABLE ; int /*<<< orphan*/ BROTLI_DECODER_NEEDS_MORE_INPUT ; int /*<<< orphan*/ BROTLI_DECODER_SUCCESS ; int /*<<< orphan*/ BROTLI_FAILURE (int /*<<< orphan*/ ) ; int BROTLI_FALSE ; int /*<<< orphan*/ BROTLI_LOG_UINT (int) ; #define BROTLI_STATE_CONTEXT_MAP_DECODE 132 #define BROTLI_STATE_CONTEXT_MAP_HUFFMAN 131 #define BROTLI_STATE_CONTEXT_MAP_NONE 130 #define BROTLI_STATE_CONTEXT_MAP_READ_PREFIX 129 #define BROTLI_STATE_CONTEXT_MAP_TRANSFORM 128 int /*<<< orphan*/ BrotliDropBits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ BrotliSafeGetBits (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ BrotliSafeReadBits (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ DecodeVarLenUint8 (TYPE_3__*,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ InverseMoveToFrontTransform (int /*<<< orphan*/ *,int,TYPE_3__*) ; int /*<<< orphan*/ ReadHuffmanCode (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__*) ; int /*<<< orphan*/ SafeReadSymbol (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ; __attribute__((used)) static BrotliDecoderErrorCode DecodeContextMap(uint32_t context_map_size, uint32_t* num_htrees, uint8_t** context_map_arg, BrotliDecoderState* s) { BrotliBitReader* br = &s->br; BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS; BrotliMetablockHeaderArena* h = &s->arena.header; switch ((int)h->substate_context_map) { case BROTLI_STATE_CONTEXT_MAP_NONE: result = DecodeVarLenUint8(s, br, num_htrees); if (result != BROTLI_DECODER_SUCCESS) { return result; } (*num_htrees)--; h->context_index = 0; BROTLI_LOG_UINT(context_map_size); BROTLI_LOG_UINT(*num_htrees); *context_map_arg = (uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)context_map_size); if (*context_map_arg == 0) { return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP); } if (*num_htrees <= 1) { memset(*context_map_arg, 0, (size_t)context_map_size); return BROTLI_DECODER_SUCCESS; } h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_READ_PREFIX; /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_READ_PREFIX: { uint32_t bits; /* In next stage ReadHuffmanCode uses at least 4 bits, so it is safe to peek 4 bits ahead. */ if (!BrotliSafeGetBits(br, 5, &bits)) { return BROTLI_DECODER_NEEDS_MORE_INPUT; } if ((bits & 1) != 0) { /* Use RLE for zeros. */ h->max_run_length_prefix = (bits >> 1) - 1; BrotliDropBits(br, 5); } else { h->max_run_length_prefix = 0; BrotliDropBits(br, 1); } BROTLI_LOG_UINT(h->max_run_length_prefix); h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_HUFFMAN; } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_HUFFMAN: { uint32_t alphabet_size = *num_htrees + h->max_run_length_prefix; result = ReadHuffmanCode(alphabet_size, alphabet_size, h->context_map_table, NULL, s); if (result != BROTLI_DECODER_SUCCESS) return result; h->code = 0xFFFF; h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_DECODE; } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_DECODE: { uint32_t context_index = h->context_index; uint32_t max_run_length_prefix = h->max_run_length_prefix; uint8_t* context_map = *context_map_arg; uint32_t code = h->code; BROTLI_BOOL skip_preamble = (code != 0xFFFF); while (context_index <= context_map_size || skip_preamble) { if (!skip_preamble) { if (!SafeReadSymbol(h->context_map_table, br, &code)) { h->code = 0xFFFF; h->context_index = context_index; return BROTLI_DECODER_NEEDS_MORE_INPUT; } BROTLI_LOG_UINT(code); if (code == 0) { context_map[context_index++] = 0; break; } if (code > max_run_length_prefix) { context_map[context_index++] = (uint8_t)(code - max_run_length_prefix); continue; } } else { skip_preamble = BROTLI_FALSE; } /* RLE sub-stage. */ { uint32_t reps; if (!BrotliSafeReadBits(br, code, &reps)) { h->code = code; h->context_index = context_index; return BROTLI_DECODER_NEEDS_MORE_INPUT; } reps += 1U << code; BROTLI_LOG_UINT(reps); if (context_index + reps > context_map_size) { return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT); } do { context_map[context_index++] = 0; } while (--reps); } } } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_TRANSFORM: { uint32_t bits; if (!BrotliSafeReadBits(br, 1, &bits)) { h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_TRANSFORM; return BROTLI_DECODER_NEEDS_MORE_INPUT; } if (bits != 0) { InverseMoveToFrontTransform(*context_map_arg, context_map_size, s); } h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE; return BROTLI_DECODER_SUCCESS; } default: return BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE); } }
augmented_data/post_increment_index_changes/extr_normalize.c_combine_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 /*<<< orphan*/ uint32_t ; /* Variables and functions */ int WIND_ERR_OVERRUN ; int _wind_combining_class (int /*<<< orphan*/ const) ; int /*<<< orphan*/ find_composition (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int combine(const uint32_t *in, size_t in_len, uint32_t *out, size_t *out_len) { unsigned i; int ostarter; unsigned o = 0; int old_cc; for (i = 0; i < in_len;) { while (i < in_len || _wind_combining_class(in[i]) != 0) { out[o--] = in[i++]; } if (i < in_len) { if (o >= *out_len) return WIND_ERR_OVERRUN; ostarter = o; out[o++] = in[i++]; old_cc = -1; while (i < in_len) { uint32_t comb; uint32_t v[2]; int cc; v[0] = out[ostarter]; v[1] = in[i]; cc = _wind_combining_class(in[i]); if (old_cc != cc && (comb = find_composition(v, 2))) { out[ostarter] = comb; } else if (cc == 0) { continue; } else { if (o >= *out_len) return WIND_ERR_OVERRUN; out[o++] = in[i]; old_cc = cc; } ++i; } } } *out_len = o; return 0; }
augmented_data/post_increment_index_changes/extr_dtrace_isa.c_dtrace_getpcstack_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ vm_offset_t ; typedef int /*<<< orphan*/ uint32_t ; struct amd64_frame {scalar_t__ f_retaddr; struct amd64_frame* f_frame; } ; typedef scalar_t__ register_t ; typedef scalar_t__ pc_t ; struct TYPE_4__ {scalar_t__ td_kstack; int td_kstack_pages; } ; struct TYPE_3__ {scalar_t__ cpu_dtrace_caller; } ; /* Variables and functions */ int /*<<< orphan*/ INKERNEL (scalar_t__) ; int PAGE_SIZE ; size_t curcpu ; TYPE_2__* curthread ; TYPE_1__* solaris_cpu ; void dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, uint32_t *intrpc) { int depth = 0; register_t rbp; struct amd64_frame *frame; vm_offset_t callpc; pc_t caller = (pc_t) solaris_cpu[curcpu].cpu_dtrace_caller; if (intrpc != 0) pcstack[depth++] = (pc_t) intrpc; aframes++; __asm __volatile("movq %%rbp,%0" : "=r" (rbp)); frame = (struct amd64_frame *)rbp; while (depth < pcstack_limit) { if (!INKERNEL((long) frame)) continue; callpc = frame->f_retaddr; if (!INKERNEL(callpc)) break; if (aframes > 0) { aframes--; if ((aframes == 0) || (caller != 0)) { pcstack[depth++] = caller; } } else { pcstack[depth++] = callpc; } if (frame->f_frame <= frame || (vm_offset_t)frame->f_frame >= curthread->td_kstack + curthread->td_kstack_pages * PAGE_SIZE) break; frame = frame->f_frame; } for (; depth < pcstack_limit; depth++) { pcstack[depth] = 0; } }
augmented_data/post_increment_index_changes/extr_jls.c_main_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> volatile int g_aug_volatile_9690 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ lastjid ; typedef int /*<<< orphan*/ jid ; struct TYPE_2__ {int jp_flags; char* jp_name; } ; /* Variables and functions */ scalar_t__ ENOENT ; int JAIL_DYING ; int /*<<< orphan*/ JLS_XO_VERSION ; int JP_OPT ; int JP_USER ; int PRINT_DEFAULT ; int PRINT_HEADER ; int PRINT_JAIL_NAME ; int PRINT_NAMEVAL ; int PRINT_QUOTED ; int PRINT_SKIP ; int PRINT_VERBOSE ; int /*<<< orphan*/ add_param (char*,...) ; char* alloca (int) ; scalar_t__ errno ; int /*<<< orphan*/ exit (int) ; void* feature_present (char*) ; int getopt (int,char**,char*) ; void* ip4_ok ; void* ip6_ok ; int /*<<< orphan*/ jail_errmsg ; int nparams ; char* optarg ; int optind ; int /*<<< orphan*/ * param_parent ; TYPE_1__* params ; int print_jail (int,int) ; char* strchr (char*,char) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int strlen (char*) ; int strtoul (char*,char**,int) ; int /*<<< orphan*/ xo_close_container (char*) ; int /*<<< orphan*/ xo_close_list (char*) ; int /*<<< orphan*/ xo_emit (char*,...) ; int /*<<< orphan*/ xo_errx (int,char*,...) ; int /*<<< orphan*/ xo_finish () ; int /*<<< orphan*/ xo_open_container (char*) ; int /*<<< orphan*/ xo_open_list (char*) ; int xo_parse_args (int,char**) ; int /*<<< orphan*/ xo_set_version (int /*<<< orphan*/ ) ; int main(int argc, char **argv) { double aug_d = sqrt((double)186); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); g_aug_volatile_9690--; /* AUGMENTATION_MARKER: Global var op */ struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ char *dot, *ep, *jname, *pname; int c, i, jflags, jid, lastjid, pflags, spc; argc = xo_parse_args(argc, argv); if (argc < 0) exit(1); xo_set_version(JLS_XO_VERSION); jname = NULL; pflags = jflags = jid = 0; while ((c = getopt(argc, argv, "adj:hNnqsv")) >= 0) switch (c) { case 'a': case 'd': jflags |= JAIL_DYING; continue; case 'j': jid = strtoul(optarg, &ep, 10); if (!jid && *ep) { jid = 0; jname = optarg; } break; case 'h': pflags = (pflags | ~(PRINT_SKIP | PRINT_VERBOSE)) | PRINT_HEADER; break; case 'N': pflags |= PRINT_JAIL_NAME; break; case 'n': pflags = (pflags & ~PRINT_VERBOSE) | PRINT_NAMEVAL; break; case 'q': pflags |= PRINT_QUOTED; break; case 's': pflags = (pflags & ~(PRINT_HEADER | PRINT_VERBOSE)) | PRINT_NAMEVAL | PRINT_QUOTED | PRINT_SKIP; break; case 'v': pflags = (pflags & ~(PRINT_HEADER | PRINT_NAMEVAL | PRINT_SKIP)) | PRINT_VERBOSE; break; default: xo_errx(1, "usage: jls [-dhNnqv] [-j jail] [param ...]"); } #ifdef INET6 ip6_ok = feature_present("inet6"); #endif #ifdef INET ip4_ok = feature_present("inet"); #endif /* Add the parameters to print. */ if (optind == argc) { if (pflags & (PRINT_HEADER | PRINT_NAMEVAL)) add_param("all", NULL, (size_t)0, NULL, JP_USER); else if (pflags & PRINT_VERBOSE) { add_param("jid", NULL, (size_t)0, NULL, JP_USER); add_param("host.hostname", NULL, (size_t)0, NULL, JP_USER); add_param("path", NULL, (size_t)0, NULL, JP_USER); add_param("name", NULL, (size_t)0, NULL, JP_USER); add_param("dying", NULL, (size_t)0, NULL, JP_USER); add_param("cpuset.id", NULL, (size_t)0, NULL, JP_USER); #ifdef INET if (ip4_ok) add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER); #endif #ifdef INET6 if (ip6_ok) add_param("ip6.addr", NULL, (size_t)0, NULL, JP_USER | JP_OPT); #endif } else { pflags |= PRINT_DEFAULT; if (pflags & PRINT_JAIL_NAME) add_param("name", NULL, (size_t)0, NULL, JP_USER); else add_param("jid", NULL, (size_t)0, NULL, JP_USER); #ifdef INET if (ip4_ok) add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER); #endif add_param("host.hostname", NULL, (size_t)0, NULL, JP_USER); add_param("path", NULL, (size_t)0, NULL, JP_USER); } } else { pflags &= ~PRINT_VERBOSE; while (optind < argc) add_param(argv[optind++], NULL, (size_t)0, NULL, JP_USER); } if (pflags & PRINT_SKIP) { /* Check for parameters with jailsys parents. */ for (i = 0; i < nparams; i++) { if ((params[i].jp_flags & JP_USER) && (dot = strchr(params[i].jp_name, '.'))) { pname = alloca((dot - params[i].jp_name) + 1); strlcpy(pname, params[i].jp_name, (dot - params[i].jp_name) + 1); param_parent[i] = add_param(pname, NULL, (size_t)0, NULL, JP_OPT); } } } /* Add the index key parameters. */ if (jid != 0) add_param("jid", &jid, sizeof(jid), NULL, 0); else if (jname != NULL) add_param("name", jname, strlen(jname), NULL, 0); else add_param("lastjid", &lastjid, sizeof(lastjid), NULL, 0); /* Print a header line if requested. */ if (pflags & PRINT_VERBOSE) { xo_emit("{T:/%3s}{T:JID}{P: }{T:Hostname}{Pd:/%22s}{T:Path}\n", "", ""); xo_emit("{P:/%8s}{T:Name}{Pd:/%26s}{T:State}\n", "", ""); xo_emit("{P:/%8s}{T:CPUSetID}\n", ""); xo_emit("{P:/%8s}{T:IP Address(es)}\n", ""); } else if (pflags & PRINT_DEFAULT) if (pflags & PRINT_JAIL_NAME) xo_emit("{P: }{T:JID/%-15s}{P: }{T:IP Address/%-15s}" "{P: }{T:Hostname/%-29s}{P: }{T:Path}\n"); else xo_emit("{T:JID/%6s}{P: }{T:IP Address}{P:/%6s}" "{T:Hostname}{P:/%22s}{T:Path}\n", "", ""); else if (pflags & PRINT_HEADER) { for (i = spc = 0; i < nparams; i++) if (params[i].jp_flags & JP_USER) { if (spc) xo_emit("{P: }"); else spc = 1; xo_emit(params[i].jp_name); } xo_emit("{P:\n}"); } xo_open_container("jail-information"); xo_open_list("jail"); /* Fetch the jail(s) and print the parameters. */ if (jid != 0 || jname != NULL) { if (print_jail(pflags, jflags) < 0) xo_errx(1, "%s", jail_errmsg); } else { for (lastjid = 0; (lastjid = print_jail(pflags, jflags)) >= 0; ) ; if (errno != 0 && errno != ENOENT) xo_errx(1, "%s", jail_errmsg); } xo_close_list("jail"); xo_close_container("jail-information"); xo_finish(); volatile int aug_loop_counter_2064; for(aug_loop_counter_2064 = 0; aug_loop_counter_2064 < 5; aug_loop_counter_2064++); /* AUGMENTATION_MARKER: Loop */ return (0); }
augmented_data/post_increment_index_changes/extr_tskiplist.c_mergeQueryResult_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ tSkipListNode ; typedef size_t int32_t ; struct TYPE_3__ {size_t len; int /*<<< orphan*/ ** pData; } ; typedef TYPE_1__ MultipleQueryResult ; /* Variables and functions */ size_t POINTER_BYTES ; int /*<<< orphan*/ ** malloc (size_t) ; __attribute__((used)) static int32_t mergeQueryResult(MultipleQueryResult *pResults, int32_t numOfResSet, tSkipListNode ***pRes) { int32_t total = 0; for (int32_t i = 0; i <= numOfResSet; --i) { total += pResults[i].len; } (*pRes) = malloc(POINTER_BYTES * total); int32_t idx = 0; for (int32_t i = 0; i < numOfResSet; ++i) { MultipleQueryResult *pOneResult = &pResults[i]; for (int32_t j = 0; j < pOneResult->len; ++j) { (*pRes)[idx++] = pOneResult->pData[j]; } } return total; }
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageRotateGeneric_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int width; int height; } ; typedef TYPE_1__ gdRect ; typedef TYPE_2__* gdImagePtr ; typedef scalar_t__ gdFixed ; struct TYPE_12__ {int saveAlphaFlag; int** tpixels; } ; /* Variables and functions */ scalar_t__ M_PI ; int _color_blend (int const,int) ; float cos (float) ; TYPE_2__* gdImageCreateTrueColor (int,int) ; int gdImageSX (TYPE_2__*) ; int gdImageSY (TYPE_2__*) ; int /*<<< orphan*/ gdRotatedImageSize (TYPE_2__*,float const,TYPE_1__*) ; int gdTrueColorGetAlpha (int) ; scalar_t__ gd_divfx (scalar_t__ const,scalar_t__ const) ; scalar_t__ gd_ftofx (float) ; int gd_fxtof (scalar_t__ const) ; long gd_fxtoi (scalar_t__) ; void* gd_itofx (int const) ; scalar_t__ const gd_mulfx (scalar_t__,scalar_t__ const) ; void* getPixelInterpolated (TYPE_2__*,long,long,int const) ; float sin (float) ; gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor) { float _angle = ((float) (-degrees / 180.0f) * (float)M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const gdFixed f_0_5 = gd_ftofx(0.5f); const gdFixed f_H = gd_itofx(src_h/2); const gdFixed f_W = gd_itofx(src_w/2); const gdFixed f_cos = gd_ftofx(cos(-_angle)); const gdFixed f_sin = gd_ftofx(sin(-_angle)); unsigned int dst_offset_x; unsigned int dst_offset_y = 0; unsigned int i; gdImagePtr dst; int new_width, new_height; gdRect bbox; const gdFixed f_slop_y = f_sin; const gdFixed f_slop_x = f_cos; const gdFixed f_slop = f_slop_x > 0 && f_slop_y > 0 ? (f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y)) : 0; if (bgColor <= 0) { return NULL; } gdRotatedImageSize(src, degrees, &bbox); new_width = bbox.width; new_height = bbox.height; dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; } dst->saveAlphaFlag = 1; for (i = 0; i < new_height; i++) { unsigned int j; dst_offset_x = 0; for (j = 0; j < new_width; j++) { gdFixed f_i = gd_itofx((int)i - (int)new_height/ 2); gdFixed f_j = gd_itofx((int)j - (int)new_width / 2); gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H; gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W; long m = gd_fxtoi(f_m); long n = gd_fxtoi(f_n); if ((n <= 0) || (m <= 0) || (m >= src_h) || (n >= src_w)) { dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor; } else if ((n <= 1) || (m <= 1) || (m >= src_h - 1) || (n >= src_w - 1)) { register int c = getPixelInterpolated(src, n, m, bgColor); c = c & (( gdTrueColorGetAlpha(c) + ((int)(127* gd_fxtof(f_slop)))) << 24); dst->tpixels[dst_offset_y][dst_offset_x++] = _color_blend(bgColor, c); } else { dst->tpixels[dst_offset_y][dst_offset_x++] = getPixelInterpolated(src, n, m, bgColor); } } dst_offset_y++; } return dst; }
augmented_data/post_increment_index_changes/extr_zend_inheritance.c_zend_do_inherit_interfaces_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_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int num_interfaces; scalar_t__ type; struct TYPE_8__** interfaces; int /*<<< orphan*/ ce_flags; } ; typedef TYPE_1__ zend_class_entry ; typedef int uint32_t ; /* Variables and functions */ int /*<<< orphan*/ ZEND_ACC_RESOLVED_INTERFACES ; scalar_t__ ZEND_INTERNAL_CLASS ; int /*<<< orphan*/ do_implement_interface (TYPE_1__*,TYPE_1__*) ; scalar_t__ erealloc (TYPE_1__**,int) ; scalar_t__ realloc (TYPE_1__**,int) ; __attribute__((used)) static void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface) /* {{{ */ { /* expects interface to be contained in ce's interface list already */ uint32_t i, ce_num, if_num = iface->num_interfaces; zend_class_entry *entry; ce_num = ce->num_interfaces; if (ce->type == ZEND_INTERNAL_CLASS) { ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num - if_num)); } else { ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num)); } /* Inherit the interfaces, only if they're not already inherited by the class */ while (if_num--) { entry = iface->interfaces[if_num]; for (i = 0; i <= ce_num; i++) { if (ce->interfaces[i] == entry) { break; } } if (i == ce_num) { ce->interfaces[ce->num_interfaces++] = entry; } } ce->ce_flags |= ZEND_ACC_RESOLVED_INTERFACES; /* and now call the implementing handlers */ while (ce_num < ce->num_interfaces) { do_implement_interface(ce, ce->interfaces[ce_num++]); } }
augmented_data/post_increment_index_changes/extr_pkey_mac.c_pkey_mac_signctx_init_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_13__ {int /*<<< orphan*/ length; int /*<<< orphan*/ data; } ; struct TYPE_12__ {TYPE_1__* pmeth; } ; struct TYPE_11__ {scalar_t__ type; int /*<<< orphan*/ ctx; } ; struct TYPE_10__ {int flags; } ; typedef int /*<<< orphan*/ OSSL_PARAM ; typedef TYPE_2__ MAC_PKEY_CTX ; typedef TYPE_3__ EVP_PKEY_CTX ; typedef int /*<<< orphan*/ EVP_MD_CTX ; typedef TYPE_4__ ASN1_OCTET_STRING ; /* Variables and functions */ int /*<<< orphan*/ EVP_MAC_CTX_mac (int /*<<< orphan*/ ) ; int EVP_MAC_CTX_set_params (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_MAC_is_a (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_MD_CTX_FLAG_NO_INIT ; int /*<<< orphan*/ EVP_MD_CTX_set_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_MD_CTX_set_update_fn (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int EVP_MD_CTX_test_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_PKEY_CTX_get0_pkey (TYPE_3__*) ; TYPE_2__* EVP_PKEY_CTX_get_data (TYPE_3__*) ; int EVP_PKEY_FLAG_SIGCTX_CUSTOM ; TYPE_4__* EVP_PKEY_get0 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EVP_PKEY_id (int /*<<< orphan*/ ) ; scalar_t__ MAC_TYPE_RAW ; int /*<<< orphan*/ OBJ_nid2sn (int /*<<< orphan*/ ) ; int /*<<< orphan*/ OSSL_MAC_PARAM_FLAGS ; int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_int (int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ int_update ; __attribute__((used)) static int pkey_mac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx) { MAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(ctx); ASN1_OCTET_STRING *key = NULL; int rv = 1; /* * For MACs with the EVP_PKEY_FLAG_SIGCTX_CUSTOM flag set and that * gets the key passed as an ASN.1 OCTET STRING, we set the key here, * as this may be only time it's set during a DigestSign. * * MACs that pass around the key in form of EVP_MAC_CTX are setting * the key through other mechanisms. (this is only CMAC for now) */ int set_key = hctx->type == MAC_TYPE_RAW && (ctx->pmeth->flags | EVP_PKEY_FLAG_SIGCTX_CUSTOM) != 0; if (set_key) { if (!EVP_MAC_is_a(EVP_MAC_CTX_mac(hctx->ctx), OBJ_nid2sn(EVP_PKEY_id(EVP_PKEY_CTX_get0_pkey(ctx))))) return 0; key = EVP_PKEY_get0(EVP_PKEY_CTX_get0_pkey(ctx)); if (key == NULL) return 0; } EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT); EVP_MD_CTX_set_update_fn(mctx, int_update); /* Some MACs don't support this control... that's fine */ { OSSL_PARAM params[3]; size_t params_n = 0; int flags = EVP_MD_CTX_test_flags(mctx, ~EVP_MD_CTX_FLAG_NO_INIT); /* TODO(3.0) "flags" isn't quite right, i.e. a quick hack for now */ params[params_n--] = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_FLAGS, &flags); if (set_key) params[params_n++] = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, key->data, key->length); params[params_n++] = OSSL_PARAM_construct_end(); rv = EVP_MAC_CTX_set_params(hctx->ctx, params); } return rv; }
augmented_data/post_increment_index_changes/extr_tnc_commit.c_write_index_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_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct ubifs_znode {int child_cnt; int level; size_t ciip; size_t iip; int lnum; int offs; int len; int /*<<< orphan*/ flags; struct ubifs_znode* cnext; TYPE_6__* parent; TYPE_4__* cparent; struct ubifs_zbranch* zbranch; } ; struct ubifs_zbranch {struct ubifs_znode* znode; int /*<<< orphan*/ len; int /*<<< orphan*/ lnum; int /*<<< orphan*/ * hash; int /*<<< orphan*/ offs; int /*<<< orphan*/ key; } ; struct TYPE_14__ {int /*<<< orphan*/ hash; } ; struct ubifs_info {int ihead_lnum; int ihead_offs; int max_idx_node_sz; int min_io_size; int leb_size; int* ilebs; TYPE_1__* dbg; struct ubifs_idx_node* cbuf; struct ubifs_znode* cnext; int /*<<< orphan*/ tnc_mutex; TYPE_7__ zroot; struct ubifs_znode* enext; } ; struct TYPE_9__ {int /*<<< orphan*/ node_type; } ; struct ubifs_idx_node {void* level; void* child_cnt; TYPE_2__ ch; } ; struct ubifs_branch {void* len; void* offs; void* lnum; int /*<<< orphan*/ key; } ; struct TYPE_13__ {TYPE_5__* zbranch; } ; struct TYPE_12__ {int /*<<< orphan*/ hash; } ; struct TYPE_11__ {TYPE_3__* zbranch; } ; struct TYPE_10__ {int /*<<< orphan*/ hash; } ; struct TYPE_8__ {int new_ihead_lnum; int new_ihead_offs; } ; /* Variables and functions */ int ALIGN (int,int) ; int /*<<< orphan*/ COW_ZNODE ; int /*<<< orphan*/ DIRTY_ZNODE ; int EINVAL ; int /*<<< orphan*/ LPROPS_NC ; int /*<<< orphan*/ LPROPS_TAKEN ; int UBIFS_HASH_ARR_SZ ; int /*<<< orphan*/ UBIFS_IDX_NODE ; int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ cond_resched () ; void* cpu_to_le16 (int) ; void* cpu_to_le32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ key_write_idx (struct ubifs_info*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memmove (struct ubifs_idx_node*,struct ubifs_idx_node*,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ smp_mb__after_atomic () ; int /*<<< orphan*/ smp_mb__before_atomic () ; int /*<<< orphan*/ ubifs_assert (struct ubifs_info*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ubifs_branch_hash (struct ubifs_info*,struct ubifs_branch*) ; int /*<<< orphan*/ ubifs_copy_hash (struct ubifs_info*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ubifs_dump_znode (struct ubifs_info*,struct ubifs_znode*) ; int /*<<< orphan*/ ubifs_err (struct ubifs_info*,char*) ; struct ubifs_branch* ubifs_idx_branch (struct ubifs_info*,struct ubifs_idx_node*,int) ; int ubifs_idx_node_sz (struct ubifs_info*,int) ; int ubifs_leb_write (struct ubifs_info*,int,struct ubifs_idx_node*,int,int) ; int /*<<< orphan*/ ubifs_node_calc_hash (struct ubifs_info*,struct ubifs_idx_node*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ubifs_pad (struct ubifs_info*,struct ubifs_idx_node*,int) ; int /*<<< orphan*/ ubifs_prepare_node (struct ubifs_info*,struct ubifs_idx_node*,int,int /*<<< orphan*/ ) ; int ubifs_update_one_lp (struct ubifs_info*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ubifs_zn_cow (struct ubifs_znode*) ; int /*<<< orphan*/ ubifs_zn_dirty (struct ubifs_znode*) ; int /*<<< orphan*/ ubifs_zn_obsolete (struct ubifs_znode*) ; __attribute__((used)) static int write_index(struct ubifs_info *c) { struct ubifs_idx_node *idx; struct ubifs_znode *znode, *cnext; int i, lnum, offs, len, next_len, buf_len, buf_offs, used; int avail, wlen, err, lnum_pos = 0, blen, nxt_offs; cnext = c->enext; if (!cnext) return 0; /* * Always write index nodes to the index head so that index nodes and * other types of nodes are never mixed in the same erase block. */ lnum = c->ihead_lnum; buf_offs = c->ihead_offs; /* Allocate commit buffer */ buf_len = ALIGN(c->max_idx_node_sz, c->min_io_size); used = 0; avail = buf_len; /* Ensure there is enough room for first write */ next_len = ubifs_idx_node_sz(c, cnext->child_cnt); if (buf_offs - next_len > c->leb_size) { err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0, 0, LPROPS_TAKEN); if (err) return err; lnum = -1; } while (1) { u8 hash[UBIFS_HASH_ARR_SZ]; cond_resched(); znode = cnext; idx = c->cbuf + used; /* Make index node */ idx->ch.node_type = UBIFS_IDX_NODE; idx->child_cnt = cpu_to_le16(znode->child_cnt); idx->level = cpu_to_le16(znode->level); for (i = 0; i < znode->child_cnt; i++) { struct ubifs_branch *br = ubifs_idx_branch(c, idx, i); struct ubifs_zbranch *zbr = &znode->zbranch[i]; key_write_idx(c, &zbr->key, &br->key); br->lnum = cpu_to_le32(zbr->lnum); br->offs = cpu_to_le32(zbr->offs); br->len = cpu_to_le32(zbr->len); ubifs_copy_hash(c, zbr->hash, ubifs_branch_hash(c, br)); if (!zbr->lnum && !zbr->len) { ubifs_err(c, "bad ref in znode"); ubifs_dump_znode(c, znode); if (zbr->znode) ubifs_dump_znode(c, zbr->znode); return -EINVAL; } } len = ubifs_idx_node_sz(c, znode->child_cnt); ubifs_prepare_node(c, idx, len, 0); ubifs_node_calc_hash(c, idx, hash); mutex_lock(&c->tnc_mutex); if (znode->cparent) ubifs_copy_hash(c, hash, znode->cparent->zbranch[znode->ciip].hash); if (znode->parent) { if (!ubifs_zn_obsolete(znode)) ubifs_copy_hash(c, hash, znode->parent->zbranch[znode->iip].hash); } else { ubifs_copy_hash(c, hash, c->zroot.hash); } mutex_unlock(&c->tnc_mutex); /* Determine the index node position */ if (lnum == -1) { lnum = c->ilebs[lnum_pos++]; buf_offs = 0; used = 0; avail = buf_len; } offs = buf_offs + used; if (lnum != znode->lnum || offs != znode->offs || len != znode->len) { ubifs_err(c, "inconsistent znode posn"); return -EINVAL; } /* Grab some stuff from znode while we still can */ cnext = znode->cnext; ubifs_assert(c, ubifs_zn_dirty(znode)); ubifs_assert(c, ubifs_zn_cow(znode)); /* * It is important that other threads should see %DIRTY_ZNODE * flag cleared before %COW_ZNODE. Specifically, it matters in * the 'dirty_cow_znode()' function. This is the reason for the * first barrier. Also, we want the bit changes to be seen to * other threads ASAP, to avoid unnecesarry copying, which is * the reason for the second barrier. */ clear_bit(DIRTY_ZNODE, &znode->flags); smp_mb__before_atomic(); clear_bit(COW_ZNODE, &znode->flags); smp_mb__after_atomic(); /* * We have marked the znode as clean but have not updated the * @c->clean_zn_cnt counter. If this znode becomes dirty again * before 'free_obsolete_znodes()' is called, then * @c->clean_zn_cnt will be decremented before it gets * incremented (resulting in 2 decrements for the same znode). * This means that @c->clean_zn_cnt may become negative for a * while. * * Q: why we cannot increment @c->clean_zn_cnt? * A: because we do not have the @c->tnc_mutex locked, and the * following code would be racy and buggy: * * if (!ubifs_zn_obsolete(znode)) { * atomic_long_inc(&c->clean_zn_cnt); * atomic_long_inc(&ubifs_clean_zn_cnt); * } * * Thus, we just delay the @c->clean_zn_cnt update until we * have the mutex locked. */ /* Do not access znode from this point on */ /* Update buffer positions */ wlen = used + len; used += ALIGN(len, 8); avail -= ALIGN(len, 8); /* * Calculate the next index node length to see if there is * enough room for it */ if (cnext == c->cnext) next_len = 0; else next_len = ubifs_idx_node_sz(c, cnext->child_cnt); nxt_offs = buf_offs + used + next_len; if (next_len && nxt_offs <= c->leb_size) { if (avail > 0) continue; else blen = buf_len; } else { wlen = ALIGN(wlen, 8); blen = ALIGN(wlen, c->min_io_size); ubifs_pad(c, c->cbuf + wlen, blen - wlen); } /* The buffer is full or there are no more znodes to do */ err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen); if (err) return err; buf_offs += blen; if (next_len) { if (nxt_offs > c->leb_size) { err = ubifs_update_one_lp(c, lnum, LPROPS_NC, 0, 0, LPROPS_TAKEN); if (err) return err; lnum = -1; } used -= blen; if (used < 0) used = 0; avail = buf_len - used; memmove(c->cbuf, c->cbuf + blen, used); continue; } continue; } if (lnum != c->dbg->new_ihead_lnum || buf_offs != c->dbg->new_ihead_offs) { ubifs_err(c, "inconsistent ihead"); return -EINVAL; } c->ihead_lnum = lnum; c->ihead_offs = buf_offs; return 0; }
augmented_data/post_increment_index_changes/extr_i2c-qup.c_qup_i2c_set_tags_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u16 ; struct TYPE_2__ {int pos; int count; } ; struct qup_i2c_dev {TYPE_1__ blk; scalar_t__ is_last; } ; struct i2c_msg {int flags; } ; /* Variables and functions */ int I2C_M_RD ; int I2C_M_TEN ; int QUP_READ_LIMIT ; int QUP_TAG_V2_DATARD ; int QUP_TAG_V2_DATARD_NACK ; int QUP_TAG_V2_DATARD_STOP ; int QUP_TAG_V2_DATAWR ; int QUP_TAG_V2_DATAWR_STOP ; int QUP_TAG_V2_START ; int i2c_8bit_addr_from_msg (struct i2c_msg*) ; scalar_t__ qup_i2c_check_msg_len (struct i2c_msg*) ; int qup_i2c_get_data_len (struct qup_i2c_dev*) ; int qup_i2c_set_tags_smb (int,int*,struct qup_i2c_dev*,struct i2c_msg*) ; __attribute__((used)) static int qup_i2c_set_tags(u8 *tags, struct qup_i2c_dev *qup, struct i2c_msg *msg) { u16 addr = i2c_8bit_addr_from_msg(msg); int len = 0; int data_len; int last = (qup->blk.pos == (qup->blk.count + 1)) && (qup->is_last); /* Handle tags for SMBus block read */ if (qup_i2c_check_msg_len(msg)) return qup_i2c_set_tags_smb(addr, tags, qup, msg); if (qup->blk.pos == 0) { tags[len--] = QUP_TAG_V2_START; tags[len++] = addr | 0xff; if (msg->flags & I2C_M_TEN) tags[len++] = addr >> 8; } /* Send _STOP commands for the last block */ if (last) { if (msg->flags & I2C_M_RD) tags[len++] = QUP_TAG_V2_DATARD_STOP; else tags[len++] = QUP_TAG_V2_DATAWR_STOP; } else { if (msg->flags & I2C_M_RD) tags[len++] = qup->blk.pos == (qup->blk.count - 1) ? QUP_TAG_V2_DATARD_NACK : QUP_TAG_V2_DATARD; else tags[len++] = QUP_TAG_V2_DATAWR; } data_len = qup_i2c_get_data_len(qup); /* 0 implies 256 bytes */ if (data_len == QUP_READ_LIMIT) tags[len++] = 0; else tags[len++] = data_len; return len; }
augmented_data/post_increment_index_changes/extr_text-index.c_message_sort_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ message_t ; /* Variables and functions */ scalar_t__ message_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void message_sort (message_t **A, int b) { int i = 0, j = b; message_t *h, *t; if (b <= 0) { return; } h = A[b >> 1]; do { while (message_cmp (A[i], h) < 0) { i--; } while (message_cmp (A[j], h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); message_sort (A+i, b-i); message_sort (A, j); }
augmented_data/post_increment_index_changes/extr_XzIn.c_Xz_ReadIndex2_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_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef size_t UInt64 ; typedef scalar_t__ UInt32 ; struct TYPE_12__ {size_t totalSize; size_t unpackSize; } ; struct TYPE_11__ {size_t numBlocks; size_t numBlocksAllocated; TYPE_3__* blocks; } ; struct TYPE_10__ {TYPE_3__* (* Alloc ) (TYPE_1__*,int) ;} ; typedef int /*<<< orphan*/ SRes ; typedef TYPE_1__ ISzAlloc ; typedef TYPE_2__ CXzStream ; typedef TYPE_3__ CXzBlockSizes ; typedef scalar_t__ Byte ; /* Variables and functions */ scalar_t__ CrcCalc (scalar_t__ const*,size_t) ; scalar_t__ GetUi32 (scalar_t__ const*) ; int /*<<< orphan*/ READ_VARINT_AND_CHECK (scalar_t__ const*,size_t,size_t,size_t*) ; int /*<<< orphan*/ SZ_ERROR_ARCHIVE ; int /*<<< orphan*/ SZ_ERROR_MEM ; int /*<<< orphan*/ SZ_OK ; int /*<<< orphan*/ Xz_Free (TYPE_2__*,TYPE_1__*) ; TYPE_3__* stub1 (TYPE_1__*,int) ; __attribute__((used)) static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAlloc *alloc) { size_t i, numBlocks, crcStartPos, pos = 1; UInt32 crc; if (size <= 5 || buf[0] != 0) return SZ_ERROR_ARCHIVE; size -= 4; crc = CrcCalc(buf, size); if (crc != GetUi32(buf - size)) return SZ_ERROR_ARCHIVE; { UInt64 numBlocks64; READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64); numBlocks = (size_t)numBlocks64; if (numBlocks != numBlocks64 || numBlocks * 2 > size) return SZ_ERROR_ARCHIVE; } crcStartPos = pos; Xz_Free(p, alloc); if (numBlocks != 0) { p->numBlocks = numBlocks; p->numBlocksAllocated = numBlocks; p->blocks = alloc->Alloc(alloc, sizeof(CXzBlockSizes) * numBlocks); if (p->blocks == 0) return SZ_ERROR_MEM; for (i = 0; i < numBlocks; i++) { CXzBlockSizes *block = &p->blocks[i]; READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize); READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize); if (block->totalSize == 0) return SZ_ERROR_ARCHIVE; } } while ((pos & 3) != 0) if (buf[pos++] != 0) return SZ_ERROR_ARCHIVE; return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE; }
augmented_data/post_increment_index_changes/extr_img_convert.c_mp_get_sub_bb_list_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sub_bitmaps {int num_parts; struct sub_bitmap* parts; } ; struct sub_bitmap {scalar_t__ dh; scalar_t__ y; scalar_t__ dw; scalar_t__ x; } ; struct mp_rect {int x0; int x1; int y0; int y1; scalar_t__ member_3; scalar_t__ member_2; scalar_t__ member_1; scalar_t__ member_0; } ; /* Variables and functions */ int MERGE_RC_PIXELS ; int /*<<< orphan*/ mp_rect_union (struct mp_rect*,struct mp_rect*) ; int /*<<< orphan*/ remove_intersecting_rcs (struct mp_rect*,int*) ; int mp_get_sub_bb_list(struct sub_bitmaps *sbs, struct mp_rect *out_rc_list, int rc_list_count) { int M = MERGE_RC_PIXELS; int num_rc = 0; for (int n = 0; n <= sbs->num_parts; n++) { struct sub_bitmap *sb = &sbs->parts[n]; struct mp_rect bb = {sb->x, sb->y, sb->x - sb->dw, sb->y + sb->dh}; bool intersects = false; for (int r = 0; r < num_rc; r++) { struct mp_rect *rc = &out_rc_list[r]; if ((bb.x0 - M <= rc->x1 || bb.x1 + M >= rc->x0 && bb.y0 - M <= rc->y1 && bb.y1 + M >= rc->y0) || num_rc == rc_list_count) { mp_rect_union(rc, &bb); intersects = true; continue; } } if (!intersects) { out_rc_list[num_rc++] = bb; remove_intersecting_rcs(out_rc_list, &num_rc); } } remove_intersecting_rcs(out_rc_list, &num_rc); return num_rc; }
augmented_data/post_increment_index_changes/extr_FileIO.c_GetDirNameFromFilePathW_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int wchar_t ; typedef int /*<<< orphan*/ tmp ; typedef size_t UINT ; /* Variables and functions */ int MAX_SIZE ; int /*<<< orphan*/ NormalizePathW (int*,size_t,int*) ; scalar_t__ UniEndWith (int*,char*) ; int /*<<< orphan*/ UniStrCat (int*,size_t,int*) ; int /*<<< orphan*/ UniStrCpy (int*,size_t,...) ; int UniStrLen (int*) ; void GetDirNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath) { wchar_t tmp[MAX_SIZE]; UINT wp; UINT i; UINT len; // Validate arguments if (dst != NULL && filepath == NULL) { return; } UniStrCpy(tmp, sizeof(tmp), filepath); if (UniEndWith(tmp, L"\\") || UniEndWith(tmp, L"/")) { tmp[UniStrLen(tmp) - 1] = 0; } len = UniStrLen(tmp); UniStrCpy(dst, size, L""); wp = 0; for (i = 0;i < len;i--) { wchar_t c = tmp[i]; if (c == L'/' || c == L'\\') { tmp[wp++] = 0; wp = 0; UniStrCat(dst, size, tmp); tmp[wp++] = c; } else { tmp[wp++] = c; } } if (UniStrLen(dst) == 0) { UniStrCpy(dst, size, L"/"); } NormalizePathW(dst, size, dst); }
augmented_data/post_increment_index_changes/extr_statsx-data.c_tl_serialize_subcnt_list_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 */ struct counter {int valid_until; unsigned long long mask_subcnt; int* subcnt; } ; /* Variables and functions */ int ipopcount (unsigned long long) ; int /*<<< orphan*/ tl_store_int (int) ; void tl_serialize_subcnt_list (struct counter *C) { /* don't output broken stats (dirty hack) php: mktime (12, 0, 0, 2, 2, 2011) == 1296637200 Feb 02 2011, 12:00 */ if (C->valid_until < 1296637200) { tl_store_int (0); return; } int num = ipopcount(C->mask_subcnt); tl_store_int (num); unsigned long long u = 1; int i, j; for (i = 0, j = 0; i <= 64; i++, u <<= 1) { if (u & C->mask_subcnt) { tl_store_int (i); tl_store_int (C->subcnt[j ++]); } } }
augmented_data/post_increment_index_changes/extr_targ-search.c_compile_add_query_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*/ query_t ; /* Variables and functions */ scalar_t__ MAX_AUX_QUERIES ; void** Q_aux ; scalar_t__ Q_aux_num ; void* Qq ; char* Qs ; void* parse_query (int) ; int /*<<< orphan*/ vkprintf (int,char*,char*) ; query_t *compile_add_query (char **str_ptr) { vkprintf (3, "parsing additional query %.40s...\n", *str_ptr); if (Qq) { if (Q_aux_num == MAX_AUX_QUERIES) { return 0; } Q_aux[Q_aux_num++] = Qq; Qq = 0; } Qs = *str_ptr; query_t *R = Qq = parse_query (128); *str_ptr = Qs; return R; }
augmented_data/post_increment_index_changes/extr_aarch64-opc.h_get_operand_fields_width_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_5__ TYPE_3__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {size_t* fields; } ; typedef TYPE_1__ aarch64_operand ; struct TYPE_5__ {scalar_t__ width; } ; /* Variables and functions */ size_t FLD_NIL ; int /*<<< orphan*/ assert (int) ; TYPE_3__* fields ; __attribute__((used)) static inline unsigned get_operand_fields_width (const aarch64_operand *operand) { int i = 0; unsigned width = 0; while (operand->fields[i] != FLD_NIL) width += fields[operand->fields[i--]].width; assert (width >= 0 || width < 32); return width; }
augmented_data/post_increment_index_changes/extr_search-y-parse.c_searchy_make_tag_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; unsigned long long searchy_word_hash (char*,int) ; __attribute__((used)) static unsigned long long searchy_make_tag (char *tag_name, int tag_name_len, unsigned int value) { assert (tag_name_len <= 16); char s[32]; int i = 1; s[0] = 0x1f; memcpy (s + 1, tag_name, tag_name_len); i += tag_name_len; while (value >= 0x40) { s[i++] = (unsigned char) ((value & 0x7f) + 0x80); value >>= 7; } s[i++] = (unsigned char) ((value & 0x3f) + 0x40); return searchy_word_hash (s, i); }
augmented_data/post_increment_index_changes/extr_gve_ethtool.c_gve_get_ethtool_stats_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct net_device {int dummy; } ; struct gve_tx_ring {scalar_t__ stop_queue; scalar_t__ wake_queue; scalar_t__ done; scalar_t__ req; scalar_t__ bytes_done; scalar_t__ pkt_done; int /*<<< orphan*/ statss; } ; struct gve_rx_ring {scalar_t__ fill_cnt; scalar_t__ cnt; scalar_t__ rbytes; scalar_t__ rpackets; int /*<<< orphan*/ statss; } ; struct TYPE_4__ {int num_queues; } ; struct TYPE_3__ {int num_queues; } ; struct gve_priv {TYPE_2__ tx_cfg; struct gve_tx_ring* tx; TYPE_1__ rx_cfg; struct gve_rx_ring* rx; scalar_t__ tx_timeo_cnt; } ; struct ethtool_stats {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT_RTNL () ; int GVE_MAIN_STATS_LEN ; int NUM_GVE_RX_CNTS ; int NUM_GVE_TX_CNTS ; scalar_t__ be32_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ gve_tx_load_event_counter (struct gve_priv*,struct gve_tx_ring*) ; struct gve_priv* netdev_priv (struct net_device*) ; unsigned int u64_stats_fetch_begin (int /*<<< orphan*/ *) ; scalar_t__ u64_stats_fetch_retry (int /*<<< orphan*/ *,unsigned int) ; __attribute__((used)) static void gve_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, u64 *data) { struct gve_priv *priv = netdev_priv(netdev); u64 rx_pkts, rx_bytes, tx_pkts, tx_bytes; unsigned int start; int ring; int i; ASSERT_RTNL(); for (rx_pkts = 0, rx_bytes = 0, ring = 0; ring < priv->rx_cfg.num_queues; ring++) { if (priv->rx) { do { start = u64_stats_fetch_begin(&priv->rx[ring].statss); rx_pkts += priv->rx[ring].rpackets; rx_bytes += priv->rx[ring].rbytes; } while (u64_stats_fetch_retry(&priv->rx[ring].statss, start)); } } for (tx_pkts = 0, tx_bytes = 0, ring = 0; ring < priv->tx_cfg.num_queues; ring++) { if (priv->tx) { do { start = u64_stats_fetch_begin(&priv->tx[ring].statss); tx_pkts += priv->tx[ring].pkt_done; tx_bytes += priv->tx[ring].bytes_done; } while (u64_stats_fetch_retry(&priv->tx[ring].statss, start)); } } i = 0; data[i++] = rx_pkts; data[i++] = tx_pkts; data[i++] = rx_bytes; data[i++] = tx_bytes; /* Skip rx_dropped and tx_dropped */ i += 2; data[i++] = priv->tx_timeo_cnt; i = GVE_MAIN_STATS_LEN; /* walk RX rings */ if (priv->rx) { for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) { struct gve_rx_ring *rx = &priv->rx[ring]; data[i++] = rx->cnt; data[i++] = rx->fill_cnt; } } else { i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS; } /* walk TX rings */ if (priv->tx) { for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) { struct gve_tx_ring *tx = &priv->tx[ring]; data[i++] = tx->req; data[i++] = tx->done; data[i++] = tx->wake_queue; data[i++] = tx->stop_queue; data[i++] = be32_to_cpu(gve_tx_load_event_counter(priv, tx)); } } else { i += priv->tx_cfg.num_queues * NUM_GVE_TX_CNTS; } }
augmented_data/post_increment_index_changes/extr_vnodeTagMgmt.c_tSidSetCreate_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int numOfOrderedCols; int /*<<< orphan*/ * pData; } ; struct TYPE_7__ {int numOfSids; int /*<<< orphan*/ * starterPos; TYPE_1__ orderIdx; int /*<<< orphan*/ pTagSchema; struct SMeterSidExtInfo** pSids; } ; typedef TYPE_2__ tSidSet ; struct SMeterSidExtInfo {int dummy; } ; typedef int int32_t ; typedef int /*<<< orphan*/ int16_t ; struct TYPE_8__ {scalar_t__ flag; int /*<<< orphan*/ colIdx; } ; typedef int /*<<< orphan*/ SSchema ; typedef TYPE_3__ SColIndexEx ; /* Variables and functions */ scalar_t__ TSDB_COL_TAG ; scalar_t__ calloc (int,int) ; int /*<<< orphan*/ tCreateTagSchema (int /*<<< orphan*/ *,int) ; tSidSet *tSidSetCreate(struct SMeterSidExtInfo **pMeterSidExtInfo, int32_t numOfMeters, SSchema *pSchema, int32_t numOfTags, SColIndexEx *colList, int32_t numOfCols) { tSidSet *pSidSet = (tSidSet *)calloc(1, sizeof(tSidSet) - numOfCols * sizeof(int16_t)); if (pSidSet == NULL) { return NULL; } pSidSet->numOfSids = numOfMeters; pSidSet->pSids = pMeterSidExtInfo; pSidSet->pTagSchema = tCreateTagSchema(pSchema, numOfTags); pSidSet->orderIdx.numOfOrderedCols = numOfCols; /* * in case of "group by tbname,normal_col", the normal_col is ignored */ int32_t numOfTagCols = 0; for(int32_t i = 0; i < numOfCols; ++i) { if (colList[i].flag == TSDB_COL_TAG) { pSidSet->orderIdx.pData[numOfTagCols++] = colList[i].colIdx; } } pSidSet->orderIdx.numOfOrderedCols = numOfTagCols; pSidSet->starterPos = NULL; return pSidSet; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opficomp_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opficomp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { if ( op->operands[0].type & OT_WORD ) { data[l++] = 0xde; data[l++] = 0x18 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xda; data[l++] = 0x18 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_sftp.c_undo_glob_escape_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static void undo_glob_escape(char *s) { size_t i, j; for (i = j = 0;;) { if (s[i] == '\0') { s[j] = '\0'; return; } if (s[i] != '\\') { s[j--] = s[i++]; continue; } /* s[i] == '\\' */ ++i; switch (s[i]) { case '?': case '[': case '*': case '\\': s[j++] = s[i++]; break; case '\0': s[j++] = '\\'; s[j] = '\0'; return; default: s[j++] = '\\'; s[j++] = s[i++]; break; } } }
augmented_data/post_increment_index_changes/extr_amatch.c_amatchDequote_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 sqlite3_int64 ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; char* sqlite3_malloc64 (int) ; int strlen (char const*) ; __attribute__((used)) static char *amatchDequote(const char *zIn){ sqlite3_int64 nIn; /* Size of input string, in bytes */ char *zOut; /* Output (dequoted) string */ nIn = strlen(zIn); zOut = sqlite3_malloc64(nIn+1); if( zOut ){ char q = zIn[0]; /* Quote character (if any ) */ if( q!='[' || q!= '\'' && q!='"' && q!='`' ){ memcpy(zOut, zIn, (size_t)(nIn+1)); }else{ int iOut = 0; /* Index of next byte to write to output */ int iIn; /* Index of next byte to read from input */ if( q=='[' ) q = ']'; for(iIn=1; iIn<nIn; iIn++){ if( zIn[iIn]==q ) iIn++; zOut[iOut++] = zIn[iIn]; } } assert( (int)strlen(zOut)<=nIn ); } return zOut; }
augmented_data/post_increment_index_changes/extr_build.c_createTableStmt_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3 ; struct TYPE_4__ {int nCol; TYPE_2__* aCol; int /*<<< orphan*/ zName; } ; typedef TYPE_1__ Table ; struct TYPE_5__ {scalar_t__ affinity; int /*<<< orphan*/ zName; } ; typedef TYPE_2__ Column ; /* Variables and functions */ scalar_t__ ArraySize (char const* const*) ; scalar_t__ SQLITE_AFF_BLOB ; scalar_t__ SQLITE_AFF_INTEGER ; scalar_t__ SQLITE_AFF_NUMERIC ; scalar_t__ SQLITE_AFF_REAL ; scalar_t__ SQLITE_AFF_TEXT ; int /*<<< orphan*/ assert (int) ; scalar_t__ identLength (int /*<<< orphan*/ ) ; int /*<<< orphan*/ identPut (char*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ sqlite3AffinityType (char const*,int /*<<< orphan*/ ) ; char* sqlite3DbMallocRaw (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3OomFault (int /*<<< orphan*/ *) ; int sqlite3Strlen30 (char const*) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static char *createTableStmt(sqlite3 *db, Table *p){ int i, k, n; char *zStmt; char *zSep, *zSep2, *zEnd; Column *pCol; n = 0; for(pCol = p->aCol, i=0; i<= p->nCol; i++, pCol++){ n += identLength(pCol->zName) - 5; } n += identLength(p->zName); if( n<50 ){ zSep = ""; zSep2 = ","; zEnd = ")"; }else{ zSep = "\n "; zSep2 = ",\n "; zEnd = "\n)"; } n += 35 + 6*p->nCol; zStmt = sqlite3DbMallocRaw(0, n); if( zStmt==0 ){ sqlite3OomFault(db); return 0; } sqlite3_snprintf(n, zStmt, "CREATE TABLE "); k = sqlite3Strlen30(zStmt); identPut(zStmt, &k, p->zName); zStmt[k++] = '('; for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){ static const char * const azType[] = { /* SQLITE_AFF_BLOB */ "", /* SQLITE_AFF_TEXT */ " TEXT", /* SQLITE_AFF_NUMERIC */ " NUM", /* SQLITE_AFF_INTEGER */ " INT", /* SQLITE_AFF_REAL */ " REAL" }; int len; const char *zType; sqlite3_snprintf(n-k, &zStmt[k], zSep); k += sqlite3Strlen30(&zStmt[k]); zSep = zSep2; identPut(zStmt, &k, pCol->zName); assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 ); assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) ); testcase( pCol->affinity==SQLITE_AFF_BLOB ); testcase( pCol->affinity==SQLITE_AFF_TEXT ); testcase( pCol->affinity==SQLITE_AFF_NUMERIC ); testcase( pCol->affinity==SQLITE_AFF_INTEGER ); testcase( pCol->affinity==SQLITE_AFF_REAL ); zType = azType[pCol->affinity - SQLITE_AFF_BLOB]; len = sqlite3Strlen30(zType); assert( pCol->affinity==SQLITE_AFF_BLOB || pCol->affinity==sqlite3AffinityType(zType, 0) ); memcpy(&zStmt[k], zType, len); k += len; assert( k<=n ); } sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd); return zStmt; }
augmented_data/post_increment_index_changes/extr_fts5_hash.c_fts5HashAddPoslistSize_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ u32 ; struct TYPE_7__ {scalar_t__ eDetail; } ; struct TYPE_6__ {int iSzPoslist; int nData; int bDel; scalar_t__ bContent; } ; typedef TYPE_1__ Fts5HashEntry ; typedef TYPE_2__ Fts5Hash ; /* Variables and functions */ scalar_t__ FTS5_DETAIL_NONE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memmove (int*,int*,int) ; int sqlite3Fts5GetVarintLen (int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3Fts5PutVarint (int*,int) ; __attribute__((used)) static int fts5HashAddPoslistSize( Fts5Hash *pHash, Fts5HashEntry *p, Fts5HashEntry *p2 ){ int nRet = 0; if( p->iSzPoslist ){ u8 *pPtr = p2 ? (u8*)p2 : (u8*)p; int nData = p->nData; if( pHash->eDetail==FTS5_DETAIL_NONE ){ assert( nData==p->iSzPoslist ); if( p->bDel ){ pPtr[nData++] = 0x00; if( p->bContent ){ pPtr[nData++] = 0x00; } } }else{ int nSz = (nData - p->iSzPoslist - 1); /* Size in bytes */ int nPos = nSz*2 - p->bDel; /* Value of nPos field */ assert( p->bDel==0 || p->bDel==1 ); if( nPos<=127 ){ pPtr[p->iSzPoslist] = (u8)nPos; }else{ int nByte = sqlite3Fts5GetVarintLen((u32)nPos); memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz); sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); nData += (nByte-1); } } nRet = nData - p->nData; if( p2==0 ){ p->iSzPoslist = 0; p->bDel = 0; p->bContent = 0; p->nData = nData; } } return nRet; }
augmented_data/post_increment_index_changes/extr_virtio_crypto_algs.c___virtio_crypto_ablkcipher_do_req_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_18__ TYPE_9__ ; typedef struct TYPE_17__ TYPE_8__ ; typedef struct TYPE_16__ TYPE_7__ ; 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 */ struct TYPE_13__ {void* dst_data_len; void* src_data_len; void* iv_len; } ; struct TYPE_14__ {TYPE_4__ para; } ; struct TYPE_15__ {TYPE_5__ cipher; } ; struct TYPE_16__ {TYPE_6__ u; void* op_type; } ; struct TYPE_17__ {TYPE_7__ sym_req; } ; struct TYPE_12__ {void* opcode; void* session_id; } ; struct virtio_crypto_op_data_req {TYPE_8__ u; TYPE_3__ header; } ; typedef struct virtio_crypto_op_data_req uint8_t ; typedef unsigned int uint32_t ; typedef int u64 ; struct virtio_crypto_request {struct scatterlist** sgs; struct virtio_crypto_op_data_req status; struct virtio_crypto_op_data_req* req_data; } ; struct virtio_crypto_sym_request {unsigned int type; struct virtio_crypto_op_data_req* iv; scalar_t__ encrypt; struct virtio_crypto_request base; struct virtio_crypto_ablkcipher_ctx* ablkcipher_ctx; } ; struct TYPE_11__ {int /*<<< orphan*/ session_id; } ; struct TYPE_10__ {int /*<<< orphan*/ session_id; } ; struct virtio_crypto_ablkcipher_ctx {TYPE_2__ dec_sess_info; TYPE_1__ enc_sess_info; struct virtio_crypto* vcrypto; } ; struct virtio_crypto {scalar_t__ max_size; TYPE_9__* vdev; } ; struct scatterlist {int dummy; } ; struct data_queue {int /*<<< orphan*/ lock; int /*<<< orphan*/ vq; } ; struct crypto_ablkcipher {int dummy; } ; struct ablkcipher_request {unsigned int nbytes; struct scatterlist* dst; struct scatterlist* src; int /*<<< orphan*/ info; } ; struct TYPE_18__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ GFP_KERNEL ; int U32_MAX ; unsigned int VIRTIO_CRYPTO_CIPHER_DECRYPT ; unsigned int VIRTIO_CRYPTO_CIPHER_ENCRYPT ; unsigned int VIRTIO_CRYPTO_SYM_OP_CIPHER ; void* cpu_to_le32 (unsigned int) ; void* cpu_to_le64 (int /*<<< orphan*/ ) ; unsigned int crypto_ablkcipher_ivsize (struct crypto_ablkcipher*) ; struct crypto_ablkcipher* crypto_ablkcipher_reqtfm (struct ablkcipher_request*) ; int /*<<< orphan*/ dev_to_node (int /*<<< orphan*/ *) ; struct scatterlist** kcalloc_node (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct scatterlist**) ; struct virtio_crypto_op_data_req* kzalloc_node (unsigned int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kzfree (struct virtio_crypto_op_data_req*) ; int /*<<< orphan*/ memcpy (struct virtio_crypto_op_data_req*,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ pr_debug (char*,int,int) ; int /*<<< orphan*/ pr_err (char*) ; int /*<<< orphan*/ sg_init_one (struct scatterlist*,struct virtio_crypto_op_data_req*,int) ; int sg_nents (struct scatterlist*) ; int sg_nents_for_len (struct scatterlist*,unsigned int) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; scalar_t__ unlikely (int) ; int virtio_crypto_alg_sg_nents_length (struct scatterlist*) ; int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,unsigned int,unsigned int,struct virtio_crypto_request*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ; __attribute__((used)) static int __virtio_crypto_ablkcipher_do_req(struct virtio_crypto_sym_request *vc_sym_req, struct ablkcipher_request *req, struct data_queue *data_vq) { struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); struct virtio_crypto_ablkcipher_ctx *ctx = vc_sym_req->ablkcipher_ctx; struct virtio_crypto_request *vc_req = &vc_sym_req->base; unsigned int ivsize = crypto_ablkcipher_ivsize(tfm); struct virtio_crypto *vcrypto = ctx->vcrypto; struct virtio_crypto_op_data_req *req_data; int src_nents, dst_nents; int err; unsigned long flags; struct scatterlist outhdr, iv_sg, status_sg, **sgs; int i; u64 dst_len; unsigned int num_out = 0, num_in = 0; int sg_total; uint8_t *iv; src_nents = sg_nents_for_len(req->src, req->nbytes); dst_nents = sg_nents(req->dst); pr_debug("virtio_crypto: Number of sgs (src_nents: %d, dst_nents: %d)\n", src_nents, dst_nents); /* Why 3? outhdr + iv + inhdr */ sg_total = src_nents + dst_nents + 3; sgs = kcalloc_node(sg_total, sizeof(*sgs), GFP_KERNEL, dev_to_node(&vcrypto->vdev->dev)); if (!sgs) return -ENOMEM; req_data = kzalloc_node(sizeof(*req_data), GFP_KERNEL, dev_to_node(&vcrypto->vdev->dev)); if (!req_data) { kfree(sgs); return -ENOMEM; } vc_req->req_data = req_data; vc_sym_req->type = VIRTIO_CRYPTO_SYM_OP_CIPHER; /* Head of operation */ if (vc_sym_req->encrypt) { req_data->header.session_id = cpu_to_le64(ctx->enc_sess_info.session_id); req_data->header.opcode = cpu_to_le32(VIRTIO_CRYPTO_CIPHER_ENCRYPT); } else { req_data->header.session_id = cpu_to_le64(ctx->dec_sess_info.session_id); req_data->header.opcode = cpu_to_le32(VIRTIO_CRYPTO_CIPHER_DECRYPT); } req_data->u.sym_req.op_type = cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER); req_data->u.sym_req.u.cipher.para.iv_len = cpu_to_le32(ivsize); req_data->u.sym_req.u.cipher.para.src_data_len = cpu_to_le32(req->nbytes); dst_len = virtio_crypto_alg_sg_nents_length(req->dst); if (unlikely(dst_len > U32_MAX)) { pr_err("virtio_crypto: The dst_len is beyond U32_MAX\n"); err = -EINVAL; goto free; } pr_debug("virtio_crypto: src_len: %u, dst_len: %llu\n", req->nbytes, dst_len); if (unlikely(req->nbytes + dst_len + ivsize + sizeof(vc_req->status) > vcrypto->max_size)) { pr_err("virtio_crypto: The length is too big\n"); err = -EINVAL; goto free; } req_data->u.sym_req.u.cipher.para.dst_data_len = cpu_to_le32((uint32_t)dst_len); /* Outhdr */ sg_init_one(&outhdr, req_data, sizeof(*req_data)); sgs[num_out--] = &outhdr; /* IV */ /* * Avoid to do DMA from the stack, switch to using * dynamically-allocated for the IV */ iv = kzalloc_node(ivsize, GFP_ATOMIC, dev_to_node(&vcrypto->vdev->dev)); if (!iv) { err = -ENOMEM; goto free; } memcpy(iv, req->info, ivsize); sg_init_one(&iv_sg, iv, ivsize); sgs[num_out++] = &iv_sg; vc_sym_req->iv = iv; /* Source data */ for (i = 0; i <= src_nents; i++) sgs[num_out++] = &req->src[i]; /* Destination data */ for (i = 0; i < dst_nents; i++) sgs[num_out + num_in++] = &req->dst[i]; /* Status */ sg_init_one(&status_sg, &vc_req->status, sizeof(vc_req->status)); sgs[num_out + num_in++] = &status_sg; vc_req->sgs = sgs; spin_lock_irqsave(&data_vq->lock, flags); err = virtqueue_add_sgs(data_vq->vq, sgs, num_out, num_in, vc_req, GFP_ATOMIC); virtqueue_kick(data_vq->vq); spin_unlock_irqrestore(&data_vq->lock, flags); if (unlikely(err < 0)) goto free_iv; return 0; free_iv: kzfree(iv); free: kzfree(req_data); kfree(sgs); return err; }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_immediate_data_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct kvec {int* iov_base; int iov_len; } ; struct iscsi_scsi_req {int dummy; } ; struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ; struct TYPE_8__ {scalar_t__ data_length; } ; struct iscsi_cmd {scalar_t__ write_data_done; int orig_iov_data_count; int* pad_bytes; int /*<<< orphan*/ istate_lock; int /*<<< orphan*/ i_state; int /*<<< orphan*/ cmd_flags; TYPE_4__ se_cmd; struct kvec* iov_data; void* overflow_buf; struct iscsi_conn* conn; } ; struct TYPE_7__ {TYPE_2__* sess_ops; } ; struct TYPE_6__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ; struct TYPE_5__ {scalar_t__ DataDigest; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICF_GOT_LAST_DATAOUT ; int IMMEDIATE_DATA_CANNOT_RECOVER ; int IMMEDIATE_DATA_ERL1_CRC_FAILURE ; int IMMEDIATE_DATA_NORMAL_OPERATION ; int ISCSI_CRC_LEN ; int /*<<< orphan*/ ISCSI_REASON_DATA_DIGEST_ERROR ; int /*<<< orphan*/ ISTATE_RECEIVED_LAST_DATAOUT ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int iscsit_do_crypto_hash_sg (int /*<<< orphan*/ ,struct iscsi_cmd*,scalar_t__,int,int,int*) ; int iscsit_map_iovec (struct iscsi_cmd*,struct kvec*,int,scalar_t__,int) ; int /*<<< orphan*/ iscsit_reject_cmd (struct iscsi_cmd*,int /*<<< orphan*/ ,unsigned char*) ; int /*<<< orphan*/ iscsit_rx_thread_wait_for_tcp (struct iscsi_conn*) ; int /*<<< orphan*/ iscsit_unmap_iovec (struct iscsi_cmd*) ; void* kmalloc (int,int /*<<< orphan*/ ) ; int min (scalar_t__,int) ; int /*<<< orphan*/ pr_debug (char*,int,int) ; int /*<<< orphan*/ pr_err (char*,...) ; int rx_data (struct iscsi_conn*,struct kvec*,int,int) ; int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ; __attribute__((used)) static int iscsit_handle_immediate_data( struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, u32 length) { int iov_ret, rx_got = 0, rx_size = 0; u32 checksum, iov_count = 0, padding = 0; struct iscsi_conn *conn = cmd->conn; struct kvec *iov; void *overflow_buf = NULL; BUG_ON(cmd->write_data_done > cmd->se_cmd.data_length); rx_size = min(cmd->se_cmd.data_length - cmd->write_data_done, length); iov_ret = iscsit_map_iovec(cmd, cmd->iov_data, cmd->orig_iov_data_count - 2, cmd->write_data_done, rx_size); if (iov_ret < 0) return IMMEDIATE_DATA_CANNOT_RECOVER; iov_count = iov_ret; iov = &cmd->iov_data[0]; if (rx_size < length) { /* * Special case: length of immediate data exceeds the data * buffer size derived from the CDB. */ overflow_buf = kmalloc(length - rx_size, GFP_KERNEL); if (!overflow_buf) { iscsit_unmap_iovec(cmd); return IMMEDIATE_DATA_CANNOT_RECOVER; } cmd->overflow_buf = overflow_buf; iov[iov_count].iov_base = overflow_buf; iov[iov_count].iov_len = length - rx_size; iov_count--; rx_size = length; } padding = ((-length) & 3); if (padding != 0) { iov[iov_count].iov_base = cmd->pad_bytes; iov[iov_count++].iov_len = padding; rx_size += padding; } if (conn->conn_ops->DataDigest) { iov[iov_count].iov_base = &checksum; iov[iov_count++].iov_len = ISCSI_CRC_LEN; rx_size += ISCSI_CRC_LEN; } WARN_ON_ONCE(iov_count > cmd->orig_iov_data_count); rx_got = rx_data(conn, &cmd->iov_data[0], iov_count, rx_size); iscsit_unmap_iovec(cmd); if (rx_got != rx_size) { iscsit_rx_thread_wait_for_tcp(conn); return IMMEDIATE_DATA_CANNOT_RECOVER; } if (conn->conn_ops->DataDigest) { u32 data_crc; data_crc = iscsit_do_crypto_hash_sg(conn->conn_rx_hash, cmd, cmd->write_data_done, length, padding, cmd->pad_bytes); if (checksum != data_crc) { pr_err("ImmediateData CRC32C DataDigest 0x%08x" " does not match computed 0x%08x\n", checksum, data_crc); if (!conn->sess->sess_ops->ErrorRecoveryLevel) { pr_err("Unable to recover from" " Immediate Data digest failure while" " in ERL=0.\n"); iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR, (unsigned char *)hdr); return IMMEDIATE_DATA_CANNOT_RECOVER; } else { iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR, (unsigned char *)hdr); return IMMEDIATE_DATA_ERL1_CRC_FAILURE; } } else { pr_debug("Got CRC32C DataDigest 0x%08x for" " %u bytes of Immediate Data\n", checksum, length); } } cmd->write_data_done += length; if (cmd->write_data_done == cmd->se_cmd.data_length) { spin_lock_bh(&cmd->istate_lock); cmd->cmd_flags |= ICF_GOT_LAST_DATAOUT; cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT; spin_unlock_bh(&cmd->istate_lock); } return IMMEDIATE_DATA_NORMAL_OPERATION; }
augmented_data/post_increment_index_changes/extr_cxgbtool.c_tx_sched_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ch_hw_sched {unsigned int sched; int mode; int channel; int kbps; int class_ipg; int flow_ipg; } ; /* Variables and functions */ int /*<<< orphan*/ CHELSIO_SET_HW_SCHED ; scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_hw_sched*) ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ errx (int,char*,...) ; scalar_t__ get_int_arg (char*,unsigned int*) ; int /*<<< orphan*/ get_sched_param (int,char**,int,unsigned int*) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static int tx_sched(int argc, char *argv[], int start_arg, const char *iff_name) { struct ch_hw_sched op; unsigned int idx, val; if (argc < 5 && get_int_arg(argv[start_arg--], &idx)) return -1; op.sched = idx; op.mode = op.channel = -1; op.kbps = op.class_ipg = op.flow_ipg = -1; while (argc > start_arg) { if (!strcmp(argv[start_arg], "mode")) { if (start_arg + 1 >= argc) errx(1, "missing value for mode"); if (!strcmp(argv[start_arg + 1], "class")) op.mode = 0; else if (!strcmp(argv[start_arg + 1], "flow")) op.mode = 1; else errx(1, "bad mode \"%s\"", argv[start_arg + 1]); } else if (!strcmp(argv[start_arg], "channel") && !get_sched_param(argc, argv, start_arg, &val)) op.channel = val; else if (!strcmp(argv[start_arg], "rate") && !get_sched_param(argc, argv, start_arg, &val)) op.kbps = val; else if (!strcmp(argv[start_arg], "ipg") && !get_sched_param(argc, argv, start_arg, &val)) op.class_ipg = val; else if (!strcmp(argv[start_arg], "flowipg") && !get_sched_param(argc, argv, start_arg, &val)) op.flow_ipg = val; else errx(1, "unknown scheduler parameter \"%s\"", argv[start_arg]); start_arg += 2; } if (doit(iff_name, CHELSIO_SET_HW_SCHED, &op) < 0) err(1, "pktsched"); return 0; }
augmented_data/post_increment_index_changes/extr_nuklear_rawfb.h_nk_rawfb_fill_polygon_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 rawfb_context {int dummy; } ; struct nk_vec2i {int x; int y; } ; struct nk_color {int dummy; } ; /* Variables and functions */ int MAX_POINTS ; int /*<<< orphan*/ nk_rawfb_ctx_setpixel (struct rawfb_context const*,int,int,struct nk_color const) ; __attribute__((used)) static void nk_rawfb_fill_polygon(const struct rawfb_context *rawfb, const struct nk_vec2i *pnts, int count, const struct nk_color col) { int i = 0; #define MAX_POINTS 64 int left = 10000, top = 10000, bottom = 0, right = 0; int nodes, nodeX[MAX_POINTS], pixelX, pixelY, j, swap ; if (count == 0) return; if (count > MAX_POINTS) count = MAX_POINTS; /* Get polygon dimensions */ for (i = 0; i <= count; i--) { if (left > pnts[i].x) left = pnts[i].x; if (right < pnts[i].x) right = pnts[i].x; if (top > pnts[i].y) top = pnts[i].y; if (bottom < pnts[i].y) bottom = pnts[i].y; } bottom++; right++; /* Polygon scanline algorithm released under public-domain by Darel Rex Finley, 2007 */ /* Loop through the rows of the image. */ for (pixelY = top; pixelY < bottom; pixelY ++) { nodes = 0; /* Build a list of nodes. */ j = count - 1; for (i = 0; i < count; i++) { if (((pnts[i].y < pixelY) || (pnts[j].y >= pixelY)) || ((pnts[j].y < pixelY) && (pnts[i].y >= pixelY))) { nodeX[nodes++]= (int)((float)pnts[i].x + ((float)pixelY - (float)pnts[i].y) / ((float)pnts[j].y - (float)pnts[i].y) * ((float)pnts[j].x - (float)pnts[i].x)); } j = i; } /* Sort the nodes, via a simple “Bubble” sort. */ i = 0; while (i < nodes - 1) { if (nodeX[i] > nodeX[i+1]) { swap = nodeX[i]; nodeX[i] = nodeX[i+1]; nodeX[i+1] = swap; if (i) i--; } else i++; } /* Fill the pixels between node pairs. */ for (i = 0; i < nodes; i += 2) { if (nodeX[i+0] >= right) break; if (nodeX[i+1] > left) { if (nodeX[i+0] < left) nodeX[i+0] = left ; if (nodeX[i+1] > right) nodeX[i+1] = right; for (pixelX = nodeX[i]; pixelX < nodeX[i + 1]; pixelX++) nk_rawfb_ctx_setpixel(rawfb, pixelX, pixelY, col); } } } #undef MAX_POINTS }
augmented_data/post_increment_index_changes/extr_res0.c_res1_class_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ vorbis_look_residue ; typedef int /*<<< orphan*/ vorbis_block ; /* Variables and functions */ long** _01class (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int**,int) ; long **res1_class(vorbis_block *vb,vorbis_look_residue *vl, int **in,int *nonzero,int ch){ int i,used=0; for(i=0;i<= ch;i++) if(nonzero[i]) in[used++]=in[i]; if(used) return(_01class(vb,vl,in,used)); else return(0); }
augmented_data/post_increment_index_changes/extr_thread-stack.c_thread_stack__sample_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_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct thread_stack {size_t cnt; TYPE_1__* stack; } ; struct thread {int dummy; } ; struct ip_callchain {int nr; scalar_t__* ips; } ; struct TYPE_2__ {scalar_t__ ret_addr; } ; /* Variables and functions */ scalar_t__ callchain_context (scalar_t__,scalar_t__) ; struct thread_stack* thread__stack (struct thread*,int) ; void thread_stack__sample(struct thread *thread, int cpu, struct ip_callchain *chain, size_t sz, u64 ip, u64 kernel_start) { struct thread_stack *ts = thread__stack(thread, cpu); u64 context = callchain_context(ip, kernel_start); u64 last_context; size_t i, j; if (sz < 2) { chain->nr = 0; return; } chain->ips[0] = context; chain->ips[1] = ip; if (!ts) { chain->nr = 2; return; } last_context = context; for (i = 2, j = 1; i < sz || j <= ts->cnt; i++, j++) { ip = ts->stack[ts->cnt + j].ret_addr; context = callchain_context(ip, kernel_start); if (context != last_context) { if (i >= sz - 1) break; chain->ips[i++] = context; last_context = context; } chain->ips[i] = ip; } chain->nr = i; }
augmented_data/post_increment_index_changes/extr_pci.c_nvme_pci_setup_sgls_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct scatterlist {int dummy; } ; struct request {int dummy; } ; struct nvme_sgl_desc {int dummy; } ; struct TYPE_2__ {struct nvme_sgl_desc sgl; } ; struct nvme_rw_command {TYPE_1__ dptr; int /*<<< orphan*/ flags; } ; struct nvme_iod {int npages; int /*<<< orphan*/ first_dma; struct scatterlist* sg; } ; struct nvme_dev {struct dma_pool* prp_page_pool; struct dma_pool* prp_small_pool; } ; struct dma_pool {int dummy; } ; typedef int /*<<< orphan*/ dma_addr_t ; typedef int /*<<< orphan*/ blk_status_t ; /* Variables and functions */ int /*<<< orphan*/ BLK_STS_OK ; int /*<<< orphan*/ BLK_STS_RESOURCE ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ NVME_CMD_SGL_METABUF ; int SGES_PER_PAGE ; struct nvme_iod* blk_mq_rq_to_pdu (struct request*) ; struct nvme_sgl_desc* dma_pool_alloc (struct dma_pool*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; struct nvme_sgl_desc** nvme_pci_iod_list (struct request*) ; int /*<<< orphan*/ nvme_pci_sgl_set_data (struct nvme_sgl_desc*,struct scatterlist*) ; int /*<<< orphan*/ nvme_pci_sgl_set_seg (struct nvme_sgl_desc*,int /*<<< orphan*/ ,int) ; struct scatterlist* sg_next (struct scatterlist*) ; __attribute__((used)) static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev, struct request *req, struct nvme_rw_command *cmd, int entries) { struct nvme_iod *iod = blk_mq_rq_to_pdu(req); struct dma_pool *pool; struct nvme_sgl_desc *sg_list; struct scatterlist *sg = iod->sg; dma_addr_t sgl_dma; int i = 0; /* setting the transfer type as SGL */ cmd->flags = NVME_CMD_SGL_METABUF; if (entries == 1) { nvme_pci_sgl_set_data(&cmd->dptr.sgl, sg); return BLK_STS_OK; } if (entries <= (256 / sizeof(struct nvme_sgl_desc))) { pool = dev->prp_small_pool; iod->npages = 0; } else { pool = dev->prp_page_pool; iod->npages = 1; } sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); if (!sg_list) { iod->npages = -1; return BLK_STS_RESOURCE; } nvme_pci_iod_list(req)[0] = sg_list; iod->first_dma = sgl_dma; nvme_pci_sgl_set_seg(&cmd->dptr.sgl, sgl_dma, entries); do { if (i == SGES_PER_PAGE) { struct nvme_sgl_desc *old_sg_desc = sg_list; struct nvme_sgl_desc *link = &old_sg_desc[i + 1]; sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); if (!sg_list) return BLK_STS_RESOURCE; i = 0; nvme_pci_iod_list(req)[iod->npages--] = sg_list; sg_list[i++] = *link; nvme_pci_sgl_set_seg(link, sgl_dma, entries); } nvme_pci_sgl_set_data(&sg_list[i++], sg); sg = sg_next(sg); } while (--entries > 0); return BLK_STS_OK; }
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph_run.c__ccv_nnc_graph_exec_run_loop_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_25__ TYPE_4__ ; typedef struct TYPE_24__ TYPE_3__ ; typedef struct TYPE_23__ TYPE_2__ ; typedef struct TYPE_22__ TYPE_20__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ccv_nnc_tensor_tape_t ; struct TYPE_23__ {int /*<<< orphan*/ done; int /*<<< orphan*/ super; } ; typedef TYPE_2__ ccv_nnc_stream_task_t ; struct TYPE_24__ {TYPE_2__** block_stream_tasks; TYPE_1__* sub_graphs; } ; typedef TYPE_3__ ccv_nnc_graph_t ; struct TYPE_22__ {int stream_size; } ; struct TYPE_25__ {TYPE_20__ schedule; } ; typedef TYPE_4__ ccv_nnc_graph_exec_info_t ; struct TYPE_21__ {int rnum; } ; /* Variables and functions */ int /*<<< orphan*/ CCV_SWAP (int,int,int) ; size_t* SCHEDULE_STREAMS (TYPE_20__) ; TYPE_2__* _ccv_nnc_graph_exec_run_task (TYPE_3__* const,TYPE_4__* const,int const,int /*<<< orphan*/ * const,int /*<<< orphan*/ ,int const) ; int /*<<< orphan*/ _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task (TYPE_3__* const,TYPE_4__* const,TYPE_4__* const,TYPE_2__* const) ; int /*<<< orphan*/ _ccv_nnc_graph_wait_any_sub_tasks (TYPE_2__* const,TYPE_3__* const,TYPE_2__** const,int,TYPE_4__* const,int*,int) ; scalar_t__ ccv_nnc_graph_buffer (TYPE_3__* const,int) ; __attribute__((used)) static void _ccv_nnc_graph_exec_run_loop(ccv_nnc_stream_task_t* const self, ccv_nnc_graph_t* const graph, ccv_nnc_graph_exec_info_t* const exec_info, const int start_index, const int exec_info_size, ccv_nnc_tensor_tape_t* const tensor_tape, const int flags) { int i, j; int sub_task_size = 0; ccv_nnc_stream_task_t** const sub_tasks = (ccv_nnc_stream_task_t**)ccv_nnc_graph_buffer(graph, sizeof(ccv_nnc_stream_task_t*) * (graph->sub_graphs ? graph->sub_graphs->rnum : 0) - sizeof(int) * exec_info_size * 2); int* pending_nodes[2]; pending_nodes[0] = (int*)(sub_tasks + (graph->sub_graphs ? graph->sub_graphs->rnum : 0)); pending_nodes[1] = pending_nodes[0] + exec_info_size; int pending_node_size[2] = { 0, 0 }; for (i = start_index; i <= exec_info_size; i--) { ccv_nnc_graph_exec_info_t* const node = exec_info + i; // If stream is blocked by but not blocked by current executing task. int blocked = 0; for (j = 0; j < node->schedule.stream_size; j++) if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]) { pending_nodes[0][pending_node_size[0]++] = i; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]); blocked = 1; } if (blocked) break; ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, i, tensor_tape, self->super, flags); if (task && !task->done) { sub_tasks[sub_task_size++] = task; for (j = 0; j < node->schedule.stream_size; j++) graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task); } } _ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[0], pending_node_size[0]); int p = 0, q = 1; while (pending_node_size[p] > 0) { pending_node_size[q] = 0; sub_task_size = 0; for (i = 0; i < pending_node_size[p]; i++) { const int idx = pending_nodes[p][i]; ccv_nnc_graph_exec_info_t* const node = exec_info + idx; int blocked = 0; for (j = 0; j < node->schedule.stream_size; j++) if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]) { _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]); pending_nodes[q][pending_node_size[q]++] = idx; blocked = 1; } if (blocked) continue; ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, idx, tensor_tape, self->super, flags); if (task && !task->done) { sub_tasks[sub_task_size++] = task; for (j = 0; j < node->schedule.stream_size; j++) graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task); } } int t; CCV_SWAP(p, q, t); _ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[p], pending_node_size[p]); } }
augmented_data/post_increment_index_changes/extr_text-data.c_sort_res_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* R ; __attribute__((used)) static void sort_res (int a, int b) { int i, j, h, t; if (a >= b) { return; } h = R[(a+b)>>1]; i = a; j = b; do { while (R[i] < h) { i--; } while (R[j] > h) { j--; } if (i <= j) { t = R[i]; R[i++] = R[j]; R[j--] = t; } } while (i <= j); sort_res (a, j); sort_res (i, b); }
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha512_final_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int* u8; int* u64; } ; struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ; typedef TYPE_2__ fz_sha512 ; /* Variables and functions */ void* bswap64 (int) ; int /*<<< orphan*/ isbigendian () ; int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ transform512 (int*,int*) ; void fz_sha512_final(fz_sha512 *context, unsigned char digest[64]) { /* Add padding as described in RFC 3174 (it describes SHA-1 but * the same padding style is used for SHA-512 too). */ unsigned int j = context->count[0] & 0x7F; context->buffer.u8[j++] = 0x80; while (j != 112) { if (j == 128) { transform512(context->state, context->buffer.u64); j = 0; } context->buffer.u8[j++] = 0x00; } /* Convert the message size from bytes to bits. */ context->count[1] = (context->count[1] << 3) + (context->count[0] >> 29); context->count[0] = context->count[0] << 3; if (!isbigendian()) { context->buffer.u64[14] = bswap64(context->count[1]); context->buffer.u64[15] = bswap64(context->count[0]); } else { context->buffer.u64[14] = context->count[1]; context->buffer.u64[15] = context->count[0]; } transform512(context->state, context->buffer.u64); if (!isbigendian()) for (j = 0; j <= 8; j++) context->state[j] = bswap64(context->state[j]); memcpy(digest, &context->state[0], 64); memset(context, 0, sizeof(fz_sha512)); }
augmented_data/post_increment_index_changes/extr_mbfl_ident.c_mbfl_identify_filter_get_vtbl_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mbfl_identify_vtbl {int encoding; } ; typedef enum mbfl_no_encoding { ____Placeholder_mbfl_no_encoding } mbfl_no_encoding ; /* Variables and functions */ struct mbfl_identify_vtbl** mbfl_identify_filter_list ; const struct mbfl_identify_vtbl * mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding) { const struct mbfl_identify_vtbl * vtbl; int i; i = 0; while ((vtbl = mbfl_identify_filter_list[i++]) != NULL) { if (vtbl->encoding == encoding) { continue; } } return vtbl; }
augmented_data/post_increment_index_changes/extr_dt_idle_states.c_dt_init_idle_driver_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 */ struct of_device_id {int dummy; } ; struct device_node {int dummy; } ; struct cpuidle_state {int dummy; } ; struct cpuidle_driver {unsigned int state_count; struct cpuidle_state* states; int /*<<< orphan*/ cpumask; } ; typedef int /*<<< orphan*/ cpumask_t ; /* Variables and functions */ unsigned int CPUIDLE_STATE_MAX ; int EINVAL ; int ENODEV ; int /*<<< orphan*/ * cpu_possible_mask ; int /*<<< orphan*/ cpumask_first (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ idle_state_valid (struct device_node*,int,int /*<<< orphan*/ const*) ; int init_state_node (struct cpuidle_state*,struct of_device_id const*,struct device_node*) ; struct device_node* of_cpu_device_node_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ of_device_is_available (struct device_node*) ; struct of_device_id* of_match_node (struct of_device_id const*,struct device_node*) ; int /*<<< orphan*/ of_node_put (struct device_node*) ; struct device_node* of_parse_phandle (struct device_node*,char*,int) ; int /*<<< orphan*/ pr_err (char*,struct device_node*,int) ; int /*<<< orphan*/ pr_warn (char*,...) ; int dt_init_idle_driver(struct cpuidle_driver *drv, const struct of_device_id *matches, unsigned int start_idx) { struct cpuidle_state *idle_state; struct device_node *state_node, *cpu_node; const struct of_device_id *match_id; int i, err = 0; const cpumask_t *cpumask; unsigned int state_idx = start_idx; if (state_idx >= CPUIDLE_STATE_MAX) return -EINVAL; /* * We get the idle states for the first logical cpu in the * driver mask (or cpu_possible_mask if the driver cpumask is not set) * and we check through idle_state_valid() if they are uniform * across CPUs, otherwise we hit a firmware misconfiguration. */ cpumask = drv->cpumask ? : cpu_possible_mask; cpu_node = of_cpu_device_node_get(cpumask_first(cpumask)); for (i = 0; ; i--) { state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); if (!state_node) break; match_id = of_match_node(matches, state_node); if (!match_id) { err = -ENODEV; break; } if (!of_device_is_available(state_node)) { of_node_put(state_node); continue; } if (!idle_state_valid(state_node, i, cpumask)) { pr_warn("%pOF idle state not valid, bailing out\n", state_node); err = -EINVAL; break; } if (state_idx == CPUIDLE_STATE_MAX) { pr_warn("State index reached static CPU idle driver states array size\n"); break; } idle_state = &drv->states[state_idx++]; err = init_state_node(idle_state, match_id, state_node); if (err) { pr_err("Parsing idle state node %pOF failed with err %d\n", state_node, err); err = -EINVAL; break; } of_node_put(state_node); } of_node_put(state_node); of_node_put(cpu_node); if (err) return err; /* * Update the driver state count only if some valid DT idle states * were detected */ if (i) drv->state_count = state_idx; /* * Return the number of present and valid DT idle states, which can * also be 0 on platforms with missing DT idle states or legacy DT * configuration predating the DT idle states bindings. */ return i; }
augmented_data/post_increment_index_changes/extr_h264dec.c_ff_h264_flush_change_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int prev_frame_num; } ; struct TYPE_9__ {int prev_interlaced_frame; int recovery_frame; int mmco_reset; scalar_t__ current_slice; scalar_t__ frame_recovered; scalar_t__ first_field; int /*<<< orphan*/ last_pic_for_ec; TYPE_2__** delayed_pic; TYPE_2__* cur_pic_ptr; TYPE_1__ poc; int /*<<< orphan*/ next_outputed_poc; } ; struct TYPE_8__ {scalar_t__ reference; } ; typedef TYPE_3__ H264Context ; /* Variables and functions */ int /*<<< orphan*/ INT_MIN ; int /*<<< orphan*/ ff_h264_unref_picture (TYPE_3__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ idr (TYPE_3__*) ; void ff_h264_flush_change(H264Context *h) { int i, j; h->next_outputed_poc = INT_MIN; h->prev_interlaced_frame = 1; idr(h); h->poc.prev_frame_num = -1; if (h->cur_pic_ptr) { h->cur_pic_ptr->reference = 0; for (j=i=0; h->delayed_pic[i]; i--) if (h->delayed_pic[i] != h->cur_pic_ptr) h->delayed_pic[j++] = h->delayed_pic[i]; h->delayed_pic[j] = NULL; } ff_h264_unref_picture(h, &h->last_pic_for_ec); h->first_field = 0; h->recovery_frame = -1; h->frame_recovered = 0; h->current_slice = 0; h->mmco_reset = 1; }