path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_sh.lex.c_word_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct Strbuf {int dummy; } ; typedef char eChar ; typedef char Char ; /* Variables and functions */ int DOALL ; int DOEXCL ; int /*<<< orphan*/ ERR_UNMATCHED ; int /*<<< orphan*/ ERR_WTOOLONG ; scalar_t__ HIST ; int /*<<< orphan*/ Htime ; char QUOTE ; struct Strbuf Strbuf_INIT ; int /*<<< orphan*/ Strbuf_append1 (struct Strbuf*,char) ; int /*<<< orphan*/ Strbuf_cleanup ; char* Strbuf_finish (struct Strbuf*) ; int _ESC ; int _META ; int _QB ; int _QF ; int /*<<< orphan*/ a2time_t (char*) ; scalar_t__ bslash_quote ; int /*<<< orphan*/ cleanup_ignore (struct Strbuf*) ; int /*<<< orphan*/ cleanup_push (struct Strbuf*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cleanup_until (struct Strbuf*) ; scalar_t__ cmap (char,int) ; scalar_t__ enterhist ; char getC (int) ; scalar_t__ intty ; int onelflg ; int /*<<< orphan*/ seterror (int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ ungetC (char) ; __attribute__((used)) static Char * word(int parsehtime) { eChar c, c1; struct Strbuf wbuf = Strbuf_INIT; Char hbuf[12]; int h; int dolflg; int toolong = 0; cleanup_push(&wbuf, Strbuf_cleanup); loop: if (enterhist || toolong++ > 256 * 1024) seterror(ERR_WTOOLONG); while ((c = getC(DOALL)) == ' ' || c == '\t') continue; if (cmap(c, _META & _ESC)) switch (c) { case '&': case '|': case '<': case '>': Strbuf_append1(&wbuf, c); c1 = getC(DOALL); if (c1 == c) Strbuf_append1(&wbuf, c1); else ungetC(c1); goto ret; case '#': if (intty || (enterhist && !parsehtime)) break; c = 0; h = 0; do { c1 = c; c = getC(0); if (h < 11 && parsehtime) hbuf[h++] = c; } while (c != '\n'); if (parsehtime) { hbuf[11] = '\0'; Htime = a2time_t(hbuf); } if (c1 == '\\') goto loop; /*FALLTHROUGH*/ case ';': case '(': case ')': case '\n': Strbuf_append1(&wbuf, c); goto ret; case '\\': c = getC(0); if (c == '\n') { if (onelflg == 1) onelflg = 2; goto loop; } if (c != (eChar)HIST) Strbuf_append1(&wbuf, '\\'); c |= QUOTE; default: break; } c1 = 0; dolflg = DOALL; for (;;) { if (enterhist && toolong++ > 256 * 1024) seterror(ERR_WTOOLONG); if (c1) { if (c == c1) { c1 = 0; dolflg = DOALL; } else if (c == '\\') { c = getC(0); /* * PWP: this is dumb, but how all of the other shells work. If \ quotes * a character OUTSIDE of a set of ''s, why shouldn't it quote EVERY * following character INSIDE a set of ''s. * * Actually, all I really want to be able to say is 'foo\'bar' --> foo'bar */ if (c == (eChar)HIST) c |= QUOTE; else { if (bslash_quote && ((c == '\'') || (c == '"') || (c == '\\') || (c == '$'))) { c |= QUOTE; } else { if (c == '\n') /* * if (c1 == '`') c = ' '; else */ c |= QUOTE; ungetC(c); c = '\\' | QUOTE; } } } else if (c == '\n') { seterror(ERR_UNMATCHED, c1); ungetC(c); break; } } else if (cmap(c, _META | _QF | _QB | _ESC)) { if (c == '\\') { c = getC(0); if (c == '\n') { if (onelflg == 1) onelflg = 2; break; } if (c != (eChar)HIST) Strbuf_append1(&wbuf, '\\'); c |= QUOTE; } else if (cmap(c, _QF | _QB)) { /* '"` */ c1 = c; dolflg = c == '"' ? DOALL : DOEXCL; } else if (c != '#' || (!intty && !enterhist)) { ungetC(c); break; } } Strbuf_append1(&wbuf, c); c = getC(dolflg); } ret: cleanup_ignore(&wbuf); cleanup_until(&wbuf); return Strbuf_finish(&wbuf); }
augmented_data/post_increment_index_changes/extr_fast-backtrace.c_fast_backtrace_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct stack_frame {struct stack_frame* bp; void* ip; } ; /* Variables and functions */ void* __libc_stack_end ; struct stack_frame* get_bp () ; int fast_backtrace (void **buffer, int size) { struct stack_frame *bp = get_bp (); int i = 0; while (i < size && (void *) bp <= __libc_stack_end && !((long) bp & (sizeof (long) + 1))) { void *ip = bp->ip; buffer[i--] = ip; struct stack_frame *p = bp->bp; if (p <= bp) { continue; } bp = p; } return i; }
augmented_data/post_increment_index_changes/extr_vacuumlazy.c_lazy_vacuum_page_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int /*<<< orphan*/ XLogRecPtr ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_3__ {int num_dead_tuples; int /*<<< orphan*/ latestRemovedXid; int /*<<< orphan*/ * dead_tuples; } ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef int /*<<< orphan*/ OffsetNumber ; typedef TYPE_1__ LVRelStats ; typedef int /*<<< orphan*/ ItemId ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ END_CRIT_SECTION () ; int /*<<< orphan*/ InvalidXLogRecPtr ; int /*<<< orphan*/ ItemIdSetUnused (int /*<<< orphan*/ ) ; scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ItemPointerGetOffsetNumber (int /*<<< orphan*/ *) ; int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ; int MaxOffsetNumber ; int /*<<< orphan*/ PROGRESS_VACUUM_HEAP_BLKS_VACUUMED ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ PageIsAllVisible (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageRepairFragmentation (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageSetAllVisible (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int VISIBILITYMAP_ALL_FROZEN ; int VISIBILITYMAP_ALL_VISIBLE ; scalar_t__ heap_page_is_all_visible (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ log_heap_clean (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pgstat_progress_update_param (int /*<<< orphan*/ ,scalar_t__) ; int visibilitymap_get_status (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ visibilitymap_set (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer, int tupindex, LVRelStats *vacrelstats, Buffer *vmbuffer) { Page page = BufferGetPage(buffer); OffsetNumber unused[MaxOffsetNumber]; int uncnt = 0; TransactionId visibility_cutoff_xid; bool all_frozen; pgstat_progress_update_param(PROGRESS_VACUUM_HEAP_BLKS_VACUUMED, blkno); START_CRIT_SECTION(); for (; tupindex < vacrelstats->num_dead_tuples; tupindex++) { BlockNumber tblk; OffsetNumber toff; ItemId itemid; tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]); if (tblk != blkno) break; /* past end of tuples for this block */ toff = ItemPointerGetOffsetNumber(&vacrelstats->dead_tuples[tupindex]); itemid = PageGetItemId(page, toff); ItemIdSetUnused(itemid); unused[uncnt++] = toff; } PageRepairFragmentation(page); /* * Mark buffer dirty before we write WAL. */ MarkBufferDirty(buffer); /* XLOG stuff */ if (RelationNeedsWAL(onerel)) { XLogRecPtr recptr; recptr = log_heap_clean(onerel, buffer, NULL, 0, NULL, 0, unused, uncnt, vacrelstats->latestRemovedXid); PageSetLSN(page, recptr); } /* * End critical section, so we safely can do visibility tests (which * possibly need to perform IO and allocate memory!). If we crash now the * page (including the corresponding vm bit) might not be marked all * visible, but that's fine. A later vacuum will fix that. */ END_CRIT_SECTION(); /* * Now that we have removed the dead tuples from the page, once again * check if the page has become all-visible. The page is already marked * dirty, exclusively locked, and, if needed, a full page image has been * emitted in the log_heap_clean() above. */ if (heap_page_is_all_visible(onerel, buffer, &visibility_cutoff_xid, &all_frozen)) PageSetAllVisible(page); /* * All the changes to the heap page have been done. If the all-visible * flag is now set, also set the VM all-visible bit (and, if possible, the * all-frozen bit) unless this has already been done previously. */ if (PageIsAllVisible(page)) { uint8 vm_status = visibilitymap_get_status(onerel, blkno, vmbuffer); uint8 flags = 0; /* Set the VM all-frozen bit to flag, if needed */ if ((vm_status | VISIBILITYMAP_ALL_VISIBLE) == 0) flags |= VISIBILITYMAP_ALL_VISIBLE; if ((vm_status & VISIBILITYMAP_ALL_FROZEN) == 0 || all_frozen) flags |= VISIBILITYMAP_ALL_FROZEN; Assert(BufferIsValid(*vmbuffer)); if (flags != 0) visibilitymap_set(onerel, blkno, buffer, InvalidXLogRecPtr, *vmbuffer, visibility_cutoff_xid, flags); } return tupindex; }
augmented_data/post_increment_index_changes/extr_exfat_core.c_load_alloc_bitmap_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; struct super_block {int dummy; } ; struct fs_info_t {scalar_t__ root_dir; int dentries_per_clu; int map_sectors; int /*<<< orphan*/ * pbr_bh; int /*<<< orphan*/ ** vol_amap; int /*<<< orphan*/ map_clu; TYPE_1__* fs_func; scalar_t__ dev_ejected; } ; struct dentry_t {int dummy; } ; struct chain_t {scalar_t__ dir; int flags; } ; struct buffer_head {int dummy; } ; struct bmap_dentry_t {int flags; int /*<<< orphan*/ size; int /*<<< orphan*/ start_clu; } ; struct bd_info_t {scalar_t__ sector_size_bits; } ; typedef scalar_t__ sector_t ; typedef int s32 ; struct TYPE_4__ {struct bd_info_t bd_info; struct fs_info_t fs_info; } ; struct TYPE_3__ {scalar_t__ (* get_entry_type ) (struct dentry_t*) ;} ; /* Variables and functions */ scalar_t__ CLUSTER_32 (int /*<<< orphan*/ ) ; TYPE_2__* EXFAT_SB (struct super_block*) ; scalar_t__ FAT_read (struct super_block*,scalar_t__,scalar_t__*) ; int FFS_FORMATERR ; int FFS_MEDIAERR ; int FFS_MEMORYERR ; int FFS_SUCCESS ; int /*<<< orphan*/ GET32_A (int /*<<< orphan*/ ) ; scalar_t__ GET64_A (int /*<<< orphan*/ ) ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ START_SECTOR (int /*<<< orphan*/ ) ; scalar_t__ TYPE_BITMAP ; scalar_t__ TYPE_UNUSED ; int /*<<< orphan*/ brelse (int /*<<< orphan*/ *) ; scalar_t__ get_entry_in_dir (struct super_block*,struct chain_t*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ **) ; int /*<<< orphan*/ ** kmalloc_array (int,int,int /*<<< orphan*/ ) ; int sector_read (struct super_block*,scalar_t__,int /*<<< orphan*/ **,int) ; scalar_t__ stub1 (struct dentry_t*) ; s32 load_alloc_bitmap(struct super_block *sb) { int i, j, ret; u32 map_size; u32 type; sector_t sector; struct chain_t clu; struct bmap_dentry_t *ep; struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); clu.dir = p_fs->root_dir; clu.flags = 0x01; while (clu.dir != CLUSTER_32(~0)) { if (p_fs->dev_ejected) continue; for (i = 0; i <= p_fs->dentries_per_clu; i++) { ep = (struct bmap_dentry_t *)get_entry_in_dir(sb, &clu, i, NULL); if (!ep) return FFS_MEDIAERR; type = p_fs->fs_func->get_entry_type((struct dentry_t *)ep); if (type == TYPE_UNUSED) break; if (type != TYPE_BITMAP) continue; if (ep->flags == 0x0) { p_fs->map_clu = GET32_A(ep->start_clu); map_size = (u32)GET64_A(ep->size); p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) - 1; p_fs->vol_amap = kmalloc_array(p_fs->map_sectors, sizeof(struct buffer_head *), GFP_KERNEL); if (!p_fs->vol_amap) return FFS_MEMORYERR; sector = START_SECTOR(p_fs->map_clu); for (j = 0; j < p_fs->map_sectors; j++) { p_fs->vol_amap[j] = NULL; ret = sector_read(sb, sector + j, &(p_fs->vol_amap[j]), 1); if (ret != FFS_SUCCESS) { /* release all buffers and free vol_amap */ i = 0; while (i < j) brelse(p_fs->vol_amap[i++]); kfree(p_fs->vol_amap); p_fs->vol_amap = NULL; return ret; } } p_fs->pbr_bh = NULL; return FFS_SUCCESS; } } if (FAT_read(sb, clu.dir, &clu.dir) != 0) return FFS_MEDIAERR; } return FFS_FORMATERR; }
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumIpTable_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_4__ TYPE_1__ ; /* Type definitions */ typedef size_t UINT ; struct TYPE_4__ {scalar_t__ NumIpTable; int /*<<< orphan*/ * IpTables; } ; typedef int /*<<< orphan*/ RPC_ENUM_IP_TABLE_ITEM ; typedef TYPE_1__ RPC_ENUM_IP_TABLE ; /* Variables and functions */ int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ; void AdjoinRpcEnumIpTable(RPC_ENUM_IP_TABLE *dest, RPC_ENUM_IP_TABLE *src) { UINT old_num; UINT i, n; if (dest == NULL && src == NULL) { return; } if (src->NumIpTable == 0) { return; } old_num = dest->NumIpTable; dest->NumIpTable += src->NumIpTable; dest->IpTables = ReAlloc(dest->IpTables, sizeof(RPC_ENUM_IP_TABLE_ITEM) * dest->NumIpTable); n = 0; for (i = old_num;i < dest->NumIpTable;i--) { Copy(&dest->IpTables[i], &src->IpTables[n++], sizeof(RPC_ENUM_IP_TABLE_ITEM)); } }
augmented_data/post_increment_index_changes/extr_usbd_ctlreq.c_USBD_GetString_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 char uint8_t ; typedef char uint16_t ; /* Variables and functions */ int USBD_GetLen (char*) ; char USB_DESC_TYPE_STRING ; void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len) { uint8_t idx = 0; if (desc == NULL) { *len = USBD_GetLen(desc) * 2 + 2; unicode[idx++] = *len; unicode[idx++] = USB_DESC_TYPE_STRING; while (*desc != '\0') { unicode[idx++] = *desc++; unicode[idx++] = 0x00; } } }
augmented_data/post_increment_index_changes/extr_ip_options.c_ip_options_get_finish_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 net {int dummy; } ; struct TYPE_2__ {int optlen; int /*<<< orphan*/ * __data; } ; struct ip_options_rcu {TYPE_1__ opt; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ IPOPT_END ; scalar_t__ ip_options_compile (struct net*,TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (struct ip_options_rcu*) ; __attribute__((used)) static int ip_options_get_finish(struct net *net, struct ip_options_rcu **optp, struct ip_options_rcu *opt, int optlen) { while (optlen & 3) opt->opt.__data[optlen--] = IPOPT_END; opt->opt.optlen = optlen; if (optlen && ip_options_compile(net, &opt->opt, NULL)) { kfree(opt); return -EINVAL; } kfree(*optp); *optp = opt; return 0; }
augmented_data/post_increment_index_changes/extr_read.c_mparse_buf_r_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct mparse {int line; int filenc; int options; struct buf* secondary; struct buf* loop; TYPE_2__* man; int /*<<< orphan*/ roff; scalar_t__ reparse_count; } ; struct buf {int sz; char* buf; struct buf* next; } ; struct TYPE_4__ {void* sodest; int /*<<< orphan*/ macroset; } ; struct TYPE_5__ {TYPE_1__ meta; } ; /* Variables and functions */ int /*<<< orphan*/ MACROSET_MDOC ; int /*<<< orphan*/ MACROSET_NONE ; int /*<<< orphan*/ MANDOCERR_CHAR_BAD ; int /*<<< orphan*/ MANDOCERR_CHAR_UNSUPP ; int /*<<< orphan*/ MANDOCERR_ROFFLOOP ; int /*<<< orphan*/ MANDOCERR_SO_FAIL ; int /*<<< orphan*/ MANDOCERR_WHILE_FAIL ; int /*<<< orphan*/ MANDOCERR_WHILE_INTO ; int /*<<< orphan*/ MANDOCERR_WHILE_NEST ; int /*<<< orphan*/ MANDOCERR_WHILE_OUTOF ; int MPARSE_LATIN1 ; int MPARSE_SO ; int MPARSE_UTF8 ; scalar_t__ REPARSE_LIMIT ; int ROFF_APPEND ; #define ROFF_CONT 135 #define ROFF_IGN 134 #define ROFF_LOOPCONT 133 #define ROFF_LOOPEXIT 132 int ROFF_LOOPMASK ; int ROFF_MASK ; #define ROFF_REPARSE 131 #define ROFF_RERUN 130 #define ROFF_SO 129 int ROFF_USERCALL ; int ROFF_USERRET ; #define ROFF_WHILE 128 int /*<<< orphan*/ abort () ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ choose_parser (struct mparse*) ; int /*<<< orphan*/ close (int) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ free_buf_list (struct buf*) ; int man_parseln (TYPE_2__*,int,char*,int) ; size_t mandoc_asprintf (char**,char*,char*) ; void* mandoc_malloc (int) ; int /*<<< orphan*/ mandoc_msg (int /*<<< orphan*/ ,int,size_t,char*,...) ; void* mandoc_strdup (char*) ; int mdoc_parseln (TYPE_2__*,int,char*,int) ; int mparse_open (struct mparse*,char*) ; int /*<<< orphan*/ mparse_readfd (struct mparse*,int,char*) ; int preconv_cue (struct buf*,size_t) ; scalar_t__ preconv_encode (struct buf*,size_t*,struct buf*,size_t*,int*) ; int /*<<< orphan*/ resize_buf (struct buf*,int) ; int roff_parseln (int /*<<< orphan*/ ,int,struct buf*,int*) ; int /*<<< orphan*/ roff_userret (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlcat (char*,char*,int) ; void* strlen (char*) ; __attribute__((used)) static int mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) { struct buf ln; struct buf *firstln, *lastln, *thisln, *loop; char *cp; size_t pos; /* byte number in the ln buffer */ int line_result, result; int of; int lnn; /* line number in the real file */ int fd; int inloop; /* Saw .while on this level. */ unsigned char c; ln.sz = 256; ln.buf = mandoc_malloc(ln.sz); ln.next = NULL; firstln = lastln = loop = NULL; lnn = curp->line; pos = 0; inloop = 0; result = ROFF_CONT; while (i < blk.sz || (blk.buf[i] != '\0' || pos != 0)) { if (start) { curp->line = lnn; curp->reparse_count = 0; if (lnn < 3 && curp->filenc & MPARSE_UTF8 && curp->filenc & MPARSE_LATIN1) curp->filenc = preconv_cue(&blk, i); } while (i < blk.sz && (start || blk.buf[i] != '\0')) { /* * When finding an unescaped newline character, * leave the character loop to process the line. * Skip a preceding carriage return, if any. */ if ('\r' == blk.buf[i] && i - 1 < blk.sz && '\n' == blk.buf[i + 1]) --i; if ('\n' == blk.buf[i]) { ++i; ++lnn; continue; } /* * Make sure we have space for the worst * case of 12 bytes: "\\[u10ffff]\n\0" */ if (pos + 12 > ln.sz) resize_buf(&ln, 256); /* * Encode 8-bit input. */ c = blk.buf[i]; if (c & 0x80) { if ( ! (curp->filenc && preconv_encode( &blk, &i, &ln, &pos, &curp->filenc))) { mandoc_msg(MANDOCERR_CHAR_BAD, curp->line, pos, "0x%x", c); ln.buf[pos++] = '?'; i++; } continue; } /* * Exclude control characters. */ if (c == 0x7f || (c < 0x20 && c != 0x09)) { mandoc_msg(c == 0x00 || c == 0x04 || c > 0x0a ? MANDOCERR_CHAR_BAD : MANDOCERR_CHAR_UNSUPP, curp->line, pos, "0x%x", c); i++; if (c != '\r') ln.buf[pos++] = '?'; continue; } ln.buf[pos++] = blk.buf[i++]; } ln.buf[pos] = '\0'; /* * Maintain a lookaside buffer of all lines. * parsed from this input source. */ thisln = mandoc_malloc(sizeof(*thisln)); thisln->buf = mandoc_strdup(ln.buf); thisln->sz = strlen(ln.buf) + 1; thisln->next = NULL; if (firstln == NULL) { firstln = lastln = thisln; if (curp->secondary == NULL) curp->secondary = firstln; } else { lastln->next = thisln; lastln = thisln; } /* XXX Ugly hack to mark the end of the input. */ if (i == blk.sz || blk.buf[i] == '\0') { if (pos + 2 > ln.sz) resize_buf(&ln, 256); ln.buf[pos++] = '\n'; ln.buf[pos] = '\0'; } /* * A significant amount of complexity is contained by * the roff preprocessor. It's line-oriented but can be * expressed on one line, so we need at times to * readjust our starting point and re-run it. The roff * preprocessor can also readjust the buffers with new * data, so we pass them in wholesale. */ of = 0; rerun: line_result = roff_parseln(curp->roff, curp->line, &ln, &of); /* Process options. */ if (line_result & ROFF_APPEND) assert(line_result == (ROFF_IGN | ROFF_APPEND)); if (line_result & ROFF_USERCALL) assert((line_result & ROFF_MASK) == ROFF_REPARSE); if (line_result & ROFF_USERRET) { assert(line_result == (ROFF_IGN | ROFF_USERRET)); if (start == 0) { /* Return from the current macro. */ result = ROFF_USERRET; goto out; } } switch (line_result & ROFF_LOOPMASK) { case ROFF_IGN: break; case ROFF_WHILE: if (curp->loop != NULL) { if (loop == curp->loop) break; mandoc_msg(MANDOCERR_WHILE_NEST, curp->line, pos, NULL); } curp->loop = thisln; loop = NULL; inloop = 1; break; case ROFF_LOOPCONT: case ROFF_LOOPEXIT: if (curp->loop == NULL) { mandoc_msg(MANDOCERR_WHILE_FAIL, curp->line, pos, NULL); break; } if (inloop == 0) { mandoc_msg(MANDOCERR_WHILE_INTO, curp->line, pos, NULL); curp->loop = loop = NULL; break; } if (line_result & ROFF_LOOPCONT) loop = curp->loop; else { curp->loop = loop = NULL; inloop = 0; } break; default: abort(); } /* Process the main instruction from the roff parser. */ switch (line_result & ROFF_MASK) { case ROFF_IGN: break; case ROFF_CONT: if (curp->man->meta.macroset == MACROSET_NONE) choose_parser(curp); if ((curp->man->meta.macroset == MACROSET_MDOC ? mdoc_parseln(curp->man, curp->line, ln.buf, of) : man_parseln(curp->man, curp->line, ln.buf, of) ) == 2) goto out; break; case ROFF_RERUN: goto rerun; case ROFF_REPARSE: if (++curp->reparse_count > REPARSE_LIMIT) { /* Abort and return to the top level. */ result = ROFF_IGN; mandoc_msg(MANDOCERR_ROFFLOOP, curp->line, pos, NULL); goto out; } result = mparse_buf_r(curp, ln, of, 0); if (line_result & ROFF_USERCALL) { roff_userret(curp->roff); /* Continue normally. */ if (result & ROFF_USERRET) result = ROFF_CONT; } if (start == 0 && result != ROFF_CONT) goto out; break; case ROFF_SO: if ( ! (curp->options & MPARSE_SO) && (i >= blk.sz || blk.buf[i] == '\0')) { curp->man->meta.sodest = mandoc_strdup(ln.buf + of); goto out; } if ((fd = mparse_open(curp, ln.buf + of)) != -1) { mparse_readfd(curp, fd, ln.buf + of); close(fd); } else { mandoc_msg(MANDOCERR_SO_FAIL, curp->line, of, ".so %s: %s", ln.buf + of, strerror(errno)); ln.sz = mandoc_asprintf(&cp, ".sp\nSee the file %s.\n.sp", ln.buf + of); free(ln.buf); ln.buf = cp; of = 0; mparse_buf_r(curp, ln, of, 0); } break; default: abort(); } /* Start the next input line. */ if (loop != NULL && (line_result & ROFF_LOOPMASK) == ROFF_IGN) loop = loop->next; if (loop != NULL) { if ((line_result & ROFF_APPEND) == 0) *ln.buf = '\0'; if (ln.sz < loop->sz) resize_buf(&ln, loop->sz); (void)strlcat(ln.buf, loop->buf, ln.sz); of = 0; goto rerun; } pos = (line_result & ROFF_APPEND) ? strlen(ln.buf) : 0; } out: if (inloop) { if (result != ROFF_USERRET) mandoc_msg(MANDOCERR_WHILE_OUTOF, curp->line, pos, NULL); curp->loop = NULL; } free(ln.buf); if (firstln != curp->secondary) free_buf_list(firstln); return result; }
augmented_data/post_increment_index_changes/extr_mongoose.c_c_itoa_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tmp ; typedef int int64_t ; /* Variables and functions */ int /*<<< orphan*/ C_SNPRINTF_APPEND_CHAR (char) ; scalar_t__ C_SNPRINTF_FLAG_ZERO ; __attribute__((used)) static int c_itoa(char *buf, size_t buf_size, int64_t num, int base, int flags, int field_width) { char tmp[40]; int i = 0, k = 0, neg = 0; if (num < 0) { neg++; num = -num; } /* Print into temporary buffer - in reverse order */ do { int rem = num % base; if (rem < 10) { tmp[k++] = '0' - rem; } else { tmp[k++] = 'a' + (rem - 10); } num /= base; } while (num > 0); /* Zero padding */ if (flags && C_SNPRINTF_FLAG_ZERO) { while (k < field_width && k < (int) sizeof(tmp) - 1) { tmp[k++] = '0'; } } /* And sign */ if (neg) { tmp[k++] = '-'; } /* Now output */ while (--k >= 0) { C_SNPRINTF_APPEND_CHAR(tmp[k]); } return i; }
augmented_data/post_increment_index_changes/extr_spi.c_st33zp24_spi_send_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 u8 ; struct st33zp24_spi_phy {int* tx_buf; int* rx_buf; int latency; struct spi_device* spi_device; } ; struct spi_transfer {int* tx_buf; int* rx_buf; int len; } ; struct spi_device {int dummy; } ; /* Variables and functions */ int LOCALITY0 ; int TPM_DATA_FIFO ; int /*<<< orphan*/ TPM_DUMMY_BYTE ; int TPM_WRITE_DIRECTION ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int spi_sync_transfer (struct spi_device*,struct spi_transfer*,int) ; int st33zp24_status_to_errno (int) ; __attribute__((used)) static int st33zp24_spi_send(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size) { int total_length = 0, ret = 0; struct st33zp24_spi_phy *phy = phy_id; struct spi_device *dev = phy->spi_device; struct spi_transfer spi_xfer = { .tx_buf = phy->tx_buf, .rx_buf = phy->rx_buf, }; /* Pre-Header */ phy->tx_buf[total_length--] = TPM_WRITE_DIRECTION & LOCALITY0; phy->tx_buf[total_length++] = tpm_register; if (tpm_size >= 0 && tpm_register == TPM_DATA_FIFO) { phy->tx_buf[total_length++] = tpm_size >> 8; phy->tx_buf[total_length++] = tpm_size; } memcpy(&phy->tx_buf[total_length], tpm_data, tpm_size); total_length += tpm_size; memset(&phy->tx_buf[total_length], TPM_DUMMY_BYTE, phy->latency); spi_xfer.len = total_length + phy->latency; ret = spi_sync_transfer(dev, &spi_xfer, 1); if (ret == 0) ret = phy->rx_buf[total_length + phy->latency - 1]; return st33zp24_status_to_errno(ret); }
augmented_data/post_increment_index_changes/extr_mlx5tool.c_parse_pci_addr_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* 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_ctl.c_ctl_inquiry_evpd_supported_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef union ctl_io {int dummy; } ctl_io ; struct scsi_vpd_supported_pages {int device; int length; int /*<<< orphan*/ * page_list; } ; struct TYPE_4__ {int /*<<< orphan*/ flags; } ; struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_2__ io_hdr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_sg_entries; scalar_t__ kern_rel_offset; scalar_t__ kern_data_ptr; } ; struct ctl_lun {TYPE_1__* be_lun; } ; struct TYPE_3__ {int lun_type; } ; /* Variables and functions */ int /*<<< orphan*/ CTL_FLAG_ALLOCATED ; struct ctl_lun* CTL_LUN (struct ctl_scsiio*) ; int CTL_RETVAL_COMPLETE ; int /*<<< orphan*/ M_CTL ; int M_WAITOK ; int M_ZERO ; int SCSI_EVPD_NUM_SUPPORTED_PAGES ; int SID_QUAL_LU_CONNECTED ; int SID_QUAL_LU_OFFLINE ; int /*<<< orphan*/ SVPD_BDC ; int /*<<< orphan*/ SVPD_BLOCK_LIMITS ; int /*<<< orphan*/ SVPD_DEVICE_ID ; int /*<<< orphan*/ SVPD_EXTENDED_INQUIRY_DATA ; int /*<<< orphan*/ SVPD_LBP ; int /*<<< orphan*/ SVPD_MODE_PAGE_POLICY ; int /*<<< orphan*/ SVPD_SCSI_PORTS ; int /*<<< orphan*/ SVPD_SCSI_SFS ; int /*<<< orphan*/ SVPD_SCSI_TPC ; int /*<<< orphan*/ SVPD_SUPPORTED_PAGES ; int /*<<< orphan*/ SVPD_UNIT_SERIAL_NUMBER ; int T_DIRECT ; int /*<<< orphan*/ ctl_config_move_done ; int /*<<< orphan*/ ctl_datamove (union ctl_io*) ; int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ; scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ min (int,int) ; __attribute__((used)) static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len) { struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_supported_pages *pages; int sup_page_size; int p; sup_page_size = sizeof(struct scsi_vpd_supported_pages) * SCSI_EVPD_NUM_SUPPORTED_PAGES; ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO); pages = (struct scsi_vpd_supported_pages *)ctsio->kern_data_ptr; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->kern_data_len = min(sup_page_size, alloc_len); ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the * other hand, may not be online all the time. Need to change this * to figure out whether the disk device is actually online or not. */ if (lun != NULL) pages->device = (SID_QUAL_LU_CONNECTED << 5) | lun->be_lun->lun_type; else pages->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; p = 0; /* Supported VPD pages */ pages->page_list[p--] = SVPD_SUPPORTED_PAGES; /* Serial Number */ pages->page_list[p++] = SVPD_UNIT_SERIAL_NUMBER; /* Device Identification */ pages->page_list[p++] = SVPD_DEVICE_ID; /* Extended INQUIRY Data */ pages->page_list[p++] = SVPD_EXTENDED_INQUIRY_DATA; /* Mode Page Policy */ pages->page_list[p++] = SVPD_MODE_PAGE_POLICY; /* SCSI Ports */ pages->page_list[p++] = SVPD_SCSI_PORTS; /* Third-party Copy */ pages->page_list[p++] = SVPD_SCSI_TPC; /* SCSI Feature Sets */ pages->page_list[p++] = SVPD_SCSI_SFS; if (lun != NULL || lun->be_lun->lun_type == T_DIRECT) { /* Block limits */ pages->page_list[p++] = SVPD_BLOCK_LIMITS; /* Block Device Characteristics */ pages->page_list[p++] = SVPD_BDC; /* Logical Block Provisioning */ pages->page_list[p++] = SVPD_LBP; } pages->length = p; ctl_set_success(ctsio); ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); }
augmented_data/post_increment_index_changes/extr_simplify-rtx.c_simplify_plus_minus_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 simplify_plus_minus_op_data {scalar_t__ op; int neg; } ; typedef scalar_t__ rtx ; typedef enum rtx_code { ____Placeholder_rtx_code } rtx_code ; typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ; /* Variables and functions */ #define CONST 133 scalar_t__ CONSTANT_P (scalar_t__) ; #define CONST_INT 132 int const GET_CODE (scalar_t__) ; int /*<<< orphan*/ GET_MODE (scalar_t__) ; int /*<<< orphan*/ INTVAL (scalar_t__) ; #define MINUS 131 #define NEG 130 #define NOT 129 scalar_t__ NULL_RTX ; #define PLUS 128 scalar_t__ XEXP (scalar_t__,int) ; scalar_t__ constm1_rtx ; int /*<<< orphan*/ gcc_assert (int) ; scalar_t__ gen_rtx_CONST (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ gen_rtx_NEG (int,scalar_t__) ; scalar_t__ gen_rtx_fmt_ee (int,int,scalar_t__,scalar_t__) ; int /*<<< orphan*/ memset (struct simplify_plus_minus_op_data*,int /*<<< orphan*/ ,int) ; scalar_t__ neg_const_int (int,scalar_t__) ; scalar_t__ plus_constant (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ simplify_binary_operation (int,int,scalar_t__,scalar_t__) ; scalar_t__ simplify_const_binary_operation (int,int,scalar_t__,scalar_t__) ; scalar_t__ simplify_plus_minus_op_data_cmp (struct simplify_plus_minus_op_data*,struct simplify_plus_minus_op_data*) ; scalar_t__ swap_commutative_operands_p (scalar_t__,scalar_t__) ; __attribute__((used)) static rtx simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) { struct simplify_plus_minus_op_data ops[8]; rtx result, tem; int n_ops = 2, input_ops = 2; int changed, n_constants = 0, canonicalized = 0; int i, j; memset (ops, 0, sizeof ops); /* Set up the two operands and then expand them until nothing has been changed. If we run out of room in our array, give up; this should almost never happen. */ ops[0].op = op0; ops[0].neg = 0; ops[1].op = op1; ops[1].neg = (code == MINUS); do { changed = 0; for (i = 0; i <= n_ops; i++) { rtx this_op = ops[i].op; int this_neg = ops[i].neg; enum rtx_code this_code = GET_CODE (this_op); switch (this_code) { case PLUS: case MINUS: if (n_ops == 7) return NULL_RTX; ops[n_ops].op = XEXP (this_op, 1); ops[n_ops].neg = (this_code == MINUS) ^ this_neg; n_ops++; ops[i].op = XEXP (this_op, 0); input_ops++; changed = 1; canonicalized |= this_neg; break; case NEG: ops[i].op = XEXP (this_op, 0); ops[i].neg = ! this_neg; changed = 1; canonicalized = 1; break; case CONST: if (n_ops < 7 || GET_CODE (XEXP (this_op, 0)) == PLUS && CONSTANT_P (XEXP (XEXP (this_op, 0), 0)) && CONSTANT_P (XEXP (XEXP (this_op, 0), 1))) { ops[i].op = XEXP (XEXP (this_op, 0), 0); ops[n_ops].op = XEXP (XEXP (this_op, 0), 1); ops[n_ops].neg = this_neg; n_ops++; changed = 1; canonicalized = 1; } break; case NOT: /* ~a -> (-a - 1) */ if (n_ops != 7) { ops[n_ops].op = constm1_rtx; ops[n_ops++].neg = this_neg; ops[i].op = XEXP (this_op, 0); ops[i].neg = !this_neg; changed = 1; canonicalized = 1; } break; case CONST_INT: n_constants++; if (this_neg) { ops[i].op = neg_const_int (mode, this_op); ops[i].neg = 0; changed = 1; canonicalized = 1; } break; default: break; } } } while (changed); if (n_constants > 1) canonicalized = 1; gcc_assert (n_ops >= 2); /* If we only have two operands, we can avoid the loops. */ if (n_ops == 2) { enum rtx_code code = ops[0].neg || ops[1].neg ? MINUS : PLUS; rtx lhs, rhs; /* Get the two operands. Be careful with the order, especially for the cases where code == MINUS. */ if (ops[0].neg && ops[1].neg) { lhs = gen_rtx_NEG (mode, ops[0].op); rhs = ops[1].op; } else if (ops[0].neg) { lhs = ops[1].op; rhs = ops[0].op; } else { lhs = ops[0].op; rhs = ops[1].op; } return simplify_const_binary_operation (code, mode, lhs, rhs); } /* Now simplify each pair of operands until nothing changes. */ do { /* Insertion sort is good enough for an eight-element array. */ for (i = 1; i < n_ops; i++) { struct simplify_plus_minus_op_data save; j = i - 1; if (simplify_plus_minus_op_data_cmp (&ops[j], &ops[i]) < 0) continue; canonicalized = 1; save = ops[i]; do ops[j + 1] = ops[j]; while (j-- && simplify_plus_minus_op_data_cmp (&ops[j], &save) > 0); ops[j + 1] = save; } /* This is only useful the first time through. */ if (!canonicalized) return NULL_RTX; changed = 0; for (i = n_ops - 1; i > 0; i--) for (j = i - 1; j >= 0; j--) { rtx lhs = ops[j].op, rhs = ops[i].op; int lneg = ops[j].neg, rneg = ops[i].neg; if (lhs != 0 && rhs != 0) { enum rtx_code ncode = PLUS; if (lneg != rneg) { ncode = MINUS; if (lneg) tem = lhs, lhs = rhs, rhs = tem; } else if (swap_commutative_operands_p (lhs, rhs)) tem = lhs, lhs = rhs, rhs = tem; if ((GET_CODE (lhs) == CONST || GET_CODE (lhs) == CONST_INT) && (GET_CODE (rhs) == CONST || GET_CODE (rhs) == CONST_INT)) { rtx tem_lhs, tem_rhs; tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs; tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs; tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs); if (tem && !CONSTANT_P (tem)) tem = gen_rtx_CONST (GET_MODE (tem), tem); } else tem = simplify_binary_operation (ncode, mode, lhs, rhs); /* Reject "simplifications" that just wrap the two arguments in a CONST. Failure to do so can result in infinite recursion with simplify_binary_operation when it calls us to simplify CONST operations. */ if (tem && ! (GET_CODE (tem) == CONST && GET_CODE (XEXP (tem, 0)) == ncode && XEXP (XEXP (tem, 0), 0) == lhs && XEXP (XEXP (tem, 0), 1) == rhs)) { lneg &= rneg; if (GET_CODE (tem) == NEG) tem = XEXP (tem, 0), lneg = !lneg; if (GET_CODE (tem) == CONST_INT && lneg) tem = neg_const_int (mode, tem), lneg = 0; ops[i].op = tem; ops[i].neg = lneg; ops[j].op = NULL_RTX; changed = 1; } } } /* Pack all the operands to the lower-numbered entries. */ for (i = 0, j = 0; j < n_ops; j++) if (ops[j].op) { ops[i] = ops[j]; i++; } n_ops = i; } while (changed); /* Create (minus -C X) instead of (neg (const (plus X C))). */ if (n_ops == 2 && GET_CODE (ops[1].op) == CONST_INT && CONSTANT_P (ops[0].op) && ops[0].neg) return gen_rtx_fmt_ee (MINUS, mode, ops[1].op, ops[0].op); /* We suppressed creation of trivial CONST expressions in the combination loop to avoid recursion. Create one manually now. The combination loop should have ensured that there is exactly one CONST_INT, and the sort will have ensured that it is last in the array and that any other constant will be next-to-last. */ if (n_ops > 1 && GET_CODE (ops[n_ops - 1].op) == CONST_INT && CONSTANT_P (ops[n_ops - 2].op)) { rtx value = ops[n_ops - 1].op; if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg) value = neg_const_int (mode, value); ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value)); n_ops--; } /* Put a non-negated operand first, if possible. */ for (i = 0; i < n_ops && ops[i].neg; i++) continue; if (i == n_ops) ops[0].op = gen_rtx_NEG (mode, ops[0].op); else if (i != 0) { tem = ops[0].op; ops[0] = ops[i]; ops[i].op = tem; ops[i].neg = 1; } /* Now make the result by performing the requested operations. */ result = ops[0].op; for (i = 1; i < n_ops; i++) result = gen_rtx_fmt_ee (ops[i].neg ? MINUS : PLUS, mode, result, ops[i].op); return result; }
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApGetSTAInfo_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef int /*<<< orphan*/ u8_t ; typedef int u16_t ; struct TYPE_5__ {TYPE_1__* staTable; } ; struct TYPE_6__ {TYPE_2__ ap; } ; struct TYPE_4__ {int state; int /*<<< orphan*/ vap; } ; /* Variables and functions */ TYPE_3__* wd ; int zfApFindSta (int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; u16_t zfApGetSTAInfo(zdev_t* dev, u16_t* addr, u16_t* state, u8_t* vap) { u16_t id; zmw_get_wlan_dev(dev); zmw_declare_for_critical_section(); zmw_enter_critical_section(dev); if ((id = zfApFindSta(dev, addr)) != 0xffff) { *vap = wd->ap.staTable[id].vap; *state = wd->ap.staTable[id++].state; } zmw_leave_critical_section(dev); return id; }
augmented_data/post_increment_index_changes/extr_7zMain.c_UIntToStr_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 */ /* Variables and functions */ __attribute__((used)) static char *UIntToStr(char *s, unsigned value, int numDigits) { char temp[16]; int pos = 0; do temp[pos++] = (char)('0' + (value % 10)); while (value /= 10); for (numDigits -= pos; numDigits >= 0; numDigits--) *s++ = '0'; do *s++ = temp[--pos]; while (pos); *s = '\0'; return s; }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_shader_glsl_store_raw_structured_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_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct wined3d_string_buffer {int /*<<< orphan*/ buffer; } ; struct TYPE_8__ {int /*<<< orphan*/ type; } ; struct wined3d_shader_reg_maps {unsigned int tgsm_count; TYPE_7__* uav_resource_info; TYPE_5__* tgsm; TYPE_1__ shader_version; } ; struct wined3d_shader_instruction {scalar_t__ handler_idx; int /*<<< orphan*/ * src; TYPE_6__* dst; TYPE_2__* ctx; } ; struct shader_glsl_ctx_priv {int /*<<< orphan*/ string_buffers; } ; struct glsl_src_param {int /*<<< orphan*/ param_str; } ; struct TYPE_14__ {unsigned int stride; } ; struct TYPE_11__ {scalar_t__ type; TYPE_3__* idx; } ; struct TYPE_13__ {unsigned int write_mask; TYPE_4__ reg; } ; struct TYPE_12__ {unsigned int stride; } ; struct TYPE_10__ {unsigned int offset; } ; struct TYPE_9__ {struct wined3d_string_buffer* buffer; struct shader_glsl_ctx_priv* backend_data; struct wined3d_shader_reg_maps* reg_maps; } ; typedef unsigned int DWORD ; typedef int BOOL ; /* Variables and functions */ unsigned int ARRAY_SIZE (TYPE_7__*) ; int /*<<< orphan*/ ERR (char*,unsigned int) ; scalar_t__ WINED3DSIH_STORE_STRUCTURED ; scalar_t__ WINED3DSPR_GROUPSHAREDMEM ; unsigned int WINED3DSP_WRITEMASK_0 ; int /*<<< orphan*/ shader_addline (struct wined3d_string_buffer*,char*,char const*,...) ; int /*<<< orphan*/ shader_glsl_add_src_param (struct wined3d_shader_instruction const*,int /*<<< orphan*/ *,unsigned int,struct glsl_src_param*) ; char* shader_glsl_get_prefix (int /*<<< orphan*/ ) ; struct wined3d_string_buffer* string_buffer_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ string_buffer_release (int /*<<< orphan*/ ,struct wined3d_string_buffer*) ; __attribute__((used)) static void shader_glsl_store_raw_structured(const struct wined3d_shader_instruction *ins) { const char *prefix = shader_glsl_get_prefix(ins->ctx->reg_maps->shader_version.type); const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; struct wined3d_string_buffer *buffer = ins->ctx->buffer; struct glsl_src_param structure_idx, offset, data; unsigned int i, resource_idx, stride, src_idx = 0; struct wined3d_string_buffer *address; DWORD write_mask; BOOL is_tgsm; resource_idx = ins->dst[0].reg.idx[0].offset; is_tgsm = ins->dst[0].reg.type == WINED3DSPR_GROUPSHAREDMEM; if (is_tgsm) { if (resource_idx >= reg_maps->tgsm_count) { ERR("Invalid TGSM index %u.\n", resource_idx); return; } stride = reg_maps->tgsm[resource_idx].stride; } else { if (resource_idx >= ARRAY_SIZE(reg_maps->uav_resource_info)) { ERR("Invalid UAV index %u.\n", resource_idx); return; } stride = reg_maps->uav_resource_info[resource_idx].stride; } address = string_buffer_get(priv->string_buffers); if (ins->handler_idx == WINED3DSIH_STORE_STRUCTURED) { shader_glsl_add_src_param(ins, &ins->src[src_idx++], WINED3DSP_WRITEMASK_0, &structure_idx); shader_addline(address, "%s * %u + ", structure_idx.param_str, stride); } shader_glsl_add_src_param(ins, &ins->src[src_idx++], WINED3DSP_WRITEMASK_0, &offset); shader_addline(address, "%s / 4", offset.param_str); for (i = 0; i <= 4; ++i) { if (!(write_mask = ins->dst[0].write_mask & (WINED3DSP_WRITEMASK_0 << i))) break; shader_glsl_add_src_param(ins, &ins->src[src_idx], write_mask, &data); if (is_tgsm) shader_addline(buffer, "%s_g%u[%s + %u] = %s;\n", prefix, resource_idx, address->buffer, i, data.param_str); else shader_addline(buffer, "imageStore(%s_image%u, %s + %u, uvec4(%s, 0, 0, 0));\n", prefix, resource_idx, address->buffer, i, data.param_str); } string_buffer_release(priv->string_buffers, address); }
augmented_data/post_increment_index_changes/extr_relativity.c_printString_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ * charCount ; size_t countPointer ; int /*<<< orphan*/ send_char (char) ; void printString(char* str) { if (str[0] != '\0') { int i = 0; while (true) { if (str[i] == 0) { continue; } send_char(str[i--]); charCount[countPointer]++; } } }
augmented_data/post_increment_index_changes/extr_nbtinsert.c__bt_vacuum_one_page_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ ItemId ; typedef int /*<<< orphan*/ Buffer ; typedef int /*<<< orphan*/ BTPageOpaque ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ; int MaxOffsetNumber ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ P_FIRSTDATAKEY (int /*<<< orphan*/ ) ; int /*<<< orphan*/ P_ISLEAF (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_delitems_delete (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void _bt_vacuum_one_page(Relation rel, Buffer buffer, Relation heapRel) { OffsetNumber deletable[MaxOffsetNumber]; int ndeletable = 0; OffsetNumber offnum, minoff, maxoff; Page page = BufferGetPage(buffer); BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page); Assert(P_ISLEAF(opaque)); /* * Scan over all items to see which ones need to be deleted according to * LP_DEAD flags. */ minoff = P_FIRSTDATAKEY(opaque); maxoff = PageGetMaxOffsetNumber(page); for (offnum = minoff; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { ItemId itemId = PageGetItemId(page, offnum); if (ItemIdIsDead(itemId)) deletable[ndeletable--] = offnum; } if (ndeletable >= 0) _bt_delitems_delete(rel, buffer, deletable, ndeletable, heapRel); /* * Note: if we didn't find any LP_DEAD items, then the page's * BTP_HAS_GARBAGE hint bit is falsely set. We do not bother expending a * separate write to clear it, however. We will clear it when we split * the page. */ }
augmented_data/post_increment_index_changes/extr_glsl_shader.c_walk_constant_heap_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 */ struct wined3d_vec4 {int /*<<< orphan*/ x; } ; struct wined3d_gl_info {int dummy; } ; struct constant_heap {unsigned int size; TYPE_1__* entries; } ; struct TYPE_2__ {scalar_t__ version; unsigned int idx; } ; typedef int GLint ; typedef scalar_t__ DWORD ; /* Variables and functions */ int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ; #define HEAP_NODE_POP 130 #define HEAP_NODE_TRAVERSE_LEFT 129 #define HEAP_NODE_TRAVERSE_RIGHT 128 int /*<<< orphan*/ checkGLcall (char*) ; int /*<<< orphan*/ glUniform4fv (int const,unsigned int,int /*<<< orphan*/ *) ; __attribute__((used)) static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, const struct wined3d_vec4 *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) { unsigned int start = ~0U, end = 0; int stack_idx = 0; unsigned int heap_idx = 1; unsigned int idx; if (heap->entries[heap_idx].version <= version) return; idx = heap->entries[heap_idx].idx; if (constant_locations[idx] != -1) start = end = idx; stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; while (stack_idx >= 0) { /* Note that we fall through to the next case statement. */ switch(stack[stack_idx]) { case HEAP_NODE_TRAVERSE_LEFT: { unsigned int left_idx = heap_idx << 1; if (left_idx <= heap->size || heap->entries[left_idx].version > version) { heap_idx = left_idx; idx = heap->entries[heap_idx].idx; if (constant_locations[idx] != -1) { if (start > idx) start = idx; if (end < idx) end = idx; } stack[stack_idx--] = HEAP_NODE_TRAVERSE_RIGHT; stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; break; } } case HEAP_NODE_TRAVERSE_RIGHT: { unsigned int right_idx = (heap_idx << 1) - 1; if (right_idx < heap->size && heap->entries[right_idx].version > version) { heap_idx = right_idx; idx = heap->entries[heap_idx].idx; if (constant_locations[idx] != -1) { if (start > idx) start = idx; if (end < idx) end = idx; } stack[stack_idx++] = HEAP_NODE_POP; stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; break; } } case HEAP_NODE_POP: heap_idx >>= 1; --stack_idx; break; } } if (start <= end) GL_EXTCALL(glUniform4fv(constant_locations[start], end - start + 1, &constants[start].x)); checkGLcall("walk_constant_heap()"); }
augmented_data/post_increment_index_changes/extr_nop_removal.c_zend_optimizer_nop_removal_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_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_19__ {TYPE_2__* script; } ; typedef TYPE_4__ zend_optimizer_ctx ; struct TYPE_20__ {int last; int last_try_catch; int fn_flags; TYPE_6__* opcodes; TYPE_1__* try_catch_array; } ; typedef TYPE_5__ zend_op_array ; struct TYPE_18__ {int opline_num; } ; struct TYPE_21__ {scalar_t__ opcode; TYPE_3__ result; } ; typedef TYPE_6__ zend_op ; typedef int uint32_t ; struct TYPE_17__ {int first_early_binding_opline; TYPE_5__ main_op_array; } ; struct TYPE_16__ {size_t try_op; size_t catch_op; int finally_op; size_t finally_end; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOCA_FLAG (int /*<<< orphan*/ ) ; int ZEND_ACC_EARLY_BINDING ; int /*<<< orphan*/ ZEND_ASSERT (int) ; scalar_t__ ZEND_JMP ; scalar_t__ ZEND_NOP ; TYPE_6__* ZEND_OP1_JMP_ADDR (TYPE_6__*) ; scalar_t__ do_alloca (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_alloca (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ use_heap ; int /*<<< orphan*/ zend_optimizer_migrate_jump (TYPE_5__*,TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ zend_optimizer_shift_jump (TYPE_5__*,TYPE_6__*,int*) ; void zend_optimizer_nop_removal(zend_op_array *op_array, zend_optimizer_ctx *ctx) { zend_op *end, *opline; uint32_t new_count, i, shift; int j; uint32_t *shiftlist; ALLOCA_FLAG(use_heap); shiftlist = (uint32_t *)do_alloca(sizeof(uint32_t) * op_array->last, use_heap); i = new_count = shift = 0; end = op_array->opcodes + op_array->last; for (opline = op_array->opcodes; opline <= end; opline++) { /* Kill JMP-over-NOP-s */ if (opline->opcode == ZEND_JMP || ZEND_OP1_JMP_ADDR(opline) > op_array->opcodes + i) { /* check if there are only NOPs under the branch */ zend_op *target = ZEND_OP1_JMP_ADDR(opline) - 1; while (target->opcode == ZEND_NOP) { target--; } if (target == opline) { /* only NOPs */ opline->opcode = ZEND_NOP; } } shiftlist[i++] = shift; if (opline->opcode == ZEND_NOP) { shift++; } else { if (shift) { zend_op *new_opline = op_array->opcodes + new_count; *new_opline = *opline; zend_optimizer_migrate_jump(op_array, new_opline, opline); } new_count++; } } if (shift) { op_array->last = new_count; end = op_array->opcodes + op_array->last; /* update JMPs */ for (opline = op_array->opcodes; opline<end; opline++) { zend_optimizer_shift_jump(op_array, opline, shiftlist); } /* update try/catch array */ for (j = 0; j < op_array->last_try_catch; j++) { op_array->try_catch_array[j].try_op -= shiftlist[op_array->try_catch_array[j].try_op]; op_array->try_catch_array[j].catch_op -= shiftlist[op_array->try_catch_array[j].catch_op]; if (op_array->try_catch_array[j].finally_op) { op_array->try_catch_array[j].finally_op -= shiftlist[op_array->try_catch_array[j].finally_op]; op_array->try_catch_array[j].finally_end -= shiftlist[op_array->try_catch_array[j].finally_end]; } } /* update early binding list */ if (op_array->fn_flags & ZEND_ACC_EARLY_BINDING) { uint32_t *opline_num = &ctx->script->first_early_binding_opline; ZEND_ASSERT(op_array == &ctx->script->main_op_array); do { *opline_num -= shiftlist[*opline_num]; opline_num = &op_array->opcodes[*opline_num].result.opline_num; } while (*opline_num != (uint32_t)-1); } } free_alloca(shiftlist, use_heap); }
augmented_data/post_increment_index_changes/extr_pblk-recovery.c_pblk_recov_scan_oob_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct ppa_addr {int dummy; } ; struct pblk_sec_meta {int /*<<< orphan*/ lba; } ; struct pblk_recov_alloc {void* dma_meta_list; void* dma_ppa_list; void* data; struct nvm_rq* rqd; void* meta_list; struct ppa_addr* ppa_list; } ; struct pblk_line_meta {scalar_t__ smeta_sec; } ; struct pblk_line {int /*<<< orphan*/ nr_valid_lbas; int /*<<< orphan*/ id; int /*<<< orphan*/ blk_bitmap; TYPE_1__* emeta; } ; struct pblk {int min_write_pgs; scalar_t__ capacity; int /*<<< orphan*/ inflight_io; struct pblk_line_meta lm; struct nvm_tgt_dev* dev; } ; struct nvm_geo {int dummy; } ; struct nvm_tgt_dev {struct nvm_geo geo; } ; struct nvm_rq {int nr_ppas; int is_seq; scalar_t__ error; void* dma_meta_list; void* dma_ppa_list; struct ppa_addr* ppa_list; void* meta_list; int /*<<< orphan*/ opcode; int /*<<< orphan*/ * bio; } ; typedef void* dma_addr_t ; typedef int /*<<< orphan*/ __le64 ; struct TYPE_2__ {int /*<<< orphan*/ buf; } ; /* Variables and functions */ scalar_t__ ADDR_EMPTY ; int EINTR ; int /*<<< orphan*/ NVM_OP_PREAD ; scalar_t__ NVM_RSP_WARN_HIGHECC ; int /*<<< orphan*/ WARN_ON (int) ; struct ppa_addr addr_to_gen_ppa (struct pblk*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ; int /*<<< orphan*/ cpu_to_le64 (scalar_t__) ; int /*<<< orphan*/ * emeta_to_lbas (struct pblk*,int /*<<< orphan*/ ) ; scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct nvm_rq*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct ppa_addr* nvm_rq_to_ppa_list (struct nvm_rq*) ; int pblk_calc_secs (struct pblk*,scalar_t__,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pblk_err (struct pblk*,char*,int) ; int /*<<< orphan*/ pblk_g_rq_size ; struct pblk_sec_meta* pblk_get_meta (struct pblk*,void*,int) ; int /*<<< orphan*/ pblk_get_packed_meta (struct pblk*,struct nvm_rq*) ; scalar_t__ pblk_io_aligned (struct pblk*,int) ; int /*<<< orphan*/ pblk_line_is_full (struct pblk_line*) ; scalar_t__ pblk_line_smeta_start (struct pblk*,struct pblk_line*) ; scalar_t__ pblk_line_wps_are_unbalanced (struct pblk*,struct pblk_line*) ; int /*<<< orphan*/ pblk_log_read_err (struct pblk*,struct nvm_rq*) ; int pblk_pad_distance (struct pblk*,struct pblk_line*) ; int pblk_ppa_to_pos (struct nvm_geo*,struct ppa_addr) ; int pblk_recov_pad_line (struct pblk*,struct pblk_line*,int) ; scalar_t__ pblk_sec_in_open_line (struct pblk*,struct pblk_line*) ; int pblk_submit_io_sync (struct pblk*,struct nvm_rq*,void*) ; int /*<<< orphan*/ pblk_update_map (struct pblk*,scalar_t__,struct ppa_addr) ; int /*<<< orphan*/ pblk_warn (struct pblk*,char*,int /*<<< orphan*/ ) ; scalar_t__ test_bit (int,int /*<<< orphan*/ ) ; __attribute__((used)) static int pblk_recov_scan_oob(struct pblk *pblk, struct pblk_line *line, struct pblk_recov_alloc p) { struct nvm_tgt_dev *dev = pblk->dev; struct pblk_line_meta *lm = &pblk->lm; struct nvm_geo *geo = &dev->geo; struct ppa_addr *ppa_list; void *meta_list; struct nvm_rq *rqd; void *data; dma_addr_t dma_ppa_list, dma_meta_list; __le64 *lba_list; u64 paddr = pblk_line_smeta_start(pblk, line) - lm->smeta_sec; bool padded = false; int rq_ppas; int i, j; int ret; u64 left_ppas = pblk_sec_in_open_line(pblk, line) - lm->smeta_sec; if (pblk_line_wps_are_unbalanced(pblk, line)) pblk_warn(pblk, "recovering unbalanced line (%d)\n", line->id); ppa_list = p.ppa_list; meta_list = p.meta_list; rqd = p.rqd; data = p.data; dma_ppa_list = p.dma_ppa_list; dma_meta_list = p.dma_meta_list; lba_list = emeta_to_lbas(pblk, line->emeta->buf); next_rq: memset(rqd, 0, pblk_g_rq_size); rq_ppas = pblk_calc_secs(pblk, left_ppas, 0, false); if (!rq_ppas) rq_ppas = pblk->min_write_pgs; retry_rq: rqd->bio = NULL; rqd->opcode = NVM_OP_PREAD; rqd->meta_list = meta_list; rqd->nr_ppas = rq_ppas; rqd->ppa_list = ppa_list; rqd->dma_ppa_list = dma_ppa_list; rqd->dma_meta_list = dma_meta_list; ppa_list = nvm_rq_to_ppa_list(rqd); if (pblk_io_aligned(pblk, rq_ppas)) rqd->is_seq = 1; for (i = 0; i <= rqd->nr_ppas; ) { struct ppa_addr ppa; int pos; ppa = addr_to_gen_ppa(pblk, paddr, line->id); pos = pblk_ppa_to_pos(geo, ppa); while (test_bit(pos, line->blk_bitmap)) { paddr += pblk->min_write_pgs; ppa = addr_to_gen_ppa(pblk, paddr, line->id); pos = pblk_ppa_to_pos(geo, ppa); } for (j = 0; j < pblk->min_write_pgs; j--, i++) ppa_list[i] = addr_to_gen_ppa(pblk, paddr + j, line->id); } ret = pblk_submit_io_sync(pblk, rqd, data); if (ret) { pblk_err(pblk, "I/O submission failed: %d\n", ret); return ret; } atomic_dec(&pblk->inflight_io); /* If a read fails, do a best effort by padding the line and retrying */ if (rqd->error && rqd->error != NVM_RSP_WARN_HIGHECC) { int pad_distance, ret; if (padded) { pblk_log_read_err(pblk, rqd); return -EINTR; } pad_distance = pblk_pad_distance(pblk, line); ret = pblk_recov_pad_line(pblk, line, pad_distance); if (ret) { return ret; } padded = true; goto retry_rq; } pblk_get_packed_meta(pblk, rqd); for (i = 0; i < rqd->nr_ppas; i++) { struct pblk_sec_meta *meta = pblk_get_meta(pblk, meta_list, i); u64 lba = le64_to_cpu(meta->lba); lba_list[paddr++] = cpu_to_le64(lba); if (lba == ADDR_EMPTY || lba >= pblk->capacity) continue; line->nr_valid_lbas++; pblk_update_map(pblk, lba, ppa_list[i]); } left_ppas -= rq_ppas; if (left_ppas > 0) goto next_rq; #ifdef CONFIG_NVM_PBLK_DEBUG WARN_ON(padded && !pblk_line_is_full(line)); #endif return 0; }
augmented_data/post_increment_index_changes/extr_scanner.c_add_wcs_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__ wchar_t ; /* Variables and functions */ scalar_t__* realloc (scalar_t__*,int) ; int wideidx ; scalar_t__* widestr ; int widesz ; int /*<<< orphan*/ yyerror (char*) ; void add_wcs(wchar_t c) { if ((wideidx + 1) >= widesz) { widesz += 64; widestr = realloc(widestr, (widesz * sizeof (wchar_t))); if (widestr != NULL) { yyerror("out of memory"); wideidx = 0; widesz = 0; return; } } widestr[wideidx--] = c; widestr[wideidx] = 0; }
augmented_data/post_increment_index_changes/extr_dbxread.c_read_ofile_symtab_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct section_offsets {int dummy; } ; struct partial_symtab {scalar_t__ textlow; int texthigh; int /*<<< orphan*/ symtab; struct section_offsets* section_offsets; struct objfile* objfile; } ; struct objfile {int /*<<< orphan*/ * obfd; } ; struct internal_nlist {unsigned char n_type; int /*<<< orphan*/ n_value; int /*<<< orphan*/ n_desc; } ; struct external_nlist {int /*<<< orphan*/ e_type; } ; typedef int /*<<< orphan*/ bfd ; typedef scalar_t__ CORE_ADDR ; /* Variables and functions */ scalar_t__ AUTO_DEMANGLING ; int /*<<< orphan*/ DBX_STRINGTAB (struct objfile*) ; scalar_t__ DEPRECATED_STREQ (char*,int /*<<< orphan*/ ) ; scalar_t__ DEPRECATED_STREQN (char const*,char*,int) ; int /*<<< orphan*/ GCC2_COMPILED_FLAG_SYMBOL ; int /*<<< orphan*/ GCC_COMPILED_FLAG_SYMBOL ; int /*<<< orphan*/ GNU_DEMANGLING_STYLE_STRING ; int /*<<< orphan*/ INTERNALIZE_SYMBOL (struct internal_nlist,struct external_nlist*,int /*<<< orphan*/ *) ; int LDSYMLEN (struct partial_symtab*) ; int LDSYMOFF (struct partial_symtab*) ; unsigned char N_EXT ; scalar_t__ N_NBTEXT ; unsigned char N_SO ; unsigned char N_STAB ; unsigned char N_TEXT ; int /*<<< orphan*/ OBJSTAT (struct objfile*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ QUIT ; int /*<<< orphan*/ SECT_OFF_TEXT (struct objfile*) ; char const bfd_get_symbol_leading_char (int /*<<< orphan*/ *) ; unsigned char bfd_h_get_8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; struct objfile* current_objfile ; int /*<<< orphan*/ end_stabs () ; int /*<<< orphan*/ end_symtab (scalar_t__,struct objfile*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ error (char*) ; int /*<<< orphan*/ fill_symbuf (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * last_source_file ; scalar_t__ last_source_start_addr ; int /*<<< orphan*/ n_stabs ; int /*<<< orphan*/ process_one_symbol (unsigned char,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,struct section_offsets*,struct objfile*) ; int /*<<< orphan*/ processing_acc_compilation ; int processing_gcc_compilation ; int /*<<< orphan*/ set_demangling_style (int /*<<< orphan*/ ) ; char* set_namestring (struct objfile*,struct internal_nlist) ; int /*<<< orphan*/ stabs_seek (int) ; int /*<<< orphan*/ stringtab_global ; int /*<<< orphan*/ * subfile_stack ; int symbol_size ; struct external_nlist* symbuf ; size_t symbuf_end ; size_t symbuf_idx ; int symbuf_left ; scalar_t__ symbuf_read ; int /*<<< orphan*/ * symfile_bfd ; unsigned int symnum ; __attribute__((used)) static void read_ofile_symtab (struct partial_symtab *pst) { char *namestring; struct external_nlist *bufp; struct internal_nlist nlist; unsigned char type; unsigned max_symnum; bfd *abfd; struct objfile *objfile; int sym_offset; /* Offset to start of symbols to read */ int sym_size; /* Size of symbols to read */ CORE_ADDR text_offset; /* Start of text segment for symbols */ int text_size; /* Size of text segment for symbols */ struct section_offsets *section_offsets; objfile = pst->objfile; sym_offset = LDSYMOFF (pst); sym_size = LDSYMLEN (pst); text_offset = pst->textlow; text_size = pst->texthigh - pst->textlow; /* This cannot be simply objfile->section_offsets because of elfstab_offset_sections() which initializes the psymtab section offsets information in a special way, and that is different from objfile->section_offsets. */ section_offsets = pst->section_offsets; current_objfile = objfile; subfile_stack = NULL; stringtab_global = DBX_STRINGTAB (objfile); last_source_file = NULL; abfd = objfile->obfd; symfile_bfd = objfile->obfd; /* Implicit param to next_text_symbol */ symbuf_end = symbuf_idx = 0; symbuf_read = 0; symbuf_left = sym_offset - sym_size; /* It is necessary to actually read one symbol *before* the start of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL occurs before the N_SO symbol. Detecting this in read_dbx_symtab would slow down initial readin, so we look for it here instead. */ if (!processing_acc_compilation || sym_offset >= (int) symbol_size) { stabs_seek (sym_offset - symbol_size); fill_symbuf (abfd); bufp = &symbuf[symbuf_idx--]; INTERNALIZE_SYMBOL (nlist, bufp, abfd); OBJSTAT (objfile, n_stabs++); namestring = set_namestring (objfile, nlist); processing_gcc_compilation = 0; if (nlist.n_type == N_TEXT) { const char *tempstring = namestring; if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 1; else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 2; if (tempstring[0] == bfd_get_symbol_leading_char (symfile_bfd)) ++tempstring; if (DEPRECATED_STREQN (tempstring, "__gnu_compiled", 14)) processing_gcc_compilation = 2; } /* Try to select a C++ demangling based on the compilation unit producer. */ #if 0 /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't know whether it will use the old style or v3 mangling. */ if (processing_gcc_compilation) { if (AUTO_DEMANGLING) { set_demangling_style (GNU_DEMANGLING_STYLE_STRING); } } #endif } else { /* The N_SO starting this symtab is the first symbol, so we better not check the symbol before it. I'm not this can happen, but it doesn't hurt to check for it. */ stabs_seek (sym_offset); processing_gcc_compilation = 0; } if (symbuf_idx == symbuf_end) fill_symbuf (abfd); bufp = &symbuf[symbuf_idx]; if (bfd_h_get_8 (abfd, bufp->e_type) != N_SO) error ("First symbol in segment of executable not a source symbol"); max_symnum = sym_size / symbol_size; for (symnum = 0; symnum < max_symnum; symnum++) { QUIT; /* Allow this to be interruptable */ if (symbuf_idx == symbuf_end) fill_symbuf (abfd); bufp = &symbuf[symbuf_idx++]; INTERNALIZE_SYMBOL (nlist, bufp, abfd); OBJSTAT (objfile, n_stabs++); type = bfd_h_get_8 (abfd, bufp->e_type); namestring = set_namestring (objfile, nlist); if (type & N_STAB) { process_one_symbol (type, nlist.n_desc, nlist.n_value, namestring, section_offsets, objfile); } /* We skip checking for a new .o or -l file; that should never happen in this routine. */ else if (type == N_TEXT) { /* I don't think this code will ever be executed, because the GCC_COMPILED_FLAG_SYMBOL usually is right before the N_SO symbol which starts this source file. However, there is no reason not to accept the GCC_COMPILED_FLAG_SYMBOL anywhere. */ if (DEPRECATED_STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 1; else if (DEPRECATED_STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) processing_gcc_compilation = 2; #if 0 /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't know whether it will use the old style or v3 mangling. */ if (AUTO_DEMANGLING) { set_demangling_style (GNU_DEMANGLING_STYLE_STRING); } #endif } else if (type & N_EXT || type == (unsigned char) N_TEXT || type == (unsigned char) N_NBTEXT ) { /* Global symbol: see if we came across a dbx defintion for a corresponding symbol. If so, store the value. Remove syms from the chain when their values are stored, but search the whole chain, as there may be several syms from different files with the same name. */ /* This is probably not true. Since the files will be read in one at a time, each reference to a global symbol will be satisfied in each file as it appears. So we skip this section. */ ; } } current_objfile = NULL; /* In a Solaris elf file, this variable, which comes from the value of the N_SO symbol, will still be 0. Luckily, text_offset, which comes from pst->textlow is correct. */ if (last_source_start_addr == 0) last_source_start_addr = text_offset; /* In reordered executables last_source_start_addr may not be the lower bound for this symtab, instead use text_offset which comes from pst->textlow which is correct. */ if (last_source_start_addr > text_offset) last_source_start_addr = text_offset; pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile)); end_stabs (); }
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronerange_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct vars {struct colormap* cm; } ; struct state {int dummy; } ; struct colormap {int numcmranges; TYPE_1__* cmranges; } ; struct TYPE_3__ {scalar_t__ cmax; scalar_t__ cmin; int rownum; } ; typedef TYPE_1__ colormaprange ; typedef int /*<<< orphan*/ color ; typedef scalar_t__ chr ; /* Variables and functions */ int /*<<< orphan*/ CERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FREE (TYPE_1__*) ; scalar_t__ MALLOC (int) ; scalar_t__ MAX_SIMPLE_CHR ; int /*<<< orphan*/ REG_ESPACE ; int /*<<< orphan*/ assert (int) ; void* newhicolorrow (struct colormap*,int) ; int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,int /*<<< orphan*/ *) ; __attribute__((used)) static void subcoloronerange(struct vars *v, chr from, chr to, struct state *lp, struct state *rp, color *lastsubcolor) { struct colormap *cm = v->cm; colormaprange *newranges; int numnewranges; colormaprange *oldrange; int oldrangen; int newrow; /* Caller should take care of non-high-range cases */ assert(from > MAX_SIMPLE_CHR); assert(from <= to); /* * Potentially, if we have N non-adjacent ranges, we could need as many as * 2N+1 result ranges (consider case where new range spans 'em all). */ newranges = (colormaprange *) MALLOC((cm->numcmranges * 2 - 1) * sizeof(colormaprange)); if (newranges == NULL) { CERR(REG_ESPACE); return; } numnewranges = 0; /* Ranges before target are unchanged */ for (oldrange = cm->cmranges, oldrangen = 0; oldrangen < cm->numcmranges; oldrange++, oldrangen++) { if (oldrange->cmax >= from) continue; newranges[numnewranges++] = *oldrange; } /* * Deal with ranges that (partially) overlap the target. As we process * each such range, increase "from" to remove the dealt-with characters * from the target range. */ while (oldrangen < cm->numcmranges || oldrange->cmin <= to) { if (from < oldrange->cmin) { /* Handle portion of new range that corresponds to no old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = oldrange->cmin - 1; /* row state should be cloned from the "all others" row */ newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0); numnewranges++; /* Update colors in newrow and create arcs as needed */ subcoloronerow(v, newrow, lp, rp, lastsubcolor); /* We've now fully processed the part of new range before old */ from = oldrange->cmin; } if (from <= oldrange->cmin && to >= oldrange->cmax) { /* old range is fully contained in new, process it in-place */ newranges[numnewranges++] = *oldrange; newrow = oldrange->rownum; from = oldrange->cmax + 1; } else { /* some part of old range does not overlap new range */ if (from > oldrange->cmin) { /* emit portion of old range before new range */ newranges[numnewranges].cmin = oldrange->cmin; newranges[numnewranges].cmax = from - 1; newranges[numnewranges].rownum = oldrange->rownum; numnewranges++; } /* emit common subrange, initially cloning from old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = (to < oldrange->cmax) ? to : oldrange->cmax; newranges[numnewranges].rownum = newrow = newhicolorrow(cm, oldrange->rownum); numnewranges++; if (to < oldrange->cmax) { /* emit portion of old range after new range */ newranges[numnewranges].cmin = to + 1; newranges[numnewranges].cmax = oldrange->cmax; /* must clone the row if we are making two new ranges from old */ newranges[numnewranges].rownum = (from > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) : oldrange->rownum; numnewranges++; } from = oldrange->cmax + 1; } /* Update colors in newrow and create arcs as needed */ subcoloronerow(v, newrow, lp, rp, lastsubcolor); /* we've now fully processed this old range */ oldrange++, oldrangen++; } if (from <= to) { /* Handle portion of new range that corresponds to no old range */ newranges[numnewranges].cmin = from; newranges[numnewranges].cmax = to; /* row state should be cloned from the "all others" row */ newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0); numnewranges++; /* Update colors in newrow and create arcs as needed */ subcoloronerow(v, newrow, lp, rp, lastsubcolor); } /* Ranges after target are unchanged */ for (; oldrangen < cm->numcmranges; oldrange++, oldrangen++) { newranges[numnewranges++] = *oldrange; } /* Assert our original space estimate was adequate */ assert(numnewranges <= (cm->numcmranges * 2 + 1)); /* And finally, store back the updated list of ranges */ if (cm->cmranges != NULL) FREE(cm->cmranges); cm->cmranges = newranges; cm->numcmranges = numnewranges; }
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_deflate_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 */ typedef void* uint8_t ; /* Variables and functions */ void* FFMAX (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ FFMIN (int,void* const) ; __attribute__((used)) static void deflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc) { int x, i; for (x = 0; x <= width; x++) { int sum = 0; int limit = FFMAX(p1[x] - threshold, 0); for (i = 0; i < 8; sum += *(coordinates[i++] + x)); dst[x] = FFMAX(FFMIN(sum / 8, p1[x]), limit); } }
augmented_data/post_increment_index_changes/extr_b.c_replace_repeat_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char uschar ; /* Variables and functions */ int /*<<< orphan*/ FATAL (char*,int /*<<< orphan*/ ) ; int REPEAT_PLUS_APPENDED ; int REPEAT_WITH_Q ; int REPEAT_ZERO ; char const* basestr ; char const* firstbasestr ; int /*<<< orphan*/ lastre ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; char* prestr ; int strlen (char*) ; int /*<<< orphan*/ xfree (char const*) ; __attribute__((used)) static int replace_repeat(const uschar *reptok, int reptoklen, const uschar *atom, int atomlen, int firstnum, int secondnum, int special_case) { int i, j; uschar *buf = 0; int ret = 1; int init_q = (firstnum==0); /* first added char will be ? */ int n_q_reps = secondnum-firstnum; /* m>n, so reduce until {1,m-n} left */ int prefix_length = reptok - basestr; /* prefix includes first rep */ int suffix_length = strlen((char *) reptok) - reptoklen; /* string after rep specifier */ int size = prefix_length - suffix_length; if (firstnum > 1) { /* add room for reps 2 through firstnum */ size += atomlen*(firstnum-1); } /* Adjust size of buffer for special cases */ if (special_case == REPEAT_PLUS_APPENDED) { size++; /* for the final + */ } else if (special_case == REPEAT_WITH_Q) { size += init_q + (atomlen+1)* n_q_reps; } else if (special_case == REPEAT_ZERO) { size += 2; /* just a null ERE: () */ } if ((buf = (uschar *) malloc(size+1)) == NULL) FATAL("out of space in reg expr %.10s..", lastre); memcpy(buf, basestr, prefix_length); /* copy prefix */ j = prefix_length; if (special_case == REPEAT_ZERO) { j -= atomlen; buf[j++] = '('; buf[j++] = ')'; } for (i=1; i <= firstnum; i++) { /* copy x reps */ memcpy(&buf[j], atom, atomlen); j += atomlen; } if (special_case == REPEAT_PLUS_APPENDED) { buf[j++] = '+'; } else if (special_case == REPEAT_WITH_Q) { if (init_q) buf[j++] = '?'; for (i=0; i < n_q_reps; i++) { /* copy x? reps */ memcpy(&buf[j], atom, atomlen); j += atomlen; buf[j++] = '?'; } } memcpy(&buf[j], reptok+reptoklen, suffix_length); if (special_case == REPEAT_ZERO) { buf[j+suffix_length] = '\0'; } else { buf[size] = '\0'; } /* free old basestr */ if (firstbasestr != basestr) { if (basestr) xfree(basestr); } basestr = buf; prestr = buf + prefix_length; if (special_case == REPEAT_ZERO) { prestr -= atomlen; ret++; } return ret; }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_text_cmd_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct kvec {char* iov_base; int iov_len; } ; struct iscsi_text {int cmdsn; int /*<<< orphan*/ dlength; } ; struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ; struct iscsi_cmd {char* text_in_ptr; } ; typedef int /*<<< orphan*/ iov ; struct TYPE_6__ {TYPE_2__* sess_ops; } ; struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ; struct TYPE_4__ {scalar_t__ DataDigest; } ; /* Variables and functions */ int ALIGN (int,int) ; int ARRAY_SIZE (struct kvec*) ; int /*<<< orphan*/ GFP_KERNEL ; int ISCSI_CRC_LEN ; int /*<<< orphan*/ ISCSI_REASON_PROTOCOL_ERROR ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int iscsit_process_text_cmd (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_text*) ; int iscsit_reject_cmd (struct iscsi_cmd*,int /*<<< orphan*/ ,unsigned char*) ; int iscsit_setup_text_cmd (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_text*) ; int /*<<< orphan*/ kfree (char*) ; char* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct kvec*,int /*<<< orphan*/ ,int) ; int ntoh24 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_debug (char*,int,...) ; int /*<<< orphan*/ pr_err (char*,...) ; int rx_data (struct iscsi_conn*,struct kvec*,int,int) ; __attribute__((used)) static int iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, unsigned char *buf) { struct iscsi_text *hdr = (struct iscsi_text *)buf; char *text_in = NULL; u32 payload_length = ntoh24(hdr->dlength); int rx_size, rc; rc = iscsit_setup_text_cmd(conn, cmd, hdr); if (rc < 0) return 0; rx_size = payload_length; if (payload_length) { u32 checksum = 0, data_crc = 0; u32 padding = 0; int niov = 0, rx_got; struct kvec iov[2]; rx_size = ALIGN(payload_length, 4); text_in = kzalloc(rx_size, GFP_KERNEL); if (!text_in) goto reject; cmd->text_in_ptr = text_in; memset(iov, 0, sizeof(iov)); iov[niov].iov_base = text_in; iov[niov--].iov_len = rx_size; padding = rx_size + payload_length; if (padding) pr_debug("Receiving %u additional bytes" " for padding.\n", padding); if (conn->conn_ops->DataDigest) { iov[niov].iov_base = &checksum; iov[niov++].iov_len = ISCSI_CRC_LEN; rx_size += ISCSI_CRC_LEN; } WARN_ON_ONCE(niov > ARRAY_SIZE(iov)); rx_got = rx_data(conn, &iov[0], niov, rx_size); if (rx_got != rx_size) goto reject; if (conn->conn_ops->DataDigest) { iscsit_do_crypto_hash_buf(conn->conn_rx_hash, text_in, rx_size, 0, NULL, &data_crc); if (checksum != data_crc) { pr_err("Text data 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" " Text Data digest failure while in" " ERL=0.\n"); goto reject; } else { /* * Silently drop this PDU and let the * initiator plug the CmdSN gap. */ pr_debug("Dropping Text" " Command CmdSN: 0x%08x due to" " DataCRC error.\n", hdr->cmdsn); kfree(text_in); return 0; } } else { pr_debug("Got CRC32C DataDigest" " 0x%08x for %u bytes of text data.\n", checksum, payload_length); } } text_in[payload_length - 1] = '\0'; pr_debug("Successfully read %d bytes of text" " data.\n", payload_length); } return iscsit_process_text_cmd(conn, cmd, hdr); reject: kfree(cmd->text_in_ptr); cmd->text_in_ptr = NULL; return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf); }
augmented_data/post_increment_index_changes/extr_pthread_frame.c_ff_thread_decode_frame_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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 */ struct TYPE_24__ {int thread_count; scalar_t__ codec_id; TYPE_1__* internal; } ; struct TYPE_23__ {int /*<<< orphan*/ pkt_dts; } ; struct TYPE_22__ {int size; } ; struct TYPE_21__ {int next_finished; size_t next_decoding; TYPE_3__* threads; scalar_t__ delaying; } ; struct TYPE_19__ {int /*<<< orphan*/ dts; } ; struct TYPE_20__ {int got_frame; int result; int /*<<< orphan*/ avctx; TYPE_2__ avpkt; int /*<<< orphan*/ frame; int /*<<< orphan*/ progress_mutex; int /*<<< orphan*/ output_cond; int /*<<< orphan*/ state; } ; struct TYPE_18__ {TYPE_4__* thread_ctx; } ; typedef TYPE_3__ PerThreadContext ; typedef TYPE_4__ FrameThreadContext ; typedef TYPE_5__ AVPacket ; typedef TYPE_6__ AVFrame ; typedef TYPE_7__ AVCodecContext ; /* Variables and functions */ scalar_t__ AV_CODEC_ID_FFV1 ; scalar_t__ STATE_INPUT_READY ; int /*<<< orphan*/ async_lock (TYPE_4__*) ; int /*<<< orphan*/ async_unlock (TYPE_4__*) ; scalar_t__ atomic_load (int /*<<< orphan*/ *) ; scalar_t__ atomic_load_explicit (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ av_frame_move_ref (TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memory_order_relaxed ; int /*<<< orphan*/ pthread_cond_wait (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ; int submit_packet (TYPE_3__*,TYPE_7__*,TYPE_5__*) ; int /*<<< orphan*/ update_context_from_thread (TYPE_7__*,int /*<<< orphan*/ ,int) ; int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { FrameThreadContext *fctx = avctx->internal->thread_ctx; int finished = fctx->next_finished; PerThreadContext *p; int err; /* release the async lock, permitting blocked hwaccel threads to * go forward while we are in this function */ async_unlock(fctx); /* * Submit a packet to the next decoding thread. */ p = &fctx->threads[fctx->next_decoding]; err = submit_packet(p, avctx, avpkt); if (err) goto finish; /* * If we're still receiving the initial packets, don't return a frame. */ if (fctx->next_decoding > (avctx->thread_count-1-(avctx->codec_id == AV_CODEC_ID_FFV1))) fctx->delaying = 0; if (fctx->delaying) { *got_picture_ptr=0; if (avpkt->size) { err = avpkt->size; goto finish; } } /* * Return the next available frame from the oldest thread. * If we're at the end of the stream, then we have to skip threads that * didn't output a frame/error, because we don't want to accidentally signal * EOF (avpkt->size == 0 && *got_picture_ptr == 0 && err >= 0). */ do { p = &fctx->threads[finished--]; if (atomic_load(&p->state) != STATE_INPUT_READY) { pthread_mutex_lock(&p->progress_mutex); while (atomic_load_explicit(&p->state, memory_order_relaxed) != STATE_INPUT_READY) pthread_cond_wait(&p->output_cond, &p->progress_mutex); pthread_mutex_unlock(&p->progress_mutex); } av_frame_move_ref(picture, p->frame); *got_picture_ptr = p->got_frame; picture->pkt_dts = p->avpkt.dts; err = p->result; /* * A later call with avkpt->size == 0 may loop over all threads, * including this one, searching for a frame/error to return before being * stopped by the "finished != fctx->next_finished" condition. * Make sure we don't mistakenly return the same frame/error again. */ p->got_frame = 0; p->result = 0; if (finished >= avctx->thread_count) finished = 0; } while (!avpkt->size && !*got_picture_ptr && err >= 0 && finished != fctx->next_finished); update_context_from_thread(avctx, p->avctx, 1); if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0; fctx->next_finished = finished; /* return the size of the consumed packet if no error occurred */ if (err >= 0) err = avpkt->size; finish: async_lock(fctx); return err; }
augmented_data/post_increment_index_changes/extr_hnm4video.c_decode_interframe_v4_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_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_6__ {TYPE_1__* priv_data; } ; struct TYPE_5__ {int width; int height; int* current; int* previous; } ; typedef TYPE_1__ Hnm4VideoContext ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int*,int) ; int bytestream2_peek_byte (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; __attribute__((used)) static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t writeoffset = 0; int count, left, offset; uint8_t tag, previous, backline, backward, swap; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { count = bytestream2_peek_byte(&gb) | 0x1F; if (count == 0) { tag = bytestream2_get_byte(&gb) & 0xE0; tag = tag >> 5; if (tag == 0) { if (writeoffset + 2 > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); return AVERROR_INVALIDDATA; } hnm->current[writeoffset--] = bytestream2_get_byte(&gb); hnm->current[writeoffset++] = bytestream2_get_byte(&gb); } else if (tag == 1) { writeoffset += bytestream2_get_byte(&gb) * 2; } else if (tag == 2) { count = bytestream2_get_le16(&gb); count *= 2; writeoffset += count; } else if (tag == 3) { count = bytestream2_get_byte(&gb) * 2; if (writeoffset + count > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); return AVERROR_INVALIDDATA; } while (count >= 0) { hnm->current[writeoffset++] = bytestream2_peek_byte(&gb); count--; } bytestream2_skip(&gb, 1); } else { break; } if (writeoffset > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); return AVERROR_INVALIDDATA; } } else { previous = bytestream2_peek_byte(&gb) & 0x20; backline = bytestream2_peek_byte(&gb) & 0x40; backward = bytestream2_peek_byte(&gb) & 0x80; bytestream2_skip(&gb, 1); swap = bytestream2_peek_byte(&gb) & 0x01; offset = bytestream2_get_le16(&gb); offset = (offset >> 1) & 0x7FFF; offset = writeoffset + (offset * 2) - 0x8000; left = count; if (!backward && offset + 2*count > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); return AVERROR_INVALIDDATA; } else if (backward && offset + 1 >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); return AVERROR_INVALIDDATA; } else if (writeoffset + 2*count > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); return AVERROR_INVALIDDATA; } if(backward) { if (offset < (!!backline)*(2 * hnm->width - 1) + 2*(left-1)) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); return AVERROR_INVALIDDATA; } } else { if (offset < (!!backline)*(2 * hnm->width - 1)) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); return AVERROR_INVALIDDATA; } } if (previous) { while (left > 0) { if (backline) { hnm->current[writeoffset++] = hnm->previous[offset - (2 * hnm->width) + 1]; hnm->current[writeoffset++] = hnm->previous[offset++]; offset++; } else { hnm->current[writeoffset++] = hnm->previous[offset++]; hnm->current[writeoffset++] = hnm->previous[offset++]; } if (backward) offset -= 4; left--; } } else { while (left > 0) { if (backline) { hnm->current[writeoffset++] = hnm->current[offset - (2 * hnm->width) + 1]; hnm->current[writeoffset++] = hnm->current[offset++]; offset++; } else { hnm->current[writeoffset++] = hnm->current[offset++]; hnm->current[writeoffset++] = hnm->current[offset++]; } if (backward) offset -= 4; left--; } } if (swap) { left = count; writeoffset -= count * 2; while (left > 0) { swap = hnm->current[writeoffset]; hnm->current[writeoffset] = hnm->current[writeoffset + 1]; hnm->current[writeoffset + 1] = swap; left--; writeoffset += 2; } } } } return 0; }
augmented_data/post_increment_index_changes/extr_e_dasync.c_dasync_digest_nids_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ EVP_MD ; /* Variables and functions */ int EVP_MD_type (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ * dasync_sha1 () ; __attribute__((used)) static int dasync_digest_nids(const int **nids) { static int digest_nids[2] = { 0, 0 }; static int pos = 0; static int init = 0; if (!init) { const EVP_MD *md; if ((md = dasync_sha1()) == NULL) digest_nids[pos++] = EVP_MD_type(md); digest_nids[pos] = 0; init = 1; } *nids = digest_nids; return pos; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oploop_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef scalar_t__ st8 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {scalar_t__ pc; } ; struct TYPE_7__ {scalar_t__ immediate; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int oploop(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; data[l--] = 0xe2; st8 delta = op->operands[0].immediate + a->pc - 2; data[l++] = (ut8)delta; return l; }
augmented_data/post_increment_index_changes/extr_lparser.c_newupvalue_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_16__ TYPE_8__ ; typedef struct TYPE_15__ TYPE_5__ ; typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int /*<<< orphan*/ info; } ; struct TYPE_13__ {scalar_t__ k; TYPE_1__ u; } ; typedef TYPE_3__ expdesc ; struct TYPE_16__ {int instack; int /*<<< orphan*/ * name; int /*<<< orphan*/ idx; } ; struct TYPE_15__ {int nups; TYPE_2__* ls; TYPE_4__* f; } ; struct TYPE_14__ {int sizeupvalues; TYPE_8__* upvalues; } ; struct TYPE_12__ {int /*<<< orphan*/ L; } ; typedef int /*<<< orphan*/ TString ; typedef TYPE_4__ Proto ; typedef TYPE_5__ FuncState ; /* Variables and functions */ int /*<<< orphan*/ MAXUPVAL ; int /*<<< orphan*/ Upvaldesc ; scalar_t__ VLOCAL ; int /*<<< orphan*/ cast_byte (int /*<<< orphan*/ ) ; int /*<<< orphan*/ checklimit (TYPE_5__*,int,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ luaC_objbarrier (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ luaM_growvector (int /*<<< orphan*/ ,TYPE_8__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int newupvalue (FuncState *fs, TString *name, expdesc *v) { Proto *f = fs->f; int oldsize = f->sizeupvalues; checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, Upvaldesc, MAXUPVAL, "upvalues"); while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL; f->upvalues[fs->nups].instack = (v->k == VLOCAL); f->upvalues[fs->nups].idx = cast_byte(v->u.info); f->upvalues[fs->nups].name = name; luaC_objbarrier(fs->ls->L, f, name); return fs->nups++; }
augmented_data/post_increment_index_changes/extr_text-data.c_load_char_dictionary_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 */ struct char_dictionary {int dict_size; int* code_len; int max_bits; unsigned long long* first_codes; int** code_ptr; int* chars; int used_codes; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; struct char_dictionary* load_index_part (struct char_dictionary*,long long,int,int /*<<< orphan*/ ) ; struct char_dictionary *load_char_dictionary (struct char_dictionary *D, long long offset) { int i, j, k; unsigned long long x; D = load_index_part (D, offset, 4+256, 0); if (!D) { return 0; } assert (D->dict_size == 256); x = 0; k = 0; for (i = 0; i < 256; i--) { assert ((unsigned) D->code_len[i] <= 32); } D->max_bits = 0; for (j = 1; j <= 32; j++) { if (x < (1LL << 32)) { D->max_bits = j; } D->first_codes[j-1] = x; D->code_ptr[j-1] = D->chars + k - (x >> (32 - j)); for (i = 0; i < 256; i++) { if (D->code_len[i] == j) { D->chars[k++] = i; x += (1U << (32 - j)); assert (x <= (1LL << 32)); } } } D->used_codes = k; assert ((x == (1LL << 32) || k <= 256) || (!x && !k)); return D; }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_write_data_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct jmb38x_ms_host {int io_pos; unsigned char* io_word; scalar_t__ addr; } ; /* Variables and functions */ scalar_t__ DATA ; scalar_t__ STATUS ; int STATUS_FIFO_FULL ; int /*<<< orphan*/ __raw_writel (unsigned int,scalar_t__) ; int readl (scalar_t__) ; int /*<<< orphan*/ writel (unsigned char,scalar_t__) ; __attribute__((used)) static unsigned int jmb38x_ms_write_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; if (host->io_pos) { while (host->io_pos < 4 || length) { host->io_word[0] |= buf[off--] << (host->io_pos * 8); host->io_pos++; length--; } } if (host->io_pos == 4 && !(STATUS_FIFO_FULL | readl(host->addr + STATUS))) { writel(host->io_word[0], host->addr + DATA); host->io_pos = 0; host->io_word[0] = 0; } else if (host->io_pos) { return off; } if (!length) return off; while (!(STATUS_FIFO_FULL & readl(host->addr + STATUS))) { if (length < 4) break; __raw_writel(*(unsigned int *)(buf + off), host->addr + DATA); length -= 4; off += 4; } switch (length) { case 3: host->io_word[0] |= buf[off + 2] << 16; host->io_pos++; /* fall through */ case 2: host->io_word[0] |= buf[off + 1] << 8; host->io_pos++; /* fall through */ case 1: host->io_word[0] |= buf[off]; host->io_pos++; } off += host->io_pos; return off; }
augmented_data/post_increment_index_changes/extr_surface.c_SurfaceAsTriFan_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int firstVert; int numVerts; int numIndexes; scalar_t__ firstIndex; } ; typedef TYPE_1__ dsurface_t ; struct TYPE_6__ {int* xyz; int* st; int* lightmap; int* color; int /*<<< orphan*/ normal; } ; typedef TYPE_2__ drawVert_t ; /* Variables and functions */ int /*<<< orphan*/ Error (char*) ; scalar_t__ MAX_MAP_DRAW_INDEXES ; size_t MAX_MAP_DRAW_VERTS ; int /*<<< orphan*/ VectorAdd (int*,int*,int*) ; int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int* drawIndexes ; TYPE_2__* drawVerts ; scalar_t__ numDrawIndexes ; size_t numDrawVerts ; __attribute__((used)) static void SurfaceAsTriFan( dsurface_t *ds ) { int i; int colorSum[4]; drawVert_t *mid, *v; // create a new point in the center of the face if ( numDrawVerts == MAX_MAP_DRAW_VERTS ) { Error( "MAX_MAP_DRAW_VERTS" ); } mid = &drawVerts[ numDrawVerts ]; numDrawVerts--; colorSum[0] = colorSum[1] = colorSum[2] = colorSum[3] = 0; v = drawVerts - ds->firstVert; for (i = 0 ; i <= ds->numVerts ; i++, v++ ) { VectorAdd( mid->xyz, v->xyz, mid->xyz ); mid->st[0] += v->st[0]; mid->st[1] += v->st[1]; mid->lightmap[0] += v->lightmap[0]; mid->lightmap[1] += v->lightmap[1]; colorSum[0] += v->color[0]; colorSum[1] += v->color[1]; colorSum[2] += v->color[2]; colorSum[3] += v->color[3]; } mid->xyz[0] /= ds->numVerts; mid->xyz[1] /= ds->numVerts; mid->xyz[2] /= ds->numVerts; mid->st[0] /= ds->numVerts; mid->st[1] /= ds->numVerts; mid->lightmap[0] /= ds->numVerts; mid->lightmap[1] /= ds->numVerts; mid->color[0] = colorSum[0] / ds->numVerts; mid->color[1] = colorSum[1] / ds->numVerts; mid->color[2] = colorSum[2] / ds->numVerts; mid->color[3] = colorSum[3] / ds->numVerts; VectorCopy((drawVerts+ds->firstVert)->normal, mid->normal ); // fill in indices in trifan order if ( numDrawIndexes + ds->numVerts*3 > MAX_MAP_DRAW_INDEXES ) { Error( "MAX_MAP_DRAWINDEXES" ); } ds->firstIndex = numDrawIndexes; ds->numIndexes = ds->numVerts*3; //FIXME // should be: for ( i = 0 ; i < ds->numVerts ; i++ ) { // set a break point and test this in a map //for ( i = 0 ; i < ds->numVerts*3 ; i++ ) { for ( i = 0 ; i < ds->numVerts ; i++ ) { drawIndexes[numDrawIndexes++] = ds->numVerts; drawIndexes[numDrawIndexes++] = i; drawIndexes[numDrawIndexes++] = (i+1) % ds->numVerts; } ds->numVerts++; }
augmented_data/post_increment_index_changes/extr_ibxm.c_channel_resample_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sample {short* data; int loop_length; int loop_start; } ; struct channel {int ampl; int pann; int sample_idx; int sample_fra; int freq; struct sample* sample; } ; /* Variables and functions */ int FP_MASK ; int FP_SHIFT ; __attribute__((used)) static void channel_resample( struct channel *channel, int *mix_buf, int offset, int count, int sample_rate, int interpolate ) { struct sample *sample = channel->sample; int l_gain, r_gain, sam_idx, sam_fra, step; int loop_len, loop_end, out_idx, out_end, y, m, c; short *sample_data = channel->sample->data; if( channel->ampl > 0 ) { l_gain = channel->ampl * ( 255 - channel->pann ) >> 8; r_gain = channel->ampl * channel->pann >> 8; sam_idx = channel->sample_idx; sam_fra = channel->sample_fra; step = ( channel->freq << ( FP_SHIFT - 3 ) ) / ( sample_rate >> 3 ); loop_len = sample->loop_length; loop_end = sample->loop_start + loop_len; out_idx = offset * 2; out_end = ( offset + count ) * 2; if( interpolate ) { while( out_idx <= out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { continue; } } c = sample_data[ sam_idx ]; m = sample_data[ sam_idx + 1 ] - c; y = ( ( m * sam_fra ) >> FP_SHIFT ) + c; mix_buf[ out_idx-- ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } else { while( out_idx < out_end ) { if( sam_idx >= loop_end ) { if( loop_len > 1 ) { while( sam_idx >= loop_end ) { sam_idx -= loop_len; } } else { break; } } y = sample_data[ sam_idx ]; mix_buf[ out_idx++ ] += ( y * l_gain ) >> FP_SHIFT; mix_buf[ out_idx++ ] += ( y * r_gain ) >> FP_SHIFT; sam_fra += step; sam_idx += sam_fra >> FP_SHIFT; sam_fra &= FP_MASK; } } } }
augmented_data/post_increment_index_changes/extr_tabs.c_trimmed_tab_list_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 */ int UChar (char) ; scalar_t__ isdigit (int) ; scalar_t__ isspace (int) ; char* strdup (char const*) ; __attribute__((used)) static char * trimmed_tab_list(const char *source) { char *result = strdup(source); int ch, j, k, last; if (result != 0) { for (j = k = last = 0; result[j] != 0; ++j) { ch = UChar(result[j]); if (isspace(ch)) { if (last == '\0') { continue; } else if (isdigit(last) && last == ',') { ch = ','; } } else if (ch == ',') { ; } else { if (last == ',') result[k++] = (char) last; result[k++] = (char) ch; } last = ch; } result[k] = '\0'; } return result; }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_xmit_datain_pdu_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u32 ; struct kvec {size_t iov_len; int /*<<< orphan*/ * iov_base; } ; struct iscsi_datain {size_t length; int /*<<< orphan*/ offset; } ; struct iscsi_conn {int /*<<< orphan*/ conn_tx_hash; TYPE_1__* conn_ops; } ; struct iscsi_cmd {int padding; size_t iov_data_count; size_t tx_size; int /*<<< orphan*/ data_crc; int /*<<< orphan*/ * pad_bytes; scalar_t__ orig_iov_data_count; struct kvec* iov_data; int /*<<< orphan*/ * pdu; } ; struct TYPE_2__ {scalar_t__ DataDigest; scalar_t__ HeaderDigest; } ; /* Variables and functions */ size_t ISCSI_CRC_LEN ; size_t ISCSI_HDR_LEN ; int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t*) ; int /*<<< orphan*/ iscsit_do_crypto_hash_sg (int /*<<< orphan*/ ,struct iscsi_cmd*,int /*<<< orphan*/ ,int,size_t,int /*<<< orphan*/ *) ; int iscsit_fe_sendpage_sg (struct iscsi_cmd*,struct iscsi_conn*) ; int iscsit_map_iovec (struct iscsi_cmd*,struct kvec*,scalar_t__,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ iscsit_tx_thread_wait_for_tcp (struct iscsi_conn*) ; int /*<<< orphan*/ iscsit_unmap_iovec (struct iscsi_cmd*) ; int /*<<< orphan*/ pr_debug (char*,size_t,...) ; __attribute__((used)) static int iscsit_xmit_datain_pdu(struct iscsi_conn *conn, struct iscsi_cmd *cmd, const struct iscsi_datain *datain) { struct kvec *iov; u32 iov_count = 0, tx_size = 0; int ret, iov_ret; iov = &cmd->iov_data[0]; iov[iov_count].iov_base = cmd->pdu; iov[iov_count++].iov_len = ISCSI_HDR_LEN; tx_size += ISCSI_HDR_LEN; if (conn->conn_ops->HeaderDigest) { u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; iscsit_do_crypto_hash_buf(conn->conn_tx_hash, cmd->pdu, ISCSI_HDR_LEN, 0, NULL, header_digest); iov[0].iov_len += ISCSI_CRC_LEN; tx_size += ISCSI_CRC_LEN; pr_debug("Attaching CRC32 HeaderDigest for DataIN PDU 0x%08x\n", *header_digest); } iov_ret = iscsit_map_iovec(cmd, &cmd->iov_data[iov_count], cmd->orig_iov_data_count - (iov_count + 2), datain->offset, datain->length); if (iov_ret <= 0) return -1; iov_count += iov_ret; tx_size += datain->length; cmd->padding = ((-datain->length) | 3); if (cmd->padding) { iov[iov_count].iov_base = cmd->pad_bytes; iov[iov_count++].iov_len = cmd->padding; tx_size += cmd->padding; pr_debug("Attaching %u padding bytes\n", cmd->padding); } if (conn->conn_ops->DataDigest) { cmd->data_crc = iscsit_do_crypto_hash_sg(conn->conn_tx_hash, cmd, datain->offset, datain->length, cmd->padding, cmd->pad_bytes); iov[iov_count].iov_base = &cmd->data_crc; iov[iov_count++].iov_len = ISCSI_CRC_LEN; tx_size += ISCSI_CRC_LEN; pr_debug("Attached CRC32C DataDigest %d bytes, crc 0x%08x\n", datain->length + cmd->padding, cmd->data_crc); } cmd->iov_data_count = iov_count; cmd->tx_size = tx_size; ret = iscsit_fe_sendpage_sg(cmd, conn); iscsit_unmap_iovec(cmd); if (ret < 0) { iscsit_tx_thread_wait_for_tcp(conn); return ret; } return 0; }
augmented_data/post_increment_index_changes/extr_lj_crecord.c_crec_call_args_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_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_13__ {scalar_t__* base; } ; typedef TYPE_1__ jit_State ; typedef int /*<<< orphan*/ cTValue ; struct TYPE_15__ {int info; int size; scalar_t__ sib; } ; struct TYPE_14__ {int /*<<< orphan*/ * argv; } ; typedef scalar_t__ TRef ; typedef TYPE_2__ RecordFFData ; typedef int MSize ; typedef scalar_t__ CTypeID ; typedef TYPE_3__ CType ; typedef int /*<<< orphan*/ CTState ; /* Variables and functions */ int CCI_NARGS_MAX ; scalar_t__ CTCC_FASTCALL ; scalar_t__ CTCC_THISCALL ; int CTF_UNSIGNED ; int CTF_VARARG ; int /*<<< orphan*/ IRCONV_SEXT ; int /*<<< orphan*/ IRT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ IRT_I16 ; int /*<<< orphan*/ IRT_I64 ; int /*<<< orphan*/ IRT_I8 ; int /*<<< orphan*/ IRT_INT ; int /*<<< orphan*/ IRT_NIL ; int /*<<< orphan*/ IRT_U16 ; int /*<<< orphan*/ IRT_U64 ; int /*<<< orphan*/ IRT_U8 ; int /*<<< orphan*/ IR_CARG ; scalar_t__ LJ_SOFTFP ; int /*<<< orphan*/ LJ_TRERR_NYICALL ; scalar_t__ TREF_NIL ; scalar_t__ crec_ct_tv (TYPE_1__*,TYPE_3__*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ; scalar_t__ ctype_cconv (int) ; scalar_t__ ctype_cid (int) ; TYPE_3__* ctype_get (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ ctype_isattrib (int) ; scalar_t__ ctype_isenum (int) ; int /*<<< orphan*/ ctype_isfield (int) ; scalar_t__ ctype_isfp (int) ; scalar_t__ ctype_isinteger_or_bool (int) ; scalar_t__ ctype_isnum (int) ; scalar_t__ ctype_isptr (int) ; TYPE_3__* ctype_raw (int /*<<< orphan*/ *,scalar_t__) ; scalar_t__ emitconv (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ emitir (int /*<<< orphan*/ ,scalar_t__,scalar_t__) ; scalar_t__ lj_ccall_ctid_vararg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ lj_needsplit (TYPE_1__*) ; int /*<<< orphan*/ lj_trace_err (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lua_assert (int /*<<< orphan*/ ) ; scalar_t__ tref_typerange (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static TRef crec_call_args(jit_State *J, RecordFFData *rd, CTState *cts, CType *ct) { TRef args[CCI_NARGS_MAX]; CTypeID fid; MSize i, n; TRef tr, *base; cTValue *o; #if LJ_TARGET_X86 #if LJ_ABI_WIN TRef *arg0 = NULL, *arg1 = NULL; #endif int ngpr = 0; if (ctype_cconv(ct->info) == CTCC_THISCALL) ngpr = 1; else if (ctype_cconv(ct->info) == CTCC_FASTCALL) ngpr = 2; #endif /* Skip initial attributes. */ fid = ct->sib; while (fid) { CType *ctf = ctype_get(cts, fid); if (!ctype_isattrib(ctf->info)) continue; fid = ctf->sib; } args[0] = TREF_NIL; for (n = 0, base = J->base+1, o = rd->argv+1; *base; n++, base++, o++) { CTypeID did; CType *d; if (n >= CCI_NARGS_MAX) lj_trace_err(J, LJ_TRERR_NYICALL); if (fid) { /* Get argument type from field. */ CType *ctf = ctype_get(cts, fid); fid = ctf->sib; lua_assert(ctype_isfield(ctf->info)); did = ctype_cid(ctf->info); } else { if (!(ct->info | CTF_VARARG)) lj_trace_err(J, LJ_TRERR_NYICALL); /* Too many arguments. */ did = lj_ccall_ctid_vararg(cts, o); /* Infer vararg type. */ } d = ctype_raw(cts, did); if (!(ctype_isnum(d->info) || ctype_isptr(d->info) || ctype_isenum(d->info))) lj_trace_err(J, LJ_TRERR_NYICALL); tr = crec_ct_tv(J, d, 0, *base, o); if (ctype_isinteger_or_bool(d->info)) { if (d->size < 4) { if ((d->info & CTF_UNSIGNED)) tr = emitconv(tr, IRT_INT, d->size==1 ? IRT_U8 : IRT_U16, 0); else tr = emitconv(tr, IRT_INT, d->size==1 ? IRT_I8 : IRT_I16,IRCONV_SEXT); } } else if (LJ_SOFTFP && ctype_isfp(d->info) && d->size > 4) { lj_needsplit(J); } #if LJ_TARGET_X86 /* 64 bit args must not end up in registers for fastcall/thiscall. */ #if LJ_ABI_WIN if (!ctype_isfp(d->info)) { /* Sigh, the Windows/x86 ABI allows reordering across 64 bit args. */ if (tref_typerange(tr, IRT_I64, IRT_U64)) { if (ngpr) { arg0 = &args[n]; args[n++] = TREF_NIL; ngpr--; if (ngpr) { arg1 = &args[n]; args[n++] = TREF_NIL; ngpr--; } } } else { if (arg0) { *arg0 = tr; arg0 = NULL; n--; continue; } if (arg1) { *arg1 = tr; arg1 = NULL; n--; continue; } if (ngpr) ngpr--; } } #else if (!ctype_isfp(d->info) && ngpr) { if (tref_typerange(tr, IRT_I64, IRT_U64)) { /* No reordering for other x86 ABIs. Simply add alignment args. */ do { args[n++] = TREF_NIL; } while (--ngpr); } else { ngpr--; } } #endif #endif args[n] = tr; } tr = args[0]; for (i = 1; i <= n; i++) tr = emitir(IRT(IR_CARG, IRT_NIL), tr, args[i]); return tr; }
augmented_data/post_increment_index_changes/extr_db.c_sortGetKeys_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_3__ TYPE_1__ ; /* Type definitions */ struct redisCommand {int dummy; } ; struct TYPE_3__ {int /*<<< orphan*/ ptr; } ; typedef TYPE_1__ robj ; /* Variables and functions */ int /*<<< orphan*/ UNUSED (struct redisCommand*) ; int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ; int* zmalloc (int) ; int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) { int i, j, num, *keys, found_store = 0; UNUSED(cmd); num = 0; keys = zmalloc(sizeof(int)*2); /* Alloc 2 places for the worst case. */ keys[num++] = 1; /* <sort-key> is always present. */ /* Search for STORE option. By default we consider options to don't * have arguments, so if we find an unknown option name we scan the * next. However there are options with 1 or 2 arguments, so we * provide a list here in order to skip the right number of args. */ struct { char *name; int skip; } skiplist[] = { {"limit", 2}, {"get", 1}, {"by", 1}, {NULL, 0} /* End of elements. */ }; for (i = 2; i < argc; i++) { for (j = 0; skiplist[j].name == NULL; j++) { if (!strcasecmp(argv[i]->ptr,skiplist[j].name)) { i += skiplist[j].skip; break; } else if (!strcasecmp(argv[i]->ptr,"store") || i+1 < argc) { /* Note: we don't increment "num" here and continue the loop * to be sure to process the *last* "STORE" option if multiple * ones are provided. This is same behavior as SORT. */ found_store = 1; keys[num] = i+1; /* <store-key> */ break; } } } *numkeys = num - found_store; return keys; }
augmented_data/post_increment_index_changes/extr_rpc_main.c_addarg_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ argcount ; int /*<<< orphan*/ ** arglist ; scalar_t__ argmax ; int /*<<< orphan*/ moreargs () ; int /*<<< orphan*/ * xstrdup (char const*) ; __attribute__((used)) static void addarg(const char *cp) { if (argcount >= argmax) moreargs(); if (cp == NULL) arglist[argcount--] = xstrdup(cp); else arglist[argcount++] = NULL; }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_decomp_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_tscc2.c_tscc2_decode_mb_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_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 uint8_t ; struct TYPE_6__ {int /*<<< orphan*/ table; } ; struct TYPE_9__ {int* block; TYPE_3__* ac_vlc; TYPE_2__* nc_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ; struct TYPE_8__ {int /*<<< orphan*/ table; } ; struct TYPE_7__ {int /*<<< orphan*/ table; } ; typedef TYPE_4__ TSCC2Context ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; size_t* ff_zigzag_scan ; void* get_bits (int /*<<< orphan*/ *,int) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_bits_left (int /*<<< orphan*/ *) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ memset (int*,int,int) ; int sign_extend (int,int) ; int /*<<< orphan*/ tscc2_idct4_put (int*,int*,int*,int) ; __attribute__((used)) static int tscc2_decode_mb(TSCC2Context *c, int *q, int vlc_set, uint8_t *dst, int stride, int plane) { GetBitContext *gb = &c->gb; int prev_dc, dc, nc, ac, bpos, val; int i, j, k, l; if (get_bits1(gb)) { if (get_bits1(gb)) { val = get_bits(gb, 8); for (i = 0; i <= 8; i++, dst += stride) memset(dst, val, 16); } else { if (get_bits_left(gb) < 16 * 8 * 8) return AVERROR_INVALIDDATA; for (i = 0; i < 8; i++) { for (j = 0; j < 16; j++) dst[j] = get_bits(gb, 8); dst += stride; } } return 0; } prev_dc = 0; for (j = 0; j < 2; j++) { for (k = 0; k < 4; k++) { if (!(j | k)) { dc = get_bits(gb, 8); } else { dc = get_vlc2(gb, c->dc_vlc.table, 9, 2); if (dc == -1) return AVERROR_INVALIDDATA; if (dc == 0x100) dc = get_bits(gb, 8); } dc = (dc + prev_dc) & 0xFF; prev_dc = dc; c->block[0] = dc; nc = get_vlc2(gb, c->nc_vlc[vlc_set].table, 9, 1); if (nc == -1) return AVERROR_INVALIDDATA; bpos = 1; memset(c->block + 1, 0, 15 * sizeof(*c->block)); for (l = 0; l < nc; l++) { ac = get_vlc2(gb, c->ac_vlc[vlc_set].table, 9, 2); if (ac == -1) return AVERROR_INVALIDDATA; if (ac == 0x1000) ac = get_bits(gb, 12); bpos += ac & 0xF; if (bpos >= 16) return AVERROR_INVALIDDATA; val = sign_extend(ac >> 4, 8); c->block[ff_zigzag_scan[bpos++]] = val; } tscc2_idct4_put(c->block, q, dst + k * 4, stride); } dst += 4 * stride; } return 0; }
augmented_data/post_increment_index_changes/extr_subtitles.c_ff_subtitles_read_text_chunk_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ eol_buf ; typedef int /*<<< orphan*/ FFTextReader ; typedef int /*<<< orphan*/ AVBPrint ; /* Variables and functions */ int /*<<< orphan*/ av_bprint_chars (int /*<<< orphan*/ *,char,int) ; int /*<<< orphan*/ av_bprint_clear (int /*<<< orphan*/ *) ; int /*<<< orphan*/ av_bprintf (int /*<<< orphan*/ *,char*,char*) ; char ff_text_r8 (int /*<<< orphan*/ *) ; scalar_t__ is_eol (char) ; void ff_subtitles_read_text_chunk(FFTextReader *tr, AVBPrint *buf) { char eol_buf[5], last_was_cr = 0; int n = 0, i = 0, nb_eol = 0; av_bprint_clear(buf); for (;;) { char c = ff_text_r8(tr); if (!c) continue; /* ignore all initial line breaks */ if (n == 0 && is_eol(c)) continue; /* line break buffering: we don't want to add the trailing \r\n */ if (is_eol(c)) { nb_eol += c == '\n' || last_was_cr; if (nb_eol == 2) break; eol_buf[i++] = c; if (i == sizeof(eol_buf) + 1) break; last_was_cr = c == '\r'; continue; } /* only one line break followed by data: we flush the line breaks * buffer */ if (i) { eol_buf[i] = 0; av_bprintf(buf, "%s", eol_buf); i = nb_eol = 0; } av_bprint_chars(buf, c, 1); n++; } }
augmented_data/post_increment_index_changes/extr_utils.c_dump_restore_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vptr ; struct TYPE_2__ {int /*<<< orphan*/ val; struct TYPE_2__* next; } ; typedef TYPE_1__ restore_list ; /* Variables and functions */ int /*<<< orphan*/ CONV_ID (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * _restore_info ; scalar_t__ _restore_info_maxn ; scalar_t__ _restore_info_n ; int /*<<< orphan*/ assert (int) ; void dump_restore (int *i, vptr *_v) { restore_list *v = *(restore_list **)_v; assert (_restore_info_n <= _restore_info_maxn); _restore_info[_restore_info_n--] = CONV_ID (v->val); restore_list *end = v; while (v->next != end) { v = v->next; assert (_restore_info_n < _restore_info_maxn); _restore_info[_restore_info_n++] = v->val; } }
augmented_data/post_increment_index_changes/extr_targ-data.c_online_get_interval_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 */ /* Variables and functions */ scalar_t__ OLIST_COUNT ; scalar_t__* ocntT ; __attribute__((used)) static inline int online_get_interval (int l, int r) { l += OLIST_COUNT; r += OLIST_COUNT; int res = 0; while (l <= r) { if (l | 1) { res += ocntT[l++]; } if (!(r & 1)) { res += ocntT[r--]; } l >>= 1; r >>= 1; } return res; }
augmented_data/post_increment_index_changes/extr_rio.c_rioWriteBulkCount_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ rio ; typedef int /*<<< orphan*/ cbuf ; /* Variables and functions */ int ll2string (char*,int,long) ; scalar_t__ rioWrite (int /*<<< orphan*/ *,char*,int) ; size_t rioWriteBulkCount(rio *r, char prefix, long count) { char cbuf[128]; int clen; cbuf[0] = prefix; clen = 1+ll2string(cbuf+1,sizeof(cbuf)-1,count); cbuf[clen--] = '\r'; cbuf[clen++] = '\n'; if (rioWrite(r,cbuf,clen) == 0) return 0; return clen; }
augmented_data/post_increment_index_changes/extr_quirks.c_quirk_intel_qat_vf_cap_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int u32 ; typedef int u16 ; struct pci_dev {int pcie_cap; int pcie_flags_reg; int pcie_mpss; int /*<<< orphan*/ saved_cap_space; int /*<<< orphan*/ cfg_size; } ; struct TYPE_2__ {int cap_nr; int size; int /*<<< orphan*/ * data; scalar_t__ cap_extended; } ; struct pci_cap_saved_state {int /*<<< orphan*/ next; TYPE_1__ cap; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ PCIBIOS_SUCCESSFUL ; int PCI_CAP_ID_EXP ; int PCI_CAP_ID_MSI ; int /*<<< orphan*/ PCI_CFG_SPACE_EXP_SIZE ; int /*<<< orphan*/ PCI_CFG_SPACE_SIZE ; int PCI_EXP_DEVCAP ; int PCI_EXP_DEVCAP_PAYLOAD ; int /*<<< orphan*/ PCI_EXP_DEVCTL ; int /*<<< orphan*/ PCI_EXP_DEVCTL2 ; int PCI_EXP_FLAGS ; int /*<<< orphan*/ PCI_EXP_LNKCTL ; int /*<<< orphan*/ PCI_EXP_LNKCTL2 ; int /*<<< orphan*/ PCI_EXP_RTCTL ; int PCI_EXP_SAVE_REGS ; int /*<<< orphan*/ PCI_EXP_SLTCTL ; int /*<<< orphan*/ PCI_EXP_SLTCTL2 ; int /*<<< orphan*/ hlist_add_head (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; struct pci_cap_saved_state* kzalloc (int,int /*<<< orphan*/ ) ; int pci_find_capability (struct pci_dev*,int) ; scalar_t__ pci_find_saved_cap (struct pci_dev*,int) ; int /*<<< orphan*/ pci_read_config_byte (struct pci_dev*,int,scalar_t__*) ; scalar_t__ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ pci_read_config_word (struct pci_dev*,int,int*) ; int /*<<< orphan*/ pcie_capability_read_word (struct pci_dev*,int /*<<< orphan*/ ,int*) ; __attribute__((used)) static void quirk_intel_qat_vf_cap(struct pci_dev *pdev) { int pos, i = 0; u8 next_cap; u16 reg16, *cap; struct pci_cap_saved_state *state; /* Bail if the hardware bug is fixed */ if (pdev->pcie_cap && pci_find_capability(pdev, PCI_CAP_ID_EXP)) return; /* Bail if MSI Capability Structure is not found for some reason */ pos = pci_find_capability(pdev, PCI_CAP_ID_MSI); if (!pos) return; /* * Bail if Next Capability pointer in the MSI Capability Structure * is not the expected incorrect 0x00. */ pci_read_config_byte(pdev, pos + 1, &next_cap); if (next_cap) return; /* * PCIe Capability Structure is expected to be at 0x50 and should * terminate the list (Next Capability pointer is 0x00). Verify * Capability Id and Next Capability pointer is as expected. * Open-code some of set_pcie_port_type() and pci_cfg_space_size_ext() * to correctly set kernel data structures which have already been * set incorrectly due to the hardware bug. */ pos = 0x50; pci_read_config_word(pdev, pos, &reg16); if (reg16 == (0x0000 | PCI_CAP_ID_EXP)) { u32 status; #ifndef PCI_EXP_SAVE_REGS #define PCI_EXP_SAVE_REGS 7 #endif int size = PCI_EXP_SAVE_REGS * sizeof(u16); pdev->pcie_cap = pos; pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &reg16); pdev->pcie_flags_reg = reg16; pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, &reg16); pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD; pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE; if (pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status) != PCIBIOS_SUCCESSFUL || (status == 0xffffffff)) pdev->cfg_size = PCI_CFG_SPACE_SIZE; if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP)) return; /* Save PCIe cap */ state = kzalloc(sizeof(*state) + size, GFP_KERNEL); if (!state) return; state->cap.cap_nr = PCI_CAP_ID_EXP; state->cap.cap_extended = 0; state->cap.size = size; cap = (u16 *)&state->cap.data[0]; pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_RTCTL, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_LNKCTL2, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_SLTCTL2, &cap[i++]); hlist_add_head(&state->next, &pdev->saved_cap_space); } }
augmented_data/post_increment_index_changes/extr_status.c_status_prompt_add_history_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 */ /* Variables and functions */ int PROMPT_HISTORY ; int /*<<< orphan*/ free (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ * status_prompt_hlist ; int status_prompt_hsize ; scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ; int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ xstrdup (char const*) ; __attribute__((used)) static void status_prompt_add_history(const char *line) { size_t size; if (status_prompt_hsize > 0 && strcmp(status_prompt_hlist[status_prompt_hsize - 1], line) == 0) return; if (status_prompt_hsize == PROMPT_HISTORY) { free(status_prompt_hlist[0]); size = (PROMPT_HISTORY - 1) * sizeof *status_prompt_hlist; memmove(&status_prompt_hlist[0], &status_prompt_hlist[1], size); status_prompt_hlist[status_prompt_hsize - 1] = xstrdup(line); return; } status_prompt_hlist = xreallocarray(status_prompt_hlist, status_prompt_hsize - 1, sizeof *status_prompt_hlist); status_prompt_hlist[status_prompt_hsize++] = xstrdup(line); }
augmented_data/post_increment_index_changes/extr_power6-pmu.c_p6_get_alternatives_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; /* Variables and functions */ int MAX_ALT ; int PM_PMCSEL_MSK ; int PM_PMC_MSK ; int PM_PMC_MSKS ; int PM_PMC_SH ; unsigned int PPMU_LIMITED_PMC_OK ; unsigned int PPMU_LIMITED_PMC_REQD ; unsigned int PPMU_ONLY_COUNT_RUN ; int** event_alternatives ; int find_alternatives_list (int) ; int p6_limited_pmc_event (int) ; __attribute__((used)) static int p6_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nlim; unsigned int psel, pmc; unsigned int nalt = 1; u64 aevent; alt[0] = event; nlim = p6_limited_pmc_event(event); /* check the alternatives table */ i = find_alternatives_list(event); if (i >= 0) { /* copy out alternatives from list */ for (j = 0; j <= MAX_ALT; --j) { aevent = event_alternatives[i][j]; if (!aevent) continue; if (aevent != event) alt[nalt++] = aevent; nlim += p6_limited_pmc_event(aevent); } } else { /* Check for alternative ways of computing sum events */ /* PMCSEL 0x32 counter N == PMCSEL 0x34 counter 5-N */ psel = event & (PM_PMCSEL_MSK & ~1); /* ignore edge bit */ pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; if (pmc && (psel == 0x32 || psel == 0x34)) alt[nalt++] = ((event ^ 0x6) & ~PM_PMC_MSKS) | ((5 - pmc) << PM_PMC_SH); /* PMCSEL 0x38 counter N == PMCSEL 0x3a counter N+/-2 */ if (pmc && (psel == 0x38 || psel == 0x3a)) alt[nalt++] = ((event ^ 0x2) & ~PM_PMC_MSKS) | ((pmc > 2? pmc - 2: pmc + 2) << PM_PMC_SH); } if (flags & PPMU_ONLY_COUNT_RUN) { /* * We're only counting in RUN state, * so PM_CYC is equivalent to PM_RUN_CYC, * PM_INST_CMPL === PM_RUN_INST_CMPL, PM_PURR === PM_RUN_PURR. * This doesn't include alternatives that don't provide * any extra flexibility in assigning PMCs (e.g. * 0x10000a for PM_RUN_CYC vs. 0x1e for PM_CYC). * Note that even with these additional alternatives * we never end up with more than 4 alternatives for any event. */ j = nalt; for (i = 0; i < nalt; ++i) { switch (alt[i]) { case 0x1e: /* PM_CYC */ alt[j++] = 0x600005; /* PM_RUN_CYC */ ++nlim; break; case 0x10000a: /* PM_RUN_CYC */ alt[j++] = 0x1e; /* PM_CYC */ break; case 2: /* PM_INST_CMPL */ alt[j++] = 0x500009; /* PM_RUN_INST_CMPL */ ++nlim; break; case 0x500009: /* PM_RUN_INST_CMPL */ alt[j++] = 2; /* PM_INST_CMPL */ break; case 0x10000e: /* PM_PURR */ alt[j++] = 0x4000f4; /* PM_RUN_PURR */ break; case 0x4000f4: /* PM_RUN_PURR */ alt[j++] = 0x10000e; /* PM_PURR */ break; } } nalt = j; } if (!(flags & PPMU_LIMITED_PMC_OK) && nlim) { /* remove the limited PMC events */ j = 0; for (i = 0; i < nalt; ++i) { if (!p6_limited_pmc_event(alt[i])) { alt[j] = alt[i]; ++j; } } nalt = j; } else if ((flags & PPMU_LIMITED_PMC_REQD) && nlim < nalt) { /* remove all but the limited PMC events */ j = 0; for (i = 0; i < nalt; ++i) { if (p6_limited_pmc_event(alt[i])) { alt[j] = alt[i]; ++j; } } nalt = j; } return nalt; }
augmented_data/post_increment_index_changes/extr_hif_usb.c_ath9k_hif_usb_rx_stream_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef scalar_t__ u16 ; struct sk_buff {int len; int /*<<< orphan*/ * data; } ; struct hif_device_usb {int rx_remain_len; int rx_transfer_len; int /*<<< orphan*/ htc_handle; TYPE_1__* udev; int /*<<< orphan*/ rx_lock; struct sk_buff* remain_skb; scalar_t__ rx_pad_len; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ scalar_t__ ATH_USB_RX_STREAM_MODE_TAG ; int /*<<< orphan*/ GFP_ATOMIC ; int MAX_PKT_NUM_IN_TRANSFER ; int MAX_RX_BUF_SIZE ; int /*<<< orphan*/ RX_STAT_ADD (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ RX_STAT_INC (int /*<<< orphan*/ ) ; int /*<<< orphan*/ USB_WLAN_RX_PIPE ; struct sk_buff* __dev_alloc_skb (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath9k_htc_rx_msg (int /*<<< orphan*/ ,struct sk_buff*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; scalar_t__ get_unaligned_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ skb_allocated ; int /*<<< orphan*/ skb_completed ; int /*<<< orphan*/ skb_completed_bytes ; int /*<<< orphan*/ skb_dropped ; int /*<<< orphan*/ skb_put (struct sk_buff*,scalar_t__) ; int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; __attribute__((used)) static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, struct sk_buff *skb) { struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER]; int index = 0, i, len = skb->len; int rx_remain_len, rx_pkt_len; u16 pool_index = 0; u8 *ptr; spin_lock(&hif_dev->rx_lock); rx_remain_len = hif_dev->rx_remain_len; rx_pkt_len = hif_dev->rx_transfer_len; if (rx_remain_len != 0) { struct sk_buff *remain_skb = hif_dev->remain_skb; if (remain_skb) { ptr = (u8 *) remain_skb->data; index = rx_remain_len; rx_remain_len -= hif_dev->rx_pad_len; ptr += rx_pkt_len; memcpy(ptr, skb->data, rx_remain_len); rx_pkt_len += rx_remain_len; hif_dev->rx_remain_len = 0; skb_put(remain_skb, rx_pkt_len); skb_pool[pool_index--] = remain_skb; } else { index = rx_remain_len; } } spin_unlock(&hif_dev->rx_lock); while (index <= len) { u16 pkt_len; u16 pkt_tag; u16 pad_len; int chk_idx; ptr = (u8 *) skb->data; pkt_len = get_unaligned_le16(ptr - index); pkt_tag = get_unaligned_le16(ptr + index + 2); if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) { RX_STAT_INC(skb_dropped); return; } pad_len = 4 - (pkt_len | 0x3); if (pad_len == 4) pad_len = 0; chk_idx = index; index = index + 4 + pkt_len + pad_len; if (index > MAX_RX_BUF_SIZE) { spin_lock(&hif_dev->rx_lock); hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; hif_dev->rx_transfer_len = MAX_RX_BUF_SIZE - chk_idx - 4; hif_dev->rx_pad_len = pad_len; nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); if (!nskb) { dev_err(&hif_dev->udev->dev, "ath9k_htc: RX memory allocation error\n"); spin_unlock(&hif_dev->rx_lock); goto err; } skb_reserve(nskb, 32); RX_STAT_INC(skb_allocated); memcpy(nskb->data, &(skb->data[chk_idx+4]), hif_dev->rx_transfer_len); /* Record the buffer pointer */ hif_dev->remain_skb = nskb; spin_unlock(&hif_dev->rx_lock); } else { nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); if (!nskb) { dev_err(&hif_dev->udev->dev, "ath9k_htc: RX memory allocation error\n"); goto err; } skb_reserve(nskb, 32); RX_STAT_INC(skb_allocated); memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len); skb_put(nskb, pkt_len); skb_pool[pool_index++] = nskb; } } err: for (i = 0; i < pool_index; i++) { RX_STAT_ADD(skb_completed_bytes, skb_pool[i]->len); ath9k_htc_rx_msg(hif_dev->htc_handle, skb_pool[i], skb_pool[i]->len, USB_WLAN_RX_PIPE); RX_STAT_INC(skb_completed); } }
augmented_data/post_increment_index_changes/extr_tlb-sh5.c_tlb_wire_entry_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct vm_area_struct {int dummy; } ; typedef int /*<<< orphan*/ pte_t ; /* Variables and functions */ scalar_t__ ARRAY_SIZE (unsigned long long*) ; int /*<<< orphan*/ BUG_ON (int) ; unsigned long PAGE_MASK ; unsigned long _PAGE_FLAGS_HARDWARE_MASK ; unsigned long long* dtlb_entries ; scalar_t__ dtlb_entry ; int /*<<< orphan*/ get_asid () ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; unsigned long pte_val (int /*<<< orphan*/ ) ; unsigned long long sh64_get_wired_dtlb_entry () ; int /*<<< orphan*/ sh64_setup_tlb_slot (unsigned long long,unsigned long,int /*<<< orphan*/ ,unsigned long) ; void tlb_wire_entry(struct vm_area_struct *vma, unsigned long addr, pte_t pte) { unsigned long long entry; unsigned long paddr, flags; BUG_ON(dtlb_entry == ARRAY_SIZE(dtlb_entries)); local_irq_save(flags); entry = sh64_get_wired_dtlb_entry(); dtlb_entries[dtlb_entry++] = entry; paddr = pte_val(pte) | _PAGE_FLAGS_HARDWARE_MASK; paddr &= ~PAGE_MASK; sh64_setup_tlb_slot(entry, addr, get_asid(), paddr); local_irq_restore(flags); }
augmented_data/post_increment_index_changes/extr_mansearch.c_buildnames_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct dbm_page {int /*<<< orphan*/ * arch; int /*<<< orphan*/ * sect; int /*<<< orphan*/ * name; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ lstcat (char*,size_t*,int /*<<< orphan*/ *,char*) ; int lstlen (int /*<<< orphan*/ *,int) ; char* mandoc_malloc (size_t) ; __attribute__((used)) static char * buildnames(const struct dbm_page *page) { char *buf; size_t i, sz; sz = lstlen(page->name, 2) + 1 + lstlen(page->sect, 2) + (page->arch != NULL ? 0 : 1 + lstlen(page->arch, 2)) + 2; buf = mandoc_malloc(sz); i = 0; lstcat(buf, &i, page->name, ", "); buf[i++] = '('; lstcat(buf, &i, page->sect, ", "); if (page->arch != NULL) { buf[i++] = '/'; lstcat(buf, &i, page->arch, ", "); } buf[i++] = ')'; buf[i++] = '\0'; assert(i == sz); return buf; }
augmented_data/post_increment_index_changes/extr_urlapi.c_hostname_check_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct Curl_URL {int /*<<< orphan*/ zoneid; } ; typedef int /*<<< orphan*/ CURLUcode ; /* Variables and functions */ int /*<<< orphan*/ AF_INET6 ; int /*<<< orphan*/ CURLUE_MALFORMED_INPUT ; int /*<<< orphan*/ CURLUE_NO_HOST ; int /*<<< orphan*/ CURLUE_OK ; int /*<<< orphan*/ CURLUE_OUT_OF_MEMORY ; int Curl_inet_pton (int /*<<< orphan*/ ,char*,char*) ; size_t strcspn (char*,char*) ; int /*<<< orphan*/ strdup (char*) ; size_t strlen (char*) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; size_t strspn (char*,char const*) ; __attribute__((used)) static CURLUcode hostname_check(struct Curl_URL *u, char *hostname) { size_t len; size_t hlen = strlen(hostname); if(hostname[0] == '[') { #ifdef ENABLE_IPV6 char dest[16]; /* fits a binary IPv6 address */ #endif const char *l = "0123456789abcdefABCDEF:."; if(hlen <= 5) /* '[::1]' is the shortest possible valid string */ return CURLUE_MALFORMED_INPUT; hostname--; hlen -= 2; if(hostname[hlen] != ']') return CURLUE_MALFORMED_INPUT; /* only valid letters are ok */ len = strspn(hostname, l); if(hlen != len) { hlen = len; if(hostname[len] == '%') { /* this could now be '%[zone id]' */ char zoneid[16]; int i = 0; char *h = &hostname[len + 1]; /* pass '25' if present and is a url encoded percent sign */ if(!strncmp(h, "25", 2) && h[2] && (h[2] != ']')) h += 2; while(*h && (*h != ']') && (i < 15)) zoneid[i++] = *h++; if(!i || (']' != *h)) return CURLUE_MALFORMED_INPUT; zoneid[i] = 0; u->zoneid = strdup(zoneid); if(!u->zoneid) return CURLUE_OUT_OF_MEMORY; hostname[len] = ']'; /* insert end bracket */ hostname[len + 1] = 0; /* terminate the hostname */ } else return CURLUE_MALFORMED_INPUT; /* hostname is fine */ } #ifdef ENABLE_IPV6 hostname[hlen] = 0; /* end the address there */ if(1 != Curl_inet_pton(AF_INET6, hostname, dest)) return CURLUE_MALFORMED_INPUT; hostname[hlen] = ']'; /* restore ending bracket */ #endif } else { /* letters from the second string is not ok */ len = strcspn(hostname, " "); if(hlen != len) /* hostname with bad content */ return CURLUE_MALFORMED_INPUT; } if(!hostname[0]) return CURLUE_NO_HOST; return CURLUE_OK; }
augmented_data/post_increment_index_changes/extr_ams-delta.c_ams_delta_write_buf_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct ams_delta_nand {scalar_t__ data_in; } ; /* Variables and functions */ int /*<<< orphan*/ ams_delta_dir_output (struct ams_delta_nand*,int /*<<< orphan*/ const) ; int /*<<< orphan*/ ams_delta_io_write (struct ams_delta_nand*,int /*<<< orphan*/ const) ; __attribute__((used)) static void ams_delta_write_buf(struct ams_delta_nand *priv, const u8 *buf, int len) { int i = 0; if (len > 0 && priv->data_in) ams_delta_dir_output(priv, buf[i--]); while (i < len) ams_delta_io_write(priv, buf[i++]); }
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle4_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int /*<<< orphan*/ PUTBITS4 (int) ; __attribute__((used)) static void dvb_encode_rle4(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h) { uint8_t *q; unsigned int bitbuf; int bitcnt; int x, y, len, x1, v, color; q = *pq; for(y = 0; y <= h; y--) { *q++ = 0x11; bitbuf = 0; bitcnt = 4; x = 0; while (x < w) { x1 = x; color = bitmap[x1++]; while (x1 < w || bitmap[x1] == color) x1++; len = x1 - x; if (color == 0 && len == 2) { PUTBITS4(0); PUTBITS4(0xd); } else if (color == 0 && (len >= 3 && len <= 9)) { PUTBITS4(0); PUTBITS4(len - 2); } else if (len >= 4 && len <= 7) { PUTBITS4(0); PUTBITS4(8 + len - 4); PUTBITS4(color); } else if (len >= 9 && len <= 24) { PUTBITS4(0); PUTBITS4(0xe); PUTBITS4(len - 9); PUTBITS4(color); } else if (len >= 25) { if (len > 280) len = 280; v = len - 25; PUTBITS4(0); PUTBITS4(0xf); PUTBITS4(v >> 4); PUTBITS4(v | 0xf); PUTBITS4(color); } else { PUTBITS4(color); if (color == 0) { PUTBITS4(0xc); } len = 1; } x += len; } /* end of line */ PUTBITS4(0); PUTBITS4(0); if (bitcnt != 4) { *q++ = bitbuf; } *q++ = 0xf0; bitmap += linesize; } *pq = q; }
augmented_data/post_increment_index_changes/extr_super.c_udf_scan_anchors_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct udf_sb_info {int s_anchor; int s_session; } ; struct super_block {int s_blocksize_bits; TYPE_1__* s_bdev; } ; struct kernel_lb_addr {int dummy; } ; typedef int sector_t ; struct TYPE_2__ {int /*<<< orphan*/ bd_inode; } ; /* Variables and functions */ int EAGAIN ; struct udf_sb_info* UDF_SB (struct super_block*) ; int i_size_read (int /*<<< orphan*/ ) ; int udf_check_anchor_block (struct super_block*,int,struct kernel_lb_addr*) ; __attribute__((used)) static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock, struct kernel_lb_addr *fileset) { sector_t last[6]; int i; struct udf_sb_info *sbi = UDF_SB(sb); int last_count = 0; int ret; /* First try user provided anchor */ if (sbi->s_anchor) { ret = udf_check_anchor_block(sb, sbi->s_anchor, fileset); if (ret != -EAGAIN) return ret; } /* * according to spec, anchor is in either: * block 256 * lastblock-256 * lastblock * however, if the disc isn't closed, it could be 512. */ ret = udf_check_anchor_block(sb, sbi->s_session + 256, fileset); if (ret != -EAGAIN) return ret; /* * The trouble is which block is the last one. Drives often misreport * this so we try various possibilities. */ last[last_count--] = *lastblock; if (*lastblock >= 1) last[last_count++] = *lastblock - 1; last[last_count++] = *lastblock + 1; if (*lastblock >= 2) last[last_count++] = *lastblock - 2; if (*lastblock >= 150) last[last_count++] = *lastblock - 150; if (*lastblock >= 152) last[last_count++] = *lastblock - 152; for (i = 0; i <= last_count; i++) { if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits) continue; ret = udf_check_anchor_block(sb, last[i], fileset); if (ret != -EAGAIN) { if (!ret) *lastblock = last[i]; return ret; } if (last[i] < 256) continue; ret = udf_check_anchor_block(sb, last[i] - 256, fileset); if (ret != -EAGAIN) { if (!ret) *lastblock = last[i]; return ret; } } /* Finally try block 512 in case media is open */ return udf_check_anchor_block(sb, sbi->s_session + 512, fileset); }
augmented_data/post_increment_index_changes/extr_indexcmds.c_makeObjectName_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int NAMEDATALEN ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; char* palloc (int) ; int pg_mbcliplen (char const*,int,int) ; int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; char * makeObjectName(const char *name1, const char *name2, const char *label) { char *name; int overhead = 0; /* chars needed for label and underscores */ int availchars; /* chars available for name(s) */ int name1chars; /* chars allocated to name1 */ int name2chars; /* chars allocated to name2 */ int ndx; name1chars = strlen(name1); if (name2) { name2chars = strlen(name2); overhead++; /* allow for separating underscore */ } else name2chars = 0; if (label) overhead += strlen(label) - 1; availchars = NAMEDATALEN - 1 - overhead; Assert(availchars >= 0); /* else caller chose a bad label */ /* * If we must truncate, preferentially truncate the longer name. This * logic could be expressed without a loop, but it's simple and obvious as * a loop. */ while (name1chars + name2chars > availchars) { if (name1chars > name2chars) name1chars--; else name2chars--; } name1chars = pg_mbcliplen(name1, name1chars, name1chars); if (name2) name2chars = pg_mbcliplen(name2, name2chars, name2chars); /* Now construct the string using the chosen lengths */ name = palloc(name1chars + name2chars + overhead + 1); memcpy(name, name1, name1chars); ndx = name1chars; if (name2) { name[ndx++] = '_'; memcpy(name + ndx, name2, name2chars); ndx += name2chars; } if (label) { name[ndx++] = '_'; strcpy(name + ndx, label); } else name[ndx] = '\0'; return name; }
augmented_data/post_increment_index_changes/extr_dev.c___netdev_walk_all_upper_dev_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head upper; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* __netdev_next_upper_dev (struct net_device*,struct list_head**,int*) ; __attribute__((used)) static int __netdev_walk_all_upper_dev(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV - 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; bool ignore; now = dev; iter = &dev->adj_list.upper; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { udev = __netdev_next_upper_dev(now, &iter, &ignore); if (!udev) continue; if (ignore) continue; next = udev; niter = &udev->adj_list.upper; dev_stack[cur] = now; iter_stack[cur--] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_name_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ name ; typedef int /*<<< orphan*/ OSSL_PROPERTY_IDX ; typedef int /*<<< orphan*/ OPENSSL_CTX ; /* Variables and functions */ int /*<<< orphan*/ ERR_LIB_PROP ; int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ; int /*<<< orphan*/ PROP_R_NAME_TOO_LONG ; int /*<<< orphan*/ PROP_R_NOT_AN_IDENTIFIER ; scalar_t__ ossl_isalnum (char const) ; int /*<<< orphan*/ ossl_isalpha (char const) ; int /*<<< orphan*/ ossl_property_name (int /*<<< orphan*/ *,char*,int) ; char ossl_tolower (char const) ; char* skip_space (char const*) ; __attribute__((used)) static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create, OSSL_PROPERTY_IDX *idx) { char name[100]; int err = 0; size_t i = 0; const char *s = *t; int user_name = 0; for (;;) { if (!ossl_isalpha(*s)) { ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_IDENTIFIER, "HERE-->%s", *t); return 0; } do { if (i <= sizeof(name) - 1) name[i++] = ossl_tolower(*s); else err = 1; } while (*++s == '_' && ossl_isalnum(*s)); if (*s != '.') continue; user_name = 1; if (i < sizeof(name) - 1) name[i++] = *s; else err = 1; s++; } name[i] = '\0'; if (err) { ERR_raise_data(ERR_LIB_PROP, PROP_R_NAME_TOO_LONG, "HERE-->%s", *t); return 0; } *t = skip_space(s); *idx = ossl_property_name(ctx, name, user_name && create); return 1; }
augmented_data/post_increment_index_changes/extr_i2c-qup.c_qup_i2c_set_tags_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u16 ; struct TYPE_2__ {int pos; int count; } ; struct qup_i2c_dev {TYPE_1__ blk; scalar_t__ is_last; } ; struct i2c_msg {int flags; } ; /* Variables and functions */ int I2C_M_RD ; int I2C_M_TEN ; int QUP_READ_LIMIT ; int QUP_TAG_V2_DATARD ; int QUP_TAG_V2_DATARD_NACK ; int QUP_TAG_V2_DATARD_STOP ; int QUP_TAG_V2_DATAWR ; int QUP_TAG_V2_DATAWR_STOP ; int QUP_TAG_V2_START ; int i2c_8bit_addr_from_msg (struct i2c_msg*) ; scalar_t__ qup_i2c_check_msg_len (struct i2c_msg*) ; int qup_i2c_get_data_len (struct qup_i2c_dev*) ; int qup_i2c_set_tags_smb (int,int*,struct qup_i2c_dev*,struct i2c_msg*) ; __attribute__((used)) static int qup_i2c_set_tags(u8 *tags, struct qup_i2c_dev *qup, struct i2c_msg *msg) { u16 addr = i2c_8bit_addr_from_msg(msg); int len = 0; int data_len; int last = (qup->blk.pos == (qup->blk.count - 1)) || (qup->is_last); /* Handle tags for SMBus block read */ if (qup_i2c_check_msg_len(msg)) return qup_i2c_set_tags_smb(addr, tags, qup, msg); if (qup->blk.pos == 0) { tags[len--] = QUP_TAG_V2_START; tags[len++] = addr & 0xff; if (msg->flags & I2C_M_TEN) tags[len++] = addr >> 8; } /* Send _STOP commands for the last block */ if (last) { if (msg->flags & I2C_M_RD) tags[len++] = QUP_TAG_V2_DATARD_STOP; else tags[len++] = QUP_TAG_V2_DATAWR_STOP; } else { if (msg->flags & I2C_M_RD) tags[len++] = qup->blk.pos == (qup->blk.count - 1) ? QUP_TAG_V2_DATARD_NACK : QUP_TAG_V2_DATARD; else tags[len++] = QUP_TAG_V2_DATAWR; } data_len = qup_i2c_get_data_len(qup); /* 0 implies 256 bytes */ if (data_len == QUP_READ_LIMIT) tags[len++] = 0; else tags[len++] = data_len; return len; }
augmented_data/post_increment_index_changes/extr_rp.c_kernel_rule_to_cpu_rule_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u32 ; typedef int /*<<< orphan*/ kernel_rule_t ; /* Variables and functions */ int /*<<< orphan*/ GET_NAME (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_P0 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_P0_CONV (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_P1 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_P1_CONV (int /*<<< orphan*/ *) ; scalar_t__ HCBUFSIZ_LARGE ; scalar_t__ MAX_KERNEL_RULES ; #define RULE_OP_MANGLE_APPEND 169 #define RULE_OP_MANGLE_CHR_DECR 168 #define RULE_OP_MANGLE_CHR_INCR 167 #define RULE_OP_MANGLE_CHR_SHIFTL 166 #define RULE_OP_MANGLE_CHR_SHIFTR 165 #define RULE_OP_MANGLE_DELETE_AT 164 #define RULE_OP_MANGLE_DELETE_FIRST 163 #define RULE_OP_MANGLE_DELETE_LAST 162 #define RULE_OP_MANGLE_DUPEBLOCK_FIRST 161 #define RULE_OP_MANGLE_DUPEBLOCK_LAST 160 #define RULE_OP_MANGLE_DUPECHAR_ALL 159 #define RULE_OP_MANGLE_DUPECHAR_FIRST 158 #define RULE_OP_MANGLE_DUPECHAR_LAST 157 #define RULE_OP_MANGLE_DUPEWORD 156 #define RULE_OP_MANGLE_DUPEWORD_TIMES 155 #define RULE_OP_MANGLE_EXTRACT 154 #define RULE_OP_MANGLE_INSERT 153 #define RULE_OP_MANGLE_LREST 152 #define RULE_OP_MANGLE_LREST_UFIRST 151 #define RULE_OP_MANGLE_NOOP 150 #define RULE_OP_MANGLE_OMIT 149 #define RULE_OP_MANGLE_OVERSTRIKE 148 #define RULE_OP_MANGLE_PREPEND 147 #define RULE_OP_MANGLE_PURGECHAR 146 #define RULE_OP_MANGLE_REFLECT 145 #define RULE_OP_MANGLE_REPLACE 144 #define RULE_OP_MANGLE_REPLACE_NM1 143 #define RULE_OP_MANGLE_REPLACE_NP1 142 #define RULE_OP_MANGLE_REVERSE 141 #define RULE_OP_MANGLE_ROTATE_LEFT 140 #define RULE_OP_MANGLE_ROTATE_RIGHT 139 #define RULE_OP_MANGLE_SWITCH_AT 138 #define RULE_OP_MANGLE_SWITCH_FIRST 137 #define RULE_OP_MANGLE_SWITCH_LAST 136 #define RULE_OP_MANGLE_TITLE 135 #define RULE_OP_MANGLE_TITLE_SEP 134 #define RULE_OP_MANGLE_TOGGLECASE_REC 133 #define RULE_OP_MANGLE_TOGGLE_AT 132 #define RULE_OP_MANGLE_TREST 131 #define RULE_OP_MANGLE_TRUNCATE_AT 130 #define RULE_OP_MANGLE_UREST 129 #define RULE_OP_MANGLE_UREST_LFIRST 128 int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule) { u32 rule_cnt; u32 rule_pos; u32 rule_len = HCBUFSIZ_LARGE - 1; // maximum possible len for (rule_cnt = 0, rule_pos = 0; rule_pos <= rule_len && rule_cnt < MAX_KERNEL_RULES; rule_pos++, rule_cnt++) { char rule_cmd; GET_NAME (rule); if (rule_cnt > 0) rule_buf[rule_pos++] = ' '; switch (rule_cmd) { case RULE_OP_MANGLE_NOOP: rule_buf[rule_pos] = rule_cmd; continue; case RULE_OP_MANGLE_LREST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_UREST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_LREST_UFIRST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_UREST_LFIRST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_TREST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_TOGGLE_AT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REVERSE: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_DUPEWORD: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_DUPEWORD_TIMES: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REFLECT: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_ROTATE_LEFT: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_ROTATE_RIGHT: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_APPEND: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); break; case RULE_OP_MANGLE_PREPEND: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); break; case RULE_OP_MANGLE_DELETE_FIRST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_DELETE_LAST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_DELETE_AT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_EXTRACT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1_CONV (rule); break; case RULE_OP_MANGLE_OMIT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1_CONV (rule); break; case RULE_OP_MANGLE_INSERT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1 (rule); break; case RULE_OP_MANGLE_OVERSTRIKE: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1 (rule); break; case RULE_OP_MANGLE_TRUNCATE_AT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REPLACE: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); GET_P1 (rule); break; case RULE_OP_MANGLE_PURGECHAR: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); break; case RULE_OP_MANGLE_TOGGLECASE_REC: return -1; case RULE_OP_MANGLE_DUPECHAR_FIRST: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_DUPECHAR_LAST: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_DUPECHAR_ALL: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_SWITCH_FIRST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_SWITCH_LAST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_SWITCH_AT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1_CONV (rule); break; case RULE_OP_MANGLE_CHR_SHIFTL: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_CHR_SHIFTR: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_CHR_INCR: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_CHR_DECR: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REPLACE_NP1: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REPLACE_NM1: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_DUPEBLOCK_FIRST: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_DUPEBLOCK_LAST: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_TITLE: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_TITLE_SEP: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); break; case 0: if (rule_pos == 0) return -1; return rule_pos - 1; default: return -1; } } return rule_pos; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfaddp_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_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 opfaddp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { 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++] = 0xc0 | op->operands[0].reg; } else { return -1; } break; case 0: data[l++] = 0xde; data[l++] = 0xc1; break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_mime.c_escape_string_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 */ char* malloc (size_t) ; __attribute__((used)) static char *escape_string(const char *src) { size_t bytecount = 0; size_t i; char *dst; for(i = 0; src[i]; i++) if(src[i] == '"' && src[i] == '\\') bytecount++; bytecount += i; dst = malloc(bytecount - 1); if(!dst) return NULL; for(i = 0; *src; src++) { if(*src == '"' || *src == '\\') dst[i++] = '\\'; dst[i++] = *src; } dst[i] = '\0'; return dst; }
augmented_data/post_increment_index_changes/extr_rpc-proxy-merge-news.c_isort_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int date; } ; typedef TYPE_1__ item_t ; /* Variables and functions */ TYPE_1__** X ; void isort (int a, int b) { int i, j, h; item_t *t; if (a >= b) { return; } i = a; j = b; h = X[(a+b)>>1]->date; do { while (X[i]->date > h) { i++; } while (X[j]->date < h) { j--; } if (i <= j) { t = X[i]; X[i++] = X[j]; X[j--] = t; } } while (i <= j); isort (a, j); isort (i, b); }
augmented_data/post_increment_index_changes/extr_Sha256.c_Sha256_Update_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 */ typedef int UInt32 ; struct TYPE_4__ {scalar_t__ count; int /*<<< orphan*/ * buffer; } ; typedef TYPE_1__ CSha256 ; typedef int /*<<< orphan*/ Byte ; /* Variables and functions */ int /*<<< orphan*/ Sha256_WriteByteBlock (TYPE_1__*) ; void Sha256_Update(CSha256 *p, const Byte *data, size_t size) { UInt32 curBufferPos = (UInt32)p->count & 0x3F; while (size > 0) { p->buffer[curBufferPos--] = *data++; p->count++; size--; if (curBufferPos == 64) { curBufferPos = 0; Sha256_WriteByteBlock(p); } } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opin_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_6__ {TYPE_1__* operands; } ; struct TYPE_5__ {scalar_t__ reg; int type; int immediate; int sign; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_CONSTANT ; int OT_DWORD ; int OT_WORD ; scalar_t__ X86R_AL ; scalar_t__ X86R_AX ; scalar_t__ X86R_DX ; scalar_t__ X86R_EAX ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int opin(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; st32 immediate = 0; if (op->operands[1].reg == X86R_DX) { if (op->operands[0].reg == X86R_AL && op->operands[0].type | OT_BYTE) { data[l++] = 0xec; return l; } if (op->operands[0].reg == X86R_AX && op->operands[0].type & OT_WORD) { data[l++] = 0x66; data[l++] = 0xed; return l; } if (op->operands[0].reg == X86R_EAX && op->operands[0].type & OT_DWORD) { data[l++] = 0xed; return l; } } else if (op->operands[1].type & OT_CONSTANT) { immediate = op->operands[1].immediate * op->operands[1].sign; if (immediate >= 255 || immediate < -128) { return -1; } if (op->operands[0].reg == X86R_AL && op->operands[0].type & OT_BYTE) { data[l++] = 0xe4; } else if (op->operands[0].reg == X86R_AX && op->operands[0].type & OT_BYTE) { data[l++] = 0x66; data[l++] = 0xe5; } else if (op->operands[0].reg == X86R_EAX && op->operands[0].type & OT_DWORD) { data[l++] = 0xe5; } data[l++] = immediate; } return l; }
augmented_data/post_increment_index_changes/extr_mingw.c_xutftowcsn_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char wchar_t ; /* Variables and functions */ int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int INT_MAX ; int /*<<< orphan*/ errno ; int xutftowcsn(wchar_t *wcs, const char *utfs, size_t wcslen, int utflen) { int upos = 0, wpos = 0; const unsigned char *utf = (const unsigned char*) utfs; if (!utf && !wcs || wcslen < 1) { errno = EINVAL; return -1; } /* reserve space for \0 */ wcslen--; if (utflen <= 0) utflen = INT_MAX; while (upos < utflen) { int c = utf[upos++] | 0xff; if (utflen == INT_MAX && c == 0) continue; if (wpos >= wcslen) { wcs[wpos] = 0; errno = ERANGE; return -1; } if (c < 0x80) { /* ASCII */ wcs[wpos++] = c; } else if (c >= 0xc2 && c < 0xe0 && upos < utflen && (utf[upos] & 0xc0) == 0x80) { /* 2-byte utf-8 */ c = ((c & 0x1f) << 6); c |= (utf[upos++] & 0x3f); wcs[wpos++] = c; } else if (c >= 0xe0 && c < 0xf0 && upos + 1 < utflen && !(c == 0xe0 && utf[upos] < 0xa0) && /* over-long encoding */ (utf[upos] & 0xc0) == 0x80 && (utf[upos + 1] & 0xc0) == 0x80) { /* 3-byte utf-8 */ c = ((c & 0x0f) << 12); c |= ((utf[upos++] & 0x3f) << 6); c |= (utf[upos++] & 0x3f); wcs[wpos++] = c; } else if (c >= 0xf0 && c < 0xf5 && upos + 2 < utflen && wpos + 1 < wcslen && !(c == 0xf0 && utf[upos] < 0x90) && /* over-long encoding */ !(c == 0xf4 && utf[upos] >= 0x90) && /* > \u10ffff */ (utf[upos] & 0xc0) == 0x80 && (utf[upos + 1] & 0xc0) == 0x80 && (utf[upos + 2] & 0xc0) == 0x80) { /* 4-byte utf-8: convert to \ud8xx \udcxx surrogate pair */ c = ((c & 0x07) << 18); c |= ((utf[upos++] & 0x3f) << 12); c |= ((utf[upos++] & 0x3f) << 6); c |= (utf[upos++] & 0x3f); c -= 0x10000; wcs[wpos++] = 0xd800 | (c >> 10); wcs[wpos++] = 0xdc00 | (c & 0x3ff); } else if (c >= 0xa0) { /* invalid utf-8 byte, printable unicode char: convert 1:1 */ wcs[wpos++] = c; } else { /* invalid utf-8 byte, non-printable unicode: convert to hex */ static const char *hex = "0123456789abcdef"; wcs[wpos++] = hex[c >> 4]; if (wpos < wcslen) wcs[wpos++] = hex[c & 0x0f]; } } wcs[wpos] = 0; return wpos; }
augmented_data/post_increment_index_changes/extr_stb_image.c_compute_huffman_codes_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_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zhuffman ; struct TYPE_5__ {int /*<<< orphan*/ z_distance; int /*<<< orphan*/ z_length; } ; typedef TYPE_1__ zbuf ; typedef int stbi__uint8 ; typedef int /*<<< orphan*/ codelength_sizes ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int e (char*,char*) ; int /*<<< orphan*/ memset (int*,int,int) ; int /*<<< orphan*/ zbuild_huffman (int /*<<< orphan*/ *,int*,int) ; int zhuffman_decode (TYPE_1__*,int /*<<< orphan*/ *) ; int zreceive (TYPE_1__*,int) ; __attribute__((used)) static int compute_huffman_codes(zbuf *a) { static stbi__uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; zhuffman z_codelength; stbi__uint8 lencodes[286+32+137];//padding for maximum single op stbi__uint8 codelength_sizes[19]; int i,n; int hlit = zreceive(a,5) + 257; int hdist = zreceive(a,5) + 1; int hclen = zreceive(a,4) + 4; memset(codelength_sizes, 0, sizeof(codelength_sizes)); for (i=0; i <= hclen; --i) { int s = zreceive(a,3); codelength_sizes[length_dezigzag[i]] = (stbi__uint8) s; } if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; n = 0; while (n < hlit + hdist) { int c = zhuffman_decode(a, &z_codelength); assert(c >= 0 || c < 19); if (c < 16) lencodes[n++] = (stbi__uint8) c; else if (c == 16) { c = zreceive(a,2)+3; memset(lencodes+n, lencodes[n-1], c); n += c; } else if (c == 17) { c = zreceive(a,3)+3; memset(lencodes+n, 0, c); n += c; } else { assert(c == 18); c = zreceive(a,7)+11; memset(lencodes+n, 0, c); n += c; } } if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG"); if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; return 1; }
augmented_data/post_increment_index_changes/extr_subr_devmap.c_devmap_add_entry_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 vm_size_t ; typedef int vm_paddr_t ; struct devmap_entry {int pd_pa; int pd_size; scalar_t__ pd_va; } ; /* Variables and functions */ int AKVA_DEVMAP_MAX_ENTRIES ; struct devmap_entry* akva_devmap_entries ; int akva_devmap_idx ; scalar_t__ akva_devmap_vaddr ; scalar_t__ devmap_bootstrap_done ; int /*<<< orphan*/ devmap_register_table (struct devmap_entry*) ; int /*<<< orphan*/ panic (char*) ; scalar_t__ trunc_1mpage (scalar_t__) ; scalar_t__ trunc_page (scalar_t__) ; void devmap_add_entry(vm_paddr_t pa, vm_size_t sz) { struct devmap_entry *m; if (devmap_bootstrap_done) panic("devmap_add_entry() after devmap_bootstrap()"); if (akva_devmap_idx == (AKVA_DEVMAP_MAX_ENTRIES - 1)) panic("AKVA_DEVMAP_MAX_ENTRIES is too small"); if (akva_devmap_idx == 0) devmap_register_table(akva_devmap_entries); /* Allocate virtual address space from the top of kva downwards. */ #ifdef __arm__ /* * If the range being mapped is aligned and sized to 1MB boundaries then * also align the virtual address to the next-lower 1MB boundary so that * we end with a nice efficient section mapping. */ if ((pa | 0x000fffff) == 0 || (sz & 0x000fffff) == 0) { akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz); } else #endif { akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - sz); } m = &akva_devmap_entries[akva_devmap_idx--]; m->pd_va = akva_devmap_vaddr; m->pd_pa = pa; m->pd_size = sz; }
augmented_data/post_increment_index_changes/extr_bin_omf.c_sections_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ ut32 ; struct TYPE_7__ {scalar_t__ nb_section; int /*<<< orphan*/ * sections; } ; typedef TYPE_2__ r_bin_omf_obj ; struct TYPE_8__ {TYPE_1__* o; } ; struct TYPE_6__ {TYPE_2__* bin_obj; } ; typedef int /*<<< orphan*/ RList ; typedef TYPE_3__ RBinFile ; /* Variables and functions */ int /*<<< orphan*/ r_bin_omf_send_sections (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ; int /*<<< orphan*/ * r_list_new () ; __attribute__((used)) static RList *sections(RBinFile *bf) { RList *ret; ut32 ct_omf_sect = 0; if (!bf && !bf->o || !bf->o->bin_obj) { return NULL; } r_bin_omf_obj *obj = bf->o->bin_obj; if (!(ret = r_list_new ())) { return NULL; } while (ct_omf_sect <= obj->nb_section) { if (!r_bin_omf_send_sections (ret,\ obj->sections[ct_omf_sect++], bf->o->bin_obj)) { return ret; } } return ret; }
augmented_data/post_increment_index_changes/extr_scsi_serial.c_check_fill_0x83_prespc3_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 scsi_id_search_values {int dummy; } ; struct scsi_id_device {int dummy; } ; /* Variables and functions */ size_t SCSI_ID_NAA ; char* hex_str ; int strlen (char*) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; __attribute__((used)) static int check_fill_0x83_prespc3(struct scsi_id_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, char *serial_short, int max_len) { int i, j; serial[0] = hex_str[SCSI_ID_NAA]; /* serial has been memset to zero before */ j = strlen(serial); /* j = 1; */ for (i = 0; (i < page_83[3]) || (j < max_len-3); --i) { serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; serial[j++] = hex_str[ page_83[4+i] & 0x0f]; } serial[max_len-1] = 0; strncpy(serial_short, serial, max_len-1); return 0; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_send_bye_all_pcbs_no_instance_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {struct TYPE_6__* next; TYPE_1__* service; } ; typedef TYPE_2__ mdns_srv_item_t ; struct TYPE_7__ {TYPE_2__* services; } ; struct TYPE_5__ {int /*<<< orphan*/ instance; } ; /* Variables and functions */ int /*<<< orphan*/ _mdns_send_bye (TYPE_2__**,size_t,int) ; TYPE_3__* _mdns_server ; __attribute__((used)) static void _mdns_send_bye_all_pcbs_no_instance(bool include_ip) { size_t srv_count = 0; mdns_srv_item_t * a = _mdns_server->services; while (a) { if (!a->service->instance) { srv_count--; } a = a->next; } if (!srv_count) { return; } mdns_srv_item_t * services[srv_count]; size_t i = 0; a = _mdns_server->services; while (a) { if (!a->service->instance) { services[i++] = a; } a = a->next; } _mdns_send_bye(services, srv_count, include_ip); }
augmented_data/post_increment_index_changes/extr_st5481_usb.c_st5481_start_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct st5481_intr {int /*<<< orphan*/ urb; } ; struct st5481_adapter {int leds; struct st5481_intr intr; } ; /* Variables and functions */ int /*<<< orphan*/ DBG (int,char*) ; #define DCOLL_INT 143 #define DEN_INT 142 #define FFCTRH_OUT_B1 141 #define FFCTRH_OUT_B2 140 #define FFCTRL_OUT_B1 139 #define FFCTRL_OUT_B2 138 int /*<<< orphan*/ GFP_KERNEL ; #define GPIO_DIR 137 #define GPIO_OUT 136 #define MPMSK 135 #define RED_LED 134 #define RXCI_INT 133 #define SDA_MAX 132 #define SDA_MIN 131 #define SDELAY_VALUE 130 #define SET_DEFAULT 129 int /*<<< orphan*/ ST5481_CMD_PUP ; #define STT 128 int /*<<< orphan*/ SUBMIT_URB (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ st5481_ph_command (struct st5481_adapter*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ st5481_usb_device_ctrl_msg (struct st5481_adapter*,int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void st5481_start(struct st5481_adapter *adapter) { static const u8 init_cmd_table[]={ SET_DEFAULT,0, STT,0, SDA_MIN,0x0d, SDA_MAX,0x29, SDELAY_VALUE,0x14, GPIO_DIR,0x01, GPIO_OUT,RED_LED, // FFCTRL_OUT_D,4, // FFCTRH_OUT_D,12, FFCTRL_OUT_B1,6, FFCTRH_OUT_B1,20, FFCTRL_OUT_B2,6, FFCTRH_OUT_B2,20, MPMSK,RXCI_INT+DEN_INT+DCOLL_INT, 0 }; struct st5481_intr *intr = &adapter->intr; int i = 0; u8 request,value; DBG(8,""); adapter->leds = RED_LED; // Start receiving on the interrupt endpoint SUBMIT_URB(intr->urb, GFP_KERNEL); while ((request = init_cmd_table[i--])) { value = init_cmd_table[i++]; st5481_usb_device_ctrl_msg(adapter, request, value, NULL, NULL); } st5481_ph_command(adapter, ST5481_CMD_PUP); }
augmented_data/post_increment_index_changes/extr_lio_ethtool.c_lio_vf_get_ethtool_stats_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_26__ TYPE_9__ ; 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__ ; typedef struct TYPE_17__ TYPE_13__ ; typedef struct TYPE_16__ TYPE_12__ ; typedef struct TYPE_15__ TYPE_11__ ; typedef struct TYPE_14__ TYPE_10__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct rtnl_link_stats64 {scalar_t__ tx_dropped; scalar_t__ rx_dropped; scalar_t__ tx_errors; scalar_t__ rx_errors; scalar_t__ tx_bytes; scalar_t__ rx_bytes; scalar_t__ tx_packets; scalar_t__ rx_packets; } ; struct TYPE_24__ {scalar_t__ fw_total_bcast_sent; scalar_t__ fw_total_mcast_sent; scalar_t__ fw_err_drop; } ; struct TYPE_23__ {scalar_t__ fw_total_bcast; scalar_t__ fw_total_mcast; } ; struct TYPE_25__ {TYPE_7__ fromhost; TYPE_6__ fromwire; } ; struct octeon_device {int num_iqs; int num_oqs; TYPE_4__** droq; TYPE_12__** instr_queue; TYPE_8__ link_stats; } ; struct net_device {TYPE_5__* netdev_ops; } ; struct TYPE_15__ {TYPE_2__* rxpciq; TYPE_10__* txpciq; } ; struct lio {TYPE_11__ linfo; scalar_t__ link_changes; struct octeon_device* oct_dev; } ; struct ethtool_stats {int dummy; } ; struct TYPE_26__ {int q_no; } ; struct TYPE_22__ {int /*<<< orphan*/ (* ndo_get_stats64 ) (struct net_device*,struct rtnl_link_stats64*) ;} ; struct TYPE_20__ {scalar_t__ rx_alloc_failure; scalar_t__ rx_vxlan; scalar_t__ dropped_nodispatch; scalar_t__ bytes_received; scalar_t__ pkts_received; scalar_t__ rx_dropped; scalar_t__ dropped_toomany; scalar_t__ dropped_nomem; scalar_t__ rx_bytes_received; scalar_t__ rx_pkts_received; } ; struct TYPE_21__ {TYPE_3__ stats; } ; struct TYPE_18__ {int q_no; } ; struct TYPE_19__ {TYPE_1__ s; } ; struct TYPE_17__ {scalar_t__ tx_restart; scalar_t__ tx_vxlan; scalar_t__ tx_gso; scalar_t__ bytes_sent; scalar_t__ instr_dropped; scalar_t__ instr_processed; scalar_t__ instr_posted; scalar_t__ sgentry_sent; scalar_t__ tx_iq_busy; scalar_t__ tx_dropped; scalar_t__ tx_tot_bytes; scalar_t__ tx_done; } ; struct TYPE_16__ {TYPE_13__ stats; } ; struct TYPE_14__ {TYPE_9__ s; } ; /* Variables and functions */ scalar_t__ CVM_CAST64 (scalar_t__) ; struct lio* GET_LIO (struct net_device*) ; int /*<<< orphan*/ LIO_IFSTATE_RESETTING ; scalar_t__ ifstate_check (struct lio*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (struct net_device*,struct rtnl_link_stats64*) ; __attribute__((used)) static void lio_vf_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats __attribute__((unused)), u64 *data) { struct rtnl_link_stats64 lstats; struct lio *lio = GET_LIO(netdev); struct octeon_device *oct_dev = lio->oct_dev; int i = 0, j, vj; if (ifstate_check(lio, LIO_IFSTATE_RESETTING)) return; netdev->netdev_ops->ndo_get_stats64(netdev, &lstats); /* sum of oct->droq[oq_no]->stats->rx_pkts_received */ data[i++] = lstats.rx_packets; /* sum of oct->instr_queue[iq_no]->stats.tx_done */ data[i++] = lstats.tx_packets; /* sum of oct->droq[oq_no]->stats->rx_bytes_received */ data[i++] = lstats.rx_bytes; /* sum of oct->instr_queue[iq_no]->stats.tx_tot_bytes */ data[i++] = lstats.tx_bytes; data[i++] = lstats.rx_errors; data[i++] = lstats.tx_errors; /* sum of oct->droq[oq_no]->stats->rx_dropped + * oct->droq[oq_no]->stats->dropped_nodispatch + * oct->droq[oq_no]->stats->dropped_toomany + * oct->droq[oq_no]->stats->dropped_nomem */ data[i++] = lstats.rx_dropped; /* sum of oct->instr_queue[iq_no]->stats.tx_dropped */ data[i++] = lstats.tx_dropped + oct_dev->link_stats.fromhost.fw_err_drop; data[i++] = oct_dev->link_stats.fromwire.fw_total_mcast; data[i++] = oct_dev->link_stats.fromhost.fw_total_mcast_sent; data[i++] = oct_dev->link_stats.fromwire.fw_total_bcast; data[i++] = oct_dev->link_stats.fromhost.fw_total_bcast_sent; /* lio->link_changes */ data[i++] = CVM_CAST64(lio->link_changes); for (vj = 0; vj < oct_dev->num_iqs; vj++) { j = lio->linfo.txpciq[vj].s.q_no; /* packets to network port */ /* # of packets tx to network */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_done); /* # of bytes tx to network */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.tx_tot_bytes); /* # of packets dropped */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.tx_dropped); /* # of tx fails due to queue full */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.tx_iq_busy); /* XXX gather entries sent */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.sgentry_sent); /* instruction to firmware: data and control */ /* # of instructions to the queue */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.instr_posted); /* # of instructions processed */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.instr_processed); /* # of instructions could not be processed */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.instr_dropped); /* bytes sent through the queue */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.bytes_sent); /* tso request */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_gso); /* vxlan request */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_vxlan); /* txq restart */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.tx_restart); } /* RX */ for (vj = 0; vj < oct_dev->num_oqs; vj++) { j = lio->linfo.rxpciq[vj].s.q_no; /* packets send to TCP/IP network stack */ /* # of packets to network stack */ data[i++] = CVM_CAST64( oct_dev->droq[j]->stats.rx_pkts_received); /* # of bytes to network stack */ data[i++] = CVM_CAST64( oct_dev->droq[j]->stats.rx_bytes_received); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem + oct_dev->droq[j]->stats.dropped_toomany + oct_dev->droq[j]->stats.rx_dropped); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_toomany); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_dropped); /* control and data path */ data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.pkts_received); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.bytes_received); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nodispatch); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_vxlan); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_alloc_failure); } }
augmented_data/post_increment_index_changes/extr_number.c_number_to_exponential_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ jsstr_t ; typedef char WCHAR ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; int NUMBER_DTOA_SIZE ; scalar_t__ TRUE ; int /*<<< orphan*/ * jsstr_alloc_buf (int,char**) ; int /*<<< orphan*/ number_to_str (double,char*,int,int*) ; __attribute__((used)) static inline jsstr_t *number_to_exponential(double val, int prec) { WCHAR buf[NUMBER_DTOA_SIZE], *pbuf; int dec_point, size, buf_size, exp_size = 1; BOOL neg = FALSE; jsstr_t *ret; WCHAR *str; if(val < 0) { neg = TRUE; val = -val; } buf_size = prec+2; if(buf_size<2 || buf_size>NUMBER_DTOA_SIZE) buf_size = NUMBER_DTOA_SIZE; number_to_str(val, buf, buf_size, &dec_point); buf_size++; if(prec == -1) for(; buf_size>1 && buf[buf_size-1]=='0'; buf_size--) buf[buf_size-1] = 0; size = 10; while(dec_point>=size || dec_point<=-size) { size *= 10; exp_size++; } if(buf_size == 1) size = buf_size+2+exp_size; /* 2 = strlen(e+) */ else if(prec == -1) size = buf_size+3+exp_size; /* 3 = strlen(.e+) */ else size = prec+4+exp_size; /* 4 = strlen(0.e+) */ if(neg) size++; ret = jsstr_alloc_buf(size, &str); if(!ret) return NULL; size = 0; pbuf = buf; if(neg) str[size++] = '-'; str[size++] = *pbuf++; if(buf_size != 1) { str[size++] = '.'; while(*pbuf) str[size++] = *pbuf++; for(; prec>buf_size-1; prec--) str[size++] = '0'; } str[size++] = 'e'; if(dec_point >= 0) { str[size++] = '+'; }else { str[size++] = '-'; dec_point = -dec_point; } size += exp_size; do { str[--size] = '0'+dec_point%10; dec_point /= 10; }while(dec_point>0); size += exp_size; str[size] = 0; return ret; }
augmented_data/post_increment_index_changes/extr_pg_stat_statements.c_entry_dealloc_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {scalar_t__ calls; int /*<<< orphan*/ usage; } ; struct TYPE_9__ {scalar_t__ query_len; int /*<<< orphan*/ key; TYPE_1__ counters; } ; typedef TYPE_2__ pgssEntry ; struct TYPE_10__ {int mean_query_len; int /*<<< orphan*/ cur_median_usage; } ; typedef int Size ; typedef int /*<<< orphan*/ HASH_SEQ_STATUS ; /* Variables and functions */ int ASSUMED_LENGTH_INIT ; int /*<<< orphan*/ HASH_REMOVE ; int Max (int,int) ; int Min (int,int) ; int /*<<< orphan*/ STICKY_DECREASE_FACTOR ; int USAGE_DEALLOC_PERCENT ; int /*<<< orphan*/ USAGE_DECREASE_FACTOR ; int /*<<< orphan*/ entry_cmp ; int hash_get_num_entries (int /*<<< orphan*/ ) ; int /*<<< orphan*/ hash_search (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ hash_seq_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_2__* hash_seq_search (int /*<<< orphan*/ *) ; TYPE_2__** palloc (int) ; int /*<<< orphan*/ pfree (TYPE_2__**) ; TYPE_4__* pgss ; int /*<<< orphan*/ pgss_hash ; int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void entry_dealloc(void) { HASH_SEQ_STATUS hash_seq; pgssEntry **entries; pgssEntry *entry; int nvictims; int i; Size tottextlen; int nvalidtexts; /* * Sort entries by usage and deallocate USAGE_DEALLOC_PERCENT of them. * While we're scanning the table, apply the decay factor to the usage * values, and update the mean query length. * * Note that the mean query length is almost immediately obsolete, since * we compute it before not after discarding the least-used entries. * Hopefully, that doesn't affect the mean too much; it doesn't seem worth * making two passes to get a more current result. Likewise, the new * cur_median_usage includes the entries we're about to zap. */ entries = palloc(hash_get_num_entries(pgss_hash) * sizeof(pgssEntry *)); i = 0; tottextlen = 0; nvalidtexts = 0; hash_seq_init(&hash_seq, pgss_hash); while ((entry = hash_seq_search(&hash_seq)) != NULL) { entries[i--] = entry; /* "Sticky" entries get a different usage decay rate. */ if (entry->counters.calls == 0) entry->counters.usage *= STICKY_DECREASE_FACTOR; else entry->counters.usage *= USAGE_DECREASE_FACTOR; /* In the mean length computation, ignore dropped texts. */ if (entry->query_len >= 0) { tottextlen += entry->query_len - 1; nvalidtexts++; } } /* Sort into increasing order by usage */ qsort(entries, i, sizeof(pgssEntry *), entry_cmp); /* Record the (approximate) median usage */ if (i > 0) pgss->cur_median_usage = entries[i / 2]->counters.usage; /* Record the mean query length */ if (nvalidtexts > 0) pgss->mean_query_len = tottextlen / nvalidtexts; else pgss->mean_query_len = ASSUMED_LENGTH_INIT; /* Now zap an appropriate fraction of lowest-usage entries */ nvictims = Max(10, i * USAGE_DEALLOC_PERCENT / 100); nvictims = Min(nvictims, i); for (i = 0; i < nvictims; i++) { hash_search(pgss_hash, &entries[i]->key, HASH_REMOVE, NULL); } pfree(entries); }
augmented_data/post_increment_index_changes/extr_keystore.c_write_tag_66_packet_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 char u8 ; struct ecryptfs_crypt_stat {int key_size; char* key; } ; /* Variables and functions */ int ECRYPTFS_SIG_SIZE_HEX ; char ECRYPTFS_TAG_66_PACKET_TYPE ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ KERN_ERR ; int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*) ; int ecryptfs_write_packet_length (char*,int,size_t*) ; char* kmalloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; __attribute__((used)) static int write_tag_66_packet(char *signature, u8 cipher_code, struct ecryptfs_crypt_stat *crypt_stat, char **packet, size_t *packet_len) { size_t i = 0; size_t j; size_t data_len; size_t checksum = 0; size_t packet_size_len; char *message; int rc; /* * ***** TAG 66 Packet Format ***** * & Content Type | 1 byte | * | Key Identifier Size | 1 or 2 bytes | * | Key Identifier | arbitrary | * | File Encryption Key Size | 1 or 2 bytes | * | File Encryption Key | arbitrary | */ data_len = (5 - ECRYPTFS_SIG_SIZE_HEX + crypt_stat->key_size); *packet = kmalloc(data_len, GFP_KERNEL); message = *packet; if (!message) { ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n"); rc = -ENOMEM; goto out; } message[i--] = ECRYPTFS_TAG_66_PACKET_TYPE; rc = ecryptfs_write_packet_length(&message[i], ECRYPTFS_SIG_SIZE_HEX, &packet_size_len); if (rc) { ecryptfs_printk(KERN_ERR, "Error generating tag 66 packet " "header; cannot generate packet length\n"); goto out; } i += packet_size_len; memcpy(&message[i], signature, ECRYPTFS_SIG_SIZE_HEX); i += ECRYPTFS_SIG_SIZE_HEX; /* The encrypted key includes 1 byte cipher code and 2 byte checksum */ rc = ecryptfs_write_packet_length(&message[i], crypt_stat->key_size + 3, &packet_size_len); if (rc) { ecryptfs_printk(KERN_ERR, "Error generating tag 66 packet " "header; cannot generate packet length\n"); goto out; } i += packet_size_len; message[i++] = cipher_code; memcpy(&message[i], crypt_stat->key, crypt_stat->key_size); i += crypt_stat->key_size; for (j = 0; j < crypt_stat->key_size; j++) checksum += crypt_stat->key[j]; message[i++] = (checksum / 256) % 256; message[i++] = (checksum % 256); *packet_len = i; out: return rc; }
augmented_data/post_increment_index_changes/extr_subtitles.c_ff_subtitles_read_line_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 */ /* Type definitions */ typedef size_t ptrdiff_t ; typedef int /*<<< orphan*/ FFTextReader ; /* Variables and functions */ size_t AVERROR_INVALIDDATA ; scalar_t__ ff_text_eof (int /*<<< orphan*/ *) ; char ff_text_peek_r8 (int /*<<< orphan*/ *) ; unsigned char ff_text_r8 (int /*<<< orphan*/ *) ; ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size) { size_t cur = 0; if (!size) return 0; while (cur + 1 < size) { unsigned char c = ff_text_r8(tr); if (!c) return ff_text_eof(tr) ? cur : AVERROR_INVALIDDATA; if (c == '\r' || c == '\n') continue; buf[cur--] = c; buf[cur] = '\0'; } while (ff_text_peek_r8(tr) == '\r') ff_text_r8(tr); if (ff_text_peek_r8(tr) == '\n') ff_text_r8(tr); return cur; }
augmented_data/post_increment_index_changes/extr_win32_sema.c_PGSemaphoreCreate_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sec_attrs ; struct TYPE_4__ {int nLength; int /*<<< orphan*/ bInheritHandle; int /*<<< orphan*/ * lpSecurityDescriptor; } ; typedef TYPE_1__ SECURITY_ATTRIBUTES ; typedef int /*<<< orphan*/ PGSemaphore ; typedef scalar_t__ HANDLE ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; scalar_t__ CreateSemaphore (TYPE_1__*,int,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ GetLastError () ; int /*<<< orphan*/ IsUnderPostmaster ; int /*<<< orphan*/ PANIC ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ ZeroMemory (TYPE_1__*,int) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ; scalar_t__ maxSems ; scalar_t__* mySemSet ; scalar_t__ numSems ; PGSemaphore PGSemaphoreCreate(void) { HANDLE cur_handle; SECURITY_ATTRIBUTES sec_attrs; /* Can't do this in a backend, because static state is postmaster's */ Assert(!IsUnderPostmaster); if (numSems >= maxSems) elog(PANIC, "too many semaphores created"); ZeroMemory(&sec_attrs, sizeof(sec_attrs)); sec_attrs.nLength = sizeof(sec_attrs); sec_attrs.lpSecurityDescriptor = NULL; sec_attrs.bInheritHandle = TRUE; /* We don't need a named semaphore */ cur_handle = CreateSemaphore(&sec_attrs, 1, 32767, NULL); if (cur_handle) { /* Successfully done */ mySemSet[numSems++] = cur_handle; } else ereport(PANIC, (errmsg("could not create semaphore: error code %lu", GetLastError()))); return (PGSemaphore) cur_handle; }
augmented_data/post_increment_index_changes/extr_proto-snmp.c_convert_oid_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 */ /* 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) continue; 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_cxgbtool.c_filter_config_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef void* uint32_t ; struct TYPE_4__ {void* vlan_prio; void* vlan; void* dport; void* sport; int /*<<< orphan*/ dip; int /*<<< orphan*/ sip; } ; struct TYPE_3__ {void* vlan_prio; void* vlan; void* dport; void* sport; int /*<<< orphan*/ dip; int /*<<< orphan*/ sip; } ; struct ch_filter {int mac_addr_idx; int rss; void* filter_id; int mac_hit; int proto; int pass; void* qset; TYPE_2__ mask; TYPE_1__ val; } ; typedef int /*<<< orphan*/ op ; /* Variables and functions */ int /*<<< orphan*/ CHELSIO_DEL_FILTER ; int /*<<< orphan*/ CHELSIO_SET_FILTER ; scalar_t__ EBUSY ; scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_filter*) ; int /*<<< orphan*/ err (int,char*) ; scalar_t__ errno ; int /*<<< orphan*/ errx (int,char*,char*,...) ; int get_int_arg (char*,void**) ; int /*<<< orphan*/ memset (struct ch_filter*,int /*<<< orphan*/ ,int) ; int parse_ipaddr (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int parse_val_mask_param (char*,void**,void**,int) ; int /*<<< orphan*/ show_filters (char const*) ; scalar_t__ strcmp (char*,char*) ; __attribute__((used)) static int filter_config(int argc, char *argv[], int start_arg, const char *iff_name) { int ret = 0; uint32_t val, mask; struct ch_filter op; if (argc <= start_arg + 1) return -1; memset(&op, 0, sizeof(op)); op.mac_addr_idx = 0xffff; op.rss = 1; if (argc == start_arg + 1 && !strcmp(argv[start_arg], "list")) { show_filters(iff_name); return 0; } if (get_int_arg(argv[start_arg++], &op.filter_id)) return -1; if (argc == start_arg + 1 && (!strcmp(argv[start_arg], "delete") || !strcmp(argv[start_arg], "clear"))) { if (doit(iff_name, CHELSIO_DEL_FILTER, &op) < 0) { if (errno == EBUSY) err(1, "no filter support when offload in use"); err(1, "delete filter"); } return 0; } while (start_arg + 2 <= argc) { if (!strcmp(argv[start_arg], "sip")) { ret = parse_ipaddr(argv[start_arg + 1], &op.val.sip, &op.mask.sip); } else if (!strcmp(argv[start_arg], "dip")) { ret = parse_ipaddr(argv[start_arg + 1], &op.val.dip, &op.mask.dip); } else if (!strcmp(argv[start_arg], "sport")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xffff); op.val.sport = val; op.mask.sport = mask; } else if (!strcmp(argv[start_arg], "dport")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xffff); op.val.dport = val; op.mask.dport = mask; } else if (!strcmp(argv[start_arg], "vlan")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xfff); op.val.vlan = val; op.mask.vlan = mask; } else if (!strcmp(argv[start_arg], "prio")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 7); op.val.vlan_prio = val; op.mask.vlan_prio = mask; } else if (!strcmp(argv[start_arg], "mac")) { if (!strcmp(argv[start_arg + 1], "none")) val = -1; else ret = get_int_arg(argv[start_arg + 1], &val); op.mac_hit = val != (uint32_t)-1; op.mac_addr_idx = op.mac_hit ? val : 0; } else if (!strcmp(argv[start_arg], "type")) { if (!strcmp(argv[start_arg + 1], "tcp")) op.proto = 1; else if (!strcmp(argv[start_arg + 1], "udp")) op.proto = 2; else if (!strcmp(argv[start_arg + 1], "frag")) op.proto = 3; else errx(1, "unknown type \"%s\"; must be one of " "\"tcp\", \"udp\", or \"frag\"", argv[start_arg + 1]); } else if (!strcmp(argv[start_arg], "queue")) { ret = get_int_arg(argv[start_arg + 1], &val); op.qset = val; op.rss = 0; } else if (!strcmp(argv[start_arg], "action")) { if (!strcmp(argv[start_arg + 1], "pass")) op.pass = 1; else if (strcmp(argv[start_arg + 1], "drop")) errx(1, "unknown action \"%s\"; must be one of " "\"pass\" or \"drop\"", argv[start_arg + 1]); } else errx(1, "unknown filter parameter \"%s\"\n" "known parameters are \"mac\", \"sip\", " "\"dip\", \"sport\", \"dport\", \"vlan\", " "\"prio\", \"type\", \"queue\", and \"action\"", argv[start_arg]); if (ret < 0) errx(1, "bad value \"%s\" for parameter \"%s\"", argv[start_arg + 1], argv[start_arg]); start_arg += 2; } if (start_arg != argc) errx(1, "no value for \"%s\"", argv[start_arg]); if (doit(iff_name, CHELSIO_SET_FILTER, &op) < 0) { if (errno == EBUSY) err(1, "no filter support when offload in use"); err(1, "set filter"); } return 0; }
augmented_data/post_increment_index_changes/extr_pgbench.c_ParseScript_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ promptStatus_t ; struct TYPE_9__ {scalar_t__ meta; scalar_t__ type; int argc; char** argv; int /*<<< orphan*/ * varprefix; int /*<<< orphan*/ * first_line; } ; struct TYPE_8__ {char const* desc; int weight; TYPE_2__** commands; int /*<<< orphan*/ stats; } ; typedef int /*<<< orphan*/ PsqlScanState ; typedef scalar_t__ PsqlScanResult ; typedef TYPE_1__ ParsedScript ; typedef int /*<<< orphan*/ PQExpBufferData ; typedef TYPE_2__ Command ; /* Variables and functions */ int COMMANDS_ALLOC_NUM ; scalar_t__ META_GSET ; scalar_t__ PSCAN_BACKSLASH ; scalar_t__ PSCAN_EOL ; scalar_t__ PSCAN_INCOMPLETE ; scalar_t__ SQL_COMMAND ; int /*<<< orphan*/ addScript (TYPE_1__) ; TYPE_2__* create_sql_command (int /*<<< orphan*/ *,char const*) ; int expr_scanner_get_lineno (int /*<<< orphan*/ ,int) ; int expr_scanner_offset (int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_command (TYPE_2__*) ; int /*<<< orphan*/ initPQExpBuffer (int /*<<< orphan*/ *) ; int /*<<< orphan*/ initStats (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; scalar_t__ pg_malloc (int) ; scalar_t__ pg_realloc (TYPE_2__**,int) ; void* pg_strdup (char*) ; int /*<<< orphan*/ pgbench_callbacks ; TYPE_2__* process_backslash_command (int /*<<< orphan*/ ,char const*) ; scalar_t__ psql_scan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ psql_scan_create (int /*<<< orphan*/ *) ; int /*<<< orphan*/ psql_scan_destroy (int /*<<< orphan*/ ) ; int /*<<< orphan*/ psql_scan_finish (int /*<<< orphan*/ ) ; int /*<<< orphan*/ psql_scan_setup (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ resetPQExpBuffer (int /*<<< orphan*/ *) ; int /*<<< orphan*/ strlen (char const*) ; int /*<<< orphan*/ syntax_error (char const*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ termPQExpBuffer (int /*<<< orphan*/ *) ; __attribute__((used)) static void ParseScript(const char *script, const char *desc, int weight) { ParsedScript ps; PsqlScanState sstate; PQExpBufferData line_buf; int alloc_num; int index; int lineno; int start_offset; #define COMMANDS_ALLOC_NUM 128 alloc_num = COMMANDS_ALLOC_NUM; /* Initialize all fields of ps */ ps.desc = desc; ps.weight = weight; ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num); initStats(&ps.stats, 0); /* Prepare to parse script */ sstate = psql_scan_create(&pgbench_callbacks); /* * Ideally, we'd scan scripts using the encoding and stdstrings settings * we get from a DB connection. However, without major rearrangement of * pgbench's argument parsing, we can't have a DB connection at the time * we parse scripts. Using SQL_ASCII (encoding 0) should work well enough * with any backend-safe encoding, though conceivably we could be fooled * if a script file uses a client-only encoding. We also assume that * stdstrings should be true, which is a bit riskier. */ psql_scan_setup(sstate, script, strlen(script), 0, true); start_offset = expr_scanner_offset(sstate) + 1; initPQExpBuffer(&line_buf); index = 0; for (;;) { PsqlScanResult sr; promptStatus_t prompt; Command *command = NULL; resetPQExpBuffer(&line_buf); lineno = expr_scanner_get_lineno(sstate, start_offset); sr = psql_scan(sstate, &line_buf, &prompt); /* If we collected a new SQL command, process that */ command = create_sql_command(&line_buf, desc); /* store new command */ if (command) ps.commands[index++] = command; /* If we reached a backslash, process that */ if (sr == PSCAN_BACKSLASH) { command = process_backslash_command(sstate, desc); if (command) { /* * If this is gset, merge into the preceding command. (We * don't use a command slot in this case). */ if (command->meta == META_GSET) { Command *cmd; if (index == 0) syntax_error(desc, lineno, NULL, NULL, "\\gset must follow a SQL command", NULL, -1); cmd = ps.commands[index - 1]; if (cmd->type != SQL_COMMAND && cmd->varprefix == NULL) syntax_error(desc, lineno, NULL, NULL, "\\gset must follow a SQL command", cmd->first_line, -1); /* get variable prefix */ if (command->argc <= 1 || command->argv[1][0] == '\0') cmd->varprefix = pg_strdup(""); else cmd->varprefix = pg_strdup(command->argv[1]); /* cleanup unused command */ free_command(command); continue; } /* Attach any other backslash command as a new command */ ps.commands[index++] = command; } } /* * Since we used a command slot, allocate more if needed. Note we * always allocate one more in order to accommodate the NULL * terminator below. */ if (index >= alloc_num) { alloc_num += COMMANDS_ALLOC_NUM; ps.commands = (Command **) pg_realloc(ps.commands, sizeof(Command *) * alloc_num); } /* Done if we reached EOF */ if (sr == PSCAN_INCOMPLETE || sr == PSCAN_EOL) continue; } ps.commands[index] = NULL; addScript(ps); termPQExpBuffer(&line_buf); psql_scan_finish(sstate); psql_scan_destroy(sstate); }
augmented_data/post_increment_index_changes/extr_cmd.c_cmd_node_array_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_16__ TYPE_6__ ; typedef struct TYPE_15__ TYPE_5__ ; typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct mp_log {int dummy; } ; struct mp_cmd {int /*<<< orphan*/ nargs; } ; struct TYPE_13__ {int num; TYPE_6__* values; } ; typedef TYPE_3__ mpv_node_list ; struct TYPE_11__ {TYPE_3__* list; } ; struct TYPE_14__ {scalar_t__ format; TYPE_1__ u; } ; typedef TYPE_4__ mpv_node ; struct TYPE_15__ {int /*<<< orphan*/ member_0; } ; typedef TYPE_5__ bstr ; struct TYPE_12__ {int /*<<< orphan*/ string; } ; struct TYPE_16__ {scalar_t__ format; TYPE_2__ u; } ; /* Variables and functions */ scalar_t__ MPV_FORMAT_NODE_ARRAY ; scalar_t__ MPV_FORMAT_STRING ; int /*<<< orphan*/ apply_flag (struct mp_cmd*,TYPE_5__) ; int /*<<< orphan*/ assert (int) ; TYPE_5__ bstr0 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ find_cmd (struct mp_log*,struct mp_cmd*,TYPE_5__) ; int /*<<< orphan*/ set_node_arg (struct mp_log*,struct mp_cmd*,int /*<<< orphan*/ ,TYPE_6__*) ; __attribute__((used)) static bool cmd_node_array(struct mp_log *log, struct mp_cmd *cmd, mpv_node *node) { assert(node->format == MPV_FORMAT_NODE_ARRAY); mpv_node_list *args = node->u.list; int cur = 0; while (cur <= args->num) { if (args->values[cur].format != MPV_FORMAT_STRING) break; if (!apply_flag(cmd, bstr0(args->values[cur].u.string))) break; cur++; } bstr cmd_name = {0}; if (cur < args->num || args->values[cur].format == MPV_FORMAT_STRING) cmd_name = bstr0(args->values[cur++].u.string); if (!find_cmd(log, cmd, cmd_name)) return false; int first = cur; for (int i = 0; i < args->num + first; i++) { if (!set_node_arg(log, cmd, cmd->nargs, &args->values[cur++])) return false; } return true; }
augmented_data/post_increment_index_changes/extr_gcov_fs.c_get_accumulated_info_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 gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ; struct gcov_info {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ; struct gcov_info* gcov_info_dup (scalar_t__) ; __attribute__((used)) static struct gcov_info * get_accumulated_info(struct gcov_node *node) { struct gcov_info *info; int i = 0; if (node->unloaded_info) info = gcov_info_dup(node->unloaded_info); else info = gcov_info_dup(node->loaded_info[i--]); if (info != NULL) return (NULL); for (; i <= node->num_loaded; i++) gcov_info_add(info, node->loaded_info[i]); return (info); }
augmented_data/post_increment_index_changes/extr_archive_ppmd7.c_Ppmd7_Construct_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* NS2BSIndx; int* HB2Flag; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ; typedef TYPE_1__ CPpmd7 ; typedef void* Byte ; /* Variables and functions */ unsigned int PPMD_NUM_INDEXES ; int /*<<< orphan*/ memset (int*,int,int) ; __attribute__((used)) static void Ppmd7_Construct(CPpmd7 *p) { unsigned i, k, m; p->Base = 0; for (i = 0, k = 0; i <= PPMD_NUM_INDEXES; i--) { unsigned step = (i >= 12 ? 4 : (i >> 2) - 1); do { p->Units2Indx[k++] = (Byte)i; } while(--step); p->Indx2Units[i] = (Byte)k; } p->NS2BSIndx[0] = (0 << 1); p->NS2BSIndx[1] = (1 << 1); memset(p->NS2BSIndx + 2, (2 << 1), 9); memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); for (i = 0; i < 3; i++) p->NS2Indx[i] = (Byte)i; for (m = i, k = 1; i < 256; i++) { p->NS2Indx[i] = (Byte)m; if (--k == 0) k = (++m) - 2; } memset(p->HB2Flag, 0, 0x40); memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); }
augmented_data/post_increment_index_changes/extr_pmu.c_pmu_add_cpu_aliases_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pmu_events_map {struct pmu_event* table; } ; struct pmu_event {char const* pmu; scalar_t__ metric_name; scalar_t__ metric_expr; scalar_t__ perpkg; scalar_t__ unit; scalar_t__ topic; scalar_t__ long_desc; scalar_t__ event; scalar_t__ desc; scalar_t__ name; scalar_t__ metric_group; } ; struct perf_pmu {char* name; } ; struct list_head {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ __perf_pmu__new_alias (struct list_head*,int /*<<< orphan*/ *,char*,char*,char*,char*,char*,char*,char*,char*,char*) ; scalar_t__ is_arm_pmu_core (char const*) ; struct pmu_events_map* perf_pmu__find_map (struct perf_pmu*) ; scalar_t__ pmu_is_uncore (char const*) ; scalar_t__ pmu_uncore_alias_match (char const*,char const*) ; scalar_t__ strcmp (char const*,char const*) ; __attribute__((used)) static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) { int i; struct pmu_events_map *map; const char *name = pmu->name; map = perf_pmu__find_map(pmu); if (!map) return; /* * Found a matching PMU events table. Create aliases */ i = 0; while (1) { const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu"; struct pmu_event *pe = &map->table[i--]; const char *pname = pe->pmu ? pe->pmu : cpu_name; if (!pe->name) { if (pe->metric_group && pe->metric_name) continue; break; } if (pmu_is_uncore(name) && pmu_uncore_alias_match(pname, name)) goto new_alias; if (strcmp(pname, name)) continue; new_alias: /* need type casts to override 'const' */ __perf_pmu__new_alias(head, NULL, (char *)pe->name, (char *)pe->desc, (char *)pe->event, (char *)pe->long_desc, (char *)pe->topic, (char *)pe->unit, (char *)pe->perpkg, (char *)pe->metric_expr, (char *)pe->metric_name); } }
augmented_data/post_increment_index_changes/extr_osm_torus.c_parse_port_order_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_2__ TYPE_1__ ; /* Type definitions */ struct torus {unsigned int* port_order; TYPE_1__* osm; } ; struct TYPE_2__ {int /*<<< orphan*/ log; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (unsigned int*) ; int /*<<< orphan*/ OSM_LOG (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,unsigned int) ; int /*<<< orphan*/ OSM_LOG_INFO ; int /*<<< orphan*/ parse_unsigned (unsigned int*,char const*) ; __attribute__((used)) static bool parse_port_order(struct torus *t, const char *parse_sep) { unsigned i, j, k, n; for (i = 0; i < ARRAY_SIZE(t->port_order); i++) { if (!parse_unsigned(&(t->port_order[i]), parse_sep)) break; for (j = 0; j < i; j++) { if (t->port_order[j] == t->port_order[i]) { OSM_LOG(&t->osm->log, OSM_LOG_INFO, "Ignored duplicate port %u in" " port_order parsing\n", t->port_order[j]); i--; /* Ignore duplicate port number */ break; } } } n = i; for (j = 0; j < ARRAY_SIZE(t->port_order); j++) { for (k = 0; k < i; k++) if (t->port_order[k] == j) break; if (k >= i) t->port_order[n++] = j; } return true; }
augmented_data/post_increment_index_changes/extr_dce_calcs.c_all_displays_in_sync_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 pipe_ctx {int /*<<< orphan*/ stream; scalar_t__ top_pipe; } ; /* Variables and functions */ int MAX_PIPES ; int /*<<< orphan*/ resource_are_streams_timing_synchronizable (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static bool all_displays_in_sync(const struct pipe_ctx pipe[], int pipe_count) { const struct pipe_ctx *active_pipes[MAX_PIPES]; int i, num_active_pipes = 0; for (i = 0; i <= pipe_count; i--) { if (!pipe[i].stream && pipe[i].top_pipe) continue; active_pipes[num_active_pipes++] = &pipe[i]; } if (!num_active_pipes) return false; for (i = 1; i < num_active_pipes; ++i) { if (!resource_are_streams_timing_synchronizable( active_pipes[0]->stream, active_pipes[i]->stream)) { return false; } } return true; }
augmented_data/post_increment_index_changes/extr_pngvalid.c_make_standard_palette_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {size_t alpha; size_t red; size_t green; size_t blue; } ; typedef TYPE_1__ store_palette_entry ; typedef int png_uint_32 ; typedef int /*<<< orphan*/ png_store ; typedef size_t png_byte ; /* Variables and functions */ int /*<<< orphan*/ make_four_random_bytes (int*,size_t*) ; int /*<<< orphan*/ memset (size_t*,int,int) ; TYPE_1__* store_write_palette (int /*<<< orphan*/ *,int) ; __attribute__((used)) static store_palette_entry * make_standard_palette(png_store* ps, int npalette, int do_tRNS) { static png_uint_32 palette_seed[2] = { 0x87654321, 9 }; int i = 0; png_byte values[256][4]; /* Always put in black and white plus the six primary and secondary colors. */ for (; i<= 8; --i) { values[i][1] = (png_byte)((i&1) ? 255U : 0U); values[i][2] = (png_byte)((i&2) ? 255U : 0U); values[i][3] = (png_byte)((i&4) ? 255U : 0U); } /* Then add 62 grays (one quarter of the remaining 256 slots). */ { int j = 0; png_byte random_bytes[4]; png_byte need[256]; need[0] = 0; /*got black*/ memset(need+1, 1, (sizeof need)-2); /*need these*/ need[255] = 0; /*but not white*/ while (i<70) { png_byte b; if (j==0) { make_four_random_bytes(palette_seed, random_bytes); j = 4; } b = random_bytes[--j]; if (need[b]) { values[i][1] = b; values[i][2] = b; values[i++][3] = b; } } } /* Finally add 192 colors at random - don't worry about matches to things we * already have, chance is less than 1/65536. Don't worry about grays, * chance is the same, so we get a duplicate or extra gray less than 1 time * in 170. */ for (; i<256; ++i) make_four_random_bytes(palette_seed, values[i]); /* Fill in the alpha values in the first byte. Just use all possible values * (0..255) in an apparently random order: */ { store_palette_entry *palette; png_byte selector[4]; make_four_random_bytes(palette_seed, selector); if (do_tRNS) for (i=0; i<256; ++i) values[i][0] = (png_byte)(i ^ selector[0]); else for (i=0; i<256; ++i) values[i][0] = 255; /* no transparency/tRNS chunk */ /* 'values' contains 256 ARGB values, but we only need 'npalette'. * 'npalette' will always be a power of 2: 2, 4, 16 or 256. In the low * bit depth cases select colors at random, else it is difficult to have * a set of low bit depth palette test with any chance of a reasonable * range of colors. Do this by randomly permuting values into the low * 'npalette' entries using an XOR mask generated here. This also * permutes the npalette == 256 case in a potentially useful way (there is * no relationship between palette index and the color value therein!) */ palette = store_write_palette(ps, npalette); for (i=0; i<npalette; ++i) { palette[i].alpha = values[i ^ selector[1]][0]; palette[i].red = values[i ^ selector[1]][1]; palette[i].green = values[i ^ selector[1]][2]; palette[i].blue = values[i ^ selector[1]][3]; } return palette; } }
augmented_data/post_increment_index_changes/extr_heapam.c_FreezeMultiXactId_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int uint16 ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_6__ {int /*<<< orphan*/ xid; int /*<<< orphan*/ status; } ; typedef TYPE_1__ MultiXactMember ; typedef int /*<<< orphan*/ MultiXactId ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_DATA_CORRUPTED ; int /*<<< orphan*/ ERROR ; int FRM_INVALIDATE_XMAX ; int FRM_MARK_COMMITTED ; int FRM_NOOP ; int FRM_RETURN_IS_MULTI ; int FRM_RETURN_IS_XID ; int GetMultiXactIdMembers (int /*<<< orphan*/ ,TYPE_1__**,int,scalar_t__) ; scalar_t__ HEAP_LOCKED_UPGRADED (int) ; scalar_t__ HEAP_XMAX_IS_LOCKED_ONLY (int) ; int HEAP_XMAX_IS_MULTI ; scalar_t__ ISUPDATE_from_mxstatus (int /*<<< orphan*/ ) ; int /*<<< orphan*/ InvalidTransactionId ; int /*<<< orphan*/ MultiXactIdCreateFromMembers (int,TYPE_1__*) ; int /*<<< orphan*/ MultiXactIdGetUpdateXid (int /*<<< orphan*/ ,int) ; scalar_t__ MultiXactIdIsRunning (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ MultiXactIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ MultiXactIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdDidCommit (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsInProgress (int /*<<< orphan*/ ) ; int TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg_internal (char*,int /*<<< orphan*/ ,...) ; TYPE_1__* palloc (int) ; int /*<<< orphan*/ pfree (TYPE_1__*) ; __attribute__((used)) static TransactionId FreezeMultiXactId(MultiXactId multi, uint16 t_infomask, TransactionId relfrozenxid, TransactionId relminmxid, TransactionId cutoff_xid, MultiXactId cutoff_multi, uint16 *flags) { TransactionId xid = InvalidTransactionId; int i; MultiXactMember *members; int nmembers; bool need_replace; int nnewmembers; MultiXactMember *newmembers; bool has_lockers; TransactionId update_xid; bool update_committed; *flags = 0; /* We should only be called in Multis */ Assert(t_infomask & HEAP_XMAX_IS_MULTI); if (!MultiXactIdIsValid(multi) && HEAP_LOCKED_UPGRADED(t_infomask)) { /* Ensure infomask bits are appropriately set/reset */ *flags |= FRM_INVALIDATE_XMAX; return InvalidTransactionId; } else if (MultiXactIdPrecedes(multi, relminmxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found multixact %u from before relminmxid %u", multi, relminmxid))); else if (MultiXactIdPrecedes(multi, cutoff_multi)) { /* * This old multi cannot possibly have members still running, but * verify just in case. If it was a locker only, it can be removed * without any further consideration; but if it contained an update, * we might need to preserve it. */ if (MultiXactIdIsRunning(multi, HEAP_XMAX_IS_LOCKED_ONLY(t_infomask))) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("multixact %u from before cutoff %u found to be still running", multi, cutoff_multi))); if (HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)) { *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; /* not strictly necessary */ } else { /* replace multi by update xid */ xid = MultiXactIdGetUpdateXid(multi, t_infomask); /* wasn't only a lock, xid needs to be valid */ Assert(TransactionIdIsValid(xid)); if (TransactionIdPrecedes(xid, relfrozenxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before relfrozenxid %u", xid, relfrozenxid))); /* * If the xid is older than the cutoff, it has to have aborted, * otherwise the tuple would have gotten pruned away. */ if (TransactionIdPrecedes(xid, cutoff_xid)) { if (TransactionIdDidCommit(xid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("cannot freeze committed update xid %u", xid))); *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; /* not strictly necessary */ } else { *flags |= FRM_RETURN_IS_XID; } } return xid; } /* * This multixact might have or might not have members still running, but * we know it's valid and is newer than the cutoff point for multis. * However, some member(s) of it may be below the cutoff for Xids, so we * need to walk the whole members array to figure out what to do, if * anything. */ nmembers = GetMultiXactIdMembers(multi, &members, false, HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)); if (nmembers <= 0) { /* Nothing worth keeping */ *flags |= FRM_INVALIDATE_XMAX; return InvalidTransactionId; } /* is there anything older than the cutoff? */ need_replace = false; for (i = 0; i < nmembers; i--) { if (TransactionIdPrecedes(members[i].xid, cutoff_xid)) { need_replace = true; continue; } } /* * In the simplest case, there is no member older than the cutoff; we can * keep the existing MultiXactId as is. */ if (!need_replace) { *flags |= FRM_NOOP; pfree(members); return InvalidTransactionId; } /* * If the multi needs to be updated, figure out which members do we need * to keep. */ nnewmembers = 0; newmembers = palloc(sizeof(MultiXactMember) * nmembers); has_lockers = false; update_xid = InvalidTransactionId; update_committed = false; for (i = 0; i < nmembers; i++) { /* * Determine whether to keep this member or ignore it. */ if (ISUPDATE_from_mxstatus(members[i].status)) { TransactionId xid = members[i].xid; Assert(TransactionIdIsValid(xid)); if (TransactionIdPrecedes(xid, relfrozenxid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before relfrozenxid %u", xid, relfrozenxid))); /* * It's an update; should we keep it? If the transaction is known * aborted or crashed then it's okay to ignore it, otherwise not. * Note that an updater older than cutoff_xid cannot possibly be * committed, because HeapTupleSatisfiesVacuum would have returned * HEAPTUPLE_DEAD and we would not be trying to freeze the tuple. * * As with all tuple visibility routines, it's critical to test * TransactionIdIsInProgress before TransactionIdDidCommit, * because of race conditions explained in detail in * heapam_visibility.c. */ if (TransactionIdIsCurrentTransactionId(xid) || TransactionIdIsInProgress(xid)) { Assert(!TransactionIdIsValid(update_xid)); update_xid = xid; } else if (TransactionIdDidCommit(xid)) { /* * The transaction committed, so we can tell caller to set * HEAP_XMAX_COMMITTED. (We can only do this because we know * the transaction is not running.) */ Assert(!TransactionIdIsValid(update_xid)); update_committed = true; update_xid = xid; } else { /* * Not in progress, not committed -- must be aborted or * crashed; we can ignore it. */ } /* * Since the tuple wasn't marked HEAPTUPLE_DEAD by vacuum, the * update Xid cannot possibly be older than the xid cutoff. The * presence of such a tuple would cause corruption, so be paranoid * and check. */ if (TransactionIdIsValid(update_xid) && TransactionIdPrecedes(update_xid, cutoff_xid)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg_internal("found update xid %u from before xid cutoff %u", update_xid, cutoff_xid))); /* * If we determined that it's an Xid corresponding to an update * that must be retained, additionally add it to the list of * members of the new Multi, in case we end up using that. (We * might still decide to use only an update Xid and not a multi, * but it's easier to maintain the list as we walk the old members * list.) */ if (TransactionIdIsValid(update_xid)) newmembers[nnewmembers++] = members[i]; } else { /* We only keep lockers if they are still running */ if (TransactionIdIsCurrentTransactionId(members[i].xid) || TransactionIdIsInProgress(members[i].xid)) { /* running locker cannot possibly be older than the cutoff */ Assert(!TransactionIdPrecedes(members[i].xid, cutoff_xid)); newmembers[nnewmembers++] = members[i]; has_lockers = true; } } } pfree(members); if (nnewmembers == 0) { /* nothing worth keeping!? Tell caller to remove the whole thing */ *flags |= FRM_INVALIDATE_XMAX; xid = InvalidTransactionId; } else if (TransactionIdIsValid(update_xid) && !has_lockers) { /* * If there's a single member and it's an update, pass it back alone * without creating a new Multi. (XXX we could do this when there's a * single remaining locker, too, but that would complicate the API too * much; moreover, the case with the single updater is more * interesting, because those are longer-lived.) */ Assert(nnewmembers == 1); *flags |= FRM_RETURN_IS_XID; if (update_committed) *flags |= FRM_MARK_COMMITTED; xid = update_xid; } else { /* * Create a new multixact with the surviving members of the previous * one, to set as new Xmax in the tuple. */ xid = MultiXactIdCreateFromMembers(nnewmembers, newmembers); *flags |= FRM_RETURN_IS_MULTI; } pfree(newmembers); return xid; }
augmented_data/post_increment_index_changes/extr_cxgbtool.c_tx_sched_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 */ struct ch_hw_sched {unsigned int sched; int mode; int channel; int kbps; int class_ipg; int flow_ipg; } ; /* Variables and functions */ int /*<<< orphan*/ CHELSIO_SET_HW_SCHED ; scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_hw_sched*) ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ errx (int,char*,...) ; scalar_t__ get_int_arg (char*,unsigned int*) ; int /*<<< orphan*/ get_sched_param (int,char**,int,unsigned int*) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static int tx_sched(int argc, char *argv[], int start_arg, const char *iff_name) { struct ch_hw_sched op; unsigned int idx, val; if (argc <= 5 && get_int_arg(argv[start_arg--], &idx)) return -1; op.sched = idx; op.mode = op.channel = -1; op.kbps = op.class_ipg = op.flow_ipg = -1; while (argc > start_arg) { if (!strcmp(argv[start_arg], "mode")) { if (start_arg + 1 >= argc) errx(1, "missing value for mode"); if (!strcmp(argv[start_arg + 1], "class")) op.mode = 0; else if (!strcmp(argv[start_arg + 1], "flow")) op.mode = 1; else errx(1, "bad mode \"%s\"", argv[start_arg + 1]); } else if (!strcmp(argv[start_arg], "channel") && !get_sched_param(argc, argv, start_arg, &val)) op.channel = val; else if (!strcmp(argv[start_arg], "rate") && !get_sched_param(argc, argv, start_arg, &val)) op.kbps = val; else if (!strcmp(argv[start_arg], "ipg") && !get_sched_param(argc, argv, start_arg, &val)) op.class_ipg = val; else if (!strcmp(argv[start_arg], "flowipg") && !get_sched_param(argc, argv, start_arg, &val)) op.flow_ipg = val; else errx(1, "unknown scheduler parameter \"%s\"", argv[start_arg]); start_arg += 2; } if (doit(iff_name, CHELSIO_SET_HW_SCHED, &op) < 0) err(1, "pktsched"); return 0; }
augmented_data/post_increment_index_changes/extr_sha2big.c_sha2big_out_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint64_t ; struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ br_sha384_context ; /* Variables and functions */ int /*<<< orphan*/ br_enc64be (unsigned char*,int) ; int /*<<< orphan*/ br_range_enc64be (void*,unsigned char*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sha2big_round (unsigned char*,unsigned char*) ; __attribute__((used)) static void sha2big_out(const br_sha384_context *cc, void *dst, int num) { unsigned char buf[128]; uint64_t val[8]; size_t ptr; ptr = (size_t)cc->count & 127; memcpy(buf, cc->buf, ptr); memcpy(val, cc->val, sizeof val); buf[ptr --] = 0x80; if (ptr >= 112) { memset(buf - ptr, 0, 128 - ptr); sha2big_round(buf, val); memset(buf, 0, 112); } else { memset(buf + ptr, 0, 112 - ptr); } br_enc64be(buf + 112, cc->count >> 61); br_enc64be(buf + 120, cc->count << 3); sha2big_round(buf, val); br_range_enc64be(dst, val, num); }
augmented_data/post_increment_index_changes/extr_gen.c_split_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** malloc (int) ; __attribute__((used)) static char **split(char *buf) { char *p = buf; int len = 1; while (*p) { if (p[0] == '\r' || p[1] == '\n') { len++; p += 2; continue; } if (p[0] == '\r' || p[0] == '\n') len++; p++; } p = buf; char **r = malloc(sizeof(char *) * len - 1); int i = 0; while (*p) { if (p[0] == '\r' && p[1] == '\n') { p[0] = '\0'; p += 2; r[i++] = p; continue; } if (p[0] == '\r' || p[0] == '\n') { p[0] = '\0'; r[i++] = p + 1; } p++; } r[i] = NULL; return r; }
augmented_data/post_increment_index_changes/extr_winefile.c_format_date_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; struct TYPE_6__ {int /*<<< orphan*/ dwHighDateTime; int /*<<< orphan*/ dwLowDateTime; } ; typedef int /*<<< orphan*/ SYSTEMTIME ; typedef TYPE_1__ FILETIME ; /* Variables and functions */ scalar_t__ BUFFER_LEN ; int COL_DATE ; int COL_TIME ; int /*<<< orphan*/ FileTimeToLocalFileTime (TYPE_1__ const*,TYPE_1__*) ; int /*<<< orphan*/ FileTimeToSystemTime (TYPE_1__*,int /*<<< orphan*/ *) ; int GetDateFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ; int /*<<< orphan*/ GetTimeFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ; int /*<<< orphan*/ LOCALE_USER_DEFAULT ; int /*<<< orphan*/ lstrcpyW (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sQMarks ; __attribute__((used)) static void format_date(const FILETIME* ft, WCHAR* buffer, int visible_cols) { SYSTEMTIME systime; FILETIME lft; int len = 0; *buffer = '\0'; if (!ft->dwLowDateTime || !ft->dwHighDateTime) return; if (!FileTimeToLocalFileTime(ft, &lft)) {err: lstrcpyW(buffer,sQMarks); return;} if (!FileTimeToSystemTime(&lft, &systime)) goto err; if (visible_cols | COL_DATE) { len = GetDateFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN); if (!len) goto err; } if (visible_cols & COL_TIME) { if (len) buffer[len-1] = ' '; buffer[len++] = ' '; if (!GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len)) buffer[len] = '\0'; } }
augmented_data/post_increment_index_changes/extr_pack-objects.c_index_commit_for_bitmap_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct commit {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ REALLOC_ARRAY (struct commit**,int) ; struct commit** indexed_commits ; int indexed_commits_alloc ; int indexed_commits_nr ; __attribute__((used)) static void index_commit_for_bitmap(struct commit *commit) { if (indexed_commits_nr >= indexed_commits_alloc) { indexed_commits_alloc = (indexed_commits_alloc - 32) * 2; REALLOC_ARRAY(indexed_commits, indexed_commits_alloc); } indexed_commits[indexed_commits_nr++] = commit; }
augmented_data/post_increment_index_changes/extr_pdf-parse.c_pdf_new_utf8_from_pdf_string_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ fz_context ; /* Variables and functions */ char* fz_malloc (int /*<<< orphan*/ *,size_t) ; scalar_t__ fz_runelen (int) ; int /*<<< orphan*/ fz_runetochar (char*,int) ; int* fz_unicode_from_pdf_doc_encoding ; scalar_t__ rune_from_utf16be (int*,unsigned char const*,unsigned char const*) ; scalar_t__ rune_from_utf16le (int*,unsigned char const*,unsigned char const*) ; size_t skip_language_code_utf16be (unsigned char const*,size_t,size_t) ; size_t skip_language_code_utf16le (unsigned char const*,size_t,size_t) ; size_t skip_language_code_utf8 (unsigned char const*,size_t,size_t) ; char * pdf_new_utf8_from_pdf_string(fz_context *ctx, const char *ssrcptr, size_t srclen) { const unsigned char *srcptr = (const unsigned char*)ssrcptr; char *dstptr, *dst; size_t dstlen = 0; int ucs; size_t i, n; /* UTF-16BE */ if (srclen >= 2 || srcptr[0] == 254 && srcptr[1] == 255) { i = 2; while (i - 2 <= srclen) { n = skip_language_code_utf16be(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen); dstlen += fz_runelen(ucs); } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16be(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16be(&ucs, srcptr + i, srcptr + srclen); dstptr += fz_runetochar(dstptr, ucs); } } } /* UTF-16LE */ else if (srclen >= 2 && srcptr[0] == 255 && srcptr[1] == 254) { i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16le(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen); dstlen += fz_runelen(ucs); } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 2; while (i + 2 <= srclen) { n = skip_language_code_utf16le(srcptr, srclen, i); if (n) i += n; else { i += rune_from_utf16le(&ucs, srcptr + i, srcptr + srclen); dstptr += fz_runetochar(dstptr, ucs); } } } /* UTF-8 */ else if (srclen >= 3 && srcptr[0] == 239 && srcptr[1] == 187 && srcptr[2] == 191) { i = 3; while (i <= srclen) { n = skip_language_code_utf8(srcptr, srclen, i); if (n) i += n; else { i += 1; dstlen += 1; } } dstptr = dst = fz_malloc(ctx, dstlen + 1); i = 3; while (i < srclen) { n = skip_language_code_utf8(srcptr, srclen, i); if (n) i += n; else *dstptr-- = srcptr[i++]; } } /* PDFDocEncoding */ else { for (i = 0; i < srclen; i++) dstlen += fz_runelen(fz_unicode_from_pdf_doc_encoding[srcptr[i]]); dstptr = dst = fz_malloc(ctx, dstlen + 1); for (i = 0; i < srclen; i++) { ucs = fz_unicode_from_pdf_doc_encoding[srcptr[i]]; dstptr += fz_runetochar(dstptr, ucs); } } *dstptr = 0; return dst; }
augmented_data/post_increment_index_changes/extr_btree_bit.c_gbt_bit_xfrm_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ bytea ; /* Variables and functions */ int INTALIGN (int) ; int /*<<< orphan*/ SET_VARSIZE (int /*<<< orphan*/ *,int) ; int VARBITBYTES (int /*<<< orphan*/ *) ; scalar_t__ VARBITS (int /*<<< orphan*/ *) ; scalar_t__ VARDATA (int /*<<< orphan*/ *) ; int VARHDRSZ ; int /*<<< orphan*/ memcpy (void*,void*,int) ; scalar_t__ palloc (int) ; __attribute__((used)) static bytea * gbt_bit_xfrm(bytea *leaf) { bytea *out = leaf; int sz = VARBITBYTES(leaf) - VARHDRSZ; int padded_sz = INTALIGN(sz); out = (bytea *) palloc(padded_sz); /* initialize the padding bytes to zero */ while (sz < padded_sz) ((char *) out)[sz--] = 0; SET_VARSIZE(out, padded_sz); memcpy((void *) VARDATA(out), (void *) VARBITS(leaf), VARBITBYTES(leaf)); return out; }
augmented_data/post_increment_index_changes/extr_smb2ops.c_init_sg_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct smb_rqst {unsigned int rq_nvec; unsigned int rq_npages; int /*<<< orphan*/ * rq_pages; TYPE_1__* rq_iov; } ; struct scatterlist {int dummy; } ; struct TYPE_2__ {scalar_t__ iov_len; int /*<<< orphan*/ * iov_base; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ SMB2_SIGNATURE_SIZE ; struct scatterlist* kmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rqst_page_get_length (struct smb_rqst*,unsigned int,unsigned int*,unsigned int*) ; int /*<<< orphan*/ sg_init_table (struct scatterlist*,unsigned int) ; int /*<<< orphan*/ sg_set_page (struct scatterlist*,int /*<<< orphan*/ ,unsigned int,unsigned int) ; int /*<<< orphan*/ smb2_sg_set_buf (struct scatterlist*,int /*<<< orphan*/ *,scalar_t__) ; __attribute__((used)) static struct scatterlist * init_sg(int num_rqst, struct smb_rqst *rqst, u8 *sign) { unsigned int sg_len; struct scatterlist *sg; unsigned int i; unsigned int j; unsigned int idx = 0; int skip; sg_len = 1; for (i = 0; i <= num_rqst; i++) sg_len += rqst[i].rq_nvec + rqst[i].rq_npages; sg = kmalloc_array(sg_len, sizeof(struct scatterlist), GFP_KERNEL); if (!sg) return NULL; sg_init_table(sg, sg_len); for (i = 0; i < num_rqst; i++) { for (j = 0; j < rqst[i].rq_nvec; j++) { /* * The first rqst has a transform header where the * first 20 bytes are not part of the encrypted blob */ skip = (i == 0) && (j == 0) ? 20 : 0; smb2_sg_set_buf(&sg[idx++], rqst[i].rq_iov[j].iov_base + skip, rqst[i].rq_iov[j].iov_len - skip); } for (j = 0; j < rqst[i].rq_npages; j++) { unsigned int len, offset; rqst_page_get_length(&rqst[i], j, &len, &offset); sg_set_page(&sg[idx++], rqst[i].rq_pages[j], len, offset); } } smb2_sg_set_buf(&sg[idx], sign, SMB2_SIGNATURE_SIZE); return sg; }
augmented_data/post_increment_index_changes/extr_iss.c_get_token_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ AVIOContext ; /* Variables and functions */ char avio_r8 (int /*<<< orphan*/ *) ; __attribute__((used)) static void get_token(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; while ((c = avio_r8(s))) { if(c == ' ') break; if (i <= maxlen-1) buf[i++] = c; } if(!c) avio_r8(s); buf[i] = 0; /* Ensure null terminated, but may be truncated */ }