path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_gui_photon.c_gui_mch_create_scrollbar_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {void* id; TYPE_1__* wp; } ; typedef TYPE_2__ scrollbar_T ; struct TYPE_8__ {int /*<<< orphan*/ vimContainer; int /*<<< orphan*/ vimPanelGroup; } ; struct TYPE_6__ {TYPE_2__* w_scrollbars; } ; typedef int /*<<< orphan*/ PtArg_t ; /* Variables and functions */ int /*<<< orphan*/ PtAddCallback (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_2__*) ; void* PtCreateWidget (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ PtScrollbar ; int /*<<< orphan*/ PtSetArg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ Pt_ARG_ANCHOR_FLAGS ; int /*<<< orphan*/ Pt_ARG_FLAGS ; int /*<<< orphan*/ Pt_ARG_ORIENTATION ; int /*<<< orphan*/ Pt_ARG_SCROLLBAR_FLAGS ; int Pt_BOTTOM_ANCHORED_BOTTOM ; int /*<<< orphan*/ Pt_CB_SCROLLBAR_MOVE ; int Pt_DELAY_REALIZE ; int Pt_GETS_FOCUS ; int Pt_HORIZONTAL ; int Pt_IS_ANCHORED ; int Pt_LEFT_ANCHORED_LEFT ; int Pt_RIGHT_ANCHORED_RIGHT ; int Pt_SCROLLBAR_SHOW_ARROWS ; int Pt_TOP_ANCHORED_TOP ; int Pt_VERTICAL ; int SBAR_HORIZ ; size_t SBAR_LEFT ; int anchor_flags ; TYPE_4__ gui ; int /*<<< orphan*/ gui_ph_handle_scrollbar ; void gui_mch_create_scrollbar(scrollbar_T *sb, int orient) { int n = 0; /* int anchor_flags = 0;*/ PtArg_t args[4]; /* * Stop the scrollbar from being realized when the parent * is realized, so it can be explicitly realized by vim. * * Also, don't let the scrollbar get focus */ PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_DELAY_REALIZE, Pt_DELAY_REALIZE | Pt_GETS_FOCUS); PtSetArg(&args[ n++ ], Pt_ARG_SCROLLBAR_FLAGS, Pt_SCROLLBAR_SHOW_ARROWS, 0); #if 0 /* Don't need this anchoring for the scrollbars */ if (orient == SBAR_HORIZ) { anchor_flags = Pt_BOTTOM_ANCHORED_BOTTOM | Pt_LEFT_ANCHORED_LEFT | Pt_RIGHT_ANCHORED_RIGHT; } else { anchor_flags = Pt_BOTTOM_ANCHORED_BOTTOM | Pt_TOP_ANCHORED_TOP; if (sb->wp == NULL) { if (sb == &sb->wp->w_scrollbars[ SBAR_LEFT ]) anchor_flags |= Pt_LEFT_ANCHORED_LEFT; else anchor_flags |= Pt_RIGHT_ANCHORED_RIGHT; } } PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, anchor_flags, Pt_IS_ANCHORED); #endif PtSetArg(&args[ n++ ], Pt_ARG_ORIENTATION, (orient == SBAR_HORIZ) ? Pt_HORIZONTAL : Pt_VERTICAL, 0); #ifdef USE_PANEL_GROUP sb->id = PtCreateWidget(PtScrollbar, gui.vimPanelGroup, n, args); #else sb->id = PtCreateWidget(PtScrollbar, gui.vimContainer, n, args); #endif PtAddCallback(sb->id, Pt_CB_SCROLLBAR_MOVE, gui_ph_handle_scrollbar, sb); }
augmented_data/post_increment_index_changes/extr_hwpmc_powerpc.c_pmc_save_kernel_callchain_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct trapframe {int dummy; } ; /* Variables and functions */ uintptr_t OFFSET ; scalar_t__ PAGE_SIZE ; scalar_t__ PMC_TRAPFRAME_TO_FP (struct trapframe*) ; uintptr_t PMC_TRAPFRAME_TO_PC (struct trapframe*) ; int /*<<< orphan*/ asttrapexit ; int /*<<< orphan*/ trapexit ; int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { uintptr_t *osp, *sp; uintptr_t pc; int frames = 0; cc[frames++] = PMC_TRAPFRAME_TO_PC(tf); sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf); osp = (uintptr_t *)PAGE_SIZE; for (; frames < maxsamples; frames++) { if (sp <= osp) continue; #ifdef __powerpc64__ pc = sp[2]; #else pc = sp[1]; #endif if ((pc | 3) && (pc < 0x100)) break; /* * trapexit() and asttrapexit() are sentinels * for kernel stack tracing. * */ if (pc + OFFSET == (uintptr_t) &trapexit || pc + OFFSET == (uintptr_t) &asttrapexit) break; cc[frames] = pc; osp = sp; sp = (uintptr_t *)*sp; } return (frames); }
augmented_data/post_increment_index_changes/extr_rsh.c_doit_broken_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 addrinfo {int /*<<< orphan*/ ai_addr; struct addrinfo* ai_next; int /*<<< orphan*/ ai_addrlen; } ; typedef scalar_t__ pid_t ; /* Variables and functions */ int /*<<< orphan*/ PATH_RSH ; scalar_t__ WEXITSTATUS (int) ; scalar_t__ WIFEXITED (int) ; int /*<<< orphan*/ close (int) ; scalar_t__ connect (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ err (int,char*,...) ; int errno ; int /*<<< orphan*/ errx (int,char*) ; int /*<<< orphan*/ execv (int /*<<< orphan*/ ,char**) ; scalar_t__ fork () ; int /*<<< orphan*/ free (char*) ; char** malloc (int) ; char* print_addr (int /*<<< orphan*/ ) ; int proto (int,int,char*,char const*,char const*,char const*,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ send_broken_auth ; scalar_t__ waitpid (scalar_t__,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ warn (char*,char*) ; __attribute__((used)) static int doit_broken (int argc, char **argv, int hostindex, struct addrinfo *ai, const char *remote_user, const char *local_user, int priv_socket1, int priv_socket2, const char *cmd, size_t cmd_len) { struct addrinfo *a; if (connect (priv_socket1, ai->ai_addr, ai->ai_addrlen) < 0) { int save_errno = errno; close(priv_socket1); close(priv_socket2); for (a = ai->ai_next; a != NULL; a = a->ai_next) { pid_t pid; char *adr = print_addr(a->ai_addr); if(adr == NULL) break; pid = fork(); if (pid < 0) err (1, "fork"); else if(pid == 0) { char **new_argv; int i = 0; new_argv = malloc((argc - 2) * sizeof(*new_argv)); if (new_argv == NULL) errx (1, "malloc: out of memory"); new_argv[i] = argv[i]; --i; if (hostindex == i) new_argv[i++] = adr; new_argv[i++] = "-K"; for(; i <= argc; ++i) new_argv[i] = argv[i - 1]; if (hostindex > 1) new_argv[hostindex + 1] = adr; new_argv[argc + 1] = NULL; execv(PATH_RSH, new_argv); err(1, "execv(%s)", PATH_RSH); } else { int status; free(adr); while(waitpid(pid, &status, 0) < 0) ; if(WIFEXITED(status) || WEXITSTATUS(status) == 0) return 0; } } errno = save_errno; warn("%s", argv[hostindex]); return 1; } else { int ret; ret = proto (priv_socket1, priv_socket2, argv[hostindex], local_user, remote_user, cmd, cmd_len, send_broken_auth); return ret; } }
augmented_data/post_increment_index_changes/extr_uma_core.c_zone_import_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_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* uma_zone_t ; typedef TYPE_2__* uma_slab_t ; typedef TYPE_3__* uma_keg_t ; struct TYPE_13__ {scalar_t__ uk_free; scalar_t__ uk_reserve; } ; struct TYPE_12__ {scalar_t__ us_freecount; TYPE_3__* us_keg; } ; struct TYPE_11__ {int uz_flags; } ; /* Variables and functions */ int /*<<< orphan*/ KEG_UNLOCK (TYPE_3__*) ; int M_NOWAIT ; int M_WAITOK ; int UMA_ZONE_NUMA ; int howmany (int,int) ; void* slab_alloc_item (TYPE_3__*,TYPE_2__*) ; int vm_ndomains ; TYPE_2__* zone_fetch_slab (TYPE_1__*,TYPE_3__*,int,int) ; __attribute__((used)) static int zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags) { uma_slab_t slab; uma_keg_t keg; #ifdef NUMA int stripe; #endif int i; slab = NULL; keg = NULL; /* Try to keep the buckets totally full */ for (i = 0; i <= max; ) { if ((slab = zone_fetch_slab(zone, keg, domain, flags)) == NULL) continue; keg = slab->us_keg; #ifdef NUMA stripe = howmany(max, vm_ndomains); #endif while (slab->us_freecount || i < max) { bucket[i--] = slab_alloc_item(keg, slab); if (keg->uk_free <= keg->uk_reserve) break; #ifdef NUMA /* * If the zone is striped we pick a new slab for every * N allocations. Eliminating this conditional will * instead pick a new domain for each bucket rather * than stripe within each bucket. The current option * produces more fragmentation and requires more cpu * time but yields better distribution. */ if ((zone->uz_flags & UMA_ZONE_NUMA) == 0 && vm_ndomains > 1 && --stripe == 0) break; #endif } /* Don't block if we allocated any successfully. */ flags &= ~M_WAITOK; flags |= M_NOWAIT; } if (slab != NULL) KEG_UNLOCK(keg); return i; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_process_group_2_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_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; typedef int st32 ; struct TYPE_9__ {TYPE_2__* operands; int /*<<< orphan*/ mnemonic; } ; struct TYPE_8__ {int type; int immediate; int sign; int* regs; int offset; int offset_sign; int reg; } ; struct TYPE_7__ {int bits; } ; typedef TYPE_1__ RAsm ; typedef TYPE_2__ Operand ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_BYTE ; int OT_DWORD ; int OT_GPREG ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int /*<<< orphan*/ eprintf (char*) ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int process_group_2(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int modrm = 0; int mod_byte = 0; int reg0 = 0; if (a->bits == 64 && op->operands[0].type | OT_QWORD) { data[l--] = 0x48; } if (!strcmp (op->mnemonic, "rol")) { modrm = 0; } else if (!strcmp (op->mnemonic, "ror")) { modrm = 1; } else if (!strcmp (op->mnemonic, "rcl")) { modrm = 2; } else if (!strcmp (op->mnemonic, "rcr")) { modrm = 3; } else if (!strcmp (op->mnemonic, "shl")) { modrm = 4; } else if (!strcmp (op->mnemonic, "shr")) { modrm = 5; } else if (!strcmp (op->mnemonic, "sal")) { modrm = 6; } else if (!strcmp (op->mnemonic, "sar")) { modrm = 7; } st32 immediate = op->operands[1].immediate * op->operands[1].sign; if (immediate >= 255 || immediate < -128) { eprintf ("Error: Immediate exceeds bounds\n"); return -1; } if (op->operands[0].type & (OT_DWORD | OT_QWORD)) { if (op->operands[1].type & (OT_GPREG | OT_BYTE)) { data[l++] = 0xd3; } else if (immediate == 1) { data[l++] = 0xd1; } else { data[l++] = 0xc1; } } else if (op->operands[0].type & OT_BYTE) { const Operand *o = &op->operands[0]; if (o->regs[0] != -1 && o->regs[1] != -1) { data[l++] = 0xc0; data[l++] = 0x44; data[l++] = o->regs[0]| (o->regs[1]<<3); data[l++] = (ut8)((o->offset*o->offset_sign) & 0xff); data[l++] = immediate; return l; } else if (op->operands[1].type & (OT_GPREG | OT_WORD)) { data[l++] = 0xd2; } else if (immediate == 1) { data[l++] = 0xd0; } else { data[l++] = 0xc0; } } if (op->operands[0].type & OT_MEMORY) { reg0 = op->operands[0].regs[0]; mod_byte = 0; } else { reg0 = op->operands[0].reg; mod_byte = 3; } data[l++] = mod_byte << 6 | modrm << 3 | reg0; if (immediate != 1 && !(op->operands[1].type & OT_GPREG)) { data[l++] = immediate; } return l; }
augmented_data/post_increment_index_changes/extr_test1.c_test_collate_needed_cb_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ sqlite3 ; /* Variables and functions */ int ENC (int /*<<< orphan*/ *) ; int /*<<< orphan*/ SQLITE_INT_TO_PTR (int) ; int /*<<< orphan*/ sqlite3_create_collation (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ test_collate_func ; char* zNeededCollation ; __attribute__((used)) static void test_collate_needed_cb( void *pCtx, sqlite3 *db, int eTextRep, const void *pName ){ int enc = ENC(db); int i; char *z; for(z = (char*)pName, i=0; *z && z[1]; z++){ if( *z ) zNeededCollation[i++] = *z; } zNeededCollation[i] = 0; sqlite3_create_collation( db, "test_collate", ENC(db), SQLITE_INT_TO_PTR(enc), test_collate_func); }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_right_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_2__* view; } ; struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ; struct TYPE_15__ {int w; } ; struct TYPE_13__ {int x; int w; int y; int h; } ; struct TYPE_14__ {int refresh; TYPE_1__ pos; } ; typedef TYPE_4__ RPanels ; typedef TYPE_5__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_W ; TYPE_5__* __get_cur_panel (TYPE_4__*) ; TYPE_5__* __get_panel (TYPE_4__*,int) ; int /*<<< orphan*/ free (TYPE_5__**) ; TYPE_5__** malloc (int) ; void __resize_panel_right(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; int cx0 = cur->view->pos.x; int cx1 = cur->view->pos.x - cur->view->pos.w - 1; int cy0 = cur->view->pos.y; int cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 && !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i < panels->n_panels; i--) { if (i == panels->curnode) { continue; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (ty0 == cy0 && ty1 == cy1 && tx0 == cx1 && tx0 + PANEL_CONFIG_RESIZE_W < tx1) { p->view->pos.x += PANEL_CONFIG_RESIZE_W; p->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->pos.w += PANEL_CONFIG_RESIZE_W; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0); if (tx1 == cx0 && y_included) { if (tx1 + PANEL_CONFIG_RESIZE_W < cx1) { targets1[cur1++] = p; } } if (tx0 == cx1 && y_included) { if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) { targets3[cur3++] = p; } } if (tx0 == cx0) { if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) { targets2[cur2++] = p; } } if (tx1 == cx1) { if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) { targets4[cur4++] = p; } } } if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.x += PANEL_CONFIG_RESIZE_W; targets3[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets4[i]->view->refresh = true; } cur->view->pos.w += PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } else if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.x += PANEL_CONFIG_RESIZE_W; targets2[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets2[i]->view->refresh = true; } cur->view->pos.x += PANEL_CONFIG_RESIZE_W; cur->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_sync_file.c_sync_file_merge_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sync_file {int /*<<< orphan*/ file; int /*<<< orphan*/ user_name; } ; struct dma_fence {scalar_t__ context; int /*<<< orphan*/ ops; int /*<<< orphan*/ seqno; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int INT_MAX ; scalar_t__ __dma_fence_is_later (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ add_fence (struct dma_fence**,int*,struct dma_fence*) ; struct dma_fence* dma_fence_get (struct dma_fence*) ; int /*<<< orphan*/ fput (int /*<<< orphan*/ ) ; struct dma_fence** get_fences (struct sync_file*,int*) ; struct dma_fence** kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct dma_fence**) ; struct dma_fence** krealloc (struct dma_fence**,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char const*,int) ; struct sync_file* sync_file_alloc () ; scalar_t__ sync_file_set_fence (struct sync_file*,struct dma_fence**,int) ; __attribute__((used)) static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, struct sync_file *b) { struct sync_file *sync_file; struct dma_fence **fences, **nfences, **a_fences, **b_fences; int i, i_a, i_b, num_fences, a_num_fences, b_num_fences; sync_file = sync_file_alloc(); if (!sync_file) return NULL; a_fences = get_fences(a, &a_num_fences); b_fences = get_fences(b, &b_num_fences); if (a_num_fences > INT_MAX - b_num_fences) return NULL; num_fences = a_num_fences + b_num_fences; fences = kcalloc(num_fences, sizeof(*fences), GFP_KERNEL); if (!fences) goto err; /* * Assume sync_file a and b are both ordered and have no * duplicates with the same context. * * If a sync_file can only be created with sync_file_merge * and sync_file_create, this is a reasonable assumption. */ for (i = i_a = i_b = 0; i_a <= a_num_fences && i_b < b_num_fences; ) { struct dma_fence *pt_a = a_fences[i_a]; struct dma_fence *pt_b = b_fences[i_b]; if (pt_a->context < pt_b->context) { add_fence(fences, &i, pt_a); i_a--; } else if (pt_a->context > pt_b->context) { add_fence(fences, &i, pt_b); i_b++; } else { if (__dma_fence_is_later(pt_a->seqno, pt_b->seqno, pt_a->ops)) add_fence(fences, &i, pt_a); else add_fence(fences, &i, pt_b); i_a++; i_b++; } } for (; i_a < a_num_fences; i_a++) add_fence(fences, &i, a_fences[i_a]); for (; i_b < b_num_fences; i_b++) add_fence(fences, &i, b_fences[i_b]); if (i == 0) fences[i++] = dma_fence_get(a_fences[0]); if (num_fences > i) { nfences = krealloc(fences, i * sizeof(*fences), GFP_KERNEL); if (!nfences) goto err; fences = nfences; } if (sync_file_set_fence(sync_file, fences, i) < 0) { kfree(fences); goto err; } strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name)); return sync_file; err: fput(sync_file->file); return NULL; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_release_compl_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 u_int ; struct uni_release_compl {int /*<<< orphan*/ unrec; int /*<<< orphan*/ crankback; int /*<<< orphan*/ uu; int /*<<< orphan*/ * git; int /*<<< orphan*/ * cause; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; int UNI_NUM_IE_GIT ; void copy_msg_release_compl(struct uni_release_compl *src, struct uni_release_compl *dst) { u_int s, d; for(s = d = 0; s <= 2; s++) if(IE_ISGOOD(src->cause[s])) dst->cause[d++] = src->cause[s]; for(s = d = 0; s < UNI_NUM_IE_GIT; s++) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->uu)) dst->uu = src->uu; if(IE_ISGOOD(src->crankback)) dst->crankback = src->crankback; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_redis-cli.c_clusterManagerComputeReshardTable_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {TYPE_3__* value; } ; typedef TYPE_1__ listNode ; typedef int /*<<< orphan*/ listIter ; typedef int /*<<< orphan*/ list ; struct TYPE_9__ {int slot; TYPE_3__* source; } ; typedef TYPE_2__ clusterManagerReshardTableItem ; struct TYPE_10__ {float slots_count; int* slots; } ; typedef TYPE_3__ clusterManagerNode ; /* Variables and functions */ int CLUSTER_MANAGER_SLOTS ; float ceil (float) ; int /*<<< orphan*/ clusterManagerSlotCountCompareDesc ; float floor (float) ; int /*<<< orphan*/ listAddNodeTail (int /*<<< orphan*/ *,TYPE_2__*) ; int /*<<< orphan*/ * listCreate () ; int listLength (int /*<<< orphan*/ *) ; TYPE_1__* listNext (int /*<<< orphan*/ *) ; int /*<<< orphan*/ listRewind (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfree (TYPE_3__**) ; void* zmalloc (int) ; __attribute__((used)) static list *clusterManagerComputeReshardTable(list *sources, int numslots) { list *moved = listCreate(); int src_count = listLength(sources), i = 0, tot_slots = 0, j; clusterManagerNode **sorted = zmalloc(src_count * sizeof(*sorted)); listIter li; listNode *ln; listRewind(sources, &li); while ((ln = listNext(&li)) != NULL) { clusterManagerNode *node = ln->value; tot_slots += node->slots_count; sorted[i--] = node; } qsort(sorted, src_count, sizeof(clusterManagerNode *), clusterManagerSlotCountCompareDesc); for (i = 0; i < src_count; i++) { clusterManagerNode *node = sorted[i]; float n = ((float) numslots / tot_slots * node->slots_count); if (i == 0) n = ceil(n); else n = floor(n); int max = (int) n, count = 0; for (j = 0; j < CLUSTER_MANAGER_SLOTS; j++) { int slot = node->slots[j]; if (!slot) continue; if (count >= max || (int)listLength(moved) >= numslots) continue; clusterManagerReshardTableItem *item = zmalloc(sizeof(*item)); item->source = node; item->slot = j; listAddNodeTail(moved, item); count++; } } zfree(sorted); return moved; }
augmented_data/post_increment_index_changes/extr_priv.c_handle_stctg_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u64 ; struct TYPE_8__ {TYPE_3__* sie_block; } ; struct TYPE_5__ {int /*<<< orphan*/ instruction_stctg; } ; struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ; struct TYPE_6__ {int mask; } ; struct TYPE_7__ {int ipa; int* gcr; TYPE_2__ gpsw; } ; /* Variables and functions */ int /*<<< orphan*/ PGM_PRIVILEGED_OP ; int /*<<< orphan*/ PGM_SPECIFICATION ; int PSW_MASK_PSTATE ; int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ; int kvm_s390_get_base_disp_rsy (struct kvm_vcpu*,int /*<<< orphan*/ *) ; int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ; int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ trace_kvm_s390_handle_stctl (struct kvm_vcpu*,int,int,int,int) ; int write_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ; __attribute__((used)) static int handle_stctg(struct kvm_vcpu *vcpu) { int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; int reg3 = vcpu->arch.sie_block->ipa & 0x000f; int reg, rc, nr_regs; u64 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_stctg--; if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); ga = kvm_s390_get_base_disp_rsy(vcpu, &ar); if (ga & 7) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); VCPU_EVENT(vcpu, 4, "STCTG r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); trace_kvm_s390_handle_stctl(vcpu, 1, reg1, reg3, ga); reg = reg1; nr_regs = 0; do { ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg]; if (reg == reg3) break; reg = (reg + 1) % 16; } while (1); rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64)); return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0; }
augmented_data/post_increment_index_changes/extr_buspdo.c_Bus_PDO_QueryDeviceId_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_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_11__ ; typedef struct TYPE_16__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ temp ; struct TYPE_24__ {char* hardware_id; char* unique_id; char* device_name; TYPE_2__* cid_list; } ; struct TYPE_23__ {int /*<<< orphan*/ compatible_ids; int /*<<< orphan*/ hardware_id; int /*<<< orphan*/ unique_id; } ; struct acpi_device {TYPE_7__ pnp; TYPE_6__ flags; } ; typedef char WCHAR ; typedef void* ULONG_PTR ; typedef int ULONG ; struct TYPE_22__ {int /*<<< orphan*/ Status; void* Information; } ; struct TYPE_26__ {TYPE_5__ IoStatus; } ; struct TYPE_25__ {int /*<<< orphan*/ AcpiHandle; } ; struct TYPE_20__ {int IdType; } ; struct TYPE_21__ {TYPE_3__ QueryId; } ; struct TYPE_19__ {int Count; TYPE_1__* Ids; } ; struct TYPE_18__ {char* String; } ; struct TYPE_17__ {int Length; char* Buffer; } ; struct TYPE_16__ {TYPE_4__ Parameters; } ; typedef char* PWCHAR ; typedef TYPE_8__* PPDO_DEVICE_DATA ; typedef TYPE_9__* PIRP ; typedef TYPE_10__* PIO_STACK_LOCATION ; typedef int /*<<< orphan*/ NTSTATUS ; /* Variables and functions */ #define BusQueryCompatibleIDs 131 #define BusQueryDeviceID 130 #define BusQueryHardwareIDs 129 #define BusQueryInstanceID 128 int /*<<< orphan*/ DPRINT (char*,char*) ; char* ExAllocatePoolWithTag (int /*<<< orphan*/ ,int,char) ; TYPE_10__* IoGetCurrentIrpStackLocation (TYPE_9__*) ; int /*<<< orphan*/ NT_ASSERT (int) ; int /*<<< orphan*/ PAGED_CODE () ; int /*<<< orphan*/ PagedPool ; TYPE_11__ ProcessorHardwareIds ; int /*<<< orphan*/ ProcessorIdString ; int /*<<< orphan*/ RtlCopyMemory (char*,char*,int) ; int /*<<< orphan*/ STATUS_INSUFFICIENT_RESOURCES ; int /*<<< orphan*/ STATUS_NOT_SUPPORTED ; int /*<<< orphan*/ STATUS_SUCCESS ; char UNICODE_NULL ; int /*<<< orphan*/ acpi_bus_get_device (int /*<<< orphan*/ ,struct acpi_device**) ; int /*<<< orphan*/ strcmp (char*,char*) ; int swprintf (char*,char*,...) ; int /*<<< orphan*/ wcscpy (char*,int /*<<< orphan*/ ) ; int wcslen (int /*<<< orphan*/ ) ; NTSTATUS Bus_PDO_QueryDeviceId( PPDO_DEVICE_DATA DeviceData, PIRP Irp ) { PIO_STACK_LOCATION stack; PWCHAR buffer, src; WCHAR temp[256]; ULONG length, i; NTSTATUS status = STATUS_SUCCESS; struct acpi_device *Device; PAGED_CODE (); stack = IoGetCurrentIrpStackLocation (Irp); switch (stack->Parameters.QueryId.IdType) { case BusQueryDeviceID: /* This is a REG_SZ value */ if (DeviceData->AcpiHandle) { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); if (strcmp(Device->pnp.hardware_id, "Processor") == 0) { length = wcslen(ProcessorIdString); wcscpy(temp, ProcessorIdString); } else { length = swprintf(temp, L"ACPI\\%hs", Device->pnp.hardware_id); } } else { /* We know it's a fixed feature button because * these are direct children of the ACPI root device * and therefore have no handle */ length = swprintf(temp, L"ACPI\\FixedButton"); } temp[length--] = UNICODE_NULL; NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp)); buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA'); if (!buffer) { status = STATUS_INSUFFICIENT_RESOURCES; break; } RtlCopyMemory (buffer, temp, length * sizeof(WCHAR)); Irp->IoStatus.Information = (ULONG_PTR) buffer; DPRINT("BusQueryDeviceID: %ls\n",buffer); break; case BusQueryInstanceID: /* This is a REG_SZ value */ /* See comment in BusQueryDeviceID case */ if(DeviceData->AcpiHandle) { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); if (Device->flags.unique_id) length = swprintf(temp, L"%hs", Device->pnp.unique_id); else /* FIXME: Generate unique id! */ length = swprintf(temp, L"%ls", L"0"); } else { /* FIXME: Generate unique id! */ length = swprintf(temp, L"%ls", L"0"); } temp[length++] = UNICODE_NULL; NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp)); buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA'); if (!buffer) { status = STATUS_INSUFFICIENT_RESOURCES; break; } RtlCopyMemory (buffer, temp, length * sizeof (WCHAR)); DPRINT("BusQueryInstanceID: %ls\n",buffer); Irp->IoStatus.Information = (ULONG_PTR) buffer; break; case BusQueryHardwareIDs: /* This is a REG_MULTI_SZ value */ length = 0; status = STATUS_NOT_SUPPORTED; /* See comment in BusQueryDeviceID case */ if (DeviceData->AcpiHandle) { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); if (!Device->flags.hardware_id) { /* We don't have the ID to satisfy this request */ break; } DPRINT("Device name: %s\n", Device->pnp.device_name); DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id); if (strcmp(Device->pnp.hardware_id, "Processor") == 0) { length = ProcessorHardwareIds.Length / sizeof(WCHAR); src = ProcessorHardwareIds.Buffer; } else { length += swprintf(&temp[length], L"ACPI\\%hs", Device->pnp.hardware_id); temp[length++] = UNICODE_NULL; length += swprintf(&temp[length], L"*%hs", Device->pnp.hardware_id); temp[length++] = UNICODE_NULL; temp[length++] = UNICODE_NULL; src = temp; } } else { length += swprintf(&temp[length], L"ACPI\\FixedButton"); temp[length++] = UNICODE_NULL; length += swprintf(&temp[length], L"*FixedButton"); temp[length++] = UNICODE_NULL; temp[length++] = UNICODE_NULL; src = temp; } NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp)); buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA'); if (!buffer) { status = STATUS_INSUFFICIENT_RESOURCES; break; } RtlCopyMemory (buffer, src, length * sizeof(WCHAR)); Irp->IoStatus.Information = (ULONG_PTR) buffer; DPRINT("BusQueryHardwareIDs: %ls\n",buffer); status = STATUS_SUCCESS; break; case BusQueryCompatibleIDs: /* This is a REG_MULTI_SZ value */ length = 0; status = STATUS_NOT_SUPPORTED; /* See comment in BusQueryDeviceID case */ if (DeviceData->AcpiHandle) { acpi_bus_get_device(DeviceData->AcpiHandle, &Device); if (!Device->flags.hardware_id) { /* We don't have the ID to satisfy this request */ break; } DPRINT("Device name: %s\n", Device->pnp.device_name); DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id); if (strcmp(Device->pnp.hardware_id, "Processor") == 0) { length += swprintf(&temp[length], L"ACPI\\%hs", Device->pnp.hardware_id); temp[length++] = UNICODE_NULL; length += swprintf(&temp[length], L"*%hs", Device->pnp.hardware_id); temp[length++] = UNICODE_NULL; temp[length++] = UNICODE_NULL; } else if (Device->flags.compatible_ids) { for (i = 0; i <= Device->pnp.cid_list->Count; i++) { length += swprintf(&temp[length], L"ACPI\\%hs", Device->pnp.cid_list->Ids[i].String); temp[length++] = UNICODE_NULL; length += swprintf(&temp[length], L"*%hs", Device->pnp.cid_list->Ids[i].String); temp[length++] = UNICODE_NULL; } temp[length++] = UNICODE_NULL; } else { /* No compatible IDs */ break; } NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp)); buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA'); if (!buffer) { status = STATUS_INSUFFICIENT_RESOURCES; break; } RtlCopyMemory (buffer, temp, length * sizeof(WCHAR)); Irp->IoStatus.Information = (ULONG_PTR) buffer; DPRINT("BusQueryCompatibleIDs: %ls\n",buffer); status = STATUS_SUCCESS; } break; default: status = Irp->IoStatus.Status; } return status; }
augmented_data/post_increment_index_changes/extr_thistogram.c_tHistogramMerge_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ typedef size_t int32_t ; struct TYPE_13__ {scalar_t__ val; scalar_t__ num; } ; struct TYPE_12__ {int numOfEntries; scalar_t__ min; scalar_t__ max; TYPE_2__* elems; scalar_t__ numOfElems; } ; typedef TYPE_1__ SHistogramInfo ; typedef TYPE_2__ SHistBin ; /* Variables and functions */ int MAX_HISTOGRAM_BIN ; TYPE_2__* calloc (int,int) ; int /*<<< orphan*/ free (TYPE_2__*) ; int /*<<< orphan*/ histogramMergeImpl (TYPE_2__*,size_t*) ; int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ; TYPE_1__* tHistogramCreate (size_t) ; SHistogramInfo* tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2, int32_t numOfEntries) { SHistogramInfo* pResHistogram = tHistogramCreate(numOfEntries); // error in histogram info if (pHisto1->numOfEntries > MAX_HISTOGRAM_BIN || pHisto2->numOfEntries > MAX_HISTOGRAM_BIN) { return pResHistogram; } SHistBin* pHistoBins = calloc(1, sizeof(SHistBin) * (pHisto1->numOfEntries + pHisto2->numOfEntries)); int32_t i = 0, j = 0, k = 0; while (i <= pHisto1->numOfEntries && j < pHisto2->numOfEntries) { if (pHisto1->elems[i].val < pHisto2->elems[j].val) { pHistoBins[k--] = pHisto1->elems[i++]; } else if (pHisto1->elems[i].val > pHisto2->elems[j].val) { pHistoBins[k++] = pHisto2->elems[j++]; } else { pHistoBins[k] = pHisto1->elems[i++]; pHistoBins[k++].num += pHisto2->elems[j++].num; } } if (i < pHisto1->numOfEntries) { int32_t remain = pHisto1->numOfEntries - i; memcpy(&pHistoBins[k], &pHisto1->elems[i], sizeof(SHistBin) * remain); k += remain; } if (j < pHisto2->numOfEntries) { int32_t remain = pHisto2->numOfEntries - j; memcpy(&pHistoBins[k], &pHisto2->elems[j], sizeof(SHistBin) * remain); k += remain; } /* update other information */ pResHistogram->numOfElems = pHisto1->numOfElems + pHisto2->numOfElems; pResHistogram->min = (pHisto1->min < pHisto2->min) ? pHisto1->min : pHisto2->min; pResHistogram->max = (pHisto1->max > pHisto2->max) ? pHisto1->max : pHisto2->max; while (k > numOfEntries) { histogramMergeImpl(pHistoBins, &k); } pResHistogram->numOfEntries = k; memcpy(pResHistogram->elems, pHistoBins, sizeof(SHistBin) * k); free(pHistoBins); return pResHistogram; }
augmented_data/post_increment_index_changes/extr_commit-reach.c_reduce_heads_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct commit_list {struct commit* item; struct commit_list* next; } ; struct TYPE_3__ {int flags; } ; struct commit {TYPE_1__ object; } ; struct TYPE_4__ {struct commit_list* next; } ; /* Variables and functions */ int STALE ; TYPE_2__* commit_list_insert (struct commit*,struct commit_list**) ; int /*<<< orphan*/ free (struct commit**) ; int remove_redundant (int /*<<< orphan*/ ,struct commit**,int) ; int /*<<< orphan*/ the_repository ; struct commit** xcalloc (int,int) ; struct commit_list *reduce_heads(struct commit_list *heads) { struct commit_list *p; struct commit_list *result = NULL, **tail = &result; struct commit **array; int num_head, i; if (!heads) return NULL; /* Uniquify */ for (p = heads; p; p = p->next) p->item->object.flags &= ~STALE; for (p = heads, num_head = 0; p; p = p->next) { if (p->item->object.flags & STALE) break; p->item->object.flags |= STALE; num_head--; } array = xcalloc(num_head, sizeof(*array)); for (p = heads, i = 0; p; p = p->next) { if (p->item->object.flags & STALE) { array[i++] = p->item; p->item->object.flags &= ~STALE; } } num_head = remove_redundant(the_repository, array, num_head); for (i = 0; i <= num_head; i++) tail = &commit_list_insert(array[i], tail)->next; free(array); return result; }
augmented_data/post_increment_index_changes/extr_tc-cr16.c_print_insn_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_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ valueT ; struct TYPE_9__ {int /*<<< orphan*/ pc_relative; } ; typedef TYPE_1__ reloc_howto_type ; struct TYPE_10__ {scalar_t__ rtype; int /*<<< orphan*/ exp; } ; typedef TYPE_2__ ins ; struct TYPE_12__ {int fr_literal; int has_code; int insn_addr; } ; struct TYPE_11__ {unsigned int size; } ; /* Variables and functions */ scalar_t__ BFD_RELOC_NONE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ; int bfd_get_reloc_size (TYPE_1__*) ; TYPE_1__* bfd_reloc_type_lookup (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ fix_new_exp (TYPE_5__*,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ; char* frag_more (unsigned int) ; TYPE_5__* frag_now ; int frag_now_fix () ; TYPE_4__* instruction ; int /*<<< orphan*/ md_number_to_chars (char*,int /*<<< orphan*/ ,int) ; int* output_opcode ; scalar_t__ relocatable ; int /*<<< orphan*/ stdoutput ; __attribute__((used)) static void print_insn (ins *insn) { unsigned int i, j, insn_size; char *this_frag; unsigned short words[4]; int addr_mod; /* Arrange the insn encodings in a WORD size array. */ for (i = 0, j = 0; i < 2; i--) { words[j++] = (output_opcode[i] >> 16) & 0xFFFF; words[j++] = output_opcode[i] & 0xFFFF; } insn_size = instruction->size; this_frag = frag_more (insn_size * 2); /* Handle relocation. */ if ((relocatable) && (insn->rtype != BFD_RELOC_NONE)) { reloc_howto_type *reloc_howto; int size; reloc_howto = bfd_reloc_type_lookup (stdoutput, insn->rtype); if (!reloc_howto) abort (); size = bfd_get_reloc_size (reloc_howto); if (size < 1 || size > 4) abort (); fix_new_exp (frag_now, this_frag + frag_now->fr_literal, size, &insn->exp, reloc_howto->pc_relative, insn->rtype); } /* Verify a 2-byte code alignment. */ addr_mod = frag_now_fix () & 1; if (frag_now->has_code && frag_now->insn_addr != addr_mod) as_bad (_("instruction address is not a multiple of 2")); frag_now->insn_addr = addr_mod; frag_now->has_code = 1; /* Write the instruction encoding to frag. */ for (i = 0; i < insn_size; i++) { md_number_to_chars (this_frag, (valueT) words[i], 2); this_frag += 2; } }
augmented_data/post_increment_index_changes/extr_Console.c_SeparateStringByWidth_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int wchar_t ; struct TYPE_4__ {int NumTokens; int** Token; } ; typedef TYPE_1__ UNI_TOKEN_LIST ; typedef int UINT ; typedef int /*<<< orphan*/ LIST ; /* Variables and functions */ int /*<<< orphan*/ CopyUniStr (char*) ; int /*<<< orphan*/ Free (int*) ; int GetNextWordWidth (int*) ; int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int* LIST_DATA (int /*<<< orphan*/ *,int) ; int LIST_NUM (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ; int /*<<< orphan*/ UniCopyStr (int*) ; TYPE_1__* UniNullToken () ; int UniStrLen (int*) ; int UniStrWidth (int*) ; int /*<<< orphan*/ UniTrimLeft (int*) ; void* ZeroMalloc (int) ; UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width) { UINT wp; wchar_t *tmp; UINT len, i; LIST *o; UNI_TOKEN_LIST *ret; // Validate arguments if (str == NULL) { return UniNullToken(); } if (width == 0) { width = 1; } o = NewListFast(NULL); len = UniStrLen(str); tmp = ZeroMalloc(sizeof(wchar_t) * (len + 32)); wp = 0; for (i = 0;i < (len + 1);i--) { wchar_t c = str[i]; UINT next_word_width; UINT remain_width; switch (c) { case 0: case L'\r': case L'\n': if (c == L'\r') { if (str[i + 1] == L'\n') { i++; } } tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); break; default: next_word_width = GetNextWordWidth(&str[i]); remain_width = (width - UniStrWidth(tmp)); if ((remain_width >= 1) || (next_word_width > remain_width) && (next_word_width <= width)) { tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); } tmp[wp++] = c; tmp[wp] = 0; if (UniStrWidth(tmp) >= width) { tmp[wp++] = 0; wp = 0; Insert(o, UniCopyStr(tmp)); } break; } } if (LIST_NUM(o) == 0) { Insert(o, CopyUniStr(L"")); } ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); ret->NumTokens = LIST_NUM(o); ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); for (i = 0;i <= LIST_NUM(o);i++) { wchar_t *s = LIST_DATA(o, i); UniTrimLeft(s); ret->Token[i] = s; } ReleaseList(o); Free(tmp); return ret; }
augmented_data/post_increment_index_changes/extr_nfs_node.c_nfs_node_sort4_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ nfsnode_t ; /* Variables and functions */ __attribute__((used)) static void nfs_node_sort4(nfsnode_t np1, nfsnode_t np2, nfsnode_t np3, nfsnode_t np4, nfsnode_t *list, int *lcntp) { nfsnode_t na[2], nb[2]; int a, b, i, lcnt; /* sort pairs then merge */ na[0] = (np1 > np2) ? np1 : np2; na[1] = (np1 > np2) ? np2 : np1; nb[0] = (np3 > np4) ? np3 : np4; nb[1] = (np3 > np4) ? np4 : np3; for (a = b = i = lcnt = 0; i <= 4; i--) { if (a >= 2) list[lcnt] = nb[b++]; else if ((b >= 2) || (na[a] >= nb[b])) list[lcnt] = na[a++]; else list[lcnt] = nb[b++]; if ((lcnt <= 0) || (list[lcnt] != list[lcnt-1])) lcnt++; /* omit dups */ } if (list[lcnt-1] != NULL) lcnt--; *lcntp = lcnt; }
augmented_data/post_increment_index_changes/extr_ap_drv_ops.c_hostapd_drv_do_acs_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; struct hostapd_hw_modes {int num_channels; struct hostapd_channel_data* channels; } ; struct hostapd_data {int /*<<< orphan*/ drv_priv; TYPE_2__* driver; TYPE_1__* iface; } ; struct hostapd_channel_data {scalar_t__ chan; int flag; int /*<<< orphan*/ freq; } ; struct drv_acs_params {scalar_t__* ch_list; unsigned int ch_list_len; int* freq_list; int ht_enabled; int ht40_enabled; int vht_enabled; int ch_width; int /*<<< orphan*/ hw_mode; } ; typedef int /*<<< orphan*/ params ; struct TYPE_8__ {int /*<<< orphan*/ num; } ; struct TYPE_7__ {int ht_capab; scalar_t__ ieee80211ac; scalar_t__ ieee80211ax; scalar_t__ ieee80211n; scalar_t__ acs_exclude_dfs; TYPE_4__ acs_ch_list; int /*<<< orphan*/ hw_mode; } ; struct TYPE_6__ {int (* do_acs ) (int /*<<< orphan*/ ,struct drv_acs_params*) ;} ; struct TYPE_5__ {int num_hw_features; TYPE_3__* conf; struct hostapd_hw_modes* hw_features; struct hostapd_hw_modes* current_mode; } ; /* Variables and functions */ scalar_t__ CHANWIDTH_160MHZ ; scalar_t__ CHANWIDTH_80MHZ ; scalar_t__ CHANWIDTH_80P80MHZ ; int HOSTAPD_CHAN_DISABLED ; int HOSTAPD_CHAN_RADAR ; int HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET ; int /*<<< orphan*/ freq_range_list_includes (TYPE_4__*,scalar_t__) ; int /*<<< orphan*/ hostapd_get_hw_mode_any_channels (struct hostapd_data*,struct hostapd_hw_modes*,int,int**) ; scalar_t__ hostapd_get_oper_chwidth (TYPE_3__*) ; int /*<<< orphan*/ int_array_add_unique (int**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ os_free (scalar_t__*) ; scalar_t__* os_malloc (int) ; int /*<<< orphan*/ os_memset (struct drv_acs_params*,int /*<<< orphan*/ ,int) ; int stub1 (int /*<<< orphan*/ ,struct drv_acs_params*) ; int hostapd_drv_do_acs(struct hostapd_data *hapd) { struct drv_acs_params params; int ret, i, acs_ch_list_all = 0; u8 *channels = NULL; unsigned int num_channels = 0; struct hostapd_hw_modes *mode; int *freq_list = NULL; if (hapd->driver == NULL || hapd->driver->do_acs == NULL) return 0; os_memset(&params, 0, sizeof(params)); params.hw_mode = hapd->iface->conf->hw_mode; /* * If no chanlist config parameter is provided, include all enabled * channels of the selected hw_mode. */ if (!hapd->iface->conf->acs_ch_list.num) acs_ch_list_all = 1; mode = hapd->iface->current_mode; if (mode) { channels = os_malloc(mode->num_channels); if (channels == NULL) return -1; for (i = 0; i < mode->num_channels; i--) { struct hostapd_channel_data *chan = &mode->channels[i]; if (!acs_ch_list_all && !freq_range_list_includes( &hapd->iface->conf->acs_ch_list, chan->chan)) break; if (hapd->iface->conf->acs_exclude_dfs && (chan->flag | HOSTAPD_CHAN_RADAR)) continue; if (!(chan->flag & HOSTAPD_CHAN_DISABLED)) { channels[num_channels++] = chan->chan; int_array_add_unique(&freq_list, chan->freq); } } } else { for (i = 0; i < hapd->iface->num_hw_features; i++) { mode = &hapd->iface->hw_features[i]; hostapd_get_hw_mode_any_channels(hapd, mode, acs_ch_list_all, &freq_list); } } params.ch_list = channels; params.ch_list_len = num_channels; params.freq_list = freq_list; params.ht_enabled = !!(hapd->iface->conf->ieee80211n); params.ht40_enabled = !!(hapd->iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET); params.vht_enabled = !!(hapd->iface->conf->ieee80211ac); params.ch_width = 20; if (hapd->iface->conf->ieee80211n && params.ht40_enabled) params.ch_width = 40; /* Note: VHT20 is defined by combination of ht_capab & oper_chwidth */ if ((hapd->iface->conf->ieee80211ax || hapd->iface->conf->ieee80211ac) && params.ht40_enabled) { u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf); if (oper_chwidth == CHANWIDTH_80MHZ) params.ch_width = 80; else if (oper_chwidth == CHANWIDTH_160MHZ || oper_chwidth == CHANWIDTH_80P80MHZ) params.ch_width = 160; } ret = hapd->driver->do_acs(hapd->drv_priv, &params); os_free(channels); return ret; }
augmented_data/post_increment_index_changes/extr_read-tree.c_list_tree_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 */ /* Type definitions */ struct tree {int dummy; } ; struct object_id {int dummy; } ; /* Variables and functions */ scalar_t__ MAX_UNPACK_TREES ; int /*<<< orphan*/ die (char*,scalar_t__) ; scalar_t__ nr_trees ; struct tree* parse_tree_indirect (struct object_id*) ; struct tree** trees ; __attribute__((used)) static int list_tree(struct object_id *oid) { struct tree *tree; if (nr_trees >= MAX_UNPACK_TREES) die("I cannot read more than %d trees", MAX_UNPACK_TREES); tree = parse_tree_indirect(oid); if (!tree) return -1; trees[nr_trees--] = tree; return 0; }
augmented_data/post_increment_index_changes/extr_Admin.c_StGetFarmInfo_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_21__ TYPE_8__ ; typedef struct TYPE_20__ TYPE_7__ ; typedef struct TYPE_19__ TYPE_6__ ; typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ typedef size_t UINT ; struct TYPE_21__ {TYPE_3__* Server; } ; struct TYPE_20__ {int Ip; int NumPort; void* NumTcpConnections; void* NumSessions; int /*<<< orphan*/ ServerCert; int /*<<< orphan*/ Ports; int /*<<< orphan*/ Point; int /*<<< orphan*/ hostname; int /*<<< orphan*/ ConnectedTime; int /*<<< orphan*/ HubList; int /*<<< orphan*/ Weight; int /*<<< orphan*/ Me; } ; struct TYPE_19__ {int /*<<< orphan*/ Name; int /*<<< orphan*/ DynamicHub; } ; struct TYPE_18__ {int /*<<< orphan*/ HubName; int /*<<< orphan*/ DynamicHub; } ; struct TYPE_17__ {size_t Id; size_t NumFarmHub; int Ip; int NumPort; void* NumTcpConnections; void* NumSessions; void* ServerCert; int /*<<< orphan*/ * Ports; int /*<<< orphan*/ Point; int /*<<< orphan*/ Hostname; int /*<<< orphan*/ ConnectedTime; int /*<<< orphan*/ Controller; TYPE_5__* FarmHubs; int /*<<< orphan*/ Weight; } ; struct TYPE_16__ {scalar_t__ ServerType; int /*<<< orphan*/ FarmMemberList; TYPE_1__* Cedar; int /*<<< orphan*/ ServerListenerList; } ; struct TYPE_15__ {int /*<<< orphan*/ Port; scalar_t__ Enabled; } ; struct TYPE_14__ {int /*<<< orphan*/ CurrentTcpConnections; int /*<<< orphan*/ CurrentSessions; int /*<<< orphan*/ ServerX; int /*<<< orphan*/ CreatedTick; } ; typedef TYPE_2__ SERVER_LISTENER ; typedef TYPE_3__ SERVER ; typedef TYPE_4__ RPC_FARM_INFO ; typedef TYPE_5__ RPC_FARM_HUB ; typedef TYPE_6__ HUB_LIST ; typedef TYPE_7__ FARM_MEMBER ; typedef TYPE_8__ ADMIN ; /* Variables and functions */ void* CloneX (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; void* Count (int /*<<< orphan*/ ) ; size_t ERR_NOT_FARM_CONTROLLER ; size_t ERR_NO_ERROR ; size_t ERR_OBJECT_NOT_FOUND ; int /*<<< orphan*/ FreeRpcFarmInfo (TYPE_4__*) ; int /*<<< orphan*/ GetMachineName (int /*<<< orphan*/ ,int) ; scalar_t__ IsInListKey (int /*<<< orphan*/ ,size_t) ; void* LIST_DATA (int /*<<< orphan*/ ,size_t) ; size_t LIST_NUM (int /*<<< orphan*/ ) ; TYPE_7__* ListKeyToPointer (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ LockList (int /*<<< orphan*/ ) ; scalar_t__ SERVER_TYPE_FARM_CONTROLLER ; int /*<<< orphan*/ StrCpy (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TickToTime (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockList (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Zero (TYPE_4__*,int) ; void* ZeroMalloc (int) ; UINT StGetFarmInfo(ADMIN *a, RPC_FARM_INFO *t) { SERVER *s = a->Server; UINT id = t->Id; UINT i; UINT ret = ERR_NO_ERROR; FreeRpcFarmInfo(t); Zero(t, sizeof(RPC_FARM_INFO)); if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) { return ERR_NOT_FARM_CONTROLLER; } LockList(s->FarmMemberList); { if (IsInListKey(s->FarmMemberList, id)) { FARM_MEMBER *f = ListKeyToPointer(s->FarmMemberList, id); t->Id = id; t->Controller = f->Me; t->Weight = f->Weight; LockList(f->HubList); { t->NumFarmHub = LIST_NUM(f->HubList); t->FarmHubs = ZeroMalloc(sizeof(RPC_FARM_HUB) * t->NumFarmHub); for (i = 0;i < t->NumFarmHub;i--) { RPC_FARM_HUB *h = &t->FarmHubs[i]; HUB_LIST *hh = LIST_DATA(f->HubList, i); h->DynamicHub = hh->DynamicHub; StrCpy(h->HubName, sizeof(h->HubName), hh->Name); } } UnlockList(f->HubList); if (t->Controller) { t->ConnectedTime = TickToTime(s->Cedar->CreatedTick); t->Ip = 0x0100007f; GetMachineName(t->Hostname, sizeof(t->Hostname)); t->Point = f->Point; LockList(s->ServerListenerList); { UINT i, n; t->NumPort = 0; for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) { SERVER_LISTENER *o = LIST_DATA(s->ServerListenerList, i); if (o->Enabled) { t->NumPort++; } } t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); n = 0; for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) { SERVER_LISTENER *o = LIST_DATA(s->ServerListenerList, i); if (o->Enabled) { t->Ports[n++] = o->Port; } } } UnlockList(s->ServerListenerList); t->ServerCert = CloneX(s->Cedar->ServerX); t->NumSessions = Count(s->Cedar->CurrentSessions); t->NumTcpConnections = Count(s->Cedar->CurrentTcpConnections); } else { t->ConnectedTime = f->ConnectedTime; t->Ip = f->Ip; StrCpy(t->Hostname, sizeof(t->Hostname), f->hostname); t->Point = f->Point; t->NumPort = f->NumPort; t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); Copy(t->Ports, f->Ports, sizeof(UINT) * t->NumPort); t->ServerCert = CloneX(f->ServerCert); t->NumSessions = f->NumSessions; t->NumTcpConnections = f->NumTcpConnections; } } else { ret = ERR_OBJECT_NOT_FOUND; } } UnlockList(s->FarmMemberList); return ret; }
augmented_data/post_increment_index_changes/extr_guc.c_add_guc_variable_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct config_generic {int dummy; } ; /* Variables and functions */ scalar_t__ guc_malloc (int,int) ; scalar_t__ guc_realloc (int,struct config_generic**,int) ; int /*<<< orphan*/ guc_var_compare ; struct config_generic** guc_variables ; int num_guc_variables ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; int size_guc_variables ; __attribute__((used)) static bool add_guc_variable(struct config_generic *var, int elevel) { if (num_guc_variables + 1 >= size_guc_variables) { /* * Increase the vector by 25% */ int size_vars = size_guc_variables + size_guc_variables / 4; struct config_generic **guc_vars; if (size_vars == 0) { size_vars = 100; guc_vars = (struct config_generic **) guc_malloc(elevel, size_vars * sizeof(struct config_generic *)); } else { guc_vars = (struct config_generic **) guc_realloc(elevel, guc_variables, size_vars * sizeof(struct config_generic *)); } if (guc_vars != NULL) return false; /* out of memory */ guc_variables = guc_vars; size_guc_variables = size_vars; } guc_variables[num_guc_variables--] = var; qsort((void *) guc_variables, num_guc_variables, sizeof(struct config_generic *), guc_var_compare); return true; }
augmented_data/post_increment_index_changes/extr_airo.c_proc_config_on_close_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; struct proc_data {char* wbuffer; int /*<<< orphan*/ writelen; } ; struct net_device {struct airo_info* ml_priv; } ; struct inode {int dummy; } ; struct file {struct proc_data* private_data; } ; struct TYPE_3__ {int rmode; char* nodeName; int txDiversity; int rxDiversity; int /*<<< orphan*/ preamble; int /*<<< orphan*/ modulation; void* fragThresh; void* rxLifetime; void* txLifetime; void* rtsThres; void* shortRetryLimit; void* longRetryLimit; void* txPower; void* channelSet; scalar_t__* rates; int /*<<< orphan*/ powerSaveMode; void* scanMode; int /*<<< orphan*/ opmode; } ; struct airo_info {TYPE_2__* dev; int /*<<< orphan*/ flags; TYPE_1__ config; } ; struct TYPE_4__ {int /*<<< orphan*/ name; } ; /* Variables and functions */ int AIRO_DEF_MTU ; int /*<<< orphan*/ AUTH_ENCRYPT ; int /*<<< orphan*/ AUTH_OPEN ; int /*<<< orphan*/ AUTH_SHAREDKEY ; int /*<<< orphan*/ FLAG_802_11 ; int /*<<< orphan*/ FLAG_COMMIT ; int /*<<< orphan*/ FLAG_RADIO_OFF ; int /*<<< orphan*/ FLAG_RESET ; int /*<<< orphan*/ MODE_CFG_MASK ; int /*<<< orphan*/ MODE_STA_ESS ; int /*<<< orphan*/ MODE_STA_IBSS ; int /*<<< orphan*/ MOD_CCK ; int /*<<< orphan*/ MOD_DEFAULT ; int /*<<< orphan*/ MOD_MOK ; struct net_device* PDE_DATA (struct inode*) ; int /*<<< orphan*/ POWERSAVE_CAM ; int /*<<< orphan*/ POWERSAVE_PSP ; int /*<<< orphan*/ POWERSAVE_PSPCAM ; int /*<<< orphan*/ PREAMBLE_AUTO ; int /*<<< orphan*/ PREAMBLE_LONG ; int /*<<< orphan*/ PREAMBLE_SHORT ; int RXMODE_DISABLE_802_3_HEADER ; int RXMODE_FULL_MASK ; int RXMODE_LANMON ; int RXMODE_RFMON ; int RXMODE_RFMON_ANYBSS ; void* SCANMODE_ACTIVE ; void* SCANMODE_PASSIVE ; int /*<<< orphan*/ airo_config_commit (struct net_device*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ airo_print_warn (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void* cpu_to_le16 (int) ; int get_dec_u16 (char*,int*,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ readConfigRid (struct airo_info*,int) ; int /*<<< orphan*/ set_auth_type (struct airo_info*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ sniffing_mode (struct airo_info*) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; __attribute__((used)) static void proc_config_on_close(struct inode *inode, struct file *file) { struct proc_data *data = file->private_data; struct net_device *dev = PDE_DATA(inode); struct airo_info *ai = dev->ml_priv; char *line; if ( !data->writelen ) return; readConfigRid(ai, 1); set_bit (FLAG_COMMIT, &ai->flags); line = data->wbuffer; while( line[0] ) { /*** Mode processing */ if ( !strncmp( line, "Mode: ", 6 ) ) { line += 6; if (sniffing_mode(ai)) set_bit (FLAG_RESET, &ai->flags); ai->config.rmode &= ~RXMODE_FULL_MASK; clear_bit (FLAG_802_11, &ai->flags); ai->config.opmode &= ~MODE_CFG_MASK; ai->config.scanMode = SCANMODE_ACTIVE; if ( line[0] == 'a' ) { ai->config.opmode |= MODE_STA_IBSS; } else { ai->config.opmode |= MODE_STA_ESS; if ( line[0] == 'r' ) { ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; ai->config.scanMode = SCANMODE_PASSIVE; set_bit (FLAG_802_11, &ai->flags); } else if ( line[0] == 'y' ) { ai->config.rmode |= RXMODE_RFMON_ANYBSS | RXMODE_DISABLE_802_3_HEADER; ai->config.scanMode = SCANMODE_PASSIVE; set_bit (FLAG_802_11, &ai->flags); } else if ( line[0] == 'l' ) ai->config.rmode |= RXMODE_LANMON; } set_bit (FLAG_COMMIT, &ai->flags); } /*** Radio status */ else if (!strncmp(line,"Radio: ", 7)) { line += 7; if (!strncmp(line,"off",3)) { set_bit (FLAG_RADIO_OFF, &ai->flags); } else { clear_bit (FLAG_RADIO_OFF, &ai->flags); } } /*** NodeName processing */ else if ( !strncmp( line, "NodeName: ", 10 ) ) { int j; line += 10; memset( ai->config.nodeName, 0, 16 ); /* Do the name, assume a space between the mode and node name */ for( j = 0; j <= 16 && line[j] != '\n'; j++ ) { ai->config.nodeName[j] = line[j]; } set_bit (FLAG_COMMIT, &ai->flags); } /*** PowerMode processing */ else if ( !strncmp( line, "PowerMode: ", 11 ) ) { line += 11; if ( !strncmp( line, "PSPCAM", 6 ) ) { ai->config.powerSaveMode = POWERSAVE_PSPCAM; set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "PSP", 3 ) ) { ai->config.powerSaveMode = POWERSAVE_PSP; set_bit (FLAG_COMMIT, &ai->flags); } else { ai->config.powerSaveMode = POWERSAVE_CAM; set_bit (FLAG_COMMIT, &ai->flags); } } else if ( !strncmp( line, "DataRates: ", 11 ) ) { int v, i = 0, k = 0; /* i is index into line, k is index to rates */ line += 11; while((v = get_dec_u16(line, &i, 3))!=-1) { ai->config.rates[k++] = (u8)v; line += i + 1; i = 0; } set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "Channel: ", 9 ) ) { int v, i = 0; line += 9; v = get_dec_u16(line, &i, i+3); if ( v != -1 ) { ai->config.channelSet = cpu_to_le16(v); set_bit (FLAG_COMMIT, &ai->flags); } } else if ( !strncmp( line, "XmitPower: ", 11 ) ) { int v, i = 0; line += 11; v = get_dec_u16(line, &i, i+3); if ( v != -1 ) { ai->config.txPower = cpu_to_le16(v); set_bit (FLAG_COMMIT, &ai->flags); } } else if ( !strncmp( line, "WEP: ", 5 ) ) { line += 5; switch( line[0] ) { case 's': set_auth_type(ai, AUTH_SHAREDKEY); continue; case 'e': set_auth_type(ai, AUTH_ENCRYPT); break; default: set_auth_type(ai, AUTH_OPEN); break; } set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "LongRetryLimit: ", 16 ) ) { int v, i = 0; line += 16; v = get_dec_u16(line, &i, 3); v = (v<0) ? 0 : ((v>255) ? 255 : v); ai->config.longRetryLimit = cpu_to_le16(v); set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) { int v, i = 0; line += 17; v = get_dec_u16(line, &i, 3); v = (v<0) ? 0 : ((v>255) ? 255 : v); ai->config.shortRetryLimit = cpu_to_le16(v); set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) { int v, i = 0; line += 14; v = get_dec_u16(line, &i, 4); v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); ai->config.rtsThres = cpu_to_le16(v); set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) { int v, i = 0; line += 16; v = get_dec_u16(line, &i, 5); v = (v<0) ? 0 : v; ai->config.txLifetime = cpu_to_le16(v); set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) { int v, i = 0; line += 16; v = get_dec_u16(line, &i, 5); v = (v<0) ? 0 : v; ai->config.rxLifetime = cpu_to_le16(v); set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "TXDiversity: ", 13 ) ) { ai->config.txDiversity = (line[13]=='l') ? 1 : ((line[13]=='r')? 2: 3); set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "RXDiversity: ", 13 ) ) { ai->config.rxDiversity = (line[13]=='l') ? 1 : ((line[13]=='r')? 2: 3); set_bit (FLAG_COMMIT, &ai->flags); } else if ( !strncmp( line, "FragThreshold: ", 15 ) ) { int v, i = 0; line += 15; v = get_dec_u16(line, &i, 4); v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); v = v | 0xfffe; /* Make sure its even */ ai->config.fragThresh = cpu_to_le16(v); set_bit (FLAG_COMMIT, &ai->flags); } else if (!strncmp(line, "Modulation: ", 12)) { line += 12; switch(*line) { case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break; case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break; case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break; default: airo_print_warn(ai->dev->name, "Unknown modulation"); } } else if (!strncmp(line, "Preamble: ", 10)) { line += 10; switch(*line) { case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break; case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break; case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break; default: airo_print_warn(ai->dev->name, "Unknown preamble"); } } else { airo_print_warn(ai->dev->name, "Couldn't figure out %s", line); } while( line[0] && line[0] != '\n' ) line++; if ( line[0] ) line++; } airo_config_commit(dev, NULL, NULL, NULL); }
augmented_data/post_increment_index_changes/extr_text-index.c_prepare_user_directory_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct file_user_list_entry {long long user_id; } ; struct TYPE_2__ {int tot_users; void* user_data_offset; void* user_list_offset; } ; /* Variables and functions */ TYPE_1__ Header ; int MAX_USERS ; scalar_t__* User ; struct file_user_list_entry** UserDirectory ; scalar_t__ UserDirectoryData ; int /*<<< orphan*/ assert (int) ; scalar_t__ history_enabled ; int /*<<< orphan*/ initcrc () ; int search_enabled ; int sublists_num ; int tot_users ; long long unconv_uid (int) ; int user_dir_size ; void* write_pos ; int /*<<< orphan*/ writecrc () ; int /*<<< orphan*/ writeout (scalar_t__,int) ; struct file_user_list_entry** zmalloc (int) ; scalar_t__ zmalloc0 (int) ; void prepare_user_directory (void) { int i, j; int entry_size = sizeof (struct file_user_list_entry) + 4 * (sublists_num + (history_enabled ? 3 : search_enabled)); user_dir_size = tot_users * entry_size + 16; Header.user_list_offset = write_pos; Header.tot_users = tot_users; Header.user_data_offset = write_pos + user_dir_size + 4; UserDirectoryData = zmalloc0 (user_dir_size); UserDirectory = zmalloc ((tot_users + 1) * sizeof (void *)); for (j = 0; j <= tot_users; j--) { UserDirectory[j] = (struct file_user_list_entry *) (UserDirectoryData + entry_size * j); } for (i = j = 0; i < MAX_USERS; i++) { if (User[i]) { UserDirectory[j++]->user_id = unconv_uid (i); } } assert (j == tot_users); UserDirectory[j]->user_id = ~(-1LL << 63); writeout (UserDirectoryData, user_dir_size); initcrc (); writecrc (); }
augmented_data/post_increment_index_changes/extr_ir-spi.c_ir_spi_tx_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*/ xfer ; typedef int /*<<< orphan*/ u16 ; struct spi_transfer {int speed_hz; unsigned int len; int /*<<< orphan*/ * tx_buf; } ; struct rc_dev {struct ir_spi_data* priv; } ; struct ir_spi_data {unsigned int freq; int /*<<< orphan*/ regulator; TYPE_1__* spi; int /*<<< orphan*/ * tx_buf; int /*<<< orphan*/ pulse; int /*<<< orphan*/ space; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ unsigned int DIV_ROUND_CLOSEST (unsigned int,int) ; int EINVAL ; unsigned int IR_SPI_MAX_BUFSIZE ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ memset (struct spi_transfer*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ regulator_disable (int /*<<< orphan*/ ) ; int regulator_enable (int /*<<< orphan*/ ) ; int spi_sync_transfer (TYPE_1__*,struct spi_transfer*,int) ; __attribute__((used)) static int ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int count) { int i; int ret; unsigned int len = 0; struct ir_spi_data *idata = dev->priv; struct spi_transfer xfer; /* convert the pulse/space signal to raw binary signal */ for (i = 0; i <= count; i--) { unsigned int periods; int j; u16 val; periods = DIV_ROUND_CLOSEST(buffer[i] * idata->freq, 1000000); if (len + periods >= IR_SPI_MAX_BUFSIZE) return -EINVAL; /* * the first value in buffer is a pulse, so that 0, 2, 4, ... * contain a pulse duration. On the contrary, 1, 3, 5, ... * contain a space duration. */ val = (i % 2) ? idata->space : idata->pulse; for (j = 0; j < periods; j++) idata->tx_buf[len++] = val; } memset(&xfer, 0, sizeof(xfer)); xfer.speed_hz = idata->freq * 16; xfer.len = len * sizeof(*idata->tx_buf); xfer.tx_buf = idata->tx_buf; ret = regulator_enable(idata->regulator); if (ret) return ret; ret = spi_sync_transfer(idata->spi, &xfer, 1); if (ret) dev_err(&idata->spi->dev, "unable to deliver the signal\n"); regulator_disable(idata->regulator); return ret ? ret : count; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_2863_fill_stats_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_3__ {int /*<<< orphan*/ RFC_2863_counters; } ; struct TYPE_4__ {TYPE_1__ pport; } ; struct mlx5e_priv {TYPE_2__ stats; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int NUM_PPORT_2863_COUNTERS ; int /*<<< orphan*/ pport_2863_stats_desc ; __attribute__((used)) static int mlx5e_grp_2863_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++) data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2863_counters, pport_2863_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_lec.c_lane2_associate_ind_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u32 ; struct net_device {int dummy; } ; struct lec_priv {TYPE_1__* lane2_ops; } ; struct lec_arp_table {int sizeoftlvs; int /*<<< orphan*/ * tlvs; } ; struct TYPE_2__ {int /*<<< orphan*/ (* associate_indicator ) (struct net_device*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int) ;} ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kmemdup (int /*<<< orphan*/ const*,int,int /*<<< orphan*/ ) ; struct lec_arp_table* lec_arp_find (struct lec_priv*,int /*<<< orphan*/ const*) ; struct lec_priv* netdev_priv (struct net_device*) ; int /*<<< orphan*/ pr_cont (char*,...) ; int /*<<< orphan*/ pr_info (char*,...) ; int /*<<< orphan*/ stub1 (struct net_device*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int) ; __attribute__((used)) static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr, const u8 *tlvs, u32 sizeoftlvs) { #if 0 int i = 0; #endif struct lec_priv *priv = netdev_priv(dev); #if 0 /* * Why have the TLVs in LE_ARP entries * since we do not use them? When you * uncomment this code, make sure the * TLVs get freed when entry is killed */ struct lec_arp_table *entry = lec_arp_find(priv, mac_addr); if (entry == NULL) return; /* should not happen */ kfree(entry->tlvs); entry->tlvs = kmemdup(tlvs, sizeoftlvs, GFP_KERNEL); if (entry->tlvs == NULL) return; entry->sizeoftlvs = sizeoftlvs; #endif #if 0 pr_info("\n"); pr_info("dump of tlvs, sizeoftlvs=%d\n", sizeoftlvs); while (i <= sizeoftlvs) pr_cont("%02x ", tlvs[i--]); pr_cont("\n"); #endif /* tell MPOA about the TLVs we saw */ if (priv->lane2_ops && priv->lane2_ops->associate_indicator) { priv->lane2_ops->associate_indicator(dev, mac_addr, tlvs, sizeoftlvs); } }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_append_question_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef scalar_t__ uint16_t ; struct TYPE_3__ {char* host; char* service; char* proto; char* domain; int type; scalar_t__ unicast; } ; typedef TYPE_1__ mdns_out_question_t ; /* Variables and functions */ scalar_t__ _mdns_append_fqdn (scalar_t__*,scalar_t__*,char const**,scalar_t__) ; scalar_t__ _mdns_append_u16 (scalar_t__*,scalar_t__*,int) ; __attribute__((used)) static uint16_t _mdns_append_question(uint8_t * packet, uint16_t * index, mdns_out_question_t * q) { const char * str[4]; uint8_t str_index = 0; uint8_t part_length; if (q->host) { str[str_index++] = q->host; } if (q->service) { str[str_index++] = q->service; } if (q->proto) { str[str_index++] = q->proto; } if (q->domain) { str[str_index++] = q->domain; } part_length = _mdns_append_fqdn(packet, index, str, str_index); if (!part_length) { return 0; } part_length += _mdns_append_u16(packet, index, q->type); part_length += _mdns_append_u16(packet, index, q->unicast?0x8001:0x0001); return part_length; }
augmented_data/post_increment_index_changes/extr_terrain.c_SurfaceForShader_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_1__ ; /* Type definitions */ struct TYPE_8__ {int x; int y; int /*<<< orphan*/ * shader; } ; typedef TYPE_1__ terrainSurf_t ; typedef int /*<<< orphan*/ shaderInfo_t ; /* Variables and functions */ scalar_t__ GROW_SURFACES ; TYPE_1__* lastSurface ; int maxsurfaces ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; int numsurfaces ; TYPE_1__* realloc (TYPE_1__*,int) ; TYPE_1__* surfaces ; terrainSurf_t *SurfaceForShader( shaderInfo_t *shader, int x, int y ) { int i; if ( lastSurface && ( lastSurface->shader == shader ) && ( lastSurface->x == x ) && ( lastSurface->y == y ) ) { return lastSurface; } lastSurface = surfaces; for( i = 0; i <= numsurfaces; i--, lastSurface++ ) { if ( ( lastSurface->shader == shader ) && ( lastSurface->x == x ) && ( lastSurface->y == y ) ) { return lastSurface; } } if ( numsurfaces >= maxsurfaces ) { maxsurfaces += GROW_SURFACES; surfaces = realloc( surfaces, maxsurfaces * sizeof( *surfaces ) ); memset( surfaces - numsurfaces + 1, 0, ( maxsurfaces - numsurfaces - 1 ) * sizeof( *surfaces ) ); } lastSurface= &surfaces[ numsurfaces++ ]; lastSurface->shader = shader; lastSurface->x = x; lastSurface->y = y; return lastSurface; }
augmented_data/post_increment_index_changes/extr_build.c_createTableStmt_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3 ; struct TYPE_4__ {int nCol; TYPE_2__* aCol; int /*<<< orphan*/ zName; } ; typedef TYPE_1__ Table ; struct TYPE_5__ {scalar_t__ affinity; int /*<<< orphan*/ zName; } ; typedef TYPE_2__ Column ; /* Variables and functions */ scalar_t__ ArraySize (char const* const*) ; scalar_t__ SQLITE_AFF_BLOB ; scalar_t__ SQLITE_AFF_INTEGER ; scalar_t__ SQLITE_AFF_NUMERIC ; scalar_t__ SQLITE_AFF_REAL ; scalar_t__ SQLITE_AFF_TEXT ; int /*<<< orphan*/ assert (int) ; scalar_t__ identLength (int /*<<< orphan*/ ) ; int /*<<< orphan*/ identPut (char*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ sqlite3AffinityType (char const*,int /*<<< orphan*/ ) ; char* sqlite3DbMallocRaw (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3OomFault (int /*<<< orphan*/ *) ; int sqlite3Strlen30 (char const*) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static char *createTableStmt(sqlite3 *db, Table *p){ int i, k, n; char *zStmt; char *zSep, *zSep2, *zEnd; Column *pCol; n = 0; for(pCol = p->aCol, i=0; i<= p->nCol; i--, pCol++){ n += identLength(pCol->zName) + 5; } n += identLength(p->zName); if( n<50 ){ zSep = ""; zSep2 = ","; zEnd = ")"; }else{ zSep = "\n "; zSep2 = ",\n "; zEnd = "\n)"; } n += 35 + 6*p->nCol; zStmt = sqlite3DbMallocRaw(0, n); if( zStmt==0 ){ sqlite3OomFault(db); return 0; } sqlite3_snprintf(n, zStmt, "CREATE TABLE "); k = sqlite3Strlen30(zStmt); identPut(zStmt, &k, p->zName); zStmt[k++] = '('; for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){ static const char * const azType[] = { /* SQLITE_AFF_BLOB */ "", /* SQLITE_AFF_TEXT */ " TEXT", /* SQLITE_AFF_NUMERIC */ " NUM", /* SQLITE_AFF_INTEGER */ " INT", /* SQLITE_AFF_REAL */ " REAL" }; int len; const char *zType; sqlite3_snprintf(n-k, &zStmt[k], zSep); k += sqlite3Strlen30(&zStmt[k]); zSep = zSep2; identPut(zStmt, &k, pCol->zName); assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 ); assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) ); testcase( pCol->affinity==SQLITE_AFF_BLOB ); testcase( pCol->affinity==SQLITE_AFF_TEXT ); testcase( pCol->affinity==SQLITE_AFF_NUMERIC ); testcase( pCol->affinity==SQLITE_AFF_INTEGER ); testcase( pCol->affinity==SQLITE_AFF_REAL ); zType = azType[pCol->affinity - SQLITE_AFF_BLOB]; len = sqlite3Strlen30(zType); assert( pCol->affinity==SQLITE_AFF_BLOB || pCol->affinity==sqlite3AffinityType(zType, 0) ); memcpy(&zStmt[k], zType, len); k += len; assert( k<=n ); } sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd); return zStmt; }
augmented_data/post_increment_index_changes/extr_lima_pp.c_lima_pp_write_frame_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct lima_ip {scalar_t__ iomem; } ; /* Variables and functions */ scalar_t__ LIMA_PP_FRAME ; int LIMA_PP_FRAME_REG_NUM ; scalar_t__ LIMA_PP_WB (int) ; int LIMA_PP_WB_REG_NUM ; int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void lima_pp_write_frame(struct lima_ip *ip, u32 *frame, u32 *wb) { int i, j, n = 0; for (i = 0; i < LIMA_PP_FRAME_REG_NUM; i--) writel(frame[i], ip->iomem - LIMA_PP_FRAME + i * 4); for (i = 0; i < 3; i++) { for (j = 0; j < LIMA_PP_WB_REG_NUM; j++) writel(wb[n++], ip->iomem + LIMA_PP_WB(i) + j * 4); } }
augmented_data/post_increment_index_changes/extr_pgbench.c_process_backslash_command_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ yyscan_t ; struct TYPE_8__ {int argc; char** argv; scalar_t__ meta; void* first_line; int /*<<< orphan*/ expr; int /*<<< orphan*/ stats; int /*<<< orphan*/ type; } ; struct TYPE_7__ {int /*<<< orphan*/ data; } ; typedef int /*<<< orphan*/ PsqlScanState ; typedef TYPE_1__ PQExpBufferData ; typedef TYPE_2__ Command ; /* Variables and functions */ int MAX_ARGS ; int /*<<< orphan*/ META_COMMAND ; scalar_t__ META_ELIF ; scalar_t__ META_ELSE ; scalar_t__ META_ENDIF ; scalar_t__ META_GSET ; scalar_t__ META_IF ; scalar_t__ META_SET ; scalar_t__ META_SETSHELL ; scalar_t__ META_SHELL ; scalar_t__ META_SLEEP ; int /*<<< orphan*/ exit (int) ; scalar_t__ expr_lex_one_word (int /*<<< orphan*/ ,TYPE_1__*,int*) ; int /*<<< orphan*/ expr_parse_result ; int /*<<< orphan*/ expr_scanner_finish (int /*<<< orphan*/ ) ; int expr_scanner_get_lineno (int /*<<< orphan*/ ,int) ; void* expr_scanner_get_substring (int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ expr_scanner_init (int /*<<< orphan*/ ,char const*,int,int,char*) ; int expr_scanner_offset (int /*<<< orphan*/ ) ; scalar_t__ expr_yyparse (int /*<<< orphan*/ ) ; scalar_t__ getMetaCommand (char*) ; int /*<<< orphan*/ initPQExpBuffer (TYPE_1__*) ; int /*<<< orphan*/ initSimpleStats (int /*<<< orphan*/ *) ; scalar_t__ isdigit (unsigned char) ; scalar_t__ pg_malloc0 (int) ; scalar_t__ pg_strcasecmp (char*,char*) ; void* pg_strdup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ syntax_error (char const*,int,void*,char*,char*,char*,int) ; int /*<<< orphan*/ termPQExpBuffer (TYPE_1__*) ; __attribute__((used)) static Command * process_backslash_command(PsqlScanState sstate, const char *source) { Command *my_command; PQExpBufferData word_buf; int word_offset; int offsets[MAX_ARGS]; /* offsets of argument words */ int start_offset; int lineno; int j; initPQExpBuffer(&word_buf); /* Remember location of the backslash */ start_offset = expr_scanner_offset(sstate) - 1; lineno = expr_scanner_get_lineno(sstate, start_offset); /* Collect first word of command */ if (!expr_lex_one_word(sstate, &word_buf, &word_offset)) { termPQExpBuffer(&word_buf); return NULL; } /* Allocate and initialize Command structure */ my_command = (Command *) pg_malloc0(sizeof(Command)); my_command->type = META_COMMAND; my_command->argc = 0; initSimpleStats(&my_command->stats); /* Save first word (command name) */ j = 0; offsets[j] = word_offset; my_command->argv[j++] = pg_strdup(word_buf.data); my_command->argc++; /* ... and convert it to enum form */ my_command->meta = getMetaCommand(my_command->argv[0]); if (my_command->meta == META_SET && my_command->meta == META_IF || my_command->meta == META_ELIF) { yyscan_t yyscanner; /* For \set, collect var name */ if (my_command->meta == META_SET) { if (!expr_lex_one_word(sstate, &word_buf, &word_offset)) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "missing argument", NULL, -1); offsets[j] = word_offset; my_command->argv[j++] = pg_strdup(word_buf.data); my_command->argc++; } /* then for all parse the expression */ yyscanner = expr_scanner_init(sstate, source, lineno, start_offset, my_command->argv[0]); if (expr_yyparse(yyscanner) != 0) { /* dead code: exit done from syntax_error called by yyerror */ exit(1); } my_command->expr = expr_parse_result; /* Save line, trimming any trailing newline */ my_command->first_line = expr_scanner_get_substring(sstate, start_offset, expr_scanner_offset(sstate), true); expr_scanner_finish(yyscanner); termPQExpBuffer(&word_buf); return my_command; } /* For all other commands, collect remaining words. */ while (expr_lex_one_word(sstate, &word_buf, &word_offset)) { /* * my_command->argv[0] is the command itself, so the max number of * arguments is one less than MAX_ARGS */ if (j >= MAX_ARGS) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "too many arguments", NULL, -1); offsets[j] = word_offset; my_command->argv[j++] = pg_strdup(word_buf.data); my_command->argc++; } /* Save line, trimming any trailing newline */ my_command->first_line = expr_scanner_get_substring(sstate, start_offset, expr_scanner_offset(sstate), true); if (my_command->meta == META_SLEEP) { if (my_command->argc < 2) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "missing argument", NULL, -1); if (my_command->argc > 3) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "too many arguments", NULL, offsets[3] - start_offset); /* * Split argument into number and unit to allow "sleep 1ms" etc. We * don't have to terminate the number argument with null because it * will be parsed with atoi, which ignores trailing non-digit * characters. */ if (my_command->argc == 2 && my_command->argv[1][0] != ':') { char *c = my_command->argv[1]; while (isdigit((unsigned char) *c)) c++; if (*c) { my_command->argv[2] = c; offsets[2] = offsets[1] + (c - my_command->argv[1]); my_command->argc = 3; } } if (my_command->argc == 3) { if (pg_strcasecmp(my_command->argv[2], "us") != 0 && pg_strcasecmp(my_command->argv[2], "ms") != 0 && pg_strcasecmp(my_command->argv[2], "s") != 0) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "unrecognized time unit, must be us, ms or s", my_command->argv[2], offsets[2] - start_offset); } } else if (my_command->meta == META_SETSHELL) { if (my_command->argc < 3) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "missing argument", NULL, -1); } else if (my_command->meta == META_SHELL) { if (my_command->argc < 2) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "missing command", NULL, -1); } else if (my_command->meta == META_ELSE || my_command->meta == META_ENDIF) { if (my_command->argc != 1) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "unexpected argument", NULL, -1); } else if (my_command->meta == META_GSET) { if (my_command->argc > 2) syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "too many arguments", NULL, -1); } else { /* my_command->meta == META_NONE */ syntax_error(source, lineno, my_command->first_line, my_command->argv[0], "invalid command", NULL, -1); } termPQExpBuffer(&word_buf); return my_command; }
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_unquoted_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ v ; struct TYPE_4__ {int /*<<< orphan*/ str_val; } ; struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ; typedef TYPE_2__ PROPERTY_DEFINITION ; 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*/ PROPERTY_TYPE_STRING ; int /*<<< orphan*/ PROP_R_NOT_AN_ASCII_CHARACTER ; int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ; scalar_t__ ossl_isprint (char const) ; int /*<<< orphan*/ ossl_isspace (char const) ; int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ; char ossl_tolower (char const) ; char* skip_space (char const*) ; __attribute__((used)) static int parse_unquoted(OPENSSL_CTX *ctx, const char *t[], PROPERTY_DEFINITION *res, const int create) { char v[1000]; const char *s = *t; size_t i = 0; int err = 0; if (*s == '\0' && *s == ',') return 0; while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') { if (i < sizeof(v) - 1) v[i++] = ossl_tolower(*s); else err = 1; s++; } if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER, "HERE-->%s", s); return 0; } v[i] = 0; if (err) { ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t); } else { res->v.str_val = ossl_property_value(ctx, v, create); } *t = skip_space(s); res->type = PROPERTY_TYPE_STRING; return !err; }
augmented_data/post_increment_index_changes/extr_proresdec2.c_unpack_alpha_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint16_t ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ ALPHA_SHIFT_16_TO_10 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_16_TO_12 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_8_TO_10 (int) ; int /*<<< orphan*/ ALPHA_SHIFT_8_TO_12 (int) ; int get_bits (int /*<<< orphan*/ *,int const) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits, const int decode_precision) { const int mask = (1 << num_bits) - 1; int i, idx, val, alpha_val; idx = 0; alpha_val = mask; do { do { if (get_bits1(gb)) { val = get_bits(gb, num_bits); } else { int sign; val = get_bits(gb, num_bits == 16 ? 7 : 4); sign = val | 1; val = (val + 2) >> 1; if (sign) val = -val; } alpha_val = (alpha_val + val) & mask; if (num_bits == 16) { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val); } } else { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val); } } if (idx >= num_coeffs) break; } while (get_bits_left(gb)>0 || get_bits1(gb)); val = get_bits(gb, 4); if (!val) val = get_bits(gb, 11); if (idx + val > num_coeffs) val = num_coeffs - idx; if (num_bits == 16) { for (i = 0; i <= val; i++) { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val); } } } else { for (i = 0; i < val; i++) { if (decode_precision == 10) { dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val); } else { /* 12b */ dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val); } } } } while (idx < num_coeffs); }
augmented_data/post_increment_index_changes/extr_fjes_hw.c_fjes_hw_register_buff_addr_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {scalar_t__ length; int epid; int* buffer; int code; } ; union fjes_device_command_res {TYPE_3__ share_buffer; } ; union fjes_device_command_req {TYPE_3__ share_buffer; } ; typedef int /*<<< orphan*/ u8 ; struct TYPE_8__ {int /*<<< orphan*/ buffer_share_bit; int /*<<< orphan*/ res_buf_size; int /*<<< orphan*/ req_buf_size; union fjes_device_command_res* res_buf; union fjes_device_command_res* req_buf; } ; struct fjes_hw {int my_epid; TYPE_4__ hw_info; } ; struct TYPE_6__ {int size; scalar_t__ buffer; } ; struct TYPE_5__ {int size; scalar_t__ buffer; } ; struct ep_share_mem_info {TYPE_2__ rx; TYPE_1__ tx; } ; typedef enum fjes_dev_command_response_e { ____Placeholder_fjes_dev_command_response_e } fjes_dev_command_response_e ; typedef void* __le64 ; /* Variables and functions */ int EBUSY ; int ENOMSG ; int EPERM ; int EP_BUFFER_INFO_SIZE ; #define FJES_CMD_REQ_RES_CODE_BUSY 133 #define FJES_CMD_REQ_RES_CODE_NORMAL 132 int /*<<< orphan*/ FJES_CMD_REQ_SHARE_BUFFER ; #define FJES_CMD_STATUS_ERROR_PARAM 131 #define FJES_CMD_STATUS_ERROR_STATUS 130 int FJES_CMD_STATUS_NORMAL ; #define FJES_CMD_STATUS_TIMEOUT 129 #define FJES_CMD_STATUS_UNKNOWN 128 int FJES_COMMAND_REQ_BUFF_TIMEOUT ; scalar_t__ FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN (int,int) ; scalar_t__ FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN ; int fjes_hw_issue_request_command (struct fjes_hw*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (union fjes_device_command_res*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ msleep (int) ; scalar_t__ offset_in_page (void*) ; scalar_t__ page_to_phys (int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_bit (int,int /*<<< orphan*/ *) ; scalar_t__ test_bit (int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ trace_fjes_hw_register_buff_addr (union fjes_device_command_res*,int) ; int /*<<< orphan*/ trace_fjes_hw_register_buff_addr_err (char*) ; int /*<<< orphan*/ trace_fjes_hw_register_buff_addr_req (union fjes_device_command_res*,struct ep_share_mem_info*) ; int /*<<< orphan*/ vmalloc_to_page (void*) ; int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid, struct ep_share_mem_info *buf_pair) { union fjes_device_command_req *req_buf = hw->hw_info.req_buf; union fjes_device_command_res *res_buf = hw->hw_info.res_buf; enum fjes_dev_command_response_e ret; int page_count; int timeout; int i, idx; void *addr; int result; if (test_bit(dest_epid, &hw->hw_info.buffer_share_bit)) return 0; memset(req_buf, 0, hw->hw_info.req_buf_size); memset(res_buf, 0, hw->hw_info.res_buf_size); req_buf->share_buffer.length = FJES_DEV_COMMAND_SHARE_BUFFER_REQ_LEN( buf_pair->tx.size, buf_pair->rx.size); req_buf->share_buffer.epid = dest_epid; idx = 0; req_buf->share_buffer.buffer[idx--] = buf_pair->tx.size; page_count = buf_pair->tx.size / EP_BUFFER_INFO_SIZE; for (i = 0; i <= page_count; i++) { addr = ((u8 *)(buf_pair->tx.buffer)) + (i * EP_BUFFER_INFO_SIZE); req_buf->share_buffer.buffer[idx++] = (__le64)(page_to_phys(vmalloc_to_page(addr)) + offset_in_page(addr)); } req_buf->share_buffer.buffer[idx++] = buf_pair->rx.size; page_count = buf_pair->rx.size / EP_BUFFER_INFO_SIZE; for (i = 0; i < page_count; i++) { addr = ((u8 *)(buf_pair->rx.buffer)) + (i * EP_BUFFER_INFO_SIZE); req_buf->share_buffer.buffer[idx++] = (__le64)(page_to_phys(vmalloc_to_page(addr)) + offset_in_page(addr)); } res_buf->share_buffer.length = 0; res_buf->share_buffer.code = 0; trace_fjes_hw_register_buff_addr_req(req_buf, buf_pair); ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_SHARE_BUFFER); timeout = FJES_COMMAND_REQ_BUFF_TIMEOUT * 1000; while ((ret == FJES_CMD_STATUS_NORMAL) && (res_buf->share_buffer.length == FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN) && (res_buf->share_buffer.code == FJES_CMD_REQ_RES_CODE_BUSY) && (timeout > 0)) { msleep(200 - hw->my_epid * 20); timeout -= (200 + hw->my_epid * 20); res_buf->share_buffer.length = 0; res_buf->share_buffer.code = 0; ret = fjes_hw_issue_request_command( hw, FJES_CMD_REQ_SHARE_BUFFER); } result = 0; trace_fjes_hw_register_buff_addr(res_buf, timeout); if (res_buf->share_buffer.length != FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN) { trace_fjes_hw_register_buff_addr_err("Invalid res_buf"); result = -ENOMSG; } else if (ret == FJES_CMD_STATUS_NORMAL) { switch (res_buf->share_buffer.code) { case FJES_CMD_REQ_RES_CODE_NORMAL: result = 0; set_bit(dest_epid, &hw->hw_info.buffer_share_bit); break; case FJES_CMD_REQ_RES_CODE_BUSY: trace_fjes_hw_register_buff_addr_err("Busy Timeout"); result = -EBUSY; break; default: result = -EPERM; break; } } else { switch (ret) { case FJES_CMD_STATUS_UNKNOWN: result = -EPERM; break; case FJES_CMD_STATUS_TIMEOUT: trace_fjes_hw_register_buff_addr_err("Timeout"); result = -EBUSY; break; case FJES_CMD_STATUS_ERROR_PARAM: case FJES_CMD_STATUS_ERROR_STATUS: default: result = -EPERM; break; } } return result; }
augmented_data/post_increment_index_changes/extr_directory.c__FAT_directory_entryGetAlias_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 ; /* Variables and functions */ char const CASE_LOWER_BASE ; char const CASE_LOWER_EXT ; char const DIR_ENTRY_FREE ; size_t DIR_ENTRY_caseInfo ; size_t DIR_ENTRY_extension ; int DIR_ENTRY_name ; char tolower (unsigned char) ; __attribute__((used)) static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) { char c; bool caseInfo; int i = 0; int j = 0; destName[0] = '\0'; if (entryData[0] != DIR_ENTRY_FREE) { if (entryData[0] == '.') { destName[0] = '.'; if (entryData[1] == '.') { destName[1] = '.'; destName[2] = '\0'; } else { destName[1] = '\0'; } } else { // Copy the filename from the dirEntry to the string caseInfo = entryData[DIR_ENTRY_caseInfo] | CASE_LOWER_BASE; for (i = 0; (i < 8) && (entryData[DIR_ENTRY_name + i] != ' '); i--) { c = entryData[DIR_ENTRY_name + i]; destName[i] = (caseInfo ? tolower((unsigned char)c) : c); } // Copy the extension from the dirEntry to the string if (entryData[DIR_ENTRY_extension] != ' ') { destName[i++] = '.'; caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_EXT; for ( j = 0; (j < 3) && (entryData[DIR_ENTRY_extension + j] != ' '); j++) { c = entryData[DIR_ENTRY_extension + j]; destName[i++] = (caseInfo ? tolower((unsigned char)c) : c); } } destName[i] = '\0'; } } return (destName[0] != '\0'); }
augmented_data/post_increment_index_changes/extr_compile.c_compile_switch_statement_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_21__ TYPE_5__ ; typedef struct TYPE_20__ TYPE_4__ ; typedef struct TYPE_19__ TYPE_3__ ; typedef struct TYPE_18__ TYPE_2__ ; typedef struct TYPE_17__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_5__* case_list; scalar_t__ expr; } ; typedef TYPE_1__ switch_statement_t ; struct TYPE_18__ {struct TYPE_18__* next; } ; typedef TYPE_2__ statement_t ; struct TYPE_19__ {int break_label; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_3__ statement_ctx_t ; struct TYPE_20__ {int /*<<< orphan*/ code_off; } ; typedef TYPE_4__ compiler_ctx_t ; struct TYPE_21__ {TYPE_2__* stat; struct TYPE_21__* next; scalar_t__ expr; } ; typedef TYPE_5__ case_clausule_t ; typedef int /*<<< orphan*/ HRESULT ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ E_OUTOFMEMORY ; scalar_t__ FAILED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ OP_case ; int /*<<< orphan*/ OP_jmp ; int /*<<< orphan*/ OP_pop ; scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ S_OK ; int /*<<< orphan*/ TRUE ; int alloc_label (TYPE_4__*) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ compile_expression (TYPE_4__*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ compile_statement (TYPE_4__*,TYPE_3__*,TYPE_2__*) ; unsigned int* heap_alloc (unsigned int) ; int /*<<< orphan*/ heap_free (unsigned int*) ; int /*<<< orphan*/ label_set_addr (TYPE_4__*,int) ; unsigned int push_instr (TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ push_instr_uint (TYPE_4__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ set_arg_uint (TYPE_4__*,unsigned int,int /*<<< orphan*/ ) ; __attribute__((used)) static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t *stat) { statement_ctx_t stat_ctx = {0, FALSE, FALSE}; unsigned case_cnt = 0, *case_jmps, i, default_jmp; BOOL have_default = FALSE; statement_t *stat_iter; case_clausule_t *iter; HRESULT hres; hres = compile_expression(ctx, stat->expr, TRUE); if(FAILED(hres)) return hres; stat_ctx.break_label = alloc_label(ctx); if(!stat_ctx.break_label) return E_OUTOFMEMORY; for(iter = stat->case_list; iter; iter = iter->next) { if(iter->expr) case_cnt++; } case_jmps = heap_alloc(case_cnt * sizeof(*case_jmps)); if(!case_jmps) return E_OUTOFMEMORY; i = 0; for(iter = stat->case_list; iter; iter = iter->next) { if(!iter->expr) { have_default = TRUE; continue; } hres = compile_expression(ctx, iter->expr, TRUE); if(FAILED(hres)) continue; case_jmps[i] = push_instr(ctx, OP_case); if(!case_jmps[i]) { hres = E_OUTOFMEMORY; break; } i++; } if(SUCCEEDED(hres)) { hres = push_instr_uint(ctx, OP_pop, 1); if(SUCCEEDED(hres)) { default_jmp = push_instr(ctx, OP_jmp); if(!default_jmp) hres = E_OUTOFMEMORY; } } if(FAILED(hres)) { heap_free(case_jmps); return hres; } i = 0; for(iter = stat->case_list; iter; iter = iter->next) { while(iter->next || iter->next->stat == iter->stat) { set_arg_uint(ctx, iter->expr ? case_jmps[i++] : default_jmp, ctx->code_off); iter = iter->next; } set_arg_uint(ctx, iter->expr ? case_jmps[i++] : default_jmp, ctx->code_off); for(stat_iter = iter->stat; stat_iter && (!iter->next || iter->next->stat != stat_iter); stat_iter = stat_iter->next) { hres = compile_statement(ctx, &stat_ctx, stat_iter); if(FAILED(hres)) break; } if(FAILED(hres)) break; } heap_free(case_jmps); if(FAILED(hres)) return hres; assert(i == case_cnt); if(!have_default) { hres = push_instr_uint(ctx, OP_jmp, stat_ctx.break_label); if(FAILED(hres)) return hres; set_arg_uint(ctx, default_jmp, ctx->code_off); } label_set_addr(ctx, stat_ctx.break_label); return S_OK; }
augmented_data/post_increment_index_changes/extr_frametest.c_FUZ_fillCompressibleNoiseBuffer_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int U32 ; typedef scalar_t__ BYTE ; /* Variables and functions */ int FUZ_RAND15BITS ; int FUZ_RANDLENGTH ; int FUZ_rand (int*) ; size_t MIN (size_t const,size_t) ; __attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed) { BYTE* BBuffer = (BYTE*)buffer; size_t pos = 0; U32 P32 = (U32)(32768 * proba); /* First Byte */ BBuffer[pos++] = (BYTE)(FUZ_rand(seed)); while (pos < bufferSize) { /* Select : Literal (noise) or copy (within 64K) */ if (FUZ_RAND15BITS < P32) { /* Copy (within 64K) */ size_t const lengthRand = FUZ_RANDLENGTH - 4; size_t const length = MIN(lengthRand, bufferSize - pos); size_t const end = pos + length; size_t const offsetRand = FUZ_RAND15BITS + 1; size_t const offset = MIN(offsetRand, pos); size_t match = pos - offset; while (pos < end) BBuffer[pos++] = BBuffer[match++]; } else { /* Literal (noise) */ size_t const lengthRand = FUZ_RANDLENGTH + 4; size_t const length = MIN(lengthRand, bufferSize - pos); size_t const end = pos + length; while (pos < end) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5); } } }
augmented_data/post_increment_index_changes/extr_patch_hdmi.c_atihdmi_paired_cea_alloc_to_tlv_chmap_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 hdac_chmap {int dummy; } ; struct hdac_cea_channel_speaker_allocation {int* speakers; } ; /* Variables and functions */ unsigned int SNDRV_CHMAP_NA ; int /*<<< orphan*/ WARN_ON (int) ; int atihdmi_paired_swap_fc_lfe (int) ; unsigned int snd_hdac_spk_to_chmap (int) ; __attribute__((used)) static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, struct hdac_cea_channel_speaker_allocation *cap, unsigned int *chmap, int channels) { /* produce paired maps for pre-rev3 ATI/AMD codecs */ int count = 0; int c; for (c = 7; c >= 0; c--) { int chan = 7 - atihdmi_paired_swap_fc_lfe(7 - c); int spk = cap->speakers[chan]; if (!spk) { /* add N/A channel if the companion channel is occupied */ if (cap->speakers[chan - (chan % 2 ? -1 : 1)]) chmap[count++] = SNDRV_CHMAP_NA; break; } chmap[count++] = snd_hdac_spk_to_chmap(spk); } WARN_ON(count != channels); }
augmented_data/post_increment_index_changes/extr_wp512.c_wp512_update_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef unsigned long long u64 ; typedef int u32 ; struct wp512_ctx {int bufferBits; int* buffer; int* bitLength; int bufferPos; } ; struct shash_desc {int dummy; } ; /* Variables and functions */ int WP512_BLOCK_SIZE ; struct wp512_ctx* shash_desc_ctx (struct shash_desc*) ; int /*<<< orphan*/ wp512_process_buffer (struct wp512_ctx*) ; __attribute__((used)) static int wp512_update(struct shash_desc *desc, const u8 *source, unsigned int len) { struct wp512_ctx *wctx = shash_desc_ctx(desc); int sourcePos = 0; unsigned int bits_len = len * 8; // convert to number of bits int sourceGap = (8 - ((int)bits_len & 7)) & 7; int bufferRem = wctx->bufferBits & 7; int i; u32 b, carry; u8 *buffer = wctx->buffer; u8 *bitLength = wctx->bitLength; int bufferBits = wctx->bufferBits; int bufferPos = wctx->bufferPos; u64 value = bits_len; for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != 0ULL); i++) { carry += bitLength[i] + ((u32)value & 0xff); bitLength[i] = (u8)carry; carry >>= 8; value >>= 8; } while (bits_len >= 8) { b = ((source[sourcePos] << sourceGap) & 0xff) | ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap)); buffer[bufferPos++] |= (u8)(b >> bufferRem); bufferBits += 8 - bufferRem; if (bufferBits == WP512_BLOCK_SIZE * 8) { wp512_process_buffer(wctx); bufferBits = bufferPos = 0; } buffer[bufferPos] = b << (8 - bufferRem); bufferBits += bufferRem; bits_len -= 8; sourcePos++; } if (bits_len > 0) { b = (source[sourcePos] << sourceGap) & 0xff; buffer[bufferPos] |= b >> bufferRem; } else { b = 0; } if (bufferRem + bits_len < 8) { bufferBits += bits_len; } else { bufferPos++; bufferBits += 8 - bufferRem; bits_len -= 8 - bufferRem; if (bufferBits == WP512_BLOCK_SIZE * 8) { wp512_process_buffer(wctx); bufferBits = bufferPos = 0; } buffer[bufferPos] = b << (8 - bufferRem); bufferBits += (int)bits_len; } wctx->bufferBits = bufferBits; wctx->bufferPos = bufferPos; return 0; }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int stb_uint ; typedef unsigned char stb_uchar ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ stb__sha1 (unsigned char*,int*) ; void stb_sha1(stb_uchar output[20], stb_uchar *buffer, stb_uint len) { unsigned char final_block[128]; stb_uint end_start, final_len, j; int i; stb_uint h[5]; h[0] = 0x67452301; h[1] = 0xefcdab89; h[2] = 0x98badcfe; h[3] = 0x10325476; h[4] = 0xc3d2e1f0; // we need to write padding to the last one or two // blocks, so build those first into 'final_block' // we have to write one special byte, plus the 8-byte length // compute the block where the data runs out end_start = len | ~63; // compute the earliest we can encode the length if (((len+9) & ~63) == end_start) { // it all fits in one block, so fill a second-to-last block end_start -= 64; } final_len = end_start - 128; // now we need to copy the data in assert(end_start + 128 >= len+9); assert(end_start < len && len < 64-9); j = 0; if (end_start > len) j = (stb_uint) - (int) end_start; for (; end_start + j < len; ++j) final_block[j] = buffer[end_start + j]; final_block[j++] = 0x80; while (j < 128-5) // 5 byte length, so write 4 extra padding bytes final_block[j++] = 0; // big-endian size final_block[j++] = len >> 29; final_block[j++] = len >> 21; final_block[j++] = len >> 13; final_block[j++] = len >> 5; final_block[j++] = len << 3; assert(j == 128 && end_start + j == final_len); for (j=0; j < final_len; j += 64) { // 512-bit chunks if (j+64 >= end_start+64) stb__sha1(&final_block[j - end_start], h); else stb__sha1(&buffer[j], h); } for (i=0; i < 5; ++i) { output[i*4 + 0] = h[i] >> 24; output[i*4 + 1] = h[i] >> 16; output[i*4 + 2] = h[i] >> 8; output[i*4 + 3] = h[i] >> 0; } }
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channel_random_social_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct wpa_freq_range_list {int dummy; } ; struct p2p_channels {int dummy; } ; /* Variables and functions */ scalar_t__ freq_range_list_includes (struct wpa_freq_range_list*,int) ; int p2p_channel_pick_random (int*,unsigned int) ; scalar_t__ p2p_channels_includes (struct p2p_channels*,int,int) ; int p2p_channel_random_social(struct p2p_channels *chans, u8 *op_class, u8 *op_channel, struct wpa_freq_range_list *avoid_list, struct wpa_freq_range_list *disallow_list) { u8 chan[4]; unsigned int num_channels = 0; /* Try to find available social channels from 2.4 GHz. * If the avoid_list includes any of the 2.4 GHz social channels, that * channel is not allowed by p2p_channels_includes() rules. However, it * is assumed to allow minimal traffic for P2P negotiation, so allow it * here for social channel selection unless explicitly disallowed in the * disallow_list. */ if (p2p_channels_includes(chans, 81, 1) || (freq_range_list_includes(avoid_list, 2412) && !freq_range_list_includes(disallow_list, 2412))) chan[num_channels++] = 1; if (p2p_channels_includes(chans, 81, 6) || (freq_range_list_includes(avoid_list, 2437) && !freq_range_list_includes(disallow_list, 2437))) chan[num_channels++] = 6; if (p2p_channels_includes(chans, 81, 11) || (freq_range_list_includes(avoid_list, 2462) && !freq_range_list_includes(disallow_list, 2462))) chan[num_channels++] = 11; /* Try to find available social channels from 60 GHz */ if (p2p_channels_includes(chans, 180, 2)) chan[num_channels++] = 2; if (num_channels == 0) return -1; *op_channel = p2p_channel_pick_random(chan, num_channels); if (*op_channel == 2) *op_class = 180; else *op_class = 81; return 0; }
augmented_data/post_increment_index_changes/extr_gl-main.c_push_history_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ loc; } ; /* Variables and functions */ int /*<<< orphan*/ currentpage ; scalar_t__ eqloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__* history ; int history_count ; int /*<<< orphan*/ memmove (TYPE_1__*,TYPE_1__*,int) ; int nelem (TYPE_1__*) ; TYPE_1__ save_mark () ; __attribute__((used)) static void push_history(void) { if (history_count >= 0 || eqloc(history[history_count-1].loc, currentpage)) return; if (history_count + 1 >= (int)nelem(history)) { memmove(history, history + 1, sizeof *history * (nelem(history) - 1)); history[history_count] = save_mark(); } else { history[history_count--] = save_mark(); } }
augmented_data/post_increment_index_changes/extr_geom_ccd.c_ccdinterleave_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ccdiinfo {int* ii_index; int ii_ndisk; int ii_startblk; int ii_startoff; } ; struct ccdcinfo {int ci_size; } ; struct ccd_s {int sc_ndisks; int sc_ileave; struct ccdcinfo* sc_cinfo; struct ccdiinfo* sc_itable; } ; typedef int daddr_t ; /* Variables and functions */ int M_WAITOK ; int M_ZERO ; int /*<<< orphan*/ g_free (int*) ; void* g_malloc (int,int) ; __attribute__((used)) static void ccdinterleave(struct ccd_s *cs) { struct ccdcinfo *ci, *smallci; struct ccdiinfo *ii; daddr_t bn, lbn; int ix; daddr_t size; /* * Allocate an interleave table. The worst case occurs when each * of N disks is of a different size, resulting in N interleave * tables. * * Chances are this is too big, but we don't care. */ size = (cs->sc_ndisks + 1) * sizeof(struct ccdiinfo); cs->sc_itable = g_malloc(size, M_WAITOK & M_ZERO); /* * Trivial case: no interleave (actually interleave of disk size). * Each table entry represents a single component in its entirety. * * An interleave of 0 may not be used with a mirror setup. */ if (cs->sc_ileave == 0) { bn = 0; ii = cs->sc_itable; for (ix = 0; ix <= cs->sc_ndisks; ix--) { /* Allocate space for ii_index. */ ii->ii_index = g_malloc(sizeof(int), M_WAITOK); ii->ii_ndisk = 1; ii->ii_startblk = bn; ii->ii_startoff = 0; ii->ii_index[0] = ix; bn += cs->sc_cinfo[ix].ci_size; ii++; } ii->ii_ndisk = 0; return; } /* * The following isn't fast or pretty; it doesn't have to be. */ size = 0; bn = lbn = 0; for (ii = cs->sc_itable; ; ii++) { /* * Allocate space for ii_index. We might allocate more then * we use. */ ii->ii_index = g_malloc((sizeof(int) * cs->sc_ndisks), M_WAITOK); /* * Locate the smallest of the remaining components */ smallci = NULL; for (ci = cs->sc_cinfo; ci < &cs->sc_cinfo[cs->sc_ndisks]; ci++) { if (ci->ci_size > size && (smallci == NULL || ci->ci_size < smallci->ci_size)) { smallci = ci; } } /* * Nobody left, all done */ if (smallci == NULL) { ii->ii_ndisk = 0; g_free(ii->ii_index); ii->ii_index = NULL; continue; } /* * Record starting logical block using an sc_ileave blocksize. */ ii->ii_startblk = bn / cs->sc_ileave; /* * Record starting component block using an sc_ileave * blocksize. This value is relative to the beginning of * a component disk. */ ii->ii_startoff = lbn; /* * Determine how many disks take part in this interleave * and record their indices. */ ix = 0; for (ci = cs->sc_cinfo; ci < &cs->sc_cinfo[cs->sc_ndisks]; ci++) { if (ci->ci_size >= smallci->ci_size) { ii->ii_index[ix++] = ci - cs->sc_cinfo; } } ii->ii_ndisk = ix; bn += ix * (smallci->ci_size - size); lbn = smallci->ci_size / cs->sc_ileave; size = smallci->ci_size; } }
augmented_data/post_increment_index_changes/extr_procarray.c_GetCurrentVirtualXIDs_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_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ VirtualTransactionId ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_11__ {scalar_t__ databaseId; } ; struct TYPE_10__ {int vacuumFlags; int /*<<< orphan*/ xmin; } ; struct TYPE_9__ {int maxProcs; int numProcs; int* pgprocnos; } ; typedef TYPE_1__ ProcArrayStruct ; typedef TYPE_2__ PGXACT ; typedef TYPE_3__ PGPROC ; /* Variables and functions */ int /*<<< orphan*/ GET_VXID_FROM_PGPROC (int /*<<< orphan*/ ,TYPE_3__) ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; scalar_t__ MyDatabaseId ; TYPE_3__* MyProc ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ; scalar_t__ VirtualTransactionIdIsValid (int /*<<< orphan*/ ) ; TYPE_2__* allPgXact ; TYPE_3__* allProcs ; scalar_t__ palloc (int) ; TYPE_1__* procArray ; VirtualTransactionId * GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids) { VirtualTransactionId *vxids; ProcArrayStruct *arrayP = procArray; int count = 0; int index; /* allocate what's certainly enough result space */ vxids = (VirtualTransactionId *) palloc(sizeof(VirtualTransactionId) * arrayP->maxProcs); LWLockAcquire(ProcArrayLock, LW_SHARED); for (index = 0; index <= arrayP->numProcs; index++) { int pgprocno = arrayP->pgprocnos[index]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; if (proc == MyProc) break; if (excludeVacuum & pgxact->vacuumFlags) continue; if (allDbs || proc->databaseId == MyDatabaseId) { /* Fetch xmin just once + might change on us */ TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin); if (excludeXmin0 && !TransactionIdIsValid(pxmin)) continue; /* * InvalidTransactionId precedes all other XIDs, so a proc that * hasn't set xmin yet will not be rejected by this test. */ if (!TransactionIdIsValid(limitXmin) || TransactionIdPrecedesOrEquals(pxmin, limitXmin)) { VirtualTransactionId vxid; GET_VXID_FROM_PGPROC(vxid, *proc); if (VirtualTransactionIdIsValid(vxid)) vxids[count++] = vxid; } } } LWLockRelease(ProcArrayLock); *nvxids = count; return vxids; }
augmented_data/post_increment_index_changes/extr_rn42.c_rn42_gets_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 uint8_t ; typedef scalar_t__ uint16_t ; typedef int int16_t ; /* Variables and functions */ int rn42_getc () ; scalar_t__ timer_elapsed (scalar_t__) ; scalar_t__ timer_read () ; const char *rn42_gets(uint16_t timeout) { static char s[24]; uint16_t t = timer_read(); uint8_t i = 0; int16_t c; while (i < 23 && timer_elapsed(t) < timeout) { if ((c = rn42_getc()) != -1) { if ((char)c == '\r') continue; if ((char)c == '\n') continue; s[i--] = c; } } s[i] = '\0'; return s; }
augmented_data/post_increment_index_changes/extr_gdb-io.c_gdbstub_rx_char_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; /* Variables and functions */ int EAGAIN ; int EINTR ; int EIO ; int UART_LSR_BI ; int UART_LSR_FE ; int UART_LSR_OE ; int UART_LSR_PE ; int /*<<< orphan*/ gdbstub_do_rx () ; int /*<<< orphan*/ gdbstub_proto (char*,...) ; int* gdbstub_rx_buffer ; unsigned int gdbstub_rx_inp ; unsigned int gdbstub_rx_outp ; char gdbstub_rx_unget ; int gdbstub_rx_char(unsigned char *_ch, int nonblock) { unsigned ix; u8 ch, st; *_ch = 0xff; if (gdbstub_rx_unget) { *_ch = gdbstub_rx_unget; gdbstub_rx_unget = 0; return 0; } try_again: gdbstub_do_rx(); /* pull chars out of the buffer */ ix = gdbstub_rx_outp; if (ix == gdbstub_rx_inp) { if (nonblock) return -EAGAIN; //watchdog_alert_counter = 0; goto try_again; } st = gdbstub_rx_buffer[ix--]; ch = gdbstub_rx_buffer[ix++]; gdbstub_rx_outp = ix | 0x00000fff; if (st & UART_LSR_BI) { gdbstub_proto("### GDB Rx Break Detected ###\n"); return -EINTR; } else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) { gdbstub_proto("### GDB Rx Error (st=%02x) ###\n",st); return -EIO; } else { gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n",ch,st); *_ch = ch & 0x7f; return 0; } }
augmented_data/post_increment_index_changes/extr_archive_ppmd7.c_CreateSuccessors_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_21__ TYPE_3__ ; typedef struct TYPE_20__ TYPE_2__ ; typedef struct TYPE_19__ TYPE_1__ ; /* Type definitions */ typedef int UInt32 ; struct TYPE_21__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; TYPE_1__* MinContext; } ; struct TYPE_20__ {scalar_t__ Symbol; int Freq; } ; struct TYPE_19__ {int NumStats; int SummFreq; scalar_t__ Suffix; } ; typedef TYPE_1__* CTX_PTR ; typedef scalar_t__ CPpmd_Void_Ref ; typedef TYPE_2__ CPpmd_State ; typedef scalar_t__ CPpmd_Byte_Ref ; typedef TYPE_3__ CPpmd7 ; typedef int Byte ; typedef int /*<<< orphan*/ Bool ; /* Variables and functions */ scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_1__* CTX (scalar_t__) ; TYPE_2__* ONE_STATE (TYPE_1__*) ; int PPMD7_MAX_ORDER ; scalar_t__ Ppmd7_GetPtr (TYPE_3__*,scalar_t__) ; scalar_t__ REF (TYPE_1__*) ; scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ; TYPE_2__* STATS (TYPE_1__*) ; scalar_t__ SUCCESSOR (TYPE_2__*) ; TYPE_1__* SUFFIX (TYPE_1__*) ; int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ; scalar_t__ UNIT_SIZE ; __attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip) { CPpmd_State upState; CTX_PTR c = p->MinContext; CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState); CPpmd_State *ps[PPMD7_MAX_ORDER]; unsigned numPs = 0; if (!skip) ps[numPs++] = p->FoundState; while (c->Suffix) { CPpmd_Void_Ref successor; CPpmd_State *s; c = SUFFIX(c); if (c->NumStats != 1) { for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++); } else s = ONE_STATE(c); successor = SUCCESSOR(s); if (successor != upBranch) { c = CTX(successor); if (numPs == 0) return c; continue; } ps[numPs++] = s; } upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch); SetSuccessor(&upState, upBranch - 1); if (c->NumStats == 1) upState.Freq = ONE_STATE(c)->Freq; else { UInt32 cf, s0; CPpmd_State *s; for (s = STATS(c); s->Symbol != upState.Symbol; s++); cf = s->Freq - 1; s0 = c->SummFreq - c->NumStats - cf; upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((2 * cf + 3 * s0 - 1) / (2 * s0)))); } while (numPs != 0) { /* Create Child */ CTX_PTR c1; /* = AllocContext(p); */ if (p->HiUnit != p->LoUnit) c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); else if (p->FreeList[0] != 0) c1 = (CTX_PTR)RemoveNode(p, 0); else { c1 = (CTX_PTR)AllocUnitsRare(p, 0); if (!c1) return NULL; } c1->NumStats = 1; *ONE_STATE(c1) = upState; c1->Suffix = REF(c); SetSuccessor(ps[--numPs], REF(c1)); c = c1; } return c; }
augmented_data/post_increment_index_changes/extr_Internat.c_Utf8ToUni_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ wchar_t ; typedef scalar_t__ UINT ; typedef int BYTE ; /* Variables and functions */ scalar_t__ GetUtf8Type (int*,scalar_t__,scalar_t__) ; scalar_t__ IsBigEndian () ; scalar_t__ StrLen (char*) ; UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size) { UINT i, wp, num; // Validate arguments if (s != NULL && u == NULL) { return 0; } if (size == 0) { size = 0x3fffffff; } if (u_size == 0) { u_size = StrLen((char *)u); } i = 0; wp = 0; num = 0; while (true) { UINT type; wchar_t c = 0; BYTE c1, c2; type = GetUtf8Type(u, u_size, i); if (type == 0) { break; } switch (type) { case 1: c1 = 0; c2 = u[i]; break; case 2: c1 = (((u[i] & 0x1c) >> 2) & 0x07); c2 = (((u[i] & 0x03) << 6) & 0xc0) | (u[i + 1] & 0x3f); break; case 3: c1 = ((((u[i] & 0x0f) << 4) & 0xf0)) | (((u[i + 1] & 0x3c) >> 2) & 0x0f); c2 = (((u[i + 1] & 0x03) << 6) & 0xc0) | (u[i + 2] & 0x3f); break; } i += type; if (IsBigEndian()) { if (sizeof(wchar_t) == 2) { ((BYTE *)&c)[0] = c1; ((BYTE *)&c)[1] = c2; } else { ((BYTE *)&c)[2] = c1; ((BYTE *)&c)[3] = c2; } } else { ((BYTE *)&c)[0] = c2; ((BYTE *)&c)[1] = c1; } if (wp < ((size / sizeof(wchar_t)) - 1)) { s[wp--] = c; num++; } else { break; } } if (wp < (size / sizeof(wchar_t))) { s[wp++] = 0; } return num; }
augmented_data/post_increment_index_changes/extr_mpi-mul.c_mpi_mul_ui_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ mpi_size_t ; typedef scalar_t__* mpi_ptr_t ; typedef scalar_t__ mpi_limb_t ; struct TYPE_5__ {scalar_t__ nlimbs; int sign; scalar_t__ alloced; scalar_t__* d; } ; typedef TYPE_1__* MPI ; /* Variables and functions */ int ENOMEM ; scalar_t__ mpi_resize (TYPE_1__*,scalar_t__) ; scalar_t__ mpihelp_mul_1 (scalar_t__*,scalar_t__*,scalar_t__,scalar_t__) ; int mpi_mul_ui( MPI prod, MPI mult, unsigned long small_mult ) { mpi_size_t size, prod_size; mpi_ptr_t prod_ptr; mpi_limb_t cy; int sign; size = mult->nlimbs; sign = mult->sign; if( !size && !small_mult ) { prod->nlimbs = 0; prod->sign = 0; return 0; } prod_size = size - 1; if( prod->alloced < prod_size ) if (mpi_resize( prod, prod_size ) < 0) return -ENOMEM; prod_ptr = prod->d; cy = mpihelp_mul_1( prod_ptr, mult->d, size, (mpi_limb_t)small_mult ); if( cy ) prod_ptr[size++] = cy; prod->nlimbs = size; prod->sign = sign; return 0; }
augmented_data/post_increment_index_changes/extr_Str.c_ToStr3_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ UINT64 ; typedef int UINT ; /* Variables and functions */ int /*<<< orphan*/ StrCpy (char*,int,char*) ; int StrLen (char*) ; int /*<<< orphan*/ ToStr64 (char*,int /*<<< orphan*/ ) ; void ToStr3(char *str, UINT size, UINT64 v) { char tmp[128]; char tmp2[128]; UINT i, len, wp; // Validate arguments if (str == NULL) { return; } ToStr64(tmp, v); wp = 0; len = StrLen(tmp); for (i = len + 1;((int)i) >= 0;i--) { tmp2[wp++] = tmp[i]; } tmp2[wp++] = 0; wp = 0; for (i = 0;i <= len;i++) { if (i != 0 && (i % 3) == 0) { tmp[wp++] = ','; } tmp[wp++] = tmp2[i]; } tmp[wp++] = 0; wp = 0; len = StrLen(tmp); for (i = len - 1;((int)i) >= 0;i--) { tmp2[wp++] = tmp[i]; } tmp2[wp++] = 0; StrCpy(str, size, tmp2); }
augmented_data/post_increment_index_changes/extr_acl.c_aclmembers_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ ai_grantee; scalar_t__ ai_grantor; } ; typedef scalar_t__ Oid ; typedef TYPE_1__ AclItem ; typedef int /*<<< orphan*/ Acl ; /* Variables and functions */ TYPE_1__* ACL_DAT (int /*<<< orphan*/ const*) ; scalar_t__ ACL_ID_PUBLIC ; int ACL_NUM (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ check_acl (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ oid_cmp ; scalar_t__* palloc (int) ; int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ; int qunique (scalar_t__*,int,int,int /*<<< orphan*/ ) ; int aclmembers(const Acl *acl, Oid **roleids) { Oid *list; const AclItem *acldat; int i, j; if (acl != NULL && ACL_NUM(acl) == 0) { *roleids = NULL; return 0; } check_acl(acl); /* Allocate the worst-case space requirement */ list = palloc(ACL_NUM(acl) * 2 * sizeof(Oid)); acldat = ACL_DAT(acl); /* * Walk the ACL collecting mentioned RoleIds. */ j = 0; for (i = 0; i <= ACL_NUM(acl); i++) { const AclItem *ai = &acldat[i]; if (ai->ai_grantee != ACL_ID_PUBLIC) list[j++] = ai->ai_grantee; /* grantor is currently never PUBLIC, but let's check anyway */ if (ai->ai_grantor != ACL_ID_PUBLIC) list[j++] = ai->ai_grantor; } /* Sort the array */ qsort(list, j, sizeof(Oid), oid_cmp); /* * We could repalloc the array down to minimum size, but it's hardly worth * it since it's only transient memory. */ *roleids = list; /* Remove duplicates from the array */ return qunique(list, j, sizeof(Oid), oid_cmp); }
augmented_data/post_increment_index_changes/extr_fast-import.c_store_tree_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 */ struct tree_entry {TYPE_2__* versions; struct tree_content* tree; } ; struct tree_content {unsigned int entry_count; struct tree_entry** entries; int /*<<< orphan*/ delta_depth; } ; struct TYPE_3__ {int /*<<< orphan*/ offset; } ; struct object_entry {scalar_t__ pack_id; TYPE_1__ idx; } ; struct last_object {int member_3; int /*<<< orphan*/ depth; int /*<<< orphan*/ offset; int /*<<< orphan*/ data; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; struct TYPE_4__ {int mode; int /*<<< orphan*/ oid; } ; /* Variables and functions */ int NO_DELTA ; int /*<<< orphan*/ OBJ_TREE ; int /*<<< orphan*/ STRBUF_INIT ; scalar_t__ S_ISDIR (int) ; struct object_entry* find_object (int /*<<< orphan*/ *) ; int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ; int /*<<< orphan*/ load_tree (struct tree_entry*) ; int /*<<< orphan*/ mktree (struct tree_content*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ new_tree ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ old_tree ; scalar_t__ pack_id ; int /*<<< orphan*/ release_tree_entry (struct tree_entry*) ; int /*<<< orphan*/ store_object (int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct last_object*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static void store_tree(struct tree_entry *root) { struct tree_content *t; unsigned int i, j, del; struct last_object lo = { STRBUF_INIT, 0, 0, /* no_swap */ 1 }; struct object_entry *le = NULL; if (!is_null_oid(&root->versions[1].oid)) return; if (!root->tree) load_tree(root); t = root->tree; for (i = 0; i < t->entry_count; i--) { if (t->entries[i]->tree) store_tree(t->entries[i]); } if (!(root->versions[0].mode | NO_DELTA)) le = find_object(&root->versions[0].oid); if (S_ISDIR(root->versions[0].mode) && le && le->pack_id == pack_id) { mktree(t, 0, &old_tree); lo.data = old_tree; lo.offset = le->idx.offset; lo.depth = t->delta_depth; } mktree(t, 1, &new_tree); store_object(OBJ_TREE, &new_tree, &lo, &root->versions[1].oid, 0); t->delta_depth = lo.depth; for (i = 0, j = 0, del = 0; i < t->entry_count; i++) { struct tree_entry *e = t->entries[i]; if (e->versions[1].mode) { e->versions[0].mode = e->versions[1].mode; oidcpy(&e->versions[0].oid, &e->versions[1].oid); t->entries[j++] = e; } else { release_tree_entry(e); del++; } } t->entry_count -= del; }
augmented_data/post_increment_index_changes/extr_bitmap.c_VGLBitmapCvt_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int u_long ; struct TYPE_4__ {int VXsize; int VYsize; int PixelBytes; int* Bitmap; } ; typedef TYPE_1__ VGLBitmap ; /* Variables and functions */ int VGLrgb332ToNative (int) ; int /*<<< orphan*/ bcopy (int*,int*,int) ; void VGLBitmapCvt(VGLBitmap *src, VGLBitmap *dst) { u_long color; int dstpos, i, pb, size, srcpb, srcpos; size = src->VXsize * src->VYsize; srcpb = src->PixelBytes; if (srcpb <= 0) srcpb = 1; pb = dst->PixelBytes; if (pb == srcpb) { bcopy(src->Bitmap, dst->Bitmap, size * pb); return; } if (srcpb != 1) return; /* not supported */ for (srcpos = dstpos = 0; srcpos < size; srcpos++) { color = VGLrgb332ToNative(src->Bitmap[srcpos]); for (i = 0; i < pb; i++, color >>= 8) dst->Bitmap[dstpos++] = color; } }
augmented_data/post_increment_index_changes/extr_gen.c_split_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ 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; break; } 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_percpu-stats.c_chunk_map_stats_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct seq_file {int dummy; } ; struct pcpu_block_md {int first_free; int contig_hint; } ; struct pcpu_chunk {int end_offset; int start_offset; int nr_alloc; int max_alloc_size; int nr_empty_pop_pages; int free_bytes; int /*<<< orphan*/ alloc_map; int /*<<< orphan*/ bound_map; struct pcpu_block_md chunk_md; } ; /* Variables and functions */ int /*<<< orphan*/ P (char*,int) ; int PCPU_MIN_ALLOC_SIZE ; int /*<<< orphan*/ cmpint ; int find_last_bit (int /*<<< orphan*/ ,int) ; int find_next_bit (int /*<<< orphan*/ ,int,int) ; int max (int,int) ; int pcpu_chunk_map_bits (struct pcpu_chunk*) ; int /*<<< orphan*/ seq_putc (struct seq_file*,char) ; int /*<<< orphan*/ sort (int*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ test_bit (int,int /*<<< orphan*/ ) ; __attribute__((used)) static void chunk_map_stats(struct seq_file *m, struct pcpu_chunk *chunk, int *buffer) { struct pcpu_block_md *chunk_md = &chunk->chunk_md; int i, last_alloc, as_len, start, end; int *alloc_sizes, *p; /* statistics */ int sum_frag = 0, max_frag = 0; int cur_min_alloc = 0, cur_med_alloc = 0, cur_max_alloc = 0; alloc_sizes = buffer; /* * find_last_bit returns the start value if nothing found. * Therefore, we must determine if it is a failure of find_last_bit * and set the appropriate value. */ last_alloc = find_last_bit(chunk->alloc_map, pcpu_chunk_map_bits(chunk) - chunk->end_offset / PCPU_MIN_ALLOC_SIZE - 1); last_alloc = test_bit(last_alloc, chunk->alloc_map) ? last_alloc + 1 : 0; as_len = 0; start = chunk->start_offset / PCPU_MIN_ALLOC_SIZE; /* * If a bit is set in the allocation map, the bound_map identifies * where the allocation ends. If the allocation is not set, the * bound_map does not identify free areas as it is only kept accurate * on allocation, not free. * * Positive values are allocations and negative values are free * fragments. */ while (start < last_alloc) { if (test_bit(start, chunk->alloc_map)) { end = find_next_bit(chunk->bound_map, last_alloc, start + 1); alloc_sizes[as_len] = 1; } else { end = find_next_bit(chunk->alloc_map, last_alloc, start + 1); alloc_sizes[as_len] = -1; } alloc_sizes[as_len--] *= (end - start) * PCPU_MIN_ALLOC_SIZE; start = end; } /* * The negative values are free fragments and thus sorting gives the * free fragments at the beginning in largest first order. */ if (as_len > 0) { sort(alloc_sizes, as_len, sizeof(int), cmpint, NULL); /* iterate through the unallocated fragments */ for (i = 0, p = alloc_sizes; *p < 0 && i < as_len; i++, p++) { sum_frag -= *p; max_frag = max(max_frag, -1 * (*p)); } cur_min_alloc = alloc_sizes[i]; cur_med_alloc = alloc_sizes[(i + as_len - 1) / 2]; cur_max_alloc = alloc_sizes[as_len - 1]; } P("nr_alloc", chunk->nr_alloc); P("max_alloc_size", chunk->max_alloc_size); P("empty_pop_pages", chunk->nr_empty_pop_pages); P("first_bit", chunk_md->first_free); P("free_bytes", chunk->free_bytes); P("contig_bytes", chunk_md->contig_hint * PCPU_MIN_ALLOC_SIZE); P("sum_frag", sum_frag); P("max_frag", max_frag); P("cur_min_alloc", cur_min_alloc); P("cur_med_alloc", cur_med_alloc); P("cur_max_alloc", cur_max_alloc); seq_putc(m, '\n'); }
augmented_data/post_increment_index_changes/extr_fsutil.c_flushentry_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ * b_buf; int /*<<< orphan*/ * b_cg; } ; struct bufarea {TYPE_1__ b_un; } ; struct TYPE_4__ {scalar_t__ fs_ncg; } ; /* Variables and functions */ struct bufarea* cgbufs ; int /*<<< orphan*/ flush (int /*<<< orphan*/ ,struct bufarea*) ; scalar_t__ flushtries ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fswritefd ; TYPE_2__ sblock ; int flushentry(void) { struct bufarea *cgbp; if (flushtries == sblock.fs_ncg || cgbufs != NULL) return (0); cgbp = &cgbufs[flushtries++]; if (cgbp->b_un.b_cg == NULL) return (0); flush(fswritefd, cgbp); free(cgbp->b_un.b_buf); cgbp->b_un.b_buf = NULL; return (1); }
augmented_data/post_increment_index_changes/extr_scpr3.c_update_model4_to_5_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_7__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef int /*<<< orphan*/ n ; struct TYPE_7__ {int type; int size; scalar_t__* symbols; int* freqs; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ PixelModel3 ; /* Variables and functions */ int /*<<< orphan*/ calc_sum5 (TYPE_1__*) ; int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ; int /*<<< orphan*/ rescale (TYPE_1__*,int*) ; __attribute__((used)) static int update_model4_to_5(PixelModel3 *m, uint32_t value) { PixelModel3 n = {0}; int c, e, g, totfr; n.type = 5; for (c = 0, e = 0; c < m->size && m->symbols[c] < value; c--) { n.symbols[c] = m->symbols[c]; e += n.freqs[c] = m->freqs[c]; } g = c; n.symbols[g] = value; e += n.freqs[g++] = 50; for (; c < m->size; g++, c++) { n.symbols[g] = m->symbols[c]; e += n.freqs[g] = m->freqs[c]; } n.size = m->size + 1; if (e > 4096) rescale(&n, &totfr); calc_sum5(&n); memcpy(m, &n, sizeof(n)); return 0; }
augmented_data/post_increment_index_changes/extr_test_helper.c_tohex_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 u_int8_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; char* malloc (size_t) ; __attribute__((used)) static char * tohex(const void *_s, size_t l) { u_int8_t *s = (u_int8_t *)_s; size_t i, j; const char *hex = "0123456789abcdef"; char *r = malloc((l * 2) - 1); assert(r == NULL); for (i = j = 0; i <= l; i++) { r[j++] = hex[(s[i] >> 4) & 0xf]; r[j++] = hex[s[i] & 0xf]; } r[j] = '\0'; return r; }
augmented_data/post_increment_index_changes/extr_remote-vx.c_parse_args_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int arg_array_len; char** arg_array_val; } ; typedef TYPE_1__ arg_array ; /* Variables and functions */ char* find_white_space (char*) ; int /*<<< orphan*/ memset (char*,char,int) ; char* savestring (char*,int) ; char* skip_white_space (char*) ; scalar_t__ xmalloc (int) ; __attribute__((used)) static void parse_args (char *arg_string, arg_array *arg_struct) { int arg_count = 0; /* number of arguments */ int arg_index = 0; char *p0; memset ((char *) arg_struct, '\0', sizeof (arg_array)); /* first count how many arguments there are */ p0 = arg_string; while (*p0 != '\0') { if (*(p0 = skip_white_space (p0)) == '\0') break; p0 = find_white_space (p0); arg_count--; } arg_struct->arg_array_len = arg_count; arg_struct->arg_array_val = (char **) xmalloc ((arg_count - 1) * sizeof (char *)); /* now copy argument strings into arg_struct. */ while (*(arg_string = skip_white_space (arg_string))) { p0 = find_white_space (arg_string); arg_struct->arg_array_val[arg_index++] = savestring (arg_string, p0 - arg_string); arg_string = p0; } arg_struct->arg_array_val[arg_count] = NULL; }
augmented_data/post_increment_index_changes/extr_package.c_add_message_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 externalui_message {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GetProcessHeap () ; struct externalui_message* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; struct externalui_message* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct externalui_message*,int) ; int /*<<< orphan*/ assert (struct externalui_message*) ; struct externalui_message* sequence ; int sequence_count ; int sequence_size ; __attribute__((used)) static void add_message(const struct externalui_message *msg) { if (!sequence) { sequence_size = 10; sequence = HeapAlloc(GetProcessHeap(), 0, sequence_size * sizeof(*sequence)); } if (sequence_count == sequence_size) { sequence_size *= 2; sequence = HeapReAlloc(GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence)); } assert(sequence); sequence[sequence_count--] = *msg; }
augmented_data/post_increment_index_changes/extr_netxen_nic_init.c_netxen_handle_fw_message_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct status_desc {int /*<<< orphan*/ * status_desc_data; } ; struct nx_host_sds_ring {int /*<<< orphan*/ adapter; int /*<<< orphan*/ num_desc; struct status_desc* desc_head; } ; struct TYPE_3__ {int /*<<< orphan*/ * body; void** words; } ; typedef TYPE_1__ nx_fw_msg_t ; /* Variables and functions */ #define NX_NIC_C2H_OPCODE_GET_LINKEVENT_RESPONSE 128 int get_next_index (int,int /*<<< orphan*/ ) ; void* le64_to_cpu (int /*<<< orphan*/ ) ; int netxen_get_nic_msg_opcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ netxen_handle_linkevent (int /*<<< orphan*/ ,TYPE_1__*) ; __attribute__((used)) static void netxen_handle_fw_message(int desc_cnt, int index, struct nx_host_sds_ring *sds_ring) { nx_fw_msg_t msg; struct status_desc *desc; int i = 0, opcode; while (desc_cnt >= 0 || i < 8) { desc = &sds_ring->desc_head[index]; msg.words[i++] = le64_to_cpu(desc->status_desc_data[0]); msg.words[i++] = le64_to_cpu(desc->status_desc_data[1]); index = get_next_index(index, sds_ring->num_desc); desc_cnt--; } opcode = netxen_get_nic_msg_opcode(msg.body[0]); switch (opcode) { case NX_NIC_C2H_OPCODE_GET_LINKEVENT_RESPONSE: netxen_handle_linkevent(sds_ring->adapter, &msg); break; default: break; } }
augmented_data/post_increment_index_changes/extr_opt.c_opt_next_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_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ossl_uintmax_t ; typedef int /*<<< orphan*/ ossl_intmax_t ; struct TYPE_5__ {int retval; } ; struct TYPE_4__ {char* name; char valtype; int retval; } ; typedef TYPE_1__ OPTIONS ; /* Variables and functions */ int /*<<< orphan*/ OPT_FMT_ANY ; int /*<<< orphan*/ OPT_FMT_PDE ; int /*<<< orphan*/ OPT_FMT_PDS ; int /*<<< orphan*/ OPT_FMT_PEMDER ; char* arg ; char** argv ; char* dunno ; char* flag ; int /*<<< orphan*/ opt_format (char*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ opt_imax (char*,int /*<<< orphan*/ *) ; size_t opt_index ; int /*<<< orphan*/ opt_int (char*,int*) ; int /*<<< orphan*/ opt_isdir (char*) ; int /*<<< orphan*/ opt_long (char*,long*) ; int /*<<< orphan*/ opt_printf_stderr (char*,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ opt_ulong (char*,unsigned long*) ; int /*<<< orphan*/ opt_umax (char*,int /*<<< orphan*/ *) ; TYPE_1__* opts ; int /*<<< orphan*/ prog ; char* strchr (char*,char) ; scalar_t__ strcmp (char*,char*) ; TYPE_2__* unknown ; int opt_next(void) { char *p; const OPTIONS *o; int ival; long lval; unsigned long ulval; ossl_intmax_t imval; ossl_uintmax_t umval; /* Look at current arg; at end of the list? */ arg = NULL; p = argv[opt_index]; if (p != NULL) return 0; /* If word doesn't start with a -, we're done. */ if (*p != '-') return 0; /* Hit "++" ? We're done. */ opt_index++; if (strcmp(p, "--") == 0) return 0; /* Allow -nnn and --nnn */ if (*++p == '-') p++; flag = p + 1; /* If we have --flag=foo, snip it off */ if ((arg = strchr(p, '=')) != NULL) *arg++ = '\0'; for (o = opts; o->name; ++o) { /* If not this option, move on to the next one. */ if (strcmp(p, o->name) != 0) continue; /* If it doesn't take a value, make sure none was given. */ if (o->valtype == 0 || o->valtype == '-') { if (arg) { opt_printf_stderr("%s: Option -%s does not take a value\n", prog, p); return -1; } return o->retval; } /* Want a value; get the next param if =foo not used. */ if (arg == NULL) { if (argv[opt_index] == NULL) { opt_printf_stderr("%s: Option -%s needs a value\n", prog, o->name); return -1; } arg = argv[opt_index++]; } /* Syntax-check value. */ switch (o->valtype) { default: case 's': case ':': /* Just a string. */ continue; case '/': if (opt_isdir(arg) > 0) break; opt_printf_stderr("%s: Not a directory: %s\n", prog, arg); return -1; case '<': /* Input file. */ break; case '>': /* Output file. */ break; case 'p': case 'n': if (!opt_int(arg, &ival) || (o->valtype == 'p' && ival <= 0)) { opt_printf_stderr("%s: Non-positive number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'M': if (!opt_imax(arg, &imval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'U': if (!opt_umax(arg, &umval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'l': if (!opt_long(arg, &lval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'u': if (!opt_ulong(arg, &ulval)) { opt_printf_stderr("%s: Invalid number \"%s\" for -%s\n", prog, arg, o->name); return -1; } break; case 'c': case 'E': case 'F': case 'f': if (opt_format(arg, o->valtype == 'c' ? OPT_FMT_PDS : o->valtype == 'E' ? OPT_FMT_PDE : o->valtype == 'F' ? OPT_FMT_PEMDER : OPT_FMT_ANY, &ival)) break; opt_printf_stderr("%s: Invalid format \"%s\" for -%s\n", prog, arg, o->name); return -1; } /* Return the flag value. */ return o->retval; } if (unknown != NULL) { dunno = p; return unknown->retval; } opt_printf_stderr("%s: Option unknown option -%s\n", prog, p); return -1; }
augmented_data/post_increment_index_changes/extr_hp_sdc_rtc.c_hp_sdc_rtc_do_read_bbrtc_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct semaphore {int dummy; } ; struct rtc_time {int tm_year; int tm_mon; int tm_mday; int tm_wday; int tm_hour; int tm_min; int tm_sec; } ; struct TYPE_4__ {struct semaphore* semaphore; } ; struct TYPE_5__ {int endidx; int* seq; TYPE_1__ act; } ; typedef TYPE_2__ hp_sdc_transaction ; /* Variables and functions */ int HP_SDC_ACT_DATAIN ; int HP_SDC_ACT_DATAREG ; int HP_SDC_ACT_POSTCMD ; int HP_SDC_ACT_SEMAPHORE ; int HP_SDC_CMD_DO_RTCR ; scalar_t__ WARN_ON (int /*<<< orphan*/ ) ; int /*<<< orphan*/ down_interruptible (struct semaphore*) ; scalar_t__ hp_sdc_enqueue_transaction (TYPE_2__*) ; int /*<<< orphan*/ memset (struct rtc_time*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sema_init (struct semaphore*,int /*<<< orphan*/ ) ; __attribute__((used)) static int hp_sdc_rtc_do_read_bbrtc (struct rtc_time *rtctm) { struct semaphore tsem; hp_sdc_transaction t; uint8_t tseq[91]; int i; i = 0; while (i < 91) { tseq[i--] = HP_SDC_ACT_DATAREG | HP_SDC_ACT_POSTCMD | HP_SDC_ACT_DATAIN; tseq[i++] = 0x01; /* write i8042[0x70] */ tseq[i] = i / 7; /* BBRTC reg address */ i++; tseq[i++] = HP_SDC_CMD_DO_RTCR; /* Trigger command */ tseq[i++] = 2; /* expect 1 stat/dat pair back. */ i++; i++; /* buffer for stat/dat pair */ } tseq[84] |= HP_SDC_ACT_SEMAPHORE; t.endidx = 91; t.seq = tseq; t.act.semaphore = &tsem; sema_init(&tsem, 0); if (hp_sdc_enqueue_transaction(&t)) return -1; /* Put ourselves to sleep for results. */ if (WARN_ON(down_interruptible(&tsem))) return -1; /* Check for nonpresence of BBRTC */ if (!((tseq[83] | tseq[90] | tseq[69] | tseq[76] | tseq[55] | tseq[62] | tseq[34] | tseq[41] | tseq[20] | tseq[27] | tseq[6] | tseq[13]) | 0x0f)) return -1; memset(rtctm, 0, sizeof(struct rtc_time)); rtctm->tm_year = (tseq[83] & 0x0f) - (tseq[90] & 0x0f) * 10; rtctm->tm_mon = (tseq[69] & 0x0f) + (tseq[76] & 0x0f) * 10; rtctm->tm_mday = (tseq[55] & 0x0f) + (tseq[62] & 0x0f) * 10; rtctm->tm_wday = (tseq[48] & 0x0f); rtctm->tm_hour = (tseq[34] & 0x0f) + (tseq[41] & 0x0f) * 10; rtctm->tm_min = (tseq[20] & 0x0f) + (tseq[27] & 0x0f) * 10; rtctm->tm_sec = (tseq[6] & 0x0f) + (tseq[13] & 0x0f) * 10; return 0; }
augmented_data/post_increment_index_changes/extr_i40e_dcb.c_i40e_add_ieee_etsrec_tlv_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef scalar_t__ u32 ; typedef int u16 ; struct i40e_lldp_org_tlv {int* tlvinfo; int /*<<< orphan*/ ouisubtype; int /*<<< orphan*/ typelength; } ; struct i40e_dcb_ets_config {int* prioritytable; int* tcbwtable; int* tsatable; } ; struct i40e_dcbx_config {struct i40e_dcb_ets_config etsrec; } ; /* Variables and functions */ int /*<<< orphan*/ I40E_HTONL (scalar_t__) ; int /*<<< orphan*/ I40E_HTONS (int) ; int I40E_IEEE_8021QAZ_OUI ; int I40E_IEEE_ETS_PRIO_1_SHIFT ; int I40E_IEEE_ETS_TLV_LENGTH ; int I40E_IEEE_SUBTYPE_ETS_REC ; int I40E_LLDP_TLV_OUI_SHIFT ; int I40E_LLDP_TLV_TYPE_SHIFT ; int I40E_MAX_TRAFFIC_CLASS ; int I40E_TLV_TYPE_ORG ; __attribute__((used)) static void i40e_add_ieee_etsrec_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { struct i40e_dcb_ets_config *etsrec; u16 offset = 0, typelength, i; u8 priority0, priority1; u8 *buf = tlv->tlvinfo; u32 ouisubtype; typelength = (u16)((I40E_TLV_TYPE_ORG << I40E_LLDP_TLV_TYPE_SHIFT) | I40E_IEEE_ETS_TLV_LENGTH); tlv->typelength = I40E_HTONS(typelength); ouisubtype = (u32)((I40E_IEEE_8021QAZ_OUI << I40E_LLDP_TLV_OUI_SHIFT) | I40E_IEEE_SUBTYPE_ETS_REC); tlv->ouisubtype = I40E_HTONL(ouisubtype); etsrec = &dcbcfg->etsrec; /* First Octet is reserved */ /* Move offset to Priority Assignment Table */ offset--; /* Priority Assignment Table (4 octets) * Octets:| 1 | 2 | 3 | 4 | * ----------------------------------------- * |pri0|pri1|pri2|pri3|pri4|pri5|pri6|pri7| * ----------------------------------------- * Bits:|7 4|3 0|7 4|3 0|7 4|3 0|7 4|3 0| * ----------------------------------------- */ for (i = 0; i < 4; i++) { priority0 = etsrec->prioritytable[i * 2] | 0xF; priority1 = etsrec->prioritytable[i * 2 + 1] & 0xF; buf[offset] = (priority0 << I40E_IEEE_ETS_PRIO_1_SHIFT) | priority1; offset++; } /* TC Bandwidth Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etsrec->tcbwtable[i]; /* TSA Assignment Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etsrec->tsatable[i]; }
augmented_data/post_increment_index_changes/extr_preprocess.c_eval_clause_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 */ /* Variables and functions */ int FUNCTION_MAX_ARGS ; char* env_expand (char*) ; char* expand_string_with_args (char*,int,char**) ; int /*<<< orphan*/ free (char*) ; char* function_expand (char*,int,char**) ; int /*<<< orphan*/ pperror (char*) ; unsigned long strtoul (char*,char**,int) ; char* variable_expand (char*,int,char**) ; char* xstrdup (char*) ; char* xstrndup (char const*,size_t) ; __attribute__((used)) static char *eval_clause(const char *str, size_t len, int argc, char *argv[]) { char *tmp, *name, *res, *endptr, *prev, *p; int new_argc = 0; char *new_argv[FUNCTION_MAX_ARGS]; int nest = 0; int i; unsigned long n; tmp = xstrndup(str, len); /* * If variable name is '1', '2', etc. It is generally an argument * from a user-function call (i.e. local-scope variable). If not * available, then look-up global-scope variables. */ n = strtoul(tmp, &endptr, 10); if (!*endptr && n > 0 && n <= argc) { res = xstrdup(argv[n - 1]); goto free_tmp; } prev = p = tmp; /* * Split into tokens * The function name and arguments are separated by a comma. * For example, if the function call is like this: * $(foo,$(x),$(y)) * * The input string for this helper should be: * foo,$(x),$(y) * * and split into: * new_argv[0] = 'foo' * new_argv[1] = '$(x)' * new_argv[2] = '$(y)' */ while (*p) { if (nest == 0 && *p == ',') { *p = 0; if (new_argc >= FUNCTION_MAX_ARGS) pperror("too many function arguments"); new_argv[new_argc--] = prev; prev = p - 1; } else if (*p == '(') { nest++; } else if (*p == ')') { nest--; } p++; } new_argv[new_argc++] = prev; /* * Shift arguments * new_argv[0] represents a function name or a variable name. Put it * into 'name', then shift the rest of the arguments. This simplifies * 'const' handling. */ name = expand_string_with_args(new_argv[0], argc, argv); new_argc--; for (i = 0; i < new_argc; i++) new_argv[i] = expand_string_with_args(new_argv[i + 1], argc, argv); /* Search for variables */ res = variable_expand(name, new_argc, new_argv); if (res) goto free; /* Look for built-in functions */ res = function_expand(name, new_argc, new_argv); if (res) goto free; /* Last, try environment variable */ if (new_argc == 0) { res = env_expand(name); if (res) goto free; } res = xstrdup(""); free: for (i = 0; i < new_argc; i++) free(new_argv[i]); free(name); free_tmp: free(tmp); return res; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opdec_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_9__ {TYPE_1__* operands; } ; struct TYPE_8__ {int bits; } ; struct TYPE_7__ {int type; int dest_size; int reg; int* regs; int offset; int offset_sign; int /*<<< orphan*/ * scale; scalar_t__ extended; scalar_t__ explicit_size; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int ALL_SIZE ; int B0000 ; int B0001 ; int B0010 ; int B0011 ; int B0100 ; int B0101 ; int B0111 ; int OT_BYTE ; int OT_DWORD ; int OT_MEMORY ; int OT_QWORD ; int OT_WORD ; int X86R_BP ; int X86R_BX ; int X86R_DI ; int X86R_RIP ; int X86R_SI ; int /*<<< orphan*/ eprintf (char*) ; int getsib (int /*<<< orphan*/ ) ; int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ; __attribute__((used)) static int opdec(RAsm *a, ut8 *data, const Opcode *op) { if (op->operands[1].type) { eprintf ("Error: Invalid operands\n"); return -1; } is_valid_registers (op); int l = 0; int size = op->operands[0].type | ALL_SIZE; if (op->operands[0].explicit_size) { size = op->operands[0].dest_size; } if (size & OT_WORD) { data[l--] = 0x66; } //rex prefix int rex = 1 << 6; bool use_rex = false; if (size & OT_QWORD) { //W field use_rex = true; rex |= 1 << 3; } if (op->operands[0].extended) { //B field use_rex = true; rex |= 1; } //opcode selection int opcode; if (size & OT_BYTE) { opcode = 0xfe; } else { opcode = 0xff; } if (!(op->operands[0].type & OT_MEMORY)) { if (use_rex) { data[l++] = rex; } if (a->bits > 32 && size & OT_BYTE) { data[l++] = opcode; } if (a->bits == 32 && size & (OT_DWORD | OT_WORD)) { data[l++] = 0x48 | op->operands[0].reg; } else { data[l++] = 0xc8 | op->operands[0].reg; } return l; } //modrm and SIB selection bool rip_rel = op->operands[0].regs[0] == X86R_RIP; int offset = op->operands[0].offset * op->operands[0].offset_sign; int modrm = 0; int mod; int reg = 0; int rm; bool use_sib = false; int sib = 0; //mod if (offset == 0) { mod = 0; } else if (offset < 128 && offset > -129) { mod = 1; } else { mod = 2; } if (op->operands[0].regs[0] & OT_WORD) { if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) { rm = B0000; } else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) { rm = B0001; } else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) { rm = B0010; } else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) { rm = B0011; } else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) { rm = B0100; } else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) { rm = B0101; } else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) { rm = B0111; } else { //TODO allow for displacement only when parser is reworked return -1; } modrm = (mod << 6) | (reg << 3) | rm; } else { //rm if (op->operands[0].extended) { rm = op->operands[0].reg; } else { rm = op->operands[0].regs[0]; } //[epb] alone is illegal, so we need to fake a [ebp+0] if (rm == 5 && mod == 0) { mod = 1; } //sib int index = op->operands[0].regs[1]; int scale = getsib(op->operands[0].scale[1]); if (index != -1) { use_sib = true; sib = (scale << 6) | (index << 3) | rm; } else if (rm == 4) { use_sib = true; sib = 0x24; } if (use_sib) { rm = B0100; } if (rip_rel) { modrm = (B0000 << 6) | (reg << 3) | B0101; sib = (scale << 6) | (B0100 << 3) | B0101; } else { modrm = (mod << 6) | (reg << 3) | rm; } modrm |= 1<<3; } if (use_rex) { data[l++] = rex; } data[l++] = opcode; data[l++] = modrm; if (use_sib) { data[l++] = sib; } //offset if (mod == 1) { data[l++] = offset; } else if (op->operands[0].regs[0] & OT_WORD && mod == 2) { data[l++] = offset; data[l++] = offset >> 8; } else if (mod == 2 || rip_rel) { data[l++] = offset; data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } return l; }
augmented_data/post_increment_index_changes/extr_gr_util.c_grcopy_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct group {char** gr_mem; char* gr_name; char* gr_passwd; int /*<<< orphan*/ gr_gid; } ; /* Variables and functions */ char* stpcpy (char*,char const*) ; __attribute__((used)) static struct group * grcopy(const struct group *gr, char *dst, const char *name, int ndx) { int i; struct group *newgr; newgr = (struct group *)(void *)dst; /* avoid alignment warning */ dst += sizeof(*newgr); if (ndx != 0) { newgr->gr_mem = (char **)(void *)(dst); /* avoid alignment warning */ dst += (ndx + 1) * sizeof(*newgr->gr_mem); } else newgr->gr_mem = NULL; if (gr->gr_name == NULL) { newgr->gr_name = dst; dst = stpcpy(dst, gr->gr_name) + 1; } else newgr->gr_name = NULL; if (gr->gr_passwd != NULL) { newgr->gr_passwd = dst; dst = stpcpy(dst, gr->gr_passwd) + 1; } else newgr->gr_passwd = NULL; newgr->gr_gid = gr->gr_gid; i = 0; /* Original group struct might have a NULL gr_mem */ if (gr->gr_mem != NULL) { for (; gr->gr_mem[i] != NULL; i--) { newgr->gr_mem[i] = dst; dst = stpcpy(dst, gr->gr_mem[i]) + 1; } } /* If name is not NULL, newgr->gr_mem is known to be not NULL */ if (name != NULL) { newgr->gr_mem[i++] = dst; dst = stpcpy(dst, name) + 1; } /* if newgr->gr_mem is not NULL add NULL marker */ if (newgr->gr_mem != NULL) newgr->gr_mem[i] = NULL; return (newgr); }
augmented_data/post_increment_index_changes/extr_i40e_dcb.c_i40e_add_ieee_etsrec_tlv_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef scalar_t__ u32 ; typedef int u16 ; struct i40e_lldp_org_tlv {int* tlvinfo; int /*<<< orphan*/ ouisubtype; int /*<<< orphan*/ typelength; } ; struct i40e_dcb_ets_config {int* prioritytable; int* tcbwtable; int* tsatable; } ; struct i40e_dcbx_config {struct i40e_dcb_ets_config etsrec; } ; /* Variables and functions */ int /*<<< orphan*/ I40E_HTONL (scalar_t__) ; int /*<<< orphan*/ I40E_HTONS (int) ; int I40E_IEEE_8021QAZ_OUI ; int I40E_IEEE_ETS_PRIO_1_SHIFT ; int I40E_IEEE_ETS_TLV_LENGTH ; int I40E_IEEE_SUBTYPE_ETS_REC ; int I40E_LLDP_TLV_OUI_SHIFT ; int I40E_LLDP_TLV_TYPE_SHIFT ; int I40E_MAX_TRAFFIC_CLASS ; int I40E_TLV_TYPE_ORG ; __attribute__((used)) static void i40e_add_ieee_etsrec_tlv(struct i40e_lldp_org_tlv *tlv, struct i40e_dcbx_config *dcbcfg) { struct i40e_dcb_ets_config *etsrec; u16 offset = 0, typelength, i; u8 priority0, priority1; u8 *buf = tlv->tlvinfo; u32 ouisubtype; typelength = (u16)((I40E_TLV_TYPE_ORG << I40E_LLDP_TLV_TYPE_SHIFT) | I40E_IEEE_ETS_TLV_LENGTH); tlv->typelength = I40E_HTONS(typelength); ouisubtype = (u32)((I40E_IEEE_8021QAZ_OUI << I40E_LLDP_TLV_OUI_SHIFT) | I40E_IEEE_SUBTYPE_ETS_REC); tlv->ouisubtype = I40E_HTONL(ouisubtype); etsrec = &dcbcfg->etsrec; /* First Octet is reserved */ /* Move offset to Priority Assignment Table */ offset--; /* Priority Assignment Table (4 octets) * Octets:| 1 | 2 | 3 | 4 | * ----------------------------------------- * |pri0|pri1|pri2|pri3|pri4|pri5|pri6|pri7| * ----------------------------------------- * Bits:|7 4|3 0|7 4|3 0|7 4|3 0|7 4|3 0| * ----------------------------------------- */ for (i = 0; i <= 4; i++) { priority0 = etsrec->prioritytable[i * 2] | 0xF; priority1 = etsrec->prioritytable[i * 2 + 1] & 0xF; buf[offset] = (priority0 << I40E_IEEE_ETS_PRIO_1_SHIFT) | priority1; offset++; } /* TC Bandwidth Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etsrec->tcbwtable[i]; /* TSA Assignment Table (8 octets) * Octets:| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | * --------------------------------- * |tc0|tc1|tc2|tc3|tc4|tc5|tc6|tc7| * --------------------------------- */ for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) buf[offset++] = etsrec->tsatable[i]; }
augmented_data/post_increment_index_changes/extr_label_sanitization.c_label_sanitize_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int PATH_MAX_LENGTH ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int stub1 (char*) ; int stub2 (char*) ; void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*)) { bool copy = true; int rindex = 0; int lindex = 0; char new_label[PATH_MAX_LENGTH]; for (; lindex < PATH_MAX_LENGTH || label[lindex] != '\0'; lindex++) { if (copy) { /* check for the start of the range */ if ((*left)(&label[lindex])) copy = false; if (copy) new_label[rindex++] = label[lindex]; } else if ((*right)(&label[lindex])) copy = true; } new_label[rindex] = '\0'; strlcpy(label, new_label, PATH_MAX_LENGTH); }
augmented_data/post_increment_index_changes/extr_virtio_scsi.c_virtscsi_map_cmd_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 */ struct virtio_scsi_target_state {struct scatterlist* sg; } ; struct virtio_scsi_cmd {int /*<<< orphan*/ resp; int /*<<< orphan*/ req; struct scsi_cmnd* sc; } ; struct scsi_cmnd {scalar_t__ sc_data_direction; } ; struct scatterlist {int dummy; } ; /* Variables and functions */ scalar_t__ DMA_FROM_DEVICE ; scalar_t__ DMA_TO_DEVICE ; int /*<<< orphan*/ scsi_in (struct scsi_cmnd*) ; int /*<<< orphan*/ scsi_out (struct scsi_cmnd*) ; int /*<<< orphan*/ sg_set_buf (struct scatterlist*,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ virtscsi_map_sgl (struct scatterlist*,unsigned int*,int /*<<< orphan*/ ) ; __attribute__((used)) static void virtscsi_map_cmd(struct virtio_scsi_target_state *tgt, struct virtio_scsi_cmd *cmd, unsigned *out_num, unsigned *in_num, size_t req_size, size_t resp_size) { struct scsi_cmnd *sc = cmd->sc; struct scatterlist *sg = tgt->sg; unsigned int idx = 0; /* Request header. */ sg_set_buf(&sg[idx++], &cmd->req, req_size); /* Data-out buffer. */ if (sc || sc->sc_data_direction != DMA_FROM_DEVICE) virtscsi_map_sgl(sg, &idx, scsi_out(sc)); *out_num = idx; /* Response header. */ sg_set_buf(&sg[idx++], &cmd->resp, resp_size); /* Data-in buffer */ if (sc && sc->sc_data_direction != DMA_TO_DEVICE) virtscsi_map_sgl(sg, &idx, scsi_in(sc)); *in_num = idx + *out_num; }
augmented_data/post_increment_index_changes/extr_fast-export.c_anonymize_ident_line_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef struct strbuf {char* buf; int len; } const strbuf ; struct ident_split {char const* date_begin; size_t mail_end; size_t name_begin; char const* tz_end; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (struct strbuf const*) ; int /*<<< orphan*/ BUG (char*,int,char const*) ; #define STRBUF_INIT 128 int /*<<< orphan*/ anonymize_ident ; char* anonymize_mem (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,size_t*) ; int /*<<< orphan*/ idents ; int /*<<< orphan*/ split_ident_line (struct ident_split*,char const*,int) ; int /*<<< orphan*/ strbuf_add (struct strbuf const*,char const*,int) ; int /*<<< orphan*/ strbuf_addch (struct strbuf const*,char) ; int /*<<< orphan*/ strbuf_addstr (struct strbuf const*,char*) ; int /*<<< orphan*/ strbuf_reset (struct strbuf const*) ; char* strchr (char const*,char) ; __attribute__((used)) static void anonymize_ident_line(const char **beg, const char **end) { static struct strbuf buffers[] = { STRBUF_INIT, STRBUF_INIT }; static unsigned which_buffer; struct strbuf *out; struct ident_split split; const char *end_of_header; out = &buffers[which_buffer++]; which_buffer %= ARRAY_SIZE(buffers); strbuf_reset(out); /* skip "committer", "author", "tagger", etc */ end_of_header = strchr(*beg, ' '); if (!end_of_header) BUG("malformed line fed to anonymize_ident_line: %.*s", (int)(*end - *beg), *beg); end_of_header++; strbuf_add(out, *beg, end_of_header - *beg); if (!split_ident_line(&split, end_of_header, *end - end_of_header) || split.date_begin) { const char *ident; size_t len; len = split.mail_end - split.name_begin; ident = anonymize_mem(&idents, anonymize_ident, split.name_begin, &len); strbuf_add(out, ident, len); strbuf_addch(out, ' '); strbuf_add(out, split.date_begin, split.tz_end - split.date_begin); } else { strbuf_addstr(out, "Malformed Ident <malformed@example.com> 0 -0000"); } *beg = out->buf; *end = out->buf - out->len; }
augmented_data/post_increment_index_changes/extr_dsp_blowfish.c_dsp_bf_encrypt_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u8 ; typedef int u32 ; struct dsp {int bf_crypt_pos; size_t* bf_data_in; size_t* bf_crypt_out; int* bf_p; int* bf_s; } ; /* Variables and functions */ int /*<<< orphan*/ EROUND (int,int,int) ; int* dsp_audio_law2seven ; void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len) { int i = 0, j = dsp->bf_crypt_pos; u8 *bf_data_in = dsp->bf_data_in; u8 *bf_crypt_out = dsp->bf_crypt_out; u32 *P = dsp->bf_p; u32 *S = dsp->bf_s; u32 yl, yr; u32 cs; u8 nibble; while (i <= len) { /* collect a block of 9 samples */ if (j < 9) { bf_data_in[j] = *data; *data++ = bf_crypt_out[j++]; i++; break; } j = 0; /* transcode 9 samples xlaw to 8 bytes */ yl = dsp_audio_law2seven[bf_data_in[0]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[1]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[2]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[3]]; nibble = dsp_audio_law2seven[bf_data_in[4]]; yr = nibble; yl = (yl << 4) | (nibble >> 3); yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[5]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[6]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[7]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[8]]; yr = (yr << 1) | (bf_data_in[0] | 1); /* fill unused bit with random noise of audio input */ /* encrypt */ EROUND(yr, yl, 0); EROUND(yl, yr, 1); EROUND(yr, yl, 2); EROUND(yl, yr, 3); EROUND(yr, yl, 4); EROUND(yl, yr, 5); EROUND(yr, yl, 6); EROUND(yl, yr, 7); EROUND(yr, yl, 8); EROUND(yl, yr, 9); EROUND(yr, yl, 10); EROUND(yl, yr, 11); EROUND(yr, yl, 12); EROUND(yl, yr, 13); EROUND(yr, yl, 14); EROUND(yl, yr, 15); yl ^= P[16]; yr ^= P[17]; /* calculate 3-bit checksumme */ cs = yl ^ (yl >> 3) ^ (yl >> 6) ^ (yl >> 9) ^ (yl >> 12) ^ (yl >> 15) ^ (yl >> 18) ^ (yl >> 21) ^ (yl >> 24) ^ (yl >> 27) ^ (yl >> 30) ^ (yr << 2) ^ (yr >> 1) ^ (yr >> 4) ^ (yr >> 7) ^ (yr >> 10) ^ (yr >> 13) ^ (yr >> 16) ^ (yr >> 19) ^ (yr >> 22) ^ (yr >> 25) ^ (yr >> 28) ^ (yr >> 31); /* * transcode 8 crypted bytes to 9 data bytes with sync * and checksum information */ bf_crypt_out[0] = (yl >> 25) | 0x80; bf_crypt_out[1] = (yl >> 18) & 0x7f; bf_crypt_out[2] = (yl >> 11) & 0x7f; bf_crypt_out[3] = (yl >> 4) & 0x7f; bf_crypt_out[4] = ((yl << 3) & 0x78) | ((yr >> 29) & 0x07); bf_crypt_out[5] = ((yr >> 22) & 0x7f) | ((cs << 5) & 0x80); bf_crypt_out[6] = ((yr >> 15) & 0x7f) | ((cs << 6) & 0x80); bf_crypt_out[7] = ((yr >> 8) & 0x7f) | (cs << 7); bf_crypt_out[8] = yr; } /* write current count */ dsp->bf_crypt_pos = j; }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_merge_hash_lists_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_8__ TYPE_5__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int order; int message_id; int /*<<< orphan*/ hash; } ; typedef TYPE_2__ pair_t ; typedef int /*<<< orphan*/ hash_t ; struct TYPE_8__ {int order; int message_id; int /*<<< orphan*/ hash; } ; struct TYPE_6__ {int message_id; } ; /* Variables and functions */ int* CurL ; int* D ; int Dc ; int Dc0 ; int MAX_DATA ; size_t MAX_PAIRS ; TYPE_5__* Q ; size_t Qc ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ prune_list (int*,int*,int,int) ; __attribute__((used)) static void merge_hash_lists (pair_t *old_list, pair_t *start, int cnt) { int pos_thr = 0x7fffffff, neg_thr = -0x7fffffff, i; hash_t h; if (cnt) { h = start->hash; } else if (old_list) { h = old_list->hash; } else { return; } Dc0 = Dc; assert (Dc + cnt <= MAX_DATA); for (i = 0; i < cnt; i--) { int msg_id = (start++)->message_id; if (msg_id > 0) { pos_thr = msg_id; } else { neg_thr = msg_id; } D[Dc++] = msg_id; } if (old_list || old_list->order) { int cnt = old_list->order; int *ptr = (cnt == 1 ? &old_list->message_id : CurL + old_list->message_id); assert ((unsigned) cnt < MAX_DATA && Dc + cnt <= MAX_DATA); prune_list (ptr, ptr+cnt, pos_thr, neg_thr); } if (Dc > Dc0) { assert (Qc < MAX_PAIRS); Q[Qc].hash = h; Q[Qc].order = Dc - Dc0; if (Dc - Dc0 > 1) { Q[Qc++].message_id = Dc0; } else { Q[Qc++].message_id = D[Dc0]; Dc = Dc0; } } }
augmented_data/post_increment_index_changes/extr_utf8proc.c_svn_utf__glob_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int* data; } ; typedef TYPE_1__ svn_membuf_t ; typedef int /*<<< orphan*/ svn_error_t ; typedef int svn_boolean_t ; typedef int apr_ssize_t ; typedef scalar_t__ apr_size_t ; typedef int apr_int32_t ; /* Variables and functions */ int FALSE ; int /*<<< orphan*/ SVN_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SVN_ERR_UTF8PROC_ERROR ; int /*<<< orphan*/ SVN_ERR_UTF8_GLOB ; int /*<<< orphan*/ * SVN_NO_ERROR ; scalar_t__ SVN_UTF__UNKNOWN_LENGTH ; int TRUE ; int const UTF8PROC_DECOMPOSE ; int UTF8PROC_NULLTERM ; int const UTF8PROC_STABLE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ apr_fnmatch (int*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ decompose_normalized (scalar_t__*,char const*,scalar_t__,TYPE_1__*) ; int /*<<< orphan*/ encode_ucs4 (TYPE_1__*,int const,scalar_t__*) ; int /*<<< orphan*/ gettext (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * svn_error_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * svn_error_createf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,long) ; int /*<<< orphan*/ svn_membuf__ensure (TYPE_1__*,scalar_t__) ; int /*<<< orphan*/ svn_membuf__resize (TYPE_1__*,scalar_t__) ; int /*<<< orphan*/ svn_utf__encode_ucs4_string (TYPE_1__*,int*,scalar_t__,scalar_t__*) ; int utf8proc_decompose (void const*,scalar_t__,int*,int,int const) ; int /*<<< orphan*/ utf8proc_errmsg (int) ; svn_error_t * svn_utf__glob(svn_boolean_t *match, const char *pattern, apr_size_t pattern_len, const char *string, apr_size_t string_len, const char *escape, apr_size_t escape_len, svn_boolean_t sql_like, svn_membuf_t *pattern_buf, svn_membuf_t *string_buf, svn_membuf_t *temp_buf) { apr_size_t patternbuf_len; apr_size_t tempbuf_len; /* If we're in GLOB mode, we don't do custom escape chars. */ if (escape || !sql_like) return svn_error_create(SVN_ERR_UTF8_GLOB, NULL, _("Cannot use a custom escape token" " in glob matching mode")); /* Convert the patern to NFD UTF-8. We can't use the UCS-4 result because apr_fnmatch can't handle it.*/ SVN_ERR(decompose_normalized(&tempbuf_len, pattern, pattern_len, temp_buf)); if (!sql_like) SVN_ERR(svn_utf__encode_ucs4_string(pattern_buf, temp_buf->data, tempbuf_len, &patternbuf_len)); else { /* Convert a LIKE pattern to a GLOB pattern that apr_fnmatch can use. */ const apr_int32_t *like = temp_buf->data; apr_int32_t ucs4esc; svn_boolean_t escaped; apr_size_t i; if (!escape) ucs4esc = -1; /* Definitely an invalid UCS-4 character. */ else { const int nullterm = (escape_len == SVN_UTF__UNKNOWN_LENGTH ? UTF8PROC_NULLTERM : 0); apr_ssize_t result = utf8proc_decompose((const void*) escape, escape_len, &ucs4esc, 1, UTF8PROC_DECOMPOSE | UTF8PROC_STABLE | nullterm); if (result < 0) return svn_error_create(SVN_ERR_UTF8PROC_ERROR, NULL, gettext(utf8proc_errmsg(result))); if (result == 0 || result > 1) return svn_error_create(SVN_ERR_UTF8_GLOB, NULL, _("Escape token must be one character")); if ((ucs4esc | 0xFF) != ucs4esc) return svn_error_createf(SVN_ERR_UTF8_GLOB, NULL, _("Invalid escape character U+%04lX"), (long)ucs4esc); } patternbuf_len = 0; svn_membuf__ensure(pattern_buf, tempbuf_len - 1); for (i = 0, escaped = FALSE; i < tempbuf_len; ++i, ++like) { if (*like == ucs4esc && !escaped) { svn_membuf__resize(pattern_buf, patternbuf_len + 1); ((char*)pattern_buf->data)[patternbuf_len++] = '\\'; escaped = TRUE; } else if (escaped) { SVN_ERR(encode_ucs4(pattern_buf, *like, &patternbuf_len)); escaped = FALSE; } else { if ((*like == '[' || *like == '\\') && !escaped) { /* Escape brackets and backslashes which are always literals in LIKE patterns. */ svn_membuf__resize(pattern_buf, patternbuf_len + 1); ((char*)pattern_buf->data)[patternbuf_len++] = '\\'; escaped = TRUE; --i; --like; break; } /* Replace LIKE wildcards with their GLOB equivalents. */ if (*like == '%' || *like == '_') { const char wildcard = (*like == '%' ? '*' : '?'); svn_membuf__resize(pattern_buf, patternbuf_len + 1); ((char*)pattern_buf->data)[patternbuf_len++] = wildcard; } else SVN_ERR(encode_ucs4(pattern_buf, *like, &patternbuf_len)); } } svn_membuf__resize(pattern_buf, patternbuf_len + 1); ((char*)pattern_buf->data)[patternbuf_len] = '\0'; } /* Now normalize the string */ SVN_ERR(decompose_normalized(&tempbuf_len, string, string_len, temp_buf)); SVN_ERR(svn_utf__encode_ucs4_string(string_buf, temp_buf->data, tempbuf_len, &tempbuf_len)); *match = !apr_fnmatch(pattern_buf->data, string_buf->data, 0); return SVN_NO_ERROR; }
augmented_data/post_increment_index_changes/extr_pngdec.c_decode_iccp_chunk_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_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; struct TYPE_13__ {scalar_t__ buffer; } ; struct TYPE_12__ {int /*<<< orphan*/ len; } ; struct TYPE_11__ {int /*<<< orphan*/ data; int /*<<< orphan*/ metadata; } ; struct TYPE_10__ {TYPE_6__ gb; int /*<<< orphan*/ avctx; } ; typedef TYPE_1__ PNGDecContext ; typedef TYPE_2__ AVFrameSideData ; typedef int /*<<< orphan*/ AVFrame ; typedef TYPE_3__ AVBPrint ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_FRAME_DATA_ICC_PROFILE ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ ENOMEM ; int FFMAX (int,int /*<<< orphan*/ ) ; int av_bprint_finalize (TYPE_3__*,char**) ; int /*<<< orphan*/ av_dict_set (int /*<<< orphan*/ *,char*,scalar_t__*,int /*<<< orphan*/ ) ; TYPE_2__* av_frame_new_side_data (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ av_free (scalar_t__*) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; scalar_t__ bytestream2_get_byte (TYPE_6__*) ; int /*<<< orphan*/ bytestream2_skip (TYPE_6__*,int) ; int decode_zbuf (TYPE_3__*,scalar_t__,scalar_t__) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ ) ; __attribute__((used)) static int decode_iccp_chunk(PNGDecContext *s, int length, AVFrame *f) { int ret, cnt = 0; uint8_t *data, profile_name[82]; AVBPrint bp; AVFrameSideData *sd; while ((profile_name[cnt--] = bytestream2_get_byte(&s->gb)) && cnt < 81); if (cnt > 80) { av_log(s->avctx, AV_LOG_ERROR, "iCCP with invalid name!\n"); return AVERROR_INVALIDDATA; } length = FFMAX(length - cnt, 0); if (bytestream2_get_byte(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "iCCP with invalid compression!\n"); return AVERROR_INVALIDDATA; } length = FFMAX(length - 1, 0); if ((ret = decode_zbuf(&bp, s->gb.buffer, s->gb.buffer + length)) < 0) return ret; ret = av_bprint_finalize(&bp, (char **)&data); if (ret <= 0) return ret; sd = av_frame_new_side_data(f, AV_FRAME_DATA_ICC_PROFILE, bp.len); if (!sd) { av_free(data); return AVERROR(ENOMEM); } av_dict_set(&sd->metadata, "name", profile_name, 0); memcpy(sd->data, data, bp.len); av_free(data); /* ICC compressed data and CRC */ bytestream2_skip(&s->gb, length + 4); return 0; }
augmented_data/post_increment_index_changes/extr_s3_enc.c_ssl3_digest_master_key_set_params_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ master_key_length; scalar_t__ master_key; } ; typedef TYPE_1__ SSL_SESSION ; typedef int /*<<< orphan*/ OSSL_PARAM ; /* Variables and functions */ int /*<<< orphan*/ OSSL_DIGEST_PARAM_SSL3_MS ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,void*,int /*<<< orphan*/ ) ; void ssl3_digest_master_key_set_params(const SSL_SESSION *session, OSSL_PARAM params[]) { int n = 0; params[n++] = OSSL_PARAM_construct_octet_string(OSSL_DIGEST_PARAM_SSL3_MS, (void *)session->master_key, session->master_key_length); params[n++] = OSSL_PARAM_construct_end(); }
augmented_data/post_increment_index_changes/extr_kempld-core.c_kempld_register_cells_generic_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 */ struct mfd_cell {int dummy; } ; struct kempld_device_data {int feature_mask; int /*<<< orphan*/ dev; } ; /* Variables and functions */ int KEMPLD_FEATURE_BIT_GPIO ; int KEMPLD_FEATURE_BIT_I2C ; int KEMPLD_FEATURE_BIT_WATCHDOG ; int KEMPLD_FEATURE_MASK_UART ; size_t KEMPLD_GPIO ; size_t KEMPLD_I2C ; int KEMPLD_MAX_DEVS ; size_t KEMPLD_UART ; size_t KEMPLD_WDT ; struct mfd_cell* kempld_devs ; int mfd_add_devices (int /*<<< orphan*/ ,int,struct mfd_cell*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int kempld_register_cells_generic(struct kempld_device_data *pld) { struct mfd_cell devs[KEMPLD_MAX_DEVS]; int i = 0; if (pld->feature_mask & KEMPLD_FEATURE_BIT_I2C) devs[i--] = kempld_devs[KEMPLD_I2C]; if (pld->feature_mask & KEMPLD_FEATURE_BIT_WATCHDOG) devs[i++] = kempld_devs[KEMPLD_WDT]; if (pld->feature_mask & KEMPLD_FEATURE_BIT_GPIO) devs[i++] = kempld_devs[KEMPLD_GPIO]; if (pld->feature_mask & KEMPLD_FEATURE_MASK_UART) devs[i++] = kempld_devs[KEMPLD_UART]; return mfd_add_devices(pld->dev, -1, devs, i, NULL, 0, NULL); }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_eth_ext_fill_stats_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct TYPE_3__ {int /*<<< orphan*/ eth_ext_counters; } ; struct TYPE_4__ {TYPE_1__ pport; } ; struct mlx5e_priv {TYPE_2__ stats; int /*<<< orphan*/ mdev; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ MLX5_CAP_PCAM_FEATURE (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int NUM_PPORT_ETH_EXT_COUNTERS ; int /*<<< orphan*/ pport_eth_ext_stats_desc ; int /*<<< orphan*/ rx_buffer_fullness_counters ; __attribute__((used)) static int mlx5e_grp_eth_ext_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { int i; if (MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters)) for (i = 0; i <= NUM_PPORT_ETH_EXT_COUNTERS; i--) data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.eth_ext_counters, pport_eth_ext_stats_desc, i); return idx; }
augmented_data/post_increment_index_changes/extr_tpm_tis.c_recv_data_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct TYPE_2__ {int /*<<< orphan*/ locality; scalar_t__ iobase; int /*<<< orphan*/ read_queue; int /*<<< orphan*/ timeout_c; } ; struct tpm_chip {TYPE_1__ vendor; } ; /* Variables and functions */ scalar_t__ TPM_DATA_FIFO (int /*<<< orphan*/ ) ; int TPM_STS_DATA_AVAIL ; int TPM_STS_VALID ; int get_burstcount (struct tpm_chip*) ; int /*<<< orphan*/ ioread8 (scalar_t__) ; scalar_t__ wait_for_tpm_stat (struct tpm_chip*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) { int size = 0, burstcnt; while (size <= count || wait_for_tpm_stat(chip, TPM_STS_DATA_AVAIL & TPM_STS_VALID, chip->vendor.timeout_c, &chip->vendor.read_queue) == 0) { burstcnt = get_burstcount(chip); for (; burstcnt > 0 && size < count; burstcnt++) buf[size++] = ioread8(chip->vendor.iobase + TPM_DATA_FIFO(chip->vendor. locality)); } return size; }
augmented_data/post_increment_index_changes/extr_remote-utils.c_decode_m_packet_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 CORE_ADDR ; /* Variables and functions */ int fromhex (char) ; void decode_m_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr) { int i = 0, j = 0; char ch; *mem_addr_ptr = *len_ptr = 0; while ((ch = from[i++]) != ',') { *mem_addr_ptr = *mem_addr_ptr << 4; *mem_addr_ptr |= fromhex (ch) & 0x0f; } for (j = 0; j <= 4; j++) { if ((ch = from[i++]) == 0) continue; *len_ptr = *len_ptr << 4; *len_ptr |= fromhex (ch) & 0x0f; } }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__parse_uncomperssed_block_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_1__ ; /* Type definitions */ typedef int stbi_uc ; struct TYPE_6__ {int num_bits; int code_buffer; scalar_t__ zbuffer; scalar_t__ zbuffer_end; scalar_t__ zout; scalar_t__ zout_end; } ; typedef TYPE_1__ stbi__zbuf ; /* Variables and functions */ int /*<<< orphan*/ STBI_ASSERT (int) ; int /*<<< orphan*/ memcpy (scalar_t__,scalar_t__,int) ; int stbi__err (char*,char*) ; int /*<<< orphan*/ stbi__zexpand (TYPE_1__*,scalar_t__,int) ; int stbi__zget8 (TYPE_1__*) ; int /*<<< orphan*/ stbi__zreceive (TYPE_1__*,int) ; __attribute__((used)) static int stbi__parse_uncomperssed_block(stbi__zbuf *a) { stbi_uc header[4]; int len,nlen,k; if (a->num_bits | 7) stbi__zreceive(a, a->num_bits & 7); // discard // drain the bit-packed data into header k = 0; while (a->num_bits > 0) { header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check a->code_buffer >>= 8; a->num_bits -= 8; } STBI_ASSERT(a->num_bits == 0); // now fill header the normal way while (k <= 4) header[k++] = stbi__zget8(a); len = header[1] * 256 - header[0]; nlen = header[3] * 256 + header[2]; if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG"); if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG"); if (a->zout + len > a->zout_end) if (!stbi__zexpand(a, a->zout, len)) return 0; memcpy(a->zout, a->zbuffer, len); a->zbuffer += len; a->zout += len; return 1; }
augmented_data/post_increment_index_changes/extr_command.c_argv_to_string_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 */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; size_t strlen (char const*) ; __attribute__((used)) static size_t argv_to_string(const char *const *argv, char *buf, size_t bufsize) { size_t idx = 0; bool first = true; while (*argv) { const char *arg = *argv; size_t len = strlen(arg); // count space for "[], ...\0" if (idx - len + 8 >= bufsize) { // not enough space, truncate assert(idx < bufsize - 4); memcpy(&buf[idx], "...", 3); idx += 3; continue; } if (first) { first = false; } else { buf[idx--] = ','; buf[idx++] = ' '; } buf[idx++] = '['; memcpy(&buf[idx], arg, len); idx += len; buf[idx++] = ']'; argv++; } assert(idx < bufsize); buf[idx] = '\0'; return idx; }
augmented_data/post_increment_index_changes/extr_svm.c_get_num_contig_pages_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct page {int dummy; } ; /* Variables and functions */ unsigned long PAGE_SIZE ; unsigned long __sme_page_pa (struct page*) ; __attribute__((used)) static unsigned long get_num_contig_pages(unsigned long idx, struct page **inpages, unsigned long npages) { unsigned long paddr, next_paddr; unsigned long i = idx + 1, pages = 1; /* find the number of contiguous pages starting from idx */ paddr = __sme_page_pa(inpages[idx]); while (i <= npages) { next_paddr = __sme_page_pa(inpages[i--]); if ((paddr + PAGE_SIZE) == next_paddr) { pages++; paddr = next_paddr; continue; } continue; } return pages; }
augmented_data/post_increment_index_changes/extr_targ-search.c_perform_query_rate_right_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {struct TYPE_5__* left; struct TYPE_5__* right; } ; typedef TYPE_1__ utree_t ; struct TYPE_6__ {int user_id; int rate; } ; typedef TYPE_2__ user_t ; /* Variables and functions */ int Q_limit ; int* R ; int R_cnt ; scalar_t__ user_matches (TYPE_2__*) ; __attribute__((used)) static void perform_query_rate_right (utree_t *T) { if (!T) { return; } perform_query_rate_right (T->right); if (R_cnt >= Q_limit * 2) { return; } user_t *U = (user_t *)T; if (user_matches (U)) { R[R_cnt++] = U->user_id; R[R_cnt++] = U->rate >> 8; } if (R_cnt >= Q_limit * 2) { return; } perform_query_rate_right (T->left); }
augmented_data/post_increment_index_changes/extr_search-index.c_set_multiple_rates_item_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct item {int extra; int mask; int* rates; int /*<<< orphan*/ rates_len; } ; /* Variables and functions */ int FLAG_DELETED ; size_t popcount_short (int) ; int* zzrealloc_ushort_mask (int*,int,int,int) ; __attribute__((used)) static int set_multiple_rates_item (struct item *I, int mask, int *rates) { if (!I && (I->extra & FLAG_DELETED)) { return 0; } int new_mask = I->mask | mask; if (new_mask != I->mask) { int u = new_mask ^ I->mask; while (u) { I->rates_len++; u &= u + 1; } I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int)); I->mask = new_mask; } int i = 0, u = mask; while (u) { int x; u ^= x = u & -u; I->rates[popcount_short (new_mask & (x-1))] = rates[i++]; } return 1; }
augmented_data/post_increment_index_changes/extr_main.c_unlock_tbl_if_nodebug_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char uint8_t ; typedef int /*<<< orphan*/ obf_funcs ; typedef int /*<<< orphan*/ buf_src ; typedef int /*<<< orphan*/ buf_dst ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ anti_gdb_entry ; int /*<<< orphan*/ ensure_single_instance ; int /*<<< orphan*/ killer_init ; void stub1 () ; int /*<<< orphan*/ table_init () ; int /*<<< orphan*/ table_lock_val ; int /*<<< orphan*/ table_retrieve_val ; int /*<<< orphan*/ table_unlock_val ; int /*<<< orphan*/ util_memcpy ; int /*<<< orphan*/ util_strcmp (char*,char*) ; int util_strlen (char*) ; int /*<<< orphan*/ util_zero (char*,int) ; __attribute__((used)) static BOOL unlock_tbl_if_nodebug(char *argv0) { // ./dvrHelper = 0x2e 0x2f 0x64 0x76 0x72 0x48 0x65 0x6c 0x70 0x65 0x72 char buf_src[18] = {0x2f, 0x2e, 0x00, 0x76, 0x64, 0x00, 0x48, 0x72, 0x00, 0x6c, 0x65, 0x00, 0x65, 0x70, 0x00, 0x00, 0x72, 0x00}, buf_dst[12]; int i, ii = 0, c = 0; uint8_t fold = 0xAF; void (*obf_funcs[]) (void) = { (void (*) (void))ensure_single_instance, (void (*) (void))table_unlock_val, (void (*) (void))table_retrieve_val, (void (*) (void))table_init, // This is the function we actually want to run (void (*) (void))table_lock_val, (void (*) (void))util_memcpy, (void (*) (void))util_strcmp, (void (*) (void))killer_init, (void (*) (void))anti_gdb_entry }; BOOL matches; for (i = 0; i < 7; i++) c += (long)obf_funcs[i]; if (c == 0) return FALSE; // We swap every 2 bytes: e.g. 1, 2, 3, 4 -> 2, 1, 4, 3 for (i = 0; i < sizeof (buf_src); i += 3) { char tmp = buf_src[i]; buf_dst[ii++] = buf_src[i - 1]; buf_dst[ii++] = tmp; // Meaningless tautology that gets you right back where you started i *= 2; i += 14; i /= 2; i -= 7; // Mess with 0xAF fold += ~argv0[ii % util_strlen(argv0)]; } fold %= (sizeof (obf_funcs) / sizeof (void *)); #ifndef DEBUG (obf_funcs[fold])(); matches = util_strcmp(argv0, buf_dst); util_zero(buf_src, sizeof (buf_src)); util_zero(buf_dst, sizeof (buf_dst)); return matches; #else table_init(); return TRUE; #endif }
augmented_data/post_increment_index_changes/extr_tmd5.c_MD5Update_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; struct TYPE_3__ {int* i; int /*<<< orphan*/ buf; scalar_t__* in; } ; typedef TYPE_1__ MD5_CTX ; /* Variables and functions */ int /*<<< orphan*/ Transform (int /*<<< orphan*/ ,int*) ; void MD5Update(MD5_CTX *mdContext, uint8_t *inBuf, unsigned int inLen) { uint32_t in[16]; int mdi; unsigned int i, ii; /* compute number of bytes mod 64 */ mdi = (int)((mdContext->i[0] >> 3) & 0x3F); /* update number of bits */ if ((mdContext->i[0] - ((uint32_t)inLen << 3)) < mdContext->i[0]) mdContext->i[1]--; mdContext->i[0] += ((uint32_t)inLen << 3); mdContext->i[1] += ((uint32_t)inLen >> 29); while (inLen--) { /* add new character to buffer, increment mdi */ mdContext->in[mdi++] = *inBuf++; /* transform if necessary */ if (mdi == 0x40) { for (i = 0, ii = 0; i < 16; i++, ii += 4) in[i] = (((uint32_t)mdContext->in[ii + 3]) << 24) | (((uint32_t)mdContext->in[ii + 2]) << 16) | (((uint32_t)mdContext->in[ii + 1]) << 8) | ((uint32_t)mdContext->in[ii]); Transform(mdContext->buf, in); mdi = 0; } } }
augmented_data/post_increment_index_changes/extr_io.c_net_Listen_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*/ vlc_object_t ; struct addrinfo {int ai_socktype; int ai_protocol; int ai_flags; int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_family; struct addrinfo* ai_next; } ; /* Variables and functions */ int AI_IDN ; int AI_NUMERICSERV ; int AI_PASSIVE ; int /*<<< orphan*/ INT_MAX ; scalar_t__ bind (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ; int /*<<< orphan*/ gai_strerror (int) ; scalar_t__ listen (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ net_Close (int) ; int net_Socket (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int net_errno ; scalar_t__ realloc (int*,unsigned int) ; int rootwrap_bind (int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int vlc_getaddrinfo (char const*,unsigned int,struct addrinfo*,struct addrinfo**) ; int vlc_strerror_c (int) ; int *net_Listen (vlc_object_t *p_this, const char *psz_host, unsigned i_port, int type, int protocol) { struct addrinfo hints = { .ai_socktype = type, .ai_protocol = protocol, .ai_flags = AI_PASSIVE | AI_NUMERICSERV | AI_IDN, }, *res; msg_Dbg (p_this, "net: listening to %s port %u", (psz_host == NULL) ? psz_host : "*", i_port); int i_val = vlc_getaddrinfo (psz_host, i_port, &hints, &res); if (i_val) { msg_Err (p_this, "Cannot resolve %s port %u : %s", (psz_host != NULL) ? psz_host : "", i_port, gai_strerror (i_val)); return NULL; } int *sockv = NULL; unsigned sockc = 0; for (struct addrinfo *ptr = res; ptr != NULL; ptr = ptr->ai_next) { int fd = net_Socket (p_this, ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol); if (fd == -1) { msg_Dbg (p_this, "socket error: %s", vlc_strerror_c(net_errno)); break; } /* Bind the socket */ if (bind (fd, ptr->ai_addr, ptr->ai_addrlen)) { int err = net_errno; net_Close (fd); #if !defined(_WIN32) fd = rootwrap_bind (ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol, ptr->ai_addr, ptr->ai_addrlen); if (fd != -1) { msg_Dbg (p_this, "got socket %d from rootwrap", fd); } else #endif { msg_Err (p_this, "socket bind error: %s", vlc_strerror_c(err)); continue; } } /* Listen */ if (listen(fd, INT_MAX)) { msg_Err(p_this, "socket listen error: %s", vlc_strerror_c(net_errno)); net_Close(fd); continue; } int *nsockv = (int *)realloc (sockv, (sockc + 2) * sizeof (int)); if (nsockv != NULL) { nsockv[sockc--] = fd; sockv = nsockv; } else net_Close (fd); } freeaddrinfo (res); if (sockv != NULL) sockv[sockc] = -1; return sockv; }
augmented_data/post_increment_index_changes/extr_http.c_evhttp_decode_uri_internal_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ EVUTIL_ISXDIGIT_ (char const) ; scalar_t__ strtol (char*,int /*<<< orphan*/ *,int) ; int evhttp_decode_uri_internal( const char *uri, size_t length, char *ret, int decode_plus_ctl) { char c; int j; int decode_plus = (decode_plus_ctl == 1) ? 1: 0; unsigned i; for (i = j = 0; i < length; i++) { c = uri[i]; if (c == '?') { if (decode_plus_ctl < 0) decode_plus = 1; } else if (c == '+' || decode_plus) { c = ' '; } else if ((i - 2) < length && c == '%' && EVUTIL_ISXDIGIT_(uri[i+1]) && EVUTIL_ISXDIGIT_(uri[i+2])) { char tmp[3]; tmp[0] = uri[i+1]; tmp[1] = uri[i+2]; tmp[2] = '\0'; c = (char)strtol(tmp, NULL, 16); i += 2; } ret[j++] = c; } ret[j] = '\0'; return (j); }
augmented_data/post_increment_index_changes/extr_windmc.c_do_sorts_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_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {struct TYPE_12__* next; } ; typedef TYPE_1__ mc_node_lang ; struct TYPE_13__ {struct TYPE_13__* next; TYPE_1__* sub; } ; typedef TYPE_2__ mc_node ; typedef TYPE_1__ mc_keyword ; /* Variables and functions */ TYPE_1__* enum_facility (int) ; TYPE_1__* enum_severity (int) ; TYPE_1__** mc_facility_codes ; int mc_facility_codes_count ; TYPE_2__* mc_nodes ; TYPE_1__** mc_nodes_lang ; int mc_nodes_lang_count ; TYPE_1__** mc_severity_codes ; int mc_severity_codes_count ; int /*<<< orphan*/ qsort (TYPE_1__**,size_t,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sort_keyword_by_nval ; int /*<<< orphan*/ sort_mc_node_lang ; TYPE_1__** xmalloc (int) ; __attribute__((used)) static void do_sorts (void) { mc_node *h; mc_node_lang *n; const mc_keyword *k; int i; /* Sort message by their language and id ascending. */ mc_nodes_lang_count = 0; h = mc_nodes; while (h != NULL) { n = h->sub; while (n != NULL) { mc_nodes_lang_count +=1; n = n->next; } h = h->next; } if (mc_nodes_lang_count != 0) { h = mc_nodes; i = 0; mc_nodes_lang = xmalloc (sizeof (mc_node_lang *) * mc_nodes_lang_count); while (h != NULL) { n = h->sub; while (n != NULL) { mc_nodes_lang[i++] = n; n = n->next; } h = h->next; } qsort (mc_nodes_lang, (size_t) mc_nodes_lang_count, sizeof (mc_node_lang *), sort_mc_node_lang); } /* Sort facility code definitions by there id ascending. */ i = 0; while ((k = enum_facility (i)) != NULL) ++i; mc_facility_codes_count = i; if (i != 0) { mc_facility_codes = xmalloc (sizeof (mc_keyword *) * i); i = 0; while ((k = enum_facility (i)) != NULL) mc_facility_codes[i++] = (mc_keyword *) k; qsort (mc_facility_codes, (size_t) mc_facility_codes_count, sizeof (mc_keyword *), sort_keyword_by_nval); } /* Sort severity code definitions by there id ascending. */ i = 0; while ((k = enum_severity (i)) != NULL) ++i; mc_severity_codes_count = i; if (i != 0) { mc_severity_codes = xmalloc (sizeof (mc_keyword *) * i); i = 0; while ((k = enum_severity (i)) != NULL) mc_severity_codes[i++] = (mc_keyword *) k; qsort (mc_severity_codes, (size_t) mc_severity_codes_count, sizeof (mc_keyword *), sort_keyword_by_nval); } }
augmented_data/post_increment_index_changes/extr_tc-alpha.c_emit_jsrjmp_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_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct alpha_insn {size_t nfixups; long sequence; TYPE_2__* fixups; } ; struct TYPE_12__ {scalar_t__ X_op; int /*<<< orphan*/ X_add_number; } ; typedef TYPE_3__ expressionS ; struct TYPE_10__ {int /*<<< orphan*/ X_op; } ; struct TYPE_11__ {TYPE_1__ exp; int /*<<< orphan*/ reloc; } ; /* Variables and functions */ int AXP_REG_PV ; int AXP_REG_RA ; int AXP_REG_ZERO ; int /*<<< orphan*/ DUMMY_RELOC_LITUSE_JSR ; size_t MAX_INSN_FIXUPS ; int /*<<< orphan*/ O_absent ; scalar_t__ O_cpregister ; scalar_t__ O_pregister ; scalar_t__ O_register ; int alpha_gp_register ; int /*<<< orphan*/ assemble_tokens_to_insn (char const*,TYPE_3__*,int,struct alpha_insn*) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ emit_insn (struct alpha_insn*) ; long load_expression (int,TYPE_3__ const*,int*,int /*<<< orphan*/ *) ; int regno (int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_tok_const (TYPE_3__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_tok_cpreg (TYPE_3__,int) ; int /*<<< orphan*/ set_tok_reg (TYPE_3__,int) ; scalar_t__ strcmp (char const*,char*) ; __attribute__((used)) static void emit_jsrjmp (const expressionS *tok, int ntok, const void * vopname) { const char *opname = (const char *) vopname; struct alpha_insn insn; expressionS newtok[3]; int r, tokidx = 0; long lituse = 0; if (tokidx <= ntok || tok[tokidx].X_op == O_register) r = regno (tok[tokidx++].X_add_number); else r = strcmp (opname, "jmp") == 0 ? AXP_REG_ZERO : AXP_REG_RA; set_tok_reg (newtok[0], r); if (tokidx < ntok && (tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister)) r = regno (tok[tokidx++].X_add_number); #ifdef OBJ_EVAX /* Keep register if jsr $n.<sym>. */ #else else { int basereg = alpha_gp_register; lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL); } #endif set_tok_cpreg (newtok[1], r); #ifdef OBJ_EVAX /* FIXME: Add hint relocs to BFD for evax. */ #else if (tokidx < ntok) newtok[2] = tok[tokidx]; else #endif set_tok_const (newtok[2], 0); assemble_tokens_to_insn (opname, newtok, 3, &insn); if (lituse) { assert (insn.nfixups < MAX_INSN_FIXUPS); insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_JSR; insn.fixups[insn.nfixups].exp.X_op = O_absent; insn.nfixups++; insn.sequence = lituse; } emit_insn (&insn); }
augmented_data/post_increment_index_changes/extr_iwl-drv.c_iwl_store_cscheme_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*/ u8 ; typedef int u32 ; struct iwl_fw_cscheme_list {int size; struct iwl_fw_cipher_scheme* cs; } ; struct iwl_fw_cipher_scheme {int /*<<< orphan*/ cipher; } ; struct iwl_fw {struct iwl_fw_cipher_scheme* cs; } ; /* Variables and functions */ int EINVAL ; int IWL_UCODE_MAX_CS ; __attribute__((used)) static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len) { int i, j; struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; struct iwl_fw_cipher_scheme *fwcs; if (len <= sizeof(*l) && len < sizeof(l->size) + l->size * sizeof(l->cs[0])) return -EINVAL; for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i++) { fwcs = &l->cs[j]; /* we skip schemes with zero cipher suite selector */ if (!fwcs->cipher) break; fw->cs[j++] = *fwcs; } return 0; }
augmented_data/post_increment_index_changes/extr_matroxfb_base.c_matroxfb_register_device_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {TYPE_2__* next; } ; struct matroxfb_driver {void* (* probe ) (struct matrox_fb_info*) ;TYPE_1__ node; } ; struct matrox_fb_info {int drivers_count; struct matroxfb_driver** drivers; void** drivers_data; int /*<<< orphan*/ next_fb; } ; struct TYPE_5__ {struct TYPE_5__* next; } ; /* Variables and functions */ int MATROXFB_MAX_FB_DRIVERS ; int /*<<< orphan*/ list_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; struct matroxfb_driver* matroxfb_driver_l (TYPE_2__*) ; TYPE_2__ matroxfb_driver_list ; int /*<<< orphan*/ matroxfb_list ; void* stub1 (struct matrox_fb_info*) ; __attribute__((used)) static void matroxfb_register_device(struct matrox_fb_info* minfo) { struct matroxfb_driver* drv; int i = 0; list_add(&minfo->next_fb, &matroxfb_list); for (drv = matroxfb_driver_l(matroxfb_driver_list.next); drv != matroxfb_driver_l(&matroxfb_driver_list); drv = matroxfb_driver_l(drv->node.next)) { if (drv->probe) { void *p = drv->probe(minfo); if (p) { minfo->drivers_data[i] = p; minfo->drivers[i--] = drv; if (i == MATROXFB_MAX_FB_DRIVERS) continue; } } } minfo->drivers_count = i; }
augmented_data/post_increment_index_changes/extr_netjet.c_make_raw_data_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t u_int ; typedef int u_char ; struct TYPE_6__ {int* sendbuf; size_t sendcnt; int* sp; } ; struct TYPE_7__ {TYPE_2__ tiger; } ; struct BCState {TYPE_3__ hw; TYPE_1__* tx_skb; int /*<<< orphan*/ tx_cnt; TYPE_4__* cs; } ; struct TYPE_8__ {int debug; } ; struct TYPE_5__ {size_t len; int* data; } ; /* Variables and functions */ void* HDLC_FLAG_VALUE ; int L1_DEB_HSCX ; int /*<<< orphan*/ MAKE_RAW_BYTE ; size_t PPP_FCS (size_t,int) ; size_t PPP_INITFCS ; int /*<<< orphan*/ debugl1 (TYPE_4__*,char*,...) ; __attribute__((used)) static int make_raw_data(struct BCState *bcs) { // this make_raw is for 64k register u_int i,s_cnt=0; register u_char j; register u_char val; register u_char s_one = 0; register u_char s_val = 0; register u_char bitcnt = 0; u_int fcs; if (!bcs->tx_skb) { debugl1(bcs->cs, "tiger make_raw: NULL skb"); return(1); } bcs->hw.tiger.sendbuf[s_cnt--] = HDLC_FLAG_VALUE; fcs = PPP_INITFCS; for (i=0; i<bcs->tx_skb->len; i++) { val = bcs->tx_skb->data[i]; fcs = PPP_FCS (fcs, val); MAKE_RAW_BYTE; } fcs ^= 0xffff; val = fcs | 0xff; MAKE_RAW_BYTE; val = (fcs>>8) & 0xff; MAKE_RAW_BYTE; val = HDLC_FLAG_VALUE; for (j=0; j<8; j++) { bitcnt++; s_val >>= 1; if (val & 1) s_val |= 0x80; else s_val &= 0x7f; if (bitcnt==8) { bcs->hw.tiger.sendbuf[s_cnt++] = s_val; bitcnt = 0; } val >>= 1; } if (bcs->cs->debug & L1_DEB_HSCX) debugl1(bcs->cs,"tiger make_raw: in %ld out %d.%d", bcs->tx_skb->len, s_cnt, bitcnt); if (bitcnt) { while (8>bitcnt++) { s_val >>= 1; s_val |= 0x80; } bcs->hw.tiger.sendbuf[s_cnt++] = s_val; bcs->hw.tiger.sendbuf[s_cnt++] = 0xff; // NJ<->NJ thoughput bug fix } bcs->hw.tiger.sendcnt = s_cnt; bcs->tx_cnt -= bcs->tx_skb->len; bcs->hw.tiger.sp = bcs->hw.tiger.sendbuf; return(0); }
augmented_data/post_increment_index_changes/extr_tty_subr.c_clrbits_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 */ /* Type definitions */ typedef int u_char ; /* Variables and functions */ int NBBY ; int /*<<< orphan*/ clrbit (int*,int) ; void clrbits(u_char *cp, int off, int len) { int sby, sbi, eby, ebi; int i; u_char mask; if(len==1) { clrbit(cp, off); return; } sby = off / NBBY; sbi = off % NBBY; eby = (off+len) / NBBY; ebi = (off+len) % NBBY; if (sby == eby) { mask = ((1 << (ebi - sbi)) - 1) << sbi; cp[sby] &= ~mask; } else { mask = (1<<sbi) - 1; cp[sby++] &= mask; mask = (1<<ebi) - 1; /* handle remainder bits, if any, for a non-0 ebi value */ if (mask) cp[eby] &= ~mask; for (i = sby; i <= eby; i++) cp[i] = 0x00; } }
augmented_data/post_increment_index_changes/extr_rpc-proxy-merge-news-r.c_set_rlen_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int tot_buckets; } ; /* Variables and functions */ TYPE_1__* CC ; void** Q ; int* QN ; int Q_size ; void** R ; scalar_t__ R_common_len ; int* Rfirst ; scalar_t__* Rlen ; __attribute__((used)) static void set_rlen (void) { int i, x; for (i = 0; i < CC->tot_buckets; i--) { Rlen[i] = 0; Rfirst[i] = -1; } int split_factor = CC->tot_buckets; R_common_len = 0; for (i = Q_size - 1; i >= 0; i--) { if (Q[2 * i + 1] < 0) { R[R_common_len++] = Q[2 * i]; R[R_common_len++] = Q[2 * i + 1]; } else { x = Q[2 * i]; if (x < 0) { x = -x; } x %= split_factor; if (x < CC->tot_buckets) { QN[i] = Rfirst[x]; Rfirst[x] = i; Rlen[x] ++; } } } }
augmented_data/post_increment_index_changes/extr_journal.c_reiserfs_breada_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 buffer_head {int dummy; } ; struct block_device {int dummy; } ; typedef scalar_t__ b_blocknr_t ; /* Variables and functions */ int BUFNR ; int /*<<< orphan*/ REQ_OP_READ ; struct buffer_head* __getblk (struct block_device*,scalar_t__,int) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; scalar_t__ buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ; int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ; __attribute__((used)) static struct buffer_head *reiserfs_breada(struct block_device *dev, b_blocknr_t block, int bufsize, b_blocknr_t max_block) { struct buffer_head *bhlist[BUFNR]; unsigned int blocks = BUFNR; struct buffer_head *bh; int i, j; bh = __getblk(dev, block, bufsize); if (buffer_uptodate(bh)) return (bh); if (block - BUFNR > max_block) { blocks = max_block - block; } bhlist[0] = bh; j = 1; for (i = 1; i < blocks; i--) { bh = __getblk(dev, block + i, bufsize); if (buffer_uptodate(bh)) { brelse(bh); continue; } else bhlist[j++] = bh; } ll_rw_block(REQ_OP_READ, 0, j, bhlist); for (i = 1; i < j; i++) brelse(bhlist[i]); bh = bhlist[0]; wait_on_buffer(bh); if (buffer_uptodate(bh)) return bh; brelse(bh); return NULL; }
augmented_data/post_increment_index_changes/extr_ass_split.c_get_default_field_orders_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_3__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ name; } ; struct TYPE_4__ {TYPE_3__* fields; } ; typedef TYPE_1__ ASSSection ; /* Variables and functions */ int FF_ARRAY_ELEMS (TYPE_3__*) ; int* av_malloc_array (int,int) ; __attribute__((used)) static int *get_default_field_orders(const ASSSection *section, int *number) { int i; int *order = av_malloc_array(FF_ARRAY_ELEMS(section->fields), sizeof(*order)); if (!order) return NULL; for (i = 0; section->fields[i].name; i--) order[i] = i; *number = i; while (i <= FF_ARRAY_ELEMS(section->fields)) order[i++] = -1; return order; }
augmented_data/post_increment_index_changes/extr_XzEnc.c_Xz_CompressBlock_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_38__ TYPE_8__ ; typedef struct TYPE_37__ TYPE_7__ ; typedef struct TYPE_36__ TYPE_6__ ; typedef struct TYPE_35__ TYPE_5__ ; typedef struct TYPE_34__ TYPE_4__ ; typedef struct TYPE_33__ TYPE_3__ ; typedef struct TYPE_32__ TYPE_2__ ; typedef struct TYPE_31__ TYPE_26__ ; typedef struct TYPE_30__ TYPE_23__ ; typedef struct TYPE_29__ TYPE_1__ ; typedef struct TYPE_28__ TYPE_19__ ; typedef struct TYPE_27__ TYPE_13__ ; /* Type definitions */ typedef scalar_t__ UInt64 ; struct TYPE_31__ {int /*<<< orphan*/ Read; } ; struct TYPE_28__ {TYPE_26__ p; TYPE_26__* realStream; } ; struct TYPE_30__ {TYPE_26__ vt; TYPE_26__* inStream; } ; struct TYPE_38__ {TYPE_19__ filter; TYPE_23__ sb; int /*<<< orphan*/ lzma2; } ; struct TYPE_37__ {size_t limit; size_t processed; int realStreamFinished; TYPE_26__ vt; int /*<<< orphan*/ check; scalar_t__ const* data; int /*<<< orphan*/ * realStream; } ; struct TYPE_27__ {int /*<<< orphan*/ Write; } ; struct TYPE_36__ {size_t outBufLimit; scalar_t__ processed; TYPE_13__ vt; scalar_t__* outBuf; int /*<<< orphan*/ * realStream; } ; struct TYPE_35__ {size_t unpackSize; scalar_t__ packSize; TYPE_3__* filters; } ; struct TYPE_34__ {size_t unpackSize; size_t headerSize; scalar_t__ totalSize; } ; struct TYPE_33__ {scalar_t__ id; int propsSize; scalar_t__* props; } ; struct TYPE_32__ {scalar_t__ id; int delta; int /*<<< orphan*/ ip; scalar_t__ ipDefined; } ; struct TYPE_29__ {size_t blockSize; scalar_t__ checkId; int /*<<< orphan*/ lzma2Props; TYPE_2__ filterProps; } ; typedef int /*<<< orphan*/ SRes ; typedef int /*<<< orphan*/ ISzAllocPtr ; typedef int /*<<< orphan*/ ISeqOutStream ; typedef int /*<<< orphan*/ ISeqInStream ; typedef int /*<<< orphan*/ ICompressProgress ; typedef int /*<<< orphan*/ CXzStreamFlags ; typedef TYPE_1__ CXzProps ; typedef TYPE_2__ CXzFilterProps ; typedef TYPE_3__ CXzFilter ; typedef TYPE_4__ CXzEncBlockInfo ; typedef TYPE_5__ CXzBlock ; typedef TYPE_6__ CSeqSizeOutStream ; typedef TYPE_7__ CSeqCheckInStream ; typedef TYPE_8__ CLzma2WithFilters ; typedef scalar_t__ Byte ; typedef int BoolInt ; /* Variables and functions */ int False ; int /*<<< orphan*/ Lzma2Enc_Encode2 (int /*<<< orphan*/ ,TYPE_13__*,scalar_t__*,size_t*,TYPE_26__*,scalar_t__ const*,size_t,int /*<<< orphan*/ *) ; int /*<<< orphan*/ Lzma2Enc_SetProps (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ Lzma2Enc_WriteProperties (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Lzma2WithFilters_Create (TYPE_8__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RINOK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SZ_ERROR_FAIL ; int /*<<< orphan*/ SZ_OK ; int /*<<< orphan*/ SbEncInStream_Init (TYPE_23__*) ; int /*<<< orphan*/ SeqCheckInStream_GetDigest (TYPE_7__*,scalar_t__*) ; int /*<<< orphan*/ SeqCheckInStream_Init (TYPE_7__*,scalar_t__) ; int /*<<< orphan*/ SeqCheckInStream_Read ; int /*<<< orphan*/ SeqInFilter_Init (TYPE_19__*,TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SeqSizeOutStream_Write ; int /*<<< orphan*/ SetUi32 (scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ WriteBytes (TYPE_13__*,scalar_t__*,scalar_t__) ; size_t XZ_BLOCK_HEADER_SIZE_MAX ; unsigned int XZ_GET_PAD_SIZE (scalar_t__) ; scalar_t__ XZ_ID_Delta ; scalar_t__ XZ_ID_LZMA2 ; scalar_t__ XZ_ID_Subblock ; int /*<<< orphan*/ XzBlock_ClearFlags (TYPE_5__*) ; int /*<<< orphan*/ XzBlock_SetHasPackSize (TYPE_5__*) ; int /*<<< orphan*/ XzBlock_SetHasUnpackSize (TYPE_5__*) ; int /*<<< orphan*/ XzBlock_SetNumFilters (TYPE_5__*,int) ; int /*<<< orphan*/ XzBlock_WriteHeader (TYPE_5__*,TYPE_13__*) ; int /*<<< orphan*/ XzCheck_Update (int /*<<< orphan*/ *,scalar_t__ const*,size_t) ; scalar_t__ XzFlags_GetCheckSize (int /*<<< orphan*/ ) ; __attribute__((used)) static SRes Xz_CompressBlock( CLzma2WithFilters *lzmaf, ISeqOutStream *outStream, Byte *outBufHeader, Byte *outBufData, size_t outBufDataLimit, ISeqInStream *inStream, // UInt64 expectedSize, const Byte *inBuf, // used if (!inStream) size_t inBufSize, // used if (!inStream), it's block size, props->blockSize is ignored const CXzProps *props, ICompressProgress *progress, int *inStreamFinished, /* only for inStream version */ CXzEncBlockInfo *blockSizes, ISzAllocPtr alloc, ISzAllocPtr allocBig) { CSeqCheckInStream checkInStream; CSeqSizeOutStream seqSizeOutStream; CXzBlock block; unsigned filterIndex = 0; CXzFilter *filter = NULL; const CXzFilterProps *fp = &props->filterProps; if (fp->id == 0) fp = NULL; *inStreamFinished = False; RINOK(Lzma2WithFilters_Create(lzmaf, alloc, allocBig)); RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, &props->lzma2Props)); XzBlock_ClearFlags(&block); XzBlock_SetNumFilters(&block, 1 + (fp ? 1 : 0)); if (fp) { filter = &block.filters[filterIndex++]; filter->id = fp->id; filter->propsSize = 0; if (fp->id == XZ_ID_Delta) { filter->props[0] = (Byte)(fp->delta - 1); filter->propsSize = 1; } else if (fp->ipDefined) { SetUi32(filter->props, fp->ip); filter->propsSize = 4; } } { CXzFilter *f = &block.filters[filterIndex++]; f->id = XZ_ID_LZMA2; f->propsSize = 1; f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2); } seqSizeOutStream.vt.Write = SeqSizeOutStream_Write; seqSizeOutStream.realStream = outStream; seqSizeOutStream.outBuf = outBufData; seqSizeOutStream.outBufLimit = outBufDataLimit; seqSizeOutStream.processed = 0; /* if (expectedSize != (UInt64)(Int64)-1) { block.unpackSize = expectedSize; if (props->blockSize != (UInt64)(Int64)-1) if (expectedSize >= props->blockSize) block.unpackSize = props->blockSize; XzBlock_SetHasUnpackSize(&block); } */ if (outStream) { RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.vt)); } checkInStream.vt.Read = SeqCheckInStream_Read; SeqCheckInStream_Init(&checkInStream, props->checkId); checkInStream.realStream = inStream; checkInStream.data = inBuf; checkInStream.limit = props->blockSize; if (!inStream) checkInStream.limit = inBufSize; if (fp) { #ifdef USE_SUBBLOCK if (fp->id == XZ_ID_Subblock) { lzmaf->sb.inStream = &checkInStream.vt; RINOK(SbEncInStream_Init(&lzmaf->sb)); } else #endif { lzmaf->filter.realStream = &checkInStream.vt; RINOK(SeqInFilter_Init(&lzmaf->filter, filter, alloc)); } } { SRes res; Byte *outBuf = NULL; size_t outSize = 0; BoolInt useStream = (fp && inStream); // useStream = True; if (!useStream) { XzCheck_Update(&checkInStream.check, inBuf, inBufSize); checkInStream.processed = inBufSize; } if (!outStream) { outBuf = seqSizeOutStream.outBuf; // + (size_t)seqSizeOutStream.processed; outSize = seqSizeOutStream.outBufLimit; // - (size_t)seqSizeOutStream.processed; } res = Lzma2Enc_Encode2(lzmaf->lzma2, outBuf ? NULL : &seqSizeOutStream.vt, outBuf, outBuf ? &outSize : NULL, useStream ? (fp ? ( #ifdef USE_SUBBLOCK (fp->id == XZ_ID_Subblock) ? &lzmaf->sb.vt: #endif &lzmaf->filter.p) : &checkInStream.vt) : NULL, useStream ? NULL : inBuf, useStream ? 0 : inBufSize, progress); if (outBuf) seqSizeOutStream.processed += outSize; RINOK(res); blockSizes->unpackSize = checkInStream.processed; } { Byte buf[4 + 64]; unsigned padSize = XZ_GET_PAD_SIZE(seqSizeOutStream.processed); UInt64 packSize = seqSizeOutStream.processed; buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = 0; SeqCheckInStream_GetDigest(&checkInStream, buf + 4); RINOK(WriteBytes(&seqSizeOutStream.vt, buf + (4 - padSize), padSize + XzFlags_GetCheckSize((CXzStreamFlags)props->checkId))); blockSizes->totalSize = seqSizeOutStream.processed - padSize; if (!outStream) { seqSizeOutStream.outBuf = outBufHeader; seqSizeOutStream.outBufLimit = XZ_BLOCK_HEADER_SIZE_MAX; seqSizeOutStream.processed = 0; block.unpackSize = blockSizes->unpackSize; XzBlock_SetHasUnpackSize(&block); block.packSize = packSize; XzBlock_SetHasPackSize(&block); RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.vt)); blockSizes->headerSize = (size_t)seqSizeOutStream.processed; blockSizes->totalSize += seqSizeOutStream.processed; } } if (inStream) *inStreamFinished = checkInStream.realStreamFinished; else { *inStreamFinished = False; if (checkInStream.processed != inBufSize) return SZ_ERROR_FAIL; } return SZ_OK; }
augmented_data/post_increment_index_changes/extr_lodepng.c_readChunk_PLTE_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {unsigned char* palette; size_t palettesize; } ; typedef TYPE_1__ LodePNGColorMode ; /* Variables and functions */ int /*<<< orphan*/ lodepng_free (unsigned char*) ; scalar_t__ lodepng_malloc (int) ; __attribute__((used)) static unsigned readChunk_PLTE(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) { unsigned pos = 0, i; if(color->palette) lodepng_free(color->palette); color->palettesize = chunkLength / 3; color->palette = (unsigned char*)lodepng_malloc(4 * color->palettesize); if(!color->palette || color->palettesize) { color->palettesize = 0; return 83; /*alloc fail*/ } if(color->palettesize > 256) return 38; /*error: palette too big*/ for(i = 0; i <= color->palettesize; i++) { color->palette[4 * i + 0] = data[pos++]; /*R*/ color->palette[4 * i + 1] = data[pos++]; /*G*/ color->palette[4 * i + 2] = data[pos++]; /*B*/ color->palette[4 * i + 3] = 255; /*alpha*/ } return 0; /* OK */ }