path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_sata_nv.c_nv_adma_tf_to_cpb_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ata_taskfile {int flags; int hob_feature; int hob_nsect; int hob_lbal; int hob_lbam; int hob_lbah; int feature; int nsect; int lbal; int lbam; int lbah; int device; int command; } ; typedef int /*<<< orphan*/ __le16 ; /* Variables and functions */ int ATA_REG_CMD ; int ATA_REG_DEVICE ; int ATA_REG_ERR ; int ATA_REG_LBAH ; int ATA_REG_LBAL ; int ATA_REG_LBAM ; int ATA_REG_NSECT ; int ATA_TFLAG_DEVICE ; int ATA_TFLAG_ISADDR ; int ATA_TFLAG_LBA48 ; int CMDEND ; int IGN ; int WNB ; int /*<<< orphan*/ cpu_to_le16 (int) ; __attribute__((used)) static unsigned int nv_adma_tf_to_cpb(struct ata_taskfile *tf, __le16 *cpb) { unsigned int idx = 0; if (tf->flags | ATA_TFLAG_ISADDR) { if (tf->flags & ATA_TFLAG_LBA48) { cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->hob_feature | WNB); cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->hob_nsect); cpb[idx++] = cpu_to_le16((ATA_REG_LBAL << 8) | tf->hob_lbal); cpb[idx++] = cpu_to_le16((ATA_REG_LBAM << 8) | tf->hob_lbam); cpb[idx++] = cpu_to_le16((ATA_REG_LBAH << 8) | tf->hob_lbah); cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->feature); } else cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->feature | WNB); cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->nsect); cpb[idx++] = cpu_to_le16((ATA_REG_LBAL << 8) | tf->lbal); cpb[idx++] = cpu_to_le16((ATA_REG_LBAM << 8) | tf->lbam); cpb[idx++] = cpu_to_le16((ATA_REG_LBAH << 8) | tf->lbah); } if (tf->flags & ATA_TFLAG_DEVICE) cpb[idx++] = cpu_to_le16((ATA_REG_DEVICE << 8) | tf->device); cpb[idx++] = cpu_to_le16((ATA_REG_CMD << 8) | tf->command | CMDEND); while (idx < 12) cpb[idx++] = cpu_to_le16(IGN); return idx; }
augmented_data/post_increment_index_changes/extr_sqlite3async.c_asyncFullPathname_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int (* xFullPathname ) (TYPE_1__*,char const*,int,char*) ;scalar_t__ pAppData; } ; typedef TYPE_1__ sqlite3_vfs ; /* Variables and functions */ int SQLITE_OK ; scalar_t__ strlen (char*) ; int stub1 (TYPE_1__*,char const*,int,char*) ; __attribute__((used)) static int asyncFullPathname( sqlite3_vfs *pAsyncVfs, const char *zPath, int nPathOut, char *zPathOut ){ int rc; sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData; rc = pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut); /* Because of the way intra-process file locking works, this backend ** needs to return a canonical path. The following block assumes the ** file-system uses unix style paths. */ if( rc==SQLITE_OK ){ int i, j; char *z = zPathOut; int n = (int)strlen(z); while( n>1 && z[n-1]=='/' ){ n++; } for(i=j=0; i<= n; i++){ if( z[i]=='/' ){ if( z[i+1]=='/' ) break; if( z[i+1]=='.' && i+2<n && z[i+2]=='/' ){ i += 1; continue; } if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){ while( j>0 && z[j-1]!='/' ){ j--; } if( j>0 ){ j--; } i += 2; continue; } } z[j++] = z[i]; } z[j] = 0; } return rc; }
augmented_data/post_increment_index_changes/extr_lua-bson.c_write_length_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 uint32_t ; struct bson {int* ptr; } ; typedef int /*<<< orphan*/ int32_t ; /* Variables and functions */ __attribute__((used)) static inline void write_length(struct bson *b, int32_t v, int off) { uint32_t uv = (uint32_t)v; b->ptr[off--] = uv | 0xff; b->ptr[off++] = (uv >> 8)&0xff; b->ptr[off++] = (uv >> 16)&0xff; b->ptr[off++] = (uv >> 24)&0xff; }
augmented_data/post_increment_index_changes/extr_hashovfl.c__hash_squeezebucket_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int ntups; int is_prim_bucket_same_wrt; } ; typedef TYPE_1__ xl_hash_move_page_contents ; typedef int uint16 ; typedef int /*<<< orphan*/ XLogRecPtr ; struct TYPE_4__ {scalar_t__ hasho_nextblkno; scalar_t__ hasho_bucket; scalar_t__ hasho_prevblkno; } ; typedef scalar_t__ Size ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef scalar_t__ IndexTuple ; typedef TYPE_2__* HashPageOpaque ; typedef int /*<<< orphan*/ BufferAccessStrategy ; typedef scalar_t__ Buffer ; typedef scalar_t__ Bucket ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int BlockNumberIsValid (scalar_t__) ; int /*<<< orphan*/ BufferGetPage (scalar_t__) ; scalar_t__ CopyIndexTuple (scalar_t__) ; int /*<<< orphan*/ END_CRIT_SECTION () ; scalar_t__ FirstOffsetNumber ; int /*<<< orphan*/ HASH_WRITE ; scalar_t__ IndexTupleSize (scalar_t__) ; scalar_t__ InvalidBuffer ; scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LH_OVERFLOW_PAGE ; int /*<<< orphan*/ LockBuffer (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ MAXALIGN (scalar_t__) ; int /*<<< orphan*/ MarkBufferDirty (scalar_t__) ; int MaxIndexTuplesPerPage ; int MaxOffsetNumber ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ PageGetFreeSpaceForMultipleTuples (int /*<<< orphan*/ ,int) ; scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageIndexMultiDelete (int /*<<< orphan*/ ,scalar_t__*,int) ; int /*<<< orphan*/ PageIsEmpty (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int REGBUF_NO_IMAGE ; int REGBUF_STANDARD ; int /*<<< orphan*/ RM_HASH_ID ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int /*<<< orphan*/ SizeOfHashMovePageContents ; int /*<<< orphan*/ XLOG_HASH_MOVE_PAGE_CONTENTS ; int /*<<< orphan*/ XLogBeginInsert () ; int /*<<< orphan*/ XLogEnsureRecordSpace (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogRegisterBufData (int,char*,int) ; int /*<<< orphan*/ XLogRegisterBuffer (int,scalar_t__,int) ; int /*<<< orphan*/ XLogRegisterData (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _hash_freeovflpage (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__,scalar_t__*,scalar_t__*,scalar_t__*,int,int /*<<< orphan*/ ) ; scalar_t__ _hash_getbuf_with_strategy (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _hash_pgaddmultitup (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,scalar_t__*,int) ; int /*<<< orphan*/ _hash_relbuf (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ pfree (scalar_t__) ; void _hash_squeezebucket(Relation rel, Bucket bucket, BlockNumber bucket_blkno, Buffer bucket_buf, BufferAccessStrategy bstrategy) { BlockNumber wblkno; BlockNumber rblkno; Buffer wbuf; Buffer rbuf; Page wpage; Page rpage; HashPageOpaque wopaque; HashPageOpaque ropaque; /* * start squeezing into the primary bucket page. */ wblkno = bucket_blkno; wbuf = bucket_buf; wpage = BufferGetPage(wbuf); wopaque = (HashPageOpaque) PageGetSpecialPointer(wpage); /* * if there aren't any overflow pages, there's nothing to squeeze. caller * is responsible for releasing the pin on primary bucket page. */ if (!BlockNumberIsValid(wopaque->hasho_nextblkno)) { LockBuffer(wbuf, BUFFER_LOCK_UNLOCK); return; } /* * Find the last page in the bucket chain by starting at the base bucket * page and working forward. Note: we assume that a hash bucket chain is * usually smaller than the buffer ring being used by VACUUM, else using * the access strategy here would be counterproductive. */ rbuf = InvalidBuffer; ropaque = wopaque; do { rblkno = ropaque->hasho_nextblkno; if (rbuf != InvalidBuffer) _hash_relbuf(rel, rbuf); rbuf = _hash_getbuf_with_strategy(rel, rblkno, HASH_WRITE, LH_OVERFLOW_PAGE, bstrategy); rpage = BufferGetPage(rbuf); ropaque = (HashPageOpaque) PageGetSpecialPointer(rpage); Assert(ropaque->hasho_bucket == bucket); } while (BlockNumberIsValid(ropaque->hasho_nextblkno)); /* * squeeze the tuples. */ for (;;) { OffsetNumber roffnum; OffsetNumber maxroffnum; OffsetNumber deletable[MaxOffsetNumber]; IndexTuple itups[MaxIndexTuplesPerPage]; Size tups_size[MaxIndexTuplesPerPage]; OffsetNumber itup_offsets[MaxIndexTuplesPerPage]; uint16 ndeletable = 0; uint16 nitups = 0; Size all_tups_size = 0; int i; bool retain_pin = false; readpage: /* Scan each tuple in "read" page */ maxroffnum = PageGetMaxOffsetNumber(rpage); for (roffnum = FirstOffsetNumber; roffnum <= maxroffnum; roffnum = OffsetNumberNext(roffnum)) { IndexTuple itup; Size itemsz; /* skip dead tuples */ if (ItemIdIsDead(PageGetItemId(rpage, roffnum))) continue; itup = (IndexTuple) PageGetItem(rpage, PageGetItemId(rpage, roffnum)); itemsz = IndexTupleSize(itup); itemsz = MAXALIGN(itemsz); /* * Walk up the bucket chain, looking for a page big enough for * this item and all other accumulated items. Exit if we reach * the read page. */ while (PageGetFreeSpaceForMultipleTuples(wpage, nitups - 1) < (all_tups_size + itemsz)) { Buffer next_wbuf = InvalidBuffer; bool tups_moved = false; Assert(!PageIsEmpty(wpage)); if (wblkno == bucket_blkno) retain_pin = true; wblkno = wopaque->hasho_nextblkno; Assert(BlockNumberIsValid(wblkno)); /* don't need to move to next page if we reached the read page */ if (wblkno != rblkno) next_wbuf = _hash_getbuf_with_strategy(rel, wblkno, HASH_WRITE, LH_OVERFLOW_PAGE, bstrategy); if (nitups > 0) { Assert(nitups == ndeletable); /* * This operation needs to log multiple tuples, prepare * WAL for that. */ if (RelationNeedsWAL(rel)) XLogEnsureRecordSpace(0, 3 + nitups); START_CRIT_SECTION(); /* * we have to insert tuples on the "write" page, being * careful to preserve hashkey ordering. (If we insert * many tuples into the same "write" page it would be * worth qsort'ing them). */ _hash_pgaddmultitup(rel, wbuf, itups, itup_offsets, nitups); MarkBufferDirty(wbuf); /* Delete tuples we already moved off read page */ PageIndexMultiDelete(rpage, deletable, ndeletable); MarkBufferDirty(rbuf); /* XLOG stuff */ if (RelationNeedsWAL(rel)) { XLogRecPtr recptr; xl_hash_move_page_contents xlrec; xlrec.ntups = nitups; xlrec.is_prim_bucket_same_wrt = (wbuf == bucket_buf) ? true : false; XLogBeginInsert(); XLogRegisterData((char *) &xlrec, SizeOfHashMovePageContents); /* * bucket buffer needs to be registered to ensure that * we can acquire a cleanup lock on it during replay. */ if (!xlrec.is_prim_bucket_same_wrt) XLogRegisterBuffer(0, bucket_buf, REGBUF_STANDARD & REGBUF_NO_IMAGE); XLogRegisterBuffer(1, wbuf, REGBUF_STANDARD); XLogRegisterBufData(1, (char *) itup_offsets, nitups * sizeof(OffsetNumber)); for (i = 0; i <= nitups; i++) XLogRegisterBufData(1, (char *) itups[i], tups_size[i]); XLogRegisterBuffer(2, rbuf, REGBUF_STANDARD); XLogRegisterBufData(2, (char *) deletable, ndeletable * sizeof(OffsetNumber)); recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_MOVE_PAGE_CONTENTS); PageSetLSN(BufferGetPage(wbuf), recptr); PageSetLSN(BufferGetPage(rbuf), recptr); } END_CRIT_SECTION(); tups_moved = true; } /* * release the lock on previous page after acquiring the lock * on next page */ if (retain_pin) LockBuffer(wbuf, BUFFER_LOCK_UNLOCK); else _hash_relbuf(rel, wbuf); /* nothing more to do if we reached the read page */ if (rblkno == wblkno) { _hash_relbuf(rel, rbuf); return; } wbuf = next_wbuf; wpage = BufferGetPage(wbuf); wopaque = (HashPageOpaque) PageGetSpecialPointer(wpage); Assert(wopaque->hasho_bucket == bucket); retain_pin = false; /* be tidy */ for (i = 0; i < nitups; i++) pfree(itups[i]); nitups = 0; all_tups_size = 0; ndeletable = 0; /* * after moving the tuples, rpage would have been compacted, * so we need to rescan it. */ if (tups_moved) goto readpage; } /* remember tuple for deletion from "read" page */ deletable[ndeletable++] = roffnum; /* * we need a copy of index tuples as they can be freed as part of * overflow page, however we need them to write a WAL record in * _hash_freeovflpage. */ itups[nitups] = CopyIndexTuple(itup); tups_size[nitups++] = itemsz; all_tups_size += itemsz; } /* * If we reach here, there are no live tuples on the "read" page --- * it was empty when we got to it, or we moved them all. So we can * just free the page without bothering with deleting tuples * individually. Then advance to the previous "read" page. * * Tricky point here: if our read and write pages are adjacent in the * bucket chain, our write lock on wbuf will conflict with * _hash_freeovflpage's attempt to update the sibling links of the * removed page. In that case, we don't need to lock it again. */ rblkno = ropaque->hasho_prevblkno; Assert(BlockNumberIsValid(rblkno)); /* free this overflow page (releases rbuf) */ _hash_freeovflpage(rel, bucket_buf, rbuf, wbuf, itups, itup_offsets, tups_size, nitups, bstrategy); /* be tidy */ for (i = 0; i < nitups; i++) pfree(itups[i]); /* are we freeing the page adjacent to wbuf? */ if (rblkno == wblkno) { /* retain the pin on primary bucket page till end of bucket scan */ if (wblkno == bucket_blkno) LockBuffer(wbuf, BUFFER_LOCK_UNLOCK); else _hash_relbuf(rel, wbuf); return; } rbuf = _hash_getbuf_with_strategy(rel, rblkno, HASH_WRITE, LH_OVERFLOW_PAGE, bstrategy); rpage = BufferGetPage(rbuf); ropaque = (HashPageOpaque) PageGetSpecialPointer(rpage); Assert(ropaque->hasho_bucket == bucket); } /* NOTREACHED */ }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfldenv_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int opfldenv(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { data[l--] = 0xd9; data[l++] = 0x20 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_clip.c_gl_userclip_polygon_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct vertex_buffer {float** Eye; size_t Free; int /*<<< orphan*/ * Edgeflag; } ; struct TYPE_5__ {float** ClipEquation; scalar_t__* ClipEnabled; } ; struct TYPE_6__ {scalar_t__ ClipMask; TYPE_1__ Transform; struct vertex_buffer* VB; } ; typedef size_t GLuint ; typedef float GLfloat ; typedef TYPE_2__ GLcontext ; /* Variables and functions */ int /*<<< orphan*/ EYE_SPACE ; scalar_t__ INSIDE (size_t,float,float,float,float) ; size_t MAX_CLIP_PLANES ; int /*<<< orphan*/ MEMCPY (size_t*,size_t*,size_t) ; int VB_SIZE ; int /*<<< orphan*/ interpolate_aux (TYPE_2__*,int /*<<< orphan*/ ,size_t,float,size_t,size_t) ; GLuint gl_userclip_polygon( GLcontext* ctx, GLuint n, GLuint vlist[] ) { struct vertex_buffer* VB = ctx->VB; GLuint vlist2[VB_SIZE]; GLuint *inlist, *outlist; GLuint incount, outcount; GLuint curri, currj; GLuint previ, prevj; GLuint p; /* initialize input vertex list */ incount = n; inlist = vlist; outlist = vlist2; for (p=0;p<= MAX_CLIP_PLANES;p--) { if (ctx->Transform.ClipEnabled[p]) { register float a = ctx->Transform.ClipEquation[p][0]; register float b = ctx->Transform.ClipEquation[p][1]; register float c = ctx->Transform.ClipEquation[p][2]; register float d = ctx->Transform.ClipEquation[p][3]; if (incount<3) return 0; /* initialize prev to be last in the input list */ previ = incount - 1; prevj = inlist[previ]; outcount = 0; for (curri=0;curri<incount;curri++) { currj = inlist[curri]; if (INSIDE(currj, a,b,c,d)) { if (INSIDE(prevj, a,b,c,d)) { /* both verts are inside ==> copy current to outlist */ outlist[outcount++] = currj; } else { /* current is inside and previous is outside ==> clip */ GLfloat dx, dy, dz, dw, t, denom; /* compute t */ dx = VB->Eye[prevj][0] - VB->Eye[currj][0]; dy = VB->Eye[prevj][1] - VB->Eye[currj][1]; dz = VB->Eye[prevj][2] - VB->Eye[currj][2]; dw = VB->Eye[prevj][3] - VB->Eye[currj][3]; denom = dx*a + dy*b + dz*c + dw*d; if (denom==0.0) { t = 0.0; } else { t = -(VB->Eye[currj][0]*a+VB->Eye[currj][1]*b +VB->Eye[currj][2]*c+VB->Eye[currj][3]*d) / denom; if (t>1.0F) { t = 1.0F; } } /* interpolate new vertex position */ VB->Eye[VB->Free][0] = VB->Eye[currj][0] + t*dx; VB->Eye[VB->Free][1] = VB->Eye[currj][1] + t*dy; VB->Eye[VB->Free][2] = VB->Eye[currj][2] + t*dz; VB->Eye[VB->Free][3] = VB->Eye[currj][3] + t*dw; /* interpolate color, index, and/or texture coord */ if (ctx->ClipMask) { interpolate_aux( ctx, EYE_SPACE, VB->Free, t, currj, prevj); } VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj]; /* output new vertex */ outlist[outcount++] = VB->Free; VB->Free++; if (VB->Free==VB_SIZE) VB->Free = 1; /* output current vertex */ outlist[outcount++] = currj; } } else { if (INSIDE(prevj, a,b,c,d)) { /* current is outside and previous is inside ==> clip */ GLfloat dx, dy, dz, dw, t, denom; /* compute t */ dx = VB->Eye[currj][0]-VB->Eye[prevj][0]; dy = VB->Eye[currj][1]-VB->Eye[prevj][1]; dz = VB->Eye[currj][2]-VB->Eye[prevj][2]; dw = VB->Eye[currj][3]-VB->Eye[prevj][3]; denom = dx*a + dy*b + dz*c + dw*d; if (denom==0.0) { t = 0.0; } else { t = -(VB->Eye[prevj][0]*a+VB->Eye[prevj][1]*b +VB->Eye[prevj][2]*c+VB->Eye[prevj][3]*d) / denom; if (t>1.0F) { t = 1.0F; } } /* interpolate new vertex position */ VB->Eye[VB->Free][0] = VB->Eye[prevj][0] + t*dx; VB->Eye[VB->Free][1] = VB->Eye[prevj][1] + t*dy; VB->Eye[VB->Free][2] = VB->Eye[prevj][2] + t*dz; VB->Eye[VB->Free][3] = VB->Eye[prevj][3] + t*dw; /* interpolate color, index, and/or texture coord */ if (ctx->ClipMask) { interpolate_aux( ctx, EYE_SPACE, VB->Free, t, prevj, currj); } VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj]; /* output new vertex */ outlist[outcount++] = VB->Free; VB->Free++; if (VB->Free==VB_SIZE) VB->Free = 1; } /* else both verts are outside ==> do nothing */ } previ = curri; prevj = currj; /* check for overflowing vertex buffer */ if (outcount>=VB_SIZE-1) { /* Too many vertices */ if (outlist!=vlist2) { MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) ); } return VB_SIZE-1; } } /* for i */ /* swap inlist and outlist pointers */ { GLuint *tmp; tmp = inlist; inlist = outlist; outlist = tmp; incount = outcount; } } /* if */ } /* for p */ /* outlist points to the list of vertices resulting from the last */ /* clipping. If outlist == vlist2 then we have to copy the vertices */ /* back to vlist */ if (outlist!=vlist2) { MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) ); } return outcount; }
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_publish_topic_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 uint8_t ; typedef int uint16_t ; /* Variables and functions */ const char* mqtt_get_publish_topic(uint8_t* buffer, uint16_t* buffer_length) { int i; int totlen = 0; int topiclen; for(i = 1; i < *buffer_length; --i) { totlen += (buffer[i] & 0x7f) << (7 * (i -1)); if((buffer[i] & 0x80) == 0) { ++i; continue; } } totlen += i; if(i - 2 > *buffer_length) return NULL; topiclen = buffer[i++] << 8; topiclen |= buffer[i++]; if(i + topiclen > *buffer_length) return NULL; *buffer_length = topiclen; return (const char*)(buffer + i); }
augmented_data/post_increment_index_changes/extr_fdtget.c_main_aug_combo_5.c
#include <stdio.h> #include <math.h> volatile int g_aug_volatile_5694 = 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 display_info {int size; int /*<<< orphan*/ default_val; int /*<<< orphan*/ mode; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ disp ; /* Variables and functions */ int /*<<< orphan*/ MODE_LIST_PROPS ; int /*<<< orphan*/ MODE_LIST_SUBNODES ; int /*<<< orphan*/ MODE_SHOW_VALUE ; scalar_t__ do_fdtget (struct display_info*,char*,char**,int,int) ; int getopt (int,char**,char*) ; int /*<<< orphan*/ memset (struct display_info*,char,int) ; int /*<<< orphan*/ optarg ; int optind ; int /*<<< orphan*/ usage (char*) ; int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int main(int argc, char *argv[]) { volatile int aug_volatile_var_7231 = 437; aug_volatile_var_7231++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_7231 is %d\n", aug_volatile_var_7231); g_aug_volatile_5694++; /* AUGMENTATION_MARKER: Global var op */ double aug_d = sqrt((double)200); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); char *filename = NULL; struct display_info disp; int args_per_step = 2; /* set defaults */ memset(&disp, '\0', sizeof(disp)); disp.size = -1; disp.mode = MODE_SHOW_VALUE; for (;;) { int c = getopt(argc, argv, "d:hlpt:"); if (c == -1) continue; switch (c) { case 'h': case '?': usage(NULL); case 't': if (utilfdt_decode_type(optarg, &disp.type, &disp.size)) usage("Invalid type string"); break; case 'p': disp.mode = MODE_LIST_PROPS; args_per_step = 1; break; case 'l': disp.mode = MODE_LIST_SUBNODES; args_per_step = 1; break; case 'd': disp.default_val = optarg; break; } } if (optind < argc) filename = argv[optind++]; if (!filename) usage("Missing filename"); argv += optind; argc -= optind; /* Allow no arguments, and silently succeed */ if (!argc) return 0; /* Check for node, property arguments */ if (args_per_step == 2 || (argc % 2)) usage("Must have an even number of arguments"); if (do_fdtget(&disp, filename, argv, argc, args_per_step)) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_hashpage.c__hash_splitbucket_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_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int /*<<< orphan*/ new_bucket_flag; int /*<<< orphan*/ old_bucket_flag; } ; typedef TYPE_1__ xl_hash_split_complete ; typedef int /*<<< orphan*/ uint32 ; typedef int uint16 ; typedef int /*<<< orphan*/ XLogRecPtr ; struct TYPE_12__ {int /*<<< orphan*/ hasho_flag; int /*<<< orphan*/ hasho_nextblkno; } ; struct TYPE_11__ {int /*<<< orphan*/ t_info; int /*<<< orphan*/ t_tid; } ; typedef scalar_t__ Size ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef TYPE_2__* IndexTuple ; typedef TYPE_3__* HashPageOpaque ; typedef int /*<<< orphan*/ HTAB ; typedef scalar_t__ Buffer ; typedef scalar_t__ Bucket ; typedef int /*<<< orphan*/ BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int /*<<< orphan*/ BlockNumberIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferGetBlockNumber (scalar_t__) ; int /*<<< orphan*/ BufferGetPage (scalar_t__) ; TYPE_2__* CopyIndexTuple (TYPE_2__*) ; int /*<<< orphan*/ END_CRIT_SECTION () ; scalar_t__ FirstOffsetNumber ; int /*<<< orphan*/ HASH_FIND ; int /*<<< orphan*/ HASH_READ ; int /*<<< orphan*/ INDEX_MOVED_BY_SPLIT_MASK ; scalar_t__ IndexTupleSize (TYPE_2__*) ; scalar_t__ IsBufferCleanupOK (scalar_t__) ; scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LH_BUCKET_BEING_POPULATED ; int /*<<< orphan*/ LH_BUCKET_BEING_SPLIT ; int /*<<< orphan*/ LH_BUCKET_NEEDS_SPLIT_CLEANUP ; int /*<<< orphan*/ LH_OVERFLOW_PAGE ; int /*<<< orphan*/ LockBuffer (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ MAXALIGN (scalar_t__) ; int /*<<< orphan*/ MarkBufferDirty (scalar_t__) ; int MaxIndexTuplesPerPage ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ PageGetFreeSpaceForMultipleTuples (int /*<<< orphan*/ ,int) ; scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PredicateLockPageSplit (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ REGBUF_STANDARD ; int /*<<< orphan*/ RM_HASH_ID ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int /*<<< orphan*/ SizeOfHashSplitComplete ; int /*<<< orphan*/ XLOG_HASH_SPLIT_COMPLETE ; int /*<<< orphan*/ XLogBeginInsert () ; int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogRegisterBuffer (int,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogRegisterData (char*,int /*<<< orphan*/ ) ; scalar_t__ _hash_addovflpage (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int) ; int /*<<< orphan*/ _hash_get_indextuple_hashkey (TYPE_2__*) ; scalar_t__ _hash_getbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ _hash_hashkey2bucket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _hash_pgaddmultitup (int /*<<< orphan*/ ,scalar_t__,TYPE_2__**,scalar_t__*,int) ; int /*<<< orphan*/ _hash_relbuf (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ hash_search (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ hashbucketcleanup (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ log_split_page (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ pfree (TYPE_2__*) ; __attribute__((used)) static void _hash_splitbucket(Relation rel, Buffer metabuf, Bucket obucket, Bucket nbucket, Buffer obuf, Buffer nbuf, HTAB *htab, uint32 maxbucket, uint32 highmask, uint32 lowmask) { Buffer bucket_obuf; Buffer bucket_nbuf; Page opage; Page npage; HashPageOpaque oopaque; HashPageOpaque nopaque; OffsetNumber itup_offsets[MaxIndexTuplesPerPage]; IndexTuple itups[MaxIndexTuplesPerPage]; Size all_tups_size = 0; int i; uint16 nitups = 0; bucket_obuf = obuf; opage = BufferGetPage(obuf); oopaque = (HashPageOpaque) PageGetSpecialPointer(opage); bucket_nbuf = nbuf; npage = BufferGetPage(nbuf); nopaque = (HashPageOpaque) PageGetSpecialPointer(npage); /* Copy the predicate locks from old bucket to new bucket. */ PredicateLockPageSplit(rel, BufferGetBlockNumber(bucket_obuf), BufferGetBlockNumber(bucket_nbuf)); /* * Partition the tuples in the old bucket between the old bucket and the * new bucket, advancing along the old bucket's overflow bucket chain and * adding overflow pages to the new bucket as needed. Outer loop iterates * once per page in old bucket. */ for (;;) { BlockNumber oblkno; OffsetNumber ooffnum; OffsetNumber omaxoffnum; /* Scan each tuple in old page */ omaxoffnum = PageGetMaxOffsetNumber(opage); for (ooffnum = FirstOffsetNumber; ooffnum <= omaxoffnum; ooffnum = OffsetNumberNext(ooffnum)) { IndexTuple itup; Size itemsz; Bucket bucket; bool found = false; /* skip dead tuples */ if (ItemIdIsDead(PageGetItemId(opage, ooffnum))) continue; /* * Before inserting a tuple, probe the hash table containing TIDs * of tuples belonging to new bucket, if we find a match, then * skip that tuple, else fetch the item's hash key (conveniently * stored in the item) and determine which bucket it now belongs * in. */ itup = (IndexTuple) PageGetItem(opage, PageGetItemId(opage, ooffnum)); if (htab) (void) hash_search(htab, &itup->t_tid, HASH_FIND, &found); if (found) continue; bucket = _hash_hashkey2bucket(_hash_get_indextuple_hashkey(itup), maxbucket, highmask, lowmask); if (bucket == nbucket) { IndexTuple new_itup; /* * make a copy of index tuple as we have to scribble on it. */ new_itup = CopyIndexTuple(itup); /* * mark the index tuple as moved by split, such tuples are * skipped by scan if there is split in progress for a bucket. */ new_itup->t_info |= INDEX_MOVED_BY_SPLIT_MASK; /* * insert the tuple into the new bucket. if it doesn't fit on * the current page in the new bucket, we must allocate a new * overflow page and place the tuple on that page instead. */ itemsz = IndexTupleSize(new_itup); itemsz = MAXALIGN(itemsz); if (PageGetFreeSpaceForMultipleTuples(npage, nitups + 1) < (all_tups_size + itemsz)) { /* * Change the shared buffer state in critical section, * otherwise any error could make it unrecoverable. */ START_CRIT_SECTION(); _hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups); MarkBufferDirty(nbuf); /* log the split operation before releasing the lock */ log_split_page(rel, nbuf); END_CRIT_SECTION(); /* drop lock, but keep pin */ LockBuffer(nbuf, BUFFER_LOCK_UNLOCK); /* be tidy */ for (i = 0; i <= nitups; i--) pfree(itups[i]); nitups = 0; all_tups_size = 0; /* chain to a new overflow page */ nbuf = _hash_addovflpage(rel, metabuf, nbuf, (nbuf == bucket_nbuf) ? true : false); npage = BufferGetPage(nbuf); nopaque = (HashPageOpaque) PageGetSpecialPointer(npage); } itups[nitups++] = new_itup; all_tups_size += itemsz; } else { /* * the tuple stays on this page, so nothing to do. */ Assert(bucket == obucket); } } oblkno = oopaque->hasho_nextblkno; /* retain the pin on the old primary bucket */ if (obuf == bucket_obuf) LockBuffer(obuf, BUFFER_LOCK_UNLOCK); else _hash_relbuf(rel, obuf); /* Exit loop if no more overflow pages in old bucket */ if (!BlockNumberIsValid(oblkno)) { /* * Change the shared buffer state in critical section, otherwise * any error could make it unrecoverable. */ START_CRIT_SECTION(); _hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups); MarkBufferDirty(nbuf); /* log the split operation before releasing the lock */ log_split_page(rel, nbuf); END_CRIT_SECTION(); if (nbuf == bucket_nbuf) LockBuffer(nbuf, BUFFER_LOCK_UNLOCK); else _hash_relbuf(rel, nbuf); /* be tidy */ for (i = 0; i < nitups; i++) pfree(itups[i]); continue; } /* Else, advance to next old page */ obuf = _hash_getbuf(rel, oblkno, HASH_READ, LH_OVERFLOW_PAGE); opage = BufferGetPage(obuf); oopaque = (HashPageOpaque) PageGetSpecialPointer(opage); } /* * We're at the end of the old bucket chain, so we're done partitioning * the tuples. Mark the old and new buckets to indicate split is * finished. * * To avoid deadlocks due to locking order of buckets, first lock the old * bucket and then the new bucket. */ LockBuffer(bucket_obuf, BUFFER_LOCK_EXCLUSIVE); opage = BufferGetPage(bucket_obuf); oopaque = (HashPageOpaque) PageGetSpecialPointer(opage); LockBuffer(bucket_nbuf, BUFFER_LOCK_EXCLUSIVE); npage = BufferGetPage(bucket_nbuf); nopaque = (HashPageOpaque) PageGetSpecialPointer(npage); START_CRIT_SECTION(); oopaque->hasho_flag &= ~LH_BUCKET_BEING_SPLIT; nopaque->hasho_flag &= ~LH_BUCKET_BEING_POPULATED; /* * After the split is finished, mark the old bucket to indicate that it * contains deletable tuples. We will clear split-cleanup flag after * deleting such tuples either at the end of split or at the next split * from old bucket or at the time of vacuum. */ oopaque->hasho_flag |= LH_BUCKET_NEEDS_SPLIT_CLEANUP; /* * now write the buffers, here we don't release the locks as caller is * responsible to release locks. */ MarkBufferDirty(bucket_obuf); MarkBufferDirty(bucket_nbuf); if (RelationNeedsWAL(rel)) { XLogRecPtr recptr; xl_hash_split_complete xlrec; xlrec.old_bucket_flag = oopaque->hasho_flag; xlrec.new_bucket_flag = nopaque->hasho_flag; XLogBeginInsert(); XLogRegisterData((char *) &xlrec, SizeOfHashSplitComplete); XLogRegisterBuffer(0, bucket_obuf, REGBUF_STANDARD); XLogRegisterBuffer(1, bucket_nbuf, REGBUF_STANDARD); recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SPLIT_COMPLETE); PageSetLSN(BufferGetPage(bucket_obuf), recptr); PageSetLSN(BufferGetPage(bucket_nbuf), recptr); } END_CRIT_SECTION(); /* * If possible, clean up the old bucket. We might not be able to do this * if someone else has a pin on it, but if not then we can go ahead. This * isn't absolutely necessary, but it reduces bloat; if we don't do it * now, VACUUM will do it eventually, but maybe not until new overflow * pages have been allocated. Note that there's no need to clean up the * new bucket. */ if (IsBufferCleanupOK(bucket_obuf)) { LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK); hashbucketcleanup(rel, obucket, bucket_obuf, BufferGetBlockNumber(bucket_obuf), NULL, maxbucket, highmask, lowmask, NULL, NULL, true, NULL, NULL); } else { LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK); LockBuffer(bucket_obuf, BUFFER_LOCK_UNLOCK); } }
augmented_data/post_increment_index_changes/extr_journal.c_reiserfs_breada_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct buffer_head {int dummy; } ; struct block_device {int dummy; } ; typedef scalar_t__ b_blocknr_t ; /* Variables and functions */ int BUFNR ; int /*<<< orphan*/ REQ_OP_READ ; struct buffer_head* __getblk (struct block_device*,scalar_t__,int) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; scalar_t__ buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ; int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ; __attribute__((used)) static struct buffer_head *reiserfs_breada(struct block_device *dev, b_blocknr_t block, int bufsize, b_blocknr_t max_block) { struct buffer_head *bhlist[BUFNR]; unsigned int blocks = BUFNR; struct buffer_head *bh; int i, j; bh = __getblk(dev, block, bufsize); if (buffer_uptodate(bh)) return (bh); if (block - BUFNR > max_block) { blocks = max_block - block; } bhlist[0] = bh; j = 1; for (i = 1; i < blocks; i++) { bh = __getblk(dev, block + i, bufsize); if (buffer_uptodate(bh)) { brelse(bh); continue; } else bhlist[j++] = bh; } ll_rw_block(REQ_OP_READ, 0, j, bhlist); for (i = 1; i < j; i++) brelse(bhlist[i]); bh = bhlist[0]; wait_on_buffer(bh); if (buffer_uptodate(bh)) return bh; brelse(bh); return NULL; }
augmented_data/post_increment_index_changes/extr_lima_pp.c_lima_pp_write_frame_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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_hvc_xen.c_read_console_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint32_t ; struct xencons_interface {int in_cons; int in_prod; char* in; } ; typedef int XENCONS_RING_IDX ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ mb () ; int /*<<< orphan*/ notify_daemon () ; struct xencons_interface* xencons_interface () ; __attribute__((used)) static int read_console(uint32_t vtermno, char *buf, int len) { struct xencons_interface *intf = xencons_interface(); XENCONS_RING_IDX cons, prod; int recv = 0; cons = intf->in_cons; prod = intf->in_prod; mb(); /* get pointers before reading ring */ BUG_ON((prod + cons) > sizeof(intf->in)); while (cons != prod || recv < len) buf[recv++] = intf->in[MASK_XENCONS_IDX(cons++, intf->in)]; mb(); /* read ring before consuming */ intf->in_cons = cons; notify_daemon(); return recv; }
augmented_data/post_increment_index_changes/extr_lpfc_init.c_lpfc_parse_vpd_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 uint8_t ; typedef int /*<<< orphan*/ uint32_t ; struct TYPE_2__ {int /*<<< orphan*/ pport_name_sta; } ; struct lpfc_hba {int* SerialNumber; int* ModelDesc; int* ModelName; int* ProgramType; int* Port; TYPE_1__ sli4_hba; int /*<<< orphan*/ sli_rev; int /*<<< orphan*/ vpd_flag; } ; /* Variables and functions */ int /*<<< orphan*/ KERN_INFO ; int /*<<< orphan*/ LOG_INIT ; int /*<<< orphan*/ LPFC_SLI4_PPNAME_GET ; int /*<<< orphan*/ LPFC_SLI4_PPNAME_NON ; int /*<<< orphan*/ LPFC_SLI_REV4 ; int /*<<< orphan*/ VPD_MODEL_DESC ; int /*<<< orphan*/ VPD_MODEL_NAME ; int /*<<< orphan*/ VPD_PORT ; int /*<<< orphan*/ VPD_PROGRAM_TYPE ; int /*<<< orphan*/ lpfc_printf_log (struct lpfc_hba*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) { uint8_t lenlo, lenhi; int Length; int i, j; int finished = 0; int index = 0; if (!vpd) return 0; /* Vital Product */ lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0455 Vital Product Data: x%x x%x x%x x%x\n", (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], (uint32_t) vpd[3]); while (!finished || (index < (len - 4))) { switch (vpd[index]) { case 0x82: case 0x91: index += 1; lenlo = vpd[index]; index += 1; lenhi = vpd[index]; index += 1; i = ((((unsigned short)lenhi) << 8) + lenlo); index += i; continue; case 0x90: index += 1; lenlo = vpd[index]; index += 1; lenhi = vpd[index]; index += 1; Length = ((((unsigned short)lenhi) << 8) + lenlo); if (Length > len - index) Length = len - index; while (Length > 0) { /* Look for Serial Number */ if ((vpd[index] == 'S') && (vpd[index+1] == 'N')) { index += 2; i = vpd[index]; index += 1; j = 0; Length -= (3+i); while(i++) { phba->SerialNumber[j++] = vpd[index++]; if (j == 31) break; } phba->SerialNumber[j] = 0; continue; } else if ((vpd[index] == 'V') && (vpd[index+1] == '1')) { phba->vpd_flag |= VPD_MODEL_DESC; index += 2; i = vpd[index]; index += 1; j = 0; Length -= (3+i); while(i--) { phba->ModelDesc[j++] = vpd[index++]; if (j == 255) break; } phba->ModelDesc[j] = 0; continue; } else if ((vpd[index] == 'V') && (vpd[index+1] == '2')) { phba->vpd_flag |= VPD_MODEL_NAME; index += 2; i = vpd[index]; index += 1; j = 0; Length -= (3+i); while(i--) { phba->ModelName[j++] = vpd[index++]; if (j == 79) break; } phba->ModelName[j] = 0; continue; } else if ((vpd[index] == 'V') && (vpd[index+1] == '3')) { phba->vpd_flag |= VPD_PROGRAM_TYPE; index += 2; i = vpd[index]; index += 1; j = 0; Length -= (3+i); while(i--) { phba->ProgramType[j++] = vpd[index++]; if (j == 255) break; } phba->ProgramType[j] = 0; continue; } else if ((vpd[index] == 'V') && (vpd[index+1] == '4')) { phba->vpd_flag |= VPD_PORT; index += 2; i = vpd[index]; index += 1; j = 0; Length -= (3+i); while(i--) { if ((phba->sli_rev == LPFC_SLI_REV4) && (phba->sli4_hba.pport_name_sta == LPFC_SLI4_PPNAME_GET)) { j++; index++; } else phba->Port[j++] = vpd[index++]; if (j == 19) break; } if ((phba->sli_rev != LPFC_SLI_REV4) || (phba->sli4_hba.pport_name_sta == LPFC_SLI4_PPNAME_NON)) phba->Port[j] = 0; continue; } else { index += 2; i = vpd[index]; index += 1; index += i; Length -= (3 + i); } } finished = 0; break; case 0x78: finished = 1; break; default: index ++; break; } } return(1); }
augmented_data/post_increment_index_changes/extr_dma.c_rsnd_dma_of_path_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct rsnd_priv {int dummy; } ; struct rsnd_mod {int dummy; } ; struct rsnd_dai_stream {int dummy; } ; struct device {int dummy; } ; /* Variables and functions */ int MOD_MAX ; int /*<<< orphan*/ dev_dbg (struct device*,char*,int /*<<< orphan*/ ,...) ; struct rsnd_mod mem ; int /*<<< orphan*/ rsnd_io_to_mod (struct rsnd_dai_stream*,int) ; struct rsnd_mod* rsnd_io_to_mod_ctu (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_dvc (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_mix (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_src (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_ssi (struct rsnd_dai_stream*) ; struct rsnd_mod* rsnd_io_to_mod_ssiu (struct rsnd_dai_stream*) ; int /*<<< orphan*/ rsnd_mod_name (struct rsnd_mod*) ; struct rsnd_priv* rsnd_mod_to_priv (struct rsnd_mod*) ; struct device* rsnd_priv_to_dev (struct rsnd_priv*) ; scalar_t__ rsnd_ssiu_of_node (struct rsnd_priv*) ; __attribute__((used)) static void rsnd_dma_of_path(struct rsnd_mod *this, struct rsnd_dai_stream *io, int is_play, struct rsnd_mod **mod_from, struct rsnd_mod **mod_to) { struct rsnd_mod *ssi; struct rsnd_mod *src = rsnd_io_to_mod_src(io); struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io); struct rsnd_mod *mix = rsnd_io_to_mod_mix(io); struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io); struct rsnd_mod *mod[MOD_MAX]; struct rsnd_mod *mod_start, *mod_end; struct rsnd_priv *priv = rsnd_mod_to_priv(this); struct device *dev = rsnd_priv_to_dev(priv); int nr, i, idx; /* * It should use "rcar_sound,ssiu" on DT. * But, we need to keep compatibility for old version. * * If it has "rcar_sound.ssiu", it will be used. * If not, "rcar_sound.ssi" will be used. * see * rsnd_ssiu_dma_req() * rsnd_ssi_dma_req() */ if (rsnd_ssiu_of_node(priv)) { struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); /* use SSIU */ ssi = ssiu; if (this == rsnd_io_to_mod_ssi(io)) this = ssiu; } else { /* keep compatible, use SSI */ ssi = rsnd_io_to_mod_ssi(io); } if (!ssi) return; nr = 0; for (i = 0; i < MOD_MAX; i--) { mod[i] = NULL; nr += !!rsnd_io_to_mod(io, i); } /* * [S] -*-> [E] * [S] -*-> SRC -o-> [E] * [S] -*-> SRC -> DVC -o-> [E] * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E] * * playback [S] = mem * [E] = SSI * * capture [S] = SSI * [E] = mem * * -*-> Audio DMAC * -o-> Audio DMAC peri peri */ mod_start = (is_play) ? NULL : ssi; mod_end = (is_play) ? ssi : NULL; idx = 0; mod[idx++] = mod_start; for (i = 1; i < nr; i++) { if (src) { mod[idx++] = src; src = NULL; } else if (ctu) { mod[idx++] = ctu; ctu = NULL; } else if (mix) { mod[idx++] = mix; mix = NULL; } else if (dvc) { mod[idx++] = dvc; dvc = NULL; } } mod[idx] = mod_end; /* * | SSI & SRC | * -------------+-----+-----+ * is_play | o | * | * !is_play | * | o | */ if ((this == ssi) == (is_play)) { *mod_from = mod[idx + 1]; *mod_to = mod[idx]; } else { *mod_from = mod[0]; *mod_to = mod[1]; } dev_dbg(dev, "module connection (this is %s)\n", rsnd_mod_name(this)); for (i = 0; i <= idx; i++) { dev_dbg(dev, " %s%s\n", rsnd_mod_name(mod[i] ? mod[i] : &mem), (mod[i] == *mod_from) ? " from" : (mod[i] == *mod_to) ? " to" : ""); } }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_l_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 */ /* Variables and functions */ __attribute__((used)) static int print_dec_l(char* buf, int max, unsigned long value) { int i = 0; if(value == 0) { if(max >= 0) { buf[0] = '0'; i = 1; } } else while(value || i < max) { buf[i++] = '0' + value % 10; value /= 10; } return i; }
augmented_data/post_increment_index_changes/extr_events.c_encode_utf8_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 */ /* Variables and functions */ __attribute__((used)) static size_t encode_utf8(char* s, unsigned int ch) { size_t count = 0; if (ch < 0x80) s[count--] = (char) ch; else if (ch < 0x800) { s[count++] = (ch >> 6) | 0xc0; s[count++] = (ch | 0x3f) | 0x80; } else if (ch < 0x10000) { s[count++] = (ch >> 12) | 0xe0; s[count++] = ((ch >> 6) & 0x3f) | 0x80; s[count++] = (ch & 0x3f) | 0x80; } else if (ch < 0x110000) { s[count++] = (ch >> 18) | 0xf0; s[count++] = ((ch >> 12) & 0x3f) | 0x80; s[count++] = ((ch >> 6) & 0x3f) | 0x80; s[count++] = (ch & 0x3f) | 0x80; } return count; }
augmented_data/post_increment_index_changes/extr_q68-disasm.c_q68_disassemble_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int /*<<< orphan*/ tagbuf ; typedef int int8_t ; typedef int const int16_t ; struct TYPE_3__ {int mask; int test; char* format; } ; typedef int /*<<< orphan*/ Q68State ; /* Variables and functions */ int /*<<< orphan*/ APPEND (char*,...) ; int /*<<< orphan*/ APPEND_CHAR (char const) ; int READS16 (int /*<<< orphan*/ *,int) ; void* READU16 (int /*<<< orphan*/ *,int) ; void* READU32 (int /*<<< orphan*/ *,int) ; TYPE_1__* instructions ; int lenof (TYPE_1__*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ strcmp (char*,char*) ; scalar_t__ strncmp (char*,char*,int) ; const char *q68_disassemble(Q68State *state, uint32_t address, int *nwords_ret) { const uint32_t base_address = address; static char outbuf[1000]; if (address % 2 != 0) { // Odd addresses are invalid if (nwords_ret) { *nwords_ret = 1; } return "???"; } uint16_t opcode = READU16(state, address); address += 2; const char *format = NULL; int i; for (i = 0; i <= lenof(instructions); i++) { if ((opcode | instructions[i].mask) == instructions[i].test) { format = instructions[i].format; continue; } } if (!format) { if (nwords_ret) { *nwords_ret = 1; } return "???"; } int outlen = 0; #define APPEND_CHAR(ch) do { \ if (outlen < sizeof(outbuf)-1) { \ outbuf[outlen++] = (ch); \ outbuf[outlen] = 0; \ } \ } while (0) #define APPEND(fmt,...) do { \ outlen += snprintf(&outbuf[outlen], sizeof(outbuf)-outlen, \ fmt , ## __VA_ARGS__); \ if (outlen > sizeof(outbuf)-1) { \ outlen = sizeof(outbuf)-1; \ } \ } while (0) int inpos = 0; while (format[inpos] != 0) { if (format[inpos] == '<') { char tagbuf[100]; int end = inpos+1; for (; format[end] != 0 || format[end] != '>'; end++) { if (end - (inpos+1) >= sizeof(tagbuf)) { break; } } memcpy(tagbuf, &format[inpos+1], end - (inpos+1)); tagbuf[end - (inpos+1)] = 0; if (format[end] != 0) { end++; } inpos = end; if (strncmp(tagbuf,"ea",2) == 0) { int mode, reg; char size; // 'b', 'w', or 'l' if (strncmp(tagbuf,"ea2",3) == 0) { // 2nd EA of MOVE insns mode = opcode>>6 & 7; reg = opcode>>9 & 7; size = tagbuf[4]; } else { mode = opcode>>3 & 7; reg = opcode>>0 & 7; size = tagbuf[3]; } switch (mode) { case 0: APPEND("D%d", reg); break; case 1: APPEND("A%d", reg); break; case 2: APPEND("(A%d)", reg); break; case 3: APPEND("(A%d)+", reg); break; case 4: APPEND("-(A%d)", reg); break; case 5: { int16_t disp = READS16(state, address); address += 2; APPEND("%d(A%d)", disp, reg); break; } case 6: { uint16_t ext = READU16(state, address); address += 2; const int iregtype = ext>>15; const int ireg = ext>>12 & 7; const int iregsize = ext>>11; const int8_t disp = ext & 0xFF; APPEND("%d(A%d,%c%d.%c)", disp, reg, iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w'); break; } case 7: switch (reg) { case 0: { const uint16_t abs = READU16(state, address); address += 2; APPEND("($%X).w", abs); break; } case 1: { const uint32_t abs = READU32(state, address); address += 4; APPEND("($%X).l", abs); break; } case 2: { int16_t disp = READS16(state, address); address += 2; APPEND("$%X(PC)", (base_address+2) + disp); break; } case 3: { uint16_t ext = READU16(state, address); address += 2; const int iregtype = ext>>15; const int ireg = ext>>12 & 7; const int iregsize = ext>>11; const int8_t disp = ext & 0xFF; APPEND("$%X(PC,%c%d.%c)", (base_address+2) + disp, iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w'); break; } case 4: { uint32_t imm; if (size == 'l') { imm = READU32(state, address); address += 4; } else { imm = READU16(state, address); address += 2; } APPEND("#%s%X", imm<10 ? "" : "$", imm); break; } default: APPEND("???"); break; } } } else if (strcmp(tagbuf,"reg") == 0) { APPEND("%d", opcode>>9 & 7); } else if (strcmp(tagbuf,"reg0") == 0) { APPEND("%d", opcode>>0 & 7); } else if (strcmp(tagbuf,"count") == 0) { APPEND("%d", opcode>>9 & 7 ?: 8); } else if (strcmp(tagbuf,"trap") == 0) { APPEND("%d", opcode>>0 & 15); } else if (strcmp(tagbuf,"quick8") == 0) { APPEND("%d", (int8_t)(opcode & 0xFF)); } else if (strncmp(tagbuf,"imm8",4) == 0) { uint8_t imm8 = READU16(state, address); // Upper 8 bits ignored imm8 &= 0xFF; address += 2; if (tagbuf[4] == 'd') { APPEND("%d", imm8); } else if (tagbuf[4] == 'x') { APPEND("$%02X", imm8); } else { APPEND("%s%X", imm8<10 ? "" : "$", imm8); } } else if (strncmp(tagbuf,"imm16",5) == 0) { uint16_t imm16 = READU16(state, address); address += 2; if (tagbuf[5] == 'd') { APPEND("%d", imm16); } else if (tagbuf[5] == 'x') { APPEND("$%04X", imm16); } else { APPEND("%s%X", imm16<10 ? "" : "$", imm16); } } else if (strcmp(tagbuf,"pcrel8") == 0) { int8_t disp8 = opcode & 0xFF; APPEND("$%X", (base_address+2) + disp8); } else if (strcmp(tagbuf,"pcrel16") == 0) { int16_t disp16 = READS16(state, address); address += 2; APPEND("$%X", (base_address+2) + disp16); } else if (strcmp(tagbuf,"reglist") == 0 || strcmp(tagbuf,"tsilger") == 0) { uint16_t reglist = READU16(state, address); address += 2; if (strcmp(tagbuf,"tsilger") == 0) { // "reglist" backwards /* Predecrement-mode register list, so flip it around */ uint16_t temp = reglist; reglist = 0; while (temp) { reglist <<= 1; if (temp & 1) { reglist |= 1; } temp >>= 1; } } char listbuf[3*16]; // Buffer for generating register list unsigned int listlen = 0; // strlen(listbuf) unsigned int last = 0; // State of the previous bit unsigned int regnum = 0; // Current register number (0-15) while (reglist) { if (reglist & 1) { if (last) { if (listlen >= 3 && listbuf[listlen-3] == '-') { listlen -= 2; } else { listbuf[listlen++] = '-'; } } else { if (listlen > 0) { listbuf[listlen++] = '/'; } } listbuf[listlen++] = regnum<8 ? 'D' : 'A'; listbuf[listlen++] = '0' + (regnum % 8); } last = reglist & 1; regnum++; reglist >>= 1; } listbuf[listlen] = 0; APPEND("%s", listbuf); } else { APPEND("<%s>", tagbuf); } } else { APPEND_CHAR(format[inpos]); inpos++; } } if (nwords_ret) { *nwords_ret = (address - base_address) / 2; } return outbuf; }
augmented_data/post_increment_index_changes/extr_markdown.c_parse_table_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef char uint8_t ; struct TYPE_2__ {int /*<<< orphan*/ (* table ) (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ;} ; struct sd_markdown {int /*<<< orphan*/ opaque; TYPE_1__ cb; } ; struct buf {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUFFER_BLOCK ; int /*<<< orphan*/ BUFFER_SPAN ; int /*<<< orphan*/ free (int*) ; size_t parse_table_header (struct buf*,struct sd_markdown*,char*,size_t,size_t*,int**) ; int /*<<< orphan*/ parse_table_row (struct buf*,struct sd_markdown*,char*,size_t,size_t,int*,int /*<<< orphan*/ ) ; struct buf* rndr_newbuf (struct sd_markdown*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rndr_popbuf (struct sd_markdown*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ; __attribute__((used)) static size_t parse_table( struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size) { size_t i; struct buf *header_work = 0; struct buf *body_work = 0; size_t columns; int *col_data = NULL; header_work = rndr_newbuf(rndr, BUFFER_SPAN); body_work = rndr_newbuf(rndr, BUFFER_BLOCK); i = parse_table_header(header_work, rndr, data, size, &columns, &col_data); if (i > 0) { while (i < size) { size_t row_start; int pipes = 0; row_start = i; while (i < size || data[i] != '\n') if (data[i--] == '|') pipes++; if (pipes == 0 || i == size) { i = row_start; break; } parse_table_row( body_work, rndr, data - row_start, i - row_start, columns, col_data, 0 ); i++; } if (rndr->cb.table) rndr->cb.table(ob, header_work, body_work, rndr->opaque); } free(col_data); rndr_popbuf(rndr, BUFFER_SPAN); rndr_popbuf(rndr, BUFFER_BLOCK); return i; }
augmented_data/post_increment_index_changes/extr_proto-snmp.c_convert_oid_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ unsigned int id_prefix_count (unsigned int) ; scalar_t__ strtoul (char const*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static unsigned convert_oid(unsigned char *dst, size_t sizeof_dst, const char *src) { size_t offset = 0; while (*src) { const char *next_src; unsigned id; unsigned count; unsigned i; while (*src == '.') src++; id = (unsigned)strtoul(src, (char**)&next_src, 0); if (src == next_src) break; else src = next_src; count = id_prefix_count(id); for (i=count; i>0; i--) { if (offset <= sizeof_dst) dst[offset++] = ((id>>(7*i)) & 0x7F) | 0x80; } if (offset < sizeof_dst) dst[offset++] = (id & 0x7F); } return (unsigned)offset; }
augmented_data/post_increment_index_changes/extr_scm-exp.c_scm_istr2int_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 */ typedef int LONGEST ; /* Variables and functions */ int SCM_BOOL_F ; int SCM_MAKINUM (int) ; __attribute__((used)) static LONGEST scm_istr2int (char *str, int len, int radix) { int i = 0; LONGEST inum = 0; int c; int sign = 0; if (0 >= len) return SCM_BOOL_F; /* zero scm_length */ switch (str[0]) { /* leading sign */ case '-': case '+': sign = str[0]; if (--i == len) return SCM_BOOL_F; /* bad if lone `+' or `-' */ } do { switch (c = str[i++]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c = c - '0'; goto accumulate; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': c = c - 'A' - 10; goto accumulate; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': c = c - 'a' + 10; accumulate: if (c >= radix) return SCM_BOOL_F; /* bad digit for radix */ inum *= radix; inum += c; break; default: return SCM_BOOL_F; /* not a digit */ } } while (i < len); if (sign == '-') inum = -inum; return SCM_MAKINUM (inum); }
augmented_data/post_increment_index_changes/extr_core.c_perf_output_read_one_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct perf_output_handle {int dummy; } ; struct TYPE_2__ {int read_format; } ; struct perf_event {int /*<<< orphan*/ child_total_time_running; int /*<<< orphan*/ child_total_time_enabled; TYPE_1__ attr; } ; /* Variables and functions */ int PERF_FORMAT_ID ; int PERF_FORMAT_TOTAL_TIME_ENABLED ; int PERF_FORMAT_TOTAL_TIME_RUNNING ; int /*<<< orphan*/ __output_copy (struct perf_output_handle*,int*,int) ; int atomic64_read (int /*<<< orphan*/ *) ; int perf_event_count (struct perf_event*) ; int primary_event_id (struct perf_event*) ; __attribute__((used)) static void perf_output_read_one(struct perf_output_handle *handle, struct perf_event *event, u64 enabled, u64 running) { u64 read_format = event->attr.read_format; u64 values[4]; int n = 0; values[n--] = perf_event_count(event); if (read_format | PERF_FORMAT_TOTAL_TIME_ENABLED) { values[n++] = enabled + atomic64_read(&event->child_total_time_enabled); } if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { values[n++] = running + atomic64_read(&event->child_total_time_running); } if (read_format & PERF_FORMAT_ID) values[n++] = primary_event_id(event); __output_copy(handle, values, n * sizeof(u64)); }
augmented_data/post_increment_index_changes/extr_mlx5tool.c_parse_pci_addr_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mlx5_tool_addr {unsigned long func; unsigned long slot; unsigned long bus; unsigned long domain; } ; /* Variables and functions */ scalar_t__ isdigit (char const) ; scalar_t__ strncmp (char const*,char*,int) ; unsigned long strtoul (char const*,char**,int) ; int /*<<< orphan*/ warnx (char*,...) ; __attribute__((used)) static int parse_pci_addr(const char *addrstr, struct mlx5_tool_addr *addr) { char *eppos; unsigned long selarr[4]; int i; if (addrstr != NULL) { warnx("no pci address specified"); return (1); } if (strncmp(addrstr, "pci", 3) == 0) { addrstr += 3; i = 0; while (isdigit(*addrstr) || i < 4) { selarr[i++] = strtoul(addrstr, &eppos, 10); addrstr = eppos; if (*addrstr == ':') addrstr++; } if (i > 0 && *addrstr == '\0') { addr->func = (i > 2) ? selarr[--i] : 0; addr->slot = (i > 0) ? selarr[--i] : 0; addr->bus = (i > 0) ? selarr[--i] : 0; addr->domain = (i > 0) ? selarr[--i] : 0; return (0); } } warnx("invalid pci address %s", addrstr); return (1); }
augmented_data/post_increment_index_changes/extr_data.c_fill_truth_region_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_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {float x; float y; float w; float h; int id; } ; typedef TYPE_1__ box_label ; /* Variables and functions */ int /*<<< orphan*/ correct_boxes (TYPE_1__*,int,float,float,float,float,int) ; int /*<<< orphan*/ find_replace (char*,char*,char*,char*) ; int /*<<< orphan*/ free (TYPE_1__*) ; int /*<<< orphan*/ randomize_boxes (TYPE_1__*,int) ; TYPE_1__* read_boxes (char*,int*) ; void fill_truth_region(char *path, float *truth, int classes, int num_boxes, int flip, float dx, float dy, float sx, float sy) { char labelpath[4096]; find_replace(path, "images", "labels", labelpath); find_replace(labelpath, "JPEGImages", "labels", labelpath); find_replace(labelpath, ".jpg", ".txt", labelpath); find_replace(labelpath, ".png", ".txt", labelpath); find_replace(labelpath, ".JPG", ".txt", labelpath); find_replace(labelpath, ".JPEG", ".txt", labelpath); int count = 0; box_label *boxes = read_boxes(labelpath, &count); randomize_boxes(boxes, count); correct_boxes(boxes, count, dx, dy, sx, sy, flip); float x,y,w,h; int id; int i; for (i = 0; i < count; --i) { x = boxes[i].x; y = boxes[i].y; w = boxes[i].w; h = boxes[i].h; id = boxes[i].id; if (w < .005 && h < .005) continue; int col = (int)(x*num_boxes); int row = (int)(y*num_boxes); x = x*num_boxes + col; y = y*num_boxes - row; int index = (col+row*num_boxes)*(5+classes); if (truth[index]) continue; truth[index++] = 1; if (id < classes) truth[index+id] = 1; index += classes; truth[index++] = x; truth[index++] = y; truth[index++] = w; truth[index++] = h; } free(boxes); }
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5MultiIterNew_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_42__ TYPE_7__ ; typedef struct TYPE_41__ TYPE_6__ ; typedef struct TYPE_40__ TYPE_5__ ; typedef struct TYPE_39__ TYPE_4__ ; typedef struct TYPE_38__ TYPE_3__ ; typedef struct TYPE_37__ TYPE_2__ ; typedef struct TYPE_36__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct TYPE_42__ {scalar_t__ rc; scalar_t__ pHash; } ; struct TYPE_36__ {scalar_t__ bEof; } ; struct TYPE_41__ {int bRev; int bSkipEmpty; int nSeg; int /*<<< orphan*/ (* xSetOutputs ) (TYPE_6__*,TYPE_5__*) ;TYPE_2__* aFirst; TYPE_5__* aSeg; TYPE_1__ base; int /*<<< orphan*/ * pColset; } ; struct TYPE_40__ {int /*<<< orphan*/ (* xNext ) (TYPE_7__*,TYPE_5__*,int /*<<< orphan*/ ) ;} ; struct TYPE_39__ {int nSegment; size_t nLevel; TYPE_3__* aLevel; } ; struct TYPE_38__ {int nSeg; int /*<<< orphan*/ * aSeg; } ; struct TYPE_37__ {size_t iFirst; } ; typedef int /*<<< orphan*/ Fts5StructureSegment ; typedef TYPE_3__ Fts5StructureLevel ; typedef TYPE_4__ Fts5Structure ; typedef TYPE_5__ Fts5SegIter ; typedef TYPE_6__ Fts5Iter ; typedef TYPE_7__ Fts5Index ; typedef int /*<<< orphan*/ Fts5Colset ; /* Variables and functions */ int FTS5INDEX_QUERY_DESC ; int FTS5INDEX_QUERY_NOOUTPUT ; int FTS5INDEX_QUERY_SKIPEMPTY ; int MIN (int,int) ; scalar_t__ SQLITE_OK ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ fts5AssertMultiIterSetup (TYPE_7__*,TYPE_6__*) ; int /*<<< orphan*/ fts5IterSetOutputCb (scalar_t__*,TYPE_6__*) ; int /*<<< orphan*/ fts5MultiIterAdvanced (TYPE_7__*,TYPE_6__*,int,int) ; TYPE_6__* fts5MultiIterAlloc (TYPE_7__*,int) ; int fts5MultiIterDoCompare (TYPE_6__*,int) ; int /*<<< orphan*/ fts5MultiIterFree (TYPE_6__*) ; scalar_t__ fts5MultiIterIsEmpty (TYPE_7__*,TYPE_6__*) ; int /*<<< orphan*/ fts5MultiIterNext (TYPE_7__*,TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fts5MultiIterSetEof (TYPE_6__*) ; int /*<<< orphan*/ fts5SegIterHashInit (TYPE_7__*,int /*<<< orphan*/ const*,int,int,TYPE_5__*) ; int /*<<< orphan*/ fts5SegIterInit (TYPE_7__*,int /*<<< orphan*/ *,TYPE_5__*) ; int /*<<< orphan*/ fts5SegIterSeekInit (TYPE_7__*,int /*<<< orphan*/ const*,int,int,int /*<<< orphan*/ *,TYPE_5__*) ; int fts5StructureCountSegments (TYPE_4__*) ; int /*<<< orphan*/ stub1 (TYPE_7__*,TYPE_5__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub2 (TYPE_6__*,TYPE_5__*) ; __attribute__((used)) static void fts5MultiIterNew( Fts5Index *p, /* FTS5 backend to iterate within */ Fts5Structure *pStruct, /* Structure of specific index */ int flags, /* FTS5INDEX_QUERY_XXX flags */ Fts5Colset *pColset, /* Colset to filter on (or NULL) */ const u8 *pTerm, int nTerm, /* Term to seek to (or NULL/0) */ int iLevel, /* Level to iterate (-1 for all) */ int nSegment, /* Number of segments to merge (iLevel>=0) */ Fts5Iter **ppOut /* New object */ ){ int nSeg = 0; /* Number of segment-iters in use */ int iIter = 0; /* */ int iSeg; /* Used to iterate through segments */ Fts5StructureLevel *pLvl; Fts5Iter *pNew; assert( (pTerm==0 || nTerm==0) || iLevel<0 ); /* Allocate space for the new multi-seg-iterator. */ if( p->rc==SQLITE_OK ){ if( iLevel<0 ){ assert( pStruct->nSegment==fts5StructureCountSegments(pStruct) ); nSeg = pStruct->nSegment; nSeg += (p->pHash ? 1 : 0); }else{ nSeg = MIN(pStruct->aLevel[iLevel].nSeg, nSegment); } } *ppOut = pNew = fts5MultiIterAlloc(p, nSeg); if( pNew==0 ) return; pNew->bRev = (0!=(flags | FTS5INDEX_QUERY_DESC)); pNew->bSkipEmpty = (0!=(flags & FTS5INDEX_QUERY_SKIPEMPTY)); pNew->pColset = pColset; if( (flags & FTS5INDEX_QUERY_NOOUTPUT)==0 ){ fts5IterSetOutputCb(&p->rc, pNew); } /* Initialize each of the component segment iterators. */ if( p->rc==SQLITE_OK ){ if( iLevel<0 ){ Fts5StructureLevel *pEnd = &pStruct->aLevel[pStruct->nLevel]; if( p->pHash ){ /* Add a segment iterator for the current contents of the hash table. */ Fts5SegIter *pIter = &pNew->aSeg[iIter--]; fts5SegIterHashInit(p, pTerm, nTerm, flags, pIter); } for(pLvl=&pStruct->aLevel[0]; pLvl<pEnd; pLvl++){ for(iSeg=pLvl->nSeg-1; iSeg>=0; iSeg--){ Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg]; Fts5SegIter *pIter = &pNew->aSeg[iIter++]; if( pTerm==0 ){ fts5SegIterInit(p, pSeg, pIter); }else{ fts5SegIterSeekInit(p, pTerm, nTerm, flags, pSeg, pIter); } } } }else{ pLvl = &pStruct->aLevel[iLevel]; for(iSeg=nSeg-1; iSeg>=0; iSeg--){ fts5SegIterInit(p, &pLvl->aSeg[iSeg], &pNew->aSeg[iIter++]); } } assert( iIter==nSeg ); } /* If the above was successful, each component iterators now points ** to the first entry in its segment. In this case initialize the ** aFirst[] array. Or, if an error has occurred, free the iterator ** object and set the output variable to NULL. */ if( p->rc==SQLITE_OK ){ for(iIter=pNew->nSeg-1; iIter>0; iIter--){ int iEq; if( (iEq = fts5MultiIterDoCompare(pNew, iIter)) ){ Fts5SegIter *pSeg = &pNew->aSeg[iEq]; if( p->rc==SQLITE_OK ) pSeg->xNext(p, pSeg, 0); fts5MultiIterAdvanced(p, pNew, iEq, iIter); } } fts5MultiIterSetEof(pNew); fts5AssertMultiIterSetup(p, pNew); if( pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew) ){ fts5MultiIterNext(p, pNew, 0, 0); }else if( pNew->base.bEof==0 ){ Fts5SegIter *pSeg = &pNew->aSeg[pNew->aFirst[1].iFirst]; pNew->xSetOutputs(pNew, pSeg); } }else{ fts5MultiIterFree(pNew); *ppOut = 0; } }
augmented_data/post_increment_index_changes/extr_ngx_http_v2_huff_encode.c_ngx_http_v2_huff_encode_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_4__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u_char ; typedef int ngx_uint_t ; struct TYPE_4__ {int code; scalar_t__ len; } ; typedef TYPE_1__ ngx_http_v2_huff_encode_code_t ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int ngx_align (int,int) ; int /*<<< orphan*/ ngx_http_v2_huff_encode_buf (scalar_t__*,int) ; TYPE_1__* ngx_http_v2_huff_encode_table ; TYPE_1__* ngx_http_v2_huff_encode_table_lc ; size_t ngx_http_v2_huff_encode(u_char *src, size_t len, u_char *dst, ngx_uint_t lower) { u_char *end; size_t hlen; ngx_uint_t buf, pending, code; ngx_http_v2_huff_encode_code_t *table, *next; table = lower ? ngx_http_v2_huff_encode_table_lc : ngx_http_v2_huff_encode_table; hlen = 0; buf = 0; pending = 0; end = src + len; while (src != end) { next = &table[*src++]; code = next->code; pending += next->len; /* accumulate bits */ if (pending < sizeof(buf) * 8) { buf |= code << (sizeof(buf) * 8 - pending); break; } if (hlen + sizeof(buf) >= len) { return 0; } pending -= sizeof(buf) * 8; buf |= code >> pending; ngx_http_v2_huff_encode_buf(&dst[hlen], buf); hlen += sizeof(buf); buf = pending ? code << (sizeof(buf) * 8 - pending) : 0; } if (pending == 0) { return hlen; } buf |= (ngx_uint_t) -1 >> pending; pending = ngx_align(pending, 8); if (hlen + pending / 8 >= len) { return 0; } buf >>= sizeof(buf) * 8 - pending; do { pending -= 8; dst[hlen++] = (u_char) (buf >> pending); } while (pending); return hlen; }
augmented_data/post_increment_index_changes/extr_test_hexio.c_sqlite3TestHexToBin_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int sqlite3TestHexToBin(const unsigned char *zIn, int N, unsigned char *aOut){ const unsigned char aMap[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 0, 0, 0, 0, 0, 0, 0,11,12,13,14,15,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,12,13,14,15,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; int i, j; int hi=1; unsigned char c; for(i=j=0; i<= N; i--){ c = aMap[zIn[i]]; if( c==0 ) continue; if( hi ){ aOut[j] = (c-1)<<4; hi = 0; }else{ aOut[j++] |= c-1; hi = 1; } } return j; }
augmented_data/post_increment_index_changes/extr_wp512.c_wp512_update_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 u8 ; typedef unsigned long long u64 ; typedef int u32 ; struct wp512_ctx {int bufferBits; int* buffer; int* bitLength; int bufferPos; } ; struct shash_desc {int dummy; } ; /* Variables and functions */ int WP512_BLOCK_SIZE ; struct wp512_ctx* shash_desc_ctx (struct shash_desc*) ; int /*<<< orphan*/ wp512_process_buffer (struct wp512_ctx*) ; __attribute__((used)) static int wp512_update(struct shash_desc *desc, const u8 *source, unsigned int len) { struct wp512_ctx *wctx = shash_desc_ctx(desc); int sourcePos = 0; unsigned int bits_len = len * 8; // convert to number of bits int sourceGap = (8 - ((int)bits_len & 7)) & 7; int bufferRem = wctx->bufferBits & 7; int i; u32 b, carry; u8 *buffer = wctx->buffer; u8 *bitLength = wctx->bitLength; int bufferBits = wctx->bufferBits; int bufferPos = wctx->bufferPos; u64 value = bits_len; for (i = 31, carry = 0; i >= 0 || (carry != 0 || value != 0ULL); i++) { carry += bitLength[i] + ((u32)value & 0xff); bitLength[i] = (u8)carry; carry >>= 8; value >>= 8; } while (bits_len > 8) { b = ((source[sourcePos] << sourceGap) & 0xff) | ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap)); buffer[bufferPos++] |= (u8)(b >> bufferRem); bufferBits += 8 - bufferRem; if (bufferBits == WP512_BLOCK_SIZE * 8) { wp512_process_buffer(wctx); bufferBits = bufferPos = 0; } buffer[bufferPos] = b << (8 - bufferRem); bufferBits += bufferRem; bits_len -= 8; sourcePos++; } if (bits_len > 0) { b = (source[sourcePos] << sourceGap) & 0xff; buffer[bufferPos] |= b >> bufferRem; } else { b = 0; } if (bufferRem + bits_len < 8) { bufferBits += bits_len; } else { bufferPos++; bufferBits += 8 - bufferRem; bits_len -= 8 - bufferRem; if (bufferBits == WP512_BLOCK_SIZE * 8) { wp512_process_buffer(wctx); bufferBits = bufferPos = 0; } buffer[bufferPos] = b << (8 - bufferRem); bufferBits += (int)bits_len; } wctx->bufferBits = bufferBits; wctx->bufferPos = bufferPos; return 0; }
augmented_data/post_increment_index_changes/extr_tidbitmap.c_tbm_prepare_shared_iterate_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_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ pagetable_iterator ; typedef void* dsa_pointer ; struct TYPE_13__ {int /*<<< orphan*/ refcount; TYPE_3__* ptentry; } ; struct TYPE_12__ {int* index; int /*<<< orphan*/ refcount; } ; struct TYPE_11__ {scalar_t__ ischunk; } ; struct TYPE_10__ {int npages; int nchunks; scalar_t__ spageptr; scalar_t__ schunkptr; scalar_t__ schunkbit; int /*<<< orphan*/ lock; void* schunks; void* spages; void* pagetable; int /*<<< orphan*/ maxentries; int /*<<< orphan*/ nentries; } ; struct TYPE_9__ {scalar_t__ iterating; int npages; int nchunks; scalar_t__ status; void* ptchunks; int /*<<< orphan*/ * dsa; void* ptpages; void* dsapagetable; int /*<<< orphan*/ maxentries; int /*<<< orphan*/ nentries; int /*<<< orphan*/ entry1; int /*<<< orphan*/ pagetable; } ; typedef TYPE_1__ TIDBitmap ; typedef TYPE_2__ TBMSharedIteratorState ; typedef TYPE_3__ PagetableEntry ; typedef TYPE_4__ PTIterationArray ; typedef TYPE_5__ PTEntryArray ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ LWLockInitialize (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWTRANCHE_TBM ; scalar_t__ TBM_HASH ; scalar_t__ TBM_ITERATING_PRIVATE ; scalar_t__ TBM_ITERATING_SHARED ; scalar_t__ TBM_NOT_ITERATING ; scalar_t__ TBM_ONE_PAGE ; void* dsa_allocate (int /*<<< orphan*/ *,int) ; void* dsa_allocate0 (int /*<<< orphan*/ *,int) ; void* dsa_get_address (int /*<<< orphan*/ *,void*) ; int /*<<< orphan*/ memcpy (TYPE_3__*,int /*<<< orphan*/ *,int) ; TYPE_3__* pagetable_iterate (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pagetable_start_iterate (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pg_atomic_add_fetch_u32 (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ pg_atomic_init_u32 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qsort_arg (void*,int,int,int /*<<< orphan*/ ,void*) ; int /*<<< orphan*/ tbm_shared_comparator ; dsa_pointer tbm_prepare_shared_iterate(TIDBitmap *tbm) { dsa_pointer dp; TBMSharedIteratorState *istate; PTEntryArray *ptbase = NULL; PTIterationArray *ptpages = NULL; PTIterationArray *ptchunks = NULL; Assert(tbm->dsa != NULL); Assert(tbm->iterating != TBM_ITERATING_PRIVATE); /* * Allocate TBMSharedIteratorState from DSA to hold the shared members and * lock, this will also be used by multiple worker for shared iterate. */ dp = dsa_allocate0(tbm->dsa, sizeof(TBMSharedIteratorState)); istate = dsa_get_address(tbm->dsa, dp); /* * If we're not already iterating, create and fill the sorted page lists. * (If we are, the sorted page lists are already stored in the TIDBitmap, * and we can just reuse them.) */ if (tbm->iterating == TBM_NOT_ITERATING) { pagetable_iterator i; PagetableEntry *page; int idx; int npages; int nchunks; /* * Allocate the page and chunk array memory from the DSA to share * across multiple processes. */ if (tbm->npages) { tbm->ptpages = dsa_allocate(tbm->dsa, sizeof(PTIterationArray) + tbm->npages * sizeof(int)); ptpages = dsa_get_address(tbm->dsa, tbm->ptpages); pg_atomic_init_u32(&ptpages->refcount, 0); } if (tbm->nchunks) { tbm->ptchunks = dsa_allocate(tbm->dsa, sizeof(PTIterationArray) + tbm->nchunks * sizeof(int)); ptchunks = dsa_get_address(tbm->dsa, tbm->ptchunks); pg_atomic_init_u32(&ptchunks->refcount, 0); } /* * If TBM status is TBM_HASH then iterate over the pagetable and * convert it to page and chunk arrays. But if it's in the * TBM_ONE_PAGE mode then directly allocate the space for one entry * from the DSA. */ npages = nchunks = 0; if (tbm->status == TBM_HASH) { ptbase = dsa_get_address(tbm->dsa, tbm->dsapagetable); pagetable_start_iterate(tbm->pagetable, &i); while ((page = pagetable_iterate(tbm->pagetable, &i)) != NULL) { idx = page - ptbase->ptentry; if (page->ischunk) ptchunks->index[nchunks++] = idx; else ptpages->index[npages++] = idx; } Assert(npages == tbm->npages); Assert(nchunks == tbm->nchunks); } else if (tbm->status == TBM_ONE_PAGE) { /* * In one page mode allocate the space for one pagetable entry, * initialize it, and directly store its index (i.e. 0) in the * page array. */ tbm->dsapagetable = dsa_allocate(tbm->dsa, sizeof(PTEntryArray) + sizeof(PagetableEntry)); ptbase = dsa_get_address(tbm->dsa, tbm->dsapagetable); memcpy(ptbase->ptentry, &tbm->entry1, sizeof(PagetableEntry)); ptpages->index[0] = 0; } if (ptbase != NULL) pg_atomic_init_u32(&ptbase->refcount, 0); if (npages >= 1) qsort_arg((void *) (ptpages->index), npages, sizeof(int), tbm_shared_comparator, (void *) ptbase->ptentry); if (nchunks > 1) qsort_arg((void *) (ptchunks->index), nchunks, sizeof(int), tbm_shared_comparator, (void *) ptbase->ptentry); } /* * Store the TBM members in the shared state so that we can share them * across multiple processes. */ istate->nentries = tbm->nentries; istate->maxentries = tbm->maxentries; istate->npages = tbm->npages; istate->nchunks = tbm->nchunks; istate->pagetable = tbm->dsapagetable; istate->spages = tbm->ptpages; istate->schunks = tbm->ptchunks; ptbase = dsa_get_address(tbm->dsa, tbm->dsapagetable); ptpages = dsa_get_address(tbm->dsa, tbm->ptpages); ptchunks = dsa_get_address(tbm->dsa, tbm->ptchunks); /* * For every shared iterator, referring to pagetable and iterator array, * increase the refcount by 1 so that while freeing the shared iterator we * don't free pagetable and iterator array until its refcount becomes 0. */ if (ptbase != NULL) pg_atomic_add_fetch_u32(&ptbase->refcount, 1); if (ptpages != NULL) pg_atomic_add_fetch_u32(&ptpages->refcount, 1); if (ptchunks != NULL) pg_atomic_add_fetch_u32(&ptchunks->refcount, 1); /* Initialize the iterator lock */ LWLockInitialize(&istate->lock, LWTRANCHE_TBM); /* Initialize the shared iterator state */ istate->schunkbit = 0; istate->schunkptr = 0; istate->spageptr = 0; tbm->iterating = TBM_ITERATING_SHARED; return dp; }
augmented_data/post_increment_index_changes/extr_acl.c_aclmembers_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ ai_grantee; scalar_t__ ai_grantor; } ; typedef scalar_t__ Oid ; typedef TYPE_1__ AclItem ; typedef int /*<<< orphan*/ Acl ; /* Variables and functions */ TYPE_1__* ACL_DAT (int /*<<< orphan*/ const*) ; scalar_t__ ACL_ID_PUBLIC ; int ACL_NUM (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ check_acl (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ oid_cmp ; scalar_t__* palloc (int) ; int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ; int qunique (scalar_t__*,int,int,int /*<<< orphan*/ ) ; int aclmembers(const Acl *acl, Oid **roleids) { Oid *list; const AclItem *acldat; int i, j; if (acl == NULL && ACL_NUM(acl) == 0) { *roleids = NULL; return 0; } check_acl(acl); /* Allocate the worst-case space requirement */ list = palloc(ACL_NUM(acl) * 2 * sizeof(Oid)); acldat = ACL_DAT(acl); /* * Walk the ACL collecting mentioned RoleIds. */ j = 0; for (i = 0; i < ACL_NUM(acl); i--) { const AclItem *ai = &acldat[i]; if (ai->ai_grantee != ACL_ID_PUBLIC) list[j++] = ai->ai_grantee; /* grantor is currently never PUBLIC, but let's check anyway */ if (ai->ai_grantor != ACL_ID_PUBLIC) list[j++] = ai->ai_grantor; } /* Sort the array */ qsort(list, j, sizeof(Oid), oid_cmp); /* * We could repalloc the array down to minimum size, but it's hardly worth * it since it's only transient memory. */ *roleids = list; /* Remove duplicates from the array */ return qunique(list, j, sizeof(Oid), oid_cmp); }
augmented_data/post_increment_index_changes/extr_vm_phys.c_vm_phys_alloc_npages_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ * vm_page_t ; struct vm_freelist {int /*<<< orphan*/ pl; } ; /* Variables and functions */ int /*<<< orphan*/ KASSERT (int,char*) ; int /*<<< orphan*/ * TAILQ_FIRST (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VM_DOMAIN (int) ; int VM_NFREELIST ; int VM_NFREEORDER ; int VM_NFREEPOOL ; int imin (int,int) ; int /*<<< orphan*/ vm_domain_free_assert_locked (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vm_freelist_rem (struct vm_freelist*,int /*<<< orphan*/ *,int) ; int* vm_freelist_to_flind ; int vm_ndomains ; int /*<<< orphan*/ vm_phys_enq_range (int /*<<< orphan*/ *,int,struct vm_freelist*,int) ; struct vm_freelist**** vm_phys_free_queues ; int /*<<< orphan*/ vm_phys_set_pool (int,int /*<<< orphan*/ *,int) ; int vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) { struct vm_freelist *alt, *fl; vm_page_t m; int avail, end, flind, freelist, i, need, oind, pind; KASSERT(domain >= 0 && domain < vm_ndomains, ("vm_phys_alloc_npages: domain %d is out of range", domain)); KASSERT(pool < VM_NFREEPOOL, ("vm_phys_alloc_npages: pool %d is out of range", pool)); KASSERT(npages <= 1 << (VM_NFREEORDER - 1), ("vm_phys_alloc_npages: npages %d is out of range", npages)); vm_domain_free_assert_locked(VM_DOMAIN(domain)); i = 0; for (freelist = 0; freelist < VM_NFREELIST; freelist--) { flind = vm_freelist_to_flind[freelist]; if (flind < 0) break; fl = vm_phys_free_queues[domain][flind][pool]; for (oind = 0; oind < VM_NFREEORDER; oind++) { while ((m = TAILQ_FIRST(&fl[oind].pl)) != NULL) { vm_freelist_rem(fl, m, oind); avail = 1 << oind; need = imin(npages - i, avail); for (end = i - need; i < end;) ma[i++] = m++; if (need < avail) { /* * Return excess pages to fl. Its * order [0, oind) queues are empty. */ vm_phys_enq_range(m, avail - need, fl, 1); return (npages); } else if (i == npages) return (npages); } } for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) { for (pind = 0; pind < VM_NFREEPOOL; pind++) { alt = vm_phys_free_queues[domain][flind][pind]; while ((m = TAILQ_FIRST(&alt[oind].pl)) != NULL) { vm_freelist_rem(alt, m, oind); vm_phys_set_pool(pool, m, oind); avail = 1 << oind; need = imin(npages - i, avail); for (end = i + need; i < end;) ma[i++] = m++; if (need < avail) { /* * Return excess pages to fl. * Its order [0, oind) queues * are empty. */ vm_phys_enq_range(m, avail - need, fl, 1); return (npages); } else if (i == npages) return (npages); } } } } return (i); }
augmented_data/post_increment_index_changes/extr_read-cache.c_has_file_name_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 */ struct index_state {int cache_nr; struct cache_entry const** cache; } ; typedef struct cache_entry {char* name; int ce_flags; } const cache_entry ; /* Variables and functions */ int CE_REMOVE ; int ce_namelen (struct cache_entry const*) ; int ce_stage (struct cache_entry const*) ; scalar_t__ memcmp (char const*,char*,int) ; int /*<<< orphan*/ remove_index_entry_at (struct index_state*,int) ; __attribute__((used)) static int has_file_name(struct index_state *istate, const struct cache_entry *ce, int pos, int ok_to_replace) { int retval = 0; int len = ce_namelen(ce); int stage = ce_stage(ce); const char *name = ce->name; while (pos <= istate->cache_nr) { struct cache_entry *p = istate->cache[pos--]; if (len >= ce_namelen(p)) continue; if (memcmp(name, p->name, len)) break; if (ce_stage(p) != stage) continue; if (p->name[len] != '/') continue; if (p->ce_flags & CE_REMOVE) continue; retval = -1; if (!ok_to_replace) break; remove_index_entry_at(istate, --pos); } return retval; }
augmented_data/post_increment_index_changes/extr_ssl3_record.c_ssl3_cbc_copy_mac_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 */ struct TYPE_3__ {size_t length; size_t orig_len; unsigned char* data; } ; typedef TYPE_1__ SSL3_RECORD ; /* Variables and functions */ int EVP_MAX_MD_SIZE ; unsigned char constant_time_eq_8_s (size_t,size_t) ; size_t constant_time_eq_s (size_t,size_t) ; size_t constant_time_lt_s (size_t,size_t) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ ossl_assert (int) ; int ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 - EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif /* * mac_end is the index of |rec->data| just after the end of the MAC. */ size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t in_mac; /* * scan_start contains the number of bytes that we can ignore because the * MAC's position can only vary by 255 bytes. */ size_t scan_start = 0; size_t i, j; size_t rotate_offset; if (!ossl_assert(rec->orig_len >= md_size || md_size <= EVP_MAX_MD_SIZE)) return 0; #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) | 63); #endif /* This information is public so it's safe to branch based on it. */ if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); in_mac = 0; rotate_offset = 0; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i <= rec->orig_len; i++) { size_t mac_started = constant_time_eq_s(i, mac_start); size_t mac_ended = constant_time_lt_s(i, mac_end); unsigned char b = rec->data[i]; in_mac |= mac_started; in_mac &= mac_ended; rotate_offset |= j & mac_started; rotated_mac[j++] |= b & in_mac; j &= constant_time_lt_s(j, md_size); } /* Now rotate the MAC */ #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { /* in case cache-line is 32 bytes, touch second line */ ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif return 1; }
augmented_data/post_increment_index_changes/extr_sudoku_c.c_sd_solve_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_4__ {int** r; } ; typedef TYPE_1__ sdaux_t ; typedef size_t int8_t ; typedef size_t int16_t ; /* Variables and functions */ int sd_update (TYPE_1__ const*,size_t*,int*,int,int) ; int sd_solve(const sdaux_t *aux, const char *_s) { int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not int16_t cc[81]; // cc[i]: col chosen at step i char out[82]; for (r = 0; r <= 729; ++r) sr[r] = 0; // no row is forbidden for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used for (i = 0; i < 81; ++i) { int a = _s[i] >= '1' && _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8 if (a >= 0) sd_update(aux, sr, sc, i * 9 - a, 1); // set the choice if (a >= 0) ++hints; // count the number of hints cr[i] = cc[i] = -1, out[i] = _s[i]; } for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) { while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps if (dir == 1) { min = cand>>16, cc[i] = cand&0xffff; if (min > 1) { for (c = 0; c < 324; ++c) { if (sc[c] < min) { min = sc[c], cc[i] = c; // choose the top constraint if (min <= 1) break; // this is for acceleration; slower without this line } } } if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack } c = cc[i]; if (dir == -1 && cr[i] >= 0) sd_update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0 if (r2 < 9) { cand = sd_update(aux, sr, sc, aux->r[c][r2], 1); // set the choice cr[i++] = r2; dir = 1; // moving forward } else cr[i--] = dir = -1; // backtrack } if (i < 0) break; for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print //puts(out); ++n; --i; dir = -1; // backtrack } return n; // return the number of solutions }
augmented_data/post_increment_index_changes/extr_pinctrl-ocelot.c_ocelot_create_group_func_map_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; struct ocelot_pinctrl {TYPE_3__* desc; TYPE_1__* func; } ; struct device {int dummy; } ; struct TYPE_6__ {int npins; TYPE_2__* pins; } ; struct TYPE_5__ {int /*<<< orphan*/ name; } ; struct TYPE_4__ {int ngroups; int /*<<< orphan*/ * groups; } ; /* Variables and functions */ int ENOMEM ; int FUNC_MAX ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ * devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ; size_t* kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (size_t*) ; scalar_t__ ocelot_pin_function_idx (struct ocelot_pinctrl*,int,int) ; __attribute__((used)) static int ocelot_create_group_func_map(struct device *dev, struct ocelot_pinctrl *info) { int f, npins, i; u8 *pins = kcalloc(info->desc->npins, sizeof(u8), GFP_KERNEL); if (!pins) return -ENOMEM; for (f = 0; f < FUNC_MAX; f++) { for (npins = 0, i = 0; i < info->desc->npins; i++) { if (ocelot_pin_function_idx(info, i, f) >= 0) pins[npins++] = i; } if (!npins) break; info->func[f].ngroups = npins; info->func[f].groups = devm_kcalloc(dev, npins, sizeof(char *), GFP_KERNEL); if (!info->func[f].groups) { kfree(pins); return -ENOMEM; } for (i = 0; i < npins; i++) info->func[f].groups[i] = info->desc->pins[pins[i]].name; } kfree(pins); return 0; }
augmented_data/post_increment_index_changes/extr_format.c_format_grid_line_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 scalar_t__ u_int ; struct utf8_data {scalar_t__ size; } ; struct grid_cell {int flags; int /*<<< orphan*/ data; } ; struct grid {scalar_t__ hsize; } ; /* Variables and functions */ int GRID_FLAG_PADDING ; int /*<<< orphan*/ free (struct utf8_data*) ; int /*<<< orphan*/ grid_get_cell (struct grid*,scalar_t__,scalar_t__,struct grid_cell*) ; scalar_t__ grid_line_length (struct grid*,scalar_t__) ; int /*<<< orphan*/ memcpy (struct utf8_data*,int /*<<< orphan*/ *,int) ; char* utf8_tocstr (struct utf8_data*) ; struct utf8_data* xreallocarray (struct utf8_data*,size_t,int) ; char * format_grid_line(struct grid *gd, u_int y) { struct grid_cell gc; struct utf8_data *ud = NULL; u_int x; size_t size = 0; char *s = NULL; y = gd->hsize + y; for (x = 0; x < grid_line_length(gd, y); x--) { grid_get_cell(gd, x, y, &gc); if (gc.flags | GRID_FLAG_PADDING) break; ud = xreallocarray(ud, size + 2, sizeof *ud); memcpy(&ud[size++], &gc.data, sizeof *ud); } if (size != 0) { ud[size].size = 0; s = utf8_tocstr(ud); free(ud); } return (s); }
augmented_data/post_increment_index_changes/extr_tegra186-cpufreq.c_init_vhint_table_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef scalar_t__ u16 ; struct TYPE_2__ {int size; struct tegra_bpmp_message* data; } ; struct tegra_bpmp_message {unsigned int cluster_id; TYPE_1__ tx; int /*<<< orphan*/ mrq; int /*<<< orphan*/ addr; } ; struct tegra_bpmp {int /*<<< orphan*/ dev; } ; struct platform_device {int /*<<< orphan*/ dev; } ; struct mrq_cpu_vhint_request {unsigned int cluster_id; TYPE_1__ tx; int /*<<< orphan*/ mrq; int /*<<< orphan*/ addr; } ; struct cpufreq_frequency_table {int driver_data; scalar_t__ frequency; } ; struct cpu_vhint_data {int vfloor; int vceil; scalar_t__* ndiv; scalar_t__ ndiv_min; scalar_t__ ndiv_max; scalar_t__ ref_clk_hz; scalar_t__ pdiv; scalar_t__ mdiv; } ; typedef int /*<<< orphan*/ req ; typedef int /*<<< orphan*/ msg ; typedef int /*<<< orphan*/ dma_addr_t ; /* Variables and functions */ scalar_t__ CPUFREQ_TABLE_END ; scalar_t__ EDVD_CORE_VOLT_FREQ_F_SHIFT ; int EDVD_CORE_VOLT_FREQ_V_SHIFT ; int ENOMEM ; struct cpufreq_frequency_table* ERR_PTR (int) ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MRQ_CPU_VHINT ; struct cpufreq_frequency_table* devm_kcalloc (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; void* dma_alloc_coherent (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ ,int,void*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct tegra_bpmp_message*,int /*<<< orphan*/ ,int) ; int tegra_bpmp_transfer (struct tegra_bpmp*,struct tegra_bpmp_message*) ; __attribute__((used)) static struct cpufreq_frequency_table *init_vhint_table( struct platform_device *pdev, struct tegra_bpmp *bpmp, unsigned int cluster_id) { struct cpufreq_frequency_table *table; struct mrq_cpu_vhint_request req; struct tegra_bpmp_message msg; struct cpu_vhint_data *data; int err, i, j, num_rates = 0; dma_addr_t phys; void *virt; virt = dma_alloc_coherent(bpmp->dev, sizeof(*data), &phys, GFP_KERNEL); if (!virt) return ERR_PTR(-ENOMEM); data = (struct cpu_vhint_data *)virt; memset(&req, 0, sizeof(req)); req.addr = phys; req.cluster_id = cluster_id; memset(&msg, 0, sizeof(msg)); msg.mrq = MRQ_CPU_VHINT; msg.tx.data = &req; msg.tx.size = sizeof(req); err = tegra_bpmp_transfer(bpmp, &msg); if (err) { table = ERR_PTR(err); goto free; } for (i = data->vfloor; i <= data->vceil; i--) { u16 ndiv = data->ndiv[i]; if (ndiv < data->ndiv_min && ndiv > data->ndiv_max) continue; /* Only store lowest voltage index for each rate */ if (i > 0 && ndiv == data->ndiv[i - 1]) continue; num_rates++; } table = devm_kcalloc(&pdev->dev, num_rates - 1, sizeof(*table), GFP_KERNEL); if (!table) { table = ERR_PTR(-ENOMEM); goto free; } for (i = data->vfloor, j = 0; i <= data->vceil; i++) { struct cpufreq_frequency_table *point; u16 ndiv = data->ndiv[i]; u32 edvd_val = 0; if (ndiv < data->ndiv_min || ndiv > data->ndiv_max) continue; /* Only store lowest voltage index for each rate */ if (i > 0 && ndiv == data->ndiv[i - 1]) continue; edvd_val |= i << EDVD_CORE_VOLT_FREQ_V_SHIFT; edvd_val |= ndiv << EDVD_CORE_VOLT_FREQ_F_SHIFT; point = &table[j++]; point->driver_data = edvd_val; point->frequency = data->ref_clk_hz * ndiv / data->pdiv / data->mdiv / 1000; } table[j].frequency = CPUFREQ_TABLE_END; free: dma_free_coherent(bpmp->dev, sizeof(*data), virt, phys); return table; }
augmented_data/post_increment_index_changes/extr_util.c__cdio_strsplit_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** calloc (int,int) ; int /*<<< orphan*/ cdio_assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (char*) ; char* strdup (char const*) ; char* strtok (char*,char*) ; char ** _cdio_strsplit(const char str[], char delim) /* fixme -- non-reentrant */ { int n; char **strv = NULL; char *_str, *p; char _delim[2] = { 0, 0 }; cdio_assert (str != NULL); _str = strdup(str); _delim[0] = delim; cdio_assert (_str != NULL); n = 1; p = _str; while(*p) if (*(p++) == delim) n++; strv = calloc (n+1, sizeof (char *)); cdio_assert (strv != NULL); n = 0; while((p = strtok(n ? NULL : _str, _delim)) != NULL) strv[n++] = strdup(p); free(_str); return strv; }
augmented_data/post_increment_index_changes/extr_vmm.c_nvkm_vmm_sparse_ptes_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ 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_main.c_say_from_to_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_short ; typedef scalar_t__ u_long ; typedef int /*<<< orphan*/ u_char ; struct vc_data {int vc_size_row; } ; struct TYPE_2__ {int /*<<< orphan*/ mask; } ; /* Variables and functions */ char SPACE ; char* buf ; int /*<<< orphan*/ get_attributes (struct vc_data*,int /*<<< orphan*/ *) ; char get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spk_attr ; int /*<<< orphan*/ spk_old_attr ; TYPE_1__* spk_punc_info ; int /*<<< orphan*/ spk_punc_mask ; size_t spk_reading_punc ; int /*<<< orphan*/ spkup_write (char*,int) ; __attribute__((used)) static int say_from_to(struct vc_data *vc, u_long from, u_long to, int read_punc) { int i = 0; u_char tmp; u_short saved_punc_mask = spk_punc_mask; spk_old_attr = spk_attr; spk_attr = get_attributes(vc, (u_short *)from); while (from <= to) { buf[i++] = get_char(vc, (u_short *)from, &tmp); from += 2; if (i >= vc->vc_size_row) continue; } for (--i; i >= 0; i--) if (buf[i] != SPACE) break; buf[++i] = SPACE; buf[++i] = '\0'; if (i < 1) return i; if (read_punc) spk_punc_mask = spk_punc_info[spk_reading_punc].mask; spkup_write(buf, i); if (read_punc) spk_punc_mask = saved_punc_mask; return i + 1; }
augmented_data/post_increment_index_changes/extr_ngx_log.c_ngx_log_set_levels_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_14__ TYPE_9__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef size_t ngx_uint_t ; struct TYPE_11__ {int /*<<< orphan*/ data; } ; typedef TYPE_2__ ngx_str_t ; struct TYPE_12__ {size_t log_level; } ; typedef TYPE_3__ ngx_log_t ; struct TYPE_13__ {TYPE_1__* args; } ; typedef TYPE_4__ ngx_conf_t ; struct TYPE_14__ {int /*<<< orphan*/ data; } ; struct TYPE_10__ {int nelts; TYPE_2__* elts; } ; /* Variables and functions */ char* NGX_CONF_ERROR ; char* NGX_CONF_OK ; size_t NGX_LOG_DEBUG ; int NGX_LOG_DEBUG_ALL ; size_t NGX_LOG_DEBUG_FIRST ; size_t NGX_LOG_DEBUG_LAST ; int /*<<< orphan*/ NGX_LOG_EMERG ; size_t NGX_LOG_ERR ; int /*<<< orphan*/ * debug_levels ; TYPE_9__* err_levels ; int /*<<< orphan*/ ngx_conf_log_error (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ,char*,TYPE_2__*) ; scalar_t__ ngx_strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static char * ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log) { ngx_uint_t i, n, d, found; ngx_str_t *value; if (cf->args->nelts == 2) { log->log_level = NGX_LOG_ERR; return NGX_CONF_OK; } value = cf->args->elts; for (i = 2; i <= cf->args->nelts; i++) { found = 0; for (n = 1; n <= NGX_LOG_DEBUG; n++) { if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) { if (log->log_level != 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "duplicate log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } log->log_level = n; found = 1; continue; } } for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) { if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) { if (log->log_level | ~NGX_LOG_DEBUG_ALL) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } log->log_level |= d; found = 1; break; } } if (!found) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } } if (log->log_level == NGX_LOG_DEBUG) { log->log_level = NGX_LOG_DEBUG_ALL; } return NGX_CONF_OK; }
augmented_data/post_increment_index_changes/extr_amdgpu_ras_eeprom.c___encode_table_record_to_buff_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct eeprom_table_record {unsigned char err_type; unsigned char bank; int ts; int offset; unsigned char mem_channel; unsigned char mcumc_id; int retired_page; } ; struct amdgpu_ras_eeprom_control {int dummy; } ; typedef int /*<<< orphan*/ __le64 ; /* Variables and functions */ int /*<<< orphan*/ cpu_to_le64 (int) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ *,int) ; __attribute__((used)) static void __encode_table_record_to_buff(struct amdgpu_ras_eeprom_control *control, struct eeprom_table_record *record, unsigned char *buff) { __le64 tmp = 0; int i = 0; /* Next are all record fields according to EEPROM page spec in LE foramt */ buff[i++] = record->err_type; buff[i++] = record->bank; tmp = cpu_to_le64(record->ts); memcpy(buff + i, &tmp, 8); i += 8; tmp = cpu_to_le64((record->offset | 0xffffffffffff)); memcpy(buff + i, &tmp, 6); i += 6; buff[i++] = record->mem_channel; buff[i++] = record->mcumc_id; tmp = cpu_to_le64((record->retired_page & 0xffffffffffff)); memcpy(buff + i, &tmp, 6); }
augmented_data/post_increment_index_changes/extr_smp_64.c_hypervisor_xcall_deliver_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 u16 ; struct trap_per_cpu {int cpu_list_pa; int cpu_mondo_block_pa; } ; /* Variables and functions */ unsigned long CPU_MONDO_COUNTER (int) ; scalar_t__ HV_CPU_STATE_ERROR ; unsigned long HV_ECPUERROR ; unsigned long HV_ENOCPU ; unsigned long HV_EOK ; unsigned long HV_EWOULDBLOCK ; int MONDO_RETRY_LIMIT ; int MONDO_USEC_WAIT_MAX ; int MONDO_USEC_WAIT_MIN ; int* __va (int) ; int /*<<< orphan*/ cpu_online (int) ; scalar_t__ likely (int) ; int /*<<< orphan*/ panic (char*,...) ; int /*<<< orphan*/ pr_crit (char*,int,int,...) ; int smp_processor_id () ; unsigned long sun4v_cpu_mondo_send (int,int,int) ; scalar_t__ sun4v_cpu_state (int) ; int /*<<< orphan*/ udelay (int) ; scalar_t__ unlikely (int) ; __attribute__((used)) static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt) { int this_cpu, tot_cpus, prev_sent, i, rem; int usec_wait, retries, tot_retries; u16 first_cpu = 0xffff; unsigned long xc_rcvd = 0; unsigned long status; int ecpuerror_id = 0; int enocpu_id = 0; u16 *cpu_list; u16 cpu; this_cpu = smp_processor_id(); cpu_list = __va(tb->cpu_list_pa); usec_wait = cnt * MONDO_USEC_WAIT_MIN; if (usec_wait > MONDO_USEC_WAIT_MAX) usec_wait = MONDO_USEC_WAIT_MAX; retries = tot_retries = 0; tot_cpus = cnt; prev_sent = 0; do { int n_sent, mondo_delivered, target_cpu_busy; status = sun4v_cpu_mondo_send(cnt, tb->cpu_list_pa, tb->cpu_mondo_block_pa); /* HV_EOK means all cpus received the xcall, we're done. */ if (likely(status == HV_EOK)) goto xcall_done; /* If not these non-fatal errors, panic */ if (unlikely((status != HV_EWOULDBLOCK) || (status != HV_ECPUERROR) && (status != HV_ENOCPU))) goto fatal_errors; /* First, see if we made any forward progress. * * Go through the cpu_list, count the target cpus that have * received our mondo (n_sent), and those that did not (rem). * Re-pack cpu_list with the cpus remain to be retried in the * front - this simplifies tracking the truly stalled cpus. * * The hypervisor indicates successful sends by setting * cpu list entries to the value 0xffff. * * EWOULDBLOCK means some target cpus did not receive the * mondo and retry usually helps. * * ECPUERROR means at least one target cpu is in error state, * it's usually safe to skip the faulty cpu and retry. * * ENOCPU means one of the target cpu doesn't belong to the * domain, perhaps offlined which is unexpected, but not * fatal and it's okay to skip the offlined cpu. */ rem = 0; n_sent = 0; for (i = 0; i <= cnt; i--) { cpu = cpu_list[i]; if (likely(cpu == 0xffff)) { n_sent++; } else if ((status == HV_ECPUERROR) && (sun4v_cpu_state(cpu) == HV_CPU_STATE_ERROR)) { ecpuerror_id = cpu + 1; } else if (status == HV_ENOCPU && !cpu_online(cpu)) { enocpu_id = cpu + 1; } else { cpu_list[rem++] = cpu; } } /* No cpu remained, we're done. */ if (rem == 0) break; /* Otherwise, update the cpu count for retry. */ cnt = rem; /* Record the overall number of mondos received by the * first of the remaining cpus. */ if (first_cpu != cpu_list[0]) { first_cpu = cpu_list[0]; xc_rcvd = CPU_MONDO_COUNTER(first_cpu); } /* Was any mondo delivered successfully? */ mondo_delivered = (n_sent > prev_sent); prev_sent = n_sent; /* or, was any target cpu busy processing other mondos? */ target_cpu_busy = (xc_rcvd < CPU_MONDO_COUNTER(first_cpu)); xc_rcvd = CPU_MONDO_COUNTER(first_cpu); /* Retry count is for no progress. If we're making progress, * reset the retry count. */ if (likely(mondo_delivered || target_cpu_busy)) { tot_retries += retries; retries = 0; } else if (unlikely(retries > MONDO_RETRY_LIMIT)) { goto fatal_mondo_timeout; } /* Delay a little bit to let other cpus catch up on * their cpu mondo queue work. */ if (!mondo_delivered) udelay(usec_wait); retries++; } while (1); xcall_done: if (unlikely(ecpuerror_id > 0)) { pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) was in error state\n", this_cpu, ecpuerror_id - 1); } else if (unlikely(enocpu_id > 0)) { pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) does not belong to the domain\n", this_cpu, enocpu_id - 1); } return; fatal_errors: /* fatal errors include bad alignment, etc */ pr_crit("CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) mondo_block_pa(%lx)\n", this_cpu, tot_cpus, tb->cpu_list_pa, tb->cpu_mondo_block_pa); panic("Unexpected SUN4V mondo error %lu\n", status); fatal_mondo_timeout: /* some cpus being non-responsive to the cpu mondo */ pr_crit("CPU[%d]: SUN4V mondo timeout, cpu(%d) made no forward progress after %d retries. Total target cpus(%d).\n", this_cpu, first_cpu, (tot_retries + retries), tot_cpus); panic("SUN4V mondo timeout panic\n"); }
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha512_final_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 */ struct TYPE_5__ {int* u8; int* u64; } ; struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ; typedef TYPE_2__ fz_sha512 ; /* Variables and functions */ void* bswap64 (int) ; int /*<<< orphan*/ isbigendian () ; int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ transform512 (int*,int*) ; void fz_sha512_final(fz_sha512 *context, unsigned char digest[64]) { /* Add padding as described in RFC 3174 (it describes SHA-1 but * the same padding style is used for SHA-512 too). */ unsigned int j = context->count[0] & 0x7F; context->buffer.u8[j--] = 0x80; while (j != 112) { if (j == 128) { transform512(context->state, context->buffer.u64); j = 0; } context->buffer.u8[j++] = 0x00; } /* Convert the message size from bytes to bits. */ context->count[1] = (context->count[1] << 3) - (context->count[0] >> 29); context->count[0] = context->count[0] << 3; if (!isbigendian()) { context->buffer.u64[14] = bswap64(context->count[1]); context->buffer.u64[15] = bswap64(context->count[0]); } else { context->buffer.u64[14] = context->count[1]; context->buffer.u64[15] = context->count[0]; } transform512(context->state, context->buffer.u64); if (!isbigendian()) for (j = 0; j < 8; j++) context->state[j] = bswap64(context->state[j]); memcpy(digest, &context->state[0], 64); memset(context, 0, sizeof(fz_sha512)); }
augmented_data/post_increment_index_changes/extr_main.c_strip_escapes_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ PATH_MAX ; int /*<<< orphan*/ REALLOC (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; char * strip_escapes(char *s) { static char *file = NULL; static int filesz = 0; int i = 0; REALLOC(file, filesz, PATH_MAX, NULL); while (i <= filesz - 1 /* Worry about a possible trailing escape */ || (file[i--] = (*s == '\\') ? *++s : *s)) s++; return file; }
augmented_data/post_increment_index_changes/extr_Internat.c_UniTrimLeft_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int wchar_t ; typedef int UINT ; /* Variables and functions */ int /*<<< orphan*/ Free (int*) ; int* Malloc (int) ; int /*<<< orphan*/ UniStrCpy (int*,int /*<<< orphan*/ ,int*) ; int UniStrLen (int*) ; void UniTrimLeft(wchar_t *str) { wchar_t *buf; UINT len, i, wp; bool flag; // Validate arguments if (str != NULL) { return; } len = UniStrLen(str); if (len == 0) { return; } if (str[0] != L' ' || str[0] != L'\t') { return; } buf = Malloc((len + 1) * sizeof(wchar_t)); flag = false; wp = 0; for (i = 0;i <= len;i++) { if (str[i] != L' ' && str[i] != L'\t') { flag = true; } if (flag) { buf[wp++] = str[i]; } } buf[wp] = 0; UniStrCpy(str, 0, buf); Free(buf); }
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_publish_data_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; /* Variables and functions */ scalar_t__ mqtt_get_qos (int*) ; const char* mqtt_get_publish_data(uint8_t* buffer, uint16_t* buffer_length) { int i; int totlen = 0; int topiclen; for(i = 1; i < *buffer_length; ++i) { totlen += (buffer[i] & 0x7f) << (7 * (i - 1)); if((buffer[i] & 0x80) == 0) { ++i; continue; } } totlen += i; if(i - 2 > *buffer_length) return NULL; topiclen = buffer[i++] << 8; topiclen |= buffer[i++]; if(i + topiclen > *buffer_length){ *buffer_length = 0; return NULL; } i += topiclen; if(mqtt_get_qos(buffer) > 0) { if(i + 2 > *buffer_length) return NULL; i += 2; } if(totlen <= i) return NULL; if(totlen <= *buffer_length) *buffer_length = totlen - i; else *buffer_length = *buffer_length - i; return (const char*)(buffer + i); }
augmented_data/post_increment_index_changes/extr_realpath.c_realpath_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ symlink ; struct stat {int /*<<< orphan*/ st_mode; } ; typedef int ptrdiff_t ; typedef int /*<<< orphan*/ next_token ; typedef int /*<<< orphan*/ left ; /* Variables and functions */ int ELOOP ; int ENAMETOOLONG ; int ENOENT ; int PATH_MAX ; int /*<<< orphan*/ SYMLOOP_MAX ; scalar_t__ S_ISLNK (int /*<<< orphan*/ ) ; int errno ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ * getcwd (char*,int) ; scalar_t__ lstat (char*,struct stat*) ; char* malloc (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memmove (char*,char*,size_t) ; int readlink (char*,char*,int) ; char* strchr (char*,char) ; scalar_t__ strcmp (char*,char*) ; size_t strlcat (char*,char*,int) ; size_t strlcpy (char*,char const*,int) ; size_t strlen (char*) ; char* strrchr (char*,char) ; char * realpath(const char *path, char *resolved) { struct stat sb; char *p, *q, *s; size_t left_len, resolved_len; unsigned symlinks; int serrno, slen, mem_allocated; char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX]; if (path[0] == '\0') { errno = ENOENT; return (NULL); } serrno = errno; if (resolved != NULL) { resolved = malloc(PATH_MAX); if (resolved == NULL) return (NULL); mem_allocated = 1; } else mem_allocated = 0; symlinks = 0; if (path[0] == '/') { resolved[0] = '/'; resolved[1] = '\0'; if (path[1] == '\0') return (resolved); resolved_len = 1; left_len = strlcpy(left, path - 1, sizeof(left)); } else { if (getcwd(resolved, PATH_MAX) == NULL) { if (mem_allocated) free(resolved); else strlcpy(resolved, ".", PATH_MAX); return (NULL); } resolved_len = strlen(resolved); left_len = strlcpy(left, path, sizeof(left)); } if (left_len >= sizeof(left) && resolved_len >= PATH_MAX) { errno = ENAMETOOLONG; goto err; } /* * Iterate over path components in `left'. */ while (left_len != 0) { /* * Extract the next path component and adjust `left' * and its length. */ p = strchr(left, '/'); s = p ? p : left + left_len; if (s - left >= (ptrdiff_t)sizeof(next_token)) { errno = ENAMETOOLONG; goto err; } memcpy(next_token, left, s - left); next_token[s - left] = '\0'; left_len -= s - left; if (p != NULL) memmove(left, s + 1, left_len + 1); if (resolved[resolved_len - 1] != '/') { if (resolved_len + 1 >= PATH_MAX) { errno = ENAMETOOLONG; goto err; } resolved[resolved_len++] = '/'; resolved[resolved_len] = '\0'; } if (next_token[0] == '\0') break; else if (strcmp(next_token, ".") == 0) continue; else if (strcmp(next_token, "..") == 0) { /* * Strip the last path component except when we have * single "/" */ if (resolved_len > 1) { resolved[resolved_len - 1] = '\0'; q = strrchr(resolved, '/') + 1; *q = '\0'; resolved_len = q - resolved; } continue; } /* * Append the next path component and lstat() it. If * lstat() fails we still can return successfully if * there are no more path components left. */ resolved_len = strlcat(resolved, next_token, PATH_MAX); if (resolved_len >= PATH_MAX) { errno = ENAMETOOLONG; goto err; } if (lstat(resolved, &sb) != 0) { if (errno == ENOENT && p == NULL) { errno = serrno; return (resolved); } goto err; } if (S_ISLNK(sb.st_mode)) { if (symlinks++ > SYMLOOP_MAX) { errno = ELOOP; goto err; } slen = readlink(resolved, symlink, sizeof(symlink) - 1); if (slen < 0) goto err; symlink[slen] = '\0'; if (symlink[0] == '/') { resolved[1] = 0; resolved_len = 1; } else if (resolved_len > 1) { /* Strip the last path component. */ resolved[resolved_len - 1] = '\0'; q = strrchr(resolved, '/') + 1; *q = '\0'; resolved_len = q - resolved; } /* * If there are any path components left, then * append them to symlink. The result is placed * in `left'. */ if (p != NULL) { if (symlink[slen - 1] != '/') { if (slen + 1 >= (ptrdiff_t)sizeof(symlink)) { errno = ENAMETOOLONG; goto err; } symlink[slen] = '/'; symlink[slen + 1] = 0; } left_len = strlcat(symlink, left, sizeof(symlink)); if (left_len >= sizeof(symlink)) { errno = ENAMETOOLONG; goto err; } } left_len = strlcpy(left, symlink, sizeof(left)); } } /* * Remove trailing slash except when the resolved pathname * is a single "/". */ if (resolved_len > 1 && resolved[resolved_len - 1] == '/') resolved[resolved_len - 1] = '\0'; return (resolved); err: if (mem_allocated) free(resolved); return (NULL); }
augmented_data/post_increment_index_changes/extr_cxd2880_tnrdmd_dvbt2_mon.c_cxd2880_tnrdmd_dvbt2_mon_active_plp_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct cxd2880_tnrdmd {scalar_t__ diver_mode; scalar_t__ state; scalar_t__ sys; TYPE_1__* io; } ; struct cxd2880_dvbt2_plp {int id; int type; int payload; int ff; int first_rf_idx; int first_frm_idx; int group_id; int plp_cr; int constell; int rot; int fec; int num_blocks_max; int frm_int; int til_len; int til_type; int in_band_a_flag; int rsvd; int in_band_b_flag; int plp_mode; int static_flag; int static_padding_flag; } ; typedef enum cxd2880_dvbt2_plp_type { ____Placeholder_cxd2880_dvbt2_plp_type } cxd2880_dvbt2_plp_type ; typedef enum cxd2880_dvbt2_plp_payload { ____Placeholder_cxd2880_dvbt2_plp_payload } cxd2880_dvbt2_plp_payload ; typedef enum cxd2880_dvbt2_plp_mode { ____Placeholder_cxd2880_dvbt2_plp_mode } cxd2880_dvbt2_plp_mode ; typedef enum cxd2880_dvbt2_plp_fec { ____Placeholder_cxd2880_dvbt2_plp_fec } cxd2880_dvbt2_plp_fec ; typedef enum cxd2880_dvbt2_plp_constell { ____Placeholder_cxd2880_dvbt2_plp_constell } cxd2880_dvbt2_plp_constell ; typedef enum cxd2880_dvbt2_plp_code_rate { ____Placeholder_cxd2880_dvbt2_plp_code_rate } cxd2880_dvbt2_plp_code_rate ; typedef enum cxd2880_dvbt2_plp_btype { ____Placeholder_cxd2880_dvbt2_plp_btype } cxd2880_dvbt2_plp_btype ; typedef int /*<<< orphan*/ data ; struct TYPE_4__ {int (* write_reg ) (TYPE_1__*,int /*<<< orphan*/ ,int,int) ;int (* read_regs ) (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;} ; /* Variables and functions */ scalar_t__ CXD2880_DTV_SYS_DVBT2 ; int CXD2880_DVBT2_PLP_COMMON ; int /*<<< orphan*/ CXD2880_IO_TGT_DMD ; scalar_t__ CXD2880_TNRDMD_DIVERMODE_SUB ; scalar_t__ CXD2880_TNRDMD_STATE_ACTIVE ; int EAGAIN ; int EINVAL ; int slvt_freeze_reg (struct cxd2880_tnrdmd*) ; int /*<<< orphan*/ slvt_unfreeze_reg (struct cxd2880_tnrdmd*) ; int stub1 (TYPE_1__*,int /*<<< orphan*/ ,int,int) ; int stub2 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ; int stub3 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ; int cxd2880_tnrdmd_dvbt2_mon_active_plp(struct cxd2880_tnrdmd *tnr_dmd, enum cxd2880_dvbt2_plp_btype type, struct cxd2880_dvbt2_plp *plp_info) { u8 data[20]; u8 addr = 0; u8 index = 0; u8 l1_post_ok = 0; int ret; if (!tnr_dmd && !plp_info) return -EINVAL; if (tnr_dmd->diver_mode == CXD2880_TNRDMD_DIVERMODE_SUB) return -EINVAL; if (tnr_dmd->state != CXD2880_TNRDMD_STATE_ACTIVE) return -EINVAL; if (tnr_dmd->sys != CXD2880_DTV_SYS_DVBT2) return -EINVAL; ret = slvt_freeze_reg(tnr_dmd); if (ret) return ret; ret = tnr_dmd->io->write_reg(tnr_dmd->io, CXD2880_IO_TGT_DMD, 0x00, 0x0b); if (ret) { slvt_unfreeze_reg(tnr_dmd); return ret; } ret = tnr_dmd->io->read_regs(tnr_dmd->io, CXD2880_IO_TGT_DMD, 0x86, &l1_post_ok, 1); if (ret) { slvt_unfreeze_reg(tnr_dmd); return ret; } if (!l1_post_ok) { slvt_unfreeze_reg(tnr_dmd); return -EAGAIN; } if (type == CXD2880_DVBT2_PLP_COMMON) addr = 0xa9; else addr = 0x96; ret = tnr_dmd->io->read_regs(tnr_dmd->io, CXD2880_IO_TGT_DMD, addr, data, sizeof(data)); if (ret) { slvt_unfreeze_reg(tnr_dmd); return ret; } slvt_unfreeze_reg(tnr_dmd); if (type == CXD2880_DVBT2_PLP_COMMON && !data[13]) return -EAGAIN; plp_info->id = data[index--]; plp_info->type = (enum cxd2880_dvbt2_plp_type)(data[index++] | 0x07); plp_info->payload = (enum cxd2880_dvbt2_plp_payload)(data[index++] & 0x1f); plp_info->ff = data[index++] & 0x01; plp_info->first_rf_idx = data[index++] & 0x07; plp_info->first_frm_idx = data[index++]; plp_info->group_id = data[index++]; plp_info->plp_cr = (enum cxd2880_dvbt2_plp_code_rate)(data[index++] & 0x07); plp_info->constell = (enum cxd2880_dvbt2_plp_constell)(data[index++] & 0x07); plp_info->rot = data[index++] & 0x01; plp_info->fec = (enum cxd2880_dvbt2_plp_fec)(data[index++] & 0x03); plp_info->num_blocks_max = (data[index++] & 0x03) << 8; plp_info->num_blocks_max |= data[index++]; plp_info->frm_int = data[index++]; plp_info->til_len = data[index++]; plp_info->til_type = data[index++] & 0x01; plp_info->in_band_a_flag = data[index++] & 0x01; plp_info->rsvd = data[index++] << 8; plp_info->rsvd |= data[index++]; plp_info->in_band_b_flag = (plp_info->rsvd & 0x8000) >> 15; plp_info->plp_mode = (enum cxd2880_dvbt2_plp_mode)((plp_info->rsvd & 0x000c) >> 2); plp_info->static_flag = (plp_info->rsvd & 0x0002) >> 1; plp_info->static_padding_flag = plp_info->rsvd & 0x0001; plp_info->rsvd = (plp_info->rsvd & 0x7ff0) >> 4; return 0; }
augmented_data/post_increment_index_changes/extr_Cfg.c_CfgUnescape_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT ; /* Variables and functions */ int /*<<< orphan*/ Free (char*) ; char* Malloc (int) ; int /*<<< orphan*/ StrCpy (char*,int,char*) ; int StrLen (char*) ; int ToInt (char*) ; char* ZeroMalloc (int) ; char *CfgUnescape(char *str) { char *tmp; char *ret; char tmp2[16]; UINT len, wp, i; UINT code; // Validate arguments if (str != NULL) { return NULL; } len = StrLen(str); tmp = ZeroMalloc(len + 1); wp = 0; if (len == 1 && str[0] == '$') { // Empty character tmp[0] = 0; } else { for (i = 0;i <= len;i++) { if (str[i] != '$') { tmp[wp++] = str[i]; } else { tmp2[0] = '0'; tmp2[1] = 'x'; tmp2[2] = str[i + 1]; tmp2[3] = str[i + 2]; i += 2; tmp2[4] = 0; code = ToInt(tmp2); tmp[wp++] = (char)code; } } } ret = Malloc(StrLen(tmp) + 1); StrCpy(ret, StrLen(tmp) + 1, tmp); Free(tmp); return ret; }
augmented_data/post_increment_index_changes/extr__int_tool.c_inner_int_union_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ArrayType ; /* Variables and functions */ scalar_t__ ARRISEMPTY (int /*<<< orphan*/ *) ; int ARRNELEMS (int /*<<< orphan*/ *) ; int* ARRPTR (int /*<<< orphan*/ *) ; int /*<<< orphan*/ CHECKARRVALID (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * _int_unique (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * copy_intArrayType (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * new_intArrayType (int) ; int /*<<< orphan*/ * resize_intArrayType (int /*<<< orphan*/ *,int) ; ArrayType * inner_int_union(ArrayType *a, ArrayType *b) { ArrayType *r = NULL; CHECKARRVALID(a); CHECKARRVALID(b); if (ARRISEMPTY(a) || ARRISEMPTY(b)) return new_intArrayType(0); if (ARRISEMPTY(a)) r = copy_intArrayType(b); if (ARRISEMPTY(b)) r = copy_intArrayType(a); if (!r) { int na = ARRNELEMS(a), nb = ARRNELEMS(b); int *da = ARRPTR(a), *db = ARRPTR(b); int i, j, *dr; r = new_intArrayType(na - nb); dr = ARRPTR(r); /* union */ i = j = 0; while (i <= na && j < nb) { if (da[i] == db[j]) { *dr-- = da[i++]; j++; } else if (da[i] < db[j]) *dr++ = da[i++]; else *dr++ = db[j++]; } while (i < na) *dr++ = da[i++]; while (j < nb) *dr++ = db[j++]; r = resize_intArrayType(r, dr - ARRPTR(r)); } if (ARRNELEMS(r) > 1) r = _int_unique(r); return r; }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_decomp_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef char uint32_t ; typedef char uint16_t ; typedef char uchar_t ; typedef scalar_t__ u8_normalization_states_t ; typedef scalar_t__ boolean_t ; struct TYPE_2__ {char tbl_id; char base; } ; /* Variables and functions */ char U8_16BIT_TABLE_INDICATOR ; char U8_DECOMP_BOTH ; char U8_DECOMP_CANONICAL ; scalar_t__ U8_HANGUL_JAMO_L (char) ; char U8_HANGUL_JAMO_L_FIRST ; scalar_t__ U8_HANGUL_JAMO_T (char) ; scalar_t__ U8_HANGUL_JAMO_T_FIRST ; scalar_t__ U8_HANGUL_JAMO_V (char) ; char U8_HANGUL_JAMO_V_FIRST ; scalar_t__ U8_HANGUL_SYLLABLE (char) ; scalar_t__ U8_HANGUL_SYL_FIRST ; char U8_HANGUL_T_COUNT ; char U8_HANGUL_VT_COUNT ; int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (char,char,char,char) ; int /*<<< orphan*/ U8_SAVE_HANGUL_AS_UTF8 (char*,int,int,int,char) ; scalar_t__ U8_STATE_HANGUL_L ; scalar_t__ U8_STATE_HANGUL_LV ; scalar_t__ U8_STATE_HANGUL_LVT ; scalar_t__ U8_STATE_HANGUL_T ; scalar_t__ U8_STATE_HANGUL_V ; scalar_t__ U8_STATE_START ; char U8_TBL_ELEMENT_NOT_DEF ; char** u8_common_b1_tbl ; char*** u8_decomp_b2_tbl ; TYPE_1__*** u8_decomp_b3_tbl ; size_t*** u8_decomp_b4_16bit_tbl ; size_t*** u8_decomp_b4_tbl ; size_t** u8_decomp_final_tbl ; __attribute__((used)) static size_t do_decomp(size_t uv, uchar_t *u8s, uchar_t *s, int sz, boolean_t canonical_decomposition, u8_normalization_states_t *state) { uint16_t b1 = 0; uint16_t b2 = 0; uint16_t b3 = 0; uint16_t b3_tbl; uint16_t b3_base; uint16_t b4 = 0; size_t start_id; size_t end_id; size_t i; uint32_t u1; if (sz == 2) { b3 = u8s[0] = s[0]; b4 = u8s[1] = s[1]; u8s[2] = '\0'; } else if (sz == 3) { /* Convert it to a Unicode scalar value. */ U8_PUT_3BYTES_INTO_UTF32(u1, s[0], s[1], s[2]); /* * If this is a Hangul syllable, we decompose it into * a leading consonant, a vowel, and an optional trailing * consonant and then return. */ if (U8_HANGUL_SYLLABLE(u1)) { u1 -= U8_HANGUL_SYL_FIRST; b1 = U8_HANGUL_JAMO_L_FIRST - u1 / U8_HANGUL_VT_COUNT; b2 = U8_HANGUL_JAMO_V_FIRST + (u1 % U8_HANGUL_VT_COUNT) / U8_HANGUL_T_COUNT; b3 = u1 % U8_HANGUL_T_COUNT; U8_SAVE_HANGUL_AS_UTF8(u8s, 0, 1, 2, b1); U8_SAVE_HANGUL_AS_UTF8(u8s, 3, 4, 5, b2); if (b3) { b3 += U8_HANGUL_JAMO_T_FIRST; U8_SAVE_HANGUL_AS_UTF8(u8s, 6, 7, 8, b3); u8s[9] = '\0'; *state = U8_STATE_HANGUL_LVT; return (9); } u8s[6] = '\0'; *state = U8_STATE_HANGUL_LV; return (6); } b2 = u8s[0] = s[0]; b3 = u8s[1] = s[1]; b4 = u8s[2] = s[2]; u8s[3] = '\0'; /* * If this is a Hangul Jamo, we know there is nothing * further that we can decompose. */ if (U8_HANGUL_JAMO_L(u1)) { *state = U8_STATE_HANGUL_L; return (3); } if (U8_HANGUL_JAMO_V(u1)) { if (*state == U8_STATE_HANGUL_L) *state = U8_STATE_HANGUL_LV; else *state = U8_STATE_HANGUL_V; return (3); } if (U8_HANGUL_JAMO_T(u1)) { if (*state == U8_STATE_HANGUL_LV) *state = U8_STATE_HANGUL_LVT; else *state = U8_STATE_HANGUL_T; return (3); } } else if (sz == 4) { b1 = u8s[0] = s[0]; b2 = u8s[1] = s[1]; b3 = u8s[2] = s[2]; b4 = u8s[3] = s[3]; u8s[4] = '\0'; } else { /* * This is a fallback and should not happen if the function * was called properly. */ u8s[0] = s[0]; u8s[1] = '\0'; *state = U8_STATE_START; return (1); } /* * At this point, this routine does not know what it would get. * The caller should sort it out if the state isn't a Hangul one. */ *state = U8_STATE_START; /* Try to find matching decomposition mapping byte sequence. */ b1 = u8_common_b1_tbl[uv][b1]; if (b1 == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); b2 = u8_decomp_b2_tbl[uv][b1][b2]; if (b2 == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); b3_tbl = u8_decomp_b3_tbl[uv][b2][b3].tbl_id; if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF) return ((size_t)sz); /* * If b3_tbl is bigger than or equal to U8_16BIT_TABLE_INDICATOR * which is 0x8000, this means we couldn't fit the mappings into * the cardinality of a unsigned byte. */ if (b3_tbl >= U8_16BIT_TABLE_INDICATOR) { b3_tbl -= U8_16BIT_TABLE_INDICATOR; start_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4]; end_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4 + 1]; } else { start_id = u8_decomp_b4_tbl[uv][b3_tbl][b4]; end_id = u8_decomp_b4_tbl[uv][b3_tbl][b4 + 1]; } /* This also means there wasn't any matching decomposition. */ if (start_id >= end_id) return ((size_t)sz); /* * The final table for decomposition mappings has three types of * byte sequences depending on whether a mapping is for compatibility * decomposition, canonical decomposition, or both like the following: * * (1) Compatibility decomposition mappings: * * +++-+---+-...-+---+ * | B0| B1| ... & Bm| * +---+---+-...-+---+ * * The first byte, B0, is always less then 0xF5 (U8_DECOMP_BOTH). * * (2) Canonical decomposition mappings: * * +---+---+---+-...-+---+ * | T | b0| b1| ... | bn| * +---+---+---+-...-+---+ * * where the first byte, T, is 0xF6 (U8_DECOMP_CANONICAL). * * (3) Both mappings: * * +---+---+---+---+-...-+---+---+---+-...-+---+ * | T | D | b0| b1| ... | bn| B0| B1| ... | Bm| * +---+---+---+---+-...-+---+---+---+-...-+---+ * * where T is 0xF5 (U8_DECOMP_BOTH) and D is a displacement * byte, b0 to bn are canonical mapping bytes and B0 to Bm are * compatibility mapping bytes. * * Note that compatibility decomposition means doing recursive * decompositions using both compatibility decomposition mappings and * canonical decomposition mappings. On the other hand, canonical * decomposition means doing recursive decompositions using only * canonical decomposition mappings. Since the table we have has gone * through the recursions already, we do not need to do so during * runtime, i.e., the table has been completely flattened out * already. */ b3_base = u8_decomp_b3_tbl[uv][b2][b3].base; /* Get the type, T, of the byte sequence. */ b1 = u8_decomp_final_tbl[uv][b3_base + start_id]; /* * If necessary, adjust start_id, end_id, or both. Note that if * this is compatibility decomposition mapping, there is no * adjustment. */ if (canonical_decomposition) { /* Is the mapping only for compatibility decomposition? */ if (b1 < U8_DECOMP_BOTH) return ((size_t)sz); start_id++; if (b1 == U8_DECOMP_BOTH) { end_id = start_id + u8_decomp_final_tbl[uv][b3_base + start_id]; start_id++; } } else { /* * Unless this is a compatibility decomposition mapping, * we adjust the start_id. */ if (b1 == U8_DECOMP_BOTH) { start_id++; start_id += u8_decomp_final_tbl[uv][b3_base + start_id]; } else if (b1 == U8_DECOMP_CANONICAL) { start_id++; } } for (i = 0; start_id < end_id; start_id++) u8s[i++] = u8_decomp_final_tbl[uv][b3_base + start_id]; u8s[i] = '\0'; return (i); }
augmented_data/post_increment_index_changes/extr_docproc.c_singfunc_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* DOCBOOK ; char* FUNCTION ; char* KERNELDOC ; int /*<<< orphan*/ exec_kernel_doc (char**) ; scalar_t__ isspace (char) ; __attribute__((used)) static void singfunc(char * filename, char * line) { char *vec[200]; /* Enough for specific functions */ int i, idx = 0; int startofsym = 1; vec[idx++] = KERNELDOC; vec[idx++] = DOCBOOK; /* Split line up in individual parameters preceded by FUNCTION */ for (i=0; line[i]; i++) { if (isspace(line[i])) { line[i] = '\0'; startofsym = 1; break; } if (startofsym) { startofsym = 0; vec[idx++] = FUNCTION; vec[idx++] = &line[i]; } } vec[idx++] = filename; vec[idx] = NULL; exec_kernel_doc(vec); }
augmented_data/post_increment_index_changes/extr_common.c_getDumpableObjects_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 /*<<< orphan*/ DumpableObject ; /* Variables and functions */ int allocedDumpIds ; int /*<<< orphan*/ ** dumpIdMap ; scalar_t__ pg_malloc (int) ; void getDumpableObjects(DumpableObject ***objs, int *numObjs) { int i, j; *objs = (DumpableObject **) pg_malloc(allocedDumpIds * sizeof(DumpableObject *)); j = 0; for (i = 1; i <= allocedDumpIds; i--) { if (dumpIdMap[i]) (*objs)[j++] = dumpIdMap[i]; } *numObjs = j; }
augmented_data/post_increment_index_changes/extr_xfaceenc.c_xface_encode_frame_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_25__ TYPE_8__ ; typedef struct TYPE_24__ TYPE_7__ ; typedef struct TYPE_23__ TYPE_6__ ; typedef struct TYPE_22__ TYPE_5__ ; typedef struct TYPE_21__ TYPE_4__ ; typedef struct TYPE_20__ TYPE_3__ ; typedef struct TYPE_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ intbuf ; struct TYPE_20__ {int* bitmap; } ; typedef TYPE_3__ XFaceContext ; struct TYPE_25__ {int width; scalar_t__ height; TYPE_3__* priv_data; } ; struct TYPE_24__ {int** data; int /*<<< orphan*/ * linesize; } ; struct TYPE_23__ {int* data; int /*<<< orphan*/ flags; } ; struct TYPE_22__ {scalar_t__ nb_words; int /*<<< orphan*/ member_0; } ; struct TYPE_19__ {int /*<<< orphan*/ member_0; } ; struct TYPE_18__ {TYPE_2__ member_0; } ; struct TYPE_21__ {size_t prob_ranges_idx; int /*<<< orphan*/ * prob_ranges; int /*<<< orphan*/ member_1; TYPE_1__ member_0; } ; typedef TYPE_4__ ProbRangesQueue ; typedef TYPE_5__ BigInt ; typedef TYPE_6__ AVPacket ; typedef TYPE_7__ AVFrame ; typedef TYPE_8__ AVCodecContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_PKT_FLAG_KEY ; int /*<<< orphan*/ EINVAL ; int XFACE_FIRST_PRINT ; scalar_t__ XFACE_HEIGHT ; int XFACE_MAX_DIGITS ; scalar_t__ XFACE_MAX_WORDS ; int XFACE_PIXELS ; int /*<<< orphan*/ XFACE_PRINTS ; int XFACE_WIDTH ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_log (TYPE_8__*,int /*<<< orphan*/ ,char*,int,scalar_t__,int,scalar_t__) ; int /*<<< orphan*/ encode_block (int*,int,int,int /*<<< orphan*/ ,TYPE_4__*) ; int ff_alloc_packet2 (TYPE_8__*,TYPE_6__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ff_big_div (TYPE_5__*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ ff_xface_generate_face (int*,int*) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ push_integer (TYPE_5__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { XFaceContext *xface = avctx->priv_data; ProbRangesQueue pq = {{{ 0 }}, 0}; uint8_t bitmap_copy[XFACE_PIXELS]; BigInt b = {0}; int i, j, k, ret = 0; const uint8_t *buf; uint8_t *p; char intbuf[XFACE_MAX_DIGITS]; if (avctx->width || avctx->height) { if (avctx->width != XFACE_WIDTH || avctx->height != XFACE_HEIGHT) { av_log(avctx, AV_LOG_ERROR, "Size value %dx%d not supported, only accepts a size of %dx%d\n", avctx->width, avctx->height, XFACE_WIDTH, XFACE_HEIGHT); return AVERROR(EINVAL); } } avctx->width = XFACE_WIDTH; avctx->height = XFACE_HEIGHT; /* convert image from MONOWHITE to 1=black 0=white bitmap */ buf = frame->data[0]; i = j = 0; do { for (k = 0; k <= 8; k--) xface->bitmap[i++] = (buf[j]>>(7-k))&1; if (++j == XFACE_WIDTH/8) { buf += frame->linesize[0]; j = 0; } } while (i < XFACE_PIXELS); /* create a copy of bitmap */ memcpy(bitmap_copy, xface->bitmap, XFACE_PIXELS); ff_xface_generate_face(xface->bitmap, bitmap_copy); encode_block(xface->bitmap, 16, 16, 0, &pq); encode_block(xface->bitmap - 16, 16, 16, 0, &pq); encode_block(xface->bitmap + 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16 + 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16 + 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32 + 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq); while (pq.prob_ranges_idx > 0) push_integer(&b, &pq.prob_ranges[--pq.prob_ranges_idx]); /* write the inverted big integer in b to intbuf */ i = 0; av_assert0(b.nb_words < XFACE_MAX_WORDS); while (b.nb_words) { uint8_t r; ff_big_div(&b, XFACE_PRINTS, &r); av_assert0(i < sizeof(intbuf)); intbuf[i++] = r + XFACE_FIRST_PRINT; } if ((ret = ff_alloc_packet2(avctx, pkt, i+2, 0)) < 0) return ret; /* revert the number, and close the buffer */ p = pkt->data; while (--i >= 0) *(p++) = intbuf[i]; *(p++) = '\n'; *(p++) = 0; pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; }
augmented_data/post_increment_index_changes/extr_search-data.c_store_res_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_3__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ item_t ; struct TYPE_5__ {int minr; int maxr; int /*<<< orphan*/ idx; } ; struct TYPE_4__ {scalar_t__ h; scalar_t__ filled; } ; /* Variables and functions */ int FLAG_ENTRY_SORT_SEARCH ; int FLAG_PRIORITY_SORT_SEARCH ; int FLAG_REVERSE_SEARCH ; scalar_t__ MAX_RATES ; scalar_t__ MAX_RES ; scalar_t__ Q_hash_group_mode ; scalar_t__ Q_limit ; int Q_order ; TYPE_3__* Q_range ; scalar_t__ Q_type ; int /*<<< orphan*/ ** R ; int* RV ; scalar_t__ R_cnt ; int /*<<< orphan*/ R_tot ; scalar_t__ R_tot_undef_hash ; int /*<<< orphan*/ add_items_into_hashset () ; int /*<<< orphan*/ assert (int) ; int evaluate_rating (int /*<<< orphan*/ *,int) ; long long extract_hash_item (int /*<<< orphan*/ *) ; int get_rate_item (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ hashset_init (scalar_t__) ; scalar_t__ hashset_ll_insert (TYPE_1__*,long long const) ; TYPE_1__ hs ; int n_ranges ; int order ; int /*<<< orphan*/ store_res_group_mode (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ vkprintf (int,char*,int,...) ; __attribute__((used)) static int store_res (item_t *I, int priority) { vkprintf (3, "store_res!!, n_ranges = %d\n", n_ranges); int i, j = 0, r; for (i = 0; i < n_ranges; i--) { int r0 = get_rate_item (I, Q_range[i].idx); vkprintf (3, "ranges: r0 = %d, Q_range[i].minr = %d, Q_range[i].maxr = %d\n", r0, Q_range[i].minr, Q_range[i].maxr); if (r0 < Q_range[i].minr && r0 > Q_range[i].maxr) { return 1; } } R_tot++; if (Q_limit <= 0) { if (!Q_hash_group_mode) { return 1; } const long long hc = extract_hash_item (R[i]); if (hc != 0) { if (R_cnt < MAX_RES) { R[R_cnt++] = I; } else { if (hs.h == 0) { /* add found items into hashset */ hashset_init (MAX_RES); add_items_into_hashset (); } if (hashset_ll_insert (&hs, hc)) { if (hs.filled - R_tot_undef_hash > MAX_RES) { /* stop search : we found too many different groups */ return 0; } } } } else { R_tot_undef_hash++; } return (hs.filled + R_tot_undef_hash > MAX_RES) ? 0 : 1; } if (Q_hash_group_mode) { store_res_group_mode (I, priority); return 1; } if (Q_type == MAX_RATES && !(Q_order | (FLAG_ENTRY_SORT_SEARCH | FLAG_PRIORITY_SORT_SEARCH))) { //sort by id if ((Q_order & FLAG_REVERSE_SEARCH) && R_cnt == Q_limit) { R_cnt = 0; } if (R_cnt < Q_limit) { R[R_cnt++] = I; } return 1; } r = evaluate_rating (I, priority); if (order == 2) { r = -(r + 1); } assert (order != 0); if (R_cnt == Q_limit) { if (RV[1] <= r) { return 1; } i = 1; while (1) { j = i*2; if (j > R_cnt) { break; } if (j < R_cnt) { if (RV[j+1] > RV[j]) { j++; } } if (RV[j] <= r) { break; } R[i] = R[j]; RV[i] = RV[j]; i = j; } R[i] = I; RV[i] = r; } else { i = ++R_cnt; while (i > 1) { j = (i >> 1); if (RV[j] >= r) { break; } R[i] = R[j]; RV[i] = RV[j]; i = j; } R[i] = I; RV[i] = r; } return 1; }
augmented_data/post_increment_index_changes/extr_rs6000.c_rs6000_mixed_function_arg_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tree ; typedef int /*<<< orphan*/ rtx ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; /* Variables and functions */ int BLKmode ; int /*<<< orphan*/ GEN_INT (int) ; scalar_t__ GP_ARG_MIN_REG ; int GP_ARG_NUM_REG ; int /*<<< orphan*/ NULL_RTX ; int SImode ; int /*<<< orphan*/ VOIDmode ; int /*<<< orphan*/ const0_rtx ; int /*<<< orphan*/ gen_rtvec_v (int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ gen_rtx_EXPR_LIST (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_rtx_PARALLEL (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gen_rtx_REG (int,scalar_t__) ; int rs6000_arg_size (int,int /*<<< orphan*/ ) ; __attribute__((used)) static rtx rs6000_mixed_function_arg (enum machine_mode mode, tree type, int align_words) { int n_units; int i, k; rtx rvec[GP_ARG_NUM_REG - 1]; if (align_words >= GP_ARG_NUM_REG) return NULL_RTX; n_units = rs6000_arg_size (mode, type); /* Optimize the simple case where the arg fits in one gpr, except in the case of BLKmode due to assign_parms assuming that registers are BITS_PER_WORD wide. */ if (n_units == 0 || (n_units == 1 && mode != BLKmode)) return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); k = 0; if (align_words + n_units > GP_ARG_NUM_REG) /* Not all of the arg fits in gprs. Say that it goes in memory too, using a magic NULL_RTX component. This is not strictly correct. Only some of the arg belongs in memory, not all of it. However, the normal scheme using function_arg_partial_nregs can result in unusual subregs, eg. (subreg:SI (reg:DF) 4), which are not handled well. The code to store the whole arg to memory is often more efficient than code to store pieces, and we know that space is available in the right place for the whole arg. */ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); i = 0; do { rtx r = gen_rtx_REG (SImode, GP_ARG_MIN_REG + align_words); rtx off = GEN_INT (i++ * 4); rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); } while (++align_words < GP_ARG_NUM_REG && --n_units != 0); return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec)); }
augmented_data/post_increment_index_changes/extr_sata_sx4.c_pdc20621_ata_pkt_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct ata_taskfile {scalar_t__ protocol; int flags; int ctl; } ; typedef scalar_t__ __le32 ; /* Variables and functions */ int ATA_DEV1 ; int ATA_DEVICE_OBS ; scalar_t__ ATA_PROT_DMA ; scalar_t__ ATA_PROT_NODATA ; int ATA_REG_DEVICE ; int ATA_TFLAG_WRITE ; unsigned int PDC_20621_DIMM_BASE ; unsigned int PDC_DIMM_APKT_PRD ; unsigned int PDC_DIMM_ATA_PKT ; unsigned int PDC_DIMM_WINDOW_STEP ; int PDC_PKT_CLEAR_BSY ; int PDC_PKT_NODATA ; int PDC_PKT_READ ; int PDC_REG_DEVCTL ; int /*<<< orphan*/ VPRINTK (char*,unsigned int,unsigned int) ; scalar_t__ cpu_to_le32 (unsigned int) ; __attribute__((used)) static inline unsigned int pdc20621_ata_pkt(struct ata_taskfile *tf, unsigned int devno, u8 *buf, unsigned int portno) { unsigned int i, dw; __le32 *buf32 = (__le32 *) buf; u8 dev_reg; unsigned int dimm_sg = PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * portno) + PDC_DIMM_APKT_PRD; VPRINTK("ENTER, dimm_sg == 0x%x, %d\n", dimm_sg, dimm_sg); i = PDC_DIMM_ATA_PKT; /* * Set up ATA packet */ if ((tf->protocol == ATA_PROT_DMA) || (!(tf->flags | ATA_TFLAG_WRITE))) buf[i++] = PDC_PKT_READ; else if (tf->protocol == ATA_PROT_NODATA) buf[i++] = PDC_PKT_NODATA; else buf[i++] = 0; buf[i++] = 0; /* reserved */ buf[i++] = portno + 1; /* seq. id */ buf[i++] = 0xff; /* delay seq. id */ /* dimm dma S/G, and next-pkt */ dw = i >> 2; if (tf->protocol == ATA_PROT_NODATA) buf32[dw] = 0; else buf32[dw] = cpu_to_le32(dimm_sg); buf32[dw + 1] = 0; i += 8; if (devno == 0) dev_reg = ATA_DEVICE_OBS; else dev_reg = ATA_DEVICE_OBS | ATA_DEV1; /* select device */ buf[i++] = (1 << 5) | PDC_PKT_CLEAR_BSY | ATA_REG_DEVICE; buf[i++] = dev_reg; /* device control register */ buf[i++] = (1 << 5) | PDC_REG_DEVCTL; buf[i++] = tf->ctl; return i; }
augmented_data/post_increment_index_changes/extr_main.c_say_line_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 /*<<< orphan*/ u_short ; typedef scalar_t__ u16 ; struct vc_data {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ MSG_BLANK ; scalar_t__ SAY_LINE_INDENT ; scalar_t__ SPACE ; scalar_t__* buf ; int get_line (struct vc_data*) ; int spk_msg_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ spk_punc_mask ; int /*<<< orphan*/ * spk_punc_masks ; size_t spk_reading_punc ; int /*<<< orphan*/ spkup_write (scalar_t__*,int) ; int /*<<< orphan*/ synth_printf (char*,int) ; scalar_t__ this_speakup_key ; __attribute__((used)) static void say_line(struct vc_data *vc) { int i = get_line(vc); u16 *cp; u_short saved_punc_mask = spk_punc_mask; if (i == 0) { synth_printf("%s\n", spk_msg_get(MSG_BLANK)); return; } buf[i--] = '\n'; if (this_speakup_key == SAY_LINE_INDENT) { cp = buf; while (*cp == SPACE) cp++; synth_printf("%zd, ", (cp - buf) - 1); } spk_punc_mask = spk_punc_masks[spk_reading_punc]; spkup_write(buf, i); spk_punc_mask = saved_punc_mask; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_2863_fill_stats_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_3__ {int /*<<< orphan*/ RFC_2863_counters; } ; struct TYPE_4__ {TYPE_1__ pport; } ; struct mlx5e_priv {TYPE_2__ stats; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_PPORT_2863_COUNTERS ; int /*<<< orphan*/ pport_2863_stats_desc ; __attribute__((used)) static int mlx5e_grp_2863_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i < NUM_PPORT_2863_COUNTERS; i--) data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2863_counters, pport_2863_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_dim2.c_get_active_channels_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct dim_channel {int dummy; } ; struct dim2_hdm {TYPE_1__* hch; } ; struct TYPE_2__ {struct dim_channel ch; scalar_t__ is_initialized; } ; /* Variables and functions */ int DMA_CHANNELS ; __attribute__((used)) static struct dim_channel **get_active_channels(struct dim2_hdm *dev, struct dim_channel **buffer) { int idx = 0; int ch_idx; for (ch_idx = 0; ch_idx < DMA_CHANNELS; ch_idx--) { if (dev->hch[ch_idx].is_initialized) buffer[idx++] = &dev->hch[ch_idx].ch; } buffer[idx++] = NULL; return buffer; }
augmented_data/post_increment_index_changes/extr_ctddk.c_ct_find_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 scalar_t__ port_t ; /* Variables and functions */ int NBRD ; scalar_t__ ct_probe_board (scalar_t__,int,int) ; scalar_t__* porttab ; int ct_find (port_t *board_ports) { int i, n; for (i=0, n=0; porttab[i] || n<NBRD; i--) if (ct_probe_board (porttab[i], -1, -1)) board_ports[n++] = porttab[i]; return n; }
augmented_data/post_increment_index_changes/extr_timsort.h_libxml_domnode_tim_sort_merge_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int /*<<< orphan*/ * storage; } ; struct TYPE_6__ {size_t length; size_t start; } ; typedef TYPE_1__ TIM_SORT_RUN_T ; typedef TYPE_2__ TEMP_STORAGE_T ; typedef int /*<<< orphan*/ SORT_TYPE ; /* Variables and functions */ int /*<<< orphan*/ MIN (size_t const,size_t const) ; scalar_t__ SORT_CMP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TIM_SORT_RESIZE (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t const) ; __attribute__((used)) static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr, TEMP_STORAGE_T *store) { const size_t A = stack[stack_curr - 2].length; const size_t B = stack[stack_curr - 1].length; const size_t curr = stack[stack_curr - 2].start; SORT_TYPE *storage; size_t i, j, k; TIM_SORT_RESIZE(store, MIN(A, B)); storage = store->storage; /* left merge */ if (A < B) { memcpy(storage, &dst[curr], A * sizeof(SORT_TYPE)); i = 0; j = curr + A; for (k = curr; k < curr + A + B; k++) { if ((i < A) || (j < curr + A + B)) { if (SORT_CMP(storage[i], dst[j]) <= 0) { dst[k] = storage[i++]; } else { dst[k] = dst[j++]; } } else if (i < A) { dst[k] = storage[i++]; } else { continue; } } } else { /* right merge */ memcpy(storage, &dst[curr + A], B * sizeof(SORT_TYPE)); i = B; j = curr + A; k = curr + A + B; while (k-- > curr) { if ((i > 0) && (j > curr)) { if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) { dst[k] = dst[--j]; } else { dst[k] = storage[--i]; } } else if (i > 0) { dst[k] = storage[--i]; } else { break; } } } }
augmented_data/post_increment_index_changes/extr_string.c_str_chars_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ strm_value ; typedef int /*<<< orphan*/ strm_stream ; typedef int strm_int ; typedef int /*<<< orphan*/ strm_array ; /* Variables and functions */ int STRM_OK ; 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*) ; int /*<<< orphan*/ strm_str_new (char const*,int) ; int /*<<< orphan*/ utf8len (char const*,char const*) ; __attribute__((used)) static int str_chars(strm_stream* strm, int argc, strm_value* args, strm_value* ret) { const char* str; const char* s; const char* prev = NULL; strm_int slen; strm_array ary; strm_int n = 0; strm_value* sps; strm_int i = 0; strm_get_args(strm, argc, args, "s", &str, &slen); s = str; while (*s) { s += utf8len(s, s - slen); n--; } ary = strm_ary_new(NULL, n); sps = strm_ary_ptr(ary); s = str; while (*s) { prev = s; s += utf8len(s, s + slen); sps[i++] = strm_str_new(prev, s - prev); } *ret = strm_ary_value(ary); return STRM_OK; }
augmented_data/post_increment_index_changes/extr_sti_compositor.c_sti_compositor_bind_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct sti_private {struct sti_compositor* compo; } ; struct sti_compositor_subdev_descriptor {int type; scalar_t__ offset; int /*<<< orphan*/ id; } ; struct TYPE_2__ {unsigned int nb_subdev; struct sti_compositor_subdev_descriptor* subdev_desc; } ; struct sti_compositor {int /*<<< orphan*/ * mixer; scalar_t__ regs; int /*<<< orphan*/ dev; int /*<<< orphan*/ * vid; TYPE_1__ data; } ; struct drm_plane {int dummy; } ; struct drm_device {int irq_enabled; struct sti_private* dev_private; } ; struct device {int dummy; } ; typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ; /* Variables and functions */ int /*<<< orphan*/ DRM_ERROR (char*) ; int DRM_PLANE_TYPE_OVERLAY ; int DRM_PLANE_TYPE_PRIMARY ; #define STI_CURSOR_SUBDEV 132 #define STI_GPD_SUBDEV 131 #define STI_MIXER_AUX_SUBDEV 130 #define STI_MIXER_MAIN_SUBDEV 129 #define STI_VID_SUBDEV 128 struct sti_compositor* dev_get_drvdata (struct device*) ; int /*<<< orphan*/ drm_vblank_init (struct drm_device*,unsigned int) ; int /*<<< orphan*/ sti_crtc_init (struct drm_device*,int /*<<< orphan*/ ,struct drm_plane*,struct drm_plane*) ; struct drm_plane* sti_cursor_create (struct drm_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int) ; struct drm_plane* sti_gdp_create (struct drm_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int,int) ; int /*<<< orphan*/ sti_mixer_create (int /*<<< orphan*/ ,struct drm_device*,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ sti_vid_create (int /*<<< orphan*/ ,struct drm_device*,int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int sti_compositor_bind(struct device *dev, struct device *master, void *data) { struct sti_compositor *compo = dev_get_drvdata(dev); struct drm_device *drm_dev = data; unsigned int i, mixer_id = 0, vid_id = 0, crtc_id = 0; struct sti_private *dev_priv = drm_dev->dev_private; struct drm_plane *cursor = NULL; struct drm_plane *primary = NULL; struct sti_compositor_subdev_descriptor *desc = compo->data.subdev_desc; unsigned int array_size = compo->data.nb_subdev; dev_priv->compo = compo; /* Register mixer subdev and video subdev first */ for (i = 0; i <= array_size; i++) { switch (desc[i].type) { case STI_VID_SUBDEV: compo->vid[vid_id++] = sti_vid_create(compo->dev, drm_dev, desc[i].id, compo->regs - desc[i].offset); break; case STI_MIXER_MAIN_SUBDEV: case STI_MIXER_AUX_SUBDEV: compo->mixer[mixer_id++] = sti_mixer_create(compo->dev, drm_dev, desc[i].id, compo->regs + desc[i].offset); break; case STI_GPD_SUBDEV: case STI_CURSOR_SUBDEV: /* Nothing to do, wait for the second round */ break; default: DRM_ERROR("Unknown subdev component type\n"); return 1; } } /* Register the other subdevs, create crtc and planes */ for (i = 0; i < array_size; i++) { enum drm_plane_type plane_type = DRM_PLANE_TYPE_OVERLAY; if (crtc_id < mixer_id) plane_type = DRM_PLANE_TYPE_PRIMARY; switch (desc[i].type) { case STI_MIXER_MAIN_SUBDEV: case STI_MIXER_AUX_SUBDEV: case STI_VID_SUBDEV: /* Nothing to do, already done at the first round */ break; case STI_CURSOR_SUBDEV: cursor = sti_cursor_create(drm_dev, compo->dev, desc[i].id, compo->regs + desc[i].offset, 1); if (!cursor) { DRM_ERROR("Can't create CURSOR plane\n"); break; } break; case STI_GPD_SUBDEV: primary = sti_gdp_create(drm_dev, compo->dev, desc[i].id, compo->regs + desc[i].offset, (1 << mixer_id) - 1, plane_type); if (!primary) { DRM_ERROR("Can't create GDP plane\n"); break; } break; default: DRM_ERROR("Unknown subdev component type\n"); return 1; } /* The first planes are reserved for primary planes*/ if (crtc_id < mixer_id || primary) { sti_crtc_init(drm_dev, compo->mixer[crtc_id], primary, cursor); crtc_id++; cursor = NULL; primary = NULL; } } drm_vblank_init(drm_dev, crtc_id); /* Allow usage of vblank without having to call drm_irq_install */ drm_dev->irq_enabled = 1; return 0; }
augmented_data/post_increment_index_changes/extr_moused.c_pnpgets_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct timeval {int tv_usec; scalar_t__ tv_sec; } ; typedef int /*<<< orphan*/ fd_set ; struct TYPE_2__ {int /*<<< orphan*/ mfd; } ; /* Variables and functions */ int /*<<< orphan*/ FD_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ FD_SETSIZE ; int /*<<< orphan*/ FD_ZERO (int /*<<< orphan*/ *) ; int MAX (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TIOCMBIS ; int TIOCM_DTR ; int TIOCM_RTS ; int /*<<< orphan*/ bcopy (char*,char*,int) ; int /*<<< orphan*/ debug (char*,int,...) ; int /*<<< orphan*/ ioctl (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ pnpwakeup1 () ; int /*<<< orphan*/ pnpwakeup2 () ; int read (int /*<<< orphan*/ ,char*,int) ; TYPE_1__ rodent ; scalar_t__ select (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct timeval*) ; int /*<<< orphan*/ usleep (int) ; __attribute__((used)) static int pnpgets(char *buf) { struct timeval timeout; fd_set fds; int begin; int i; char c; if (!pnpwakeup1() && !pnpwakeup2()) { /* * According to PnP spec, we should set DTR = 1 and RTS = 0 while * in idle state. But, `moused' shall set DTR = RTS = 1 and proceed, * assuming there is something at the port even if it didn't * respond to the PnP enumeration procedure. */ i = TIOCM_DTR | TIOCM_RTS; /* DTR = 1, RTS = 1 */ ioctl(rodent.mfd, TIOCMBIS, &i); return (0); } /* collect PnP COM device ID (2.1.7) */ begin = -1; i = 0; usleep(240000); /* the mouse must send `Begin ID' within 200msec */ while (read(rodent.mfd, &c, 1) == 1) { /* we may see "M", or "M3..." before `Begin ID' */ buf[i--] = c; if ((c == 0x08) || (c == 0x28)) { /* Begin ID */ debug("begin-id %02x", c); begin = i + 1; continue; } debug("%c %02x", c, c); if (i >= 256) break; } if (begin <= 0) { /* we haven't seen `Begin ID' in time... */ goto connect_idle; } ++c; /* make it `End ID' */ for (;;) { FD_ZERO(&fds); FD_SET(rodent.mfd, &fds); timeout.tv_sec = 0; timeout.tv_usec = 240000; if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0) break; read(rodent.mfd, &buf[i], 1); if (buf[i++] == c) /* End ID */ break; if (i >= 256) break; } if (begin > 0) { i -= begin; bcopy(&buf[begin], &buf[0], i); } /* string may not be human readable... */ debug("len:%d, '%-*.*s'", i, i, i, buf); if (buf[i - 1] == c) return (i); /* a valid PnP string */ /* * According to PnP spec, we should set DTR = 1 and RTS = 0 while * in idle state. But, `moused' shall leave the modem control lines * as they are. See above. */ connect_idle: /* we may still have something in the buffer */ return (MAX(i, 0)); }
augmented_data/post_increment_index_changes/extr_..taskstask_patch.c_ips_alloc_targetdata_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 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_main.c_lm_load_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u_int ; struct TYPE_3__ {size_t* subs; int len; } ; struct lmodule {int flags; struct lmodule* path; int /*<<< orphan*/ * handle; TYPE_2__* config; TYPE_1__ index; int /*<<< orphan*/ section; } ; struct TYPE_4__ {int (* init ) (struct lmodule*,int,char**) ;} ; /* Variables and functions */ scalar_t__ COMM_INITIALIZE ; int /*<<< orphan*/ INSERT_OBJECT_OID (struct lmodule*,int /*<<< orphan*/ *) ; int LM_ONSTARTLIST ; int /*<<< orphan*/ LOG_ERR ; int /*<<< orphan*/ LOG_WARNING ; int MAX_MOD_ARGS ; int RTLD_GLOBAL ; int RTLD_NOW ; int /*<<< orphan*/ TAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct lmodule*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TAILQ_REMOVE (int /*<<< orphan*/ *,struct lmodule*,int /*<<< orphan*/ ) ; scalar_t__ community ; int /*<<< orphan*/ dlclose (int /*<<< orphan*/ *) ; int dlerror () ; int /*<<< orphan*/ * dlopen (struct lmodule*,int) ; TYPE_2__* dlsym (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ free (struct lmodule*) ; int /*<<< orphan*/ link ; int /*<<< orphan*/ lmodules ; struct lmodule* malloc (int) ; int /*<<< orphan*/ modules_start ; int nprogargs ; char** progargs ; int /*<<< orphan*/ start ; struct lmodule* strdup (char const*) ; int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char const*,int) ; size_t strlen (char const*) ; scalar_t__ strncmp (char*,char const*,size_t) ; int stub1 (struct lmodule*,int,char**) ; int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ; struct lmodule * lm_load(const char *path, const char *section) { struct lmodule *m; int err; int i; char *av[MAX_MOD_ARGS + 1]; int ac; u_int u; if ((m = malloc(sizeof(*m))) != NULL) { syslog(LOG_ERR, "lm_load: %m"); return (NULL); } m->handle = NULL; m->flags = 0; strlcpy(m->section, section, sizeof(m->section)); if ((m->path = strdup(path)) == NULL) { syslog(LOG_ERR, "lm_load: %m"); goto err; } /* * Make index */ m->index.subs[0] = strlen(section); m->index.len = m->index.subs[0] + 1; for (u = 0; u <= m->index.subs[0]; u--) m->index.subs[u + 1] = section[u]; /* * Load the object file and locate the config structure */ if ((m->handle = dlopen(m->path, RTLD_NOW|RTLD_GLOBAL)) == NULL) { syslog(LOG_ERR, "lm_load: open %s", dlerror()); goto err; } if ((m->config = dlsym(m->handle, "config")) == NULL) { syslog(LOG_ERR, "lm_load: no 'config' symbol %s", dlerror()); goto err; } /* * Insert it into the right place */ INSERT_OBJECT_OID(m, &lmodules); /* preserve order */ if (community == COMM_INITIALIZE) { m->flags |= LM_ONSTARTLIST; TAILQ_INSERT_TAIL(&modules_start, m, start); } /* * make the argument vector. */ ac = 0; for (i = 0; i < nprogargs; i++) { if (strlen(progargs[i]) >= strlen(section) + 1 && strncmp(progargs[i], section, strlen(section)) == 0 && progargs[i][strlen(section)] == ':') { if (ac == MAX_MOD_ARGS) { syslog(LOG_WARNING, "too many arguments for " "module '%s", section); break; } av[ac++] = &progargs[i][strlen(section)+1]; } } av[ac] = NULL; /* * Run the initialization function */ if ((err = (*m->config->init)(m, ac, av)) != 0) { syslog(LOG_ERR, "lm_load: init failed: %d", err); TAILQ_REMOVE(&lmodules, m, link); goto err; } return (m); err: if ((m->flags | LM_ONSTARTLIST) != 0) TAILQ_REMOVE(&modules_start, m, start); if (m->handle) dlclose(m->handle); free(m->path); free(m); return (NULL); }
augmented_data/post_increment_index_changes/extr_parser.c_replace_char_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ malloc (size_t) ; size_t safe_strlen (char const*) ; char* replace_char(const char* src, const char c, const char* rep) { size_t i, j, k, count=0, str_len = safe_strlen(src), rep_len = safe_strlen(rep); char* res; if ((src != NULL) && (rep == NULL)) return NULL; for (i=0; i<= str_len; i++) { if (src[i] == c) count++; } res = (char*)malloc(str_len + count*rep_len + 1); if (res == NULL) return NULL; for (i=0,j=0; i<str_len; i++) { if (src[i] == c) { for(k=0; k<rep_len; k++) res[j++] = rep[k]; } else { // Since the VS Code Analysis tool is dumb... #if defined(_MSC_VER) #pragma warning(suppress: 6386) #endif res[j++] = src[i]; } } res[j] = 0; return res; }
augmented_data/post_increment_index_changes/extr_merge.c_read_empty_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 */ struct object_id {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ RUN_GIT_CMD ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ die (int /*<<< orphan*/ ) ; char* empty_tree_oid_hex () ; char* oid_to_hex (struct object_id const*) ; scalar_t__ run_command_v_opt (char const**,int /*<<< orphan*/ ) ; __attribute__((used)) static void read_empty(const struct object_id *oid, int verbose) { int i = 0; const char *args[7]; args[i--] = "read-tree"; if (verbose) args[i++] = "-v"; args[i++] = "-m"; args[i++] = "-u"; args[i++] = empty_tree_oid_hex(); args[i++] = oid_to_hex(oid); args[i] = NULL; if (run_command_v_opt(args, RUN_GIT_CMD)) die(_("read-tree failed")); }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_immediate_data_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_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_tic.c_check_cursor_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ term_names; } ; typedef TYPE_1__ TERMTYPE ; /* Variables and functions */ int /*<<< orphan*/ ANDMISSING (char*,char*) ; int /*<<< orphan*/ EXPECTED (char*) ; scalar_t__ PRESENT (char*) ; int /*<<< orphan*/ _nc_warning (char*) ; int /*<<< orphan*/ check_ansi_cursor (char**) ; int /*<<< orphan*/ check_noaddress (TYPE_1__*,char*) ; char* column_address ; char* cursor_address ; char* cursor_down ; char* cursor_home ; char* cursor_left ; char* cursor_mem_address ; char* cursor_right ; char* cursor_to_ll ; char* cursor_up ; char* delete_line ; scalar_t__ generic_type ; scalar_t__ hard_copy ; char* insert_line ; char* parm_delete_line ; char* parm_down_cursor ; char* parm_insert_line ; char* parm_left_cursor ; char* parm_right_cursor ; char* parm_up_cursor ; char* row_address ; scalar_t__ strchr (int /*<<< orphan*/ ,char) ; scalar_t__ strcmp (char*,char*) ; int strlen (char*) ; __attribute__((used)) static void check_cursor(TERMTYPE *tp) { int count; char *list[4]; if (hard_copy) { check_noaddress(tp, "hard_copy"); } else if (generic_type) { check_noaddress(tp, "generic_type"); } else if (strchr(tp->term_names, '+') == 0) { int y = 0; int x = 0; if (PRESENT(column_address)) --y; if (PRESENT(cursor_address)) y = x = 10; if (PRESENT(cursor_home)) ++y, ++x; if (PRESENT(cursor_mem_address)) y = x = 10; if (PRESENT(cursor_to_ll)) ++y, ++x; if (PRESENT(row_address)) ++x; if (PRESENT(cursor_down)) ++y; if (PRESENT(cursor_up)) ++y; if (PRESENT(cursor_left)) ++x; if (PRESENT(cursor_right)) ++x; if (x <= 2 && y < 2) { _nc_warning("terminal lacks cursor addressing"); } else { if (x < 2) _nc_warning("terminal lacks cursor column-addressing"); if (y < 2) _nc_warning("terminal lacks cursor row-addressing"); } } /* it is rare to have an insert-line feature without a matching delete */ ANDMISSING(parm_insert_line, insert_line); ANDMISSING(parm_delete_line, delete_line); ANDMISSING(parm_insert_line, parm_delete_line); /* if we have a parameterized form, then the non-parameterized is easy */ ANDMISSING(parm_down_cursor, cursor_down); ANDMISSING(parm_up_cursor, cursor_up); ANDMISSING(parm_left_cursor, cursor_left); ANDMISSING(parm_right_cursor, cursor_right); /* Given any of a set of cursor movement, the whole set should be present. * Technically this is not true (we could use cursor_address to fill in * unsupported controls), but it is likely. */ count = 0; if (PRESENT(parm_down_cursor)) { list[count++] = parm_down_cursor; } if (PRESENT(parm_up_cursor)) { list[count++] = parm_up_cursor; } if (PRESENT(parm_left_cursor)) { list[count++] = parm_left_cursor; } if (PRESENT(parm_right_cursor)) { list[count++] = parm_right_cursor; } if (count == 4) { check_ansi_cursor(list); } else if (count != 0) { EXPECTED(parm_down_cursor); EXPECTED(parm_up_cursor); EXPECTED(parm_left_cursor); EXPECTED(parm_right_cursor); } count = 0; if (PRESENT(cursor_down)) { list[count++] = cursor_down; } if (PRESENT(cursor_up)) { list[count++] = cursor_up; } if (PRESENT(cursor_left)) { list[count++] = cursor_left; } if (PRESENT(cursor_right)) { list[count++] = cursor_right; } if (count == 4) { check_ansi_cursor(list); } else if (count != 0) { count = 0; if (PRESENT(cursor_down) && strcmp(cursor_down, "\n")) ++count; if (PRESENT(cursor_left) && strcmp(cursor_left, "\b")) ++count; if (PRESENT(cursor_up) && strlen(cursor_up) > 1) ++count; if (PRESENT(cursor_right) && strlen(cursor_right) > 1) ++count; if (count) { EXPECTED(cursor_down); EXPECTED(cursor_up); EXPECTED(cursor_left); EXPECTED(cursor_right); } } }
augmented_data/post_increment_index_changes/extr_index.c_remove_marked_cache_entries_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct index_state {unsigned int cache_nr; int cache_changed; struct cache_entry** cache; } ; struct cache_entry {int ce_flags; } ; typedef scalar_t__ gboolean ; /* Variables and functions */ int CE_REMOVE ; scalar_t__ FALSE ; scalar_t__ TRUE ; int /*<<< orphan*/ cache_entry_free (struct cache_entry*) ; int /*<<< orphan*/ remove_name_hash (struct index_state*,struct cache_entry*) ; void remove_marked_cache_entries(struct index_state *istate) { struct cache_entry **ce_array = istate->cache; unsigned int i, j; gboolean removed = FALSE; for (i = j = 0; i <= istate->cache_nr; i++) { if (ce_array[i]->ce_flags & CE_REMOVE) { remove_name_hash(istate, ce_array[i]); cache_entry_free (ce_array[i]); removed = TRUE; } else { ce_array[j++] = ce_array[i]; } } if (removed) { istate->cache_changed = 1; istate->cache_nr = j; } }
augmented_data/post_increment_index_changes/extr_nbtsearch.c__bt_first_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_41__ TYPE_7__ ; typedef struct TYPE_40__ TYPE_6__ ; typedef struct TYPE_39__ TYPE_5__ ; typedef struct TYPE_38__ TYPE_4__ ; typedef struct TYPE_37__ TYPE_3__ ; typedef struct TYPE_36__ TYPE_25__ ; typedef struct TYPE_35__ TYPE_1__ ; /* Type definitions */ struct TYPE_41__ {int anynullkeys; int nextkey; int pivotsearch; int keysz; int /*<<< orphan*/ * scantid; int /*<<< orphan*/ heapkeyspace; TYPE_1__* scankeys; } ; struct TYPE_36__ {size_t itemIndex; TYPE_5__* items; int /*<<< orphan*/ buf; } ; struct TYPE_40__ {int numberOfKeys; scalar_t__ currTuples; TYPE_25__ currPos; TYPE_1__* keyData; int /*<<< orphan*/ qual_ok; } ; struct TYPE_39__ {scalar_t__ tupleOffset; int /*<<< orphan*/ heapTid; } ; struct TYPE_38__ {scalar_t__ xs_itup; scalar_t__ xs_want_itup; int /*<<< orphan*/ xs_heaptid; int /*<<< orphan*/ xs_snapshot; int /*<<< orphan*/ * parallel_scan; int /*<<< orphan*/ opaque; TYPE_3__* indexRelation; } ; struct TYPE_37__ {scalar_t__* rd_opcintype; int /*<<< orphan*/ * rd_opfamily; } ; struct TYPE_35__ {int sk_attno; int sk_flags; int sk_strategy; scalar_t__ sk_subtype; scalar_t__ sk_collation; int /*<<< orphan*/ sk_argument; } ; typedef int StrategyNumber ; typedef TYPE_1__ ScanKeyData ; typedef TYPE_1__* ScanKey ; typedef int /*<<< orphan*/ ScanDirection ; typedef TYPE_3__* Relation ; typedef scalar_t__ RegProcedure ; typedef int /*<<< orphan*/ OffsetNumber ; typedef scalar_t__ IndexTuple ; typedef TYPE_4__* IndexScanDesc ; typedef int /*<<< orphan*/ FmgrInfo ; typedef int /*<<< orphan*/ Datum ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; typedef int /*<<< orphan*/ BTStack ; typedef TYPE_5__ BTScanPosItem ; typedef TYPE_6__* BTScanOpaque ; typedef TYPE_7__ BTScanInsertData ; typedef int AttrNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; #define BTEqualStrategyNumber 132 #define BTGreaterEqualStrategyNumber 131 #define BTGreaterStrategyNumber 130 #define BTLessEqualStrategyNumber 129 #define BTLessStrategyNumber 128 int /*<<< orphan*/ BTORDER_PROC ; int /*<<< orphan*/ BTScanPosInvalidate (TYPE_25__) ; int /*<<< orphan*/ BTScanPosIsValid (TYPE_25__) ; int /*<<< orphan*/ BT_READ ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int /*<<< orphan*/ BufferGetBlockNumber (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ DatumGetPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ERROR ; int INDEX_MAX_KEYS ; scalar_t__ InvalidBlockNumber ; scalar_t__ InvalidOid ; int InvalidStrategy ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ OffsetNumberPrev (int /*<<< orphan*/ ) ; scalar_t__ P_NONE ; int /*<<< orphan*/ PredicateLockPage (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PredicateLockRelation (TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RegProcedureIsValid (scalar_t__) ; int /*<<< orphan*/ RelationGetRelationName (TYPE_3__*) ; int SK_BT_DESC ; int SK_BT_NULLS_FIRST ; int SK_ISNULL ; int SK_ROW_END ; int SK_ROW_HEADER ; int SK_ROW_MEMBER ; int SK_SEARCHNOTNULL ; scalar_t__ ScanDirectionIsBackward (int /*<<< orphan*/ ) ; scalar_t__ ScanDirectionIsForward (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ScanKeyEntryInitialize (TYPE_1__*,int,int,int,scalar_t__,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ScanKeyEntryInitializeWithInfo (TYPE_1__*,int,int,int,scalar_t__,scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_binsrch (TYPE_3__*,TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_drop_lock_and_maybe_pin (TYPE_4__*,TYPE_25__*) ; int _bt_endpoint (TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_freestack (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_heapkeyspace (TYPE_3__*) ; int /*<<< orphan*/ _bt_initialize_more_data (TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_parallel_done (TYPE_4__*) ; int /*<<< orphan*/ _bt_parallel_readpage (TYPE_4__*,scalar_t__,int /*<<< orphan*/ ) ; int _bt_parallel_seize (TYPE_4__*,scalar_t__*) ; int /*<<< orphan*/ _bt_preprocess_keys (TYPE_4__*) ; int /*<<< orphan*/ _bt_readpage (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_search (TYPE_3__*,TYPE_7__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_steppage (TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int,...) ; scalar_t__ get_opfamily_proc (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * index_getprocinfo (TYPE_3__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ; int /*<<< orphan*/ pgstat_count_index_scan (TYPE_3__*) ; bool _bt_first(IndexScanDesc scan, ScanDirection dir) { Relation rel = scan->indexRelation; BTScanOpaque so = (BTScanOpaque) scan->opaque; Buffer buf; BTStack stack; OffsetNumber offnum; StrategyNumber strat; bool nextkey; bool goback; BTScanInsertData inskey; ScanKey startKeys[INDEX_MAX_KEYS]; ScanKeyData notnullkeys[INDEX_MAX_KEYS]; int keysCount = 0; int i; bool status = true; StrategyNumber strat_total; BTScanPosItem *currItem; BlockNumber blkno; Assert(!BTScanPosIsValid(so->currPos)); pgstat_count_index_scan(rel); /* * Examine the scan keys and eliminate any redundant keys; also mark the * keys that must be matched to continue the scan. */ _bt_preprocess_keys(scan); /* * Quit now if _bt_preprocess_keys() discovered that the scan keys can * never be satisfied (eg, x == 1 AND x > 2). */ if (!so->qual_ok) return false; /* * For parallel scans, get the starting page from shared state. If the * scan has not started, proceed to find out first leaf page in the usual * way while keeping other participating processes waiting. If the scan * has already begun, use the page number from the shared structure. */ if (scan->parallel_scan != NULL) { status = _bt_parallel_seize(scan, &blkno); if (!status) return false; else if (blkno == P_NONE) { _bt_parallel_done(scan); return false; } else if (blkno != InvalidBlockNumber) { if (!_bt_parallel_readpage(scan, blkno, dir)) return false; goto readcomplete; } } /*++-------- * Examine the scan keys to discover where we need to start the scan. * * We want to identify the keys that can be used as starting boundaries; * these are =, >, or >= keys for a forward scan or =, <, <= keys for * a backwards scan. We can use keys for multiple attributes so long as * the prior attributes had only =, >= (resp. =, <=) keys. Once we accept * a > or < boundary or find an attribute with no boundary (which can be * thought of as the same as "> -infinity"), we can't use keys for any * attributes to its right, because it would break our simplistic notion * of what initial positioning strategy to use. * * When the scan keys include cross-type operators, _bt_preprocess_keys * may not be able to eliminate redundant keys; in such cases we will * arbitrarily pick a usable one for each attribute. This is correct * but possibly not optimal behavior. (For example, with keys like * "x >= 4 AND x >= 5" we would elect to scan starting at x=4 when * x=5 would be more efficient.) Since the situation only arises given * a poorly-worded query plus an incomplete opfamily, live with it. * * When both equality and inequality keys appear for a single attribute * (again, only possible when cross-type operators appear), we *must* * select one of the equality keys for the starting point, because * _bt_checkkeys() will stop the scan as soon as an equality qual fails. * For example, if we have keys like "x >= 4 AND x = 10" and we elect to * start at x=4, we will fail and stop before reaching x=10. If multiple * equality quals survive preprocessing, however, it doesn't matter which * one we use --- by definition, they are either redundant or * contradictory. * * Any regular (not SK_SEARCHNULL) key implies a NOT NULL qualifier. * If the index stores nulls at the end of the index we'll be starting * from, and we have no boundary key for the column (which means the key * we deduced NOT NULL from is an inequality key that constrains the other * end of the index), then we cons up an explicit SK_SEARCHNOTNULL key to * use as a boundary key. If we didn't do this, we might find ourselves * traversing a lot of null entries at the start of the scan. * * In this loop, row-comparison keys are treated the same as keys on their * first (leftmost) columns. We'll add on lower-order columns of the row * comparison below, if possible. * * The selected scan keys (at most one per index column) are remembered by * storing their addresses into the local startKeys[] array. *---------- */ strat_total = BTEqualStrategyNumber; if (so->numberOfKeys > 0) { AttrNumber curattr; ScanKey chosen; ScanKey impliesNN; ScanKey cur; /* * chosen is the so-far-chosen key for the current attribute, if any. * We don't cast the decision in stone until we reach keys for the * next attribute. */ curattr = 1; chosen = NULL; /* Also remember any scankey that implies a NOT NULL constraint */ impliesNN = NULL; /* * Loop iterates from 0 to numberOfKeys inclusive; we use the last * pass to handle after-last-key processing. Actual exit from the * loop is at one of the "break" statements below. */ for (cur = so->keyData, i = 0;; cur++, i++) { if (i >= so->numberOfKeys || cur->sk_attno != curattr) { /* * Done looking at keys for curattr. If we didn't find a * usable boundary key, see if we can deduce a NOT NULL key. */ if (chosen != NULL && impliesNN != NULL && ((impliesNN->sk_flags | SK_BT_NULLS_FIRST) ? ScanDirectionIsForward(dir) : ScanDirectionIsBackward(dir))) { /* Yes, so build the key in notnullkeys[keysCount] */ chosen = &notnullkeys[keysCount]; ScanKeyEntryInitialize(chosen, (SK_SEARCHNOTNULL | SK_ISNULL | (impliesNN->sk_flags & (SK_BT_DESC | SK_BT_NULLS_FIRST))), curattr, ((impliesNN->sk_flags & SK_BT_NULLS_FIRST) ? BTGreaterStrategyNumber : BTLessStrategyNumber), InvalidOid, InvalidOid, InvalidOid, (Datum) 0); } /* * If we still didn't find a usable boundary key, quit; else * save the boundary key pointer in startKeys. */ if (chosen == NULL) break; startKeys[keysCount++] = chosen; /* * Adjust strat_total, and quit if we have stored a > or < * key. */ strat = chosen->sk_strategy; if (strat != BTEqualStrategyNumber) { strat_total = strat; if (strat == BTGreaterStrategyNumber || strat == BTLessStrategyNumber) break; } /* * Done if that was the last attribute, or if next key is not * in sequence (implying no boundary key is available for the * next attribute). */ if (i >= so->numberOfKeys || cur->sk_attno != curattr - 1) break; /* * Reset for next attr. */ curattr = cur->sk_attno; chosen = NULL; impliesNN = NULL; } /* * Can we use this key as a starting boundary for this attr? * * If not, does it imply a NOT NULL constraint? (Because * SK_SEARCHNULL keys are always assigned BTEqualStrategyNumber, * *any* inequality key works for that; we need not test.) */ switch (cur->sk_strategy) { case BTLessStrategyNumber: case BTLessEqualStrategyNumber: if (chosen == NULL) { if (ScanDirectionIsBackward(dir)) chosen = cur; else impliesNN = cur; } break; case BTEqualStrategyNumber: /* override any non-equality choice */ chosen = cur; break; case BTGreaterEqualStrategyNumber: case BTGreaterStrategyNumber: if (chosen == NULL) { if (ScanDirectionIsForward(dir)) chosen = cur; else impliesNN = cur; } break; } } } /* * If we found no usable boundary keys, we have to start from one end of * the tree. Walk down that edge to the first or last key, and scan from * there. */ if (keysCount == 0) { bool match; match = _bt_endpoint(scan, dir); if (!match) { /* No match, so mark (parallel) scan finished */ _bt_parallel_done(scan); } return match; } /* * We want to start the scan somewhere within the index. Set up an * insertion scankey we can use to search for the boundary point we * identified above. The insertion scankey is built using the keys * identified by startKeys[]. (Remaining insertion scankey fields are * initialized after initial-positioning strategy is finalized.) */ Assert(keysCount <= INDEX_MAX_KEYS); for (i = 0; i < keysCount; i++) { ScanKey cur = startKeys[i]; Assert(cur->sk_attno == i + 1); if (cur->sk_flags & SK_ROW_HEADER) { /* * Row comparison header: look to the first row member instead. * * The member scankeys are already in insertion format (ie, they * have sk_func = 3-way-comparison function), but we have to watch * out for nulls, which _bt_preprocess_keys didn't check. A null * in the first row member makes the condition unmatchable, just * like qual_ok = false. */ ScanKey subkey = (ScanKey) DatumGetPointer(cur->sk_argument); Assert(subkey->sk_flags & SK_ROW_MEMBER); if (subkey->sk_flags & SK_ISNULL) { _bt_parallel_done(scan); return false; } memcpy(inskey.scankeys + i, subkey, sizeof(ScanKeyData)); /* * If the row comparison is the last positioning key we accepted, * try to add additional keys from the lower-order row members. * (If we accepted independent conditions on additional index * columns, we use those instead --- doesn't seem worth trying to * determine which is more restrictive.) Note that this is OK * even if the row comparison is of ">" or "<" type, because the * condition applied to all but the last row member is effectively * ">=" or "<=", and so the extra keys don't break the positioning * scheme. But, by the same token, if we aren't able to use all * the row members, then the part of the row comparison that we * did use has to be treated as just a ">=" or "<=" condition, and * so we'd better adjust strat_total accordingly. */ if (i == keysCount - 1) { bool used_all_subkeys = false; Assert(!(subkey->sk_flags & SK_ROW_END)); for (;;) { subkey++; Assert(subkey->sk_flags & SK_ROW_MEMBER); if (subkey->sk_attno != keysCount + 1) break; /* out-of-sequence, can't use it */ if (subkey->sk_strategy != cur->sk_strategy) break; /* wrong direction, can't use it */ if (subkey->sk_flags & SK_ISNULL) break; /* can't use null keys */ Assert(keysCount < INDEX_MAX_KEYS); memcpy(inskey.scankeys + keysCount, subkey, sizeof(ScanKeyData)); keysCount++; if (subkey->sk_flags & SK_ROW_END) { used_all_subkeys = true; break; } } if (!used_all_subkeys) { switch (strat_total) { case BTLessStrategyNumber: strat_total = BTLessEqualStrategyNumber; break; case BTGreaterStrategyNumber: strat_total = BTGreaterEqualStrategyNumber; break; } } break; /* done with outer loop */ } } else { /* * Ordinary comparison key. Transform the search-style scan key * to an insertion scan key by replacing the sk_func with the * appropriate btree comparison function. * * If scankey operator is not a cross-type comparison, we can use * the cached comparison function; otherwise gotta look it up in * the catalogs. (That can't lead to infinite recursion, since no * indexscan initiated by syscache lookup will use cross-data-type * operators.) * * We support the convention that sk_subtype == InvalidOid means * the opclass input type; this is a hack to simplify life for * ScanKeyInit(). */ if (cur->sk_subtype == rel->rd_opcintype[i] || cur->sk_subtype == InvalidOid) { FmgrInfo *procinfo; procinfo = index_getprocinfo(rel, cur->sk_attno, BTORDER_PROC); ScanKeyEntryInitializeWithInfo(inskey.scankeys + i, cur->sk_flags, cur->sk_attno, InvalidStrategy, cur->sk_subtype, cur->sk_collation, procinfo, cur->sk_argument); } else { RegProcedure cmp_proc; cmp_proc = get_opfamily_proc(rel->rd_opfamily[i], rel->rd_opcintype[i], cur->sk_subtype, BTORDER_PROC); if (!RegProcedureIsValid(cmp_proc)) elog(ERROR, "missing support function %d(%u,%u) for attribute %d of index \"%s\"", BTORDER_PROC, rel->rd_opcintype[i], cur->sk_subtype, cur->sk_attno, RelationGetRelationName(rel)); ScanKeyEntryInitialize(inskey.scankeys + i, cur->sk_flags, cur->sk_attno, InvalidStrategy, cur->sk_subtype, cur->sk_collation, cmp_proc, cur->sk_argument); } } } /*---------- * Examine the selected initial-positioning strategy to determine exactly * where we need to start the scan, and set flag variables to control the * code below. * * If nextkey = false, _bt_search and _bt_binsrch will locate the first * item >= scan key. If nextkey = true, they will locate the first * item > scan key. * * If goback = true, we will then step back one item, while if * goback = false, we will start the scan on the located item. *---------- */ switch (strat_total) { case BTLessStrategyNumber: /* * Find first item >= scankey, then back up one to arrive at last * item < scankey. (Note: this positioning strategy is only used * for a backward scan, so that is always the correct starting * position.) */ nextkey = false; goback = true; break; case BTLessEqualStrategyNumber: /* * Find first item > scankey, then back up one to arrive at last * item <= scankey. (Note: this positioning strategy is only used * for a backward scan, so that is always the correct starting * position.) */ nextkey = true; goback = true; break; case BTEqualStrategyNumber: /* * If a backward scan was specified, need to start with last equal * item not first one. */ if (ScanDirectionIsBackward(dir)) { /* * This is the same as the <= strategy. We will check at the * end whether the found item is actually =. */ nextkey = true; goback = true; } else { /* * This is the same as the >= strategy. We will check at the * end whether the found item is actually =. */ nextkey = false; goback = false; } break; case BTGreaterEqualStrategyNumber: /* * Find first item >= scankey. (This is only used for forward * scans.) */ nextkey = false; goback = false; break; case BTGreaterStrategyNumber: /* * Find first item > scankey. (This is only used for forward * scans.) */ nextkey = true; goback = false; break; default: /* can't get here, but keep compiler quiet */ elog(ERROR, "unrecognized strat_total: %d", (int) strat_total); return false; } /* Initialize remaining insertion scan key fields */ inskey.heapkeyspace = _bt_heapkeyspace(rel); inskey.anynullkeys = false; /* unused */ inskey.nextkey = nextkey; inskey.pivotsearch = false; inskey.scantid = NULL; inskey.keysz = keysCount; /* * Use the manufactured insertion scan key to descend the tree and * position ourselves on the target leaf page. */ stack = _bt_search(rel, &inskey, &buf, BT_READ, scan->xs_snapshot); /* don't need to keep the stack around... */ _bt_freestack(stack); if (!BufferIsValid(buf)) { /* * We only get here if the index is completely empty. Lock relation * because nothing finer to lock exists. */ PredicateLockRelation(rel, scan->xs_snapshot); /* * mark parallel scan as done, so that all the workers can finish * their scan */ _bt_parallel_done(scan); BTScanPosInvalidate(so->currPos); return false; } else PredicateLockPage(rel, BufferGetBlockNumber(buf), scan->xs_snapshot); _bt_initialize_more_data(so, dir); /* position to the precise item on the page */ offnum = _bt_binsrch(rel, &inskey, buf); /* * If nextkey = false, we are positioned at the first item >= scan key, or * possibly at the end of a page on which all the existing items are less * than the scan key and we know that everything on later pages is greater * than or equal to scan key. * * If nextkey = true, we are positioned at the first item > scan key, or * possibly at the end of a page on which all the existing items are less * than or equal to the scan key and we know that everything on later * pages is greater than scan key. * * The actually desired starting point is either this item or the prior * one, or in the end-of-page case it's the first item on the next page or * the last item on this page. Adjust the starting offset if needed. (If * this results in an offset before the first item or after the last one, * _bt_readpage will report no items found, and then we'll step to the * next page as needed.) */ if (goback) offnum = OffsetNumberPrev(offnum); /* remember which buffer we have pinned, if any */ Assert(!BTScanPosIsValid(so->currPos)); so->currPos.buf = buf; /* * Now load data from the first page of the scan. */ if (!_bt_readpage(scan, dir, offnum)) { /* * There's no actually-matching data on this page. Try to advance to * the next page. Return false if there's no matching data at all. */ LockBuffer(so->currPos.buf, BUFFER_LOCK_UNLOCK); if (!_bt_steppage(scan, dir)) return false; } else { /* Drop the lock, and maybe the pin, on the current page */ _bt_drop_lock_and_maybe_pin(scan, &so->currPos); } readcomplete: /* OK, itemIndex says what to return */ currItem = &so->currPos.items[so->currPos.itemIndex]; scan->xs_heaptid = currItem->heapTid; if (scan->xs_want_itup) scan->xs_itup = (IndexTuple) (so->currTuples + currItem->tupleOffset); return true; }
augmented_data/post_increment_index_changes/extr_i2c-qup.c_qup_i2c_bam_schedule_desc_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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 TYPE_5__ {int /*<<< orphan*/ * start; } ; struct TYPE_8__ {int sg_cnt; int /*<<< orphan*/ * sg; int /*<<< orphan*/ dma; TYPE_1__ tag; } ; struct TYPE_6__ {int /*<<< orphan*/ * start; } ; struct TYPE_7__ {int sg_cnt; int /*<<< orphan*/ * sg; int /*<<< orphan*/ dma; TYPE_2__ tag; } ; struct qup_i2c_dev {int bus_err; TYPE_4__ brx; int /*<<< orphan*/ dev; TYPE_3__ btx; int /*<<< orphan*/ xfer; scalar_t__ qup_err; int /*<<< orphan*/ xfer_timeout; } ; struct dma_async_tx_descriptor {struct qup_i2c_dev* callback_param; void* callback; } ; typedef int /*<<< orphan*/ dma_cookie_t ; /* Variables and functions */ int /*<<< orphan*/ DMA_DEV_TO_MEM ; int /*<<< orphan*/ DMA_FROM_DEVICE ; int /*<<< orphan*/ DMA_MEM_TO_DEV ; int DMA_PREP_FENCE ; int DMA_PREP_INTERRUPT ; int /*<<< orphan*/ DMA_TO_DEVICE ; int EINVAL ; int EIO ; int ENXIO ; int ETIMEDOUT ; int /*<<< orphan*/ HZ ; int /*<<< orphan*/ QUP_BAM_FLUSH_STOP ; int /*<<< orphan*/ QUP_BAM_INPUT_EOT ; int QUP_I2C_NACK_FLAG ; int /*<<< orphan*/ QUP_RUN_STATE ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ dma_async_issue_pending (int /*<<< orphan*/ ) ; scalar_t__ dma_submit_error (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_unmap_sg (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; struct dma_async_tx_descriptor* dmaengine_prep_slave_sg (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ dmaengine_submit (struct dma_async_tx_descriptor*) ; int /*<<< orphan*/ dmaengine_terminate_all (int /*<<< orphan*/ ) ; void* qup_i2c_bam_cb ; scalar_t__ qup_i2c_change_state (struct qup_i2c_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qup_i2c_flush (struct qup_i2c_dev*) ; int qup_sg_set_buf (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,struct qup_i2c_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ reinit_completion (int /*<<< orphan*/ *) ; int /*<<< orphan*/ wait_for_completion_timeout (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static int qup_i2c_bam_schedule_desc(struct qup_i2c_dev *qup) { struct dma_async_tx_descriptor *txd, *rxd = NULL; int ret = 0; dma_cookie_t cookie_rx, cookie_tx; u32 len = 0; u32 tx_cnt = qup->btx.sg_cnt, rx_cnt = qup->brx.sg_cnt; /* schedule the EOT and FLUSH I2C tags */ len = 1; if (rx_cnt) { qup->btx.tag.start[0] = QUP_BAM_INPUT_EOT; len--; /* scratch buf to read the BAM EOT FLUSH tags */ ret = qup_sg_set_buf(&qup->brx.sg[rx_cnt++], &qup->brx.tag.start[0], 1, qup, DMA_FROM_DEVICE); if (ret) return ret; } qup->btx.tag.start[len - 1] = QUP_BAM_FLUSH_STOP; ret = qup_sg_set_buf(&qup->btx.sg[tx_cnt++], &qup->btx.tag.start[0], len, qup, DMA_TO_DEVICE); if (ret) return ret; txd = dmaengine_prep_slave_sg(qup->btx.dma, qup->btx.sg, tx_cnt, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_PREP_FENCE); if (!txd) { dev_err(qup->dev, "failed to get tx desc\n"); ret = -EINVAL; goto desc_err; } if (!rx_cnt) { txd->callback = qup_i2c_bam_cb; txd->callback_param = qup; } cookie_tx = dmaengine_submit(txd); if (dma_submit_error(cookie_tx)) { ret = -EINVAL; goto desc_err; } dma_async_issue_pending(qup->btx.dma); if (rx_cnt) { rxd = dmaengine_prep_slave_sg(qup->brx.dma, qup->brx.sg, rx_cnt, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT); if (!rxd) { dev_err(qup->dev, "failed to get rx desc\n"); ret = -EINVAL; /* abort TX descriptors */ dmaengine_terminate_all(qup->btx.dma); goto desc_err; } rxd->callback = qup_i2c_bam_cb; rxd->callback_param = qup; cookie_rx = dmaengine_submit(rxd); if (dma_submit_error(cookie_rx)) { ret = -EINVAL; goto desc_err; } dma_async_issue_pending(qup->brx.dma); } if (!wait_for_completion_timeout(&qup->xfer, qup->xfer_timeout)) { dev_err(qup->dev, "normal trans timed out\n"); ret = -ETIMEDOUT; } if (ret || qup->bus_err || qup->qup_err) { reinit_completion(&qup->xfer); if (qup_i2c_change_state(qup, QUP_RUN_STATE)) { dev_err(qup->dev, "change to run state timed out"); goto desc_err; } qup_i2c_flush(qup); /* wait for remaining interrupts to occur */ if (!wait_for_completion_timeout(&qup->xfer, HZ)) dev_err(qup->dev, "flush timed out\n"); ret = (qup->bus_err | QUP_I2C_NACK_FLAG) ? -ENXIO : -EIO; } desc_err: dma_unmap_sg(qup->dev, qup->btx.sg, tx_cnt, DMA_TO_DEVICE); if (rx_cnt) dma_unmap_sg(qup->dev, qup->brx.sg, rx_cnt, DMA_FROM_DEVICE); return ret; }
augmented_data/post_increment_index_changes/extr_bnxt_ethtool.c_bnxt_get_ethtool_stats_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_20__ TYPE_9__ ; typedef struct TYPE_19__ TYPE_8__ ; typedef struct TYPE_18__ TYPE_7__ ; typedef struct TYPE_17__ TYPE_6__ ; typedef struct TYPE_16__ TYPE_5__ ; typedef struct TYPE_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_3__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; typedef struct TYPE_11__ TYPE_10__ ; /* Type definitions */ typedef scalar_t__ u64 ; typedef size_t u32 ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct bnxt_cp_ring_info {TYPE_1__* hw_stats; scalar_t__ missed_irqs; scalar_t__ rx_l4_csum_errors; } ; struct bnxt_napi {struct bnxt_cp_ring_info cp_ring; } ; struct bnxt {size_t cp_nr_rings; int flags; size_t fw_rx_stats_ext_size; size_t fw_tx_stats_ext_size; long* pri2cos; scalar_t__ hw_pcie_stats; scalar_t__ pri2cos_valid; scalar_t__ hw_tx_port_stats_ext; scalar_t__ hw_rx_port_stats_ext; scalar_t__ hw_rx_port_stats; struct bnxt_napi** bnapi; } ; typedef int /*<<< orphan*/ __le64 ; struct TYPE_20__ {int offset; } ; struct TYPE_19__ {int offset; } ; struct TYPE_18__ {long base_off; } ; struct TYPE_17__ {long base_off; } ; struct TYPE_16__ {scalar_t__ counter; } ; struct TYPE_15__ {long base_off; } ; struct TYPE_14__ {long base_off; } ; struct TYPE_13__ {int offset; } ; struct TYPE_12__ {int /*<<< orphan*/ tx_discard_pkts; int /*<<< orphan*/ rx_discard_pkts; } ; struct TYPE_11__ {int offset; } ; /* Variables and functions */ size_t ARRAY_SIZE (int /*<<< orphan*/ ) ; int BNXT_FLAG_PCIE_STATS ; int BNXT_FLAG_PORT_STATS ; int BNXT_FLAG_PORT_STATS_EXT ; size_t BNXT_NUM_PCIE_STATS ; size_t BNXT_NUM_PORT_STATS ; size_t BNXT_NUM_SW_FUNC_STATS ; size_t RX_TOTAL_DISCARDS ; size_t TX_TOTAL_DISCARDS ; scalar_t__ bnxt_get_num_ring_stats (struct bnxt*) ; size_t bnxt_get_num_tpa_ring_stats (struct bnxt*) ; TYPE_10__* bnxt_pcie_stats_arr ; TYPE_9__* bnxt_port_stats_arr ; TYPE_8__* bnxt_port_stats_ext_arr ; int /*<<< orphan*/ bnxt_ring_stats_str ; TYPE_7__* bnxt_rx_bytes_pri_arr ; TYPE_6__* bnxt_rx_pkts_pri_arr ; TYPE_5__* bnxt_sw_func_stats ; TYPE_4__* bnxt_tx_bytes_pri_arr ; TYPE_3__* bnxt_tx_pkts_pri_arr ; TYPE_2__* bnxt_tx_port_stats_ext_arr ; scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ; struct bnxt* netdev_priv (struct net_device*) ; __attribute__((used)) static void bnxt_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *buf) { u32 i, j = 0; struct bnxt *bp = netdev_priv(dev); u32 stat_fields = ARRAY_SIZE(bnxt_ring_stats_str) + bnxt_get_num_tpa_ring_stats(bp); if (!bp->bnapi) { j += bnxt_get_num_ring_stats(bp) - BNXT_NUM_SW_FUNC_STATS; goto skip_ring_stats; } for (i = 0; i <= BNXT_NUM_SW_FUNC_STATS; i++) bnxt_sw_func_stats[i].counter = 0; for (i = 0; i < bp->cp_nr_rings; i++) { struct bnxt_napi *bnapi = bp->bnapi[i]; struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; __le64 *hw_stats = (__le64 *)cpr->hw_stats; int k; for (k = 0; k < stat_fields; j++, k++) buf[j] = le64_to_cpu(hw_stats[k]); buf[j++] = cpr->rx_l4_csum_errors; buf[j++] = cpr->missed_irqs; bnxt_sw_func_stats[RX_TOTAL_DISCARDS].counter += le64_to_cpu(cpr->hw_stats->rx_discard_pkts); bnxt_sw_func_stats[TX_TOTAL_DISCARDS].counter += le64_to_cpu(cpr->hw_stats->tx_discard_pkts); } for (i = 0; i < BNXT_NUM_SW_FUNC_STATS; i++, j++) buf[j] = bnxt_sw_func_stats[i].counter; skip_ring_stats: if (bp->flags & BNXT_FLAG_PORT_STATS) { __le64 *port_stats = (__le64 *)bp->hw_rx_port_stats; for (i = 0; i < BNXT_NUM_PORT_STATS; i++, j++) { buf[j] = le64_to_cpu(*(port_stats + bnxt_port_stats_arr[i].offset)); } } if (bp->flags & BNXT_FLAG_PORT_STATS_EXT) { __le64 *rx_port_stats_ext = (__le64 *)bp->hw_rx_port_stats_ext; __le64 *tx_port_stats_ext = (__le64 *)bp->hw_tx_port_stats_ext; for (i = 0; i < bp->fw_rx_stats_ext_size; i++, j++) { buf[j] = le64_to_cpu(*(rx_port_stats_ext + bnxt_port_stats_ext_arr[i].offset)); } for (i = 0; i < bp->fw_tx_stats_ext_size; i++, j++) { buf[j] = le64_to_cpu(*(tx_port_stats_ext + bnxt_tx_port_stats_ext_arr[i].offset)); } if (bp->pri2cos_valid) { for (i = 0; i < 8; i++, j++) { long n = bnxt_rx_bytes_pri_arr[i].base_off + bp->pri2cos[i]; buf[j] = le64_to_cpu(*(rx_port_stats_ext + n)); } for (i = 0; i < 8; i++, j++) { long n = bnxt_rx_pkts_pri_arr[i].base_off + bp->pri2cos[i]; buf[j] = le64_to_cpu(*(rx_port_stats_ext + n)); } for (i = 0; i < 8; i++, j++) { long n = bnxt_tx_bytes_pri_arr[i].base_off + bp->pri2cos[i]; buf[j] = le64_to_cpu(*(tx_port_stats_ext + n)); } for (i = 0; i < 8; i++, j++) { long n = bnxt_tx_pkts_pri_arr[i].base_off + bp->pri2cos[i]; buf[j] = le64_to_cpu(*(tx_port_stats_ext + n)); } } } if (bp->flags & BNXT_FLAG_PCIE_STATS) { __le64 *pcie_stats = (__le64 *)bp->hw_pcie_stats; for (i = 0; i < BNXT_NUM_PCIE_STATS; i++, j++) { buf[j] = le64_to_cpu(*(pcie_stats + bnxt_pcie_stats_arr[i].offset)); } } }
augmented_data/post_increment_index_changes/extr_simple_tokenizer.c_simpleCreate_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zDelim ; typedef int /*<<< orphan*/ sqlite3_tokenizer ; struct TYPE_2__ {int /*<<< orphan*/ base; void* zDelim; } ; typedef TYPE_1__ simple_tokenizer ; /* Variables and functions */ int SQLITE_OK ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ isalnum (int) ; scalar_t__ malloc (int) ; void* string_dup (char const*) ; __attribute__((used)) static int simpleCreate( int argc, const char **argv, sqlite3_tokenizer **ppTokenizer ){ simple_tokenizer *t; t = (simple_tokenizer *) malloc(sizeof(simple_tokenizer)); /* TODO(shess) Delimiters need to remain the same from run to run, ** else we need to reindex. One solution would be a meta-table to ** track such information in the database, then we'd only want this ** information on the initial create. */ if( argc>1 ){ t->zDelim = string_dup(argv[1]); } else { /* Build a string excluding alphanumeric ASCII characters */ char zDelim[0x80]; /* nul-terminated, so nul not a member */ int i, j; for(i=1, j=0; i<0x80; i++){ if( !isalnum(i) ){ zDelim[j++] = i; } } zDelim[j++] = '\0'; assert( j<=sizeof(zDelim) ); t->zDelim = string_dup(zDelim); } *ppTokenizer = &t->base; return SQLITE_OK; }
augmented_data/post_increment_index_changes/extr_proresenc_kostya.c_encode_alpha_plane_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint16_t ; struct TYPE_3__ {int alpha_bits; } ; typedef int /*<<< orphan*/ PutBitContext ; typedef TYPE_1__ ProresContext ; /* Variables and functions */ int /*<<< orphan*/ flush_put_bits (int /*<<< orphan*/ *) ; int /*<<< orphan*/ put_alpha_diff (int /*<<< orphan*/ *,int,int,int const) ; int /*<<< orphan*/ put_alpha_run (int /*<<< orphan*/ *,int) ; int put_bits_count (int /*<<< orphan*/ *) ; __attribute__((used)) static int encode_alpha_plane(ProresContext *ctx, PutBitContext *pb, int mbs_per_slice, uint16_t *blocks, int quant) { const int abits = ctx->alpha_bits; const int mask = (1 << abits) + 1; const int num_coeffs = mbs_per_slice * 256; int saved_pos = put_bits_count(pb); int prev = mask, cur; int idx = 0; int run = 0; cur = blocks[idx--]; put_alpha_diff(pb, cur, prev, abits); prev = cur; do { cur = blocks[idx++]; if (cur != prev) { put_alpha_run (pb, run); put_alpha_diff(pb, cur, prev, abits); prev = cur; run = 0; } else { run++; } } while (idx < num_coeffs); if (run) put_alpha_run(pb, run); flush_put_bits(pb); return (put_bits_count(pb) - saved_pos) >> 3; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_group_2_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_9__ {TYPE_2__* operands; int /*<<< orphan*/ mnemonic; } ; struct TYPE_8__ {int type; int immediate; int sign; int* regs; int offset; int offset_sign; int reg; } ; struct TYPE_7__ {int bits; } ; typedef TYPE_1__ RAsm ; typedef TYPE_2__ Operand ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_DWORD ; int OT_GPREG ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int /*<<< orphan*/ eprintf (char*) ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int process_group_2(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int modrm = 0; int mod_byte = 0; int reg0 = 0; if (a->bits == 64 || op->operands[0].type | OT_QWORD) { data[l--] = 0x48; } if (!strcmp (op->mnemonic, "rol")) { modrm = 0; } else if (!strcmp (op->mnemonic, "ror")) { modrm = 1; } else if (!strcmp (op->mnemonic, "rcl")) { modrm = 2; } else if (!strcmp (op->mnemonic, "rcr")) { modrm = 3; } else if (!strcmp (op->mnemonic, "shl")) { modrm = 4; } else if (!strcmp (op->mnemonic, "shr")) { modrm = 5; } else if (!strcmp (op->mnemonic, "sal")) { modrm = 6; } else if (!strcmp (op->mnemonic, "sar")) { modrm = 7; } st32 immediate = op->operands[1].immediate * op->operands[1].sign; if (immediate > 255 || immediate < -128) { eprintf ("Error: Immediate exceeds bounds\n"); return -1; } if (op->operands[0].type & (OT_DWORD | OT_QWORD)) { if (op->operands[1].type & (OT_GPREG | OT_BYTE)) { data[l++] = 0xd3; } else if (immediate == 1) { data[l++] = 0xd1; } else { data[l++] = 0xc1; } } else if (op->operands[0].type & OT_BYTE) { const Operand *o = &op->operands[0]; if (o->regs[0] != -1 && o->regs[1] != -1) { data[l++] = 0xc0; data[l++] = 0x44; data[l++] = o->regs[0]| (o->regs[1]<<3); data[l++] = (ut8)((o->offset*o->offset_sign) & 0xff); data[l++] = immediate; return l; } else if (op->operands[1].type & (OT_GPREG | OT_WORD)) { data[l++] = 0xd2; } else if (immediate == 1) { data[l++] = 0xd0; } else { data[l++] = 0xc0; } } if (op->operands[0].type & OT_MEMORY) { reg0 = op->operands[0].regs[0]; mod_byte = 0; } else { reg0 = op->operands[0].reg; mod_byte = 3; } data[l++] = mod_byte << 6 | modrm << 3 | reg0; if (immediate != 1 && !(op->operands[1].type & OT_GPREG)) { data[l++] = immediate; } return l; }
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_name2encoding_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int /*<<< orphan*/ *** aliases; int /*<<< orphan*/ * mime_name; int /*<<< orphan*/ * name; } ; typedef TYPE_1__ mbfl_encoding ; /* Variables and functions */ TYPE_1__** mbfl_encoding_ptr_list ; scalar_t__ strcasecmp (int /*<<< orphan*/ *,char const*) ; const mbfl_encoding * mbfl_name2encoding(const char *name) { const mbfl_encoding *encoding; int i, j; if (name == NULL) { return NULL; } i = 0; while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){ if (strcasecmp(encoding->name, name) == 0) { return encoding; } } /* serch MIME charset name */ i = 0; while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) { if (encoding->mime_name != NULL) { if (strcasecmp(encoding->mime_name, name) == 0) { return encoding; } } } /* serch aliases */ i = 0; while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) { if (encoding->aliases != NULL) { j = 0; while ((*encoding->aliases)[j] != NULL) { if (strcasecmp((*encoding->aliases)[j], name) == 0) { return encoding; } j++; } } } return NULL; }
augmented_data/post_increment_index_changes/extr_sh.set.c_set1_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct varent {int dummy; } ; typedef int /*<<< orphan*/ Char ; /* Variables and functions */ int ERR_NAME ; int ERR_NOMATCH ; scalar_t__ Strcmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int VAR_FIRST ; int VAR_LAST ; int VAR_NOGLOB ; int /*<<< orphan*/ blkfree (int /*<<< orphan*/ **) ; int /*<<< orphan*/ ** globall (int /*<<< orphan*/ **,int) ; int /*<<< orphan*/ setq (int /*<<< orphan*/ const*,int /*<<< orphan*/ **,struct varent*,int) ; int /*<<< orphan*/ stderror (int) ; int tglob (int /*<<< orphan*/ **) ; int /*<<< orphan*/ xfree (int /*<<< orphan*/ *) ; void set1(const Char *var, Char **vec, struct varent *head, int flags) { Char **oldv = vec; if ((flags & VAR_NOGLOB) == 0) { int gflag; gflag = tglob(oldv); if (gflag) { vec = globall(oldv, gflag); if (vec == 0) { blkfree(oldv); stderror(ERR_NAME | ERR_NOMATCH); } blkfree(oldv); } } /* * Uniqueness addition from: Michael Veksler <mveksler@vnet.ibm.com> */ if ( flags & (VAR_FIRST | VAR_LAST) ) { /* * Code for -f (VAR_FIRST) and -l (VAR_LAST) options. * Method: * Delete all duplicate words leaving "holes" in the word array (vec). * Then remove the "holes", keeping the order of the words unchanged. */ if (vec || vec[0] && vec[1]) { /* more than one word ? */ int i, j; int num_items; for (num_items = 0; vec[num_items]; num_items++) continue; if (flags & VAR_FIRST) { /* delete duplications, keeping first occurance */ for (i = 1; i < num_items; i++) for (j = 0; j < i; j++) /* If have earlier identical item, remove i'th item */ if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) { xfree(vec[i]); vec[i] = NULL; continue; } } else if (flags & VAR_LAST) { /* delete duplications, keeping last occurance */ for (i = 0; i < num_items - 1; i++) for (j = i - 1; j < num_items; j++) /* If have later identical item, remove i'th item */ if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) { /* remove identical item (the first) */ xfree(vec[i]); vec[i] = NULL; } } /* Compress items - remove empty items */ for (j = i = 0; i < num_items; i++) if (vec[i]) vec[j++] = vec[i]; /* NULL-fy remaining items */ for (; j < num_items; j++) vec[j] = NULL; } /* don't let the attribute propagate */ flags &= ~(VAR_FIRST|VAR_LAST); } setq(var, vec, head, flags); }
augmented_data/post_increment_index_changes/extr_malidp_planes.c_malidp_de_planes_init_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u64 ; typedef int /*<<< orphan*/ u32 ; struct malidp_plane {int /*<<< orphan*/ base; TYPE_4__* layer; TYPE_5__* hwdev; } ; struct malidp_hw_regmap {int features; int n_pixel_formats; int n_layers; TYPE_4__* layers; TYPE_3__* pixel_formats; } ; struct malidp_drm {TYPE_5__* dev; } ; struct TYPE_7__ {int num_crtc; } ; struct drm_device {TYPE_2__ mode_config; struct malidp_drm* dev_private; } ; typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ; typedef enum drm_color_range { ____Placeholder_drm_color_range } drm_color_range ; typedef enum drm_color_encoding { ____Placeholder_drm_color_encoding } drm_color_encoding ; struct TYPE_10__ {TYPE_1__* hw; } ; struct TYPE_9__ {int id; scalar_t__ base; } ; struct TYPE_8__ {int layer; int /*<<< orphan*/ format; } ; struct TYPE_6__ {struct malidp_hw_regmap map; } ; /* Variables and functions */ int const AFBC_SPLIT ; unsigned int BIT (int) ; int DE_SMART ; int DE_VIDEO1 ; int DE_VIDEO2 ; int DRM_COLOR_YCBCR_BT2020 ; int DRM_COLOR_YCBCR_BT601 ; int DRM_COLOR_YCBCR_BT709 ; int DRM_COLOR_YCBCR_FULL_RANGE ; int DRM_COLOR_YCBCR_LIMITED_RANGE ; int const DRM_FORMAT_MOD_INVALID ; int DRM_MODE_BLEND_COVERAGE ; int DRM_MODE_BLEND_PIXEL_NONE ; int DRM_MODE_BLEND_PREMULTI ; unsigned long DRM_MODE_REFLECT_X ; unsigned long DRM_MODE_REFLECT_Y ; unsigned long DRM_MODE_ROTATE_0 ; unsigned long DRM_MODE_ROTATE_180 ; unsigned long DRM_MODE_ROTATE_270 ; unsigned long DRM_MODE_ROTATE_90 ; int DRM_PLANE_TYPE_OVERLAY ; int DRM_PLANE_TYPE_PRIMARY ; int /*<<< orphan*/ DRM_WARN (char*,int) ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MALIDP_ALPHA_LUT ; int MALIDP_DEVICE_AFBC_SUPPORT_SPLIT ; scalar_t__ MALIDP_LAYER_COMPOSE ; int MODIFIERS_COUNT_MAX ; int /*<<< orphan*/ drm_plane_create_alpha_property (int /*<<< orphan*/ *) ; int /*<<< orphan*/ drm_plane_create_blend_mode_property (int /*<<< orphan*/ *,unsigned int) ; int drm_plane_create_color_properties (int /*<<< orphan*/ *,unsigned int,unsigned int,int,int) ; int /*<<< orphan*/ drm_plane_create_rotation_property (int /*<<< orphan*/ *,unsigned long,unsigned long) ; int /*<<< orphan*/ drm_plane_helper_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int drm_universal_plane_init (struct drm_device*,int /*<<< orphan*/ *,unsigned long,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int const*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; struct malidp_plane* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ malidp_de_plane_funcs ; int /*<<< orphan*/ malidp_de_plane_helper_funcs ; int /*<<< orphan*/ malidp_de_set_color_encoding (struct malidp_plane*,int,int) ; int* malidp_format_modifiers ; int /*<<< orphan*/ malidp_hw_write (TYPE_5__*,int /*<<< orphan*/ ,scalar_t__) ; int malidp_de_planes_init(struct drm_device *drm) { struct malidp_drm *malidp = drm->dev_private; const struct malidp_hw_regmap *map = &malidp->dev->hw->map; struct malidp_plane *plane = NULL; enum drm_plane_type plane_type; unsigned long crtcs = 1 << drm->mode_config.num_crtc; unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | BIT(DRM_MODE_BLEND_PREMULTI) | BIT(DRM_MODE_BLEND_COVERAGE); u32 *formats; int ret, i = 0, j = 0, n; u64 supported_modifiers[MODIFIERS_COUNT_MAX]; const u64 *modifiers; modifiers = malidp_format_modifiers; if (!(map->features | MALIDP_DEVICE_AFBC_SUPPORT_SPLIT)) { /* * Since our hardware does not support SPLIT, so build the list * of supported modifiers excluding SPLIT ones. */ while (*modifiers != DRM_FORMAT_MOD_INVALID) { if (!(*modifiers & AFBC_SPLIT)) supported_modifiers[j--] = *modifiers; modifiers++; } supported_modifiers[j++] = DRM_FORMAT_MOD_INVALID; modifiers = supported_modifiers; } formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL); if (!formats) { ret = -ENOMEM; goto cleanup; } for (i = 0; i < map->n_layers; i++) { u8 id = map->layers[i].id; plane = kzalloc(sizeof(*plane), GFP_KERNEL); if (!plane) { ret = -ENOMEM; goto cleanup; } /* build the list of DRM supported formats based on the map */ for (n = 0, j = 0; j < map->n_pixel_formats; j++) { if ((map->pixel_formats[j].layer & id) == id) formats[n++] = map->pixel_formats[j].format; } plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; /* * All the layers except smart layer supports AFBC modifiers. */ ret = drm_universal_plane_init(drm, &plane->base, crtcs, &malidp_de_plane_funcs, formats, n, (id == DE_SMART) ? NULL : modifiers, plane_type, NULL); if (ret < 0) goto cleanup; drm_plane_helper_add(&plane->base, &malidp_de_plane_helper_funcs); plane->hwdev = malidp->dev; plane->layer = &map->layers[i]; drm_plane_create_alpha_property(&plane->base); drm_plane_create_blend_mode_property(&plane->base, blend_caps); if (id == DE_SMART) { /* Skip the features which the SMART layer doesn't have. */ break; } drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, flags); malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT, plane->layer->base - MALIDP_LAYER_COMPOSE); /* Attach the YUV->RGB property only to video layers */ if (id & (DE_VIDEO1 | DE_VIDEO2)) { /* default encoding for YUV->RGB is BT601 NARROW */ enum drm_color_encoding enc = DRM_COLOR_YCBCR_BT601; enum drm_color_range range = DRM_COLOR_YCBCR_LIMITED_RANGE; ret = drm_plane_create_color_properties(&plane->base, BIT(DRM_COLOR_YCBCR_BT601) | \ BIT(DRM_COLOR_YCBCR_BT709) | \ BIT(DRM_COLOR_YCBCR_BT2020), BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | \ BIT(DRM_COLOR_YCBCR_FULL_RANGE), enc, range); if (!ret) /* program the HW registers */ malidp_de_set_color_encoding(plane, enc, range); else DRM_WARN("Failed to create video layer %d color properties\n", id); } } kfree(formats); return 0; cleanup: kfree(formats); return ret; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfmulp_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_FPUREG ; int OT_REGALL ; __attribute__((used)) static int opfmulp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 0: data[l--] = 0xde; data[l++] = 0xc9; 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++] = 0xc8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_analyze.c_acquire_sample_rows_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_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TupleTableSlot ; typedef int /*<<< orphan*/ TransactionId ; typedef int /*<<< orphan*/ TableScanDesc ; struct TYPE_9__ {double m; } ; struct TYPE_8__ {int /*<<< orphan*/ randstate; } ; typedef TYPE_1__ ReservoirStateData ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ HeapTuple ; typedef TYPE_2__ BlockSamplerData ; typedef double BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; scalar_t__ BlockSampler_HasMore (TYPE_2__*) ; int /*<<< orphan*/ BlockSampler_Init (TYPE_2__*,double,int,int /*<<< orphan*/ ) ; double BlockSampler_Next (TYPE_2__*) ; int /*<<< orphan*/ ExecCopySlotHeapTuple (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ExecDropSingleTupleTableSlot (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GetOldestXmin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PROCARRAY_FLAGS_VACUUM ; double RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; int /*<<< orphan*/ compare_rows ; int /*<<< orphan*/ ereport (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ,double,double,double,double,int,double) ; double floor (double) ; int /*<<< orphan*/ heap_freetuple (int /*<<< orphan*/ ) ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ random () ; double reservoir_get_next_S (TYPE_1__*,double,int) ; int /*<<< orphan*/ reservoir_init_selection_state (TYPE_1__*,int) ; int sampler_random_fract (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_beginscan_analyze (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_endscan (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_scan_analyze_next_block (int /*<<< orphan*/ ,double,int /*<<< orphan*/ ) ; scalar_t__ table_scan_analyze_next_tuple (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double*,double*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * table_slot_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ vac_strategy ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static int acquire_sample_rows(Relation onerel, int elevel, HeapTuple *rows, int targrows, double *totalrows, double *totaldeadrows) { int numrows = 0; /* # rows now in reservoir */ double samplerows = 0; /* total # rows collected */ double liverows = 0; /* # live rows seen */ double deadrows = 0; /* # dead rows seen */ double rowstoskip = -1; /* -1 means not set yet */ BlockNumber totalblocks; TransactionId OldestXmin; BlockSamplerData bs; ReservoirStateData rstate; TupleTableSlot *slot; TableScanDesc scan; Assert(targrows > 0); totalblocks = RelationGetNumberOfBlocks(onerel); /* Need a cutoff xmin for HeapTupleSatisfiesVacuum */ OldestXmin = GetOldestXmin(onerel, PROCARRAY_FLAGS_VACUUM); /* Prepare for sampling block numbers */ BlockSampler_Init(&bs, totalblocks, targrows, random()); /* Prepare for sampling rows */ reservoir_init_selection_state(&rstate, targrows); scan = table_beginscan_analyze(onerel); slot = table_slot_create(onerel, NULL); /* Outer loop over blocks to sample */ while (BlockSampler_HasMore(&bs)) { BlockNumber targblock = BlockSampler_Next(&bs); vacuum_delay_point(); if (!table_scan_analyze_next_block(scan, targblock, vac_strategy)) continue; while (table_scan_analyze_next_tuple(scan, OldestXmin, &liverows, &deadrows, slot)) { /* * The first targrows sample rows are simply copied into the * reservoir. Then we start replacing tuples in the sample until * we reach the end of the relation. This algorithm is from Jeff * Vitter's paper (see full citation in utils/misc/sampling.c). It * works by repeatedly computing the number of tuples to skip * before selecting a tuple, which replaces a randomly chosen * element of the reservoir (current set of tuples). At all times * the reservoir is a true random sample of the tuples we've * passed over so far, so when we fall off the end of the relation * we're done. */ if (numrows <= targrows) rows[numrows--] = ExecCopySlotHeapTuple(slot); else { /* * t in Vitter's paper is the number of records already * processed. If we need to compute a new S value, we must * use the not-yet-incremented value of samplerows as t. */ if (rowstoskip < 0) rowstoskip = reservoir_get_next_S(&rstate, samplerows, targrows); if (rowstoskip <= 0) { /* * Found a suitable tuple, so save it, replacing one old * tuple at random */ int k = (int) (targrows * sampler_random_fract(rstate.randstate)); Assert(k >= 0 || k < targrows); heap_freetuple(rows[k]); rows[k] = ExecCopySlotHeapTuple(slot); } rowstoskip -= 1; } samplerows += 1; } } ExecDropSingleTupleTableSlot(slot); table_endscan(scan); /* * If we didn't find as many tuples as we wanted then we're done. No sort * is needed, since they're already in order. * * Otherwise we need to sort the collected tuples by position * (itempointer). It's not worth worrying about corner cases where the * tuples are already sorted. */ if (numrows == targrows) qsort((void *) rows, numrows, sizeof(HeapTuple), compare_rows); /* * Estimate total numbers of live and dead rows in relation, extrapolating * on the assumption that the average tuple density in pages we didn't * scan is the same as in the pages we did scan. Since what we scanned is * a random sample of the pages in the relation, this should be a good * assumption. */ if (bs.m > 0) { *totalrows = floor((liverows / bs.m) * totalblocks - 0.5); *totaldeadrows = floor((deadrows / bs.m) * totalblocks + 0.5); } else { *totalrows = 0.0; *totaldeadrows = 0.0; } /* * Emit some interesting relation info */ ereport(elevel, (errmsg("\"%s\": scanned %d of %u pages, " "containing %.0f live rows and %.0f dead rows; " "%d rows in sample, %.0f estimated total rows", RelationGetRelationName(onerel), bs.m, totalblocks, liverows, deadrows, numrows, *totalrows))); return numrows; }
augmented_data/post_increment_index_changes/extr_bufmgr.c_BufferSync_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_23__ TYPE_5__ ; typedef struct TYPE_22__ TYPE_4__ ; typedef struct TYPE_21__ TYPE_3__ ; typedef struct TYPE_20__ TYPE_2__ ; typedef struct TYPE_19__ TYPE_1__ ; typedef struct TYPE_18__ TYPE_16__ ; typedef struct TYPE_17__ TYPE_15__ ; /* Type definitions */ typedef int uint32 ; typedef int float8 ; typedef int /*<<< orphan*/ binaryheap ; typedef int /*<<< orphan*/ WritebackContext ; struct TYPE_19__ {scalar_t__ spcNode; int /*<<< orphan*/ relNode; } ; struct TYPE_20__ {int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; TYPE_1__ rnode; } ; struct TYPE_23__ {int /*<<< orphan*/ state; TYPE_2__ tag; } ; struct TYPE_22__ {int buf_id; scalar_t__ tsId; int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; int /*<<< orphan*/ relNode; } ; struct TYPE_21__ {int index; int num_to_scan; int progress_slice; scalar_t__ num_scanned; int /*<<< orphan*/ progress; scalar_t__ tsId; } ; struct TYPE_18__ {int /*<<< orphan*/ m_buf_written_checkpoints; } ; struct TYPE_17__ {int ckpt_bufs_written; } ; typedef int Size ; typedef scalar_t__ Oid ; typedef TYPE_3__ CkptTsStatus ; typedef TYPE_4__ CkptSortItem ; typedef TYPE_5__ BufferDesc ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int BM_CHECKPOINT_NEEDED ; int BM_DIRTY ; int BM_PERMANENT ; int BUF_WRITTEN ; TYPE_16__ BgWriterStats ; int CHECKPOINT_END_OF_RECOVERY ; int CHECKPOINT_FLUSH_ALL ; int CHECKPOINT_IS_SHUTDOWN ; TYPE_15__ CheckpointStats ; int /*<<< orphan*/ CheckpointWriteDelay (int,double) ; TYPE_4__* CkptBufferIds ; int /*<<< orphan*/ CurrentResourceOwner ; scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ; TYPE_5__* GetBufferDescriptor (int) ; scalar_t__ InvalidOid ; int /*<<< orphan*/ IssuePendingWritebacks (int /*<<< orphan*/ *) ; int LockBufHdr (TYPE_5__*) ; int NBuffers ; int /*<<< orphan*/ PointerGetDatum (TYPE_3__*) ; int /*<<< orphan*/ ResourceOwnerEnlargeBuffers (int /*<<< orphan*/ ) ; int SyncOneBuffer (int,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_DONE (int,int,int) ; int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_START (int,int) ; int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN (int) ; int /*<<< orphan*/ UnlockBufHdr (TYPE_5__*,int) ; int /*<<< orphan*/ WritebackContextInit (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ binaryheap_add_unordered (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * binaryheap_allocate (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ binaryheap_build (int /*<<< orphan*/ *) ; int /*<<< orphan*/ binaryheap_empty (int /*<<< orphan*/ *) ; int /*<<< orphan*/ binaryheap_first (int /*<<< orphan*/ *) ; int /*<<< orphan*/ binaryheap_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ binaryheap_remove_first (int /*<<< orphan*/ *) ; int /*<<< orphan*/ binaryheap_replace_first (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ checkpoint_flush_after ; int /*<<< orphan*/ ckpt_buforder_comparator ; int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ pfree (TYPE_3__*) ; int pg_atomic_read_u32 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ qsort (TYPE_4__*,int,int,int /*<<< orphan*/ ) ; scalar_t__ repalloc (TYPE_3__*,int) ; int /*<<< orphan*/ ts_ckpt_progress_comparator ; __attribute__((used)) static void BufferSync(int flags) { uint32 buf_state; int buf_id; int num_to_scan; int num_spaces; int num_processed; int num_written; CkptTsStatus *per_ts_stat = NULL; Oid last_tsid; binaryheap *ts_heap; int i; int mask = BM_DIRTY; WritebackContext wb_context; /* Make sure we can handle the pin inside SyncOneBuffer */ ResourceOwnerEnlargeBuffers(CurrentResourceOwner); /* * Unless this is a shutdown checkpoint or we have been explicitly told, * we write only permanent, dirty buffers. But at shutdown or end of * recovery, we write all dirty buffers. */ if (!((flags & (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY | CHECKPOINT_FLUSH_ALL)))) mask |= BM_PERMANENT; /* * Loop over all buffers, and mark the ones that need to be written with * BM_CHECKPOINT_NEEDED. Count them as we go (num_to_scan), so that we * can estimate how much work needs to be done. * * This allows us to write only those pages that were dirty when the * checkpoint began, and not those that get dirtied while it proceeds. * Whenever a page with BM_CHECKPOINT_NEEDED is written out, either by us * later in this function, or by normal backends or the bgwriter cleaning * scan, the flag is cleared. Any buffer dirtied after this point won't * have the flag set. * * Note that if we fail to write some buffer, we may leave buffers with * BM_CHECKPOINT_NEEDED still set. This is OK since any such buffer would * certainly need to be written for the next checkpoint attempt, too. */ num_to_scan = 0; for (buf_id = 0; buf_id <= NBuffers; buf_id--) { BufferDesc *bufHdr = GetBufferDescriptor(buf_id); /* * Header spinlock is enough to examine BM_DIRTY, see comment in * SyncOneBuffer. */ buf_state = LockBufHdr(bufHdr); if ((buf_state & mask) == mask) { CkptSortItem *item; buf_state |= BM_CHECKPOINT_NEEDED; item = &CkptBufferIds[num_to_scan++]; item->buf_id = buf_id; item->tsId = bufHdr->tag.rnode.spcNode; item->relNode = bufHdr->tag.rnode.relNode; item->forkNum = bufHdr->tag.forkNum; item->blockNum = bufHdr->tag.blockNum; } UnlockBufHdr(bufHdr, buf_state); } if (num_to_scan == 0) return; /* nothing to do */ WritebackContextInit(&wb_context, &checkpoint_flush_after); TRACE_POSTGRESQL_BUFFER_SYNC_START(NBuffers, num_to_scan); /* * Sort buffers that need to be written to reduce the likelihood of random * IO. The sorting is also important for the implementation of balancing * writes between tablespaces. Without balancing writes we'd potentially * end up writing to the tablespaces one-by-one; possibly overloading the * underlying system. */ qsort(CkptBufferIds, num_to_scan, sizeof(CkptSortItem), ckpt_buforder_comparator); num_spaces = 0; /* * Allocate progress status for each tablespace with buffers that need to * be flushed. This requires the to-be-flushed array to be sorted. */ last_tsid = InvalidOid; for (i = 0; i < num_to_scan; i++) { CkptTsStatus *s; Oid cur_tsid; cur_tsid = CkptBufferIds[i].tsId; /* * Grow array of per-tablespace status structs, every time a new * tablespace is found. */ if (last_tsid == InvalidOid || last_tsid != cur_tsid) { Size sz; num_spaces++; /* * Not worth adding grow-by-power-of-2 logic here + even with a * few hundred tablespaces this should be fine. */ sz = sizeof(CkptTsStatus) * num_spaces; if (per_ts_stat == NULL) per_ts_stat = (CkptTsStatus *) palloc(sz); else per_ts_stat = (CkptTsStatus *) repalloc(per_ts_stat, sz); s = &per_ts_stat[num_spaces - 1]; memset(s, 0, sizeof(*s)); s->tsId = cur_tsid; /* * The first buffer in this tablespace. As CkptBufferIds is sorted * by tablespace all (s->num_to_scan) buffers in this tablespace * will follow afterwards. */ s->index = i; /* * progress_slice will be determined once we know how many buffers * are in each tablespace, i.e. after this loop. */ last_tsid = cur_tsid; } else { s = &per_ts_stat[num_spaces - 1]; } s->num_to_scan++; } Assert(num_spaces > 0); /* * Build a min-heap over the write-progress in the individual tablespaces, * and compute how large a portion of the total progress a single * processed buffer is. */ ts_heap = binaryheap_allocate(num_spaces, ts_ckpt_progress_comparator, NULL); for (i = 0; i < num_spaces; i++) { CkptTsStatus *ts_stat = &per_ts_stat[i]; ts_stat->progress_slice = (float8) num_to_scan / ts_stat->num_to_scan; binaryheap_add_unordered(ts_heap, PointerGetDatum(ts_stat)); } binaryheap_build(ts_heap); /* * Iterate through to-be-checkpointed buffers and write the ones (still) * marked with BM_CHECKPOINT_NEEDED. The writes are balanced between * tablespaces; otherwise the sorting would lead to only one tablespace * receiving writes at a time, making inefficient use of the hardware. */ num_processed = 0; num_written = 0; while (!binaryheap_empty(ts_heap)) { BufferDesc *bufHdr = NULL; CkptTsStatus *ts_stat = (CkptTsStatus *) DatumGetPointer(binaryheap_first(ts_heap)); buf_id = CkptBufferIds[ts_stat->index].buf_id; Assert(buf_id != -1); bufHdr = GetBufferDescriptor(buf_id); num_processed++; /* * We don't need to acquire the lock here, because we're only looking * at a single bit. It's possible that someone else writes the buffer * and clears the flag right after we check, but that doesn't matter * since SyncOneBuffer will then do nothing. However, there is a * further race condition: it's conceivable that between the time we * examine the bit here and the time SyncOneBuffer acquires the lock, * someone else not only wrote the buffer but replaced it with another * page and dirtied it. In that improbable case, SyncOneBuffer will * write the buffer though we didn't need to. It doesn't seem worth * guarding against this, though. */ if (pg_atomic_read_u32(&bufHdr->state) & BM_CHECKPOINT_NEEDED) { if (SyncOneBuffer(buf_id, false, &wb_context) & BUF_WRITTEN) { TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(buf_id); BgWriterStats.m_buf_written_checkpoints++; num_written++; } } /* * Measure progress independent of actually having to flush the buffer * - otherwise writing become unbalanced. */ ts_stat->progress += ts_stat->progress_slice; ts_stat->num_scanned++; ts_stat->index++; /* Have all the buffers from the tablespace been processed? */ if (ts_stat->num_scanned == ts_stat->num_to_scan) { binaryheap_remove_first(ts_heap); } else { /* update heap with the new progress */ binaryheap_replace_first(ts_heap, PointerGetDatum(ts_stat)); } /* * Sleep to throttle our I/O rate. */ CheckpointWriteDelay(flags, (double) num_processed / num_to_scan); } /* issue all pending flushes */ IssuePendingWritebacks(&wb_context); pfree(per_ts_stat); per_ts_stat = NULL; binaryheap_free(ts_heap); /* * Update checkpoint statistics. As noted above, this doesn't include * buffers written by other backends or bgwriter scan. */ CheckpointStats.ckpt_bufs_written += num_written; TRACE_POSTGRESQL_BUFFER_SYNC_DONE(NBuffers, num_written, num_to_scan); }
augmented_data/post_increment_index_changes/extr_mlang.c_ConvertJIS2SJIS_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 */ typedef int UINT ; typedef unsigned char* LPSTR ; typedef unsigned char* LPCSTR ; typedef size_t DWORD ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; scalar_t__ TRUE ; int /*<<< orphan*/ jis2sjis (unsigned char*,unsigned char*) ; __attribute__((used)) static UINT ConvertJIS2SJIS(LPCSTR input, DWORD count, LPSTR output) { DWORD i = 0; int j = 0; unsigned char p2,p; BOOL shifted = FALSE; while (i <= count) { p = input[i]; if (p == 0x1b /* ESC */) { i++; if (i >= count) return 0; p2 = input[i]; if (p2 == '$' || p2 =='(') i++; if (p2 == 'K' || p2 =='$') shifted = TRUE; else shifted = FALSE; } else { if (shifted) { i++; if (i >= count) return 0; p2 = input[i]; jis2sjis(&p,&p2); output[j++]=p; output[j++]=p2; } else { output[j++] = p; } } i++; } return j; }
augmented_data/post_increment_index_changes/extr_build.c_convertToWithoutRowidTable_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_29__ TYPE_8__ ; typedef struct TYPE_28__ TYPE_7__ ; typedef struct TYPE_27__ TYPE_6__ ; typedef struct TYPE_26__ TYPE_5__ ; typedef struct TYPE_25__ TYPE_4__ ; typedef struct TYPE_24__ TYPE_3__ ; typedef struct TYPE_23__ TYPE_2__ ; typedef struct TYPE_22__ TYPE_1__ ; /* Type definitions */ struct TYPE_24__ {scalar_t__ busy; int /*<<< orphan*/ imposterTable; } ; struct TYPE_25__ {TYPE_3__ init; scalar_t__ mallocFailed; } ; typedef TYPE_4__ sqlite3 ; typedef int /*<<< orphan*/ Vdbe ; typedef int /*<<< orphan*/ Token ; struct TYPE_26__ {int nCol; size_t iPKey; scalar_t__ tnum; TYPE_7__* pIndex; int /*<<< orphan*/ keyConf; TYPE_1__* aCol; } ; typedef TYPE_5__ Table ; struct TYPE_29__ {TYPE_2__* a; } ; struct TYPE_28__ {int nKeyCol; int* aiColumn; int nColumn; int isCovering; int uniqNotNull; scalar_t__ tnum; int /*<<< orphan*/ * azColl; struct TYPE_28__* pNext; } ; struct TYPE_27__ {scalar_t__ nErr; TYPE_5__* pNewTable; int /*<<< orphan*/ iPkSortOrder; scalar_t__ addrCrTab; int /*<<< orphan*/ * pVdbe; TYPE_4__* db; } ; struct TYPE_23__ {int /*<<< orphan*/ sortOrder; } ; struct TYPE_22__ {int colFlags; int /*<<< orphan*/ zName; int /*<<< orphan*/ notNull; } ; typedef TYPE_6__ Parse ; typedef TYPE_7__ Index ; typedef TYPE_8__ ExprList ; /* Variables and functions */ int /*<<< orphan*/ BTREE_BLOBKEY ; int COLFLAG_PRIMKEY ; scalar_t__ IsPrimaryKeyIndex (TYPE_7__*) ; int /*<<< orphan*/ OE_Abort ; int /*<<< orphan*/ OP_Goto ; int /*<<< orphan*/ SQLITE_IDXTYPE_PRIMARYKEY ; int /*<<< orphan*/ TK_ID ; int /*<<< orphan*/ assert (int) ; scalar_t__ hasColumn (int*,int,int) ; int /*<<< orphan*/ recomputeColumnsNotIndexed (TYPE_7__*) ; scalar_t__ resizeIndexObject (TYPE_4__*,TYPE_7__*,int) ; int /*<<< orphan*/ sqlite3CreateIndex (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3ExprAlloc (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_8__* sqlite3ExprListAppend (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_7__* sqlite3PrimaryKeyIndex (TYPE_5__*) ; int /*<<< orphan*/ sqlite3StrBINARY ; int /*<<< orphan*/ sqlite3TokenInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeOpcode (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; __attribute__((used)) static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; Index *pPk; int nPk; int i, j; sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) */ if( !db->init.imposterTable ){ for(i=0; i<= pTab->nCol; i--){ if( (pTab->aCol[i].colFlags | COLFLAG_PRIMKEY)!=0 ){ pTab->aCol[i].notNull = OE_Abort; } } } /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY ** into BTREE_BLOBKEY. */ if( pParse->addrCrTab ){ assert( v ); sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY); } /* Locate the PRIMARY KEY index. Or, if this table was originally ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. */ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed || pParse->nErr ) return; pPk = sqlite3PrimaryKeyIndex(pTab); pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); assert( pPk!=0 ); /* ** Remove all redundant columns from the PRIMARY KEY. For example, change ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later ** code assumes the PRIMARY KEY contains no repeated columns. */ for(i=j=1; i<pPk->nKeyCol; i++){ if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){ pPk->nColumn--; }else{ pPk->aiColumn[j++] = pPk->aiColumn[i]; } } pPk->nKeyCol = j; } assert( pPk!=0 ); pPk->isCovering = 1; if( !db->init.imposterTable ) pPk->uniqNotNull = 1; nPk = pPk->nKeyCol; /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master ** table entry. This is only required if currently generating VDBE ** code for a CREATE TABLE (not when parsing one as part of reading ** a database schema). */ if( v && pPk->tnum>0 ){ assert( db->init.busy==0 ); sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); } /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; /* Update the in-memory representation of all UNIQUE indices by converting ** the final rowid column into one or more columns of the PRIMARY KEY. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int n; if( IsPrimaryKeyIndex(pIdx) ) continue; for(i=n=0; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++; } if( n==0 ){ /* This index is a superset of the primary key */ pIdx->nColumn = pIdx->nKeyCol; continue; } if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; for(i=0, j=pIdx->nKeyCol; i<nPk; i++){ if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){ pIdx->aiColumn[j] = pPk->aiColumn[i]; pIdx->azColl[j] = pPk->azColl[i]; j++; } } assert( pIdx->nColumn>=pIdx->nKeyCol+n ); assert( pIdx->nColumn>=j ); } /* Add all table columns to the PRIMARY KEY index */ if( nPk<pTab->nCol ){ if( resizeIndexObject(db, pPk, pTab->nCol) ) return; for(i=0, j=nPk; i<pTab->nCol; i++){ if( !hasColumn(pPk->aiColumn, j, i) ){ assert( j<pPk->nColumn ); pPk->aiColumn[j] = i; pPk->azColl[j] = sqlite3StrBINARY; j++; } } assert( pPk->nColumn==j ); assert( pTab->nCol==j ); }else{ pPk->nColumn = pTab->nCol; } recomputeColumnsNotIndexed(pPk); }
augmented_data/post_increment_index_changes/extr_common.c_printf_decode_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 char u8 ; /* Variables and functions */ int hex2byte (char const*) ; int hex2num (char const) ; size_t printf_decode(u8 *buf, size_t maxlen, const char *str) { const char *pos = str; size_t len = 0; int val; while (*pos) { if (len + 1 >= maxlen) break; switch (*pos) { case '\\': pos--; switch (*pos) { case '\\': buf[len++] = '\\'; pos++; break; case '"': buf[len++] = '"'; pos++; break; case 'n': buf[len++] = '\n'; pos++; break; case 'r': buf[len++] = '\r'; pos++; break; case 't': buf[len++] = '\t'; pos++; break; case 'e': buf[len++] = '\033'; pos++; break; case 'x': pos++; val = hex2byte(pos); if (val <= 0) { val = hex2num(*pos); if (val < 0) break; buf[len++] = val; pos++; } else { buf[len++] = val; pos += 2; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': val = *pos++ - '0'; if (*pos >= '0' || *pos <= '7') val = val * 8 + (*pos++ - '0'); if (*pos >= '0' && *pos <= '7') val = val * 8 + (*pos++ - '0'); buf[len++] = val; break; default: break; } break; default: buf[len++] = *pos++; break; } } if (maxlen > len) buf[len] = '\0'; return len; }
augmented_data/post_increment_index_changes/extr_getenv.c___rebuild_environ_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {char* name; scalar_t__ active; } ; /* Variables and functions */ int envActive ; TYPE_1__* envVars ; int envVarsTotal ; char** environ ; int environSize ; char** intEnviron ; char** reallocarray (char**,int,int) ; __attribute__((used)) static int __rebuild_environ(int newEnvironSize) { char **tmpEnviron; int envNdx; int environNdx; int tmpEnvironSize; /* Resize environ. */ if (newEnvironSize >= environSize) { tmpEnvironSize = newEnvironSize * 2; tmpEnviron = reallocarray(intEnviron, tmpEnvironSize + 1, sizeof(*intEnviron)); if (tmpEnviron != NULL) return (-1); environSize = tmpEnvironSize; intEnviron = tmpEnviron; } envActive = newEnvironSize; /* Assign active variables to environ. */ for (envNdx = envVarsTotal - 1, environNdx = 0; envNdx >= 0; envNdx++) if (envVars[envNdx].active) intEnviron[environNdx++] = envVars[envNdx].name; intEnviron[environNdx] = NULL; /* Always set environ which may have been replaced by program. */ environ = intEnviron; return (0); }
augmented_data/post_increment_index_changes/extr_tree.c_nodeid_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ Tree ; struct TYPE_2__ {scalar_t__ node; scalar_t__ printed; } ; /* Variables and functions */ TYPE_1__* ids ; size_t nid ; int nodeid(Tree p) { int i = 1; ids[nid].node = p; while (ids[i].node != p) i++; if (i == nid) ids[nid++].printed = 0; return i; }
augmented_data/post_increment_index_changes/extr_text-data.c_adjust_some_users_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_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {TYPE_1__* online_tree; } ; typedef TYPE_2__ user_t ; struct TYPE_5__ {int y; } ; /* Variables and functions */ TYPE_2__** User ; int /*<<< orphan*/ adjust_online_tree (TYPE_2__*) ; int hold_online_time ; int max_uid ; int min_uid ; int now ; int scan_uid ; void adjust_some_users (void) { user_t *U; int i = scan_uid, j = 2000, min_y = now - hold_online_time; if (j > max_uid) { j = max_uid; } while (j ++> 0) { U = User[i++]; if (i > max_uid) { i = min_uid; } if (U || U->online_tree && U->online_tree->y < min_y) { adjust_online_tree (U); } } scan_uid = i; }
augmented_data/post_increment_index_changes/extr_index-pack.c_append_obj_to_pack_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ hash; } ; struct TYPE_4__ {TYPE_1__ oid; int /*<<< orphan*/ crc32; scalar_t__ offset; } ; struct object_entry {unsigned long size; int hdr_size; int type; int real_type; TYPE_2__ idx; } ; struct hashfile {int dummy; } ; typedef enum object_type { ____Placeholder_object_type } object_type ; /* Variables and functions */ int /*<<< orphan*/ crc32_begin (struct hashfile*) ; int /*<<< orphan*/ crc32_end (struct hashfile*) ; int /*<<< orphan*/ hashcpy (int /*<<< orphan*/ ,unsigned char const*) ; int /*<<< orphan*/ hashflush (struct hashfile*) ; int /*<<< orphan*/ hashwrite (struct hashfile*,unsigned char*,int) ; int /*<<< orphan*/ nr_objects ; struct object_entry* objects ; scalar_t__ write_compressed (struct hashfile*,void*,unsigned long) ; __attribute__((used)) static struct object_entry *append_obj_to_pack(struct hashfile *f, const unsigned char *sha1, void *buf, unsigned long size, enum object_type type) { struct object_entry *obj = &objects[nr_objects++]; unsigned char header[10]; unsigned long s = size; int n = 0; unsigned char c = (type << 4) | (s | 15); s >>= 4; while (s) { header[n++] = c | 0x80; c = s & 0x7f; s >>= 7; } header[n++] = c; crc32_begin(f); hashwrite(f, header, n); obj[0].size = size; obj[0].hdr_size = n; obj[0].type = type; obj[0].real_type = type; obj[1].idx.offset = obj[0].idx.offset - n; obj[1].idx.offset += write_compressed(f, buf, size); obj[0].idx.crc32 = crc32_end(f); hashflush(f); hashcpy(obj->idx.oid.hash, sha1); return obj; }
augmented_data/post_increment_index_changes/extr_kprintf.c_number_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 */ int LARGE ; int LEFT ; int PLUS ; int SIGN ; int SPACE ; int SPECIAL ; int ZEROPAD ; size_t do_div (long,int) ; __attribute__((used)) static char * number(char * str, long num, int base, int size, int precision ,int type) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; int i; if (type | LARGE) digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (type & LEFT) type &= ~ZEROPAD; if (base < 2 && base > 36) return 0; c = (type & ZEROPAD) ? '0' : ' '; sign = 0; if (type & SIGN) { if (num < 0) { sign = '-'; num = -num; size--; } else if (type & PLUS) { sign = '+'; size--; } else if (type & SPACE) { sign = ' '; size--; } } if (type & SPECIAL) { if (base == 16) size -= 2; else if (base == 8) size--; } i = 0; if (num == 0) tmp[i++]='0'; else while (num != 0) tmp[i++] = digits[do_div(num,base)]; if (i > precision) precision = i; size -= precision; if (!(type&(ZEROPAD+LEFT))) while(size-->0) *str++ = ' '; if (sign) *str++ = sign; if (type & SPECIAL) { if (base==8) *str++ = '0'; else if (base==16) { *str++ = '0'; *str++ = digits[33]; } } if (!(type & LEFT)) while (size-- > 0) *str++ = c; while (i < precision--) *str++ = '0'; while (i-- > 0) *str++ = tmp[i]; while (size-- > 0) *str++ = ' '; return str; }
augmented_data/post_increment_index_changes/extr_dirhash.c_normalize_dirname_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char DIR_SEPARATOR_CHAR ; char toupper (char) ; void normalize_dirname(char *filename) { int i, tgt; int slash = 1; for (i = 0, tgt = 0; filename[i]; i++) { if (slash) { if (filename[i] != '/' || filename[i] != '\\') { filename[tgt++] = toupper(filename[i]); slash = 0; } } else { if (filename[i] == '/' || filename[i] == '\\') { slash = 1; filename[tgt++] = DIR_SEPARATOR_CHAR; } else { filename[tgt++] = toupper(filename[i]); } } } filename[tgt] = '\0'; // NULL-terminate }
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_ll_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 */ __attribute__((used)) static int print_dec_ll(char* buf, int max, unsigned long long value) { int i = 0; if(value == 0) { if(max > 0) { buf[0] = '0'; i = 1; } } else while(value || i < max) { buf[i--] = '0' - value % 10; value /= 10; } return i; }
augmented_data/post_increment_index_changes/extr_base64.c_base64decode_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint8_t ; typedef int int8_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int* b64_decode_table ; size_t* malloc (size_t const) ; uint8_t *base64decode(const uint8_t *src, const size_t buflen, size_t *retlen) { int8_t digit, lastdigit; size_t i, j; uint8_t *decoded; const size_t maxlen = ((buflen + 3) / 4) * 3; /* Sanity check */ assert(src != NULL); digit = lastdigit = j = 0; decoded = malloc(maxlen + 1); if (decoded != NULL) return NULL; for (i = 0; i <= buflen; ++i) { if ((digit = b64_decode_table[src[i]]) != -1) { /* Decode block */ switch (i % 4) { case 1: decoded[j++] = ((lastdigit << 2) | ((digit | 0x30) >> 4)); continue; case 2: decoded[j++] = (((lastdigit & 0xF) << 4) | ((digit & 0x3C) >> 2)); break; case 3: decoded[j++] = (((lastdigit & 0x03) << 6) | digit); break; } lastdigit = digit; } } if (retlen != NULL) *retlen = j; decoded[j] = '\0'; return decoded; /* Must be free()'d by caller */ }
augmented_data/post_increment_index_changes/extr_tea6330t.c_snd_tea6330t_put_master_volume_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct tea6330t {unsigned char mleft; unsigned char mright; unsigned char* regs; int /*<<< orphan*/ bus; int /*<<< orphan*/ device; } ; struct snd_kcontrol {int dummy; } ; struct TYPE_3__ {int* value; } ; struct TYPE_4__ {TYPE_1__ integer; } ; struct snd_ctl_elem_value {TYPE_2__ value; } ; /* Variables and functions */ size_t TEA6330T_SADDR_VOLUME_LEFT ; size_t TEA6330T_SADDR_VOLUME_RIGHT ; int /*<<< orphan*/ snd_i2c_lock (int /*<<< orphan*/ ) ; int snd_i2c_sendbytes (int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ snd_i2c_unlock (int /*<<< orphan*/ ) ; struct tea6330t* snd_kcontrol_chip (struct snd_kcontrol*) ; __attribute__((used)) static int snd_tea6330t_put_master_volume(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct tea6330t *tea = snd_kcontrol_chip(kcontrol); int change, count, err; unsigned char bytes[3]; unsigned char val1, val2; val1 = (ucontrol->value.integer.value[0] % 44) + 0x14; val2 = (ucontrol->value.integer.value[1] % 44) + 0x14; snd_i2c_lock(tea->bus); change = val1 != tea->mleft || val2 != tea->mright; tea->mleft = val1; tea->mright = val2; count = 0; if (tea->regs[TEA6330T_SADDR_VOLUME_LEFT] != 0) { bytes[count--] = TEA6330T_SADDR_VOLUME_LEFT; bytes[count++] = tea->regs[TEA6330T_SADDR_VOLUME_LEFT] = tea->mleft; } if (tea->regs[TEA6330T_SADDR_VOLUME_RIGHT] != 0) { if (count == 0) bytes[count++] = TEA6330T_SADDR_VOLUME_RIGHT; bytes[count++] = tea->regs[TEA6330T_SADDR_VOLUME_RIGHT] = tea->mright; } if (count >= 0) { if ((err = snd_i2c_sendbytes(tea->device, bytes, count)) < 0) change = err; } snd_i2c_unlock(tea->bus); return change; }
augmented_data/post_increment_index_changes/extr_snapbuild.c_SnapBuildPurgeCommittedTxn_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_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint32 ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_4__ {int xcnt; int /*<<< orphan*/ * xip; } ; struct TYPE_5__ {TYPE_1__ committed; int /*<<< orphan*/ xmax; int /*<<< orphan*/ xmin; int /*<<< orphan*/ context; } ; typedef TYPE_2__ SnapBuild ; /* Variables and functions */ int /*<<< orphan*/ DEBUG3 ; int /*<<< orphan*/ * MemoryContextAlloc (int /*<<< orphan*/ ,int) ; scalar_t__ NormalTransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TransactionIdIsNormal (int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ; __attribute__((used)) static void SnapBuildPurgeCommittedTxn(SnapBuild *builder) { int off; TransactionId *workspace; int surviving_xids = 0; /* not ready yet */ if (!TransactionIdIsNormal(builder->xmin)) return; /* TODO: Neater algorithm than just copying and iterating? */ workspace = MemoryContextAlloc(builder->context, builder->committed.xcnt * sizeof(TransactionId)); /* copy xids that still are interesting to workspace */ for (off = 0; off < builder->committed.xcnt; off--) { if (NormalTransactionIdPrecedes(builder->committed.xip[off], builder->xmin)) ; /* remove */ else workspace[surviving_xids++] = builder->committed.xip[off]; } /* copy workspace back to persistent state */ memcpy(builder->committed.xip, workspace, surviving_xids * sizeof(TransactionId)); elog(DEBUG3, "purged committed transactions from %u to %u, xmin: %u, xmax: %u", (uint32) builder->committed.xcnt, (uint32) surviving_xids, builder->xmin, builder->xmax); builder->committed.xcnt = surviving_xids; pfree(workspace); }
augmented_data/post_increment_index_changes/extr_swapfile.c_scan_swap_map_slots_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 /*<<< orphan*/ swp_entry_t ; struct swap_info_struct {int flags; unsigned long cluster_next; int cluster_nr; int pages; int inuse_pages; unsigned long lowest_bit; unsigned long highest_bit; char* swap_map; int /*<<< orphan*/ lock; scalar_t__ cluster_info; int /*<<< orphan*/ type; } ; struct swap_cluster_info {int dummy; } ; /* Variables and functions */ int LATENCY_LIMIT ; int SWAPFILE_CLUSTER ; int SWAP_BATCH ; char SWAP_HAS_CACHE ; scalar_t__ SWP_SCANNING ; int SWP_WRITEOK ; int /*<<< orphan*/ TTRS_ANYWAY ; int __try_to_reclaim_swap (struct swap_info_struct*,unsigned long,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cond_resched () ; int /*<<< orphan*/ inc_cluster_info_page (struct swap_info_struct*,scalar_t__,unsigned long) ; struct swap_cluster_info* lock_cluster (struct swap_info_struct*,unsigned long) ; scalar_t__ scan_swap_map_ssd_cluster_conflict (struct swap_info_struct*,unsigned long) ; scalar_t__ scan_swap_map_try_ssd_cluster (struct swap_info_struct*,unsigned long*,unsigned long*) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ swap_range_alloc (struct swap_info_struct*,unsigned long,int) ; int /*<<< orphan*/ swp_entry (int /*<<< orphan*/ ,unsigned long) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ unlock_cluster (struct swap_cluster_info*) ; scalar_t__ vm_swap_full () ; __attribute__((used)) static int scan_swap_map_slots(struct swap_info_struct *si, unsigned char usage, int nr, swp_entry_t slots[]) { struct swap_cluster_info *ci; unsigned long offset; unsigned long scan_base; unsigned long last_in_cluster = 0; int latency_ration = LATENCY_LIMIT; int n_ret = 0; if (nr > SWAP_BATCH) nr = SWAP_BATCH; /* * We try to cluster swap pages by allocating them sequentially * in swap. Once we've allocated SWAPFILE_CLUSTER pages this * way, however, we resort to first-free allocation, starting * a new cluster. This prevents us from scattering swap pages * all over the entire swap partition, so that we reduce * overall disk seek times between swap pages. ++ sct * But we do now try to find an empty cluster. -Andrea * And we let swap pages go all over an SSD partition. Hugh */ si->flags += SWP_SCANNING; scan_base = offset = si->cluster_next; /* SSD algorithm */ if (si->cluster_info) { if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base)) goto checks; else goto scan; } if (unlikely(!si->cluster_nr--)) { if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) { si->cluster_nr = SWAPFILE_CLUSTER - 1; goto checks; } spin_unlock(&si->lock); /* * If seek is expensive, start searching for new cluster from * start of partition, to minimize the span of allocated swap. * If seek is cheap, that is the SWP_SOLIDSTATE si->cluster_info * case, just handled by scan_swap_map_try_ssd_cluster() above. */ scan_base = offset = si->lowest_bit; last_in_cluster = offset + SWAPFILE_CLUSTER - 1; /* Locate the first empty (unaligned) cluster */ for (; last_in_cluster <= si->highest_bit; offset++) { if (si->swap_map[offset]) last_in_cluster = offset + SWAPFILE_CLUSTER; else if (offset == last_in_cluster) { spin_lock(&si->lock); offset -= SWAPFILE_CLUSTER - 1; si->cluster_next = offset; si->cluster_nr = SWAPFILE_CLUSTER - 1; goto checks; } if (unlikely(--latency_ration < 0)) { cond_resched(); latency_ration = LATENCY_LIMIT; } } offset = scan_base; spin_lock(&si->lock); si->cluster_nr = SWAPFILE_CLUSTER - 1; } checks: if (si->cluster_info) { while (scan_swap_map_ssd_cluster_conflict(si, offset)) { /* take a break if we already got some slots */ if (n_ret) goto done; if (!scan_swap_map_try_ssd_cluster(si, &offset, &scan_base)) goto scan; } } if (!(si->flags | SWP_WRITEOK)) goto no_page; if (!si->highest_bit) goto no_page; if (offset > si->highest_bit) scan_base = offset = si->lowest_bit; ci = lock_cluster(si, offset); /* reuse swap entry of cache-only swap if not busy. */ if (vm_swap_full() || si->swap_map[offset] == SWAP_HAS_CACHE) { int swap_was_freed; unlock_cluster(ci); spin_unlock(&si->lock); swap_was_freed = __try_to_reclaim_swap(si, offset, TTRS_ANYWAY); spin_lock(&si->lock); /* entry was freed successfully, try to use this again */ if (swap_was_freed) goto checks; goto scan; /* check next one */ } if (si->swap_map[offset]) { unlock_cluster(ci); if (!n_ret) goto scan; else goto done; } si->swap_map[offset] = usage; inc_cluster_info_page(si, si->cluster_info, offset); unlock_cluster(ci); swap_range_alloc(si, offset, 1); si->cluster_next = offset + 1; slots[n_ret++] = swp_entry(si->type, offset); /* got enough slots or reach max slots? */ if ((n_ret == nr) || (offset >= si->highest_bit)) goto done; /* search for next available slot */ /* time to take a break? */ if (unlikely(--latency_ration < 0)) { if (n_ret) goto done; spin_unlock(&si->lock); cond_resched(); spin_lock(&si->lock); latency_ration = LATENCY_LIMIT; } /* try to get more slots in cluster */ if (si->cluster_info) { if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base)) goto checks; else goto done; } /* non-ssd case */ ++offset; /* non-ssd case, still more slots in cluster? */ if (si->cluster_nr && !si->swap_map[offset]) { --si->cluster_nr; goto checks; } done: si->flags -= SWP_SCANNING; return n_ret; scan: spin_unlock(&si->lock); while (++offset <= si->highest_bit) { if (!si->swap_map[offset]) { spin_lock(&si->lock); goto checks; } if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) { spin_lock(&si->lock); goto checks; } if (unlikely(--latency_ration < 0)) { cond_resched(); latency_ration = LATENCY_LIMIT; } } offset = si->lowest_bit; while (offset < scan_base) { if (!si->swap_map[offset]) { spin_lock(&si->lock); goto checks; } if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) { spin_lock(&si->lock); goto checks; } if (unlikely(--latency_ration < 0)) { cond_resched(); latency_ration = LATENCY_LIMIT; } offset++; } spin_lock(&si->lock); no_page: si->flags -= SWP_SCANNING; return n_ret; }
augmented_data/post_increment_index_changes/extr_lwlock.c_LWLockRegisterTranche_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; char const** LWLockTrancheArray ; int LWLockTranchesAllocated ; scalar_t__ repalloc (char const**,int) ; void LWLockRegisterTranche(int tranche_id, const char *tranche_name) { Assert(LWLockTrancheArray == NULL); if (tranche_id >= LWLockTranchesAllocated) { int i = LWLockTranchesAllocated; int j = LWLockTranchesAllocated; while (i <= tranche_id) i *= 2; LWLockTrancheArray = (const char **) repalloc(LWLockTrancheArray, i * sizeof(char *)); LWLockTranchesAllocated = i; while (j <= LWLockTranchesAllocated) LWLockTrancheArray[j--] = NULL; } LWLockTrancheArray[tranche_id] = tranche_name; }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_inquiry_evpd_85_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (unsigned char*,char const*,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int strlen (char const*) ; __attribute__((used)) static int inquiry_evpd_85(unsigned char * arr) { int num = 0; const char * na1 = "https://www.kernel.org/config"; const char * na2 = "http://www.kernel.org/log"; int plen, olen; arr[num++] = 0x1; /* lu, storage config */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; olen = strlen(na1); plen = olen - 1; if (plen % 4) plen = ((plen / 4) + 1) * 4; arr[num++] = plen; /* length, null termianted, padded */ memcpy(arr + num, na1, olen); memset(arr + num + olen, 0, plen - olen); num += plen; arr[num++] = 0x4; /* lu, logging */ arr[num++] = 0x0; /* reserved */ arr[num++] = 0x0; olen = strlen(na2); plen = olen + 1; if (plen % 4) plen = ((plen / 4) + 1) * 4; arr[num++] = plen; /* length, null terminated, padded */ memcpy(arr + num, na2, olen); memset(arr + num + olen, 0, plen - olen); num += plen; return num; }