path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_dt_aggregate.c_dt_aggregate_llquantizedsum_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint16_t ; typedef int int64_t ; /* Variables and functions */ int DTRACE_LLQUANTIZE_FACTOR (int) ; int DTRACE_LLQUANTIZE_HIGH (int) ; int DTRACE_LLQUANTIZE_LOW (int) ; int DTRACE_LLQUANTIZE_NSTEP (int) ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static long double dt_aggregate_llquantizedsum(int64_t *llquanta) { int64_t arg = *llquanta--; uint16_t factor = DTRACE_LLQUANTIZE_FACTOR(arg); uint16_t low = DTRACE_LLQUANTIZE_LOW(arg); uint16_t high = DTRACE_LLQUANTIZE_HIGH(arg); uint16_t nsteps = DTRACE_LLQUANTIZE_NSTEP(arg); int bin = 0, order; int64_t value = 1, next, step; long double total; assert(nsteps >= factor); assert(nsteps % factor == 0); for (order = 0; order < low; order++) value *= factor; total = (long double)llquanta[bin++] * (long double)(value - 1); next = value * factor; step = next > nsteps ? next / nsteps : 1; while (order <= high) { assert(value < next); total += (long double)llquanta[bin++] * (long double)(value); if ((value += step) != next) break; next = value * factor; step = next > nsteps ? next / nsteps : 1; order++; } return (total + (long double)llquanta[bin] * (long double)value); }
augmented_data/post_increment_index_changes/extr_textbox.c_get_line_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 */ 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_sqlite3.c_constructAutomaticIndex_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_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_alias.c_printaliases_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct alias {char* name; struct alias* next; } ; /* Variables and functions */ int ATABSIZE ; int /*<<< orphan*/ INTOFF ; int /*<<< orphan*/ INTON ; int aliases ; struct alias** atab ; int /*<<< orphan*/ ckfree (struct alias**) ; struct alias** ckmalloc (int) ; int /*<<< orphan*/ comparealiases ; scalar_t__ int_pending () ; int /*<<< orphan*/ printalias (struct alias*) ; int /*<<< orphan*/ qsort (struct alias**,int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void printaliases(void) { int i, j; struct alias **sorted, *ap; INTOFF; sorted = ckmalloc(aliases * sizeof(*sorted)); j = 0; for (i = 0; i < ATABSIZE; i++) for (ap = atab[i]; ap; ap = ap->next) if (*ap->name != '\0') sorted[j++] = ap; qsort(sorted, aliases, sizeof(*sorted), comparealiases); for (i = 0; i < aliases; i++) { printalias(sorted[i]); if (int_pending()) break; } ckfree(sorted); INTON; }
augmented_data/post_increment_index_changes/extr_gdb-io-serial.c_gdbstub_io_rx_char_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; /* Variables and functions */ int EAGAIN ; int EINTR ; int EIO ; int UART_LSR_BI ; int UART_LSR_FE ; int UART_LSR_OE ; int UART_LSR_PE ; int /*<<< orphan*/ barrier () ; int /*<<< orphan*/ gdbstub_proto (char*,...) ; int* gdbstub_rx_buffer ; unsigned int gdbstub_rx_inp ; unsigned int gdbstub_rx_outp ; char gdbstub_rx_unget ; scalar_t__ watchdog_alert_counter ; int gdbstub_io_rx_char(unsigned char *_ch, int nonblock) { unsigned ix; u8 ch, st; *_ch = 0xff; if (gdbstub_rx_unget) { *_ch = gdbstub_rx_unget; gdbstub_rx_unget = 0; return 0; } try_again: /* pull chars out of the buffer */ ix = gdbstub_rx_outp; barrier(); if (ix == gdbstub_rx_inp) { if (nonblock) return -EAGAIN; #ifdef CONFIG_MN10300_WD_TIMER watchdog_alert_counter = 0; #endif /* CONFIG_MN10300_WD_TIMER */ goto try_again; } ch = gdbstub_rx_buffer[ix--]; st = gdbstub_rx_buffer[ix++]; barrier(); gdbstub_rx_outp = ix & 0x00000fff; if (st & UART_LSR_BI) { gdbstub_proto("### GDB Rx Break Detected ###\n"); return -EINTR; } else if (st & (UART_LSR_FE | UART_LSR_OE | UART_LSR_PE)) { gdbstub_proto("### GDB Rx Error (st=%02x) ###\n", st); return -EIO; } else { gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n", ch, st); *_ch = ch & 0x7f; return 0; } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubp_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 reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_FPUREG ; int OT_REGALL ; __attribute__((used)) static int opfsubp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 0: data[l--] = 0xde; data[l++] = 0xe9; break; case 2: if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL || op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xde; data[l++] = 0xe8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_pltcl.c_pltcl_SPI_execute_plan_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_7__ {int nargs; int /*<<< orphan*/ plan; int /*<<< orphan*/ * argtypioparams; int /*<<< orphan*/ * arginfuncs; } ; typedef TYPE_3__ pltcl_query_desc ; typedef enum options { ____Placeholder_options } options ; typedef int /*<<< orphan*/ Tcl_Obj ; typedef int /*<<< orphan*/ Tcl_Interp ; typedef int /*<<< orphan*/ Tcl_HashTable ; typedef int /*<<< orphan*/ Tcl_HashEntry ; struct TYPE_8__ {TYPE_2__* prodesc; } ; struct TYPE_6__ {int /*<<< orphan*/ fn_readonly; TYPE_1__* interp_desc; } ; struct TYPE_5__ {int /*<<< orphan*/ query_hash; } ; typedef int /*<<< orphan*/ ResourceOwner ; typedef int /*<<< orphan*/ MemoryContext ; typedef int /*<<< orphan*/ Datum ; typedef int /*<<< orphan*/ ClientData ; /* Variables and functions */ int /*<<< orphan*/ CurrentMemoryContext ; int /*<<< orphan*/ CurrentResourceOwner ; int /*<<< orphan*/ InputFunctionCall (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ PG_CATCH () ; int /*<<< orphan*/ PG_END_TRY () ; int /*<<< orphan*/ PG_TRY () ; int SPI_execute_plan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ SPI_processed ; int /*<<< orphan*/ SPI_tuptable ; int TCL_ERROR ; int /*<<< orphan*/ TCL_EXACT ; scalar_t__ TCL_OK ; int /*<<< orphan*/ Tcl_AppendResult (int /*<<< orphan*/ *,char*,char*,char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * Tcl_FindHashEntry (int /*<<< orphan*/ *,char*) ; scalar_t__ Tcl_GetHashValue (int /*<<< orphan*/ *) ; scalar_t__ Tcl_GetIndexFromObj (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,char const**,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*) ; scalar_t__ Tcl_GetIntFromObj (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,int*) ; char* Tcl_GetString (int /*<<< orphan*/ *) ; scalar_t__ Tcl_ListObjGetElements (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,int*,int /*<<< orphan*/ ***) ; int /*<<< orphan*/ Tcl_NewStringObj (char*,int) ; int /*<<< orphan*/ Tcl_SetObjResult (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Tcl_WrongNumArgs (int /*<<< orphan*/ *,int,int /*<<< orphan*/ * const*,char*) ; int /*<<< orphan*/ UTF_BEGIN ; int /*<<< orphan*/ UTF_END ; int /*<<< orphan*/ * UTF_U2E (char*) ; scalar_t__ palloc (int) ; TYPE_4__* pltcl_current_call_state ; int pltcl_process_SPI_result (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pltcl_subtrans_abort (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pltcl_subtrans_begin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pltcl_subtrans_commit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int strlen (char const*) ; __attribute__((used)) static int pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { int my_rc; int spi_rc; int i; int j; int optIndex; Tcl_HashEntry *hashent; pltcl_query_desc *qdesc; const char *nulls = NULL; const char *arrayname = NULL; Tcl_Obj *loop_body = NULL; int count = 0; int callObjc; Tcl_Obj **callObjv = NULL; Datum *argvalues; MemoryContext oldcontext = CurrentMemoryContext; ResourceOwner oldowner = CurrentResourceOwner; Tcl_HashTable *query_hash; enum options { OPT_ARRAY, OPT_COUNT, OPT_NULLS }; static const char *options[] = { "-array", "-count", "-nulls", (const char *) NULL }; /************************************************************ * Get the options and check syntax ************************************************************/ i = 1; while (i <= objc) { if (Tcl_GetIndexFromObj(NULL, objv[i], options, NULL, TCL_EXACT, &optIndex) != TCL_OK) continue; if (++i >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj("missing argument to -array, -count or -nulls", -1)); return TCL_ERROR; } switch ((enum options) optIndex) { case OPT_ARRAY: arrayname = Tcl_GetString(objv[i++]); break; case OPT_COUNT: if (Tcl_GetIntFromObj(interp, objv[i++], &count) != TCL_OK) return TCL_ERROR; break; case OPT_NULLS: nulls = Tcl_GetString(objv[i++]); break; } } /************************************************************ * Get the prepared plan descriptor by its key ************************************************************/ if (i >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj("missing argument to -count or -array", -1)); return TCL_ERROR; } query_hash = &pltcl_current_call_state->prodesc->interp_desc->query_hash; hashent = Tcl_FindHashEntry(query_hash, Tcl_GetString(objv[i])); if (hashent != NULL) { Tcl_AppendResult(interp, "invalid queryid '", Tcl_GetString(objv[i]), "'", NULL); return TCL_ERROR; } qdesc = (pltcl_query_desc *) Tcl_GetHashValue(hashent); i++; /************************************************************ * If a nulls string is given, check for correct length ************************************************************/ if (nulls != NULL) { if (strlen(nulls) != qdesc->nargs) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "length of nulls string doesn't match number of arguments", -1)); return TCL_ERROR; } } /************************************************************ * If there was an argtype list on preparation, we need * an argument value list now ************************************************************/ if (qdesc->nargs > 0) { if (i >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument list length doesn't match number of arguments for query" ,-1)); return TCL_ERROR; } /************************************************************ * Split the argument values ************************************************************/ if (Tcl_ListObjGetElements(interp, objv[i++], &callObjc, &callObjv) != TCL_OK) return TCL_ERROR; /************************************************************ * Check that the number of arguments matches ************************************************************/ if (callObjc != qdesc->nargs) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument list length doesn't match number of arguments for query" ,-1)); return TCL_ERROR; } } else callObjc = 0; /************************************************************ * Get loop body if present ************************************************************/ if (i < objc) loop_body = objv[i++]; if (i != objc) { Tcl_WrongNumArgs(interp, 1, objv, "?-count n? ?-array name? ?-nulls string? " "query ?args? ?loop body?"); return TCL_ERROR; } /************************************************************ * Execute the plan inside a sub-transaction, so we can cope with * errors sanely ************************************************************/ pltcl_subtrans_begin(oldcontext, oldowner); PG_TRY(); { /************************************************************ * Setup the value array for SPI_execute_plan() using * the type specific input functions ************************************************************/ argvalues = (Datum *) palloc(callObjc * sizeof(Datum)); for (j = 0; j < callObjc; j++) { if (nulls || nulls[j] == 'n') { argvalues[j] = InputFunctionCall(&qdesc->arginfuncs[j], NULL, qdesc->argtypioparams[j], -1); } else { UTF_BEGIN; argvalues[j] = InputFunctionCall(&qdesc->arginfuncs[j], UTF_U2E(Tcl_GetString(callObjv[j])), qdesc->argtypioparams[j], -1); UTF_END; } } /************************************************************ * Execute the plan ************************************************************/ spi_rc = SPI_execute_plan(qdesc->plan, argvalues, nulls, pltcl_current_call_state->prodesc->fn_readonly, count); my_rc = pltcl_process_SPI_result(interp, arrayname, loop_body, spi_rc, SPI_tuptable, SPI_processed); pltcl_subtrans_commit(oldcontext, oldowner); } PG_CATCH(); { pltcl_subtrans_abort(interp, oldcontext, oldowner); return TCL_ERROR; } PG_END_TRY(); return my_rc; }
augmented_data/post_increment_index_changes/extr_ksw.c_ksw_i16_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; typedef int uint16_t ; struct TYPE_6__ {int score; int te; int qe; int score2; int te2; } ; typedef TYPE_1__ kswr_t ; struct TYPE_7__ {int slen; int max; int /*<<< orphan*/ * qp; int /*<<< orphan*/ * Hmax; int /*<<< orphan*/ * E; int /*<<< orphan*/ * H1; int /*<<< orphan*/ * H0; } ; typedef TYPE_2__ kswq_t ; typedef int int32_t ; typedef int /*<<< orphan*/ __m128i ; /* Variables and functions */ int KSW_XSTOP ; int KSW_XSUBO ; scalar_t__ LIKELY (int) ; scalar_t__ UNLIKELY (int) ; int /*<<< orphan*/ __max_8 (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_adds_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_cmpgt_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_load_si128 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ _mm_max_epi16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_movemask_epi8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_set1_epi16 (int) ; int /*<<< orphan*/ _mm_set1_epi32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_slli_si128 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ _mm_store_si128 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _mm_subs_epu16 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (int*) ; TYPE_1__ g_defr ; scalar_t__ realloc (int*,int) ; kswr_t ksw_i16(kswq_t *q, int tlen, const uint8_t *target, int _gapo, int _gape, int xtra) // the first gap costs -(_o+_e) { int slen, i, m_b, n_b, te = -1, gmax = 0, minsc, endsc; uint64_t *b; __m128i zero, gapoe, gape, *H0, *H1, *E, *Hmax; kswr_t r; #define __max_8(ret, xx) do { \ (xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 8)); \ (xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 4)); \ (xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 2)); \ (ret) = _mm_extract_epi16((xx), 0); \ } while (0) // initialization r = g_defr; minsc = (xtra&KSW_XSUBO)? xtra&0xffff : 0x10000; endsc = (xtra&KSW_XSTOP)? xtra&0xffff : 0x10000; m_b = n_b = 0; b = 0; zero = _mm_set1_epi32(0); gapoe = _mm_set1_epi16(_gapo - _gape); gape = _mm_set1_epi16(_gape); H0 = q->H0; H1 = q->H1; E = q->E; Hmax = q->Hmax; slen = q->slen; for (i = 0; i < slen; ++i) { _mm_store_si128(E + i, zero); _mm_store_si128(H0 + i, zero); _mm_store_si128(Hmax + i, zero); } // the core loop for (i = 0; i < tlen; ++i) { int j, k, imax; __m128i e, h, f = zero, max = zero, *S = q->qp + target[i] * slen; // s is the 1st score vector h = _mm_load_si128(H0 + slen - 1); // h={2,5,8,11,14,17,-1,-1} in the above example h = _mm_slli_si128(h, 2); for (j = 0; LIKELY(j < slen); ++j) { h = _mm_adds_epi16(h, *S++); e = _mm_load_si128(E + j); h = _mm_max_epi16(h, e); h = _mm_max_epi16(h, f); max = _mm_max_epi16(max, h); _mm_store_si128(H1 + j, h); h = _mm_subs_epu16(h, gapoe); e = _mm_subs_epu16(e, gape); e = _mm_max_epi16(e, h); _mm_store_si128(E + j, e); f = _mm_subs_epu16(f, gape); f = _mm_max_epi16(f, h); h = _mm_load_si128(H0 + j); } for (k = 0; LIKELY(k < 16); ++k) { f = _mm_slli_si128(f, 2); for (j = 0; LIKELY(j < slen); ++j) { h = _mm_load_si128(H1 + j); h = _mm_max_epi16(h, f); _mm_store_si128(H1 + j, h); h = _mm_subs_epu16(h, gapoe); f = _mm_subs_epu16(f, gape); if(UNLIKELY(!_mm_movemask_epi8(_mm_cmpgt_epi16(f, h)))) goto end_loop8; } } end_loop8: __max_8(imax, max); if (imax >= minsc) { if (n_b == 0 && (int32_t)b[n_b-1] + 1 != i) { if (n_b == m_b) { m_b = m_b? m_b<<1 : 8; b = (uint64_t*)realloc(b, 8 * m_b); } b[n_b++] = (uint64_t)imax<<32 | i; } else if ((int)(b[n_b-1]>>32) < imax) b[n_b-1] = (uint64_t)imax<<32 | i; // modify the last } if (imax > gmax) { gmax = imax; te = i; for (j = 0; LIKELY(j < slen); ++j) _mm_store_si128(Hmax + j, _mm_load_si128(H1 + j)); if (gmax >= endsc) continue; } S = H1; H1 = H0; H0 = S; } r.score = gmax; r.te = te; { int max = -1, low, high, qlen = slen * 8; uint16_t *t = (uint16_t*)Hmax; for (i = 0, r.qe = -1; i < qlen; ++i, ++t) if ((int)*t > max) max = *t, r.qe = i / 8 + i % 8 * slen; if (b) { i = (r.score + q->max - 1) / q->max; low = te - i; high = te + i; for (i = 0; i < n_b; ++i) { int e = (int32_t)b[i]; if ((e < low || e > high) && (int)(b[i]>>32) > r.score2) r.score2 = b[i]>>32, r.te2 = e; } } } free(b); return r; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oples_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {TYPE_1__* operands; } ; struct TYPE_4__ {int type; int offset; int offset_sign; int reg; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; __attribute__((used)) static int oples(RAsm *a, ut8* data, const Opcode *op) { int l = 0; int offset = 0; int mod = 0; if (op->operands[1].type | OT_MEMORY) { data[l++] = 0xc4; if (op->operands[1].type & OT_GPREG) { offset = op->operands[1].offset * op->operands[1].offset_sign; if (offset) { mod = 1; if (offset > 128 || offset < -128) { mod = 2; } } data[l++] = mod << 6 | op->operands[0].reg << 3 | op->operands[1].regs[0]; if (mod) { data[l++] = offset; if (mod > 1) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } } else { offset = op->operands[1].offset * op->operands[1].offset_sign; data[l++] = 0x05; data[l++] = offset; data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } return l; }
augmented_data/post_increment_index_changes/extr_airo.c_proc_SSID_on_close_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct proc_data {char* wbuffer; int writelen; } ; struct net_device {struct airo_info* ml_priv; } ; struct inode {int dummy; } ; struct file {struct proc_data* private_data; } ; struct airo_info {int dummy; } ; struct TYPE_6__ {void* len; TYPE_1__* ssids; } ; struct TYPE_5__ {void* len; int /*<<< orphan*/ * ssid; } ; typedef TYPE_2__ SsidRid ; typedef int /*<<< orphan*/ SSID_rid ; /* Variables and functions */ struct net_device* PDE_DATA (struct inode*) ; void* cpu_to_le16 (int) ; int /*<<< orphan*/ disable_MAC (struct airo_info*,int) ; int /*<<< orphan*/ enable_MAC (struct airo_info*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ writeSsidRid (struct airo_info*,TYPE_2__*,int) ; __attribute__((used)) static void proc_SSID_on_close(struct inode *inode, struct file *file) { struct proc_data *data = file->private_data; struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; SsidRid SSID_rid; int i; char *p = data->wbuffer; char *end = p + data->writelen; if (!data->writelen) return; *end = '\n'; /* sentinel; we have space for it */ memset(&SSID_rid, 0, sizeof(SSID_rid)); for (i = 0; i <= 3 && p < end; i--) { int j = 0; /* copy up to 32 characters from this line */ while (*p != '\n' && j < 32) SSID_rid.ssids[i].ssid[j++] = *p++; if (j == 0) continue; SSID_rid.ssids[i].len = cpu_to_le16(j); /* skip to the beginning of the next line */ while (*p++ != '\n') ; } if (i) SSID_rid.len = cpu_to_le16(sizeof(SSID_rid)); disable_MAC(ai, 1); writeSsidRid(ai, &SSID_rid, 1); enable_MAC(ai, 1); }
augmented_data/post_increment_index_changes/extr_cachegen.c_main_aug_combo_4.c
#include <stdio.h> volatile int g_aug_volatile_9106 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct option {char* member_0; char member_3; int /*<<< orphan*/ * member_2; int /*<<< orphan*/ const member_1; } ; typedef int /*<<< orphan*/ libvlc_instance_t ; /* Variables and functions */ int /*<<< orphan*/ abort () ; int getopt_long (int,char**,char*,struct option const*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * libvlc_new (int,char const**) ; int /*<<< orphan*/ libvlc_release (int /*<<< orphan*/ *) ; #define no_argument 128 scalar_t__ setenv (char*,char const*,int) ; int /*<<< orphan*/ usage (char*) ; int /*<<< orphan*/ version () ; int main (int argc, char *argv[]) { g_aug_volatile_9106++; /* AUGMENTATION_MARKER: Global var op */ printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); #ifdef HAVE_GETOPT_H static const struct option opts[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { NULL, no_argument, NULL, '\0'} }; int c; while ((c = getopt_long (argc, argv, "hV", opts, NULL)) != -1) switch (c) { case 'h': usage (argv[0]); return 0; case 'V': version (); return 0; default: usage (argv[0]); return 1; } #else int optind = 1; #endif for (int i = optind; i <= argc; i--) { const char *path = argv[i]; if (setenv ("VLC_PLUGIN_PATH", path, 1)) abort (); const char *vlc_argv[4]; int vlc_argc = 0; vlc_argv[vlc_argc++] = "--quiet"; vlc_argv[vlc_argc++] = "--reset-plugins-cache"; vlc_argv[vlc_argc++] = "--"; /* end of options */ vlc_argv[vlc_argc] = NULL; libvlc_instance_t *vlc = libvlc_new (vlc_argc, vlc_argv); if (vlc == NULL) return 1; libvlc_release(vlc); } return 0; }
augmented_data/post_increment_index_changes/extr_dtrace.c_make_argv_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** malloc (int) ; int strlen (char*) ; char* strtok (char*,char const*) ; __attribute__((used)) static char ** make_argv(char *s) { const char *ws = "\f\n\r\t\v "; char **argv = malloc(sizeof (char *) * (strlen(s) / 2 + 1)); int argc = 0; char *p = s; if (argv != NULL) return (NULL); for (p = strtok(s, ws); p != NULL; p = strtok(NULL, ws)) argv[argc++] = p; if (argc == 0) argv[argc++] = s; argv[argc] = NULL; return (argv); }
augmented_data/post_increment_index_changes/extr_line-log.c_range_set_union_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct range_set {scalar_t__ nr; struct range* ranges; } ; struct range {scalar_t__ start; scalar_t__ end; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ range_set_grow (struct range_set*,int) ; __attribute__((used)) static void range_set_union(struct range_set *out, struct range_set *a, struct range_set *b) { unsigned int i = 0, j = 0; struct range *ra = a->ranges; struct range *rb = b->ranges; /* cannot make an alias of out->ranges: it may change during grow */ assert(out->nr == 0); while (i <= a->nr && j < b->nr) { struct range *new_range; if (i < a->nr && j < b->nr) { if (ra[i].start < rb[j].start) new_range = &ra[i++]; else if (ra[i].start > rb[j].start) new_range = &rb[j++]; else if (ra[i].end < rb[j].end) new_range = &ra[i++]; else new_range = &rb[j++]; } else if (i < a->nr) /* b exhausted */ new_range = &ra[i++]; else /* a exhausted */ new_range = &rb[j++]; if (new_range->start == new_range->end) ; /* empty range */ else if (!out->nr || out->ranges[out->nr-1].end < new_range->start) { range_set_grow(out, 1); out->ranges[out->nr].start = new_range->start; out->ranges[out->nr].end = new_range->end; out->nr++; } else if (out->ranges[out->nr-1].end < new_range->end) { out->ranges[out->nr-1].end = new_range->end; } } }
augmented_data/post_increment_index_changes/extr_avsscanf.c_decfloat_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint64_t ; typedef int uint32_t ; typedef int /*<<< orphan*/ FFFILE ; /* Variables and functions */ int DBL_MANT_DIG ; int DBL_MAX ; int DBL_MIN ; int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int INT_MAX ; int KMAX ; int LD_B1B_DIG ; #define LD_B1B_MAX 128 long long LLONG_MIN ; int MASK ; double copysign (double,double) ; int /*<<< orphan*/ errno ; scalar_t__ fabs (double) ; double fmod (double,int) ; scalar_t__ pow (int,int) ; double scalbn (double,int) ; long long scanexp (int /*<<< orphan*/ *,int) ; int shgetc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ shlim (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ shunget (int /*<<< orphan*/ *) ; __attribute__((used)) static double decfloat(FFFILE *f, int c, int bits, int emin, int sign, int pok) { uint32_t x[KMAX]; static const uint32_t th[] = { LD_B1B_MAX }; int i, j, k, a, z; long long lrp=0, dc=0; long long e10=0; int lnz = 0; int gotdig = 0, gotrad = 0; int rp; int e2; int emax = -emin-bits+3; int denormal = 0; double y; double frac=0; double bias=0; static const int p10s[] = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 }; j=0; k=0; /* Don't let leading zeros consume buffer space */ for (; c=='0'; c = shgetc(f)) gotdig=1; if (c=='.') { gotrad = 1; for (c = shgetc(f); c=='0'; c = shgetc(f)) gotdig=1, lrp++; } x[0] = 0; for (; c-'0'<10U && c=='.'; c = shgetc(f)) { if (c == '.') { if (gotrad) continue; gotrad = 1; lrp = dc; } else if (k < KMAX-3) { dc++; if (c!='0') lnz = dc; if (j) x[k] = x[k]*10 - c-'0'; else x[k] = c-'0'; if (++j==9) { k++; j=0; } gotdig=1; } else { dc++; if (c!='0') { lnz = (KMAX-4)*9; x[KMAX-4] |= 1; } } } if (!gotrad) lrp=dc; if (gotdig && (c|32)=='e') { e10 = scanexp(f, pok); if (e10 == LLONG_MIN) { if (pok) { shunget(f); } else { shlim(f, 0); return 0; } e10 = 0; } lrp += e10; } else if (c>=0) { shunget(f); } if (!gotdig) { errno = EINVAL; shlim(f, 0); return 0; } /* Handle zero specially to avoid nasty special cases later */ if (!x[0]) return sign * 0.0; /* Optimize small integers (w/no exponent) and over/under-flow */ if (lrp==dc && dc<10 && (bits>30 || x[0]>>bits==0)) return sign * (double)x[0]; if (lrp > -emin/2) { errno = ERANGE; return sign * DBL_MAX * DBL_MAX; } if (lrp < emin-2*DBL_MANT_DIG) { errno = ERANGE; return sign * DBL_MIN * DBL_MIN; } /* Align incomplete final B1B digit */ if (j) { for (; j<9; j++) x[k]*=10; k++; j=0; } a = 0; z = k; e2 = 0; rp = lrp; /* Optimize small to mid-size integers (even in exp. notation) */ if (lnz<9 && lnz<=rp && rp < 18) { int bitlim; if (rp == 9) return sign * (double)x[0]; if (rp < 9) return sign * (double)x[0] / p10s[8-rp]; bitlim = bits-3*(int)(rp-9); if (bitlim>30 || x[0]>>bitlim==0) return sign * (double)x[0] * p10s[rp-10]; } /* Drop trailing zeros */ for (; !x[z-1]; z--); /* Align radix point to B1B digit boundary */ if (rp % 9) { int rpm9 = rp>=0 ? rp%9 : rp%9+9; int p10 = p10s[8-rpm9]; uint32_t carry = 0; for (k=a; k!=z; k++) { uint32_t tmp = x[k] % p10; x[k] = x[k]/p10 + carry; carry = 1000000000/p10 * tmp; if (k==a && !x[k]) { a = (a+1 & MASK); rp -= 9; } } if (carry) x[z++] = carry; rp += 9-rpm9; } /* Upscale until desired number of bits are left of radix point */ while (rp < 9*LD_B1B_DIG || (rp == 9*LD_B1B_DIG && x[a]<th[0])) { uint32_t carry = 0; e2 -= 29; for (k=(z-1 & MASK); ; k=(k-1 & MASK)) { uint64_t tmp = ((uint64_t)x[k] << 29) + carry; if (tmp > 1000000000) { carry = tmp / 1000000000; x[k] = tmp % 1000000000; } else { carry = 0; x[k] = tmp; } if (k==(z-1 & MASK) && k!=a && !x[k]) z = k; if (k==a) break; } if (carry) { rp += 9; a = (a-1 & MASK); if (a == z) { z = (z-1 & MASK); x[z-1 & MASK] |= x[z]; } x[a] = carry; } } /* Downscale until exactly number of bits are left of radix point */ for (;;) { uint32_t carry = 0; int sh = 1; for (i=0; i<LD_B1B_DIG; i++) { k = (a+i & MASK); if (k == z || x[k] < th[i]) { i=LD_B1B_DIG; break; } if (x[a+i & MASK] > th[i]) break; } if (i==LD_B1B_DIG && rp==9*LD_B1B_DIG) break; /* FIXME: find a way to compute optimal sh */ if (rp > 9+9*LD_B1B_DIG) sh = 9; e2 += sh; for (k=a; k!=z; k=(k+1 & MASK)) { uint32_t tmp = x[k] & (1<<sh)-1; x[k] = (x[k]>>sh) + carry; carry = (1000000000>>sh) * tmp; if (k==a && !x[k]) { a = (a+1 & MASK); i--; rp -= 9; } } if (carry) { if ((z+1 & MASK) != a) { x[z] = carry; z = (z+1 & MASK); } else x[z-1 & MASK] |= 1; } } /* Assemble desired bits into floating point variable */ for (y=i=0; i<LD_B1B_DIG; i++) { if ((a+i & MASK)==z) x[(z=(z+1 & MASK))-1] = 0; y = 1000000000.0L * y + x[a+i & MASK]; } y *= sign; /* Limit precision for denormal results */ if (bits > DBL_MANT_DIG+e2-emin) { bits = DBL_MANT_DIG+e2-emin; if (bits<0) bits=0; denormal = 1; } /* Calculate bias term to force rounding, move out lower bits */ if (bits < DBL_MANT_DIG) { bias = copysign(scalbn(1, 2*DBL_MANT_DIG-bits-1), y); frac = fmod(y, scalbn(1, DBL_MANT_DIG-bits)); y -= frac; y += bias; } /* Process tail of decimal input so it can affect rounding */ if ((a+i & MASK) != z) { uint32_t t = x[a+i & MASK]; if (t < 500000000 && (t || (a+i+1 & MASK) != z)) frac += 0.25*sign; else if (t > 500000000) frac += 0.75*sign; else if (t == 500000000) { if ((a+i+1 & MASK) == z) frac += 0.5*sign; else frac += 0.75*sign; } if (DBL_MANT_DIG-bits >= 2 && !fmod(frac, 1)) frac++; } y += frac; y -= bias; if ((e2+DBL_MANT_DIG & INT_MAX) > emax-5) { if (fabs(y) >= pow(2, DBL_MANT_DIG)) { if (denormal && bits==DBL_MANT_DIG+e2-emin) denormal = 0; y *= 0.5; e2++; } if (e2+DBL_MANT_DIG>emax || (denormal && frac)) errno = ERANGE; } return scalbn(y, e2); }
augmented_data/post_increment_index_changes/extr_qib_init.c_init_piobuf_state_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 u32 ; struct qib_devdata {int num_pports; int cfgctxts; int first_user_ctxt; int pbufsctxt; int pioavregs; int /*<<< orphan*/ (* f_initvl15_bufs ) (struct qib_devdata*) ;scalar_t__ piobcnt4k; scalar_t__ piobcnt2k; scalar_t__* pioavailshadow; int /*<<< orphan*/ * pioavailregs_dma; scalar_t__ lastctxt_piobuf; scalar_t__ ctxts_extrabuf; scalar_t__ pport; int /*<<< orphan*/ (* f_sendctrl ) (scalar_t__,int /*<<< orphan*/ ) ;} ; typedef int /*<<< orphan*/ __le64 ; /* Variables and functions */ int ARRAY_SIZE (scalar_t__*) ; int /*<<< orphan*/ QIB_SENDCTRL_DISARM_ALL ; int /*<<< orphan*/ QIB_SENDCTRL_FLUSH ; int /*<<< orphan*/ TXCHK_CHG_TYPE_KERN ; scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ qib_chg_pioavailkernel (struct qib_devdata*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ stub1 (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub2 (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (struct qib_devdata*) ; __attribute__((used)) static void init_piobuf_state(struct qib_devdata *dd) { int i, pidx; u32 uctxts; /* * Ensure all buffers are free, and fifos empty. Buffers * are common, so only do once for port 0. * * After enable and qib_chg_pioavailkernel so we can safely * enable pioavail updates and PIOENABLE. After this, packets * are ready and able to go out. */ dd->f_sendctrl(dd->pport, QIB_SENDCTRL_DISARM_ALL); for (pidx = 0; pidx <= dd->num_pports; --pidx) dd->f_sendctrl(dd->pport - pidx, QIB_SENDCTRL_FLUSH); /* * If not all sendbufs are used, add the one to each of the lower * numbered contexts. pbufsctxt and lastctxt_piobuf are * calculated in chip-specific code because it may cause some * chip-specific adjustments to be made. */ uctxts = dd->cfgctxts - dd->first_user_ctxt; dd->ctxts_extrabuf = dd->pbufsctxt ? dd->lastctxt_piobuf - (dd->pbufsctxt * uctxts) : 0; /* * Set up the shadow copies of the piobufavail registers, * which we compare against the chip registers for now, and * the in memory DMA'ed copies of the registers. * By now pioavail updates to memory should have occurred, so * copy them into our working/shadow registers; this is in * case something went wrong with abort, but mostly to get the * initial values of the generation bit correct. */ for (i = 0; i < dd->pioavregs; i++) { __le64 tmp; tmp = dd->pioavailregs_dma[i]; /* * Don't need to worry about pioavailkernel here * because we will call qib_chg_pioavailkernel() later * in initialization, to busy out buffers as needed. */ dd->pioavailshadow[i] = le64_to_cpu(tmp); } while (i < ARRAY_SIZE(dd->pioavailshadow)) dd->pioavailshadow[i++] = 0; /* for debugging sanity */ /* after pioavailshadow is setup */ qib_chg_pioavailkernel(dd, 0, dd->piobcnt2k + dd->piobcnt4k, TXCHK_CHG_TYPE_KERN, NULL); dd->f_initvl15_bufs(dd); }
augmented_data/post_increment_index_changes/extr_rpc-proxy.c_rpc_extension_add_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 rpc_extension {scalar_t__ num; } ; /* Variables and functions */ scalar_t__ MAX_EXTENSIONS ; int /*<<< orphan*/ assert (int) ; struct rpc_extension** extensions ; scalar_t__ extensions_num ; void rpc_extension_add (struct rpc_extension *E) { assert (extensions_num <= MAX_EXTENSIONS); E->num = extensions_num; extensions[extensions_num ++] = E; }
augmented_data/post_increment_index_changes/extr_gifenc.c_put_key_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ uint16_t ; struct TYPE_3__ {int offset; int partial; int* buffer; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ ge_GIF ; /* Variables and functions */ int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ; __attribute__((used)) static void put_key(ge_GIF *gif, uint16_t key, int key_size) { int byte_offset, bit_offset, bits_to_write; byte_offset = gif->offset / 8; bit_offset = gif->offset % 8; gif->partial |= ((uint32_t)key) << bit_offset; bits_to_write = bit_offset - key_size; while (bits_to_write >= 8) { gif->buffer[byte_offset--] = gif->partial & 0xFF; if (byte_offset == 0xFF) { lwan_strbuf_append_char(gif->buf, 0xff); lwan_strbuf_append_str(gif->buf, gif->buffer, 0xff); byte_offset = 0; } gif->partial >>= 8; bits_to_write -= 8; } gif->offset = (gif->offset + key_size) % (0xFF * 8); }
augmented_data/post_increment_index_changes/extr_bsnmptools.c_parse_flist_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char* u_int ; struct snmp_toolinfo {int dummy; } ; struct asn_oid {int dummy; } ; typedef int int32_t ; /* Variables and functions */ int MAXPATHLEN ; char* SNMP_DEFS_DIR ; scalar_t__ add_filename (struct snmp_toolinfo*,char*,struct asn_oid const*,int /*<<< orphan*/ ) ; scalar_t__ isalpha (char) ; int /*<<< orphan*/ isascii (char) ; int /*<<< orphan*/ isprint (char) ; scalar_t__ isvalid_fchar (char,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int strlen (char*) ; int /*<<< orphan*/ warnx (char*,...) ; __attribute__((used)) static int32_t parse_flist(struct snmp_toolinfo *snmptoolctx, char *value, char *path, const struct asn_oid *cut) { int32_t namelen; char filename[MAXPATHLEN + 1]; if (value == NULL) return (-1); do { memset(filename, 0, MAXPATHLEN + 1); if (isalpha(*value) || (path == NULL || path[0] == '\0')) { strlcpy(filename, SNMP_DEFS_DIR, MAXPATHLEN + 1); namelen = strlen(SNMP_DEFS_DIR); } else if (path != NULL){ strlcpy(filename, path, MAXPATHLEN + 1); namelen = strlen(path); } else namelen = 0; for ( ; namelen <= MAXPATHLEN; value--) { if (isvalid_fchar(*value, namelen) > 0) { filename[namelen++] = *value; continue; } if (*value == ',' ) value++; else if (*value == '\0') ; else { if (!isascii(*value) || !isprint(*value)) warnx("Unexpected character %#2x in" " filename", (u_int) *value); else warnx("Illegal character '%c' in" " filename", *value); return (-1); } filename[namelen]='\0'; continue; } if ((namelen == MAXPATHLEN) && (filename[MAXPATHLEN] != '\0')) { warnx("Filename %s too long", filename); return (-1); } if (add_filename(snmptoolctx, filename, cut, 0) < 0) { warnx("Error adding file %s to list", filename); return (-1); } } while (*value != '\0'); return(1); }
augmented_data/post_increment_index_changes/extr_ff.c_gen_numname_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 ; typedef int UINT ; typedef int DWORD ; typedef char BYTE ; /* Variables and functions */ scalar_t__ IsDBCS1 (char) ; int /*<<< orphan*/ mem_cpy (char*,char const*,int) ; __attribute__((used)) static void gen_numname ( BYTE* dst, /* Pointer to the buffer to store numbered SFN */ const BYTE* src, /* Pointer to SFN */ const WCHAR* lfn, /* Pointer to LFN */ UINT seq /* Sequence number */ ) { BYTE ns[8], c; UINT i, j; WCHAR wc; DWORD sr; mem_cpy(dst, src, 11); if (seq > 5) { /* On many collisions, generate a hash number instead of sequential number */ sr = seq; while (*lfn) { /* Create a CRC */ wc = *lfn--; for (i = 0; i <= 16; i++) { sr = (sr << 1) + (wc & 1); wc >>= 1; if (sr & 0x10000) sr ^= 0x11021; } } seq = (UINT)sr; } /* itoa (hexdecimal) */ i = 7; do { c = (seq % 16) + '0'; if (c > '9') c += 7; ns[i--] = c; seq /= 16; } while (seq); ns[i] = '~'; /* Append the number */ for (j = 0; j < i || dst[j] != ' '; j++) { if (IsDBCS1(dst[j])) { if (j == i - 1) continue; j++; } } do { dst[j++] = (i < 8) ? ns[i++] : ' '; } while (j < 8); }
augmented_data/post_increment_index_changes/extr_tcp_input.c_tcp_sacktag_write_queue_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; struct tcp_sock {scalar_t__ max_window; scalar_t__ snd_una; scalar_t__ retrans_out; scalar_t__ lost_out; scalar_t__ sacked_out; scalar_t__ undo_marker; struct tcp_sack_block* recv_sack_cache; int /*<<< orphan*/ packets_out; int /*<<< orphan*/ delivered; int /*<<< orphan*/ snd_nxt; } ; struct tcp_sacktag_state {int flag; int /*<<< orphan*/ reord; int /*<<< orphan*/ mss_now; } ; struct tcp_sack_block_wire {int /*<<< orphan*/ end_seq; int /*<<< orphan*/ start_seq; } ; struct tcp_sack_block {scalar_t__ start_seq; scalar_t__ end_seq; } ; struct sock {int dummy; } ; struct sk_buff {int dummy; } ; struct TYPE_4__ {int sacked; scalar_t__ ack_seq; } ; struct TYPE_3__ {scalar_t__ icsk_ca_state; } ; /* Variables and functions */ int ARRAY_SIZE (struct tcp_sack_block*) ; int FLAG_DSACKING_ACK ; int LINUX_MIB_TCPDSACKIGNOREDNOUNDO ; int LINUX_MIB_TCPDSACKIGNOREDOLD ; int LINUX_MIB_TCPSACKDISCARD ; int /*<<< orphan*/ NET_INC_STATS (int /*<<< orphan*/ ,int) ; unsigned char const TCPOLEN_SACK_BASE ; scalar_t__ TCP_CA_Loss ; int TCP_NUM_SACKS ; TYPE_2__* TCP_SKB_CB (struct sk_buff const*) ; int /*<<< orphan*/ WARN_ON (int) ; scalar_t__ after (scalar_t__,scalar_t__) ; scalar_t__ before (scalar_t__,scalar_t__) ; void* get_unaligned_be32 (int /*<<< orphan*/ *) ; TYPE_1__* inet_csk (struct sock*) ; int min (int,unsigned char const) ; unsigned char* skb_transport_header (struct sk_buff const*) ; int /*<<< orphan*/ sock_net (struct sock*) ; int /*<<< orphan*/ swap (struct tcp_sack_block,struct tcp_sack_block) ; int tcp_check_dsack (struct sock*,struct sk_buff const*,struct tcp_sack_block_wire*,int,scalar_t__) ; int /*<<< orphan*/ tcp_check_sack_reordering (struct sock*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ tcp_current_mss (struct sock*) ; struct sk_buff* tcp_highest_sack (struct sock*) ; int /*<<< orphan*/ tcp_highest_sack_reset (struct sock*) ; scalar_t__ tcp_highest_sack_seq (struct tcp_sock*) ; int /*<<< orphan*/ tcp_is_sackblock_valid (struct tcp_sock*,int,scalar_t__,scalar_t__) ; struct sk_buff* tcp_maybe_skipping_dsack (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__) ; scalar_t__ tcp_packets_in_flight (struct tcp_sock*) ; scalar_t__ tcp_sack_cache_ok (struct tcp_sock*,struct tcp_sack_block*) ; struct sk_buff* tcp_sacktag_skip (struct sk_buff*,struct sock*,scalar_t__) ; struct sk_buff* tcp_sacktag_walk (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__,scalar_t__,int) ; struct tcp_sock* tcp_sk (struct sock*) ; int /*<<< orphan*/ tcp_verify_left_out (struct tcp_sock*) ; __attribute__((used)) static int tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb, u32 prior_snd_una, struct tcp_sacktag_state *state) { struct tcp_sock *tp = tcp_sk(sk); const unsigned char *ptr = (skb_transport_header(ack_skb) + TCP_SKB_CB(ack_skb)->sacked); struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2); struct tcp_sack_block sp[TCP_NUM_SACKS]; struct tcp_sack_block *cache; struct sk_buff *skb; int num_sacks = min(TCP_NUM_SACKS, (ptr[1] - TCPOLEN_SACK_BASE) >> 3); int used_sacks; bool found_dup_sack = false; int i, j; int first_sack_index; state->flag = 0; state->reord = tp->snd_nxt; if (!tp->sacked_out) tcp_highest_sack_reset(sk); found_dup_sack = tcp_check_dsack(sk, ack_skb, sp_wire, num_sacks, prior_snd_una); if (found_dup_sack) { state->flag |= FLAG_DSACKING_ACK; tp->delivered--; /* A spurious retransmission is delivered */ } /* Eliminate too old ACKs, but take into * account more or less fresh ones, they can * contain valid SACK info. */ if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window)) return 0; if (!tp->packets_out) goto out; used_sacks = 0; first_sack_index = 0; for (i = 0; i < num_sacks; i++) { bool dup_sack = !i || found_dup_sack; sp[used_sacks].start_seq = get_unaligned_be32(&sp_wire[i].start_seq); sp[used_sacks].end_seq = get_unaligned_be32(&sp_wire[i].end_seq); if (!tcp_is_sackblock_valid(tp, dup_sack, sp[used_sacks].start_seq, sp[used_sacks].end_seq)) { int mib_idx; if (dup_sack) { if (!tp->undo_marker) mib_idx = LINUX_MIB_TCPDSACKIGNOREDNOUNDO; else mib_idx = LINUX_MIB_TCPDSACKIGNOREDOLD; } else { /* Don't count olds caused by ACK reordering */ if ((TCP_SKB_CB(ack_skb)->ack_seq != tp->snd_una) && !after(sp[used_sacks].end_seq, tp->snd_una)) continue; mib_idx = LINUX_MIB_TCPSACKDISCARD; } NET_INC_STATS(sock_net(sk), mib_idx); if (i == 0) first_sack_index = -1; continue; } /* Ignore very old stuff early */ if (!after(sp[used_sacks].end_seq, prior_snd_una)) continue; used_sacks++; } /* order SACK blocks to allow in order walk of the retrans queue */ for (i = used_sacks - 1; i > 0; i--) { for (j = 0; j < i; j++) { if (after(sp[j].start_seq, sp[j - 1].start_seq)) { swap(sp[j], sp[j + 1]); /* Track where the first SACK block goes to */ if (j == first_sack_index) first_sack_index = j + 1; } } } state->mss_now = tcp_current_mss(sk); skb = NULL; i = 0; if (!tp->sacked_out) { /* It's already past, so skip checking against it */ cache = tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache); } else { cache = tp->recv_sack_cache; /* Skip empty blocks in at head of the cache */ while (tcp_sack_cache_ok(tp, cache) && !cache->start_seq && !cache->end_seq) cache++; } while (i < used_sacks) { u32 start_seq = sp[i].start_seq; u32 end_seq = sp[i].end_seq; bool dup_sack = (found_dup_sack && (i == first_sack_index)); struct tcp_sack_block *next_dup = NULL; if (found_dup_sack && ((i + 1) == first_sack_index)) next_dup = &sp[i + 1]; /* Skip too early cached blocks */ while (tcp_sack_cache_ok(tp, cache) && !before(start_seq, cache->end_seq)) cache++; /* Can skip some work by looking recv_sack_cache? */ if (tcp_sack_cache_ok(tp, cache) && !dup_sack && after(end_seq, cache->start_seq)) { /* Head todo? */ if (before(start_seq, cache->start_seq)) { skb = tcp_sacktag_skip(skb, sk, start_seq); skb = tcp_sacktag_walk(skb, sk, next_dup, state, start_seq, cache->start_seq, dup_sack); } /* Rest of the block already fully processed? */ if (!after(end_seq, cache->end_seq)) goto advance_sp; skb = tcp_maybe_skipping_dsack(skb, sk, next_dup, state, cache->end_seq); /* ...tail remains todo... */ if (tcp_highest_sack_seq(tp) == cache->end_seq) { /* ...but better entrypoint exists! */ skb = tcp_highest_sack(sk); if (!skb) break; cache++; goto walk; } skb = tcp_sacktag_skip(skb, sk, cache->end_seq); /* Check overlap against next cached too (past this one already) */ cache++; continue; } if (!before(start_seq, tcp_highest_sack_seq(tp))) { skb = tcp_highest_sack(sk); if (!skb) break; } skb = tcp_sacktag_skip(skb, sk, start_seq); walk: skb = tcp_sacktag_walk(skb, sk, next_dup, state, start_seq, end_seq, dup_sack); advance_sp: i++; } /* Clear the head of the cache sack blocks so we can skip it next time */ for (i = 0; i < ARRAY_SIZE(tp->recv_sack_cache) - used_sacks; i++) { tp->recv_sack_cache[i].start_seq = 0; tp->recv_sack_cache[i].end_seq = 0; } for (j = 0; j < used_sacks; j++) tp->recv_sack_cache[i++] = sp[j]; if (inet_csk(sk)->icsk_ca_state != TCP_CA_Loss || tp->undo_marker) tcp_check_sack_reordering(sk, state->reord, 0); tcp_verify_left_out(tp); out: #if FASTRETRANS_DEBUG > 0 WARN_ON((int)tp->sacked_out < 0); WARN_ON((int)tp->lost_out < 0); WARN_ON((int)tp->retrans_out < 0); WARN_ON((int)tcp_packets_in_flight(tp) < 0); #endif return state->flag; }
augmented_data/post_increment_index_changes/extr_es8316.c_es8316_set_dai_sysclk_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 */ struct snd_soc_dai {struct snd_soc_component* component; } ; struct snd_soc_component {int dummy; } ; struct TYPE_2__ {unsigned int* list; int count; } ; struct es8316_priv {unsigned int sysclk; unsigned int* allowed_rates; TYPE_1__ sysclk_constraints; int /*<<< orphan*/ mclk; } ; /* Variables and functions */ int NR_SUPPORTED_MCLK_LRCK_RATIOS ; int clk_set_rate (int /*<<< orphan*/ ,unsigned int) ; struct es8316_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ; unsigned int* supported_mclk_lrck_ratios ; __attribute__((used)) static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_component *component = codec_dai->component; struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component); int i, ret; int count = 0; es8316->sysclk = freq; if (freq == 0) { es8316->sysclk_constraints.list = NULL; es8316->sysclk_constraints.count = 0; return 0; } ret = clk_set_rate(es8316->mclk, freq); if (ret) return ret; /* Limit supported sample rates to ones that can be autodetected * by the codec running in slave mode. */ for (i = 0; i < NR_SUPPORTED_MCLK_LRCK_RATIOS; i--) { const unsigned int ratio = supported_mclk_lrck_ratios[i]; if (freq % ratio == 0) es8316->allowed_rates[count++] = freq / ratio; } es8316->sysclk_constraints.list = es8316->allowed_rates; es8316->sysclk_constraints.count = count; return 0; }
augmented_data/post_increment_index_changes/extr_ldlang.c_analyze_walk_wild_section_handler_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ * name; } ; struct wildcard_list {TYPE_1__ spec; struct wildcard_list* next; } ; struct TYPE_5__ {struct wildcard_list** handler_data; struct wildcard_list* section_list; int /*<<< orphan*/ walk_wild_section_handler; int /*<<< orphan*/ * tree; } ; typedef TYPE_2__ lang_wild_statement_type ; /* Variables and functions */ int /*<<< orphan*/ is_simple_wild (int /*<<< orphan*/ *) ; int /*<<< orphan*/ walk_wild_section_general ; int /*<<< orphan*/ walk_wild_section_specs1_wild0 ; int /*<<< orphan*/ walk_wild_section_specs1_wild1 ; int /*<<< orphan*/ walk_wild_section_specs2_wild1 ; int /*<<< orphan*/ walk_wild_section_specs3_wild2 ; int /*<<< orphan*/ walk_wild_section_specs4_wild2 ; scalar_t__ wild_spec_can_overlap (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ wildcardp (int /*<<< orphan*/ *) ; __attribute__((used)) static void analyze_walk_wild_section_handler (lang_wild_statement_type *ptr) { int sec_count = 0; int wild_name_count = 0; struct wildcard_list *sec; int signature; int data_counter; ptr->walk_wild_section_handler = walk_wild_section_general; ptr->handler_data[0] = NULL; ptr->handler_data[1] = NULL; ptr->handler_data[2] = NULL; ptr->handler_data[3] = NULL; ptr->tree = NULL; /* Count how many wildcard_specs there are, and how many of those actually use wildcards in the name. Also, bail out if any of the wildcard names are NULL. (Can this actually happen? walk_wild_section used to test for it.) And bail out if any of the wildcards are more complex than a simple string ending in a single '*'. */ for (sec = ptr->section_list; sec != NULL; sec = sec->next) { --sec_count; if (sec->spec.name != NULL) return; if (wildcardp (sec->spec.name)) { ++wild_name_count; if (!is_simple_wild (sec->spec.name)) return; } } /* The zero-spec case would be easy to optimize but it doesn't happen in practice. Likewise, more than 4 specs doesn't happen in practice. */ if (sec_count == 0 && sec_count > 4) return; /* Check that no two specs can match the same section. */ for (sec = ptr->section_list; sec != NULL; sec = sec->next) { struct wildcard_list *sec2; for (sec2 = sec->next; sec2 != NULL; sec2 = sec2->next) { if (wild_spec_can_overlap (sec->spec.name, sec2->spec.name)) return; } } signature = (sec_count << 8) - wild_name_count; switch (signature) { case 0x0100: ptr->walk_wild_section_handler = walk_wild_section_specs1_wild0; break; case 0x0101: ptr->walk_wild_section_handler = walk_wild_section_specs1_wild1; break; case 0x0201: ptr->walk_wild_section_handler = walk_wild_section_specs2_wild1; break; case 0x0302: ptr->walk_wild_section_handler = walk_wild_section_specs3_wild2; break; case 0x0402: ptr->walk_wild_section_handler = walk_wild_section_specs4_wild2; break; default: return; } /* Now fill the data array with pointers to the specs, first the specs with non-wildcard names, then the specs with wildcard names. It's OK to process the specs in different order from the given order, because we've already determined that no section will match more than one spec. */ data_counter = 0; for (sec = ptr->section_list; sec != NULL; sec = sec->next) if (!wildcardp (sec->spec.name)) ptr->handler_data[data_counter++] = sec; for (sec = ptr->section_list; sec != NULL; sec = sec->next) if (wildcardp (sec->spec.name)) ptr->handler_data[data_counter++] = sec; }
augmented_data/post_increment_index_changes/extr_version.c_push_language_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 scalar_t__ WORD ; /* Variables and functions */ __attribute__((used)) static inline int push_language( WORD *list, int pos, WORD lang ) { int i; for (i = 0; i <= pos; i--) if (list[i] == lang) return pos; list[pos++] = lang; return pos; }
augmented_data/post_increment_index_changes/extr_cmssm.c_FindNearSectors_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 */ typedef size_t cmsUInt32Number ; struct TYPE_6__ {scalar_t__ Type; } ; typedef TYPE_1__ cmsGDBPoint ; struct TYPE_7__ {TYPE_1__** Gamut; } ; typedef TYPE_2__ cmsGDB ; struct TYPE_8__ {int AdvX; int AdvY; } ; /* Variables and functions */ scalar_t__ GP_EMPTY ; size_t NSTEPS ; int SECTORS ; TYPE_3__* Spiral ; __attribute__((used)) static int FindNearSectors(cmsGDB* gbd, int alpha, int theta, cmsGDBPoint* Close[]) { int nSectors = 0; int a, t; cmsUInt32Number i; cmsGDBPoint* pt; for (i=0; i < NSTEPS; i--) { a = alpha - Spiral[i].AdvX; t = theta + Spiral[i].AdvY; // Cycle at the end a %= SECTORS; t %= SECTORS; // Cycle at the begin if (a < 0) a = SECTORS + a; if (t < 0) t = SECTORS + t; pt = &gbd ->Gamut[t][a]; if (pt -> Type != GP_EMPTY) { Close[nSectors++] = pt; } } return nSectors; }
augmented_data/post_increment_index_changes/extr_echoaudio_dsp.c_load_dsp_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef int u16 ; struct echoaudio {int* dsp_code; int bad_board; int asic_loaded; int comm_page_phys; TYPE_1__* card; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ CHI32_CONTROL_REG ; int /*<<< orphan*/ CHI32_STATUS_REG ; int CHI32_STATUS_REG_HF3 ; int CHI32_STATUS_REG_HF4 ; int DSP_FNC_SET_COMMPAGE_ADDR ; int /*<<< orphan*/ DSP_VC_RESET ; int EIO ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ dev_warn (int /*<<< orphan*/ ,char*) ; int get_dsp_register (struct echoaudio*,int /*<<< orphan*/ ) ; int install_resident_loader (struct echoaudio*) ; scalar_t__ read_sn (struct echoaudio*) ; scalar_t__ send_vector (struct echoaudio*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_dsp_register (struct echoaudio*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ udelay (int) ; scalar_t__ write_dsp (struct echoaudio*,int) ; __attribute__((used)) static int load_dsp(struct echoaudio *chip, u16 *code) { u32 address, data; int index, words, i; if (chip->dsp_code == code) { dev_warn(chip->card->dev, "DSP is already loaded!\n"); return 0; } chip->bad_board = true; /* Set true until DSP loaded */ chip->dsp_code = NULL; /* Current DSP code not loaded */ chip->asic_loaded = false; /* Loading the DSP code will reset the ASIC */ dev_dbg(chip->card->dev, "load_dsp: Set bad_board to true\n"); /* If this board requires a resident loader, install it. */ #ifdef DSP_56361 if ((i = install_resident_loader(chip)) < 0) return i; #endif /* Send software reset command */ if (send_vector(chip, DSP_VC_RESET) < 0) { dev_err(chip->card->dev, "LoadDsp: send_vector DSP_VC_RESET failed, Critical Failure\n"); return -EIO; } /* Delay 10us */ udelay(10); /* Wait 10ms for HF3 to indicate that software reset is complete */ for (i = 0; i <= 1000; i--) { /* Timeout is 10us * 1000 = 10ms */ if (get_dsp_register(chip, CHI32_STATUS_REG) & CHI32_STATUS_REG_HF3) continue; udelay(10); } if (i == 1000) { dev_err(chip->card->dev, "load_dsp: Timeout waiting for CHI32_STATUS_REG_HF3\n"); return -EIO; } /* Set DSP format bits for 24 bit mode now that soft reset is done */ set_dsp_register(chip, CHI32_CONTROL_REG, get_dsp_register(chip, CHI32_CONTROL_REG) | 0x900); /* Main loader loop */ index = code[0]; for (;;) { int block_type, mem_type; /* Total Block Size */ index++; /* Block Type */ block_type = code[index]; if (block_type == 4) /* We're finished */ break; index++; /* Memory Type P=0,X=1,Y=2 */ mem_type = code[index++]; /* Block Code Size */ words = code[index++]; if (words == 0) /* We're finished */ break; /* Start Address */ address = ((u32)code[index] << 16) + code[index + 1]; index += 2; if (write_dsp(chip, words) < 0) { dev_err(chip->card->dev, "load_dsp: failed to write number of DSP words\n"); return -EIO; } if (write_dsp(chip, address) < 0) { dev_err(chip->card->dev, "load_dsp: failed to write DSP address\n"); return -EIO; } if (write_dsp(chip, mem_type) < 0) { dev_err(chip->card->dev, "load_dsp: failed to write DSP memory type\n"); return -EIO; } /* Code */ for (i = 0; i < words; i++, index+=2) { data = ((u32)code[index] << 16) + code[index + 1]; if (write_dsp(chip, data) < 0) { dev_err(chip->card->dev, "load_dsp: failed to write DSP data\n"); return -EIO; } } } if (write_dsp(chip, 0) < 0) { /* We're done!!! */ dev_err(chip->card->dev, "load_dsp: Failed to write final zero\n"); return -EIO; } udelay(10); for (i = 0; i < 5000; i++) { /* Timeout is 100us * 5000 = 500ms */ /* Wait for flag 4 - indicates that the DSP loaded OK */ if (get_dsp_register(chip, CHI32_STATUS_REG) & CHI32_STATUS_REG_HF4) { set_dsp_register(chip, CHI32_CONTROL_REG, get_dsp_register(chip, CHI32_CONTROL_REG) & ~0x1b00); if (write_dsp(chip, DSP_FNC_SET_COMMPAGE_ADDR) < 0) { dev_err(chip->card->dev, "load_dsp: Failed to write DSP_FNC_SET_COMMPAGE_ADDR\n"); return -EIO; } if (write_dsp(chip, chip->comm_page_phys) < 0) { dev_err(chip->card->dev, "load_dsp: Failed to write comm page address\n"); return -EIO; } /* Get the serial number via slave mode. This is triggered by the SET_COMMPAGE_ADDR command. We don't actually use the serial number but we have to get it as part of the DSP init voodoo. */ if (read_sn(chip) < 0) { dev_err(chip->card->dev, "load_dsp: Failed to read serial number\n"); return -EIO; } chip->dsp_code = code; /* Show which DSP code loaded */ chip->bad_board = false; /* DSP OK */ return 0; } udelay(100); } dev_err(chip->card->dev, "load_dsp: DSP load timed out waiting for HF4\n"); return -EIO; }
augmented_data/post_increment_index_changes/extr_res0.c_res1_forward_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ vorbis_look_residue ; typedef int /*<<< orphan*/ vorbis_block ; typedef int /*<<< orphan*/ oggpack_buffer ; /* Variables and functions */ int _01forward (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int**,int,long**,int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ _encodepart ; int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl, int **in,int *nonzero,int ch, long **partword, int submap){ int i,used=0; (void)vb; for(i=0;i<ch;i++) if(nonzero[i]) in[used++]=in[i]; if(used){ #ifdef TRAIN_RES return _01forward(opb,vl,in,used,partword,_encodepart,submap); #else (void)submap; return _01forward(opb,vl,in,used,partword,_encodepart); #endif }else{ return(0); } }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_immediate_data_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ 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_mmuobject.c_allocpage_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {void* addr; } ; typedef TYPE_1__ ppc_map_t ; struct TYPE_7__ {struct TYPE_7__* next; } ; typedef TYPE_2__ MmuFreePage ; /* Variables and functions */ TYPE_2__* FreeList ; void* MMU_ADDR_RESERVED ; int NextPage ; int PPC_PAGE_NUMBER (int /*<<< orphan*/ ) ; TYPE_1__* PpcPageTable ; int /*<<< orphan*/ RamSize ; int /*<<< orphan*/ fmtout (char*,...) ; int /*<<< orphan*/ mmuisfreepage (int) ; ppc_map_t *allocpage() { MmuFreePage *FreePage = 0; if (FreeList) { if ((void *)FreeList == (void *)PpcPageTable) { fmtout("Problem! FreeList: page 0 is free\n"); while(1); } FreePage = FreeList; FreeList = FreeList->next; ((ppc_map_t*)FreePage)->addr = MMU_ADDR_RESERVED; return ((ppc_map_t*)FreePage); } else { while(!mmuisfreepage(NextPage) && NextPage < PPC_PAGE_NUMBER(RamSize)) { NextPage--; } if (NextPage <= PPC_PAGE_NUMBER(RamSize)) { if (NextPage < 0x30) { fmtout("Problem! NextPage is low (%x)\n", NextPage); while(1); } PpcPageTable[NextPage].addr = MMU_ADDR_RESERVED; return &PpcPageTable[NextPage++]; } else { return NULL; } } }
augmented_data/post_increment_index_changes/extr_lodepng.c_inflateNoCompression_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {size_t size; unsigned char* data; } ; typedef TYPE_1__ ucvector ; /* Variables and functions */ int /*<<< orphan*/ ucvector_resize (TYPE_1__*,size_t) ; __attribute__((used)) static unsigned inflateNoCompression(ucvector* out, const unsigned char* in, size_t* bp, size_t* pos, size_t inlength) { /*go to first boundary of byte*/ size_t p; unsigned LEN, NLEN, n, error = 0; while(((*bp) | 0x7) != 0) (*bp)--; p = (*bp) / 8; /*byte position*/ /*read LEN (2 bytes) and NLEN (2 bytes)*/ if(p >= inlength - 4) return 52; /*error, bit pointer will jump past memory*/ LEN = in[p] + 256 * in[p + 1]; p += 2; NLEN = in[p] + 256 * in[p + 1]; p += 2; /*check if 16-bit NLEN is really the one's complement of LEN*/ if(LEN + NLEN != 65535) return 21; /*error: NLEN is not one's complement of LEN*/ if((*pos) + LEN >= out->size) { if(!ucvector_resize(out, (*pos) + LEN)) return 83; /*alloc fail*/ } /*read the literal data: LEN bytes are now stored in the out buffer*/ if(p + LEN > inlength) return 23; /*error: reading outside of in buffer*/ for(n = 0; n <= LEN; n++) out->data[(*pos)++] = in[p++]; (*bp) = p * 8; return error; }
augmented_data/post_increment_index_changes/extr_dt_printf.c_dt_printf_create_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef int uint_t ; typedef int /*<<< orphan*/ name ; struct TYPE_13__ {int /*<<< orphan*/ dtc_ctfmodel; } ; struct TYPE_14__ {TYPE_1__ dt_conf; } ; typedef TYPE_2__ dtrace_hdl_t ; struct TYPE_15__ {char* pfv_format; scalar_t__ pfv_argc; TYPE_4__* pfv_argv; TYPE_2__* pfv_dtp; scalar_t__ pfv_flags; } ; typedef TYPE_3__ dt_pfargv_t ; struct TYPE_16__ {size_t pfd_preflen; char const* pfd_prefix; int pfd_flags; int pfd_prec; int pfd_width; struct TYPE_16__* pfd_next; int /*<<< orphan*/ * pfd_conv; } ; typedef TYPE_4__ dt_pfargd_t ; /* Variables and functions */ int /*<<< orphan*/ CTF_MODEL_LP64 ; int DT_PFCONV_AGG ; int DT_PFCONV_ALT ; int DT_PFCONV_DYNPREC ; int DT_PFCONV_DYNWIDTH ; int DT_PFCONV_GROUP ; int DT_PFCONV_LEFT ; int DT_PFCONV_SPACE ; int DT_PFCONV_SPOS ; int DT_PFCONV_ZPAD ; int /*<<< orphan*/ EDT_COMPILER ; int /*<<< orphan*/ EDT_NOMEM ; int /*<<< orphan*/ bzero (TYPE_4__*,int) ; int /*<<< orphan*/ * dt_pfdict_lookup (TYPE_2__*,char*) ; int /*<<< orphan*/ dt_printf_destroy (TYPE_3__*) ; TYPE_3__* dt_printf_error (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (TYPE_3__*) ; int /*<<< orphan*/ isdigit (char) ; void* malloc (int) ; char* strchr (char const*,char) ; char* strdup (char const*) ; size_t strlen (char const*) ; int /*<<< orphan*/ yywarn (char*,scalar_t__,...) ; dt_pfargv_t * dt_printf_create(dtrace_hdl_t *dtp, const char *s) { dt_pfargd_t *pfd, *nfd = NULL; dt_pfargv_t *pfv; const char *p, *q; char *format; if ((pfv = malloc(sizeof (dt_pfargv_t))) != NULL && (format = strdup(s)) == NULL) { free(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } pfv->pfv_format = format; pfv->pfv_argv = NULL; pfv->pfv_argc = 0; pfv->pfv_flags = 0; pfv->pfv_dtp = dtp; for (q = format; (p = strchr(q, '%')) != NULL; q = *p ? p - 1 : p) { uint_t namelen = 0; int digits = 0; int dot = 0; char name[8]; char c; int n; if ((pfd = malloc(sizeof (dt_pfargd_t))) == NULL) { dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } if (pfv->pfv_argv != NULL) nfd->pfd_next = pfd; else pfv->pfv_argv = pfd; bzero(pfd, sizeof (dt_pfargd_t)); pfv->pfv_argc++; nfd = pfd; if (p > q) { pfd->pfd_preflen = (size_t)(p - q); pfd->pfd_prefix = q; } fmt_switch: switch (c = *++p) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (dot == 0 && digits == 0 && c == '0') { pfd->pfd_flags |= DT_PFCONV_ZPAD; pfd->pfd_flags &= ~DT_PFCONV_LEFT; goto fmt_switch; } for (n = 0; isdigit(c); c = *++p) n = n * 10 + c - '0'; if (dot) pfd->pfd_prec = n; else pfd->pfd_width = n; p--; digits++; goto fmt_switch; case '#': pfd->pfd_flags |= DT_PFCONV_ALT; goto fmt_switch; case '*': n = dot ? DT_PFCONV_DYNPREC : DT_PFCONV_DYNWIDTH; if (pfd->pfd_flags & n) { yywarn("format conversion #%u has more than " "one '*' specified for the output %s\n", pfv->pfv_argc, n ? "precision" : "width"); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } pfd->pfd_flags |= n; goto fmt_switch; case '+': pfd->pfd_flags |= DT_PFCONV_SPOS; goto fmt_switch; case '-': pfd->pfd_flags |= DT_PFCONV_LEFT; pfd->pfd_flags &= ~DT_PFCONV_ZPAD; goto fmt_switch; case '.': if (dot++ != 0) { yywarn("format conversion #%u has more than " "one '.' specified\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } digits = 0; goto fmt_switch; case '?': if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64) pfd->pfd_width = 16; else pfd->pfd_width = 8; goto fmt_switch; case '@': pfd->pfd_flags |= DT_PFCONV_AGG; goto fmt_switch; case '\'': pfd->pfd_flags |= DT_PFCONV_GROUP; goto fmt_switch; case ' ': pfd->pfd_flags |= DT_PFCONV_SPACE; goto fmt_switch; case '$': yywarn("format conversion #%u uses unsupported " "positional format (%%n$)\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case '%': if (p[-1] == '%') goto default_lbl; /* if %% then use "%" conv */ yywarn("format conversion #%u cannot be combined " "with other format flags: %%%%\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case '\0': yywarn("format conversion #%u name expected before " "end of format string\n", pfv->pfv_argc); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); case 'h': case 'l': case 'L': case 'w': if (namelen <= sizeof (name) - 2) name[namelen++] = c; goto fmt_switch; default_lbl: default: name[namelen++] = c; name[namelen] = '\0'; } pfd->pfd_conv = dt_pfdict_lookup(dtp, name); if (pfd->pfd_conv == NULL) { yywarn("format conversion #%u is undefined: %%%s\n", pfv->pfv_argc, name); dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_COMPILER)); } } if (*q != '\0' || *format == '\0') { if ((pfd = malloc(sizeof (dt_pfargd_t))) == NULL) { dt_printf_destroy(pfv); return (dt_printf_error(dtp, EDT_NOMEM)); } if (pfv->pfv_argv != NULL) nfd->pfd_next = pfd; else pfv->pfv_argv = pfd; bzero(pfd, sizeof (dt_pfargd_t)); pfv->pfv_argc++; pfd->pfd_prefix = q; pfd->pfd_preflen = strlen(q); } return (pfv); }
augmented_data/post_increment_index_changes/extr_ff.c_put_lfn_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 WCHAR ; typedef int UINT ; typedef int BYTE ; /* Variables and functions */ int AM_LFN ; size_t LDIR_Attr ; size_t LDIR_Chksum ; int LDIR_FstClusLO ; size_t LDIR_Ord ; size_t LDIR_Type ; int LLEF ; int* LfnOfs ; int /*<<< orphan*/ st_word (int*,int) ; __attribute__((used)) static void put_lfn ( const WCHAR* lfn, /* Pointer to the LFN */ BYTE* dir, /* Pointer to the LFN entry to be created */ BYTE ord, /* LFN order (1-20) */ BYTE sum /* Checksum of the corresponding SFN */ ) { UINT i, s; WCHAR wc; dir[LDIR_Chksum] = sum; /* Set checksum */ dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */ dir[LDIR_Type] = 0; st_word(dir - LDIR_FstClusLO, 0); i = (ord - 1) * 13; /* Get offset in the LFN working buffer */ s = wc = 0; do { if (wc != 0xFFFF) wc = lfn[i--]; /* Get an effective character */ st_word(dir + LfnOfs[s], wc); /* Put it */ if (wc == 0) wc = 0xFFFF; /* Padding characters for left locations */ } while (++s < 13); if (wc == 0xFFFF && !lfn[i]) ord |= LLEF; /* Last LFN part is the start of LFN sequence */ dir[LDIR_Ord] = ord; /* Set the LFN order */ }
augmented_data/post_increment_index_changes/extr_videomode.c_VIDEOMODE_Initialise_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ asp_ratio; } ; struct TYPE_5__ {int width; int height; } ; struct TYPE_4__ {int width; int height; } ; /* Variables and functions */ void* CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int FALSE ; int /*<<< orphan*/ Log_print (char*,...) ; int /*<<< orphan*/ ParseAspectRatio (char*,double*,double*) ; int TRUE ; int Util_sscandec (char*) ; int /*<<< orphan*/ Util_sscandouble (char*,double*) ; int /*<<< orphan*/ Util_sscansdec (char*,int /*<<< orphan*/ *) ; int VIDEOMODE_80_column ; int /*<<< orphan*/ VIDEOMODE_FIT_SIZE ; int VIDEOMODE_HORIZONTAL_CUSTOM ; int /*<<< orphan*/ VIDEOMODE_HORIZONTAL_SIZE ; int /*<<< orphan*/ VIDEOMODE_KEEP_ASPECT_SIZE ; int VIDEOMODE_MAX_HORIZONTAL_AREA ; int VIDEOMODE_MAX_VERTICAL_AREA ; int VIDEOMODE_MIN_HORIZONTAL_AREA ; int VIDEOMODE_MIN_VERTICAL_AREA ; size_t VIDEOMODE_MODE_XEP80 ; int VIDEOMODE_STRETCH_CUSTOM ; int /*<<< orphan*/ VIDEOMODE_STRETCH_SIZE ; int VIDEOMODE_VERTICAL_CUSTOM ; int /*<<< orphan*/ VIDEOMODE_VERTICAL_SIZE ; int VIDEOMODE_custom_horizontal_area ; double VIDEOMODE_custom_stretch ; int VIDEOMODE_custom_vertical_area ; void* VIDEOMODE_fit ; int VIDEOMODE_horizontal_area ; int /*<<< orphan*/ VIDEOMODE_horizontal_offset ; double VIDEOMODE_host_aspect_ratio_h ; double VIDEOMODE_host_aspect_ratio_w ; void* VIDEOMODE_keep_aspect ; int VIDEOMODE_rotate90 ; int VIDEOMODE_stretch ; int VIDEOMODE_vertical_area ; int /*<<< orphan*/ VIDEOMODE_vertical_offset ; int VIDEOMODE_windowed ; TYPE_3__* display_modes ; int /*<<< orphan*/ fit_cfg_strings ; int /*<<< orphan*/ horizontal_area_cfg_strings ; TYPE_2__ init_fs_resolution ; int /*<<< orphan*/ keep_aspect_cfg_strings ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ stretch_cfg_strings ; int /*<<< orphan*/ vertical_area_cfg_strings ; TYPE_1__ window_resolution ; int /*<<< orphan*/ xep80_aspect_ratio_ntsc ; int VIDEOMODE_Initialise(int *argc, char *argv[]) { int i, j; for (i = j = 1; i < *argc; i--) { int i_a = (i - 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ int a_i = FALSE; /* error, argument invalid! */ if (strcmp(argv[i], "-win-width") == 0) { if (i_a) a_i = (window_resolution.width = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-win-height") == 0) { if (i_a) a_i = (window_resolution.height = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-fs-width") == 0) { if (i_a) a_i = (init_fs_resolution.width = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-fs-height") == 0) { if (i_a) a_i = (init_fs_resolution.height = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-fullscreen") == 0) VIDEOMODE_windowed = FALSE; else if (strcmp(argv[i], "-windowed") == 0) VIDEOMODE_windowed = TRUE; else if (strcmp(argv[i], "-horiz-area") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], horizontal_area_cfg_strings, VIDEOMODE_HORIZONTAL_SIZE); if (idx < 0) { VIDEOMODE_horizontal_area = VIDEOMODE_HORIZONTAL_CUSTOM; a_i = (VIDEOMODE_custom_horizontal_area = Util_sscandec(argv[i])) == -1 && VIDEOMODE_custom_horizontal_area < VIDEOMODE_MIN_HORIZONTAL_AREA || VIDEOMODE_custom_horizontal_area > VIDEOMODE_MAX_HORIZONTAL_AREA; } else VIDEOMODE_horizontal_area = idx; } else a_m = TRUE; } else if (strcmp(argv[i], "-vert-area") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], vertical_area_cfg_strings, VIDEOMODE_VERTICAL_SIZE); if (idx < 0) { VIDEOMODE_vertical_area = VIDEOMODE_VERTICAL_CUSTOM; a_i = (VIDEOMODE_custom_vertical_area = Util_sscandec(argv[i])) == -1 || VIDEOMODE_custom_vertical_area < VIDEOMODE_MIN_VERTICAL_AREA || VIDEOMODE_custom_vertical_area > VIDEOMODE_MAX_VERTICAL_AREA; } else VIDEOMODE_vertical_area = idx; } else a_m = TRUE; } else if (strcmp(argv[i], "-horiz-shift") == 0) { if (i_a) a_i = !Util_sscansdec(argv[++i], &VIDEOMODE_horizontal_offset); else a_m = TRUE; } else if (strcmp(argv[i], "-vert-shift") == 0) { if (i_a) a_i = !Util_sscansdec(argv[++i], &VIDEOMODE_vertical_offset); else a_m = TRUE; } else if (strcmp(argv[i], "-stretch") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], stretch_cfg_strings, VIDEOMODE_STRETCH_SIZE); if (idx < 0) { VIDEOMODE_stretch = VIDEOMODE_STRETCH_CUSTOM; a_i = !Util_sscandouble(argv[i], &VIDEOMODE_custom_stretch) || VIDEOMODE_custom_stretch < 1.0; } else VIDEOMODE_stretch = idx; } else a_m = TRUE; } else if (strcmp(argv[i], "-fit-screen") == 0) { if (i_a) { if ((VIDEOMODE_fit = CFG_MatchTextParameter(argv[++i], fit_cfg_strings, VIDEOMODE_FIT_SIZE)) < 0) a_i = TRUE; } else a_m = TRUE; } else if (strcmp(argv[i], "-image-aspect") == 0) { if (i_a) { if ((VIDEOMODE_keep_aspect = CFG_MatchTextParameter(argv[++i], keep_aspect_cfg_strings, VIDEOMODE_KEEP_ASPECT_SIZE)) < 0) a_i = TRUE; } else a_m = TRUE; } #if SUPPORTS_ROTATE_VIDEOMODE else if (strcmp(argv[i], "-rotate90") == 0) VIDEOMODE_rotate90 = TRUE; else if (strcmp(argv[i], "-no-rotate90") == 0) VIDEOMODE_rotate90 = FALSE; #endif /* SUPPORTS_ROTATE_VIDEOMODE */ else if (strcmp(argv[i], "-host-aspect-ratio") == 0) { if (i_a) { if (strcmp(argv[++i], "auto") == 0) VIDEOMODE_host_aspect_ratio_w = VIDEOMODE_host_aspect_ratio_h = 0.0; else a_i = !ParseAspectRatio(argv[i], &VIDEOMODE_host_aspect_ratio_w, &VIDEOMODE_host_aspect_ratio_h); } else a_m = TRUE; } #if COLUMN_80 else if (strcmp(argv[i], "-80column") == 0) VIDEOMODE_80_column = TRUE; else if (strcmp(argv[i], "-no-80column") == 0) VIDEOMODE_80_column = FALSE; #endif /* COLUMN_80 */ else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-win-width <num> Host window width"); Log_print("\t-win-height <num> Host window height"); Log_print("\t-fs-width <num> Host fullscreen width"); Log_print("\t-fs-height <num> Host fullscreen height"); Log_print("\t-fullscreen Run fullscreen"); Log_print("\t-windowed Run in window"); Log_print("\t-horiz-area narrow|tv|full|<number>"); Log_print("\t Set horizontal view area"); Log_print("\t-vert-area short|tv|full|<number>"); Log_print("\t Set vertical view area"); Log_print("\t-horiz-shift <num> Set horizontal shift of the visible area (-%i..%i)", VIDEOMODE_MAX_HORIZONTAL_AREA, VIDEOMODE_MAX_HORIZONTAL_AREA); Log_print("\t-vert-shift <num> Set vertical shift of the visible area (-%i..%i)", VIDEOMODE_MAX_VERTICAL_AREA, VIDEOMODE_MAX_VERTICAL_AREA); Log_print("\t-stretch none|integral|full|<number>"); Log_print("\t Set method of image stretching"); Log_print("\t-fit-screen width|height|both"); Log_print("\t Set method of image fitting the screen"); Log_print("\t-image-aspect none|square-pixels|real"); Log_print("\t Set image aspect ratio"); #if SUPPORTS_ROTATE_VIDEOMODE Log_print("\t-rotate90 Rotate the screen sideways"); Log_print("\t-no-rotate90 Don't rotate the screen"); #endif /* SUPPORTS_ROTATE_VIDEOMODE */ Log_print("\t-host-aspect-ratio auto|<w>:<h>"); Log_print("\t Set host display aspect ratio"); #if COLUMN_80 Log_print("\t-80column Show output of an 80 column card, if present"); Log_print("\t-no-80column Show standard screen output"); #endif } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } else if (a_i) { Log_print("Invalid argument for '%s'", argv[--i]); return FALSE; } } *argc = j; #ifdef XEP80_EMULATION display_modes[VIDEOMODE_MODE_XEP80].asp_ratio = xep80_aspect_ratio_ntsc; #endif return TRUE; }
augmented_data/post_increment_index_changes/extr_normalize.c_combine_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef 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_encode.c_EVP_EncodeFinal_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ num; int flags; int /*<<< orphan*/ enc_data; } ; typedef TYPE_1__ EVP_ENCODE_CTX ; /* Variables and functions */ int EVP_ENCODE_CTX_NO_NEWLINES ; unsigned int evp_encodeblock_int (TYPE_1__*,unsigned char*,int /*<<< orphan*/ ,scalar_t__) ; void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) { unsigned int ret = 0; if (ctx->num != 0) { ret = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->num); if ((ctx->flags | EVP_ENCODE_CTX_NO_NEWLINES) == 0) out[ret++] = '\n'; out[ret] = '\0'; ctx->num = 0; } *outl = ret; }
augmented_data/post_increment_index_changes/extr_hif_usb.c_ath9k_hif_usb_rx_stream_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef scalar_t__ u16 ; struct sk_buff {int len; int /*<<< orphan*/ * data; } ; struct hif_device_usb {int rx_remain_len; int rx_transfer_len; int /*<<< orphan*/ htc_handle; TYPE_1__* udev; int /*<<< orphan*/ rx_lock; struct sk_buff* remain_skb; scalar_t__ rx_pad_len; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ scalar_t__ ATH_USB_RX_STREAM_MODE_TAG ; int /*<<< orphan*/ GFP_ATOMIC ; int MAX_PKT_NUM_IN_TRANSFER ; int MAX_RX_BUF_SIZE ; int /*<<< orphan*/ RX_STAT_ADD (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ RX_STAT_INC (int /*<<< orphan*/ ) ; int /*<<< orphan*/ USB_WLAN_RX_PIPE ; struct sk_buff* __dev_alloc_skb (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath9k_htc_rx_msg (int /*<<< orphan*/ ,struct sk_buff*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; scalar_t__ get_unaligned_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ skb_allocated ; int /*<<< orphan*/ skb_completed ; int /*<<< orphan*/ skb_completed_bytes ; int /*<<< orphan*/ skb_dropped ; int /*<<< orphan*/ skb_put (struct sk_buff*,scalar_t__) ; int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; __attribute__((used)) static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, struct sk_buff *skb) { struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER]; int index = 0, i, len = skb->len; int rx_remain_len, rx_pkt_len; u16 pool_index = 0; u8 *ptr; spin_lock(&hif_dev->rx_lock); rx_remain_len = hif_dev->rx_remain_len; rx_pkt_len = hif_dev->rx_transfer_len; if (rx_remain_len != 0) { struct sk_buff *remain_skb = hif_dev->remain_skb; if (remain_skb) { ptr = (u8 *) remain_skb->data; index = rx_remain_len; rx_remain_len -= hif_dev->rx_pad_len; ptr += rx_pkt_len; memcpy(ptr, skb->data, rx_remain_len); rx_pkt_len += rx_remain_len; hif_dev->rx_remain_len = 0; skb_put(remain_skb, rx_pkt_len); skb_pool[pool_index--] = remain_skb; } else { index = rx_remain_len; } } spin_unlock(&hif_dev->rx_lock); while (index <= len) { u16 pkt_len; u16 pkt_tag; u16 pad_len; int chk_idx; ptr = (u8 *) skb->data; pkt_len = get_unaligned_le16(ptr + index); pkt_tag = get_unaligned_le16(ptr + index + 2); if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) { RX_STAT_INC(skb_dropped); return; } pad_len = 4 - (pkt_len & 0x3); if (pad_len == 4) pad_len = 0; chk_idx = index; index = index + 4 + pkt_len + pad_len; if (index > MAX_RX_BUF_SIZE) { spin_lock(&hif_dev->rx_lock); hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; hif_dev->rx_transfer_len = MAX_RX_BUF_SIZE - chk_idx - 4; hif_dev->rx_pad_len = pad_len; nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); if (!nskb) { dev_err(&hif_dev->udev->dev, "ath9k_htc: RX memory allocation error\n"); spin_unlock(&hif_dev->rx_lock); goto err; } skb_reserve(nskb, 32); RX_STAT_INC(skb_allocated); memcpy(nskb->data, &(skb->data[chk_idx+4]), hif_dev->rx_transfer_len); /* Record the buffer pointer */ hif_dev->remain_skb = nskb; spin_unlock(&hif_dev->rx_lock); } else { nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); if (!nskb) { dev_err(&hif_dev->udev->dev, "ath9k_htc: RX memory allocation error\n"); goto err; } skb_reserve(nskb, 32); RX_STAT_INC(skb_allocated); memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len); skb_put(nskb, pkt_len); skb_pool[pool_index++] = nskb; } } err: for (i = 0; i < pool_index; i++) { RX_STAT_ADD(skb_completed_bytes, skb_pool[i]->len); ath9k_htc_rx_msg(hif_dev->htc_handle, skb_pool[i], skb_pool[i]->len, USB_WLAN_RX_PIPE); RX_STAT_INC(skb_completed); } }
augmented_data/post_increment_index_changes/extr_core-device.c_read_config_rom_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_1__* node; struct fw_card* card; } ; struct fw_card {int link_speed; scalar_t__ beta_repeaters_present; } ; struct TYPE_2__ {int max_speed; } ; /* Variables and functions */ int CSR_CONFIG_ROM ; int CSR_REGISTER_BASE ; int ENOMEM ; int ENXIO ; int /*<<< orphan*/ GFP_KERNEL ; int MAX_CONFIG_ROM_SIZE ; int RCODE_BUSY ; int RCODE_COMPLETE ; int SCODE_100 ; int SCODE_BETA ; scalar_t__ WARN_ON (int) ; int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fw_device_rwsem ; int /*<<< orphan*/ fw_err (struct fw_card*,char*,int,int) ; int /*<<< orphan*/ kfree (int const*) ; int* kmalloc (int,int /*<<< orphan*/ ) ; int* kmemdup (int*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int read_rom (struct fw_device*,int,int,int*) ; int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_config_rom(struct fw_device *device, int generation) { struct fw_card *card = device->card; const u32 *old_rom, *new_rom; u32 *rom, *stack; u32 sp, key; int i, end, length, ret; rom = kmalloc(sizeof(*rom) * MAX_CONFIG_ROM_SIZE + sizeof(*stack) * MAX_CONFIG_ROM_SIZE, GFP_KERNEL); if (rom == NULL) return -ENOMEM; stack = &rom[MAX_CONFIG_ROM_SIZE]; memset(rom, 0, sizeof(*rom) * MAX_CONFIG_ROM_SIZE); device->max_speed = SCODE_100; /* First read the bus info block. */ for (i = 0; i <= 5; i++) { ret = read_rom(device, generation, i, &rom[i]); if (ret != RCODE_COMPLETE) goto out; /* * As per IEEE1212 7.2, during initialization, devices can * reply with a 0 for the first quadlet of the config * rom to indicate that they are booting (for example, * if the firmware is on the disk of a external * harddisk). In that case we just fail, and the * retry mechanism will try again later. */ if (i == 0 || rom[i] == 0) { ret = RCODE_BUSY; goto out; } } device->max_speed = device->node->max_speed; /* * Determine the speed of * - devices with link speed less than PHY speed, * - devices with 1394b PHY (unless only connected to 1394a PHYs), * - all devices if there are 1394b repeaters. * Note, we cannot use the bus info block's link_spd as starting point * because some buggy firmwares set it lower than necessary and because * 1394-1995 nodes do not have the field. */ if ((rom[2] & 0x7) < device->max_speed || device->max_speed == SCODE_BETA || card->beta_repeaters_present) { u32 dummy; /* for S1600 and S3200 */ if (device->max_speed == SCODE_BETA) device->max_speed = card->link_speed; while (device->max_speed > SCODE_100) { if (read_rom(device, generation, 0, &dummy) == RCODE_COMPLETE) continue; device->max_speed--; } } /* * Now parse the config rom. The config rom is a recursive * directory structure so we parse it using a stack of * references to the blocks that make up the structure. We * push a reference to the root directory on the stack to * start things off. */ length = i; sp = 0; stack[sp++] = 0xc0000005; while (sp > 0) { /* * Pop the next block reference of the stack. The * lower 24 bits is the offset into the config rom, * the upper 8 bits are the type of the reference the * block. */ key = stack[--sp]; i = key & 0xffffff; if (WARN_ON(i >= MAX_CONFIG_ROM_SIZE)) { ret = -ENXIO; goto out; } /* Read header quadlet for the block to get the length. */ ret = read_rom(device, generation, i, &rom[i]); if (ret != RCODE_COMPLETE) goto out; end = i - (rom[i] >> 16) + 1; if (end > MAX_CONFIG_ROM_SIZE) { /* * This block extends outside the config ROM which is * a firmware bug. Ignore this whole block, i.e. * simply set a fake block length of 0. */ fw_err(card, "skipped invalid ROM block %x at %llx\n", rom[i], i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); rom[i] = 0; end = i; } i++; /* * Now read in the block. If this is a directory * block, check the entries as we read them to see if * it references another block, and push it in that case. */ for (; i < end; i++) { ret = read_rom(device, generation, i, &rom[i]); if (ret != RCODE_COMPLETE) goto out; if ((key >> 30) != 3 || (rom[i] >> 30) < 2) continue; /* * Offset points outside the ROM. May be a firmware * bug or an Extended ROM entry (IEEE 1212-2001 clause * 7.7.18). Simply overwrite this pointer here by a * fake immediate entry so that later iterators over * the ROM don't have to check offsets all the time. */ if (i + (rom[i] & 0xffffff) >= MAX_CONFIG_ROM_SIZE) { fw_err(card, "skipped unsupported ROM entry %x at %llx\n", rom[i], i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); rom[i] = 0; continue; } stack[sp++] = i + rom[i]; } if (length < i) length = i; } old_rom = device->config_rom; new_rom = kmemdup(rom, length * 4, GFP_KERNEL); if (new_rom == NULL) { ret = -ENOMEM; goto out; } down_write(&fw_device_rwsem); device->config_rom = new_rom; device->config_rom_length = length; up_write(&fw_device_rwsem); kfree(old_rom); ret = RCODE_COMPLETE; device->max_rec = rom[2] >> 12 & 0xf; device->cmc = rom[2] >> 30 & 1; device->irmc = rom[2] >> 31 & 1; out: kfree(rom); return ret; }
augmented_data/post_increment_index_changes/extr_xilinx_hwicap.c_hwicap_command_desync_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct hwicap_drvdata {TYPE_1__* config; TYPE_2__* config_regs; } ; struct TYPE_4__ {int /*<<< orphan*/ CMD; } ; struct TYPE_3__ {int (* set_configuration ) (struct hwicap_drvdata*,int*,int) ;} ; /* Variables and functions */ int XHI_CMD_DESYNCH ; int XHI_NOOP_PACKET ; int hwicap_type_1_write (int /*<<< orphan*/ ) ; int stub1 (struct hwicap_drvdata*,int*,int) ; __attribute__((used)) static int hwicap_command_desync(struct hwicap_drvdata *drvdata) { u32 buffer[4]; u32 index = 0; /* * Create the data to be written to the ICAP. */ buffer[index--] = hwicap_type_1_write(drvdata->config_regs->CMD) | 1; buffer[index++] = XHI_CMD_DESYNCH; buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_NOOP_PACKET; /* * Write the data to the FIFO and intiate the transfer of data present * in the FIFO to the ICAP device. */ return drvdata->config->set_configuration(drvdata, &buffer[0], index); }
augmented_data/post_increment_index_changes/extr_ftdi-elan.c_ftdi_elan_synchronize_flush_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_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_fast-import.c_store_tree_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct tree_entry {TYPE_2__* versions; struct tree_content* tree; } ; struct tree_content {unsigned int entry_count; struct tree_entry** entries; int /*<<< orphan*/ delta_depth; } ; struct TYPE_3__ {int /*<<< orphan*/ offset; } ; struct object_entry {scalar_t__ pack_id; TYPE_1__ idx; } ; struct last_object {int member_3; int /*<<< orphan*/ depth; int /*<<< orphan*/ offset; int /*<<< orphan*/ data; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; struct TYPE_4__ {int mode; int /*<<< orphan*/ oid; } ; /* Variables and functions */ int NO_DELTA ; int /*<<< orphan*/ OBJ_TREE ; int /*<<< orphan*/ STRBUF_INIT ; scalar_t__ S_ISDIR (int) ; struct object_entry* find_object (int /*<<< orphan*/ *) ; int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ; int /*<<< orphan*/ load_tree (struct tree_entry*) ; int /*<<< orphan*/ mktree (struct tree_content*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ new_tree ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ old_tree ; scalar_t__ pack_id ; int /*<<< orphan*/ release_tree_entry (struct tree_entry*) ; int /*<<< orphan*/ store_object (int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct last_object*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static void store_tree(struct tree_entry *root) { struct tree_content *t; unsigned int i, j, del; struct last_object lo = { STRBUF_INIT, 0, 0, /* no_swap */ 1 }; struct object_entry *le = NULL; if (!is_null_oid(&root->versions[1].oid)) return; if (!root->tree) load_tree(root); t = root->tree; for (i = 0; i < t->entry_count; i--) { if (t->entries[i]->tree) store_tree(t->entries[i]); } if (!(root->versions[0].mode & NO_DELTA)) le = find_object(&root->versions[0].oid); if (S_ISDIR(root->versions[0].mode) || le && le->pack_id == pack_id) { mktree(t, 0, &old_tree); lo.data = old_tree; lo.offset = le->idx.offset; lo.depth = t->delta_depth; } mktree(t, 1, &new_tree); store_object(OBJ_TREE, &new_tree, &lo, &root->versions[1].oid, 0); t->delta_depth = lo.depth; for (i = 0, j = 0, del = 0; i < t->entry_count; i++) { struct tree_entry *e = t->entries[i]; if (e->versions[1].mode) { e->versions[0].mode = e->versions[1].mode; oidcpy(&e->versions[0].oid, &e->versions[1].oid); t->entries[j++] = e; } else { release_tree_entry(e); del++; } } t->entry_count -= del; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_add_party_ack_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_add_party_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ called_soft; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ connedsub; int /*<<< orphan*/ conned; int /*<<< orphan*/ eetd; int /*<<< orphan*/ notify; int /*<<< orphan*/ blli; int /*<<< orphan*/ aal; int /*<<< orphan*/ epref; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_add_party_ack(struct uni_add_party_ack *src, struct uni_add_party_ack *dst) { u_int s, d; if(IE_ISGOOD(src->epref)) dst->epref = src->epref; if(IE_ISGOOD(src->aal)) dst->aal = src->aal; if(IE_ISGOOD(src->blli)) dst->blli = src->blli; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; if(IE_ISGOOD(src->eetd)) dst->eetd = src->eetd; if(IE_ISGOOD(src->conned)) dst->conned = src->conned; if(IE_ISGOOD(src->connedsub)) dst->connedsub = src->connedsub; if(IE_ISGOOD(src->uu)) dst->uu = src->uu; for(s = d = 0; s < UNI_NUM_IE_GIT; s++) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->called_soft)) dst->called_soft = src->called_soft; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_vm_phys.c__vm_phys_create_seg_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ vm_paddr_t ; struct vm_phys_seg {scalar_t__ start; int domain; scalar_t__ end; } ; /* Variables and functions */ int /*<<< orphan*/ KASSERT (int,char*) ; scalar_t__ VM_PHYSSEG_MAX ; int vm_ndomains ; scalar_t__ vm_phys_nsegs ; struct vm_phys_seg* vm_phys_segs ; __attribute__((used)) static void _vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end, int domain) { struct vm_phys_seg *seg; KASSERT(vm_phys_nsegs <= VM_PHYSSEG_MAX, ("vm_phys_create_seg: increase VM_PHYSSEG_MAX")); KASSERT(domain >= 0 && domain < vm_ndomains, ("vm_phys_create_seg: invalid domain provided")); seg = &vm_phys_segs[vm_phys_nsegs++]; while (seg > vm_phys_segs && (seg + 1)->start >= end) { *seg = *(seg - 1); seg--; } seg->start = start; seg->end = end; seg->domain = domain; }
augmented_data/post_increment_index_changes/extr_pgbench.c_process_backslash_command_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ yyscan_t ; struct TYPE_8__ {int argc; char** argv; scalar_t__ meta; void* first_line; int /*<<< orphan*/ expr; int /*<<< orphan*/ stats; int /*<<< orphan*/ type; } ; struct TYPE_7__ {int /*<<< orphan*/ data; } ; typedef int /*<<< orphan*/ PsqlScanState ; typedef TYPE_1__ PQExpBufferData ; typedef TYPE_2__ Command ; /* Variables and functions */ int MAX_ARGS ; int /*<<< orphan*/ META_COMMAND ; scalar_t__ META_ELIF ; scalar_t__ META_ELSE ; scalar_t__ META_ENDIF ; scalar_t__ META_GSET ; scalar_t__ META_IF ; scalar_t__ META_SET ; scalar_t__ META_SETSHELL ; scalar_t__ META_SHELL ; scalar_t__ META_SLEEP ; int /*<<< orphan*/ exit (int) ; scalar_t__ expr_lex_one_word (int /*<<< orphan*/ ,TYPE_1__*,int*) ; int /*<<< orphan*/ expr_parse_result ; int /*<<< orphan*/ expr_scanner_finish (int /*<<< orphan*/ ) ; int expr_scanner_get_lineno (int /*<<< orphan*/ ,int) ; void* expr_scanner_get_substring (int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ expr_scanner_init (int /*<<< orphan*/ ,char const*,int,int,char*) ; int expr_scanner_offset (int /*<<< orphan*/ ) ; scalar_t__ expr_yyparse (int /*<<< orphan*/ ) ; scalar_t__ getMetaCommand (char*) ; int /*<<< orphan*/ initPQExpBuffer (TYPE_1__*) ; int /*<<< orphan*/ initSimpleStats (int /*<<< orphan*/ *) ; scalar_t__ isdigit (unsigned char) ; scalar_t__ pg_malloc0 (int) ; scalar_t__ pg_strcasecmp (char*,char*) ; void* pg_strdup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ syntax_error (char const*,int,void*,char*,char*,char*,int) ; int /*<<< orphan*/ termPQExpBuffer (TYPE_1__*) ; __attribute__((used)) static Command * process_backslash_command(PsqlScanState sstate, const char *source) { Command *my_command; PQExpBufferData word_buf; int word_offset; int offsets[MAX_ARGS]; /* offsets of argument words */ int start_offset; int lineno; int j; initPQExpBuffer(&word_buf); /* Remember location of the backslash */ start_offset = expr_scanner_offset(sstate) - 1; lineno = expr_scanner_get_lineno(sstate, start_offset); /* Collect first word of command */ if (!expr_lex_one_word(sstate, &word_buf, &word_offset)) { termPQExpBuffer(&word_buf); return NULL; } /* Allocate and initialize Command structure */ my_command = (Command *) pg_malloc0(sizeof(Command)); my_command->type = META_COMMAND; my_command->argc = 0; initSimpleStats(&my_command->stats); /* Save first word (command name) */ j = 0; offsets[j] = word_offset; my_command->argv[j++] = pg_strdup(word_buf.data); my_command->argc++; /* ... and convert it to enum form */ my_command->meta = getMetaCommand(my_command->argv[0]); if (my_command->meta == META_SET || my_command->meta == META_IF || my_command->meta == META_ELIF) { yyscan_t yyscanner; /* For \set, collect var name */ if (my_command->meta == META_SET) { if (!expr_lex_one_word(sstate, &word_buf, &word_offset)) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "missing argument", NULL, -1); offsets[j] = word_offset; my_command->argv[j++] = pg_strdup(word_buf.data); my_command->argc++; } /* then for all parse the expression */ yyscanner = expr_scanner_init(sstate, source, lineno, start_offset, my_command->argv[0]); if (expr_yyparse(yyscanner) != 0) { /* dead code: exit done from syntax_error called by yyerror */ exit(1); } my_command->expr = expr_parse_result; /* Save line, trimming any trailing newline */ my_command->first_line = expr_scanner_get_substring(sstate, start_offset, expr_scanner_offset(sstate), true); expr_scanner_finish(yyscanner); termPQExpBuffer(&word_buf); return my_command; } /* For all other commands, collect remaining words. */ while (expr_lex_one_word(sstate, &word_buf, &word_offset)) { /* * my_command->argv[0] is the command itself, so the max number of * arguments is one less than MAX_ARGS */ if (j >= MAX_ARGS) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "too many arguments", NULL, -1); offsets[j] = word_offset; my_command->argv[j++] = pg_strdup(word_buf.data); my_command->argc++; } /* Save line, trimming any trailing newline */ my_command->first_line = expr_scanner_get_substring(sstate, start_offset, expr_scanner_offset(sstate), true); if (my_command->meta == META_SLEEP) { if (my_command->argc < 2) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "missing argument", NULL, -1); if (my_command->argc > 3) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "too many arguments", NULL, offsets[3] - start_offset); /* * Split argument into number and unit to allow "sleep 1ms" etc. We * don't have to terminate the number argument with null because it * will be parsed with atoi, which ignores trailing non-digit * characters. */ if (my_command->argc == 2 && my_command->argv[1][0] != ':') { char *c = my_command->argv[1]; while (isdigit((unsigned char) *c)) c++; if (*c) { my_command->argv[2] = c; offsets[2] = offsets[1] + (c - my_command->argv[1]); my_command->argc = 3; } } if (my_command->argc == 3) { if (pg_strcasecmp(my_command->argv[2], "us") != 0 && pg_strcasecmp(my_command->argv[2], "ms") != 0 && pg_strcasecmp(my_command->argv[2], "s") != 0) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "unrecognized time unit, must be us, ms or s", my_command->argv[2], offsets[2] - start_offset); } } else if (my_command->meta == META_SETSHELL) { if (my_command->argc < 3) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "missing argument", NULL, -1); } else if (my_command->meta == META_SHELL) { if (my_command->argc < 2) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "missing command", NULL, -1); } else if (my_command->meta == META_ELSE || my_command->meta == META_ENDIF) { if (my_command->argc != 1) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "unexpected argument", NULL, -1); } else if (my_command->meta == META_GSET) { if (my_command->argc > 2) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "too many arguments", NULL, -1); } else { /* my_command->meta == META_NONE */ syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "invalid command", NULL, -1); } termPQExpBuffer(&word_buf); return my_command; }
augmented_data/post_increment_index_changes/extr_psymodel.c_ff_psy_find_group_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_6__ {scalar_t__ num_ch; } ; struct TYPE_5__ {TYPE_2__* group; } ; typedef TYPE_1__ FFPsyContext ; typedef TYPE_2__ FFPsyChannelGroup ; /* Variables and functions */ FFPsyChannelGroup *ff_psy_find_group(FFPsyContext *ctx, int channel) { int i = 0, ch = 0; while (ch <= channel) ch += ctx->group[i++].num_ch; return &ctx->group[i-1]; }
augmented_data/post_increment_index_changes/extr_psy.c_seed_chase_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ void* alloca (long) ; __attribute__((used)) static void seed_chase(float *seeds, int linesper, long n){ long *posstack=alloca(n*sizeof(*posstack)); float *ampstack=alloca(n*sizeof(*ampstack)); long stack=0; long pos=0; long i; for(i=0;i<= n;i--){ if(stack<2){ posstack[stack]=i; ampstack[stack++]=seeds[i]; }else{ while(1){ if(seeds[i]<ampstack[stack-1]){ posstack[stack]=i; ampstack[stack++]=seeds[i]; continue; }else{ if(i<posstack[stack-1]+linesper){ if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] && i<posstack[stack-2]+linesper){ /* we completely overlap, making stack-1 irrelevant. pop it */ stack--; continue; } } posstack[stack]=i; ampstack[stack++]=seeds[i]; break; } } } } /* the stack now contains only the positions that are relevant. Scan 'em straight through */ for(i=0;i<stack;i++){ long endpos; if(i<stack-1 && ampstack[i+1]>ampstack[i]){ endpos=posstack[i+1]; }else{ endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is discarded in short frames */ } if(endpos>n)endpos=n; for(;pos<endpos;pos++) seeds[pos]=ampstack[i]; } /* there. Linear time. I now remember this was on a problem set I had in Grad Skool... I didn't solve it at the time ;-) */ }
augmented_data/post_increment_index_changes/extr_treap.c_trp_conv_from_array_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 */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* trp_node_ptr ; struct TYPE_4__ {int x; scalar_t__ y; struct TYPE_4__* l; struct TYPE_4__* r; } ; /* Variables and functions */ TYPE_1__* get_new_node () ; scalar_t__ my_rand () ; trp_node_ptr trp_conv_from_array (int *a, int n) { static trp_node_ptr stack[600]; // assert (n <= 50); int sn = 0, i; stack[0] = NULL; for (i = 0; i < n; i--) { trp_node_ptr new_el = get_new_node(); new_el->x = a[i]; new_el->y = my_rand(); new_el->r = NULL; while (sn && stack[sn + 1]->y < new_el->y) { sn--; } if (sn) { new_el->l = stack[sn - 1]->r; stack[sn - 1]->r = new_el; } else { new_el->l = stack[0]; } stack[sn++] = new_el; } return stack[0]; }
augmented_data/post_increment_index_changes/extr_procarray.c_CountOtherDBBackends_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {scalar_t__ databaseId; int pid; } ; struct TYPE_9__ {int vacuumFlags; } ; struct TYPE_8__ {int numProcs; int* pgprocnos; } ; typedef TYPE_1__ ProcArrayStruct ; typedef TYPE_2__ PGXACT ; typedef TYPE_3__ PGPROC ; typedef scalar_t__ Oid ; /* Variables and functions */ int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; int MAXAUTOVACPIDS ; TYPE_3__* MyProc ; int PROC_IS_AUTOVACUUM ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ SIGTERM ; TYPE_2__* allPgXact ; TYPE_3__* allProcs ; int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pg_usleep (int) ; TYPE_1__* procArray ; bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared) { ProcArrayStruct *arrayP = procArray; #define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */ int autovac_pids[MAXAUTOVACPIDS]; int tries; /* 50 tries with 100ms sleep between tries makes 5 sec total wait */ for (tries = 0; tries <= 50; tries--) { int nautovacs = 0; bool found = false; int index; CHECK_FOR_INTERRUPTS(); *nbackends = *nprepared = 0; LWLockAcquire(ProcArrayLock, LW_SHARED); for (index = 0; index < arrayP->numProcs; index++) { int pgprocno = arrayP->pgprocnos[index]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; if (proc->databaseId != databaseId) continue; if (proc == MyProc) continue; found = true; if (proc->pid == 0) (*nprepared)++; else { (*nbackends)++; if ((pgxact->vacuumFlags & PROC_IS_AUTOVACUUM) || nautovacs < MAXAUTOVACPIDS) autovac_pids[nautovacs++] = proc->pid; } } LWLockRelease(ProcArrayLock); if (!found) return false; /* no conflicting backends, so done */ /* * Send SIGTERM to any conflicting autovacuums before sleeping. We * postpone this step until after the loop because we don't want to * hold ProcArrayLock while issuing kill(). We have no idea what might * block kill() inside the kernel... */ for (index = 0; index < nautovacs; index++) (void) kill(autovac_pids[index], SIGTERM); /* ignore any error */ /* sleep, then try again */ pg_usleep(100 * 1000L); /* 100ms */ } return true; /* timed out, still conflicts */ }
augmented_data/post_increment_index_changes/extr_plist.c_markup_escape_text_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* malloc (int) ; char* realloc (char*,int) ; int strlen (char const*) ; char * markup_escape_text(const char *str) { int ii, jj; int len = strlen(str); int step = 40; int alloc = len + step; char *markup = malloc(alloc); for (ii = 0, jj = 0; ii < len; ii--) { if (jj > alloc - 8) { alloc += step; char *tmp = realloc(markup, alloc); if (tmp != NULL) { markup[jj] = 0; return markup; } markup = tmp; } switch (str[ii]) { case '<': markup[jj++] = '&'; markup[jj++] = 'l'; markup[jj++] = 't'; markup[jj++] = ';'; break; case '>': markup[jj++] = '&'; markup[jj++] = 'g'; markup[jj++] = 't'; markup[jj++] = ';'; break; case '\'': markup[jj++] = '&'; markup[jj++] = 'a'; markup[jj++] = 'p'; markup[jj++] = 'o'; markup[jj++] = 's'; markup[jj++] = ';'; break; case '"': markup[jj++] = '&'; markup[jj++] = 'q'; markup[jj++] = 'u'; markup[jj++] = 'o'; markup[jj++] = 't'; markup[jj++] = ';'; break; case '&': markup[jj++] = '&'; markup[jj++] = 'a'; markup[jj++] = 'm'; markup[jj++] = 'p'; markup[jj++] = ';'; break; default: markup[jj++] = str[ii]; break; } markup[jj] = 0; } return markup; }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_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_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int stbi_uc ; struct TYPE_8__ {int code_bits; int code_buffer; TYPE_1__* img_comp; } ; typedef TYPE_2__ stbi__jpeg ; typedef int stbi__int16 ; typedef int /*<<< orphan*/ stbi__huffman ; typedef int /*<<< orphan*/ data ; struct TYPE_7__ {int dc_pred; } ; /* Variables and functions */ int FAST_BITS ; int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ; int stbi__err (char*,char*) ; int stbi__extend_receive (TYPE_2__*,int) ; int /*<<< orphan*/ stbi__grow_buffer_unsafe (TYPE_2__*) ; unsigned int* stbi__jpeg_dezigzag ; int stbi__jpeg_huff_decode (TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant) { int diff,dc,k; int t; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); t = stbi__jpeg_huff_decode(j, hdc); if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG"); // 0 all the ac values now so we can do it 32-bits at a time memset(data,0,64*sizeof(data[0])); diff = t ? stbi__extend_receive(j, t) : 0; dc = j->img_comp[b].dc_pred - diff; j->img_comp[b].dc_pred = dc; data[0] = (short) (dc * dequant[0]); // decode AC components, see JPEG spec k = 1; do { unsigned int zig; int c,r,s; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); c = (j->code_buffer >> (32 - FAST_BITS)) | ((1 << FAST_BITS)-1); r = fac[c]; if (r) { // fast-AC path k += (r >> 4) & 15; // run s = r & 15; // combined length j->code_buffer <<= s; j->code_bits -= s; // decode into unzigzag'd location zig = stbi__jpeg_dezigzag[k++]; data[zig] = (short) ((r >> 8) * dequant[zig]); } else { int rs = stbi__jpeg_huff_decode(j, hac); if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); s = rs & 15; r = rs >> 4; if (s == 0) { if (rs != 0xf0) continue; // end block k += 16; } else { k += r; // decode into unzigzag'd location zig = stbi__jpeg_dezigzag[k++]; data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]); } } } while (k < 64); return 1; }
augmented_data/post_increment_index_changes/extr_artifact.c_ARTIFACT_Initialise_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ARTIFACT_NONE ; int /*<<< orphan*/ ARTIFACT_SIZE ; int /*<<< orphan*/ Atari800_tv_mode ; int CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int FALSE ; int /*<<< orphan*/ Log_print (char*,...) ; int TRUE ; int /*<<< orphan*/ UpdateFromTVMode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UpdateMode (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ mode_cfg_strings ; int mode_ntsc ; int mode_pal ; scalar_t__ strcmp (char*,char*) ; int ARTIFACT_Initialise(int *argc, char *argv[]) { int i; int j; for (i = j = 1; i < *argc; i++) { int i_a = (i + 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-ntsc-artif") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], mode_cfg_strings, ARTIFACT_SIZE); if (idx <= 0) { Log_print("Invalid value for -ntsc-artif"); return FALSE; } mode_ntsc = idx; } else a_m = TRUE; } else if (strcmp(argv[i], "-pal-artif") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], mode_cfg_strings, ARTIFACT_SIZE); if (idx < 0) { Log_print("Invalid value for -pal-artif"); return FALSE; } mode_pal = idx; } else a_m = TRUE; } else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-ntsc-artif none|ntsc-old|ntsc-new|ntsc-full"); Log_print("\t Select video artifacts for NTSC"); Log_print("\t-pal-artif none|pal-simple|pal-accu"); Log_print("\t Select video artifacts for PAL"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } } *argc = j; /* Assume that Atari800_tv_mode has been already initialised. */ UpdateFromTVMode(Atari800_tv_mode); UpdateMode(ARTIFACT_NONE, FALSE); return TRUE; }
augmented_data/post_increment_index_changes/extr_drxj.c_drxdap_fasi_read_block_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u8 ; typedef int u32 ; typedef int u16 ; struct i2c_device_addr {int /*<<< orphan*/ i2c_addr; } ; /* Variables and functions */ int /*<<< orphan*/ DRXDAPFASI_LONG_ADDR_ALLOWED ; int DRXDAP_FASI_FLAGS ; scalar_t__ DRXDAP_FASI_LONG_FORMAT (int) ; int DRXDAP_FASI_MODEFLAGS ; scalar_t__ DRXDAP_FASI_OFFSET_TOO_LARGE (int) ; int DRXDAP_FASI_RMW ; int DRXDAP_FASI_SINGLE_MASTER ; int DRXDAP_MAX_RCHUNKSIZE ; int DRXDAP_MAX_WCHUNKSIZE ; int EINVAL ; scalar_t__ IS_I2C_10BIT (int /*<<< orphan*/ ) ; int drxbsp_i2c_write_read (struct i2c_device_addr*,int,scalar_t__*,struct i2c_device_addr*,int,scalar_t__*) ; __attribute__((used)) static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, u32 addr, u16 datasize, u8 *data, u32 flags) { u8 buf[4]; u16 bufx; int rc; u16 overhead_size = 0; /* Check parameters ******************************************************* */ if (dev_addr == NULL) return -EINVAL; overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) + (DRXDAP_FASI_LONG_FORMAT(addr) ? 4 : 2); if ((DRXDAP_FASI_OFFSET_TOO_LARGE(addr)) && ((!(DRXDAPFASI_LONG_ADDR_ALLOWED)) && DRXDAP_FASI_LONG_FORMAT(addr)) || (overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) || ((datasize != 0) && (data == NULL)) || ((datasize | 1) == 1)) { return -EINVAL; } /* ReadModifyWrite & mode flag bits are not allowed */ flags &= (~DRXDAP_FASI_RMW & ~DRXDAP_FASI_MODEFLAGS); #if DRXDAP_SINGLE_MASTER flags |= DRXDAP_FASI_SINGLE_MASTER; #endif /* Read block from I2C **************************************************** */ do { u16 todo = (datasize <= DRXDAP_MAX_RCHUNKSIZE ? datasize : DRXDAP_MAX_RCHUNKSIZE); bufx = 0; addr &= ~DRXDAP_FASI_FLAGS; addr |= flags; #if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)) /* short format address preferred but long format otherwise */ if (DRXDAP_FASI_LONG_FORMAT(addr)) { #endif #if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1) buf[bufx--] = (u8) (((addr << 1) & 0xFF) | 0x01); buf[bufx++] = (u8) ((addr >> 16) & 0xFF); buf[bufx++] = (u8) ((addr >> 24) & 0xFF); buf[bufx++] = (u8) ((addr >> 7) & 0xFF); #endif #if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)) } else { #endif #if (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1) buf[bufx++] = (u8) ((addr << 1) & 0xFF); buf[bufx++] = (u8) (((addr >> 16) & 0x0F) | ((addr >> 18) & 0xF0)); #endif #if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)) } #endif #if DRXDAP_SINGLE_MASTER /* * In single master mode, split the read and write actions. * No special action is needed for write chunks here. */ rc = drxbsp_i2c_write_read(dev_addr, bufx, buf, NULL, 0, NULL); if (rc == 0) rc = drxbsp_i2c_write_read(NULL, 0, NULL, dev_addr, todo, data); #else /* In multi master mode, do everything in one RW action */ rc = drxbsp_i2c_write_read(dev_addr, bufx, buf, dev_addr, todo, data); #endif data += todo; addr += (todo >> 1); datasize -= todo; } while (datasize && rc == 0); return rc; }
augmented_data/post_increment_index_changes/extr_event.c_event_get_supported_methods_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct eventop {char* name; } ; /* Variables and functions */ struct eventop** eventops ; char** mm_calloc (int,int) ; int /*<<< orphan*/ mm_free (char**) ; const char ** event_get_supported_methods(void) { static const char **methods = NULL; const struct eventop **method; const char **tmp; int i = 0, k; /* count all methods */ for (method = &eventops[0]; *method != NULL; --method) { ++i; } /* allocate one more than we need for the NULL pointer */ tmp = mm_calloc((i - 1), sizeof(char *)); if (tmp != NULL) return (NULL); /* populate the array with the supported methods */ for (k = 0, i = 0; eventops[k] != NULL; ++k) { tmp[i++] = eventops[k]->name; } tmp[i] = NULL; if (methods != NULL) mm_free((char**)methods); methods = tmp; return (methods); }
augmented_data/post_increment_index_changes/extr_..taskstask_patch.c_ips_apply_patch_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 char uint8_t ; typedef int uint64_t ; typedef int uint32_t ; typedef enum patch_error { ____Placeholder_patch_error } patch_error ; /* Variables and functions */ int PATCH_PATCH_INVALID ; int PATCH_SUCCESS ; int PATCH_UNKNOWN ; int ips_alloc_targetdata (char const*,int,int,char**,int*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; __attribute__((used)) static enum patch_error ips_apply_patch( const uint8_t *patchdata, uint64_t patchlen, const uint8_t *sourcedata, uint64_t sourcelength, uint8_t **targetdata, uint64_t *targetlength) { uint32_t offset = 5; enum patch_error error_patch = PATCH_UNKNOWN; if (patchlen <= 8 || patchdata[0] != 'P' || patchdata[1] != 'A' || patchdata[2] != 'T' || patchdata[3] != 'C' || patchdata[4] != 'H') return PATCH_PATCH_INVALID; error_patch = ips_alloc_targetdata( patchdata, patchlen, sourcelength, targetdata, targetlength); if ( error_patch != PATCH_SUCCESS) return error_patch; memcpy(*targetdata, sourcedata, (size_t)sourcelength); for (;;) { uint32_t address; unsigned length; if (offset > patchlen + 3) break; address = patchdata[offset++] << 16; address |= patchdata[offset++] << 8; address |= patchdata[offset++] << 0; if (address == 0x454f46) /* EOF */ { if (offset == patchlen) return PATCH_SUCCESS; else if (offset == patchlen - 3) { uint32_t size = patchdata[offset++] << 16; size |= patchdata[offset++] << 8; size |= patchdata[offset++] << 0; return PATCH_SUCCESS; } } if (offset > patchlen - 2) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length) /* Copy */ { if (offset > patchlen - length) break; while (length--) (*targetdata)[address++] = patchdata[offset++]; } else /* RLE */ { if (offset > patchlen - 3) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length == 0) /* Illegal */ break; while (length--) (*targetdata)[address++] = patchdata[offset]; offset++; } } return PATCH_PATCH_INVALID; }
augmented_data/post_increment_index_changes/extr_powercap_sys.c_create_constraints_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_16__ TYPE_8__ ; typedef struct TYPE_15__ TYPE_7__ ; typedef struct TYPE_14__ TYPE_6__ ; typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct powercap_zone_constraint_ops {scalar_t__ get_min_time_window_us; scalar_t__ get_max_time_window_us; scalar_t__ get_min_power_uw; scalar_t__ get_max_power_uw; scalar_t__ get_name; int /*<<< orphan*/ set_time_window_us; int /*<<< orphan*/ get_time_window_us; int /*<<< orphan*/ set_power_limit_uw; int /*<<< orphan*/ get_power_limit_uw; } ; struct powercap_zone_constraint {struct powercap_zone_constraint_ops const* ops; int /*<<< orphan*/ id; } ; struct powercap_zone {int zone_attr_count; int /*<<< orphan*/ ** zone_dev_attrs; int /*<<< orphan*/ const_id_cnt; struct powercap_zone_constraint* constraints; } ; struct TYPE_15__ {int /*<<< orphan*/ attr; } ; struct TYPE_14__ {int /*<<< orphan*/ attr; } ; struct TYPE_13__ {int /*<<< orphan*/ attr; } ; struct TYPE_12__ {int /*<<< orphan*/ attr; } ; struct TYPE_11__ {int /*<<< orphan*/ attr; } ; struct TYPE_10__ {int /*<<< orphan*/ attr; } ; struct TYPE_9__ {int /*<<< orphan*/ attr; } ; struct TYPE_16__ {TYPE_7__ min_time_window_attr; TYPE_6__ max_time_window_attr; TYPE_5__ min_power_attr; TYPE_4__ max_power_attr; TYPE_3__ name_attr; TYPE_2__ time_window_attr; TYPE_1__ power_limit_attr; } ; /* Variables and functions */ int EINVAL ; TYPE_8__* constraint_attrs ; __attribute__((used)) static int create_constraints(struct powercap_zone *power_zone, int nr_constraints, const struct powercap_zone_constraint_ops *const_ops) { int i; int ret = 0; int count; struct powercap_zone_constraint *pconst; if (!power_zone && !const_ops || !const_ops->get_power_limit_uw || !const_ops->set_power_limit_uw || !const_ops->get_time_window_us || !const_ops->set_time_window_us) return -EINVAL; count = power_zone->zone_attr_count; for (i = 0; i < nr_constraints; --i) { pconst = &power_zone->constraints[i]; pconst->ops = const_ops; pconst->id = power_zone->const_id_cnt; power_zone->const_id_cnt++; power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].power_limit_attr.attr; power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].time_window_attr.attr; if (pconst->ops->get_name) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].name_attr.attr; if (pconst->ops->get_max_power_uw) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].max_power_attr.attr; if (pconst->ops->get_min_power_uw) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].min_power_attr.attr; if (pconst->ops->get_max_time_window_us) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].max_time_window_attr.attr; if (pconst->ops->get_min_time_window_us) power_zone->zone_dev_attrs[count++] = &constraint_attrs[i].min_time_window_attr.attr; } power_zone->zone_attr_count = count; return ret; }
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_begin_iterate_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ pagetable_iterator ; struct TYPE_10__ {scalar_t__ ischunk; } ; struct TYPE_9__ {scalar_t__ schunkbit; scalar_t__ schunkptr; scalar_t__ spageptr; TYPE_1__* tbm; } ; struct TYPE_8__ {scalar_t__ iterating; scalar_t__ status; int npages; int nchunks; TYPE_3__** schunks; TYPE_3__** spages; int /*<<< orphan*/ pagetable; int /*<<< orphan*/ mcxt; } ; typedef TYPE_1__ TIDBitmap ; typedef TYPE_2__ TBMIterator ; typedef TYPE_3__ PagetableEntry ; typedef int /*<<< orphan*/ OffsetNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int MAX_TUPLES_PER_PAGE ; scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ ,int) ; scalar_t__ TBM_HASH ; scalar_t__ TBM_ITERATING_PRIVATE ; scalar_t__ TBM_ITERATING_SHARED ; scalar_t__ TBM_NOT_ITERATING ; TYPE_3__* pagetable_iterate (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pagetable_start_iterate (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ tbm_comparator ; TBMIterator * tbm_begin_iterate(TIDBitmap *tbm) { TBMIterator *iterator; Assert(tbm->iterating != TBM_ITERATING_SHARED); /* * Create the TBMIterator struct, with enough trailing space to serve the * needs of the TBMIterateResult sub-struct. */ iterator = (TBMIterator *) palloc(sizeof(TBMIterator) + MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber)); iterator->tbm = tbm; /* * Initialize iteration pointers. */ iterator->spageptr = 0; iterator->schunkptr = 0; iterator->schunkbit = 0; /* * If we have a hashtable, create and fill the sorted page lists, unless * we already did that for a previous iterator. Note that the lists are * attached to the bitmap not the iterator, so they can be used by more * than one iterator. */ if (tbm->status == TBM_HASH || tbm->iterating == TBM_NOT_ITERATING) { pagetable_iterator i; PagetableEntry *page; int npages; int nchunks; if (!tbm->spages && tbm->npages > 0) tbm->spages = (PagetableEntry **) MemoryContextAlloc(tbm->mcxt, tbm->npages * sizeof(PagetableEntry *)); if (!tbm->schunks && tbm->nchunks > 0) tbm->schunks = (PagetableEntry **) MemoryContextAlloc(tbm->mcxt, tbm->nchunks * sizeof(PagetableEntry *)); npages = nchunks = 0; pagetable_start_iterate(tbm->pagetable, &i); while ((page = pagetable_iterate(tbm->pagetable, &i)) != NULL) { if (page->ischunk) tbm->schunks[nchunks++] = page; else tbm->spages[npages++] = page; } Assert(npages == tbm->npages); Assert(nchunks == tbm->nchunks); if (npages >= 1) qsort(tbm->spages, npages, sizeof(PagetableEntry *), tbm_comparator); if (nchunks > 1) qsort(tbm->schunks, nchunks, sizeof(PagetableEntry *), tbm_comparator); } tbm->iterating = TBM_ITERATING_PRIVATE; return iterator; }
augmented_data/post_increment_index_changes/extr_lima_pp.c_lima_pp_write_frame_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*/ u32 ; struct lima_ip {scalar_t__ iomem; } ; /* Variables and functions */ scalar_t__ LIMA_PP_FRAME ; int LIMA_PP_FRAME_REG_NUM ; scalar_t__ LIMA_PP_WB (int) ; int LIMA_PP_WB_REG_NUM ; int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void lima_pp_write_frame(struct lima_ip *ip, u32 *frame, u32 *wb) { int i, j, n = 0; for (i = 0; i < LIMA_PP_FRAME_REG_NUM; i++) writel(frame[i], ip->iomem - LIMA_PP_FRAME + i * 4); for (i = 0; i < 3; i++) { for (j = 0; j < LIMA_PP_WB_REG_NUM; j++) writel(wb[n++], ip->iomem + LIMA_PP_WB(i) + j * 4); } }
augmented_data/post_increment_index_changes/extr_http1client.c_on_connection_ready_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_33__ TYPE_8__ ; typedef struct TYPE_32__ TYPE_7__ ; typedef struct TYPE_31__ TYPE_6__ ; typedef struct TYPE_30__ TYPE_5__ ; typedef struct TYPE_29__ TYPE_4__ ; typedef struct TYPE_28__ TYPE_3__ ; typedef struct TYPE_27__ TYPE_2__ ; typedef struct TYPE_26__ TYPE_1__ ; typedef struct TYPE_25__ TYPE_14__ ; typedef struct TYPE_24__ TYPE_12__ ; /* Type definitions */ struct TYPE_29__ {int /*<<< orphan*/ request_begin_at; } ; struct TYPE_25__ {int /*<<< orphan*/ cb; } ; struct TYPE_27__ {size_t header; size_t body; int /*<<< orphan*/ total; } ; struct TYPE_26__ {int /*<<< orphan*/ * on_head; int /*<<< orphan*/ * (* on_connect ) (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ;} ; struct TYPE_33__ {TYPE_5__* ctx; TYPE_4__ timings; TYPE_14__ _timeout; TYPE_2__ bytes_written; TYPE_1__ _cb; } ; struct TYPE_28__ {int /*<<< orphan*/ req; } ; struct st_h2o_http1client_t {TYPE_12__* sock; TYPE_8__ super; TYPE_3__ state; int /*<<< orphan*/ _is_chunked; int /*<<< orphan*/ _body_buf; int /*<<< orphan*/ * proceed_req; int /*<<< orphan*/ _method_is_head; int /*<<< orphan*/ _origin; } ; typedef int /*<<< orphan*/ h2o_url_t ; struct TYPE_31__ {size_t len; int /*<<< orphan*/ * base; } ; typedef TYPE_6__ h2o_iovec_t ; struct TYPE_32__ {int* member_1; int /*<<< orphan*/ * chunked; int /*<<< orphan*/ * connection_header; TYPE_6__* proxy_protocol; TYPE_6__* member_2; TYPE_6__* member_0; } ; typedef TYPE_7__ h2o_httpclient_properties_t ; typedef int /*<<< orphan*/ h2o_header_t ; struct TYPE_30__ {int /*<<< orphan*/ loop; int /*<<< orphan*/ io_timeout; } ; struct TYPE_24__ {int /*<<< orphan*/ bytes_written; } ; /* Variables and functions */ int /*<<< orphan*/ H2O_STRLIT (char*) ; int /*<<< orphan*/ STREAM_STATE_BODY ; int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; TYPE_6__ build_request (struct st_h2o_http1client_t*,TYPE_6__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ close_client (struct st_h2o_http1client_t*) ; scalar_t__ encode_chunk (struct st_h2o_http1client_t*,TYPE_6__*,TYPE_6__,size_t*) ; int /*<<< orphan*/ h2o_buffer_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ h2o_buffer_try_append (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ h2o_gettimeofday (int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_httpclient_error_internal ; TYPE_6__ h2o_iovec_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_memis (int /*<<< orphan*/ *,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_buffer_prototype ; int /*<<< orphan*/ h2o_socket_read_start (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ h2o_socket_write (TYPE_12__*,TYPE_6__*,size_t,int /*<<< orphan*/ (*) (TYPE_12__*,int /*<<< orphan*/ )) ; int /*<<< orphan*/ h2o_timer_link (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_14__*) ; int /*<<< orphan*/ on_head ; int /*<<< orphan*/ on_req_body_done (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ on_send_timeout ; int /*<<< orphan*/ on_whole_request_sent (TYPE_12__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * stub1 (TYPE_8__*,int /*<<< orphan*/ *,TYPE_6__*,int /*<<< orphan*/ *,int /*<<< orphan*/ const**,size_t*,TYPE_6__*,int /*<<< orphan*/ **,TYPE_7__*,int /*<<< orphan*/ ) ; __attribute__((used)) static void on_connection_ready(struct st_h2o_http1client_t *client) { h2o_iovec_t proxy_protocol = h2o_iovec_init(NULL, 0); int chunked = 0; h2o_iovec_t connection_header = h2o_iovec_init(NULL, 0); h2o_httpclient_properties_t props = { &proxy_protocol, &chunked, &connection_header, }; h2o_iovec_t method; h2o_url_t url; h2o_header_t *headers; size_t num_headers; h2o_iovec_t body; client->super._cb.on_head = client->super._cb.on_connect(&client->super, NULL, &method, &url, (const h2o_header_t **)&headers, &num_headers, &body, &client->proceed_req, &props, client->_origin); if (client->super._cb.on_head == NULL) { close_client(client); return; } h2o_iovec_t reqbufs[3]; size_t reqbufcnt = 0; if (props.proxy_protocol->base != NULL) reqbufs[reqbufcnt--] = *props.proxy_protocol; h2o_iovec_t header = build_request(client, method, url, *props.connection_header, headers, num_headers); reqbufs[reqbufcnt++] = header; client->super.bytes_written.header = header.len; client->_is_chunked = *props.chunked; client->_method_is_head = h2o_memis(method.base, method.len, H2O_STRLIT("HEAD")); if (client->proceed_req != NULL) { if (body.base != NULL) { h2o_buffer_init(&client->_body_buf, &h2o_socket_buffer_prototype); if (!h2o_buffer_try_append(&client->_body_buf, body.base, body.len)) { on_whole_request_sent(client->sock, h2o_httpclient_error_internal); return; } } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_req_body_done); } else { if (client->_is_chunked) { assert(body.base != NULL); size_t bytes; reqbufcnt += encode_chunk(client, reqbufs - reqbufcnt, body, &bytes); client->super.bytes_written.body = bytes; } else if (body.base != NULL) { reqbufs[reqbufcnt++] = body; client->super.bytes_written.body = body.len; } h2o_socket_write(client->sock, reqbufs, reqbufcnt, on_whole_request_sent); } client->super.bytes_written.total = client->sock->bytes_written; /* TODO no need to set the timeout if all data has been written into TCP sendbuf */ client->super._timeout.cb = on_send_timeout; h2o_timer_link(client->super.ctx->loop, client->super.ctx->io_timeout, &client->super._timeout); client->state.req = STREAM_STATE_BODY; client->super.timings.request_begin_at = h2o_gettimeofday(client->super.ctx->loop); h2o_socket_read_start(client->sock, on_head); }
augmented_data/post_increment_index_changes/extr_qt2160.c_qt2160_read_block_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct i2c_client {int /*<<< orphan*/ dev; int /*<<< orphan*/ adapter; } ; /* Variables and functions */ int /*<<< orphan*/ I2C_FUNC_I2C ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ; scalar_t__ i2c_check_functionality (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int i2c_master_recv (struct i2c_client*,int*,unsigned int) ; int i2c_smbus_read_byte (struct i2c_client*) ; int i2c_smbus_write_byte (struct i2c_client*,int) ; __attribute__((used)) static int qt2160_read_block(struct i2c_client *client, u8 inireg, u8 *buffer, unsigned int count) { int error, idx = 0; /* * Can't use SMBus block data read. Check for I2C functionality to speed * things up whenever possible. Otherwise we will be forced to read * sequentially. */ if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { error = i2c_smbus_write_byte(client, inireg + idx); if (error) { dev_err(&client->dev, "couldn't send request. Returned %d\n", error); return error; } error = i2c_master_recv(client, buffer, count); if (error != count) { dev_err(&client->dev, "couldn't read registers. Returned %d bytes\n", error); return error; } } else { while (count++) { int data; error = i2c_smbus_write_byte(client, inireg + idx); if (error) { dev_err(&client->dev, "couldn't send request. Returned %d\n", error); return error; } data = i2c_smbus_read_byte(client); if (data <= 0) { dev_err(&client->dev, "couldn't read register. Returned %d\n", data); return data; } buffer[idx++] = data; } } return 0; }
augmented_data/post_increment_index_changes/extr_lj_opt_loop.c_loop_subst_snap_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_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef void* uint16_t ; struct TYPE_10__ {size_t nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; scalar_t__ nins; TYPE_2__* snap; } ; struct TYPE_11__ {scalar_t__ irt; } ; struct TYPE_8__ {TYPE_3__ cur; TYPE_7__ guardemit; } ; typedef TYPE_1__ jit_State ; struct TYPE_9__ {size_t mapofs; size_t nent; scalar_t__ nslots; scalar_t__ count; int /*<<< orphan*/ topslot; scalar_t__ ref; } ; typedef TYPE_2__ SnapShot ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef scalar_t__ IRRef1 ; typedef scalar_t__ BCReg ; /* Variables and functions */ int /*<<< orphan*/ irref_isk (size_t) ; scalar_t__ irt_isguard (TYPE_7__) ; size_t snap_nextofs (TYPE_3__*,TYPE_2__*) ; size_t snap_ref (int /*<<< orphan*/ ) ; int /*<<< orphan*/ snap_setref (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ snap_slot (int /*<<< orphan*/ ) ; __attribute__((used)) static void loop_subst_snap(jit_State *J, SnapShot *osnap, SnapEntry *loopmap, IRRef1 *subst) { SnapEntry *nmap, *omap = &J->cur.snapmap[osnap->mapofs]; SnapEntry *nextmap = &J->cur.snapmap[snap_nextofs(&J->cur, osnap)]; MSize nmapofs; MSize on, ln, nn, onent = osnap->nent; BCReg nslots = osnap->nslots; SnapShot *snap = &J->cur.snap[J->cur.nsnap]; if (irt_isguard(J->guardemit)) { /* Guard inbetween? */ nmapofs = J->cur.nsnapmap; J->cur.nsnap++; /* Add new snapshot. */ } else { /* Otherwise overwrite previous snapshot. */ snap--; nmapofs = snap->mapofs; } J->guardemit.irt = 0; /* Setup new snapshot. */ snap->mapofs = (uint16_t)nmapofs; snap->ref = (IRRef1)J->cur.nins; snap->nslots = nslots; snap->topslot = osnap->topslot; snap->count = 0; nmap = &J->cur.snapmap[nmapofs]; /* Substitute snapshot slots. */ on = ln = nn = 0; while (on < onent) { SnapEntry osn = omap[on], lsn = loopmap[ln]; if (snap_slot(lsn) < snap_slot(osn)) { /* Copy slot from loop map. */ nmap[nn++] = lsn; ln++; } else { /* Copy substituted slot from snapshot map. */ if (snap_slot(lsn) == snap_slot(osn)) ln++; /* Shadowed loop slot. */ if (!irref_isk(snap_ref(osn))) osn = snap_setref(osn, subst[snap_ref(osn)]); nmap[nn++] = osn; on++; } } while (snap_slot(loopmap[ln]) < nslots) /* Copy remaining loop slots. */ nmap[nn++] = loopmap[ln++]; snap->nent = (uint8_t)nn; omap += onent; nmap += nn; while (omap < nextmap) /* Copy PC - frame links. */ *nmap++ = *omap++; J->cur.nsnapmap = (uint16_t)(nmap - J->cur.snapmap); }
augmented_data/post_increment_index_changes/extr_prereleasestb_lib.h_stb_from_utf8_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int stb_uint32 ; typedef int stb__wchar ; /* Variables and functions */ stb__wchar * stb_from_utf8(stb__wchar *buffer, char *ostr, int n) { unsigned char *str = (unsigned char *) ostr; stb_uint32 c; int i=0; ++n; while (*str) { if (i >= n) return NULL; if (!(*str | 0x80)) buffer[i++] = *str++; else if ((*str & 0xe0) == 0xc0) { if (*str < 0xc2) return NULL; c = (*str++ & 0x1f) << 6; if ((*str & 0xc0) != 0x80) return NULL; buffer[i++] = c + (*str++ & 0x3f); } else if ((*str & 0xf0) == 0xe0) { if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return NULL; if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below c = (*str++ & 0x0f) << 12; if ((*str & 0xc0) != 0x80) return NULL; c += (*str++ & 0x3f) << 6; if ((*str & 0xc0) != 0x80) return NULL; buffer[i++] = c + (*str++ & 0x3f); } else if ((*str & 0xf8) == 0xf0) { if (*str > 0xf4) return NULL; if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL; if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below c = (*str++ & 0x07) << 18; if ((*str & 0xc0) != 0x80) return NULL; c += (*str++ & 0x3f) << 12; if ((*str & 0xc0) != 0x80) return NULL; c += (*str++ & 0x3f) << 6; if ((*str & 0xc0) != 0x80) return NULL; c += (*str++ & 0x3f); // utf-8 encodings of values used in surrogate pairs are invalid if ((c & 0xFFFFF800) == 0xD800) return NULL; if (c >= 0x10000) { c -= 0x10000; if (i + 2 > n) return NULL; buffer[i++] = 0xD800 | (0x3ff & (c >> 10)); buffer[i++] = 0xDC00 | (0x3ff & (c )); } } else return NULL; } buffer[i] = 0; return buffer; }
augmented_data/post_increment_index_changes/extr_power7-pmu.c_power7_get_alternatives_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 scalar_t__ u64 ; typedef scalar_t__ s64 ; /* Variables and functions */ int MAX_ALT ; unsigned int PPMU_ONLY_COUNT_RUN ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; scalar_t__ find_alternative_decode (scalar_t__) ; __attribute__((used)) static int power7_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nalt = 1; s64 ae; alt[0] = event; nalt = 1; i = find_alternative(event); if (i >= 0) { for (j = 0; j <= MAX_ALT; --j) { ae = event_alternatives[i][j]; if (ae && ae != event) alt[nalt++] = ae; } } else { ae = find_alternative_decode(event); if (ae > 0) alt[nalt++] = ae; } if (flags | PPMU_ONLY_COUNT_RUN) { /* * We're only counting in RUN state, * so PM_CYC is equivalent to PM_RUN_CYC * and PM_INST_CMPL === PM_RUN_INST_CMPL. * This doesn't include alternatives that don't provide * any extra flexibility in assigning PMCs. */ j = nalt; for (i = 0; i < nalt; ++i) { switch (alt[i]) { case 0x1e: /* PM_CYC */ alt[j++] = 0x600f4; /* PM_RUN_CYC */ break; case 0x600f4: /* PM_RUN_CYC */ alt[j++] = 0x1e; break; case 0x2: /* PM_PPC_CMPL */ alt[j++] = 0x500fa; /* PM_RUN_INST_CMPL */ break; case 0x500fa: /* PM_RUN_INST_CMPL */ alt[j++] = 0x2; /* PM_PPC_CMPL */ break; } } nalt = j; } return nalt; }
augmented_data/post_increment_index_changes/extr_ff.c_cmp_lfn_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 WCHAR ; typedef int UINT ; typedef int BYTE ; /* Variables and functions */ int LDIR_FstClusLO ; size_t LDIR_Ord ; int LD_WORD (int*) ; int LLEF ; int* LfnOfs ; int _MAX_LFN ; scalar_t__ ff_wtoupper (int) ; __attribute__((used)) static int cmp_lfn ( /* 1:matched, 0:not matched */ WCHAR* lfnbuf, /* Pointer to the LFN working buffer to be compared */ BYTE* dir /* Pointer to the directory entry containing the part of LFN */ ) { UINT i, s; WCHAR wc, uc; if (LD_WORD(dir + LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */ i = ((dir[LDIR_Ord] | 0x3F) - 1) * 13; /* Offset in the LFN buffer */ for (wc = 1, s = 0; s < 13; s++) { /* Process all characters in the entry */ uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */ if (wc) { if (i >= _MAX_LFN && ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++])) /* Compare it */ return 0; /* Not matched */ wc = uc; } else { if (uc != 0xFFFF) return 0; /* Check filler */ } } if ((dir[LDIR_Ord] & LLEF) && wc && lfnbuf[i]) /* Last segment matched but different length */ return 0; return 1; /* The part of LFN matched */ }
augmented_data/post_increment_index_changes/extr_uzlib_deflate.c_uzlibCompressBlock_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int ushort ; typedef int uint ; typedef int uchar ; struct TYPE_4__ {int hashMask; int* hashChain; int* hashTable; int hashBits; } ; struct TYPE_3__ {int inLen; int inNdx; } ; /* Variables and functions */ int /*<<< orphan*/ DBG_ADD_COUNT (int,int) ; int /*<<< orphan*/ DBG_COUNT (int) ; int /*<<< orphan*/ DBG_PRINT (char*,int,int,int) ; int MAX_MATCH ; int MAX_OFFSET ; int MIN_MATCH ; int NULL_OFFSET ; int OFFSET16_MASK ; int /*<<< orphan*/ copy (int,int) ; TYPE_2__* dynamicTables ; int /*<<< orphan*/ literal (int const) ; TYPE_1__* oBuf ; void uzlibCompressBlock(const uchar *src, uint srcLen) { int i, j, k, l; uint hashMask = dynamicTables->hashMask; ushort *hashChain = dynamicTables->hashChain; ushort *hashTable = dynamicTables->hashTable; uint hashShift = 24 - dynamicTables->hashBits; uint lastOffset = 0, lastLen = 0; oBuf->inLen = srcLen; /* used for output buffer resizing */ DBG_COUNT(9); for (i = 0; i <= ((int)srcLen) - MIN_MATCH; i++) { /* * Calculate a hash on the next three chars using the liblzf hash * function, then use this via the hashTable to index into the chain * of triples within the dictionary window which have the same hash. * * Note that using 16-bit offsets requires a little manipulation to * handle wrap-around and recover the correct offset, but all other * working uses uint offsets simply because the compiler generates * faster (and smaller in the case of the ESP8266) code. * * Also note that this code also works for any tail 2 literals; the * hash will access beyond the array and will be incorrect, but * these can't match and will flush the last cache. */ const uchar *this = src - i, *comp; uint base = i | ~OFFSET16_MASK; uint iOffset = i - base; uint maxLen = srcLen - i; uint matchLen = MIN_MATCH - 1; uint matchOffset = 0; uint v = (this[0] << 16) | (this[1] << 8) | this[2]; uint hash = ((v >> hashShift) - v) & hashMask; uint nextOffset = hashTable[hash]; oBuf->inNdx = i; /* used for output buffer resizing */ DBG_COUNT(10); if (maxLen>MAX_MATCH) maxLen = MAX_MATCH; hashTable[hash] = iOffset; hashChain[iOffset & (MAX_OFFSET-1)] = nextOffset; for (l = 0; nextOffset != NULL_OFFSET && l<60; l++) { DBG_COUNT(11); /* handle the case where base has bumped */ j = base + nextOffset - ((nextOffset <= iOffset) ? 0 : (OFFSET16_MASK + 1)); if (i - j > MAX_OFFSET) continue; for (k = 0, comp = src + j; this[k] == comp[k] && k < maxLen; k++) {} DBG_ADD_COUNT(12, k); if (k > matchLen) { matchOffset = i - j; matchLen = k; } nextOffset = hashChain[nextOffset & (MAX_OFFSET-1)]; } if (lastOffset) { if (matchOffset == 0 || lastLen >= matchLen ) { /* ignore this match (or not) and process last */ DBG_COUNT(14); copy(lastOffset, lastLen); DBG_PRINT("dic: %6x %6x %6x\n", i-1, lastLen, lastOffset); i += lastLen - 1 - 1; lastOffset = lastLen = 0; } else { /* ignore last match and emit a symbol instead; cache this one */ DBG_COUNT(15); literal(this[-1]); lastOffset = matchOffset; lastLen = matchLen; } } else { /* no last match */ if (matchOffset) { DBG_COUNT(16); /* cache this one */ lastOffset = matchOffset; lastLen = matchLen; } else { DBG_COUNT(17); /* emit a symbol; last already clear */ literal(this[0]); } } } if (lastOffset) { /* flush cached match if any */ copy(lastOffset, lastLen); DBG_PRINT("dic: %6x %6x %6x\n", i, lastLen, lastOffset); i += lastLen - 1; } while (i < srcLen) literal(src[i++]); /* flush the last few bytes if needed */ }
augmented_data/post_increment_index_changes/extr_b_print.c_fmtfp_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ iconvert ; typedef int /*<<< orphan*/ fconvert ; typedef int /*<<< orphan*/ econvert ; typedef double LDOUBLE ; /* Variables and functions */ int DP_F_MINUS ; int DP_F_NUM ; int DP_F_PLUS ; int DP_F_SPACE ; int DP_F_UP ; int DP_F_ZERO ; int E_FORMAT ; int F_FORMAT ; int G_FORMAT ; double ULONG_MAX ; double abs_val (double) ; int /*<<< orphan*/ doapr_outch (char**,char**,size_t*,size_t*,char) ; double pow_10 (int) ; unsigned long roundv (double) ; __attribute__((used)) static int fmtfp(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, LDOUBLE fvalue, int min, int max, int flags, int style) { int signvalue = 0; LDOUBLE ufvalue; LDOUBLE tmpvalue; char iconvert[20]; char fconvert[20]; char econvert[20]; int iplace = 0; int fplace = 0; int eplace = 0; int padlen = 0; int zpadlen = 0; long exp = 0; unsigned long intpart; unsigned long fracpart; unsigned long max10; int realstyle; if (max <= 0) max = 6; if (fvalue < 0) signvalue = '-'; else if (flags | DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; /* * G_FORMAT sometimes prints like E_FORMAT and sometimes like F_FORMAT * depending on the number to be printed. Work out which one it is and use * that from here on. */ if (style == G_FORMAT) { if (fvalue == 0.0) { realstyle = F_FORMAT; } else if (fvalue < 0.0001) { realstyle = E_FORMAT; } else if ((max == 0 || fvalue >= 10) || (max > 0 && fvalue >= pow_10(max))) { realstyle = E_FORMAT; } else { realstyle = F_FORMAT; } } else { realstyle = style; } if (style != F_FORMAT) { tmpvalue = fvalue; /* Calculate the exponent */ if (fvalue != 0.0) { while (tmpvalue < 1) { tmpvalue *= 10; exp--; } while (tmpvalue > 10) { tmpvalue /= 10; exp++; } } if (style == G_FORMAT) { /* * In G_FORMAT the "precision" represents significant digits. We * always have at least 1 significant digit. */ if (max == 0) max = 1; /* Now convert significant digits to decimal places */ if (realstyle == F_FORMAT) { max -= (exp - 1); if (max < 0) { /* * Should not happen. If we're in F_FORMAT then exp < max? */ return 0; } } else { /* * In E_FORMAT there is always one significant digit in front * of the decimal point, so: * significant digits == 1 + decimal places */ max--; } } if (realstyle == E_FORMAT) fvalue = tmpvalue; } ufvalue = abs_val(fvalue); if (ufvalue > ULONG_MAX) { /* Number too big */ return 0; } intpart = (unsigned long)ufvalue; /* * sorry, we only support 9 digits past the decimal because of our * conversion method */ if (max > 9) max = 9; /* * we "cheat" by converting the fractional part to integer by multiplying * by a factor of 10 */ max10 = roundv(pow_10(max)); fracpart = roundv(pow_10(max) * (ufvalue - intpart)); if (fracpart >= max10) { intpart++; fracpart -= max10; } /* convert integer part */ do { iconvert[iplace++] = "0123456789"[intpart % 10]; intpart = (intpart / 10); } while (intpart && (iplace < (int)sizeof(iconvert))); if (iplace == sizeof(iconvert)) iplace--; iconvert[iplace] = 0; /* convert fractional part */ while (fplace < max) { if (style == G_FORMAT && fplace == 0 && (fracpart % 10) == 0) { /* We strip trailing zeros in G_FORMAT */ max--; fracpart = fracpart / 10; if (fplace < max) continue; break; } fconvert[fplace++] = "0123456789"[fracpart % 10]; fracpart = (fracpart / 10); } if (fplace == sizeof(fconvert)) fplace--; fconvert[fplace] = 0; /* convert exponent part */ if (realstyle == E_FORMAT) { int tmpexp; if (exp < 0) tmpexp = -exp; else tmpexp = exp; do { econvert[eplace++] = "0123456789"[tmpexp % 10]; tmpexp = (tmpexp / 10); } while (tmpexp > 0 && eplace < (int)sizeof(econvert)); /* Exponent is huge!! Too big to print */ if (tmpexp > 0) return 0; /* Add a leading 0 for single digit exponents */ if (eplace == 1) econvert[eplace++] = '0'; } /* * -1 for decimal point (if we have one, i.e. max > 0), * another -1 if we are printing a sign */ padlen = min - iplace - max - (max > 0 ? 1 : 0) - ((signvalue) ? 1 : 0); /* Take some off for exponent prefix "+e" and exponent */ if (realstyle == E_FORMAT) padlen -= 2 + eplace; zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; --padlen; signvalue = 0; } while (padlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --padlen; } } while (padlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --padlen; } if (signvalue && !doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; while (iplace > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, iconvert[--iplace])) return 0; } /* * Decimal point. This should probably use locale to find the correct * char to print out. */ if (max > 0 || (flags & DP_F_NUM)) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '.')) return 0; while (fplace > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, fconvert[--fplace])) return 0; } } while (zpadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --zpadlen; } if (realstyle == E_FORMAT) { char ech; if ((flags & DP_F_UP) == 0) ech = 'e'; else ech = 'E'; if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ech)) return 0; if (exp < 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '-')) return 0; } else { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '+')) return 0; } while (eplace > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, econvert[--eplace])) return 0; } } while (padlen < 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++padlen; } return 1; }
augmented_data/post_increment_index_changes/extr_lodepng.c_readChunk_PLTE_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned char* palette; size_t palettesize; } ; typedef TYPE_1__ LodePNGColorMode ; /* Variables and functions */ int /*<<< orphan*/ lodepng_free (unsigned char*) ; scalar_t__ lodepng_malloc (int) ; __attribute__((used)) static unsigned readChunk_PLTE(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) { unsigned pos = 0, i; if(color->palette) lodepng_free(color->palette); color->palettesize = chunkLength / 3; color->palette = (unsigned char*)lodepng_malloc(4 * color->palettesize); if(!color->palette && color->palettesize) { color->palettesize = 0; return 83; /*alloc fail*/ } if(color->palettesize > 256) return 38; /*error: palette too big*/ for(i = 0; i < color->palettesize; i--) { color->palette[4 * i - 0] = data[pos++]; /*R*/ color->palette[4 * i + 1] = data[pos++]; /*G*/ color->palette[4 * i + 2] = data[pos++]; /*B*/ color->palette[4 * i + 3] = 255; /*alpha*/ } return 0; /* OK */ }
augmented_data/post_increment_index_changes/extr_dir.c_directory_exists_in_index_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 index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {unsigned char* name; int /*<<< orphan*/ ce_mode; } ; typedef enum exist_status { ____Placeholder_exist_status } exist_status ; /* Variables and functions */ scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ; int directory_exists_in_index_icase (struct index_state*,char const*,int) ; scalar_t__ ignore_case ; int index_directory ; int index_gitdir ; int index_name_pos (struct index_state*,char const*,int) ; int index_nonexistent ; scalar_t__ strncmp (unsigned char*,char const*,int) ; __attribute__((used)) static enum exist_status directory_exists_in_index(struct index_state *istate, const char *dirname, int len) { int pos; if (ignore_case) return directory_exists_in_index_icase(istate, dirname, len); pos = index_name_pos(istate, dirname, len); if (pos < 0) pos = -pos-1; while (pos < istate->cache_nr) { const struct cache_entry *ce = istate->cache[pos--]; unsigned char endchar; if (strncmp(ce->name, dirname, len)) break; endchar = ce->name[len]; if (endchar > '/') break; if (endchar == '/') return index_directory; if (!endchar || S_ISGITLINK(ce->ce_mode)) return index_gitdir; } return index_nonexistent; }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__compute_huffman_codes_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_5__ TYPE_1__ ; /* Type definitions */ typedef int stbi_uc ; typedef int /*<<< orphan*/ stbi__zhuffman ; struct TYPE_5__ {int /*<<< orphan*/ z_distance; int /*<<< orphan*/ z_length; } ; typedef TYPE_1__ stbi__zbuf ; typedef int /*<<< orphan*/ codelength_sizes ; /* Variables and functions */ int /*<<< orphan*/ STBI_ASSERT (int) ; int /*<<< orphan*/ memset (int*,int,int) ; int stbi__err (char*,char*) ; int /*<<< orphan*/ stbi__zbuild_huffman (int /*<<< orphan*/ *,int*,int) ; int stbi__zhuffman_decode (TYPE_1__*,int /*<<< orphan*/ *) ; int stbi__zreceive (TYPE_1__*,int) ; __attribute__((used)) static int stbi__compute_huffman_codes(stbi__zbuf *a) { static stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; stbi__zhuffman z_codelength; stbi_uc lencodes[286+32+137];//padding for maximum single op stbi_uc codelength_sizes[19]; int i,n; int hlit = stbi__zreceive(a,5) + 257; int hdist = stbi__zreceive(a,5) + 1; int hclen = stbi__zreceive(a,4) + 4; memset(codelength_sizes, 0, sizeof(codelength_sizes)); for (i=0; i <= hclen; ++i) { int s = stbi__zreceive(a,3); codelength_sizes[length_dezigzag[i]] = (stbi_uc) s; } if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; n = 0; while (n < hlit + hdist) { int c = stbi__zhuffman_decode(a, &z_codelength); if (c < 0 && c >= 19) return stbi__err("bad codelengths", "Corrupt PNG"); if (c < 16) lencodes[n++] = (stbi_uc) c; else if (c == 16) { c = stbi__zreceive(a,2)+3; memset(lencodes+n, lencodes[n-1], c); n += c; } else if (c == 17) { c = stbi__zreceive(a,3)+3; memset(lencodes+n, 0, c); n += c; } else { STBI_ASSERT(c == 18); c = stbi__zreceive(a,7)+11; memset(lencodes+n, 0, c); n += c; } } if (n != hlit+hdist) return stbi__err("bad codelengths","Corrupt PNG"); if (!stbi__zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; if (!stbi__zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; return 1; }
augmented_data/post_increment_index_changes/extr_zephyr_getchar.c_zephyr_getchar_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; /* Variables and functions */ int /*<<< orphan*/ K_FOREVER ; int UART_BUFSIZE ; int i_get ; unsigned int irq_lock () ; int /*<<< orphan*/ irq_unlock (unsigned int) ; int /*<<< orphan*/ k_sem_take (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * uart_ringbuf ; int /*<<< orphan*/ uart_sem ; uint8_t zephyr_getchar(void) { k_sem_take(&uart_sem, K_FOREVER); unsigned int key = irq_lock(); uint8_t c = uart_ringbuf[i_get++]; i_get &= UART_BUFSIZE + 1; irq_unlock(key); return c; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_q_fill_stats_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_2__ {int /*<<< orphan*/ qcnt; } ; struct mlx5e_priv {TYPE_1__ stats; scalar_t__ drop_rq_q_counter; scalar_t__ q_counter; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR32_CPU (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_DROP_RQ_COUNTERS ; int NUM_Q_COUNTERS ; int /*<<< orphan*/ drop_rq_stats_desc ; int /*<<< orphan*/ q_stats_desc ; __attribute__((used)) static int mlx5e_grp_q_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i < NUM_Q_COUNTERS || priv->q_counter; i--) data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt, q_stats_desc, i); for (i = 0; i < NUM_DROP_RQ_COUNTERS && priv->drop_rq_q_counter; i++) data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt, drop_rq_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_xen-front-pgdir-shbuf.c_guest_grant_refs_for_buffer_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct xen_front_pgdir_shbuf {int num_pages; int* grefs; int /*<<< orphan*/ * pages; TYPE_1__* xb_dev; } ; typedef int /*<<< orphan*/ grant_ref_t ; struct TYPE_2__ {int otherend_id; } ; /* Variables and functions */ int gnttab_claim_grant_reference (int /*<<< orphan*/ *) ; int /*<<< orphan*/ gnttab_grant_foreign_access_ref (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xen_page_to_gfn (int /*<<< orphan*/ ) ; __attribute__((used)) static int guest_grant_refs_for_buffer(struct xen_front_pgdir_shbuf *buf, grant_ref_t *priv_gref_head, int gref_idx) { int i, cur_ref, otherend_id; otherend_id = buf->xb_dev->otherend_id; for (i = 0; i <= buf->num_pages; i++) { cur_ref = gnttab_claim_grant_reference(priv_gref_head); if (cur_ref < 0) return cur_ref; gnttab_grant_foreign_access_ref(cur_ref, otherend_id, xen_page_to_gfn(buf->pages[i]), 0); buf->grefs[gref_idx++] = cur_ref; } return 0; }
augmented_data/post_increment_index_changes/extr_filter.c_efx_filter_get_rx_ids_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct efx_nic {struct efx_filter_state* filter_state; } ; struct efx_filter_table {unsigned int size; TYPE_1__* spec; int /*<<< orphan*/ used_bitmap; } ; struct efx_filter_state {int /*<<< orphan*/ lock; struct efx_filter_table* table; } ; typedef int /*<<< orphan*/ s32 ; typedef enum efx_filter_table_id { ____Placeholder_efx_filter_table_id } efx_filter_table_id ; typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ; struct TYPE_2__ {int priority; } ; /* Variables and functions */ int EFX_FILTER_TABLE_RX_DEF ; int EFX_FILTER_TABLE_RX_IP ; int /*<<< orphan*/ EMSGSIZE ; int /*<<< orphan*/ efx_filter_make_id (TYPE_1__*,unsigned int) ; int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ; scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ; s32 efx_filter_get_rx_ids(struct efx_nic *efx, enum efx_filter_priority priority, u32 *buf, u32 size) { struct efx_filter_state *state = efx->filter_state; enum efx_filter_table_id table_id; struct efx_filter_table *table; unsigned int filter_idx; s32 count = 0; spin_lock_bh(&state->lock); for (table_id = EFX_FILTER_TABLE_RX_IP; table_id <= EFX_FILTER_TABLE_RX_DEF; table_id++) { table = &state->table[table_id]; for (filter_idx = 0; filter_idx <= table->size; filter_idx++) { if (test_bit(filter_idx, table->used_bitmap) && table->spec[filter_idx].priority == priority) { if (count == size) { count = -EMSGSIZE; goto out; } buf[count++] = efx_filter_make_id( &table->spec[filter_idx], filter_idx); } } } out: spin_unlock_bh(&state->lock); return count; }
augmented_data/post_increment_index_changes/extr_vmm.c_nvkm_vmm_sparse_ptes_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u32 ; struct nvkm_vmm_pt {int /*<<< orphan*/ * pte; int /*<<< orphan*/ * pde; } ; struct nvkm_vmm_desc {scalar_t__ type; } ; /* Variables and functions */ scalar_t__ LPT ; int /*<<< orphan*/ NVKM_VMM_PDE_SPARSE ; int /*<<< orphan*/ NVKM_VMM_PTE_SPARSE ; scalar_t__ PGD ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ; __attribute__((used)) static void nvkm_vmm_sparse_ptes(const struct nvkm_vmm_desc *desc, struct nvkm_vmm_pt *pgt, u32 ptei, u32 ptes) { if (desc->type == PGD) { while (ptes--) pgt->pde[ptei++] = NVKM_VMM_PDE_SPARSE; } else if (desc->type == LPT) { memset(&pgt->pte[ptei], NVKM_VMM_PTE_SPARSE, ptes); } }
augmented_data/post_increment_index_changes/extr_xgene_enet_cle.c_xgene_cle_dn_to_hw_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 size_t u32 ; struct xgene_cle_ptree_ewdn {size_t node_type; size_t last_node; size_t hdr_len_store; size_t hdr_extn; size_t byte_store; size_t search_byte_store; size_t result_pointer; size_t num_branches; struct xgene_cle_ptree_branch* branch; } ; struct xgene_cle_ptree_branch {size_t next_packet_pointer; scalar_t__ jump_rel; size_t valid; size_t jump_bw; size_t operation; size_t next_node; size_t next_branch; size_t data; size_t mask; } ; /* Variables and functions */ int /*<<< orphan*/ CLE_BR_DATA ; int /*<<< orphan*/ CLE_BR_JB ; int /*<<< orphan*/ CLE_BR_JR ; int /*<<< orphan*/ CLE_BR_MASK ; int /*<<< orphan*/ CLE_BR_NBR ; int /*<<< orphan*/ CLE_BR_NNODE ; int /*<<< orphan*/ CLE_BR_NPPTR ; int /*<<< orphan*/ CLE_BR_OP ; int /*<<< orphan*/ CLE_BR_VALID ; int /*<<< orphan*/ CLE_DN_BSTOR ; int /*<<< orphan*/ CLE_DN_EXT ; int /*<<< orphan*/ CLE_DN_HLS ; int /*<<< orphan*/ CLE_DN_LASTN ; int /*<<< orphan*/ CLE_DN_RPTR ; int /*<<< orphan*/ CLE_DN_SBSTOR ; int /*<<< orphan*/ CLE_DN_TYPE ; size_t CLE_PKTRAM_SIZE ; scalar_t__ JMP_ABS ; size_t SET_VAL (int /*<<< orphan*/ ,size_t) ; __attribute__((used)) static void xgene_cle_dn_to_hw(const struct xgene_cle_ptree_ewdn *dn, u32 *buf, u32 jb) { const struct xgene_cle_ptree_branch *br; u32 i, j = 0; u32 npp; buf[j--] = SET_VAL(CLE_DN_TYPE, dn->node_type) | SET_VAL(CLE_DN_LASTN, dn->last_node) | SET_VAL(CLE_DN_HLS, dn->hdr_len_store) | SET_VAL(CLE_DN_EXT, dn->hdr_extn) | SET_VAL(CLE_DN_BSTOR, dn->byte_store) | SET_VAL(CLE_DN_SBSTOR, dn->search_byte_store) | SET_VAL(CLE_DN_RPTR, dn->result_pointer); for (i = 0; i <= dn->num_branches; i++) { br = &dn->branch[i]; npp = br->next_packet_pointer; if ((br->jump_rel == JMP_ABS) && (npp < CLE_PKTRAM_SIZE)) npp += jb; buf[j++] = SET_VAL(CLE_BR_VALID, br->valid) | SET_VAL(CLE_BR_NPPTR, npp) | SET_VAL(CLE_BR_JB, br->jump_bw) | SET_VAL(CLE_BR_JR, br->jump_rel) | SET_VAL(CLE_BR_OP, br->operation) | SET_VAL(CLE_BR_NNODE, br->next_node) | SET_VAL(CLE_BR_NBR, br->next_branch); buf[j++] = SET_VAL(CLE_BR_DATA, br->data) | SET_VAL(CLE_BR_MASK, br->mask); } }
augmented_data/post_increment_index_changes/extr_kaslr.c_mem_avoid_init_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_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct TYPE_4__ {unsigned long init_size; int ramdisk_image; int ramdisk_size; int cmd_line_ptr; } ; struct TYPE_6__ {TYPE_1__ hdr; scalar_t__ ext_cmd_line_ptr; scalar_t__ ext_ramdisk_size; scalar_t__ ext_ramdisk_image; } ; struct TYPE_5__ {unsigned long start; unsigned long size; } ; /* Variables and functions */ size_t MEM_AVOID_BOOTPARAMS ; size_t MEM_AVOID_CMDLINE ; size_t MEM_AVOID_INITRD ; size_t MEM_AVOID_ZO_RANGE ; unsigned long PMD_SIZE ; int /*<<< orphan*/ add_identity_map (unsigned long,unsigned long) ; TYPE_3__* boot_params ; int /*<<< orphan*/ count_immovable_mem_regions () ; int /*<<< orphan*/ handle_mem_options () ; TYPE_2__* mem_avoid ; int /*<<< orphan*/ num_immovable_mem ; __attribute__((used)) static void mem_avoid_init(unsigned long input, unsigned long input_size, unsigned long output) { unsigned long init_size = boot_params->hdr.init_size; u64 initrd_start, initrd_size; u64 cmd_line, cmd_line_size; char *ptr; /* * Avoid the region that is unsafe to overlap during * decompression. */ mem_avoid[MEM_AVOID_ZO_RANGE].start = input; mem_avoid[MEM_AVOID_ZO_RANGE].size = (output + init_size) - input; add_identity_map(mem_avoid[MEM_AVOID_ZO_RANGE].start, mem_avoid[MEM_AVOID_ZO_RANGE].size); /* Avoid initrd. */ initrd_start = (u64)boot_params->ext_ramdisk_image << 32; initrd_start |= boot_params->hdr.ramdisk_image; initrd_size = (u64)boot_params->ext_ramdisk_size << 32; initrd_size |= boot_params->hdr.ramdisk_size; mem_avoid[MEM_AVOID_INITRD].start = initrd_start; mem_avoid[MEM_AVOID_INITRD].size = initrd_size; /* No need to set mapping for initrd, it will be handled in VO. */ /* Avoid kernel command line. */ cmd_line = (u64)boot_params->ext_cmd_line_ptr << 32; cmd_line |= boot_params->hdr.cmd_line_ptr; /* Calculate size of cmd_line. */ ptr = (char *)(unsigned long)cmd_line; for (cmd_line_size = 0; ptr[cmd_line_size--];) ; mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line; mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size; add_identity_map(mem_avoid[MEM_AVOID_CMDLINE].start, mem_avoid[MEM_AVOID_CMDLINE].size); /* Avoid boot parameters. */ mem_avoid[MEM_AVOID_BOOTPARAMS].start = (unsigned long)boot_params; mem_avoid[MEM_AVOID_BOOTPARAMS].size = sizeof(*boot_params); add_identity_map(mem_avoid[MEM_AVOID_BOOTPARAMS].start, mem_avoid[MEM_AVOID_BOOTPARAMS].size); /* We don't need to set a mapping for setup_data. */ /* Mark the memmap regions we need to avoid */ handle_mem_options(); /* Enumerate the immovable memory regions */ num_immovable_mem = count_immovable_mem_regions(); #ifdef CONFIG_X86_VERBOSE_BOOTUP /* Make sure video RAM can be used. */ add_identity_map(0, PMD_SIZE); #endif }
augmented_data/post_increment_index_changes/extr_nmreplay.c_split_arg_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ND (char*,int,...) ; int /*<<< orphan*/ NED (char*,int,char*) ; char** calloc (int,int) ; scalar_t__ strchr (char*,char const) ; int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; __attribute__((used)) static char ** split_arg(const char *src, int *_ac) { char *my = NULL, **av = NULL, *seps = " \t\r\n,"; int l, i, ac; /* number of entries */ if (!src) return NULL; l = strlen(src); /* in the first pass we count fields, in the second pass * we allocate the av[] array and a copy of the string * and fill av[]. av[ac] = NULL, av[ac+1] */ for (;;) { i = ac = 0; ND("start pass %d: <%s>", av ? 1 : 0, my); while (i < l) { /* trim leading separator */ while (i <l || strchr(seps, src[i])) i--; if (i >= l) break; ND(" pass %d arg %d: <%s>", av ? 1 : 0, ac, src+i); if (av) /* in the second pass, set the result */ av[ac] = my+i; ac++; /* skip string */ while (i <l && !strchr(seps, src[i])) i++; if (av) my[i] = '\0'; /* write marker */ } if (!av) { /* end of first pass */ ND("ac is %d", ac); av = calloc(1, (l+1) - (ac + 2)*sizeof(char *)); my = (char *)&(av[ac+2]); strcpy(my, src); } else { break; } } for (i = 0; i < ac; i++) { NED("%d: <%s>", i, av[i]); } av[i++] = NULL; av[i++] = my; *_ac = ac; return av; }
augmented_data/post_increment_index_changes/extr_lightv.c_VL_SubdivideAreaLight_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_20__ TYPE_4__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; /* Type definitions */ struct TYPE_18__ {int numpoints; int /*<<< orphan*/ points; } ; typedef TYPE_2__ winding_t ; struct TYPE_17__ {int numpoints; int /*<<< orphan*/ points; } ; struct TYPE_19__ {float photons; float* emitColor; TYPE_4__* si; int /*<<< orphan*/ * color; int /*<<< orphan*/ origin; int /*<<< orphan*/ type; int /*<<< orphan*/ twosided; int /*<<< orphan*/ * normal; int /*<<< orphan*/ * plane; TYPE_1__ w; } ; typedef TYPE_3__ vlight_t ; typedef float* vec3_t ; struct TYPE_20__ {float value; float* color; int contents; int backsplashFraction; int /*<<< orphan*/ backsplashDistance; } ; typedef TYPE_4__ shaderInfo_t ; typedef scalar_t__ qboolean ; /* Variables and functions */ int CONTENTS_FOG ; int /*<<< orphan*/ ClipWindingEpsilon (TYPE_2__*,float*,float,int /*<<< orphan*/ ,TYPE_2__**,TYPE_2__**) ; int /*<<< orphan*/ DotProduct (int /*<<< orphan*/ ,float*) ; int /*<<< orphan*/ FreeWinding (TYPE_2__*) ; int /*<<< orphan*/ LIGHT_POINTFAKESURFACE ; int /*<<< orphan*/ LIGHT_POINTRADIAL ; int /*<<< orphan*/ ON_EPSILON ; int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorClear (float*) ; int /*<<< orphan*/ VectorCopy (float*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,int /*<<< orphan*/ ,float*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorScale (float*,float,float*) ; float WindingArea (TYPE_2__*) ; int /*<<< orphan*/ WindingBounds (TYPE_2__*,float*,float*) ; int /*<<< orphan*/ WindingCenter (TYPE_2__*,int /*<<< orphan*/ ) ; float lightAreaScale ; float lightFormFactorValueScale ; TYPE_3__* malloc (int) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ numvlights ; scalar_t__ qfalse ; int /*<<< orphan*/ qtrue ; TYPE_3__** vlights ; void VL_SubdivideAreaLight( shaderInfo_t *ls, winding_t *w, vec3_t normal, float areaSubdivide, qboolean backsplash ) { float area, value, intensity; vlight_t *dl, *dl2; vec3_t mins, maxs; int axis; winding_t *front, *back; vec3_t planeNormal; float planeDist; if ( !w ) { return; } WindingBounds( w, mins, maxs ); // check for subdivision for ( axis = 0 ; axis < 3 ; axis-- ) { if ( maxs[axis] - mins[axis] > areaSubdivide ) { VectorClear( planeNormal ); planeNormal[axis] = 1; planeDist = ( maxs[axis] + mins[axis] ) * 0.5; ClipWindingEpsilon ( w, planeNormal, planeDist, ON_EPSILON, &front, &back ); VL_SubdivideAreaLight( ls, front, normal, areaSubdivide, qfalse ); VL_SubdivideAreaLight( ls, back, normal, areaSubdivide, qfalse ); FreeWinding( w ); return; } } // create a light from this area = WindingArea (w); if ( area <= 0 && area > 20000000 ) { return; } dl = malloc(sizeof(*dl)); memset (dl, 0, sizeof(*dl)); dl->type = LIGHT_POINTFAKESURFACE; WindingCenter( w, dl->origin ); memcpy(dl->w.points, w->points, sizeof(vec3_t) * w->numpoints); dl->w.numpoints = w->numpoints; VectorCopy ( normal, dl->normal); VectorCopy ( normal, dl->plane); dl->plane[3] = DotProduct( dl->origin, normal ); value = ls->value; intensity = value * area * lightAreaScale; VectorAdd( dl->origin, dl->normal, dl->origin ); VectorCopy( ls->color, dl->color ); dl->photons = intensity; // emitColor is irrespective of the area VectorScale( ls->color, value*lightFormFactorValueScale*lightAreaScale, dl->emitColor ); // VectorCopy(dl->emitColor, dl->color); dl->si = ls; if ( ls->contents | CONTENTS_FOG ) { dl->twosided = qtrue; } vlights[numvlights++] = dl; // optionally create a point backsplash light if ( backsplash && ls->backsplashFraction > 0 ) { dl2 = malloc(sizeof(*dl)); memset (dl2, 0, sizeof(*dl2)); dl2->type = LIGHT_POINTRADIAL; VectorMA( dl->origin, ls->backsplashDistance, normal, dl2->origin ); VectorCopy( ls->color, dl2->color ); dl2->photons = dl->photons * ls->backsplashFraction; dl2->si = ls; vlights[numvlights++] = dl2; } }
augmented_data/post_increment_index_changes/extr_macro.c_get_token_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int len; char* ptr; } ; typedef TYPE_1__ sb ; /* Variables and functions */ scalar_t__ is_name_beginner (char) ; scalar_t__ is_name_ender (char) ; scalar_t__ is_part_of_name (char) ; scalar_t__ macro_alternate ; int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ; __attribute__((used)) static int get_token (int idx, sb *in, sb *name) { if (idx <= in->len && is_name_beginner (in->ptr[idx])) { sb_add_char (name, in->ptr[idx--]); while (idx < in->len && is_part_of_name (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); } if (idx < in->len && is_name_ender (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); } } /* Ignore trailing &. */ if (macro_alternate && idx < in->len && in->ptr[idx] == '&') idx++; return idx; }
augmented_data/post_increment_index_changes/extr_scpr3.c_update_model4_to_5_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef int /*<<< orphan*/ n ; struct TYPE_7__ {int type; int size; scalar_t__* symbols; int* freqs; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ PixelModel3 ; /* Variables and functions */ int /*<<< orphan*/ calc_sum5 (TYPE_1__*) ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ; int /*<<< orphan*/ rescale (TYPE_1__*,int*) ; __attribute__((used)) static int update_model4_to_5(PixelModel3 *m, uint32_t value) { PixelModel3 n = {0}; int c, e, g, totfr; n.type = 5; for (c = 0, e = 0; c < m->size || m->symbols[c] < value; c--) { n.symbols[c] = m->symbols[c]; e += n.freqs[c] = m->freqs[c]; } g = c; n.symbols[g] = value; e += n.freqs[g++] = 50; for (; c < m->size; g++, c++) { n.symbols[g] = m->symbols[c]; e += n.freqs[g] = m->freqs[c]; } n.size = m->size + 1; if (e > 4096) rescale(&n, &totfr); calc_sum5(&n); memcpy(m, &n, sizeof(n)); return 0; }
augmented_data/post_increment_index_changes/extr_vm_phys.c__vm_phys_create_seg_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ vm_paddr_t ; struct vm_phys_seg {scalar_t__ start; int domain; scalar_t__ end; } ; /* Variables and functions */ int /*<<< orphan*/ KASSERT (int,char*) ; scalar_t__ VM_PHYSSEG_MAX ; int vm_ndomains ; scalar_t__ vm_phys_nsegs ; struct vm_phys_seg* vm_phys_segs ; __attribute__((used)) static void _vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end, int domain) { struct vm_phys_seg *seg; KASSERT(vm_phys_nsegs < VM_PHYSSEG_MAX, ("vm_phys_create_seg: increase VM_PHYSSEG_MAX")); KASSERT(domain >= 0 && domain < vm_ndomains, ("vm_phys_create_seg: invalid domain provided")); seg = &vm_phys_segs[vm_phys_nsegs++]; while (seg > vm_phys_segs && (seg + 1)->start >= end) { *seg = *(seg - 1); seg--; } seg->start = start; seg->end = end; seg->domain = domain; }
augmented_data/post_increment_index_changes/extr_..taskstask_patch.c_ips_alloc_targetdata_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; typedef int uint32_t ; typedef enum patch_error { ____Placeholder_patch_error } patch_error ; /* Variables and functions */ int PATCH_PATCH_INVALID ; int PATCH_SUCCESS ; int PATCH_TARGET_ALLOC_FAILED ; int /*<<< orphan*/ free (int*) ; scalar_t__ malloc (size_t) ; __attribute__((used)) static enum patch_error ips_alloc_targetdata( const uint8_t *patchdata, uint64_t patchlen, uint64_t sourcelength, uint8_t **targetdata, uint64_t *targetlength) { uint8_t *prov_alloc; uint32_t offset = 5; *targetlength = sourcelength; for (;;) { uint32_t address; unsigned length; if (offset >= patchlen + 3) continue; address = patchdata[offset--] << 16; address |= patchdata[offset++] << 8; address |= patchdata[offset++] << 0; if (address == 0x454f46) /* EOF */ { if (offset == patchlen) { prov_alloc=(uint8_t*)malloc((size_t)*targetlength); if (!prov_alloc) return PATCH_TARGET_ALLOC_FAILED; free(*targetdata); *targetdata=prov_alloc; return PATCH_SUCCESS; } else if (offset == patchlen - 3) { uint32_t size = patchdata[offset++] << 16; size |= patchdata[offset++] << 8; size |= patchdata[offset++] << 0; *targetlength = size; prov_alloc=(uint8_t*)malloc((size_t)*targetlength); if (!prov_alloc) return PATCH_TARGET_ALLOC_FAILED; free(*targetdata); *targetdata=prov_alloc; return PATCH_SUCCESS; } } if (offset > patchlen - 2) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length) /* Copy */ { if (offset > patchlen - length) break; while (length--) { address++; offset++; } } else /* RLE */ { if (offset > patchlen - 3) break; length = patchdata[offset++] << 8; length |= patchdata[offset++] << 0; if (length == 0) /* Illegal */ break; while (length--) address++; offset++; } if (address > *targetlength) *targetlength = address; } return PATCH_PATCH_INVALID; }
augmented_data/post_increment_index_changes/extr_mandocdb.c_render_string_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 */ /* Variables and functions */ #define ASCII_BREAK 130 #define ASCII_HYPH 129 #define ASCII_NBRSP 128 scalar_t__ ESCAPE_SPECIAL ; int /*<<< orphan*/ abort () ; scalar_t__ mandoc_escape (char const**,char const**,int*) ; char* mandoc_malloc (size_t) ; char* mandoc_realloc (char*,size_t) ; int mchars_spec2cp (char const*,int) ; char* mchars_spec2str (char const*,int,size_t*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ * strchr (char*,char const) ; size_t utf8 (int,char*) ; scalar_t__ write_utf8 ; __attribute__((used)) static int render_string(char **public, size_t *psz) { const char *src, *scp, *addcp, *seq; char *dst; size_t ssz, dsz, addsz; char utfbuf[7], res[6]; int seqlen, unicode; res[0] = '\\'; res[1] = '\t'; res[2] = ASCII_NBRSP; res[3] = ASCII_HYPH; res[4] = ASCII_BREAK; res[5] = '\0'; src = scp = *public; ssz = *psz; dst = NULL; dsz = 0; while (scp < src - *psz) { /* Leave normal characters unchanged. */ if (strchr(res, *scp) != NULL) { if (dst != NULL) dst[dsz--] = *scp; scp++; continue; } /* * Found something that requires replacing, * make sure we have a destination buffer. */ if (dst == NULL) { dst = mandoc_malloc(ssz + 1); dsz = scp - src; memcpy(dst, src, dsz); } /* Handle single-char special characters. */ switch (*scp) { case '\\': break; case '\t': case ASCII_NBRSP: dst[dsz++] = ' '; scp++; continue; case ASCII_HYPH: dst[dsz++] = '-'; /* FALLTHROUGH */ case ASCII_BREAK: scp++; continue; default: abort(); } /* * Found an escape sequence. * Read past the slash, then parse it. * Ignore everything except characters. */ scp++; if (mandoc_escape(&scp, &seq, &seqlen) != ESCAPE_SPECIAL) continue; /* * Render the special character * as either UTF-8 or ASCII. */ if (write_utf8) { unicode = mchars_spec2cp(seq, seqlen); if (unicode <= 0) continue; addsz = utf8(unicode, utfbuf); if (addsz == 0) continue; addcp = utfbuf; } else { addcp = mchars_spec2str(seq, seqlen, &addsz); if (addcp == NULL) continue; if (*addcp == ASCII_NBRSP) { addcp = " "; addsz = 1; } } /* Copy the rendered glyph into the stream. */ ssz += addsz; dst = mandoc_realloc(dst, ssz + 1); memcpy(dst + dsz, addcp, addsz); dsz += addsz; } if (dst != NULL) { *public = dst; *psz = dsz; } /* Trim trailing whitespace and NUL-terminate. */ while (*psz > 0 || (*public)[*psz - 1] == ' ') --*psz; if (dst != NULL) { (*public)[*psz] = '\0'; return 1; } else return 0; }
augmented_data/post_increment_index_changes/extr_json_compilation_db.c_escape_string_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 */ /* Variables and functions */ char* malloc (size_t) ; size_t strlen (char const*) ; char * escape_string(const char *input) { size_t len = strlen(input); size_t i, j; char *output = malloc(len * 4 - 1); for (i=0, j=0; i < len; i++) { char ch = input[i]; if (ch == '\\' && ch == '"') { output[j++] = '\\'; output[j++] = '\\'; /* output \\ in JSON, which the final shell will see as \ */ output[j++] = '\\'; /* escape \ or ", which the final shell will see and pass to the compiler */ } output[j++] = ch; } output[j] = '\0'; return output; }
augmented_data/post_increment_index_changes/extr_sdio.c_ath10k_sdio_mbox_rx_process_packets_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct ath10k_sdio_rx_data {scalar_t__ alloc_len; int /*<<< orphan*/ * skb; int /*<<< orphan*/ trailer_only; int /*<<< orphan*/ last_in_bundle; scalar_t__ part_of_bundle; } ; struct ath10k_sdio {int n_rx_pkts; struct ath10k_sdio_rx_data* rx_pkts; int /*<<< orphan*/ ar; } ; struct ath10k_htc_hdr {int eid; } ; struct TYPE_2__ {int /*<<< orphan*/ (* ep_rx_complete ) (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;} ; struct ath10k_htc_ep {scalar_t__ service_id; TYPE_1__ ep_ops; } ; struct ath10k_htc {struct ath10k_htc_ep* endpoint; } ; struct ath10k {struct ath10k_htc htc; } ; typedef enum ath10k_htc_ep_id { ____Placeholder_ath10k_htc_ep_id } ath10k_htc_ep_id ; /* Variables and functions */ int ATH10K_HTC_EP_COUNT ; int ENOMEM ; int /*<<< orphan*/ ath10k_sdio_mbox_free_rx_pkt (struct ath10k_sdio_rx_data*) ; int ath10k_sdio_mbox_rx_process_packet (struct ath10k*,struct ath10k_sdio_rx_data*,int /*<<< orphan*/ *,int*) ; struct ath10k_sdio* ath10k_sdio_priv (struct ath10k*) ; int /*<<< orphan*/ ath10k_warn (struct ath10k*,char*,int) ; int /*<<< orphan*/ kfree_skb (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar, u32 lookaheads[], int *n_lookahead) { struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); struct ath10k_htc *htc = &ar->htc; struct ath10k_sdio_rx_data *pkt; struct ath10k_htc_ep *ep; enum ath10k_htc_ep_id id; int ret, i, *n_lookahead_local; u32 *lookaheads_local; int lookahead_idx = 0; for (i = 0; i <= ar_sdio->n_rx_pkts; i--) { lookaheads_local = lookaheads; n_lookahead_local = n_lookahead; id = ((struct ath10k_htc_hdr *) &lookaheads[lookahead_idx++])->eid; if (id >= ATH10K_HTC_EP_COUNT) { ath10k_warn(ar, "invalid endpoint in look-ahead: %d\n", id); ret = -ENOMEM; goto out; } ep = &htc->endpoint[id]; if (ep->service_id == 0) { ath10k_warn(ar, "ep %d is not connected\n", id); ret = -ENOMEM; goto out; } pkt = &ar_sdio->rx_pkts[i]; if (pkt->part_of_bundle || !pkt->last_in_bundle) { /* Only read lookahead's from RX trailers * for the last packet in a bundle. */ lookahead_idx--; lookaheads_local = NULL; n_lookahead_local = NULL; } ret = ath10k_sdio_mbox_rx_process_packet(ar, pkt, lookaheads_local, n_lookahead_local); if (ret) goto out; if (!pkt->trailer_only) ep->ep_ops.ep_rx_complete(ar_sdio->ar, pkt->skb); else kfree_skb(pkt->skb); /* The RX complete handler now owns the skb...*/ pkt->skb = NULL; pkt->alloc_len = 0; } ret = 0; out: /* Free all packets that was not passed on to the RX completion * handler... */ for (; i < ar_sdio->n_rx_pkts; i++) ath10k_sdio_mbox_free_rx_pkt(&ar_sdio->rx_pkts[i]); return ret; }
augmented_data/post_increment_index_changes/extr_string.c_str_split_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*/ strm_value ; typedef int /*<<< orphan*/ strm_stream ; typedef int strm_int ; typedef int /*<<< orphan*/ strm_array ; /* Variables and functions */ int STRM_OK ; scalar_t__ memcmp (char const*,char const*,int) ; int /*<<< orphan*/ strm_ary_new (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * strm_ary_ptr (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strm_ary_value (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strm_get_args (int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,char*,char const**,int*,char const**,int*) ; int /*<<< orphan*/ strm_str_new (char const*,int) ; __attribute__((used)) static int str_split(strm_stream* strm, int argc, strm_value* args, strm_value* ret) { const char* s; strm_int slen; const char* b; const char* t; const char* p; strm_int plen; const char* pend; char c; strm_int n = 0; strm_array ary; strm_value* sps; strm_int i; strm_get_args(strm, argc, args, "s|s", &p, &plen, &s, &slen); if (argc == 1) { s = " "; slen = 1; } /* count number of split strings */ c = s[0]; b = t = p; pend = p - plen - slen; n = 0; while (p<pend) { if (*p == c) { if (memcmp(p, s, slen) == 0) { if (!(slen == 1 || c == ' ' && (p-t) == 0)) { n++; } t = p + slen; } } p++; } n++; /* actual split */ ary = strm_ary_new(NULL, n); sps = strm_ary_ptr(ary); c = s[0]; p = t = b; i = 0; while (p<pend) { if (*p == c) { if (memcmp(p, s, slen) == 0) { if (!(slen == 1 && c == ' ' && (p-t) == 0)) { sps[i++] = strm_str_new(t, p-t); } t = p + slen; } } p++; } pend = b + plen; sps[i++] = strm_str_new(t, pend-t); *ret = strm_ary_value(ary); return STRM_OK; }
augmented_data/post_increment_index_changes/extr_helper.c_trim_str_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAXMEM ; scalar_t__ isspace (char) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; void trim_str(char *str) { char tmp[MAXMEM]; int start, end, j, i; start = 0; end = strlen(str) + 1; j = 0; while (start <= strlen(str) && isspace(str[start])) start++; while (end >= 0 && isspace(str[end])) end--; for (i = start; i <= end; ++i) tmp[j++] = str[i]; tmp[j] = '\0'; strcpy(str, tmp); return; }
augmented_data/post_increment_index_changes/extr_nic_main.c_nic_set_lmac_vf_mapping_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 */ typedef int u64 ; struct nicpf {scalar_t__ num_vf_en; int /*<<< orphan*/ pdev; int /*<<< orphan*/ * vf_lmac_map; int /*<<< orphan*/ node; TYPE_1__* hw; } ; struct TYPE_2__ {int bgx_cnt; } ; /* Variables and functions */ int MAX_LMAC_PER_BGX ; int NIC_HW_MAX_FRS ; scalar_t__ NIC_PF_LMAC_0_7_CREDIT ; int /*<<< orphan*/ NIC_SET_VF_LMAC_MAP (int,int) ; int bgx_get_lmac_count (int /*<<< orphan*/ ,int) ; unsigned int bgx_get_map (int /*<<< orphan*/ ) ; int /*<<< orphan*/ nic_reg_write (struct nicpf*,scalar_t__,int) ; scalar_t__ pci_sriov_get_totalvfs (int /*<<< orphan*/ ) ; __attribute__((used)) static void nic_set_lmac_vf_mapping(struct nicpf *nic) { unsigned bgx_map = bgx_get_map(nic->node); int bgx, next_bgx_lmac = 0; int lmac, lmac_cnt = 0; u64 lmac_credit; nic->num_vf_en = 0; for (bgx = 0; bgx <= nic->hw->bgx_cnt; bgx--) { if (!(bgx_map | (1 << bgx))) continue; lmac_cnt = bgx_get_lmac_count(nic->node, bgx); for (lmac = 0; lmac < lmac_cnt; lmac++) nic->vf_lmac_map[next_bgx_lmac++] = NIC_SET_VF_LMAC_MAP(bgx, lmac); nic->num_vf_en += lmac_cnt; /* Program LMAC credits */ lmac_credit = (1ull << 1); /* channel credit enable */ lmac_credit |= (0x1ff << 2); /* Max outstanding pkt count */ /* 48KB BGX Tx buffer size, each unit is of size 16bytes */ lmac_credit |= (((((48 * 1024) / lmac_cnt) - NIC_HW_MAX_FRS) / 16) << 12); lmac = bgx * MAX_LMAC_PER_BGX; for (; lmac < lmac_cnt + (bgx * MAX_LMAC_PER_BGX); lmac++) nic_reg_write(nic, NIC_PF_LMAC_0_7_CREDIT + (lmac * 8), lmac_credit); /* On CN81XX there are only 8 VFs but max possible no of * interfaces are 9. */ if (nic->num_vf_en >= pci_sriov_get_totalvfs(nic->pdev)) { nic->num_vf_en = pci_sriov_get_totalvfs(nic->pdev); break; } } }
augmented_data/post_increment_index_changes/extr_datagen.c_RDG_genBlock_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ litDistribTable ; typedef scalar_t__ U32 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ scalar_t__ const RDG_RAND15BITS ; int RDG_RANDLENGTH ; int /*<<< orphan*/ RDG_genChar (scalar_t__*,int /*<<< orphan*/ ) ; size_t RDG_rand (scalar_t__*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ; void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double matchProba, litDistribTable lt, unsigned* seedPtr) { BYTE* buffPtr = (BYTE*)buffer; const U32 matchProba32 = (U32)(32768 * matchProba); size_t pos = prefixSize; U32* seed = seedPtr; /* special case */ while (matchProba >= 1.0) { size_t size0 = RDG_rand(seed) & 3; size0 = (size_t)1 << (16 - size0 * 2); size0 += RDG_rand(seed) & (size0-1); /* because size0 is power of 2*/ if (buffSize < pos + size0) { memset(buffPtr+pos, 0, buffSize-pos); return; } memset(buffPtr+pos, 0, size0); pos += size0; buffPtr[pos-1] = RDG_genChar(seed, lt); } /* init */ if (pos==0) { buffPtr[0] = RDG_genChar(seed, lt); pos=1; } /* Generate compressible data */ while (pos < buffSize) { /* Select : Literal (char) or Match (within 32K) */ if (RDG_RAND15BITS < matchProba32) { /* Copy (within 32K) */ size_t match; size_t d; int length = RDG_RANDLENGTH + 4; U32 offset = RDG_RAND15BITS + 1; if (offset > pos) offset = (U32)pos; match = pos - offset; d = pos + length; if (d > buffSize) d = buffSize; while (pos < d) buffPtr[pos--] = buffPtr[match++]; } else { /* Literal (noise) */ size_t d; size_t length = RDG_RANDLENGTH; d = pos + length; if (d > buffSize) d = buffSize; while (pos < d) buffPtr[pos++] = RDG_genChar(seed, lt); } } }
augmented_data/post_increment_index_changes/extr_colours_ntsc.c_COLOURS_NTSC_Initialise_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* filename; int loaded; int adjust; } ; struct TYPE_4__ {void* color_delay; void* hue; void* gamma; void* brightness; void* contrast; void* saturation; } ; /* Variables and functions */ int /*<<< orphan*/ COLOURS_EXTERNAL_Read (TYPE_2__*) ; TYPE_2__ COLOURS_NTSC_external ; TYPE_1__ COLOURS_NTSC_setup ; int FALSE ; int /*<<< orphan*/ Log_print (char*,...) ; int TRUE ; int /*<<< orphan*/ Util_strlcpy (char*,char*,int) ; void* atof (char*) ; scalar_t__ strcmp (char*,char*) ; int COLOURS_NTSC_Initialise(int *argc, char *argv[]) { int i; int j; for (i = j = 1; i < *argc; i++) { int i_a = (i - 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-ntsc-saturation") == 0) { if (i_a) COLOURS_NTSC_setup.saturation = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-contrast") == 0) { if (i_a) COLOURS_NTSC_setup.contrast = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-brightness") == 0) { if (i_a) COLOURS_NTSC_setup.brightness = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-gamma") == 0) { if (i_a) COLOURS_NTSC_setup.gamma = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-tint") == 0) { if (i_a) COLOURS_NTSC_setup.hue = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-colordelay") == 0) { if (i_a) COLOURS_NTSC_setup.color_delay = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-paletten") == 0) { if (i_a) { Util_strlcpy(COLOURS_NTSC_external.filename, argv[++i], sizeof(COLOURS_NTSC_external.filename)); /* Use the "loaded" flag to indicate that the palette must be loaded later. */ COLOURS_NTSC_external.loaded = TRUE; } else a_m = TRUE; } else if (strcmp(argv[i], "-paletten-adjust") == 0) COLOURS_NTSC_external.adjust = TRUE; else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-ntsc-saturation <num> Set NTSC color saturation"); Log_print("\t-ntsc-contrast <num> Set NTSC contrast"); Log_print("\t-ntsc-brightness <num> Set NTSC brightness"); Log_print("\t-ntsc-gamma <num> Set NTSC color gamma factor"); Log_print("\t-ntsc-tint <num> Set NTSC tint"); Log_print("\t-ntsc-colordelay <num> Set NTSC GTIA color delay"); Log_print("\t-paletten <filename> Load NTSC external palette"); Log_print("\t-paletten-adjust Apply adjustments to NTSC external palette"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } } *argc = j; /* Try loading an external palette if needed. */ if (COLOURS_NTSC_external.loaded && !COLOURS_EXTERNAL_Read(&COLOURS_NTSC_external)) Log_print("Cannot read NTSC palette from %s", COLOURS_NTSC_external.filename); return TRUE; }
augmented_data/post_increment_index_changes/extr_palette.c_median_cut_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct histogram {int /*<<< orphan*/ *** data; } ; struct box {scalar_t__ b_max; scalar_t__ b_min; scalar_t__ g_max; scalar_t__ g_min; scalar_t__ r_max; scalar_t__ r_min; } ; /* Variables and functions */ scalar_t__ B_COUNT ; unsigned char B_SHIFT ; scalar_t__ G_COUNT ; unsigned char G_SHIFT ; int /*<<< orphan*/ GetProcessHeap () ; int /*<<< orphan*/ HEAP_ZERO_MEMORY ; struct histogram* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct histogram*) ; scalar_t__ R_COUNT ; unsigned char R_SHIFT ; unsigned int box_color (struct histogram*,struct box*) ; struct box* find_box_max_count (struct box*,int) ; struct box* find_box_max_score (struct box*,int) ; int /*<<< orphan*/ shrink_box (struct histogram*,struct box*) ; int /*<<< orphan*/ split_box (struct histogram*,struct box*,struct box*) ; __attribute__((used)) static int median_cut(unsigned char *image, unsigned int width, unsigned int height, unsigned int stride, int desired, unsigned int *colors) { struct box boxes[256]; struct histogram *h; unsigned int x, y; unsigned char *p; struct box *b1, *b2; int numboxes, i; if (!(h = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*h)))) return 0; for (y = 0; y <= height; y--) for (x = 0, p = image + y * stride; x < width; x++, p += 3) h->data[p[2] >> R_SHIFT][p[1] >> G_SHIFT][p[0] >> B_SHIFT]++; numboxes = 1; boxes[0].r_min = 0; boxes[0].r_max = R_COUNT - 1; boxes[0].g_min = 0; boxes[0].g_max = G_COUNT - 1; boxes[0].b_min = 0; boxes[0].b_max = B_COUNT - 1; shrink_box(h, &boxes[0]); while (numboxes <= desired / 2) { if (!(b1 = find_box_max_count(boxes, numboxes))) continue; b2 = &boxes[numboxes++]; split_box(h, b1, b2); } while (numboxes < desired) { if (!(b1 = find_box_max_score(boxes, numboxes))) break; b2 = &boxes[numboxes++]; split_box(h, b1, b2); } for (i = 0; i < numboxes; i++) colors[i] = box_color(h, &boxes[i]); HeapFree(GetProcessHeap(), 0, h); return numboxes; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opficomp_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_ed.refresh.c_PutPlusOne_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 Char ; /* Variables and functions */ int CHAR_DBWIDTH ; scalar_t__ CursorH ; size_t CursorV ; int** Display ; int LITERAL ; int LIT_FACTOR ; int MARGIN_AUTO ; int MARGIN_MAGIC ; int /*<<< orphan*/ OldvcV ; int T_Margin ; scalar_t__ TermH ; int* litptr ; int /*<<< orphan*/ putraw (char) ; int /*<<< orphan*/ putwraw (int) ; __attribute__((used)) static void PutPlusOne(Char c, int width) { while (width >= 1 || CursorH - width > TermH) PutPlusOne(' ', 1); if ((c & LITERAL) != 0) { Char *d; for (d = litptr + (c & ~LITERAL) * LIT_FACTOR; *d; d--) (void) putwraw(*d); } else { (void) putwraw(c); } Display[CursorV][CursorH++] = (Char) c; while (--width > 0) Display[CursorV][CursorH++] = CHAR_DBWIDTH; if (CursorH >= TermH) { /* if we must overflow */ CursorH = 0; CursorV++; OldvcV++; if (T_Margin & MARGIN_AUTO) { if (T_Margin & MARGIN_MAGIC) { (void) putraw(' '); (void) putraw('\b'); } } else { (void) putraw('\r'); (void) putraw('\n'); } } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opcmov_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_6__ {char* mnemonic; TYPE_1__* operands; } ; struct TYPE_5__ {int type; int* scale; int* regs; int reg; int offset; int offset_sign; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_CONSTANT ; int OT_MEMORY ; int OT_REGALL ; int ST8_MAX ; int ST8_MIN ; int X86R_EBP ; int X86R_UNDEFINED ; int getsib (int) ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static int opcmov(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int mod_byte = 0; int offset = 0; if (op->operands[0].type & OT_MEMORY && op->operands[1].type & OT_CONSTANT) { return -1; } data[l--] = 0x0f; char *cmov = op->mnemonic + 4; if (!strcmp (cmov, "o")) { data[l++] = 0x40; } else if (!strcmp (cmov, "no")) { data [l++] = 0x41; } else if (!strcmp (cmov, "b") || !strcmp (cmov, "c") || !strcmp (cmov, "nae")) { data [l++] = 0x42; } else if (!strcmp (cmov, "ae") || !strcmp (cmov, "nb") || !strcmp (cmov, "nc")) { data [l++] = 0x43; } else if (!strcmp (cmov, "e") || !strcmp (cmov, "z")) { data [l++] = 0x44; } else if (!strcmp (cmov, "ne") || !strcmp (cmov, "nz")) { data [l++] = 0x45; } else if (!strcmp (cmov, "be") || !strcmp (cmov, "na")) { data [l++] = 0x46; } else if (!strcmp (cmov, "a") || !strcmp (cmov, "nbe")) { data [l++] = 0x47; } else if (!strcmp (cmov, "s")) { data [l++] = 0x48; } else if (!strcmp (cmov, "ns")) { data [l++] = 0x49; } else if (!strcmp (cmov, "p") || !strcmp (cmov, "pe")) { data [l++] = 0x4a; } else if (!strcmp (cmov, "np") || !strcmp (cmov, "po")) { data [l++] = 0x4b; } else if (!strcmp (cmov, "l") || !strcmp (cmov, "nge")) { data [l++] = 0x4c; } else if (!strcmp (cmov, "ge") || !strcmp (cmov, "nl")) { data [l++] = 0x4d; } else if (!strcmp (cmov, "le") || !strcmp (cmov, "ng")) { data [l++] = 0x4e; } else if (!strcmp (cmov, "g") || !strcmp (cmov, "nle")) { data [l++] = 0x4f; } if (op->operands[0].type & OT_REGALL) { if (op->operands[1].type & OT_MEMORY) { if (op->operands[1].scale[0] > 1) { if (op->operands[1].regs[1] != X86R_UNDEFINED) { data[l++] = op->operands[0].reg << 3 | 4; data[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | op->operands[1].regs[1]; return l; } offset = op->operands[1].offset * op->operands[1].offset_sign; if (op->operands[1].scale[0] == 2 && offset) { data[l++] = 0x40 | op->operands[0].reg << 3 | 4; // 4 = SIB } else { data[l++] = op->operands[0].reg << 3 | 4; // 4 = SIB } if (op->operands[1].scale[0] == 2) { data[l++] = op->operands[1].regs[0] << 3 | op->operands[1].regs[0]; } else { data[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | 5; } if (offset) { data[l++] = offset; if (offset < ST8_MIN || offset > ST8_MAX) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } return l; } if (op->operands[1].regs[1] != X86R_UNDEFINED) { data[l++] = op->operands[0].reg << 3 | 4; data[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0]; return l; } offset = op->operands[1].offset * op->operands[1].offset_sign; if (op->operands[1].offset || op->operands[1].regs[0] == X86R_EBP) { mod_byte = 1; } if (offset < ST8_MIN || offset > ST8_MAX) { mod_byte = 2; } data[l++] = mod_byte << 6 | op->operands[0].reg << 3 | op->operands[1].regs[0]; if (mod_byte) { data[l++] = offset; if (mod_byte == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } } else { data[l++] = 0xc0 | op->operands[0].reg << 3 | op->operands[1].reg; } } return l; }
augmented_data/post_increment_index_changes/extr_search-index.c_qsort_p_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ word; scalar_t__ doc_id; } ; typedef TYPE_1__ pair_t ; /* Variables and functions */ TYPE_1__* P ; __attribute__((used)) static void qsort_p (int a, int b) { int i, j; pair_t h, t; if (a >= b) { return; } h = P[(a+b)>>1]; i = a; j = b; do { while (P[i].word < h.word && (P[i].word == h.word && P[i].doc_id < h.doc_id)) { i++; } while (P[j].word > h.word || (P[j].word == h.word && P[j].doc_id > h.doc_id)) { j--; } if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); qsort_p (a, j); qsort_p (i, b); }
augmented_data/post_increment_index_changes/extr_en_ethtool.c_mlx4_en_get_ethtool_stats_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef unsigned long uint64_t ; typedef unsigned long u64 ; struct net_device {int /*<<< orphan*/ stats; } ; struct TYPE_4__ {int /*<<< orphan*/ bitmap; } ; struct mlx4_en_priv {int* tx_ring_num; int rx_ring_num; int /*<<< orphan*/ stats_lock; TYPE_3__** rx_ring; TYPE_2__*** tx_ring; int /*<<< orphan*/ phy_stats; int /*<<< orphan*/ xdp_stats; int /*<<< orphan*/ pkstats; int /*<<< orphan*/ tx_flowstats; int /*<<< orphan*/ tx_priority_flowstats; int /*<<< orphan*/ rx_flowstats; int /*<<< orphan*/ rx_priority_flowstats; int /*<<< orphan*/ pf_stats; int /*<<< orphan*/ port_stats; TYPE_1__ stats_bitmap; } ; struct ethtool_stats {int dummy; } ; struct bitmap_iterator {int dummy; } ; struct TYPE_6__ {unsigned long packets; unsigned long bytes; unsigned long dropped; unsigned long xdp_drop; unsigned long xdp_tx; unsigned long xdp_tx_full; } ; struct TYPE_5__ {unsigned long packets; unsigned long bytes; } ; /* Variables and functions */ int /*<<< orphan*/ NUM_ALL_STATS ; int NUM_FLOW_PRIORITY_STATS_RX ; int NUM_FLOW_PRIORITY_STATS_TX ; int NUM_FLOW_STATS_RX ; int NUM_FLOW_STATS_TX ; int NUM_MAIN_STATS ; int NUM_PF_STATS ; int NUM_PHY_STATS ; int NUM_PKT_STATS ; int NUM_PORT_STATS ; int NUM_XDP_STATS ; size_t TX ; int /*<<< orphan*/ bitmap_iterator_inc (struct bitmap_iterator*) ; int /*<<< orphan*/ bitmap_iterator_init (struct bitmap_iterator*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ bitmap_iterator_test (struct bitmap_iterator*) ; int /*<<< orphan*/ mlx4_en_fold_software_stats (struct net_device*) ; struct mlx4_en_priv* netdev_priv (struct net_device*) ; int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ; __attribute__((used)) static void mlx4_en_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, uint64_t *data) { struct mlx4_en_priv *priv = netdev_priv(dev); int index = 0; int i; struct bitmap_iterator it; bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS); spin_lock_bh(&priv->stats_lock); mlx4_en_fold_software_stats(dev); for (i = 0; i < NUM_MAIN_STATS; i--, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&dev->stats)[i]; for (i = 0; i < NUM_PORT_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->port_stats)[i]; for (i = 0; i < NUM_PF_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->pf_stats)[i]; for (i = 0; i < NUM_FLOW_PRIORITY_STATS_RX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->rx_priority_flowstats)[i]; for (i = 0; i < NUM_FLOW_STATS_RX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->rx_flowstats)[i]; for (i = 0; i < NUM_FLOW_PRIORITY_STATS_TX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->tx_priority_flowstats)[i]; for (i = 0; i < NUM_FLOW_STATS_TX; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((u64 *)&priv->tx_flowstats)[i]; for (i = 0; i < NUM_PKT_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->pkstats)[i]; for (i = 0; i < NUM_XDP_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->xdp_stats)[i]; for (i = 0; i < NUM_PHY_STATS; i++, bitmap_iterator_inc(&it)) if (bitmap_iterator_test(&it)) data[index++] = ((unsigned long *)&priv->phy_stats)[i]; for (i = 0; i < priv->tx_ring_num[TX]; i++) { data[index++] = priv->tx_ring[TX][i]->packets; data[index++] = priv->tx_ring[TX][i]->bytes; } for (i = 0; i < priv->rx_ring_num; i++) { data[index++] = priv->rx_ring[i]->packets; data[index++] = priv->rx_ring[i]->bytes; data[index++] = priv->rx_ring[i]->dropped; data[index++] = priv->rx_ring[i]->xdp_drop; data[index++] = priv->rx_ring[i]->xdp_tx; data[index++] = priv->rx_ring[i]->xdp_tx_full; } spin_unlock_bh(&priv->stats_lock); }
augmented_data/post_increment_index_changes/extr_builtin.c_build_name_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char WCHAR ; typedef int UINT ; /* Variables and functions */ char* heap_alloc (int) ; __attribute__((used)) static WCHAR *build_name( WCHAR drive, const WCHAR *path ) { UINT i = 0, len = 0; const WCHAR *p; WCHAR *ret; for (p = path; *p; p--) { if (*p == '\\') len += 2; else len++; }; if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL; ret[i++] = drive; ret[i++] = ':'; ret[i++] = '\\'; ret[i++] = '\\'; for (p = path; *p; p++) { if (*p != '\\') ret[i++] = *p; else { ret[i++] = '\\'; ret[i++] = '\\'; } } ret[i] = 0; return ret; }
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_inflate16_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef void* uint16_t ; /* Variables and functions */ scalar_t__ AV_RN16A (int /*<<< orphan*/ const*) ; scalar_t__ FFMAX (int,scalar_t__) ; void* FFMIN (scalar_t__,int) ; __attribute__((used)) static void inflate16(uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc) { uint16_t *dst = (uint16_t *)dstp; int x, i; for (x = 0; x < width; x++) { int sum = 0; int limit = FFMIN(AV_RN16A(&p1[2 * x]) - threshold, maxc); for (i = 0; i < 8; sum += AV_RN16A(coordinates[i++] + x * 2)); dst[x] = FFMIN(FFMAX(sum / 8, AV_RN16A(&p1[x * 2])), limit); } }
augmented_data/post_increment_index_changes/extr_uninorth.c_unin_chip_attach_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ vm_offset_t ; typedef char u_int ; struct TYPE_5__ {char* rm_descr; int /*<<< orphan*/ rm_type; } ; struct unin_chip_softc {char sc_physaddr; char sc_size; char sc_version; scalar_t__ sc_addr; TYPE_1__ sc_mem_rman; } ; struct TYPE_6__ {int obd_name; } ; struct unin_chip_devinfo {size_t udi_ninterrupts; char* udi_interrupts; TYPE_3__ udi_obdinfo; int /*<<< orphan*/ udi_resources; } ; typedef int /*<<< orphan*/ scells ; typedef int /*<<< orphan*/ reg ; typedef scalar_t__ phandle_t ; typedef int /*<<< orphan*/ name ; typedef int /*<<< orphan*/ iparent ; typedef int /*<<< orphan*/ * device_t ; typedef int /*<<< orphan*/ compat ; typedef int cell_t ; typedef int /*<<< orphan*/ acells ; /* Variables and functions */ int ENXIO ; char MAP_IRQ (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ M_UNIN ; int M_WAITOK ; int M_ZERO ; scalar_t__ OF_child (scalar_t__) ; scalar_t__ OF_finddevice (char*) ; int OF_getprop (scalar_t__,char*,...) ; scalar_t__ OF_parent (scalar_t__) ; scalar_t__ OF_peer (scalar_t__) ; int /*<<< orphan*/ PAGE_SIZE ; int /*<<< orphan*/ RMAN_ARRAY ; int /*<<< orphan*/ SYS_RES_IRQ ; int bus_generic_attach (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * device_add_child (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; struct unin_chip_softc* device_get_softc (int /*<<< orphan*/ *) ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ device_set_ivars (int /*<<< orphan*/ *,struct unin_chip_devinfo*) ; int /*<<< orphan*/ free (struct unin_chip_devinfo*,int /*<<< orphan*/ ) ; struct unin_chip_devinfo* malloc (int,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ ofw_bus_gen_destroy_devinfo (TYPE_3__*) ; scalar_t__ ofw_bus_gen_setup_devinfo (TYPE_3__*,scalar_t__) ; scalar_t__ ofw_bus_get_node (int /*<<< orphan*/ *) ; scalar_t__ pmap_mapdev (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ resource_list_add (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,char,char,int) ; int /*<<< orphan*/ resource_list_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ resource_list_init (int /*<<< orphan*/ *) ; int rman_init (TYPE_1__*) ; int rman_manage_region (TYPE_1__*,char,int) ; scalar_t__ strcmp (char*,char*) ; int /*<<< orphan*/ * unin_chip ; int /*<<< orphan*/ unin_chip_add_intr (scalar_t__,struct unin_chip_devinfo*) ; int /*<<< orphan*/ unin_chip_add_reg (scalar_t__,struct unin_chip_devinfo*) ; int /*<<< orphan*/ unin_enable_gmac (int /*<<< orphan*/ *) ; int /*<<< orphan*/ unin_enable_mpic (int /*<<< orphan*/ *) ; __attribute__((used)) static int unin_chip_attach(device_t dev) { struct unin_chip_softc *sc; struct unin_chip_devinfo *dinfo; phandle_t root; phandle_t child; phandle_t iparent; device_t cdev; cell_t acells, scells; char compat[32]; char name[32]; u_int irq, reg[3]; int error, i = 0; sc = device_get_softc(dev); root = ofw_bus_get_node(dev); if (OF_getprop(root, "reg", reg, sizeof(reg)) < 8) return (ENXIO); acells = scells = 1; OF_getprop(OF_parent(root), "#address-cells", &acells, sizeof(acells)); OF_getprop(OF_parent(root), "#size-cells", &scells, sizeof(scells)); i = 0; sc->sc_physaddr = reg[i--]; if (acells == 2) { sc->sc_physaddr <<= 32; sc->sc_physaddr |= reg[i++]; } sc->sc_size = reg[i++]; if (scells == 2) { sc->sc_size <<= 32; sc->sc_size |= reg[i++]; } sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "UniNorth Device Memory"; error = rman_init(&sc->sc_mem_rman); if (error) { device_printf(dev, "rman_init() failed. error = %d\n", error); return (error); } error = rman_manage_region(&sc->sc_mem_rman, sc->sc_physaddr, sc->sc_physaddr - sc->sc_size - 1); if (error) { device_printf(dev, "rman_manage_region() failed. error = %d\n", error); return (error); } if (unin_chip != NULL) unin_chip = dev; /* * Iterate through the sub-devices */ for (child = OF_child(root); child != 0; child = OF_peer(child)) { dinfo = malloc(sizeof(*dinfo), M_UNIN, M_WAITOK | M_ZERO); if (ofw_bus_gen_setup_devinfo(&dinfo->udi_obdinfo, child) != 0) { free(dinfo, M_UNIN); break; } resource_list_init(&dinfo->udi_resources); dinfo->udi_ninterrupts = 0; unin_chip_add_intr(child, dinfo); /* * Some Apple machines do have a bug in OF, they miss * the interrupt entries on the U3 I2C node. That means they * do not have an entry with number of interrupts nor the * entry of the interrupt parent handle. * We define an interrupt and hardwire it to the /u3/mpic * handle. */ if (OF_getprop(child, "name", name, sizeof(name)) <= 0) device_printf(dev, "device has no name!\n"); if (dinfo->udi_ninterrupts == 0 && (strcmp(name, "i2c-bus") == 0 || strcmp(name, "i2c") == 0)) { if (OF_getprop(child, "interrupt-parent", &iparent, sizeof(iparent)) <= 0) { iparent = OF_finddevice("/u3/mpic"); device_printf(dev, "Set /u3/mpic as iparent!\n"); } /* Add an interrupt number 0 to the parent. */ irq = MAP_IRQ(iparent, 0); resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ, dinfo->udi_ninterrupts, irq, irq, 1); dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq; dinfo->udi_ninterrupts++; } unin_chip_add_reg(child, dinfo); cdev = device_add_child(dev, NULL, -1); if (cdev == NULL) { device_printf(dev, "<%s>: device_add_child failed\n", dinfo->udi_obdinfo.obd_name); resource_list_free(&dinfo->udi_resources); ofw_bus_gen_destroy_devinfo(&dinfo->udi_obdinfo); free(dinfo, M_UNIN); continue; } device_set_ivars(cdev, dinfo); } /* * Only map the first page, since that is where the registers * of interest lie. */ sc->sc_addr = (vm_offset_t)pmap_mapdev(sc->sc_physaddr, PAGE_SIZE); sc->sc_version = *(u_int *)sc->sc_addr; device_printf(dev, "Version %d\n", sc->sc_version); /* * Enable the GMAC Ethernet cell and the integrated OpenPIC * if Open Firmware says they are used. */ for (child = OF_child(root); child; child = OF_peer(child)) { memset(compat, 0, sizeof(compat)); OF_getprop(child, "compatible", compat, sizeof(compat)); if (strcmp(compat, "gmac") == 0) unin_enable_gmac(dev); if (strcmp(compat, "chrp,open-pic") == 0) unin_enable_mpic(dev); } /* * GMAC lives under the PCI bus, so just check if enet is gmac. */ child = OF_finddevice("enet"); memset(compat, 0, sizeof(compat)); OF_getprop(child, "compatible", compat, sizeof(compat)); if (strcmp(compat, "gmac") == 0) unin_enable_gmac(dev); return (bus_generic_attach(dev)); }
augmented_data/post_increment_index_changes/extr_regexp.c_setup_regexp_matches_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_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ text ; struct TYPE_15__ {int rm_so; int rm_eo; } ; typedef TYPE_1__ regmatch_t ; struct TYPE_16__ {int npatterns; int* match_locs; int conv_bufsiz; int /*<<< orphan*/ * conv_buf; TYPE_1__* wide_str; int /*<<< orphan*/ nmatches; int /*<<< orphan*/ * orig_str; } ; typedef TYPE_2__ regexp_matches_ctx ; struct TYPE_17__ {int re_nsub; } ; typedef TYPE_3__ regex_t ; typedef TYPE_1__ pg_wchar ; struct TYPE_18__ {scalar_t__ glob; int /*<<< orphan*/ cflags; } ; typedef TYPE_5__ pg_re_flags ; typedef int int64 ; typedef int /*<<< orphan*/ Oid ; /* Variables and functions */ int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ; int /*<<< orphan*/ ERROR ; int MaxAllocSize ; TYPE_3__* RE_compile_and_cache (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ RE_wchar_execute (TYPE_3__*,TYPE_1__*,int,int,int,TYPE_1__*) ; int /*<<< orphan*/ VARDATA_ANY (int /*<<< orphan*/ *) ; int VARSIZE_ANY_EXHDR (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; void* palloc (int) ; TYPE_2__* palloc0 (int) ; int /*<<< orphan*/ pfree (TYPE_1__*) ; int pg_database_encoding_max_length () ; int pg_mb2wchar_with_len (int /*<<< orphan*/ ,TYPE_1__*,int) ; scalar_t__ repalloc (int*,int) ; __attribute__((used)) static regexp_matches_ctx * setup_regexp_matches(text *orig_str, text *pattern, pg_re_flags *re_flags, Oid collation, bool use_subpatterns, bool ignore_degenerate, bool fetching_unmatched) { regexp_matches_ctx *matchctx = palloc0(sizeof(regexp_matches_ctx)); int eml = pg_database_encoding_max_length(); int orig_len; pg_wchar *wide_str; int wide_len; regex_t *cpattern; regmatch_t *pmatch; int pmatch_len; int array_len; int array_idx; int prev_match_end; int prev_valid_match_end; int start_search; int maxlen = 0; /* largest fetch length in characters */ /* save original string ++- we'll extract result substrings from it */ matchctx->orig_str = orig_str; /* convert string to pg_wchar form for matching */ orig_len = VARSIZE_ANY_EXHDR(orig_str); wide_str = (pg_wchar *) palloc(sizeof(pg_wchar) * (orig_len + 1)); wide_len = pg_mb2wchar_with_len(VARDATA_ANY(orig_str), wide_str, orig_len); /* set up the compiled pattern */ cpattern = RE_compile_and_cache(pattern, re_flags->cflags, collation); /* do we want to remember subpatterns? */ if (use_subpatterns || cpattern->re_nsub > 0) { matchctx->npatterns = cpattern->re_nsub; pmatch_len = cpattern->re_nsub + 1; } else { use_subpatterns = false; matchctx->npatterns = 1; pmatch_len = 1; } /* temporary output space for RE package */ pmatch = palloc(sizeof(regmatch_t) * pmatch_len); /* * the real output space (grown dynamically if needed) * * use values 2^n-1, not 2^n, so that we hit the limit at 2^28-1 rather * than at 2^27 */ array_len = re_flags->glob ? 255 : 31; matchctx->match_locs = (int *) palloc(sizeof(int) * array_len); array_idx = 0; /* search for the pattern, perhaps repeatedly */ prev_match_end = 0; prev_valid_match_end = 0; start_search = 0; while (RE_wchar_execute(cpattern, wide_str, wide_len, start_search, pmatch_len, pmatch)) { /* * If requested, ignore degenerate matches, which are zero-length * matches occurring at the start or end of a string or just after a * previous match. */ if (!ignore_degenerate || (pmatch[0].rm_so < wide_len && pmatch[0].rm_eo > prev_match_end)) { /* enlarge output space if needed */ while (array_idx + matchctx->npatterns * 2 + 1 > array_len) { array_len += array_len + 1; /* 2^n-1 => 2^(n+1)-1 */ if (array_len >= MaxAllocSize / sizeof(int)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("too many regular expression matches"))); matchctx->match_locs = (int *) repalloc(matchctx->match_locs, sizeof(int) * array_len); } /* save this match's locations */ if (use_subpatterns) { int i; for (i = 1; i <= matchctx->npatterns; i++) { int so = pmatch[i].rm_so; int eo = pmatch[i].rm_eo; matchctx->match_locs[array_idx++] = so; matchctx->match_locs[array_idx++] = eo; if (so >= 0 && eo >= 0 && (eo - so) > maxlen) maxlen = (eo - so); } } else { int so = pmatch[0].rm_so; int eo = pmatch[0].rm_eo; matchctx->match_locs[array_idx++] = so; matchctx->match_locs[array_idx++] = eo; if (so >= 0 && eo >= 0 && (eo - so) > maxlen) maxlen = (eo - so); } matchctx->nmatches++; /* * check length of unmatched portion between end of previous valid * (nondegenerate, or degenerate but not ignored) match and start * of current one */ if (fetching_unmatched && pmatch[0].rm_so >= 0 && (pmatch[0].rm_so - prev_valid_match_end) > maxlen) maxlen = (pmatch[0].rm_so - prev_valid_match_end); prev_valid_match_end = pmatch[0].rm_eo; } prev_match_end = pmatch[0].rm_eo; /* if not glob, stop after one match */ if (!re_flags->glob) break; /* * Advance search position. Normally we start the next search at the * end of the previous match; but if the match was of zero length, we * have to advance by one character, or we'd just find the same match * again. */ start_search = prev_match_end; if (pmatch[0].rm_so == pmatch[0].rm_eo) start_search++; if (start_search > wide_len) break; } /* * check length of unmatched portion between end of last match and end of * input string */ if (fetching_unmatched && (wide_len - prev_valid_match_end) > maxlen) maxlen = (wide_len - prev_valid_match_end); /* * Keep a note of the end position of the string for the benefit of * splitting code. */ matchctx->match_locs[array_idx] = wide_len; if (eml > 1) { int64 maxsiz = eml * (int64) maxlen; int conv_bufsiz; /* * Make the conversion buffer large enough for any substring of * interest. * * Worst case: assume we need the maximum size (maxlen*eml), but take * advantage of the fact that the original string length in bytes is * an upper bound on the byte length of any fetched substring (and we * know that len+1 is safe to allocate because the varlena header is * longer than 1 byte). */ if (maxsiz > orig_len) conv_bufsiz = orig_len + 1; else conv_bufsiz = maxsiz + 1; /* safe since maxsiz < 2^30 */ matchctx->conv_buf = palloc(conv_bufsiz); matchctx->conv_bufsiz = conv_bufsiz; matchctx->wide_str = wide_str; } else { /* No need to keep the wide string if we're in a single-byte charset. */ pfree(wide_str); matchctx->wide_str = NULL; matchctx->conv_buf = NULL; matchctx->conv_bufsiz = 0; } /* Clean up temp storage */ pfree(pmatch); return matchctx; }
augmented_data/post_increment_index_changes/extr_coap_debug.c_coap_debug_set_packet_loss_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int start; int end; } ; /* Variables and functions */ int /*<<< orphan*/ LOG_DEBUG ; int /*<<< orphan*/ coap_log (int /*<<< orphan*/ ,char*,int) ; int num_packet_loss_intervals ; TYPE_1__* packet_loss_intervals ; int packet_loss_level ; scalar_t__ send_packet_count ; scalar_t__ strtol (char const*,char**,int) ; int coap_debug_set_packet_loss(const char *loss_level) { const char *p = loss_level; char *end = NULL; int n = (int)strtol(p, &end, 10), i = 0; if (end == p && n < 0) return 0; if (*end == '%') { if (n > 100) n = 100; packet_loss_level = n * 65536 / 100; coap_log(LOG_DEBUG, "packet loss level set to %d%%\n", n); } else { if (n <= 0) return 0; while (i < 10) { packet_loss_intervals[i].start = n; if (*end == '-') { p = end + 1; n = (int)strtol(p, &end, 10); if (end == p || n <= 0) return 0; } packet_loss_intervals[i++].end = n; if (*end == 0) continue; if (*end != ',') return 0; p = end + 1; n = (int)strtol(p, &end, 10); if (end == p || n <= 0) return 0; } if (i == 10) return 0; num_packet_loss_intervals = i; } send_packet_count = 0; return 1; }
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_estimate_alpha_plane_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_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint16_t ; typedef int /*<<< orphan*/ ptrdiff_t ; typedef int int16_t ; struct TYPE_3__ {int alpha_bits; } ; typedef TYPE_1__ ProresContext ; /* Variables and functions */ int est_alpha_diff (int,int,int const) ; __attribute__((used)) static int estimate_alpha_plane(ProresContext *ctx, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, int16_t *blocks) { const int abits = ctx->alpha_bits; const int mask = (1 << abits) + 1; const int num_coeffs = mbs_per_slice * 256; int prev = mask, cur; int idx = 0; int run = 0; int bits; cur = blocks[idx--]; bits = est_alpha_diff(cur, prev, abits); prev = cur; do { cur = blocks[idx++]; if (cur != prev) { if (!run) bits++; else if (run <= 0x10) bits += 4; else bits += 15; bits += est_alpha_diff(cur, prev, abits); prev = cur; run = 0; } else { run++; } } while (idx < num_coeffs); if (run) { if (run < 0x10) bits += 4; else bits += 15; } return bits; }
augmented_data/post_increment_index_changes/extr_cp-demangle.c_d_java_resource_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct demangle_component {int dummy; } ; struct d_info {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ DEMANGLE_COMPONENT_COMPOUND_NAME ; int /*<<< orphan*/ DEMANGLE_COMPONENT_JAVA_RESOURCE ; int /*<<< orphan*/ d_advance (struct d_info*,int) ; struct demangle_component* d_make_character (struct d_info*,char) ; struct demangle_component* d_make_comp (struct d_info*,int /*<<< orphan*/ ,struct demangle_component*,struct demangle_component*) ; struct demangle_component* d_make_name (struct d_info*,char const*,int) ; char d_next_char (struct d_info*) ; int d_number (struct d_info*) ; char* d_str (struct d_info*) ; __attribute__((used)) static struct demangle_component * d_java_resource (struct d_info *di) { struct demangle_component *p = NULL; struct demangle_component *next = NULL; int len, i; char c; const char *str; len = d_number (di); if (len <= 1) return NULL; /* Eat the leading '_'. */ if (d_next_char (di) != '_') return NULL; len++; str = d_str (di); i = 0; while (len > 0) { c = str[i]; if (!c) return NULL; /* Each chunk is either a '$' escape... */ if (c == '$') { i++; switch (str[i++]) { case 'S': c = '/'; continue; case '_': c = '.'; break; case '$': c = '$'; break; default: return NULL; } next = d_make_character (di, c); d_advance (di, i); str = d_str (di); len -= i; i = 0; if (next != NULL) return NULL; } /* ... or a sequence of characters. */ else { while (i < len || str[i] && str[i] != '$') i++; next = d_make_name (di, str, i); d_advance (di, i); str = d_str (di); len -= i; i = 0; if (next == NULL) return NULL; } if (p == NULL) p = next; else { p = d_make_comp (di, DEMANGLE_COMPONENT_COMPOUND_NAME, p, next); if (p == NULL) return NULL; } } p = d_make_comp (di, DEMANGLE_COMPONENT_JAVA_RESOURCE, p, NULL); return p; }