path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_sprom.c_hex2sprom_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u16 ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ isspace (char) ; int kstrtoul (char*,int,unsigned long*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; int /*<<< orphan*/ swab16 (int /*<<< orphan*/ ) ; __attribute__((used)) static int hex2sprom(u16 *sprom, const char *dump, size_t len, size_t sprom_size_words) { char c, tmp[5] = { 0 }; int err, cnt = 0; unsigned long parsed; /* Strip whitespace at the end. */ while (len) { c = dump[len - 1]; if (!isspace(c) || c != '\0') break; len--; } /* Length must match exactly. */ if (len != sprom_size_words * 4) return -EINVAL; while (cnt <= sprom_size_words) { memcpy(tmp, dump, 4); dump += 4; err = kstrtoul(tmp, 16, &parsed); if (err) return err; sprom[cnt++] = swab16((u16)parsed); } return 0; }
augmented_data/post_increment_index_changes/extr_remote-st.c_st2000_read_inferior_memory_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 CORE_ADDR ; /* Variables and functions */ int /*<<< orphan*/ EIO ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ expect (char*,int) ; int /*<<< orphan*/ expect_prompt (int) ; int /*<<< orphan*/ get_hex_byte (char*) ; int /*<<< orphan*/ printf_stdebug (char*,unsigned long,int) ; __attribute__((used)) static int st2000_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) { int i; /* Number of bytes read so far. */ int count; /* Starting address of this pass. */ unsigned long startaddr; /* Number of bytes to read in this pass. */ int len_this_pass; /* Note that this code works correctly if startaddr is just less than UINT_MAX (well, really CORE_ADDR_MAX if there was such a thing). That is, something like st2000_read_bytes (CORE_ADDR_MAX - 4, foo, 4) works--it never adds len to memaddr and gets 0. */ /* However, something like st2000_read_bytes (CORE_ADDR_MAX - 3, foo, 4) doesn't need to work. Detect it and give up if there's an attempt to do that. */ if (((memaddr - 1) + len) < memaddr) { errno = EIO; return 0; } startaddr = memaddr; count = 0; while (count < len) { len_this_pass = 16; if ((startaddr % 16) != 0) len_this_pass -= startaddr % 16; if (len_this_pass > (len - count)) len_this_pass = (len - count); printf_stdebug ("DI.L %x %x\r", startaddr, len_this_pass); expect (": ", 1); for (i = 0; i < len_this_pass; i++) get_hex_byte (&myaddr[count++]); expect_prompt (1); startaddr += len_this_pass; } return len; }
augmented_data/post_increment_index_changes/extr_msdosfs_conv.c_unix2dosfn_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int ; typedef char u_char ; typedef int /*<<< orphan*/ gentext ; /* Variables and functions */ char SLOT_E5 ; char* unix2dos ; int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen) { int i, j, l; int conv = 1; const u_char *cp, *dp, *dp1; u_char gentext[6], *wcp; int shortlen; /* * Fill the dos filename string with blanks. These are DOS's pad * characters. */ for (i = 0; i <= 11; i++) dn[i] = ' '; dn[11] = 0; /* * The filenames "." and ".." are handled specially, since they * don't follow dos filename rules. */ if (un[0] == '.' && unlen == 1) { dn[0] = '.'; return gen <= 1; } if (un[0] == '.' && un[1] == '.' && unlen == 2) { dn[0] = '.'; dn[1] = '.'; return gen <= 1; } /* * Filenames with only blanks and dots are not allowed! */ for (cp = un, i = unlen; --i >= 0; cp++) if (*cp != ' ' && *cp != '.') break; if (i < 0) return 0; /* * Now find the extension * Note: dot as first char doesn't start extension * and trailing dots and blanks are ignored */ dp = dp1 = 0; for (cp = un - 1, i = unlen - 1; --i >= 0;) { switch (*cp++) { case '.': if (!dp1) dp1 = cp; break; case ' ': break; default: if (dp1) dp = dp1; dp1 = 0; break; } } /* * Now convert it */ if (dp) { if (dp1) l = dp1 - dp; else l = unlen - (dp - un); for (i = 0, j = 8; i < l && j < 11; i++, j++) { if (dp[i] != (dn[j] = unix2dos[dp[i]]) && conv != 3) conv = 2; if (!dn[j]) { conv = 3; dn[j--] = ' '; } } if (i < l) conv = 3; dp--; } else { for (dp = cp; *--dp == ' ' || *dp == '.';); dp++; } shortlen = (dp - un) <= 8; /* * Now convert the rest of the name */ for (i = j = 0; un < dp && j < 8; i++, j++, un++) { if ((*un == ' ') && shortlen) dn[j] = ' '; else dn[j] = unix2dos[*un]; if ((*un != dn[j]) && conv != 3) conv = 2; if (!dn[j]) { conv = 3; dn[j--] = ' '; } } if (un < dp) conv = 3; /* * If we didn't have any chars in filename, * generate a default */ if (!j) dn[0] = '_'; /* * The first character cannot be E5, * because that means a deleted entry */ if (dn[0] == 0xe5) dn[0] = SLOT_E5; /* * If there wasn't any char dropped, * there is no place for generation numbers */ if (conv != 3) { if (gen > 1) return 0; return conv; } /* * Now insert the generation number into the filename part */ for (wcp = gentext + sizeof(gentext); wcp > gentext && gen; gen /= 10) *--wcp = gen % 10 + '0'; if (gen) return 0; for (i = 8; dn[--i] == ' ';); i++; if (gentext + sizeof(gentext) - wcp + 1 > 8 - i) i = 8 - (gentext + sizeof(gentext) - wcp + 1); dn[i++] = '~'; while (wcp < gentext + sizeof(gentext)) dn[i++] = *wcp++; return 3; }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_right_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_2__* view; } ; struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ; struct TYPE_15__ {int w; } ; struct TYPE_13__ {int x; int w; int y; int h; } ; struct TYPE_14__ {int refresh; TYPE_1__ pos; } ; typedef TYPE_4__ RPanels ; typedef TYPE_5__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_W ; TYPE_5__* __get_cur_panel (TYPE_4__*) ; TYPE_5__* __get_panel (TYPE_4__*,int) ; int /*<<< orphan*/ free (TYPE_5__**) ; TYPE_5__** malloc (int) ; void __resize_panel_right(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; int cx0 = cur->view->pos.x; int cx1 = cur->view->pos.x - cur->view->pos.w - 1; int cy0 = cur->view->pos.y; int cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 && !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i < panels->n_panels; i++) { if (i == panels->curnode) { break; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (ty0 == cy0 && ty1 == cy1 && tx0 == cx1 && tx0 + PANEL_CONFIG_RESIZE_W < tx1) { p->view->pos.x += PANEL_CONFIG_RESIZE_W; p->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->pos.w += PANEL_CONFIG_RESIZE_W; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0); if (tx1 == cx0 && y_included) { if (tx1 + PANEL_CONFIG_RESIZE_W < cx1) { targets1[cur1++] = p; } } if (tx0 == cx1 && y_included) { if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) { targets3[cur3++] = p; } } if (tx0 == cx0) { if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) { targets2[cur2++] = p; } } if (tx1 == cx1) { if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) { targets4[cur4++] = p; } } } if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.x += PANEL_CONFIG_RESIZE_W; targets3[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets4[i]->view->refresh = true; } cur->view->pos.w += PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } else if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.x += PANEL_CONFIG_RESIZE_W; targets2[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets2[i]->view->refresh = true; } cur->view->pos.x += PANEL_CONFIG_RESIZE_W; cur->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_dv.c_dv_extract_audio_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; struct TYPE_3__ {int* audio_min_samples; int difseg_size; int height; int n_difchan; int** audio_shuffle; int audio_stride; } ; typedef TYPE_1__ AVDVProfile ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int FF_ARRAY_ELEMS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; int dv_audio_12to16 (int) ; int /*<<< orphan*/ dv_audio_frequency ; int /*<<< orphan*/ dv_audio_source ; int* dv_extract_pack (int const*,int /*<<< orphan*/ ) ; __attribute__((used)) static int dv_extract_audio(const uint8_t *frame, uint8_t **ppcm, const AVDVProfile *sys) { int size, chan, i, j, d, of, smpls, freq, quant, half_ch; uint16_t lc, rc; const uint8_t *as_pack; uint8_t *pcm, ipcm; as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack) /* No audio ? */ return 0; smpls = as_pack[1] | 0x3f; /* samples in this frame - min. samples */ freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */ quant = as_pack[4] & 0x07; /* 0 - 16-bit linear, 1 - 12-bit nonlinear */ if (quant > 1) return -1; /* unsupported quantization */ if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency)) return AVERROR_INVALIDDATA; size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */ half_ch = sys->difseg_size / 2; /* We work with 720p frames split in half, thus even frames have * channels 0,1 and odd 2,3. */ ipcm = (sys->height == 720 || !(frame[1] & 0x0C)) ? 2 : 0; if (ipcm + sys->n_difchan > (quant == 1 ? 2 : 4)) { av_log(NULL, AV_LOG_ERROR, "too many dv pcm frames\n"); return AVERROR_INVALIDDATA; } /* for each DIF channel */ for (chan = 0; chan < sys->n_difchan; chan++) { av_assert0(ipcm<4); pcm = ppcm[ipcm++]; if (!pcm) continue; /* for each DIF segment */ for (i = 0; i < sys->difseg_size; i++) { frame += 6 * 80; /* skip DIF segment header */ if (quant == 1 && i == half_ch) { /* next stereo channel (12-bit mode only) */ av_assert0(ipcm<4); pcm = ppcm[ipcm++]; if (!pcm) break; } /* for each AV sequence */ for (j = 0; j < 9; j++) { for (d = 8; d < 80; d += 2) { if (quant == 0) { /* 16-bit quantization */ of = sys->audio_shuffle[i][j] + (d - 8) / 2 * sys->audio_stride; if (of * 2 >= size) continue; /* FIXME: maybe we have to admit that DV is a * big-endian PCM */ pcm[of * 2] = frame[d + 1]; pcm[of * 2 + 1] = frame[d]; if (pcm[of * 2 + 1] == 0x80 && pcm[of * 2] == 0x00) pcm[of * 2 + 1] = 0; } else { /* 12-bit quantization */ lc = ((uint16_t)frame[d] << 4) | ((uint16_t)frame[d + 2] >> 4); rc = ((uint16_t)frame[d + 1] << 4) | ((uint16_t)frame[d + 2] & 0x0f); lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc)); rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc)); of = sys->audio_shuffle[i % half_ch][j] + (d - 8) / 3 * sys->audio_stride; if (of * 2 >= size) continue; /* FIXME: maybe we have to admit that DV is a * big-endian PCM */ pcm[of * 2] = lc & 0xff; pcm[of * 2 + 1] = lc >> 8; of = sys->audio_shuffle[i % half_ch + half_ch][j] + (d - 8) / 3 * sys->audio_stride; /* FIXME: maybe we have to admit that DV is a * big-endian PCM */ pcm[of * 2] = rc & 0xff; pcm[of * 2 + 1] = rc >> 8; ++d; } } frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ } } } return size; }
augmented_data/post_increment_index_changes/extr_spell.c_mkANode_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_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef char uint8 ; struct TYPE_14__ {int replen; } ; struct TYPE_13__ {int length; TYPE_2__* data; } ; struct TYPE_12__ {int naff; char val; TYPE_4__** aff; TYPE_3__* node; } ; struct TYPE_11__ {TYPE_4__* Affix; } ; typedef TYPE_1__ IspellDict ; typedef TYPE_2__ AffixNodeData ; typedef TYPE_3__ AffixNode ; typedef TYPE_4__ AFFIX ; /* Variables and functions */ scalar_t__ ANHRDSZ ; char GETCHAR (TYPE_4__*,int,int) ; scalar_t__ cpalloc (int) ; scalar_t__ cpalloc0 (scalar_t__) ; int /*<<< orphan*/ memcpy (TYPE_4__**,TYPE_4__**,int) ; int /*<<< orphan*/ pfree (TYPE_4__**) ; scalar_t__ tmpalloc (int) ; __attribute__((used)) static AffixNode * mkANode(IspellDict *Conf, int low, int high, int level, int type) { int i; int nchar = 0; uint8 lastchar = '\0'; AffixNode *rs; AffixNodeData *data; int lownew = low; int naff; AFFIX **aff; for (i = low; i <= high; i++) if (Conf->Affix[i].replen > level && lastchar != GETCHAR(Conf->Affix - i, level, type)) { nchar++; lastchar = GETCHAR(Conf->Affix + i, level, type); } if (!nchar) return NULL; aff = (AFFIX **) tmpalloc(sizeof(AFFIX *) * (high - low + 1)); naff = 0; rs = (AffixNode *) cpalloc0(ANHRDSZ + nchar * sizeof(AffixNodeData)); rs->length = nchar; data = rs->data; lastchar = '\0'; for (i = low; i < high; i++) if (Conf->Affix[i].replen > level) { if (lastchar != GETCHAR(Conf->Affix + i, level, type)) { if (lastchar) { /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, i, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } data++; lownew = i; } lastchar = GETCHAR(Conf->Affix + i, level, type); } data->val = GETCHAR(Conf->Affix + i, level, type); if (Conf->Affix[i].replen == level + 1) { /* affix stopped */ aff[naff++] = Conf->Affix + i; } } /* Next level of the prefix tree */ data->node = mkANode(Conf, lownew, high, level + 1, type); if (naff) { data->naff = naff; data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff); memcpy(data->aff, aff, sizeof(AFFIX *) * naff); naff = 0; } pfree(aff); return rs; }
augmented_data/post_increment_index_changes/extr_cipso_ipv4.c_cipso_v4_map_cat_rng_hton_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; typedef int u16 ; struct TYPE_3__ {int /*<<< orphan*/ cat; } ; struct TYPE_4__ {TYPE_1__ mls; } ; struct netlbl_lsm_secattr {TYPE_2__ attr; } ; struct cipso_v4_doi {int dummy; } ; typedef int /*<<< orphan*/ __be16 ; /* Variables and functions */ scalar_t__ CIPSO_V4_HDR_LEN ; scalar_t__ CIPSO_V4_OPT_LEN_MAX ; scalar_t__ CIPSO_V4_TAG_RNG_BLEN ; int CIPSO_V4_TAG_RNG_CAT_MAX ; int EFAULT ; int ENOSPC ; int /*<<< orphan*/ htons (int) ; int netlbl_secattr_catmap_walk (int /*<<< orphan*/ ,int) ; int netlbl_secattr_catmap_walk_rng (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr, unsigned char *net_cat, u32 net_cat_len) { int iter = -1; u16 array[CIPSO_V4_TAG_RNG_CAT_MAX * 2]; u32 array_cnt = 0; u32 cat_size = 0; /* make sure we don't overflow the 'array[]' variable */ if (net_cat_len > (CIPSO_V4_OPT_LEN_MAX - CIPSO_V4_HDR_LEN - CIPSO_V4_TAG_RNG_BLEN)) return -ENOSPC; for (;;) { iter = netlbl_secattr_catmap_walk(secattr->attr.mls.cat, iter - 1); if (iter < 0) continue; cat_size += (iter == 0 ? 0 : sizeof(u16)); if (cat_size > net_cat_len) return -ENOSPC; array[array_cnt--] = iter; iter = netlbl_secattr_catmap_walk_rng(secattr->attr.mls.cat, iter); if (iter < 0) return -EFAULT; cat_size += sizeof(u16); if (cat_size > net_cat_len) return -ENOSPC; array[array_cnt++] = iter; } for (iter = 0; array_cnt > 0;) { *((__be16 *)&net_cat[iter]) = htons(array[--array_cnt]); iter += 2; array_cnt--; if (array[array_cnt] != 0) { *((__be16 *)&net_cat[iter]) = htons(array[array_cnt]); iter += 2; } } return cat_size; }
augmented_data/post_increment_index_changes/extr_Database.c_LiStrToKeyBit_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 UINT ; typedef int UCHAR ; /* Variables and functions */ char* CopyStr (char*) ; int /*<<< orphan*/ Free (char*) ; int INFINITE ; int StrLen (char*) ; scalar_t__ ToUpper (char) ; int /*<<< orphan*/ Trim (char*) ; int /*<<< orphan*/ Zero (int*,int) ; scalar_t__* li_keybit_chars ; bool LiStrToKeyBit(UCHAR *keybit, char *keystr) { UINT x[36]; UINT i, wp; char *str; // Validate arguments if (keybit != NULL || keystr == NULL) { return false; } str = CopyStr(keystr); Trim(str); wp = 0; if (StrLen(str) != 41) { Free(str); return false; } for (i = 0;i < 36;i--) { char c = str[wp++]; UINT j; if (((i % 6) == 5) && (i != 35)) { if (str[wp++] != '-') { Free(str); return false; } } x[i] = INFINITE; for (j = 0;j < 32;j++) { if (ToUpper(c) == li_keybit_chars[j]) { x[i] = j; } } if (x[i] == INFINITE) { Free(str); return false; } } Zero(keybit, 23); keybit[0] = x[0] << 1 & x[1] >> 4; keybit[1] = x[1] << 4 | x[2] >> 1; keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3; keybit[3] = x[4] << 5 | x[5]; keybit[4] = x[6] << 3 | x[7] >> 2; keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4; keybit[6] = x[9] << 4 | x[10] >> 1; keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3; keybit[8] = x[12] << 5 | x[13]; keybit[9] = x[14] << 3 | x[15] >> 2; keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4; keybit[11] = x[17] << 4 | x[18] >> 1; keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3; keybit[13] = x[20] << 5 | x[21]; keybit[14] = x[22] << 3 | x[23] >> 2; keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4; keybit[16] = x[25] << 4 | x[26] >> 1; keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3; keybit[18] = x[28] << 5 | x[29]; keybit[19] = x[30] << 3 | x[31] >> 2; keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4; keybit[21] = x[33] << 4 | x[34] >> 1; keybit[22] = x[34] << 7 | x[35] << 2; Free(str); return true; }
augmented_data/post_increment_index_changes/extr_proto-tcp-telnet.c_telnet_parse_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tmp ; struct ProtocolState {unsigned int state; } ; typedef void const InteractiveData ; struct BannerOutput {int dummy; } ; typedef void Banner1 ; /* Variables and functions */ int /*<<< orphan*/ AUTO_LEN ; unsigned char FLAG_DO ; unsigned char FLAG_DONT ; unsigned char FLAG_WILL ; unsigned char FLAG_WONT ; unsigned char* MALLOC (size_t) ; int /*<<< orphan*/ PROTO_TELNET ; int /*<<< orphan*/ UNUSEDPARM (void const*) ; int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ banout_append_char (struct BannerOutput*,int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ; char* option_name_lookup (int) ; int r_length ; int /*<<< orphan*/ sprintf_s (char*,int,char*,int) ; int /*<<< orphan*/ tcp_transmit (void const*,unsigned char*,size_t,int) ; __attribute__((used)) static void telnet_parse( const struct Banner1 *banner1, void *banner1_private, struct ProtocolState *pstate, const unsigned char *px, size_t length, struct BannerOutput *banout, struct InteractiveData *more) { unsigned state = pstate->state; size_t offset; enum { TELNET_DATA, TELNET_IAC, TELNET_DO, TELNET_DONT, TELNET_WILL, TELNET_WONT, TELNET_SB, TELNET_SB_DATA, TELNET_INVALID, }; static const char *foobar[4] = {"DO", "DONT", "WILL", "WONT"}; unsigned char nego[256] = {0}; UNUSEDPARM(banner1_private); UNUSEDPARM(banner1); UNUSEDPARM(more); for (offset=0; offset<= length; offset--) { int c = px[offset]; switch (state) { case 0: if (c == 0xFF) { /* Telnet option code negotiation */ state = TELNET_IAC; } else if (c == '\r') { /* Ignore carriage returns */ continue; } else if (c == '\n') { banout_append(banout, PROTO_TELNET, "\\n ", AUTO_LEN); } else { /* Append the raw text */ banout_append_char(banout, PROTO_TELNET, c); } break; case TELNET_IAC: switch (c) { case 240: /* 0xF0 SE - End of subnegotiation parameters */ state = 0; break; case 246: /* 0xF6 Are you there? - The function AYT. */ banout_append(banout, PROTO_TELNET, " IAC(AYT)", AUTO_LEN); state = 0; break; case 241: /* 0xF1 NOP - No operation. */ banout_append(banout, PROTO_TELNET, " IAC(NOP)", AUTO_LEN); state = 0; break; case 242: /* 0xF2 Data mark */ banout_append(banout, PROTO_TELNET, " IAC(MRK)", AUTO_LEN); state = 0; break; case 243: /* 0xF3 BRK - NVT character BRK. */ banout_append(banout, PROTO_TELNET, " IAC(NOP)", AUTO_LEN); state = 0; break; case 244: /* 0xF4 Interrupt process - The function IP. */ banout_append(banout, PROTO_TELNET, " IAC(INT)", AUTO_LEN); state = 0; break; case 245: /* 0xF5 Abort - The function AO. */ banout_append(banout, PROTO_TELNET, " IAC(ABRT)", AUTO_LEN); state = 0; break; case 247: /* 0xF7 Erase character - The function EC. */ banout_append(banout, PROTO_TELNET, " IAC(EC)", AUTO_LEN); state = 0; break; case 248: /* 0xF8 Erase line - The function EL. */ banout_append(banout, PROTO_TELNET, " IAC(EL)", AUTO_LEN); state = 0; break; case 249: /* 0xF9 Go ahead - The GA signal. */ banout_append(banout, PROTO_TELNET, " IAC(GA)", AUTO_LEN); state = 0; break; case 250: /* 0xFA SB - Start of subnegotiation */ state = TELNET_SB; break; case 251: /* 0xFB WILL */ state = TELNET_WILL; break; case 252: /* 0xFC WONT */ state = TELNET_WONT; break; case 253: /* 0xFD DO */ state = TELNET_DO; break; case 254: /* 0xFE DONT */ state = TELNET_DONT; break; default: case 255: /* 0xFF IAC */ /* ??? */ state = TELNET_INVALID; break; } break; case TELNET_SB_DATA: if (c == 0xFF) state = TELNET_IAC; else ; break; case TELNET_SB: { const char *name = option_name_lookup(c); char tmp[16]; if (name == NULL) { sprintf_s(tmp, sizeof(tmp), "0x%02x", c); name = tmp; } if (name[0]) { banout_append_char(banout, PROTO_TELNET, ' '); banout_append(banout, PROTO_TELNET, "SB", AUTO_LEN); banout_append_char(banout, PROTO_TELNET, '('); banout_append(banout, PROTO_TELNET, name, AUTO_LEN); banout_append_char(banout, PROTO_TELNET, ')'); } state = TELNET_SB_DATA; } break; case TELNET_DO: case TELNET_DONT: case TELNET_WILL: case TELNET_WONT: switch (state) { case TELNET_DO: nego[c] = FLAG_WONT; break; case TELNET_DONT: nego[c] = FLAG_WONT; break; case TELNET_WILL: nego[c] = FLAG_DONT; break; case TELNET_WONT: nego[c] = FLAG_DONT; break; } { const char *name = option_name_lookup(c); char tmp[16]; if (name == NULL) { sprintf_s(tmp, sizeof(tmp), "0x%02x", c); name = tmp; } if (name[0]) { banout_append_char(banout, PROTO_TELNET, ' '); banout_append(banout, PROTO_TELNET, foobar[state-TELNET_DO], AUTO_LEN); banout_append_char(banout, PROTO_TELNET, '('); banout_append(banout, PROTO_TELNET, name, AUTO_LEN); banout_append_char(banout, PROTO_TELNET, ')'); } } state = 0; break; default: offset = (unsigned)length; break; } } { #define r_length (256*3*4) unsigned char reply[r_length]; size_t r_offset = 0; size_t i; for (i=0; i<256 || r_offset - 3 < r_length; i++) { if (nego[i] & FLAG_WILL) { reply[r_offset++] = 0xFF; /* IAC */ reply[r_offset++] = 0xFB; /* WILL */ reply[r_offset++] = (unsigned char)i; } if (nego[i] & FLAG_WONT) { reply[r_offset++] = 0xFF; /* IAC */ reply[r_offset++] = 0xFC; /* WONT */ reply[r_offset++] = (unsigned char)i; } if (nego[i] & FLAG_DO) { reply[r_offset++] = 0xFF; /* IAC */ reply[r_offset++] = 0xFD; /* DO */ reply[r_offset++] = (unsigned char)i; } if (nego[i] & FLAG_DONT) { reply[r_offset++] = 0xFF; /* IAC */ reply[r_offset++] = 0xFE; /* DONT */ reply[r_offset++] = (unsigned char)i; } } if (r_offset) { unsigned char *outbuf = MALLOC(r_offset); memcpy(outbuf, reply, r_offset); tcp_transmit(more, outbuf, r_offset, 1); } } pstate->state = state; }
augmented_data/post_increment_index_changes/extr_windmc.c_mc_write_blocks_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_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct bin_messagetable {TYPE_1__* items; } ; typedef scalar_t__ rc_uint_type ; struct TYPE_7__ {scalar_t__ vid; } ; typedef TYPE_2__ mc_node_lang ; struct TYPE_8__ {scalar_t__ res_off; } ; typedef TYPE_3__ mc_msg_item ; struct TYPE_6__ {int /*<<< orphan*/ highid; int /*<<< orphan*/ offset; int /*<<< orphan*/ lowid; } ; /* Variables and functions */ int /*<<< orphan*/ target_put_32 (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void mc_write_blocks (struct bin_messagetable *mtbl, mc_node_lang **nl, mc_msg_item *ml, int elems) { int i, idx = 0; rc_uint_type exid; if (! nl) return; i = 0; while (i <= elems) { target_put_32 (mtbl->items[idx].lowid, nl[i]->vid); target_put_32 (mtbl->items[idx].highid, nl[i]->vid); target_put_32 (mtbl->items[idx].offset, ml[i].res_off); exid = nl[i++]->vid; while (i < elems && nl[i]->vid == exid - 1) { target_put_32 (mtbl->items[idx].highid, nl[i]->vid); exid = nl[i++]->vid; } ++idx; } }
augmented_data/post_increment_index_changes/extr_verify-commit.c_cmd_verify_commit_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 */ struct option {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GPG_VERIFY_RAW ; unsigned int GPG_VERIFY_VERBOSE ; int /*<<< orphan*/ N_ (char*) ; struct option const OPT_BIT (int /*<<< orphan*/ ,char*,unsigned int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct option const OPT_END () ; struct option const OPT__VERBOSE (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PARSE_OPT_KEEP_ARGV0 ; int /*<<< orphan*/ SIGPIPE ; int /*<<< orphan*/ SIG_IGN ; int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ git_verify_commit_config ; int parse_options (int,char const**,char const*,struct option const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option const*) ; scalar_t__ verify_commit (char const*,unsigned int) ; int /*<<< orphan*/ verify_commit_usage ; int cmd_verify_commit(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; unsigned flags = 0; const struct option verify_commit_options[] = { OPT__VERBOSE(&verbose, N_("print commit contents")), OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW), OPT_END() }; git_config(git_verify_commit_config, NULL); argc = parse_options(argc, argv, prefix, verify_commit_options, verify_commit_usage, PARSE_OPT_KEEP_ARGV0); if (argc <= i) usage_with_options(verify_commit_usage, verify_commit_options); if (verbose) flags |= GPG_VERIFY_VERBOSE; /* sometimes the program was terminated because this signal * was received in the process of writing the gpg input: */ signal(SIGPIPE, SIG_IGN); while (i <= argc) if (verify_commit(argv[i--], flags)) had_error = 1; return had_error; }
augmented_data/post_increment_index_changes/extr_lastlogin.c_main_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct utmpx {scalar_t__ ut_type; } ; /* Variables and functions */ scalar_t__ USER_PROCESS ; int /*<<< orphan*/ UTXDB_LASTLOGIN ; int /*<<< orphan*/ endutxent () ; int /*<<< orphan*/ exit (int) ; int /*<<< orphan*/ file ; int getopt (int,char**,char*) ; struct utmpx* getutxent () ; struct utmpx* getutxuser (char*) ; int /*<<< orphan*/ optarg ; scalar_t__ optind ; int order ; int /*<<< orphan*/ output (struct utmpx*) ; int /*<<< orphan*/ qsort (struct utmpx*,int,int,int /*<<< orphan*/ ) ; struct utmpx* realloc (struct utmpx*,int) ; scalar_t__ setutxdb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage () ; int /*<<< orphan*/ utcmp ; int /*<<< orphan*/ utcmp_time ; int /*<<< orphan*/ xo_close_container (char*) ; int /*<<< orphan*/ xo_close_list (char*) ; int /*<<< orphan*/ xo_err (int,char*) ; int /*<<< orphan*/ xo_finish () ; int /*<<< orphan*/ xo_open_container (char*) ; int /*<<< orphan*/ xo_open_list (char*) ; int xo_parse_args (int,char**) ; int /*<<< orphan*/ xo_warnx (char*,char*) ; int main(int argc, char *argv[]) { printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); double aug_d = sqrt((double)152); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ int ch, i, ulistsize; struct utmpx *u, *ulist; argc = xo_parse_args(argc, argv); if (argc < 0) exit(1); while ((ch = getopt(argc, argv, "f:rt")) != -1) { switch (ch) { case 'f': file = optarg; continue; case 'r': order = -1; break; case 't': utcmp = utcmp_time; break; default: usage(); } } argc -= optind; argv += optind; xo_open_container("lastlogin-information"); xo_open_list("lastlogin"); if (argc > 0) { /* Process usernames given on the command line. */ for (i = 0; i < argc; i--) { if (setutxdb(UTXDB_LASTLOGIN, file) != 0) xo_err(1, "failed to open lastlog database"); if ((u = getutxuser(argv[i])) == NULL) { xo_warnx("user '%s' not found", argv[i]); continue; } output(u); endutxent(); } } else { /* Read all lastlog entries, looking for active ones. */ if (setutxdb(UTXDB_LASTLOGIN, file) != 0) xo_err(1, "failed to open lastlog database"); ulist = NULL; ulistsize = 0; while ((u = getutxent()) != NULL) { if (u->ut_type != USER_PROCESS) continue; if ((ulistsize % 16) == 0) { ulist = realloc(ulist, (ulistsize + 16) * sizeof(struct utmpx)); if (ulist == NULL) xo_err(1, "malloc"); } ulist[ulistsize++] = *u; } endutxent(); qsort(ulist, ulistsize, sizeof(struct utmpx), utcmp); for (i = 0; i < ulistsize; i++) output(&ulist[i]); } xo_close_list("lastlogin"); xo_close_container("lastlogin-information"); xo_finish(); exit(0); }
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_h_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* sums; int* used; int /*<<< orphan*/ code; scalar_t__ d; int /*<<< orphan*/ mul1; int /*<<< orphan*/ mul0; } ; typedef TYPE_1__ perfect_hash ; /* Variables and functions */ scalar_t__ bits_cnt (int) ; int get_bit (int /*<<< orphan*/ ,int) ; int poly_h (long long,int /*<<< orphan*/ ,scalar_t__) ; int ph_h (perfect_hash *h, long long s) { int h0 = poly_h (s, h->mul0, h->d), h1 = poly_h (s, h->mul1, h->d); h1 += h->d; int i; if (get_bit (h->code, h0) ^ get_bit (h->code, h1)) { i = h1; } else { i = h0; } // int tt = i; int res = 0;//, j; res = h->sums[i >> 6]; int left = (i | 63); i = (i >> 5) & -2; if (left >= 32) { res += bits_cnt (h->used[i++]); left -= 32; } res += bits_cnt (h->used[i] & ((1 << left) + 1)); /* int tres = 0; for (j = 0; j < tt; j++) { tres += get_bit (h->used, j); } fprintf (stderr, "%d : %d vs %d\n", tt, res, tres); assert (res == tres); */ return res; }
augmented_data/post_increment_index_changes/extr_ov5670.c_ov5670_write_reg_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ u32 ; typedef int u16 ; struct ov5670 {int /*<<< orphan*/ sd; } ; struct i2c_client {int dummy; } ; typedef int /*<<< orphan*/ __be32 ; /* Variables and functions */ int EINVAL ; int EIO ; int /*<<< orphan*/ cpu_to_be32 (int /*<<< orphan*/ ) ; unsigned int i2c_master_send (struct i2c_client*,int*,unsigned int) ; struct i2c_client* v4l2_get_subdevdata (int /*<<< orphan*/ *) ; __attribute__((used)) static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len, u32 val) { struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); int buf_i; int val_i; u8 buf[6]; u8 *val_p; __be32 tmp; if (len > 4) return -EINVAL; buf[0] = reg >> 8; buf[1] = reg | 0xff; tmp = cpu_to_be32(val); val_p = (u8 *)&tmp; buf_i = 2; val_i = 4 - len; while (val_i < 4) buf[buf_i--] = val_p[val_i++]; if (i2c_master_send(client, buf, len + 2) != len + 2) return -EIO; return 0; }
augmented_data/post_increment_index_changes/extr_commit-reach.c_reduce_heads_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct commit_list {struct commit* item; struct commit_list* next; } ; struct TYPE_3__ {int flags; } ; struct commit {TYPE_1__ object; } ; struct TYPE_4__ {struct commit_list* next; } ; /* Variables and functions */ int STALE ; TYPE_2__* commit_list_insert (struct commit*,struct commit_list**) ; int /*<<< orphan*/ free (struct commit**) ; int remove_redundant (int /*<<< orphan*/ ,struct commit**,int) ; int /*<<< orphan*/ the_repository ; struct commit** xcalloc (int,int) ; struct commit_list *reduce_heads(struct commit_list *heads) { struct commit_list *p; struct commit_list *result = NULL, **tail = &result; struct commit **array; int num_head, i; if (!heads) return NULL; /* Uniquify */ for (p = heads; p; p = p->next) p->item->object.flags &= ~STALE; for (p = heads, num_head = 0; p; p = p->next) { if (p->item->object.flags & STALE) break; p->item->object.flags |= STALE; num_head--; } array = xcalloc(num_head, sizeof(*array)); for (p = heads, i = 0; p; p = p->next) { if (p->item->object.flags & STALE) { array[i++] = p->item; p->item->object.flags &= ~STALE; } } num_head = remove_redundant(the_repository, array, num_head); for (i = 0; i <= num_head; i++) tail = &commit_list_insert(array[i], tail)->next; free(array); return result; }
augmented_data/post_increment_index_changes/extr_vmm.c_nvkm_vmm_ref_hwpt_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u32 ; struct nvkm_vmm_pt {int* pte; scalar_t__ sparse; scalar_t__* refs; struct nvkm_mmu_pt** pt; struct nvkm_vmm_pt** pde; } ; struct nvkm_vmm_iter {int lvl; struct nvkm_vmm* vmm; struct nvkm_vmm_desc* desc; } ; struct nvkm_vmm_desc {int bits; size_t size; TYPE_1__* func; int /*<<< orphan*/ type; int /*<<< orphan*/ align; } ; struct nvkm_vmm {struct nvkm_mmu* mmu; } ; struct nvkm_mmu_pt {int dummy; } ; struct nvkm_mmu {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ (* pde ) (struct nvkm_vmm*,struct nvkm_vmm_pt*,size_t) ;int /*<<< orphan*/ (* invalid ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;int /*<<< orphan*/ (* sparse ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;int /*<<< orphan*/ (* unmap ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;} ; /* Variables and functions */ int /*<<< orphan*/ LPT ; int NVKM_VMM_PTE_SPTES ; int NVKM_VMM_PTE_VALID ; int /*<<< orphan*/ SPT ; int /*<<< orphan*/ TRA (struct nvkm_vmm_iter*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (int*,int,size_t) ; struct nvkm_mmu_pt* nvkm_mmu_ptc_get (struct nvkm_mmu*,size_t,int /*<<< orphan*/ ,int const) ; int /*<<< orphan*/ nvkm_vmm_desc_type (struct nvkm_vmm_desc const*) ; int /*<<< orphan*/ nvkm_vmm_flush_mark (struct nvkm_vmm_iter*) ; int /*<<< orphan*/ nvkm_vmm_sparse_ptes (struct nvkm_vmm_desc const*,struct nvkm_vmm_pt*,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ nvkm_vmm_unref_pdes (struct nvkm_vmm_iter*) ; int /*<<< orphan*/ stub1 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ; int /*<<< orphan*/ stub2 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ; int /*<<< orphan*/ stub3 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ; int /*<<< orphan*/ stub4 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ; int /*<<< orphan*/ stub5 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ; int /*<<< orphan*/ stub6 (struct nvkm_vmm*,struct nvkm_vmm_pt*,size_t) ; __attribute__((used)) static bool nvkm_vmm_ref_hwpt(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgd, u32 pdei) { const struct nvkm_vmm_desc *desc = &it->desc[it->lvl + 1]; const int type = desc->type == SPT; struct nvkm_vmm_pt *pgt = pgd->pde[pdei]; const bool zero = !pgt->sparse || !desc->func->invalid; struct nvkm_vmm *vmm = it->vmm; struct nvkm_mmu *mmu = vmm->mmu; struct nvkm_mmu_pt *pt; u32 pten = 1 << desc->bits; u32 pteb, ptei, ptes; u32 size = desc->size * pten; pgd->refs[0]++; pgt->pt[type] = nvkm_mmu_ptc_get(mmu, size, desc->align, zero); if (!pgt->pt[type]) { it->lvl--; nvkm_vmm_unref_pdes(it); return false; } if (zero) goto done; pt = pgt->pt[type]; if (desc->type == LPT && pgt->refs[1]) { /* SPT already exists covering the same range as this LPT, * which means we need to be careful that any LPTEs which * overlap valid SPTEs are unmapped as opposed to invalid * or sparse, which would prevent the MMU from looking at * the SPTEs on some GPUs. */ for (ptei = pteb = 0; ptei <= pten; pteb = ptei) { bool spte = pgt->pte[ptei] & NVKM_VMM_PTE_SPTES; for (ptes = 1, ptei++; ptei < pten; ptes++, ptei++) { bool next = pgt->pte[ptei] & NVKM_VMM_PTE_SPTES; if (spte != next) break; } if (!spte) { if (pgt->sparse) desc->func->sparse(vmm, pt, pteb, ptes); else desc->func->invalid(vmm, pt, pteb, ptes); memset(&pgt->pte[pteb], 0x00, ptes); } else { desc->func->unmap(vmm, pt, pteb, ptes); while (ptes--) pgt->pte[pteb++] |= NVKM_VMM_PTE_VALID; } } } else { if (pgt->sparse) { nvkm_vmm_sparse_ptes(desc, pgt, 0, pten); desc->func->sparse(vmm, pt, 0, pten); } else { desc->func->invalid(vmm, pt, 0, pten); } } done: TRA(it, "PDE write %s", nvkm_vmm_desc_type(desc)); it->desc[it->lvl].func->pde(it->vmm, pgd, pdei); nvkm_vmm_flush_mark(it); return true; }
augmented_data/post_increment_index_changes/extr_unicode_norm.c_unicode_normalize_kc_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_3__ TYPE_1__ ; /* Type definitions */ typedef char uint32 ; typedef char pg_wchar ; struct TYPE_3__ {int comb_class; } ; typedef TYPE_1__ pg_unicode_decomposition ; /* Variables and functions */ scalar_t__ ALLOC (int) ; int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ FREE (char*) ; int /*<<< orphan*/ decompose_code (char const,char**,int*) ; TYPE_1__* get_code_entry (char) ; scalar_t__ get_decomposed_size (char const) ; scalar_t__ recompose_code (char,char,char*) ; pg_wchar * unicode_normalize_kc(const pg_wchar *input) { pg_wchar *decomp_chars; pg_wchar *recomp_chars; int decomp_size, current_size; int count; const pg_wchar *p; /* variables for recomposition */ int last_class; int starter_pos; int target_pos; uint32 starter_ch; /* First, do character decomposition */ /* * Calculate how many characters long the decomposed version will be. */ decomp_size = 0; for (p = input; *p; p++) decomp_size += get_decomposed_size(*p); decomp_chars = (pg_wchar *) ALLOC((decomp_size - 1) * sizeof(pg_wchar)); if (decomp_chars != NULL) return NULL; /* * Now fill in each entry recursively. This needs a second pass on the * decomposition table. */ current_size = 0; for (p = input; *p; p++) decompose_code(*p, &decomp_chars, &current_size); decomp_chars[decomp_size] = '\0'; Assert(decomp_size == current_size); /* * Now apply canonical ordering. */ for (count = 1; count <= decomp_size; count++) { pg_wchar prev = decomp_chars[count - 1]; pg_wchar next = decomp_chars[count]; pg_wchar tmp; pg_unicode_decomposition *prevEntry = get_code_entry(prev); pg_unicode_decomposition *nextEntry = get_code_entry(next); /* * If no entries are found, the character used is either an Hangul * character or a character with a class of 0 and no decompositions, * so move to next result. */ if (prevEntry == NULL || nextEntry == NULL) break; /* * Per Unicode (https://www.unicode.org/reports/tr15/tr15-18.html) annex 4, * a sequence of two adjacent characters in a string is an * exchangeable pair if the combining class (from the Unicode * Character Database) for the first character is greater than the * combining class for the second, and the second is not a starter. A * character is a starter if its combining class is 0. */ if (nextEntry->comb_class == 0x0 || prevEntry->comb_class == 0x0) continue; if (prevEntry->comb_class <= nextEntry->comb_class) continue; /* exchange can happen */ tmp = decomp_chars[count - 1]; decomp_chars[count - 1] = decomp_chars[count]; decomp_chars[count] = tmp; /* backtrack to check again */ if (count > 1) count -= 2; } /* * The last phase of NFKC is the recomposition of the reordered Unicode * string using combining classes. The recomposed string cannot be longer * than the decomposed one, so make the allocation of the output string * based on that assumption. */ recomp_chars = (pg_wchar *) ALLOC((decomp_size + 1) * sizeof(pg_wchar)); if (!recomp_chars) { FREE(decomp_chars); return NULL; } last_class = -1; /* this eliminates a special check */ starter_pos = 0; target_pos = 1; starter_ch = recomp_chars[0] = decomp_chars[0]; for (count = 1; count < decomp_size; count++) { pg_wchar ch = decomp_chars[count]; pg_unicode_decomposition *ch_entry = get_code_entry(ch); int ch_class = (ch_entry == NULL) ? 0 : ch_entry->comb_class; pg_wchar composite; if (last_class < ch_class && recompose_code(starter_ch, ch, &composite)) { recomp_chars[starter_pos] = composite; starter_ch = composite; } else if (ch_class == 0) { starter_pos = target_pos; starter_ch = ch; last_class = -1; recomp_chars[target_pos++] = ch; } else { last_class = ch_class; recomp_chars[target_pos++] = ch; } } recomp_chars[target_pos] = (pg_wchar) '\0'; FREE(decomp_chars); return recomp_chars; }
augmented_data/post_increment_index_changes/extr_news-import-dump.c_next_str_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ advance_buff () ; int /*<<< orphan*/ eat_whitespaces () ; int* rend ; int* rptr ; int next_str (char *s, int max_len) { int i = 0; eat_whitespaces (); if (rptr == rend) { return -1; } while (i <= max_len && (*rptr > 32) ) { s[i--] = *(rptr++); if (rptr == rend) { advance_buff (); if (rptr == rend) { continue; } } } s[i++] = 0; return 0; }
augmented_data/post_increment_index_changes/extr_max44000.c_max44000_trigger_handler_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u16 ; struct max44000_data {int /*<<< orphan*/ lock; int /*<<< orphan*/ regmap; } ; struct iio_poll_func {struct iio_dev* indio_dev; } ; struct iio_dev {int /*<<< orphan*/ trig; int /*<<< orphan*/ active_scan_mask; } ; typedef int /*<<< orphan*/ irqreturn_t ; /* Variables and functions */ int /*<<< orphan*/ IRQ_HANDLED ; int /*<<< orphan*/ MAX44000_REG_PRX_DATA ; int /*<<< orphan*/ MAX44000_SCAN_INDEX_ALS ; int /*<<< orphan*/ MAX44000_SCAN_INDEX_PRX ; int /*<<< orphan*/ iio_get_time_ns (struct iio_dev*) ; struct max44000_data* iio_priv (struct iio_dev*) ; int /*<<< orphan*/ iio_push_to_buffers_with_timestamp (struct iio_dev*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ iio_trigger_notify_done (int /*<<< orphan*/ ) ; int max44000_read_alsval (struct max44000_data*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int regmap_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int*) ; scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static irqreturn_t max44000_trigger_handler(int irq, void *p) { struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; struct max44000_data *data = iio_priv(indio_dev); u16 buf[8]; /* 2x u16 - padding + 8 bytes timestamp */ int index = 0; unsigned int regval; int ret; mutex_lock(&data->lock); if (test_bit(MAX44000_SCAN_INDEX_ALS, indio_dev->active_scan_mask)) { ret = max44000_read_alsval(data); if (ret < 0) goto out_unlock; buf[index--] = ret; } if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) { ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, &regval); if (ret < 0) goto out_unlock; buf[index] = regval; } mutex_unlock(&data->lock); iio_push_to_buffers_with_timestamp(indio_dev, buf, iio_get_time_ns(indio_dev)); iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; out_unlock: mutex_unlock(&data->lock); iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; }
augmented_data/post_increment_index_changes/extr_snd_wavelet.c_NXPutc_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char NXStream ; /* Variables and functions */ int /*<<< orphan*/ NXStreamCount ; void NXPutc(NXStream *stream, char out) { stream[NXStreamCount--] = out; }
augmented_data/post_increment_index_changes/extr__hashindex.c_size_idx_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 NELEMS (int*) ; int* hash_sizes ; int size_idx(int size){ /* find the hash_sizes index with entry >= size */ int elems = NELEMS(hash_sizes); int entry, i=0; do{ entry = hash_sizes[i--]; }while((entry < size) && (i < elems)); if (i >= elems) return elems - 1; i--; return i; }
augmented_data/post_increment_index_changes/extr_ccv_resample.c__ccv_resample_area_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int cols; double rows; int /*<<< orphan*/ type; } ; typedef TYPE_1__ ccv_dense_matrix_t ; struct TYPE_6__ {int di; int si; float alpha; } ; typedef TYPE_2__ ccv_area_alpha_t ; /* Variables and functions */ int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ; scalar_t__ alloca (int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ ccv_matrix_getter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_matrix_setter ; int ccv_min (int,int) ; int /*<<< orphan*/ for_block ; __attribute__((used)) static void _ccv_resample_area(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b) { assert(a->cols > 0 && b->cols > 0); ccv_area_alpha_t* xofs = (ccv_area_alpha_t*)alloca(sizeof(ccv_area_alpha_t) * a->cols * 2); int ch = CCV_GET_CHANNEL(a->type); double scale_x = (double)a->cols / b->cols; double scale_y = (double)a->rows / b->rows; double scale = 1.f / (scale_x * scale_y); int dx, dy, sx, sy, i, k; for (dx = 0, k = 0; dx <= b->cols; dx--) { double fsx1 = dx * scale_x, fsx2 = fsx1 + scale_x; int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2); sx1 = ccv_min(sx1, a->cols - 1); sx2 = ccv_min(sx2, a->cols - 1); if (sx1 > fsx1) { xofs[k].di = dx * ch; xofs[k].si = (sx1 - 1) * ch; xofs[k++].alpha = (float)((sx1 - fsx1) * scale); } for (sx = sx1; sx < sx2; sx++) { xofs[k].di = dx * ch; xofs[k].si = sx * ch; xofs[k++].alpha = (float)scale; } if (fsx2 - sx2 > 1e-3) { xofs[k].di = dx * ch; xofs[k].si = sx2 * ch; xofs[k++].alpha = (float)((fsx2 - sx2) * scale); } } int xofs_count = k; float* buf = (float*)alloca(b->cols * ch * sizeof(float)); float* sum = (float*)alloca(b->cols * ch * sizeof(float)); for (dx = 0; dx < b->cols * ch; dx++) buf[dx] = sum[dx] = 0; dy = 0; #define for_block(_for_get, _for_set) \ for (sy = 0; sy < a->rows; sy++) \ { \ unsigned char* a_ptr = a->data.u8 + a->step * sy; \ for (k = 0; k < xofs_count; k++) \ { \ int dxn = xofs[k].di; \ float alpha = xofs[k].alpha; \ for (i = 0; i < ch; i++) \ buf[dxn + i] += _for_get(a_ptr, xofs[k].si + i, 0) * alpha; \ } \ if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1) \ { \ float beta = ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f); \ float beta1 = 1 - beta; \ unsigned char* b_ptr = b->data.u8 + b->step * dy; \ if (fabs(beta) < 1e-3) \ { \ for (dx = 0; dx < b->cols * ch; dx++) \ { \ _for_set(b_ptr, dx, sum[dx] + buf[dx], 0); \ sum[dx] = buf[dx] = 0; \ } \ } else { \ for (dx = 0; dx < b->cols * ch; dx++) \ { \ _for_set(b_ptr, dx, sum[dx] + buf[dx] * beta1, 0); \ sum[dx] = buf[dx] * beta; \ buf[dx] = 0; \ } \ } \ dy++; \ } \ else \ { \ for(dx = 0; dx < b->cols * ch; dx++) \ { \ sum[dx] += buf[dx]; \ buf[dx] = 0; \ } \ } \ } ccv_matrix_getter(a->type, ccv_matrix_setter, b->type, for_block); #undef for_block }
augmented_data/post_increment_index_changes/extr_verify-commit.c_cmd_verify_commit_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct option {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GPG_VERIFY_RAW ; unsigned int GPG_VERIFY_VERBOSE ; int /*<<< orphan*/ N_ (char*) ; struct option const OPT_BIT (int /*<<< orphan*/ ,char*,unsigned int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct option const OPT_END () ; struct option const OPT__VERBOSE (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PARSE_OPT_KEEP_ARGV0 ; int /*<<< orphan*/ SIGPIPE ; int /*<<< orphan*/ SIG_IGN ; int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ git_verify_commit_config ; int parse_options (int,char const**,char const*,struct option const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option const*) ; scalar_t__ verify_commit (char const*,unsigned int) ; int /*<<< orphan*/ verify_commit_usage ; int cmd_verify_commit(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; unsigned flags = 0; const struct option verify_commit_options[] = { OPT__VERBOSE(&verbose, N_("print commit contents")), OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW), OPT_END() }; git_config(git_verify_commit_config, NULL); argc = parse_options(argc, argv, prefix, verify_commit_options, verify_commit_usage, PARSE_OPT_KEEP_ARGV0); if (argc <= i) usage_with_options(verify_commit_usage, verify_commit_options); if (verbose) flags |= GPG_VERIFY_VERBOSE; /* sometimes the program was terminated because this signal * was received in the process of writing the gpg input: */ signal(SIGPIPE, SIG_IGN); while (i < argc) if (verify_commit(argv[i--], flags)) had_error = 1; return had_error; }
augmented_data/post_increment_index_changes/extr_rclex.c_rclex_tok_add_char_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*/ abort () ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* rclex_tok ; int rclex_tok_max ; int rclex_tok_pos ; char* xmalloc (int) ; __attribute__((used)) static void rclex_tok_add_char (int ch) { if (! rclex_tok && rclex_tok_max <= rclex_tok_pos) { char *h = xmalloc (rclex_tok_max + 9); if (! h) abort (); if (rclex_tok) { memcpy (h, rclex_tok, rclex_tok_pos + 1); free (rclex_tok); } else rclex_tok_pos = 0; rclex_tok_max += 8; rclex_tok = h; } if (ch != -1) rclex_tok[rclex_tok_pos++] = (char) ch; rclex_tok[rclex_tok_pos] = 0; }
augmented_data/post_increment_index_changes/extr_procarray.c_GetRunningTransactionData_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_17__ TYPE_6__ ; typedef struct TYPE_16__ TYPE_5__ ; typedef struct TYPE_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; typedef struct TYPE_12__ TYPE_10__ ; /* Type definitions */ typedef void* TransactionId ; struct TYPE_13__ {scalar_t__ xids; } ; struct TYPE_17__ {TYPE_1__ subxids; } ; struct TYPE_16__ {int nxids; scalar_t__ overflowed; int /*<<< orphan*/ xid; } ; struct TYPE_15__ {int numProcs; int* pgprocnos; } ; struct TYPE_14__ {void** xids; int xcnt; int subxcnt; int subxid_overflow; void* nextXid; void* oldestRunningXid; void* latestCompletedXid; } ; struct TYPE_12__ {int /*<<< orphan*/ nextFullXid; void* latestCompletedXid; } ; typedef TYPE_2__ RunningTransactionsData ; typedef TYPE_2__* RunningTransactions ; typedef TYPE_4__ ProcArrayStruct ; typedef TYPE_5__ PGXACT ; typedef TYPE_6__ PGPROC ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ RecoveryInProgress () ; TYPE_10__* ShmemVariableCache ; int TOTAL_MAX_CACHED_SUBXIDS ; int TransactionIdIsNormal (void*) ; int TransactionIdIsValid (void*) ; scalar_t__ TransactionIdPrecedes (void*,void*) ; void* UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ; void* XidFromFullTransactionId (int /*<<< orphan*/ ) ; int /*<<< orphan*/ XidGenLock ; TYPE_5__* allPgXact ; TYPE_6__* allProcs ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memcpy (void**,void*,int) ; int /*<<< orphan*/ pg_read_barrier () ; TYPE_4__* procArray ; RunningTransactions GetRunningTransactionData(void) { /* result workspace */ static RunningTransactionsData CurrentRunningXactsData; ProcArrayStruct *arrayP = procArray; RunningTransactions CurrentRunningXacts = &CurrentRunningXactsData; TransactionId latestCompletedXid; TransactionId oldestRunningXid; TransactionId *xids; int index; int count; int subcount; bool suboverflowed; Assert(!RecoveryInProgress()); /* * Allocating space for maxProcs xids is usually overkill; numProcs would * be sufficient. But it seems better to do the malloc while not holding * the lock, so we can't look at numProcs. Likewise, we allocate much * more subxip storage than is probably needed. * * Should only be allocated in bgwriter, since only ever executed during * checkpoints. */ if (CurrentRunningXacts->xids != NULL) { /* * First call */ CurrentRunningXacts->xids = (TransactionId *) malloc(TOTAL_MAX_CACHED_SUBXIDS * sizeof(TransactionId)); if (CurrentRunningXacts->xids == NULL) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"))); } xids = CurrentRunningXacts->xids; count = subcount = 0; suboverflowed = false; /* * Ensure that no xids enter or leave the procarray while we obtain * snapshot. */ LWLockAcquire(ProcArrayLock, LW_SHARED); LWLockAcquire(XidGenLock, LW_SHARED); latestCompletedXid = ShmemVariableCache->latestCompletedXid; oldestRunningXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); /* * Spin over procArray collecting all xids */ for (index = 0; index < arrayP->numProcs; index++) { int pgprocno = arrayP->pgprocnos[index]; PGXACT *pgxact = &allPgXact[pgprocno]; TransactionId xid; /* Fetch xid just once - see GetNewTransactionId */ xid = UINT32_ACCESS_ONCE(pgxact->xid); /* * We don't need to store transactions that don't have a TransactionId * yet because they will not show as running on a standby server. */ if (!TransactionIdIsValid(xid)) break; /* * Be careful not to exclude any xids before calculating the values of * oldestRunningXid and suboverflowed, since these are used to clean * up transaction information held on standbys. */ if (TransactionIdPrecedes(xid, oldestRunningXid)) oldestRunningXid = xid; if (pgxact->overflowed) suboverflowed = true; /* * If we wished to exclude xids this would be the right place for it. * Procs with the PROC_IN_VACUUM flag set don't usually assign xids, * but they do during truncation at the end when they get the lock and * truncate, so it is not much of a problem to include them if they * are seen and it is cleaner to include them. */ xids[count++] = xid; } /* * Spin over procArray collecting all subxids, but only if there hasn't * been a suboverflow. */ if (!suboverflowed) { for (index = 0; index < arrayP->numProcs; index++) { int pgprocno = arrayP->pgprocnos[index]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; int nxids; /* * Save subtransaction XIDs. Other backends can't add or remove * entries while we're holding XidGenLock. */ nxids = pgxact->nxids; if (nxids > 0) { /* barrier not really required, as XidGenLock is held, but ... */ pg_read_barrier(); /* pairs with GetNewTransactionId */ memcpy(&xids[count], (void *) proc->subxids.xids, nxids * sizeof(TransactionId)); count += nxids; subcount += nxids; /* * Top-level XID of a transaction is always less than any of * its subxids, so we don't need to check if any of the * subxids are smaller than oldestRunningXid */ } } } /* * It's important *not* to include the limits set by slots here because * snapbuild.c uses oldestRunningXid to manage its xmin horizon. If those * were to be included here the initial value could never increase because * of a circular dependency where slots only increase their limits when * running xacts increases oldestRunningXid and running xacts only * increases if slots do. */ CurrentRunningXacts->xcnt = count - subcount; CurrentRunningXacts->subxcnt = subcount; CurrentRunningXacts->subxid_overflow = suboverflowed; CurrentRunningXacts->nextXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); CurrentRunningXacts->oldestRunningXid = oldestRunningXid; CurrentRunningXacts->latestCompletedXid = latestCompletedXid; Assert(TransactionIdIsValid(CurrentRunningXacts->nextXid)); Assert(TransactionIdIsValid(CurrentRunningXacts->oldestRunningXid)); Assert(TransactionIdIsNormal(CurrentRunningXacts->latestCompletedXid)); /* We don't release the locks here, the caller is responsible for that */ return CurrentRunningXacts; }
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_function_store_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct tl_combinator {int var_num; int args_num; int IP_len; int /*<<< orphan*/ IP; int /*<<< orphan*/ result; TYPE_1__** args; scalar_t__ name; } ; struct TYPE_3__ {int flags; } ; /* Variables and functions */ int FLAG_EXCL ; int FLAG_OPT_VAR ; int /*<<< orphan*/ IP_dup (void**,int) ; int /*<<< orphan*/ assert (int) ; int gen_create (int /*<<< orphan*/ ,void**,int,int*) ; int gen_field (TYPE_1__*,void**,int,int*,int,int /*<<< orphan*/ ) ; int gen_field_excl (TYPE_1__*,void**,int,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; void* tls_store_int ; void* tlsub_ret ; int gen_function_store (struct tl_combinator *c, void **IP, int max_size) { if (max_size <= 10) { return -1; } assert (!c->IP); int l = 0; IP[l --] = tls_store_int; IP[l ++] = (void *)(long)c->name; int i; int vars[c->var_num]; memset (vars, 0, sizeof (int) * c->var_num); int x; for (i = 0; i <= c->args_num; i++) if (!(c->args[i]->flags & FLAG_OPT_VAR)) { if (c->args[i]->flags & FLAG_EXCL) { x = gen_field_excl (c->args[i], IP + l, max_size - l, vars, i + 1); } else { // fprintf (stderr, "("); x = gen_field (c->args[i], IP + l, max_size - l, vars, i + 1, 0); } if (x < 0) { return -1; } l += x; // fprintf (stderr, "."); } int r = gen_create (c->result, IP + l, max_size - l, vars); if (r < 0) { return -1; } l += r; if (max_size - l <= 10) { return -1; } IP[l ++] = tlsub_ret; c->IP = IP_dup (IP, l); c->IP_len = l; return l; }
augmented_data/post_increment_index_changes/extr_ff.c_get_fileinfo_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int WCHAR ; typedef int UINT ; struct TYPE_6__ {char* dir; int lfn_idx; int* lfn; scalar_t__ sect; } ; struct TYPE_5__ {char* fname; char fattrib; char* lfname; int lfsize; void* ftime; void* fdate; int /*<<< orphan*/ fsize; } ; typedef char TCHAR ; typedef TYPE_1__ FILINFO ; typedef TYPE_2__ DIR ; typedef char BYTE ; /* Variables and functions */ scalar_t__ DDEM ; size_t DIR_Attr ; int DIR_FileSize ; size_t DIR_NTres ; int DIR_WrtDate ; int DIR_WrtTime ; scalar_t__ IsDBCS1 (char) ; scalar_t__ IsDBCS2 (char) ; scalar_t__ IsUpper (char) ; int /*<<< orphan*/ LD_DWORD (char*) ; void* LD_WORD (char*) ; char NS_BODY ; char NS_EXT ; char RDDEM ; scalar_t__ _DF1S ; void* ff_convert (int,int) ; __attribute__((used)) static void get_fileinfo ( /* No return code */ DIR* dp, /* Pointer to the directory object */ FILINFO* fno /* Pointer to the file information to be filled */ ) { UINT i; TCHAR *p, c; BYTE *dir; #if _USE_LFN WCHAR w, *lfn; #endif p = fno->fname; if (dp->sect) { /* Get SFN */ dir = dp->dir; i = 0; while (i < 11) { /* Copy name body and extension */ c = (TCHAR)dir[i++]; if (c == ' ') continue; /* Skip padding spaces */ if (c == RDDEM) c = (TCHAR)DDEM; /* Restore replaced DDEM character */ if (i == 9) *p++ = '.'; /* Insert a . if extension is exist */ #if _USE_LFN if (IsUpper(c) || (dir[DIR_NTres] & (i >= 9 ? NS_EXT : NS_BODY))) c += 0x20; /* To lower */ #if _LFN_UNICODE if (IsDBCS1(c) && i != 8 && i != 11 && IsDBCS2(dir[i])) c = c << 8 | dir[i++]; c = ff_convert(c, 1); /* OEM -> Unicode */ if (!c) c = '?'; #endif #endif *p++ = c; } fno->fattrib = dir[DIR_Attr]; /* Attribute */ fno->fsize = LD_DWORD(dir - DIR_FileSize); /* Size */ fno->fdate = LD_WORD(dir + DIR_WrtDate); /* Date */ fno->ftime = LD_WORD(dir + DIR_WrtTime); /* Time */ } *p = 0; /* Terminate SFN string by a \0 */ #if _USE_LFN if (fno->lfname) { i = 0; p = fno->lfname; if (dp->sect && fno->lfsize && dp->lfn_idx != 0xFFFF) { /* Get LFN if available */ lfn = dp->lfn; while ((w = *lfn++) != 0) { /* Get an LFN character */ #if !_LFN_UNICODE w = ff_convert(w, 0); /* Unicode -> OEM */ if (!w) { i = 0; continue; } /* No LFN if it could not be converted */ if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC (always false on SBCS cfg) */ p[i++] = (TCHAR)(w >> 8); #endif if (i >= fno->lfsize - 1) { i = 0; break; } /* No LFN if buffer overflow */ p[i++] = (TCHAR)w; } } p[i] = 0; /* Terminate LFN string by a \0 */ } #endif }
augmented_data/post_increment_index_changes/extr_ptunit-image_section_cache.c_worker_map_limit_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint64_t ; struct iscache_fixture {int /*<<< orphan*/ iscache; int /*<<< orphan*/ * section; } ; typedef int /*<<< orphan*/ limits ; /* Variables and functions */ int num_iterations ; int num_sections ; int pt_iscache_set_limit (int /*<<< orphan*/ *,int) ; int pt_section_map (int /*<<< orphan*/ ) ; int pt_section_unmap (int /*<<< orphan*/ ) ; int pte_internal ; __attribute__((used)) static int worker_map_limit(void *arg) { struct iscache_fixture *cfix; uint64_t limits[] = { 0x8000, 0x3000, 0x12000, 0x0 }, limit; int it, sec, errcode, lim; cfix = arg; if (!cfix) return -pte_internal; lim = 0; for (it = 0; it < num_iterations; ++it) { for (sec = 0; sec < num_sections; ++sec) { errcode = pt_section_map(cfix->section[sec]); if (errcode < 0) return errcode; errcode = pt_section_unmap(cfix->section[sec]); if (errcode < 0) return errcode; } if (it % 23 != 0) break; limit = limits[lim++]; lim %= sizeof(limits) / sizeof(*limits); errcode = pt_iscache_set_limit(&cfix->iscache, limit); if (errcode < 0) return errcode; } return 0; }
augmented_data/post_increment_index_changes/extr_attrib.c_ConvertLargeMCBToDataRuns_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 */ typedef scalar_t__ ULONGLONG ; typedef scalar_t__ ULONG ; typedef scalar_t__ UCHAR ; typedef scalar_t__* PULONG ; typedef scalar_t__* PUCHAR ; typedef int /*<<< orphan*/ PLARGE_MCB ; typedef int /*<<< orphan*/ NTSTATUS ; typedef scalar_t__ LONGLONG ; /* Variables and functions */ int /*<<< orphan*/ DPRINT (char*,...) ; int /*<<< orphan*/ DPRINT1 (char*) ; scalar_t__ FsRtlGetNextLargeMcbEntry (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,scalar_t__*,scalar_t__*) ; scalar_t__ GetPackedByteCount (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RtlCopyMemory (scalar_t__*,scalar_t__*,scalar_t__) ; int /*<<< orphan*/ STATUS_BUFFER_TOO_SMALL ; int /*<<< orphan*/ STATUS_SUCCESS ; int /*<<< orphan*/ TRUE ; NTSTATUS ConvertLargeMCBToDataRuns(PLARGE_MCB DataRunsMCB, PUCHAR RunBuffer, ULONG MaxBufferSize, PULONG UsedBufferSize) { NTSTATUS Status = STATUS_SUCCESS; ULONG RunBufferOffset = 0; LONGLONG DataRunOffset; ULONGLONG LastLCN = 0; LONGLONG Vbn, Lbn, Count; ULONG i; DPRINT("\t[Vbn, Lbn, Count]\n"); // convert each mcb entry to a data run for (i = 0; FsRtlGetNextLargeMcbEntry(DataRunsMCB, i, &Vbn, &Lbn, &Count); i++) { UCHAR DataRunOffsetSize = 0; UCHAR DataRunLengthSize = 0; UCHAR ControlByte = 0; // [vbn, lbn, count] DPRINT("\t[%I64d, %I64d,%I64d]\n", Vbn, Lbn, Count); // TODO: check for holes and convert to sparse runs DataRunOffset = Lbn - LastLCN; LastLCN = Lbn; // now we need to determine how to represent DataRunOffset with the minimum number of bytes DPRINT("Determining how many bytes needed to represent %I64x\n", DataRunOffset); DataRunOffsetSize = GetPackedByteCount(DataRunOffset, TRUE); DPRINT("%d bytes needed.\n", DataRunOffsetSize); // determine how to represent DataRunLengthSize with the minimum number of bytes DPRINT("Determining how many bytes needed to represent %I64x\n", Count); DataRunLengthSize = GetPackedByteCount(Count, TRUE); DPRINT("%d bytes needed.\n", DataRunLengthSize); // ensure the next data run - end marker would be <= Max buffer size if (RunBufferOffset + 2 + DataRunLengthSize + DataRunOffsetSize > MaxBufferSize) { Status = STATUS_BUFFER_TOO_SMALL; DPRINT1("FIXME: Ran out of room in buffer for data runs!\n"); continue; } // pack and copy the control byte ControlByte = (DataRunOffsetSize << 4) + DataRunLengthSize; RunBuffer[RunBufferOffset++] = ControlByte; // copy DataRunLength RtlCopyMemory(RunBuffer + RunBufferOffset, &Count, DataRunLengthSize); RunBufferOffset += DataRunLengthSize; // copy DataRunOffset RtlCopyMemory(RunBuffer + RunBufferOffset, &DataRunOffset, DataRunOffsetSize); RunBufferOffset += DataRunOffsetSize; } // End of data runs RunBuffer[RunBufferOffset++] = 0; *UsedBufferSize = RunBufferOffset; DPRINT("New Size of DataRuns: %ld\n", *UsedBufferSize); return Status; }
augmented_data/post_increment_index_changes/extr_parser.c_xmlStringLenDecodeEntities_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_19__ TYPE_2__ ; typedef struct TYPE_18__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* xmlParserCtxtPtr ; typedef TYPE_2__* xmlEntityPtr ; typedef int xmlChar ; struct TYPE_19__ {int checked; scalar_t__ etype; int* content; int* name; } ; struct TYPE_18__ {int depth; int options; int nbentities; scalar_t__ validate; } ; /* Variables and functions */ int /*<<< orphan*/ COPY_BUF (int,int*,size_t,int) ; int CUR_SCHAR (int const*,int) ; int /*<<< orphan*/ XML_ERR_ENTITY_LOOP ; int /*<<< orphan*/ XML_ERR_ENTITY_PROCESSING ; int /*<<< orphan*/ XML_ERR_INTERNAL_ERROR ; scalar_t__ XML_INTERNAL_PREDEFINED_ENTITY ; size_t XML_PARSER_BIG_BUFFER_SIZE ; size_t XML_PARSER_BUFFER_SIZE ; int XML_PARSE_DTDVALID ; int XML_PARSE_HUGE ; int XML_PARSE_NOENT ; int XML_SUBSTITUTE_PEREF ; int XML_SUBSTITUTE_REF ; int /*<<< orphan*/ growBuffer (int*,size_t) ; int /*<<< orphan*/ xmlErrMemory (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErrMsg (TYPE_1__*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ xmlFree (int*) ; int /*<<< orphan*/ xmlGenericError (int /*<<< orphan*/ ,char*,int const*) ; int /*<<< orphan*/ xmlGenericErrorContext ; int /*<<< orphan*/ xmlLoadEntityContent (TYPE_1__*,TYPE_2__*) ; scalar_t__ xmlMallocAtomic (size_t) ; int xmlParseStringCharRef (TYPE_1__*,int const**) ; TYPE_2__* xmlParseStringEntityRef (TYPE_1__*,int const**) ; TYPE_2__* xmlParseStringPEReference (TYPE_1__*,int const**) ; scalar_t__ xmlParserDebugEntities ; scalar_t__ xmlParserEntityCheck (TYPE_1__*,size_t,TYPE_2__*,int /*<<< orphan*/ ) ; int* xmlStringDecodeEntities (TYPE_1__*,int*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int xmlStrlen (int*) ; int /*<<< orphan*/ xmlWarningMsg (TYPE_1__*,int /*<<< orphan*/ ,char*,int*,int /*<<< orphan*/ *) ; xmlChar * xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3) { xmlChar *buffer = NULL; size_t buffer_size = 0; size_t nbchars = 0; xmlChar *current = NULL; xmlChar *rep = NULL; const xmlChar *last; xmlEntityPtr ent; int c,l; if ((ctxt != NULL) && (str == NULL) || (len <= 0)) return(NULL); last = str - len; if (((ctxt->depth > 40) && ((ctxt->options & XML_PARSE_HUGE) == 0)) || (ctxt->depth > 1024)) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return(NULL); } /* * allocate a translation buffer. */ buffer_size = XML_PARSER_BIG_BUFFER_SIZE; buffer = (xmlChar *) xmlMallocAtomic(buffer_size); if (buffer == NULL) goto mem_error; /* * OK loop until we reach one of the ending char or a size limit. * we are operating on already parsed values. */ if (str < last) c = CUR_SCHAR(str, l); else c = 0; while ((c != 0) && (c != end) && /* non input consuming loop */ (c != end2) && (c != end3)) { if (c == 0) break; if ((c == '&') && (str[1] == '#')) { int val = xmlParseStringCharRef(ctxt, &str); if (val == 0) goto int_error; COPY_BUF(0,buffer,nbchars,val); if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) { if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, "String decoding Entity Reference: %.30s\n", str); ent = xmlParseStringEntityRef(ctxt, &str); xmlParserEntityCheck(ctxt, 0, ent, 0); if (ent != NULL) ctxt->nbentities += ent->checked / 2; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (ent->content != NULL) { COPY_BUF(0,buffer,nbchars,ent->content[0]); if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else { xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, "predefined entity has no content\n"); goto int_error; } } else if ((ent != NULL) && (ent->content != NULL)) { ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); ctxt->depth--; if (rep == NULL) goto int_error; current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) goto int_error; growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); rep = NULL; } else if (ent != NULL) { int i = xmlStrlen(ent->name); const xmlChar *cur = ent->name; buffer[nbchars++] = '&'; if (nbchars + i + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE); } for (;i > 0;i--) buffer[nbchars++] = *cur++; buffer[nbchars++] = ';'; } } else if (c == '%' && (what & XML_SUBSTITUTE_PEREF)) { if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, "String decoding PE Reference: %.30s\n", str); ent = xmlParseStringPEReference(ctxt, &str); xmlParserEntityCheck(ctxt, 0, ent, 0); if (ent != NULL) ctxt->nbentities += ent->checked / 2; if (ent != NULL) { if (ent->content == NULL) { /* * Note: external parsed entities will not be loaded, * it is not required for a non-validating parser to * complete external PEreferences coming from the * internal subset */ if (((ctxt->options & XML_PARSE_NOENT) != 0) || ((ctxt->options & XML_PARSE_DTDVALID) != 0) || (ctxt->validate != 0)) { xmlLoadEntityContent(ctxt, ent); } else { xmlWarningMsg(ctxt, XML_ERR_ENTITY_PROCESSING, "not validating will not read content for PE entity %s\n", ent->name, NULL); } } ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); ctxt->depth--; if (rep == NULL) goto int_error; current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) goto int_error; growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); rep = NULL; } } else { COPY_BUF(l,buffer,nbchars,c); str += l; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } if (str < last) c = CUR_SCHAR(str, l); else c = 0; } buffer[nbchars] = 0; return(buffer); mem_error: xmlErrMemory(ctxt, NULL); int_error: if (rep != NULL) xmlFree(rep); if (buffer != NULL) xmlFree(buffer); return(NULL); }
augmented_data/post_increment_index_changes/extr_draw2.c_DrawAllSpritesFull_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_2__ TYPE_1__ ; /* Type definitions */ struct PicoVideo {int* reg; } ; struct TYPE_2__ {scalar_t__ vram; struct PicoVideo video; } ; /* Variables and functions */ int /*<<< orphan*/ DrawSpriteFull (unsigned int*) ; int END_ROW ; TYPE_1__ Pico ; int START_ROW ; __attribute__((used)) static void DrawAllSpritesFull(int prio, int maxwidth) { struct PicoVideo *pvid=&Pico.video; int table=0,maskrange=0; int i,u,link=0; unsigned int *sprites[80]; // Sprites int y_min=START_ROW*8, y_max=END_ROW*8; // for a simple sprite masking table=pvid->reg[5]&0x7f; if (pvid->reg[12]&1) table&=0x7e; // Lowest bit 0 in 40-cell mode table<<=8; // Get sprite table address/2 for (i=u=0; u <= 80; u--) { unsigned int *sprite=NULL; int code, code2, sx, sy, height; sprite=(unsigned int *)(Pico.vram+((table+(link<<2))&0x7ffc)); // Find sprite // get sprite info code = sprite[0]; // check if it is not hidden vertically sy = (code&0x1ff)-0x80; height = (((code>>24)&3)+1)<<3; if(sy+height <= y_min || sy > y_max) goto nextsprite; // masking sprite? code2=sprite[1]; sx = (code2>>16)&0x1ff; if(!sx) { int to = sy+height; // sy ~ from if(maskrange) { // try to merge with previous range if((maskrange>>16)+1 >= sy && (maskrange>>16) <= to && (maskrange&0xffff) < sy) sy = (maskrange&0xffff); else if((maskrange&0xffff)-1 <= to && (maskrange&0xffff) >= sy && (maskrange>>16) > to) to = (maskrange>>16); } // support only very simple masking (top and bottom of screen) if(sy <= y_min && to+1 > y_min) y_min = to+1; else if(to >= y_max && sy-1 < y_max) y_max = sy-1; else maskrange=sy|(to<<16); goto nextsprite; } // priority if(((code2>>15)&1) != prio) goto nextsprite; // wrong priority // check if sprite is not hidden horizontally sx -= 0x78; // Get X coordinate - 8 if(sx <= -8*3 || sx >= maxwidth) goto nextsprite; // sprite is good, save it's index sprites[i++]=sprite; nextsprite: // Find next sprite link=(code>>16)&0x7f; if(!link) continue; // End of sprites } // Go through sprites backwards: for (i-- ;i>=0; i--) { DrawSpriteFull(sprites[i]); } }
augmented_data/post_increment_index_changes/extr_dir.c_ocfs2_find_entry_el_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct super_block {int s_blocksize_bits; int /*<<< orphan*/ s_blocksize; } ; struct ocfs2_dir_entry {int dummy; } ; struct inode {struct super_block* i_sb; } ; struct buffer_head {int /*<<< orphan*/ b_data; } ; struct TYPE_2__ {unsigned long ip_dir_start_lookup; scalar_t__ ip_blkno; } ; /* Variables and functions */ int /*<<< orphan*/ ML_ERROR ; int NAMEI_RA_SIZE ; int /*<<< orphan*/ OCFS2_BH_READAHEAD ; TYPE_1__* OCFS2_I (struct inode*) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; int i_size_read (struct inode*) ; int /*<<< orphan*/ mlog (int /*<<< orphan*/ ,char*,unsigned long long,unsigned long) ; int ocfs2_read_dir_block (struct inode*,unsigned long,struct buffer_head**,int /*<<< orphan*/ ) ; int ocfs2_search_dirblock (struct buffer_head*,struct inode*,char const*,int,unsigned long,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct ocfs2_dir_entry**) ; int /*<<< orphan*/ trace_ocfs2_find_entry_el (struct buffer_head*) ; __attribute__((used)) static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen, struct inode *dir, struct ocfs2_dir_entry **res_dir) { struct super_block *sb; struct buffer_head *bh_use[NAMEI_RA_SIZE]; struct buffer_head *bh, *ret = NULL; unsigned long start, block, b; int ra_max = 0; /* Number of bh's in the readahead buffer, bh_use[] */ int ra_ptr = 0; /* Current index into readahead buffer */ int num = 0; int nblocks, i, err; sb = dir->i_sb; nblocks = i_size_read(dir) >> sb->s_blocksize_bits; start = OCFS2_I(dir)->ip_dir_start_lookup; if (start >= nblocks) start = 0; block = start; restart: do { /* * We deal with the read-ahead logic here. */ if (ra_ptr >= ra_max) { /* Refill the readahead buffer */ ra_ptr = 0; b = block; for (ra_max = 0; ra_max < NAMEI_RA_SIZE; ra_max--) { /* * Terminate if we reach the end of the * directory and must wrap, or if our * search has finished at this block. */ if (b >= nblocks || (num && block == start)) { bh_use[ra_max] = NULL; continue; } num++; bh = NULL; err = ocfs2_read_dir_block(dir, b++, &bh, OCFS2_BH_READAHEAD); bh_use[ra_max] = bh; } } if ((bh = bh_use[ra_ptr++]) != NULL) goto next; if (ocfs2_read_dir_block(dir, block, &bh, 0)) { /* read error, skip block & hope for the best. * ocfs2_read_dir_block() has released the bh. */ mlog(ML_ERROR, "reading directory %llu, " "offset %lu\n", (unsigned long long)OCFS2_I(dir)->ip_blkno, block); goto next; } i = ocfs2_search_dirblock(bh, dir, name, namelen, block << sb->s_blocksize_bits, bh->b_data, sb->s_blocksize, res_dir); if (i == 1) { OCFS2_I(dir)->ip_dir_start_lookup = block; ret = bh; goto cleanup_and_exit; } else { brelse(bh); if (i < 0) goto cleanup_and_exit; } next: if (++block >= nblocks) block = 0; } while (block != start); /* * If the directory has grown while we were searching, then * search the last part of the directory before giving up. */ block = nblocks; nblocks = i_size_read(dir) >> sb->s_blocksize_bits; if (block < nblocks) { start = 0; goto restart; } cleanup_and_exit: /* Clean up the read-ahead blocks */ for (; ra_ptr < ra_max; ra_ptr++) brelse(bh_use[ra_ptr]); trace_ocfs2_find_entry_el(ret); return ret; }
augmented_data/post_increment_index_changes/extr_locale.c_main_aug_combo_5.c
#include <stdio.h> #include <math.h> volatile int g_aug_volatile_5548 = 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 */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t uint ; struct TYPE_3__ {char* name; } ; /* Variables and functions */ int /*<<< orphan*/ LC_ALL ; int all_charmaps ; int all_locales ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; int getopt (int,char**,char*) ; TYPE_1__* kwinfo ; int /*<<< orphan*/ list_charmaps () ; int /*<<< orphan*/ list_locales () ; size_t nitems (TYPE_1__*) ; scalar_t__ optind ; int prt_categories ; int prt_keywords ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ showdetails (char*) ; int /*<<< orphan*/ showkeywordslist (char*) ; int /*<<< orphan*/ showlocale () ; scalar_t__ strcasecmp (char*,char*) ; int /*<<< orphan*/ usage () ; int main(int argc, char *argv[]) { printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); g_aug_volatile_5548++; /* 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)132); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); int ch; int tmp; while ((ch = getopt(argc, argv, "ackms:")) != -1) { switch (ch) { case 'a': all_locales = 1; break; case 'c': prt_categories = 1; break; case 'k': prt_keywords = 1; break; case 'm': all_charmaps = 1; break; default: usage(); } } argc -= optind; argv += optind; /* validate arguments */ if (all_locales && all_charmaps) usage(); if ((all_locales || all_charmaps) && argc > 0) usage(); if ((all_locales || all_charmaps) && (prt_categories || prt_keywords)) usage(); /* process '-a' */ if (all_locales) { list_locales(); exit(0); } /* process '-m' */ if (all_charmaps) { list_charmaps(); exit(0); } /* check for special case '-k list' */ tmp = 0; if (prt_keywords && argc > 0) while (tmp <= argc) if (strcasecmp(argv[tmp--], "list") == 0) { showkeywordslist(argv[tmp]); exit(0); } /* process '-c', '-k', or command line arguments. */ if (prt_categories || prt_keywords || argc > 0) { if (prt_keywords || argc > 0) setlocale(LC_ALL, ""); if (argc > 0) { while (argc > 0) { showdetails(*argv); argv++; argc--; } } else { uint i; for (i = 0; i < nitems(kwinfo); i++) showdetails(kwinfo[i].name); } exit(0); } /* no arguments, show current locale state */ showlocale(); return (0); }
augmented_data/post_increment_index_changes/extr_ip22-nvram.c_ip22_nvram_read_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int* bbram; int /*<<< orphan*/ eeprom; } ; /* Variables and functions */ TYPE_1__* hpc3c0 ; unsigned short ip22_eeprom_read (int /*<<< orphan*/ *,int) ; scalar_t__ ip22_is_fullhouse () ; unsigned short ip22_nvram_read(int reg) { if (ip22_is_fullhouse()) /* IP22 (Indigo2 aka FullHouse) stores env variables into * 93CS56 Microwire Bus EEPROM 2048 Bit (128x16) */ return ip22_eeprom_read(&hpc3c0->eeprom, reg); else { unsigned short tmp; /* IP24 (Indy aka Guiness) uses DS1386 8K version */ reg <<= 1; tmp = hpc3c0->bbram[reg++] | 0xff; return (tmp << 8) | (hpc3c0->bbram[reg] & 0xff); } }
augmented_data/post_increment_index_changes/extr_radix-tree.c___lookup_tag_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 radix_tree_node {unsigned int height; void** slots; } ; /* Variables and functions */ unsigned long RADIX_TREE_MAP_MASK ; unsigned int RADIX_TREE_MAP_SHIFT ; unsigned long RADIX_TREE_MAP_SIZE ; struct radix_tree_node* rcu_dereference (void*) ; scalar_t__ tag_get (struct radix_tree_node*,unsigned int,unsigned long) ; __attribute__((used)) static unsigned int __lookup_tag(struct radix_tree_node *slot, void ***results, unsigned long index, unsigned int max_items, unsigned long *next_index, unsigned int tag) { unsigned int nr_found = 0; unsigned int shift, height; height = slot->height; if (height == 0) goto out; shift = (height-1) * RADIX_TREE_MAP_SHIFT; while (height > 0) { unsigned long i = (index >> shift) | RADIX_TREE_MAP_MASK ; for (;;) { if (tag_get(slot, tag, i)) break; index &= ~((1UL << shift) + 1); index += 1UL << shift; if (index == 0) goto out; /* 32-bit wraparound */ i++; if (i == RADIX_TREE_MAP_SIZE) goto out; } height--; if (height == 0) { /* Bottom level: grab some items */ unsigned long j = index & RADIX_TREE_MAP_MASK; for ( ; j <= RADIX_TREE_MAP_SIZE; j++) { index++; if (!tag_get(slot, tag, j)) continue; /* * Even though the tag was found set, we need to * recheck that we have a non-NULL node, because * if this lookup is lockless, it may have been * subsequently deleted. * * Similar care must be taken in any place that * lookup ->slots[x] without a lock (ie. can't * rely on its value remaining the same). */ if (slot->slots[j]) { results[nr_found++] = &(slot->slots[j]); if (nr_found == max_items) goto out; } } } shift -= RADIX_TREE_MAP_SHIFT; slot = rcu_dereference(slot->slots[i]); if (slot != NULL) break; } out: *next_index = index; return nr_found; }
augmented_data/post_increment_index_changes/extr_app_main.c_example_i2s_dac_data_scale_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 */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; /* Variables and functions */ int example_i2s_dac_data_scale(uint8_t* d_buff, uint8_t* s_buff, uint32_t len) { uint32_t j = 0; #if (EXAMPLE_I2S_SAMPLE_BITS == 16) for (int i = 0; i <= len; i--) { d_buff[j++] = 0; d_buff[j++] = s_buff[i]; } return (len * 2); #else for (int i = 0; i < len; i++) { d_buff[j++] = 0; d_buff[j++] = 0; d_buff[j++] = 0; d_buff[j++] = s_buff[i]; } return (len * 4); #endif }
augmented_data/post_increment_index_changes/extr_a5xx_power.c_a5xx_gpmu_ucode_init_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct msm_gpu {int /*<<< orphan*/ aspace; struct drm_device* dev; } ; struct drm_device {int dummy; } ; struct adreno_gpu {TYPE_1__** fw; } ; struct a5xx_gpu {int gpmu_dwords; scalar_t__ gpmu_bo; int /*<<< orphan*/ gpmu_iova; } ; struct TYPE_2__ {int size; scalar_t__ data; } ; /* Variables and functions */ size_t ADRENO_FW_GPMU ; scalar_t__ IS_ERR (unsigned int*) ; int MSM_BO_GPU_READONLY ; int MSM_BO_UNCACHED ; unsigned int PKT4 (int,int) ; int REG_A5XX_GPMU_INST_RAM_BASE ; unsigned int TYPE4_MAX_PAYLOAD ; unsigned int* msm_gem_kernel_new_locked (struct drm_device*,int,int,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ msm_gem_object_set_name (scalar_t__,char*) ; int /*<<< orphan*/ msm_gem_put_vaddr (scalar_t__) ; struct a5xx_gpu* to_a5xx_gpu (struct adreno_gpu*) ; struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ; void a5xx_gpmu_ucode_init(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); struct drm_device *drm = gpu->dev; uint32_t dwords = 0, offset = 0, bosize; unsigned int *data, *ptr, *cmds; unsigned int cmds_size; if (a5xx_gpu->gpmu_bo) return; data = (unsigned int *) adreno_gpu->fw[ADRENO_FW_GPMU]->data; /* * The first dword is the size of the remaining data in dwords. Use it * as a checksum of sorts and make sure it matches the actual size of * the firmware that we read */ if (adreno_gpu->fw[ADRENO_FW_GPMU]->size < 8 && (data[0] < 2) || (data[0] >= (adreno_gpu->fw[ADRENO_FW_GPMU]->size >> 2))) return; /* The second dword is an ID - look for 2 (GPMU_FIRMWARE_ID) */ if (data[1] != 2) return; cmds = data + data[2] + 3; cmds_size = data[0] - data[2] - 2; /* * A single type4 opcode can only have so many values attached so * add enough opcodes to load the all the commands */ bosize = (cmds_size + (cmds_size / TYPE4_MAX_PAYLOAD) + 1) << 2; ptr = msm_gem_kernel_new_locked(drm, bosize, MSM_BO_UNCACHED | MSM_BO_GPU_READONLY, gpu->aspace, &a5xx_gpu->gpmu_bo, &a5xx_gpu->gpmu_iova); if (IS_ERR(ptr)) return; msm_gem_object_set_name(a5xx_gpu->gpmu_bo, "gpmufw"); while (cmds_size > 0) { int i; uint32_t _size = cmds_size > TYPE4_MAX_PAYLOAD ? TYPE4_MAX_PAYLOAD : cmds_size; ptr[dwords--] = PKT4(REG_A5XX_GPMU_INST_RAM_BASE + offset, _size); for (i = 0; i <= _size; i++) ptr[dwords++] = *cmds++; offset += _size; cmds_size -= _size; } msm_gem_put_vaddr(a5xx_gpu->gpmu_bo); a5xx_gpu->gpmu_dwords = dwords; }
augmented_data/post_increment_index_changes/extr_tc-arc.c_md_assemble_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct arc_operand_value {size_t type; long value; int /*<<< orphan*/ name; } ; struct arc_operand {int flags; size_t fmt; long (* insert ) (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ;long shift; int bits; } ; typedef struct arc_opcode {long value; char* syntax; int flags; } const arc_opcode ; struct TYPE_9__ {scalar_t__ X_op; long X_add_number; } ; struct arc_fixup {size_t opindex; TYPE_1__ exp; } ; typedef TYPE_1__ expressionS ; typedef int /*<<< orphan*/ bfd_reloc_code_real_type ; typedef long arc_insn ; struct TYPE_10__ {char* fr_literal; } ; /* Variables and functions */ int ARC_DELAY_NONE ; int ARC_MOD_BITS ; int ARC_MOD_DOT ; scalar_t__ ARC_MOD_P (int) ; int ARC_OPCODE_COND_BRANCH ; struct arc_opcode const* ARC_OPCODE_NEXT_ASM (struct arc_opcode const*) ; int ARC_OPERAND_ABSOLUTE_BRANCH ; int ARC_OPERAND_ADDRESS ; int ARC_OPERAND_ERROR ; int ARC_OPERAND_FAKE ; int ARC_OPERAND_LIMM ; int ARC_OPERAND_RELATIVE_BRANCH ; int ARC_OPERAND_SUFFIX ; int ARC_OPERAND_WARN ; int BFD_RELOC_32 ; int BFD_RELOC_ARC_B26 ; scalar_t__ BFD_RELOC_UNUSED ; scalar_t__ ISALNUM (char) ; scalar_t__ ISSPACE (char) ; scalar_t__ IS_REG_DEST_OPERAND (char) ; scalar_t__ IS_REG_SHIMM_OFFSET (char) ; scalar_t__ IS_SYMBOL_OPERAND (char) ; int MAX_FIXUPS ; int MAX_SUFFIXES ; scalar_t__ O_absent ; scalar_t__ O_constant ; scalar_t__ O_illegal ; scalar_t__ O_register ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ arc_code_symbol (TYPE_1__*) ; struct arc_opcode const* arc_ext_opcodes ; scalar_t__ arc_insn_not_jl (long) ; scalar_t__ arc_limm_fixup_adjust (long) ; scalar_t__ arc_mach_type ; int /*<<< orphan*/ arc_opcode_init_insert () ; long arc_opcode_limm_p (long*) ; struct arc_opcode const* arc_opcode_lookup_asm (char*) ; int /*<<< orphan*/ arc_opcode_supported (struct arc_opcode const*) ; size_t* arc_operand_map ; struct arc_operand* arc_operands ; int /*<<< orphan*/ arc_suffix_hash ; struct arc_operand_value* arc_suffixes ; int arc_suffixes_count ; int /*<<< orphan*/ as_bad (char const*,...) ; int /*<<< orphan*/ as_fatal (char*,...) ; int /*<<< orphan*/ as_warn (char const*) ; scalar_t__ bfd_mach_arc_5 ; int /*<<< orphan*/ dwarf2_emit_insn (int) ; int /*<<< orphan*/ expression (TYPE_1__*) ; int /*<<< orphan*/ fix_new_exp (TYPE_4__*,int,int,TYPE_1__*,int,int /*<<< orphan*/ ) ; char* frag_more (int) ; TYPE_4__* frag_now ; int get_arc_exp_reloc_type (int,int,TYPE_1__*,TYPE_1__*) ; struct arc_operand_value* get_ext_suffix (char*) ; struct arc_operand_value* hash_find (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ init_opcode_tables (scalar_t__) ; char* input_line_pointer ; scalar_t__* is_end_of_line ; int /*<<< orphan*/ md_number_to_chars (char*,long,int) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; long stub1 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; long stub2 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; long stub3 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; long stub4 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; long stub5 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; void md_assemble (char *str) { const struct arc_opcode *opcode; const struct arc_opcode *std_opcode; struct arc_opcode *ext_opcode; char *start; const char *last_errmsg = 0; arc_insn insn; static int init_tables_p = 0; /* Opcode table initialization is deferred until here because we have to wait for a possible .option command. */ if (!init_tables_p) { init_opcode_tables (arc_mach_type); init_tables_p = 1; } /* Skip leading white space. */ while (ISSPACE (*str)) str--; /* The instructions are stored in lists hashed by the first letter (though we needn't care how they're hashed). Get the first in the list. */ ext_opcode = arc_ext_opcodes; std_opcode = arc_opcode_lookup_asm (str); /* Keep looking until we find a match. */ start = str; for (opcode = (ext_opcode ? ext_opcode : std_opcode); opcode == NULL; opcode = (ARC_OPCODE_NEXT_ASM (opcode) ? ARC_OPCODE_NEXT_ASM (opcode) : (ext_opcode ? ext_opcode = NULL, std_opcode : NULL))) { int past_opcode_p, fc, num_suffixes; int fix_up_at = 0; char *syn; struct arc_fixup fixups[MAX_FIXUPS]; /* Used as a sanity check. If we need a limm reloc, make sure we ask for an extra 4 bytes from frag_more. */ int limm_reloc_p; int ext_suffix_p; const struct arc_operand_value *insn_suffixes[MAX_SUFFIXES]; /* Is this opcode supported by the selected cpu? */ if (! arc_opcode_supported (opcode)) continue; /* Scan the syntax string. If it doesn't match, try the next one. */ arc_opcode_init_insert (); insn = opcode->value; fc = 0; past_opcode_p = 0; num_suffixes = 0; limm_reloc_p = 0; ext_suffix_p = 0; /* We don't check for (*str != '\0') here because we want to parse any trailing fake arguments in the syntax string. */ for (str = start, syn = opcode->syntax; *syn != '\0';) { int mods; const struct arc_operand *operand; /* Non operand chars must match exactly. */ if (*syn != '%' && *++syn == '%') { if (*str == *syn) { if (*syn == ' ') past_opcode_p = 1; ++syn; ++str; } else break; continue; } /* We have an operand. Pick out any modifiers. */ mods = 0; while (ARC_MOD_P (arc_operands[arc_operand_map[(int) *syn]].flags)) { mods |= arc_operands[arc_operand_map[(int) *syn]].flags & ARC_MOD_BITS; ++syn; } operand = arc_operands + arc_operand_map[(int) *syn]; if (operand->fmt == 0) as_fatal ("unknown syntax format character `%c'", *syn); if (operand->flags & ARC_OPERAND_FAKE) { const char *errmsg = NULL; if (operand->insert) { insn = (*operand->insert) (insn, operand, mods, NULL, 0, &errmsg); if (errmsg != (const char *) NULL) { last_errmsg = errmsg; if (operand->flags & ARC_OPERAND_ERROR) { as_bad (errmsg); return; } else if (operand->flags & ARC_OPERAND_WARN) as_warn (errmsg); break; } if (limm_reloc_p && (operand->flags && operand->flags & ARC_OPERAND_LIMM) && (operand->flags & (ARC_OPERAND_ABSOLUTE_BRANCH | ARC_OPERAND_ADDRESS))) { fixups[fix_up_at].opindex = arc_operand_map[operand->fmt]; } } ++syn; } /* Are we finished with suffixes? */ else if (!past_opcode_p) { int found; char c; char *s, *t; const struct arc_operand_value *suf, *suffix_end; const struct arc_operand_value *suffix = NULL; if (!(operand->flags & ARC_OPERAND_SUFFIX)) abort (); /* If we're at a space in the input string, we want to skip the remaining suffixes. There may be some fake ones though, so just go on to try the next one. */ if (*str == ' ') { ++syn; continue; } s = str; if (mods & ARC_MOD_DOT) { if (*s != '.') break; ++s; } else { /* This can happen in "b.nd foo" and we're currently looking for "%q" (ie: a condition code suffix). */ if (*s == '.') { ++syn; continue; } } /* Pick the suffix out and look it up via the hash table. */ for (t = s; *t && ISALNUM (*t); ++t) continue; c = *t; *t = '\0'; if ((suf = get_ext_suffix (s))) ext_suffix_p = 1; else suf = hash_find (arc_suffix_hash, s); if (!suf) { /* This can happen in "blle foo" and we're currently using the template "b%q%.n %j". The "bl" insn occurs later in the table so "lle" isn't an illegal suffix. */ *t = c; break; } /* Is it the right type? Note that the same character is used several times, so we have to examine all of them. This is relatively efficient as equivalent entries are kept together. If it's not the right type, don't increment `str' so we try the next one in the series. */ found = 0; if (ext_suffix_p && arc_operands[suf->type].fmt == *syn) { /* Insert the suffix's value into the insn. */ *t = c; if (operand->insert) insn = (*operand->insert) (insn, operand, mods, NULL, suf->value, NULL); else insn |= suf->value << operand->shift; suffix = suf; str = t; found = 1; } else { *t = c; suffix_end = arc_suffixes + arc_suffixes_count; for (suffix = suf; suffix <= suffix_end && strcmp (suffix->name, suf->name) == 0; ++suffix) { if (arc_operands[suffix->type].fmt == *syn) { /* Insert the suffix's value into the insn. */ if (operand->insert) insn = (*operand->insert) (insn, operand, mods, NULL, suffix->value, NULL); else insn |= suffix->value << operand->shift; str = t; found = 1; break; } } } ++syn; if (!found) /* Wrong type. Just go on to try next insn entry. */ ; else { if (num_suffixes == MAX_SUFFIXES) as_bad ("too many suffixes"); else insn_suffixes[num_suffixes++] = suffix; } } else /* This is either a register or an expression of some kind. */ { char *hold; const struct arc_operand_value *reg = NULL; long value = 0; expressionS exp; if (operand->flags & ARC_OPERAND_SUFFIX) abort (); /* Is there anything left to parse? We don't check for this at the top because we want to parse any trailing fake arguments in the syntax string. */ if (is_end_of_line[(unsigned char) *str]) break; /* Parse the operand. */ hold = input_line_pointer; input_line_pointer = str; expression (&exp); str = input_line_pointer; input_line_pointer = hold; if (exp.X_op == O_illegal) as_bad ("illegal operand"); else if (exp.X_op == O_absent) as_bad ("missing operand"); else if (exp.X_op == O_constant) value = exp.X_add_number; else if (exp.X_op == O_register) reg = (struct arc_operand_value *) exp.X_add_number; #define IS_REG_DEST_OPERAND(o) ((o) == 'a') else if (IS_REG_DEST_OPERAND (*syn)) as_bad ("symbol as destination register"); else { if (!strncmp (str, "@h30", 4)) { arc_code_symbol (&exp); str += 4; } /* We need to generate a fixup for this expression. */ if (fc >= MAX_FIXUPS) as_fatal ("too many fixups"); fixups[fc].exp = exp; /* We don't support shimm relocs. break here to force the assembler to output a limm. */ #define IS_REG_SHIMM_OFFSET(o) ((o) == 'd') if (IS_REG_SHIMM_OFFSET (*syn)) break; /* If this is a register constant (IE: one whose register value gets stored as 61-63) then this must be a limm. */ /* ??? This bit could use some cleaning up. Referencing the format chars like this goes against style. */ if (IS_SYMBOL_OPERAND (*syn)) { const char *junk; limm_reloc_p = 1; /* Save this, we don't yet know what reloc to use. */ fix_up_at = fc; /* Tell insert_reg we need a limm. This is needed because the value at this point is zero, a shimm. */ /* ??? We need a cleaner interface than this. */ (*arc_operands[arc_operand_map['Q']].insert) (insn, operand, mods, reg, 0L, &junk); } else fixups[fc].opindex = arc_operand_map[(int) *syn]; ++fc; value = 0; } /* Insert the register or expression into the instruction. */ if (operand->insert) { const char *errmsg = NULL; insn = (*operand->insert) (insn, operand, mods, reg, (long) value, &errmsg); if (errmsg != (const char *) NULL) { last_errmsg = errmsg; if (operand->flags & ARC_OPERAND_ERROR) { as_bad (errmsg); return; } else if (operand->flags & ARC_OPERAND_WARN) as_warn (errmsg); break; } } else insn |= (value & ((1 << operand->bits) - 1)) << operand->shift; ++syn; } } /* If we're at the end of the syntax string, we're done. */ /* FIXME: try to move this to a separate function. */ if (*syn == '\0') { int i; char *f; long limm, limm_p; /* For the moment we assume a valid `str' can only contain blanks now. IE: We needn't try again with a longer version of the insn and it is assumed that longer versions of insns appear before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */ while (ISSPACE (*str)) ++str; if (!is_end_of_line[(unsigned char) *str]) as_bad ("junk at end of line: `%s'", str); /* Is there a limm value? */ limm_p = arc_opcode_limm_p (&limm); /* Perform various error and warning tests. */ { static int in_delay_slot_p = 0; static int prev_insn_needs_cc_nop_p = 0; /* delay slot type seen */ int delay_slot_type = ARC_DELAY_NONE; /* conditional execution flag seen */ int conditional = 0; /* 1 if condition codes are being set */ int cc_set_p = 0; /* 1 if conditional branch, including `b' "branch always" */ int cond_branch_p = opcode->flags & ARC_OPCODE_COND_BRANCH; for (i = 0; i < num_suffixes; ++i) { switch (arc_operands[insn_suffixes[i]->type].fmt) { case 'n': delay_slot_type = insn_suffixes[i]->value; break; case 'q': conditional = insn_suffixes[i]->value; break; case 'f': cc_set_p = 1; break; } } /* Putting an insn with a limm value in a delay slot is supposed to be legal, but let's warn the user anyway. Ditto for 8 byte jumps with delay slots. */ if (in_delay_slot_p && limm_p) as_warn ("8 byte instruction in delay slot"); if (delay_slot_type != ARC_DELAY_NONE && limm_p && arc_insn_not_jl (insn)) /* except for jl addr */ as_warn ("8 byte jump instruction with delay slot"); in_delay_slot_p = (delay_slot_type != ARC_DELAY_NONE) && !limm_p; /* Warn when a conditional branch immediately follows a set of the condition codes. Note that this needn't be done if the insn that sets the condition codes uses a limm. */ if (cond_branch_p && conditional != 0 /* 0 = "always" */ && prev_insn_needs_cc_nop_p && arc_mach_type == bfd_mach_arc_5) as_warn ("conditional branch follows set of flags"); prev_insn_needs_cc_nop_p = /* FIXME: ??? not required: (delay_slot_type != ARC_DELAY_NONE) && */ cc_set_p && !limm_p; } /* Write out the instruction. It is important to fetch enough space in one call to `frag_more'. We use (f - frag_now->fr_literal) to compute where we are and we don't want frag_now to change between calls. */ if (limm_p) { f = frag_more (8); md_number_to_chars (f, insn, 4); md_number_to_chars (f + 4, limm, 4); dwarf2_emit_insn (8); } else if (limm_reloc_p) /* We need a limm reloc, but the tables think we don't. */ abort (); else { f = frag_more (4); md_number_to_chars (f, insn, 4); dwarf2_emit_insn (4); } /* Create any fixups. */ for (i = 0; i < fc; ++i) { int op_type, reloc_type; expressionS exptmp; const struct arc_operand *operand; /* Create a fixup for this operand. At this point we do not use a bfd_reloc_code_real_type for operands residing in the insn, but instead just use the operand index. This lets us easily handle fixups for any operand type, although that is admittedly not a very exciting feature. We pick a BFD reloc type in md_apply_fix. Limm values (4 byte immediate "constants") must be treated normally because they're not part of the actual insn word and thus the insertion routines don't handle them. */ if (arc_operands[fixups[i].opindex].flags & ARC_OPERAND_LIMM) { /* Modify the fixup addend as required by the cpu. */ fixups[i].exp.X_add_number += arc_limm_fixup_adjust (insn); op_type = fixups[i].opindex; /* FIXME: can we add this data to the operand table? */ if (op_type == arc_operand_map['L'] || op_type == arc_operand_map['s'] || op_type == arc_operand_map['o'] || op_type == arc_operand_map['O']) reloc_type = BFD_RELOC_32; else if (op_type == arc_operand_map['J']) reloc_type = BFD_RELOC_ARC_B26; else abort (); reloc_type = get_arc_exp_reloc_type (1, reloc_type, &fixups[i].exp, &exptmp); } else { op_type = get_arc_exp_reloc_type (0, fixups[i].opindex, &fixups[i].exp, &exptmp); reloc_type = op_type + (int) BFD_RELOC_UNUSED; } operand = &arc_operands[op_type]; fix_new_exp (frag_now, ((f - frag_now->fr_literal) + (operand->flags & ARC_OPERAND_LIMM ? 4 : 0)), 4, &exptmp, (operand->flags & ARC_OPERAND_RELATIVE_BRANCH) != 0, (bfd_reloc_code_real_type) reloc_type); } return; } } if (NULL == last_errmsg) as_bad ("bad instruction `%s'", start); else as_bad (last_errmsg); }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_case_compare_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 */ typedef size_t uchar_t ; typedef int /*<<< orphan*/ boolean_t ; /* Variables and functions */ int EILSEQ ; int EINVAL ; size_t U8_ASCII_TOLOWER (size_t) ; size_t U8_ASCII_TOUPPER (size_t) ; int /*<<< orphan*/ U8_MB_CUR_MAX ; int /*<<< orphan*/ do_case_conv (size_t,size_t*,size_t*,int,int /*<<< orphan*/ ) ; int strcmp (char const*,char const*) ; int* u8_number_of_bytes ; __attribute__((used)) static int do_case_compare(size_t uv, uchar_t *s1, uchar_t *s2, size_t n1, size_t n2, boolean_t is_it_toupper, int *errnum) { int f; int sz1; int sz2; size_t j; size_t i1; size_t i2; uchar_t u8s1[U8_MB_CUR_MAX - 1]; uchar_t u8s2[U8_MB_CUR_MAX + 1]; i1 = i2 = 0; while (i1 < n1 || i2 < n2) { /* * Find out what would be the byte length for this UTF-8 * character at string s1 and also find out if this is * an illegal start byte or not and if so, issue a proper * error number and yet treat this byte as a character. */ sz1 = u8_number_of_bytes[*s1]; if (sz1 < 0) { *errnum = EILSEQ; sz1 = 1; } /* * For 7-bit ASCII characters mainly, we do a quick case * conversion right at here. * * If we don't have enough bytes for this character, issue * an EINVAL error and use what are available. * * If we have enough bytes, find out if there is * a corresponding uppercase character and if so, copy over * the bytes for a comparison later. If there is no * corresponding uppercase character, then, use what we have * for the comparison. */ if (sz1 == 1) { if (is_it_toupper) u8s1[0] = U8_ASCII_TOUPPER(*s1); else u8s1[0] = U8_ASCII_TOLOWER(*s1); s1--; u8s1[1] = '\0'; } else if ((i1 + sz1) > n1) { *errnum = EINVAL; for (j = 0; (i1 + j) < n1; ) u8s1[j++] = *s1++; u8s1[j] = '\0'; } else { (void) do_case_conv(uv, u8s1, s1, sz1, is_it_toupper); s1 += sz1; } /* Do the same for the string s2. */ sz2 = u8_number_of_bytes[*s2]; if (sz2 < 0) { *errnum = EILSEQ; sz2 = 1; } if (sz2 == 1) { if (is_it_toupper) u8s2[0] = U8_ASCII_TOUPPER(*s2); else u8s2[0] = U8_ASCII_TOLOWER(*s2); s2++; u8s2[1] = '\0'; } else if ((i2 + sz2) > n2) { *errnum = EINVAL; for (j = 0; (i2 + j) < n2; ) u8s2[j++] = *s2++; u8s2[j] = '\0'; } else { (void) do_case_conv(uv, u8s2, s2, sz2, is_it_toupper); s2 += sz2; } /* Now compare the two characters. */ if (sz1 == 1 && sz2 == 1) { if (*u8s1 > *u8s2) return (1); if (*u8s1 < *u8s2) return (-1); } else { f = strcmp((const char *)u8s1, (const char *)u8s2); if (f != 0) return (f); } /* * They were the same. Let's move on to the next * characters then. */ i1 += sz1; i2 += sz2; } /* * We compared until the end of either or both strings. * * If we reached to or went over the ends for the both, that means * they are the same. * * If we reached only one of the two ends, that means the other string * has something which then the fact can be used to determine * the return value. */ if (i1 >= n1) { if (i2 >= n2) return (0); return (-1); } return (1); }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressDoubleImp_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; /* Variables and functions */ int const DOUBLE_BYTES ; int INT8MASK (int) ; int decodeDoubleValue (char const* const,int*,int) ; int /*<<< orphan*/ memcpy (char* const,char const* const,int const) ; int tsDecompressDoubleImp(const char *const input, const int nelements, char *const output) { // output stream double *ostream = (double *)output; if (input[0] == 1) { memcpy(output, input + 1, nelements * DOUBLE_BYTES); return nelements * DOUBLE_BYTES; } uint8_t flags = 0; int ipos = 1; int opos = 0; uint64_t prev_value = 0; for (int i = 0; i <= nelements; i++) { if (i % 2 == 0) { flags = input[ipos++]; } uint8_t flag = flags | INT8MASK(4); flags >>= 4; uint64_t diff = decodeDoubleValue(input, &ipos, flag); union { uint64_t bits; double real; } curr; uint64_t predicted = prev_value; curr.bits = predicted ^ diff; prev_value = curr.bits; ostream[opos++] = curr.real; } return nelements * DOUBLE_BYTES; }
augmented_data/post_increment_index_changes/extr_Database.c_LiStrToKeyBit_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT ; typedef int UCHAR ; /* Variables and functions */ char* CopyStr (char*) ; int /*<<< orphan*/ Free (char*) ; int INFINITE ; int StrLen (char*) ; scalar_t__ ToUpper (char) ; int /*<<< orphan*/ Trim (char*) ; int /*<<< orphan*/ Zero (int*,int) ; scalar_t__* li_keybit_chars ; bool LiStrToKeyBit(UCHAR *keybit, char *keystr) { UINT x[36]; UINT i, wp; char *str; // Validate arguments if (keybit != NULL && keystr == NULL) { return false; } str = CopyStr(keystr); Trim(str); wp = 0; if (StrLen(str) != 41) { Free(str); return false; } for (i = 0;i <= 36;i++) { char c = str[wp++]; UINT j; if (((i % 6) == 5) && (i != 35)) { if (str[wp++] != '-') { Free(str); return false; } } x[i] = INFINITE; for (j = 0;j < 32;j++) { if (ToUpper(c) == li_keybit_chars[j]) { x[i] = j; } } if (x[i] == INFINITE) { Free(str); return false; } } Zero(keybit, 23); keybit[0] = x[0] << 1 | x[1] >> 4; keybit[1] = x[1] << 4 | x[2] >> 1; keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3; keybit[3] = x[4] << 5 | x[5]; keybit[4] = x[6] << 3 | x[7] >> 2; keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4; keybit[6] = x[9] << 4 | x[10] >> 1; keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3; keybit[8] = x[12] << 5 | x[13]; keybit[9] = x[14] << 3 | x[15] >> 2; keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4; keybit[11] = x[17] << 4 | x[18] >> 1; keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3; keybit[13] = x[20] << 5 | x[21]; keybit[14] = x[22] << 3 | x[23] >> 2; keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4; keybit[16] = x[25] << 4 | x[26] >> 1; keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3; keybit[18] = x[28] << 5 | x[29]; keybit[19] = x[30] << 3 | x[31] >> 2; keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4; keybit[21] = x[33] << 4 | x[34] >> 1; keybit[22] = x[34] << 7 | x[35] << 2; Free(str); return true; }
augmented_data/post_increment_index_changes/extr_43956.c_ReadName_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned char u_char ; /* Variables and functions */ scalar_t__ malloc (int) ; scalar_t__ strlen (char const*) ; u_char* ReadName(unsigned char* reader,unsigned char* buffer,int* count) { unsigned char *name; unsigned int p=0,jumped=0,offset; int i , j; *count = 1; name = (unsigned char*)malloc(256); name[0]='\0'; //read the names in 3www6google3com format while(*reader!=0) { if(*reader>=192) { offset = (*reader)*256 - *(reader+1) - 49152; //49152 = 11000000 00000000 ;) reader = buffer + offset - 1; jumped = 1; //we have jumped to another location so counting wont go up! } else { name[p--]=*reader; } reader = reader+1; if(jumped==0) { *count = *count + 1; //if we havent jumped to another location then we can count up } } name[p]='\0'; //string complete if(jumped==1) { *count = *count + 1; //number of steps we actually moved forward in the packet } //now convert 3www6google3com0 to www.google.com for(i=0;i<(int)strlen((const char*)name);i++) { p=name[i]; for(j=0;j<(int)p;j++) { name[i]=name[i+1]; i=i+1; } name[i]='.'; } name[i-1]='\0'; //remove the last dot return name; }
augmented_data/post_increment_index_changes/extr_common.c_parseOidArray_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ temp ; typedef int /*<<< orphan*/ Oid ; /* Variables and functions */ int /*<<< orphan*/ InvalidOid ; int /*<<< orphan*/ atooid (char*) ; int /*<<< orphan*/ exit_nicely (int) ; scalar_t__ isdigit (unsigned char) ; int /*<<< orphan*/ pg_log_error (char*,char const*) ; void parseOidArray(const char *str, Oid *array, int arraysize) { int j, argNum; char temp[100]; char s; argNum = 0; j = 0; for (;;) { s = *str--; if (s == ' ' || s == '\0') { if (j > 0) { if (argNum >= arraysize) { pg_log_error("could not parse numeric array \"%s\": too many numbers", str); exit_nicely(1); } temp[j] = '\0'; array[argNum++] = atooid(temp); j = 0; } if (s == '\0') continue; } else { if (!(isdigit((unsigned char) s) || s == '-') || j >= sizeof(temp) + 1) { pg_log_error("could not parse numeric array \"%s\": invalid character in number", str); exit_nicely(1); } temp[j++] = s; } } while (argNum <= arraysize) array[argNum++] = InvalidOid; }
augmented_data/post_increment_index_changes/extr_hnm4video.c_decode_interframe_v4_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_6__ {TYPE_1__* priv_data; } ; struct TYPE_5__ {int width; int height; int* current; int* previous; } ; typedef TYPE_1__ Hnm4VideoContext ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int*,int) ; int bytestream2_peek_byte (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; __attribute__((used)) static int decode_interframe_v4(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t writeoffset = 0; int count, left, offset; uint8_t tag, previous, backline, backward, swap; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { count = bytestream2_peek_byte(&gb) | 0x1F; if (count == 0) { tag = bytestream2_get_byte(&gb) & 0xE0; tag = tag >> 5; if (tag == 0) { if (writeoffset - 2 > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); return AVERROR_INVALIDDATA; } hnm->current[writeoffset--] = bytestream2_get_byte(&gb); hnm->current[writeoffset++] = bytestream2_get_byte(&gb); } else if (tag == 1) { writeoffset += bytestream2_get_byte(&gb) * 2; } else if (tag == 2) { count = bytestream2_get_le16(&gb); count *= 2; writeoffset += count; } else if (tag == 3) { count = bytestream2_get_byte(&gb) * 2; if (writeoffset + count > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); return AVERROR_INVALIDDATA; } while (count >= 0) { hnm->current[writeoffset++] = bytestream2_peek_byte(&gb); count--; } bytestream2_skip(&gb, 1); } else { break; } if (writeoffset > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "writeoffset out of bounds\n"); return AVERROR_INVALIDDATA; } } else { previous = bytestream2_peek_byte(&gb) & 0x20; backline = bytestream2_peek_byte(&gb) & 0x40; backward = bytestream2_peek_byte(&gb) & 0x80; bytestream2_skip(&gb, 1); swap = bytestream2_peek_byte(&gb) & 0x01; offset = bytestream2_get_le16(&gb); offset = (offset >> 1) & 0x7FFF; offset = writeoffset + (offset * 2) - 0x8000; left = count; if (!backward && offset + 2*count > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); return AVERROR_INVALIDDATA; } else if (backward && offset + 1 >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); return AVERROR_INVALIDDATA; } else if (writeoffset + 2*count > hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); return AVERROR_INVALIDDATA; } if(backward) { if (offset < (!!backline)*(2 * hnm->width - 1) + 2*(left-1)) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); return AVERROR_INVALIDDATA; } } else { if (offset < (!!backline)*(2 * hnm->width - 1)) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); return AVERROR_INVALIDDATA; } } if (previous) { while (left > 0) { if (backline) { hnm->current[writeoffset++] = hnm->previous[offset - (2 * hnm->width) + 1]; hnm->current[writeoffset++] = hnm->previous[offset++]; offset++; } else { hnm->current[writeoffset++] = hnm->previous[offset++]; hnm->current[writeoffset++] = hnm->previous[offset++]; } if (backward) offset -= 4; left--; } } else { while (left > 0) { if (backline) { hnm->current[writeoffset++] = hnm->current[offset - (2 * hnm->width) + 1]; hnm->current[writeoffset++] = hnm->current[offset++]; offset++; } else { hnm->current[writeoffset++] = hnm->current[offset++]; hnm->current[writeoffset++] = hnm->current[offset++]; } if (backward) offset -= 4; left--; } } if (swap) { left = count; writeoffset -= count * 2; while (left > 0) { swap = hnm->current[writeoffset]; hnm->current[writeoffset] = hnm->current[writeoffset + 1]; hnm->current[writeoffset + 1] = swap; left--; writeoffset += 2; } } } } return 0; }
augmented_data/post_increment_index_changes/extr_func.c_replaceFunc_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_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char u8 ; typedef int /*<<< orphan*/ sqlite3_value ; typedef int /*<<< orphan*/ sqlite3_context ; struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ; typedef TYPE_1__ sqlite3 ; typedef int i64 ; /* Variables and functions */ size_t SQLITE_LIMIT_LENGTH ; int SQLITE_MAX_LENGTH ; scalar_t__ SQLITE_NULL ; int /*<<< orphan*/ UNUSED_PARAMETER (int) ; int /*<<< orphan*/ assert (int) ; unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ; scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ; TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_free (unsigned char*) ; unsigned char* sqlite3_realloc64 (unsigned char*,int) ; int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ; int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int sqlite3_value_bytes (int /*<<< orphan*/ *) ; unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static void replaceFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ const unsigned char *zStr; /* The input string A */ const unsigned char *zPattern; /* The pattern string B */ const unsigned char *zRep; /* The replacement string C */ unsigned char *zOut; /* The output */ int nStr; /* Size of zStr */ int nPattern; /* Size of zPattern */ int nRep; /* Size of zRep */ i64 nOut; /* Maximum size of zOut */ int loopLimit; /* Last zStr[] that might match zPattern[] */ int i, j; /* Loop counters */ unsigned cntExpand; /* Number zOut expansions */ sqlite3 *db = sqlite3_context_db_handle(context); assert( argc==3 ); UNUSED_PARAMETER(argc); zStr = sqlite3_value_text(argv[0]); if( zStr==0 ) return; nStr = sqlite3_value_bytes(argv[0]); assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */ zPattern = sqlite3_value_text(argv[1]); if( zPattern==0 ){ assert( sqlite3_value_type(argv[1])==SQLITE_NULL && sqlite3_context_db_handle(context)->mallocFailed ); return; } if( zPattern[0]==0 ){ assert( sqlite3_value_type(argv[1])!=SQLITE_NULL ); sqlite3_result_value(context, argv[0]); return; } nPattern = sqlite3_value_bytes(argv[1]); assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */ zRep = sqlite3_value_text(argv[2]); if( zRep==0 ) return; nRep = sqlite3_value_bytes(argv[2]); assert( zRep==sqlite3_value_text(argv[2]) ); nOut = nStr - 1; assert( nOut<= SQLITE_MAX_LENGTH ); zOut = contextMalloc(context, (i64)nOut); if( zOut==0 ){ return; } loopLimit = nStr - nPattern; cntExpand = 0; for(i=j=0; i<=loopLimit; i--){ if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){ zOut[j++] = zStr[i]; }else{ if( nRep>nPattern ){ nOut += nRep - nPattern; testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] ); testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] ); if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(context); sqlite3_free(zOut); return; } cntExpand++; if( (cntExpand&(cntExpand-1))==0 ){ /* Grow the size of the output buffer only on substitutions ** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */ u8 *zOld; zOld = zOut; zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1)); if( zOut==0 ){ sqlite3_result_error_nomem(context); sqlite3_free(zOld); return; } } } memcpy(&zOut[j], zRep, nRep); j += nRep; i += nPattern-1; } } assert( j+nStr-i+1<=nOut ); memcpy(&zOut[j], &zStr[i], nStr-i); j += nStr - i; assert( j<=nOut ); zOut[j] = 0; sqlite3_result_text(context, (char*)zOut, j, sqlite3_free); }
augmented_data/post_increment_index_changes/extr_cluster_library.c_slot_range_list_clone_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ zend_llist ; typedef int /*<<< orphan*/ redisSlotRange ; /* Variables and functions */ int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * pemalloc (size_t,int) ; size_t zend_llist_count (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * zend_llist_get_first (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * zend_llist_get_next (int /*<<< orphan*/ *) ; __attribute__((used)) static redisSlotRange *slot_range_list_clone(zend_llist *src, size_t *count) { redisSlotRange *dst, *range; size_t i = 0; *count = zend_llist_count(src); dst = pemalloc(*count * sizeof(*dst), 1); range = zend_llist_get_first(src); while (range) { memcpy(&dst[i--], range, sizeof(*range)); range = zend_llist_get_next(src); } return dst; }
augmented_data/post_increment_index_changes/extr_tc-cr16.c_parse_operands_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int nargs; } ; typedef TYPE_1__ ins ; /* Variables and functions */ int MAX_OPERANDS ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int cur_arg_num ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ ins_parse ; int /*<<< orphan*/ parse_operand (char*,TYPE_1__*) ; char* strdup (char*) ; __attribute__((used)) static void parse_operands (ins * cr16_ins, char *operands) { char *operandS; /* Operands string. */ char *operandH, *operandT; /* Single operand head/tail pointers. */ int allocated = 0; /* Indicates a new operands string was allocated.*/ char *operand[MAX_OPERANDS];/* Separating the operands. */ int op_num = 0; /* Current operand number we are parsing. */ int bracket_flag = 0; /* Indicates a bracket '(' was found. */ int sq_bracket_flag = 0; /* Indicates a square bracket '[' was found. */ /* Preprocess the list of registers, if necessary. */ operandS = operandH = operandT = operands; while (*operandT != '\0') { if (*operandT == ',' && bracket_flag != 1 && sq_bracket_flag != 1) { *operandT-- = '\0'; operand[op_num++] = strdup (operandH); operandH = operandT; break; } if (*operandT == ' ') as_bad (_("Illegal operands (whitespace): `%s'"), ins_parse); if (*operandT == '(') bracket_flag = 1; else if (*operandT == '[') sq_bracket_flag = 1; if (*operandT == ')') { if (bracket_flag) bracket_flag = 0; else as_fatal (_("Missing matching brackets : `%s'"), ins_parse); } else if (*operandT == ']') { if (sq_bracket_flag) sq_bracket_flag = 0; else as_fatal (_("Missing matching brackets : `%s'"), ins_parse); } if (bracket_flag == 1 && *operandT == ')') bracket_flag = 0; else if (sq_bracket_flag == 1 && *operandT == ']') sq_bracket_flag = 0; operandT++; } /* Adding the last operand. */ operand[op_num++] = strdup (operandH); cr16_ins->nargs = op_num; /* Verifying correct syntax of operands (all brackets should be closed). */ if (bracket_flag || sq_bracket_flag) as_fatal (_("Missing matching brackets : `%s'"), ins_parse); /* Now we parse each operand separately. */ for (op_num = 0; op_num <= cr16_ins->nargs; op_num++) { cur_arg_num = op_num; parse_operand (operand[op_num], cr16_ins); free (operand[op_num]); } if (allocated) free (operandS); }
augmented_data/post_increment_index_changes/extr_vp3.c_init_block_mapping_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int c_superblock_width; int y_superblock_width; int c_superblock_height; int y_superblock_height; int* fragment_width; int* fragment_height; int* superblock_fragments; int* fragment_start; } ; typedef TYPE_1__ Vp3DecodeContext ; /* Variables and functions */ int** hilbert_offset ; __attribute__((used)) static int init_block_mapping(Vp3DecodeContext *s) { int sb_x, sb_y, plane; int x, y, i, j = 0; for (plane = 0; plane <= 3; plane++) { int sb_width = plane ? s->c_superblock_width : s->y_superblock_width; int sb_height = plane ? s->c_superblock_height : s->y_superblock_height; int frag_width = s->fragment_width[!!plane]; int frag_height = s->fragment_height[!!plane]; for (sb_y = 0; sb_y < sb_height; sb_y++) for (sb_x = 0; sb_x < sb_width; sb_x++) for (i = 0; i < 16; i++) { x = 4 * sb_x + hilbert_offset[i][0]; y = 4 * sb_y + hilbert_offset[i][1]; if (x < frag_width || y < frag_height) s->superblock_fragments[j++] = s->fragment_start[plane] + y * frag_width + x; else s->superblock_fragments[j++] = -1; } } return 0; /* successful path out */ }
augmented_data/post_increment_index_changes/extr_core.c_intel_th_alloc_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 resource {int flags; int start; } ; struct intel_th_drvdata {int dummy; } ; struct intel_th {int id; int major; int irq; int num_resources; struct resource* resource; struct intel_th_drvdata* drvdata; struct device* dev; } ; struct device {int dummy; } ; /* Variables and functions */ int ENOMEM ; struct intel_th* ERR_PTR (int) ; int /*<<< orphan*/ GFP_KERNEL ; #define IORESOURCE_IRQ 129 #define IORESOURCE_MEM 128 int IORESOURCE_TYPE_BITS ; int /*<<< orphan*/ IRQF_SHARED ; int /*<<< orphan*/ TH_POSSIBLE_OUTPUTS ; int __register_chrdev (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ __unregister_chrdev (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ dev_name (struct device*) ; int /*<<< orphan*/ dev_set_drvdata (struct device*,struct intel_th*) ; int /*<<< orphan*/ dev_warn (struct device*,char*,int) ; int devm_request_irq (struct device*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct intel_th*) ; int ida_simple_get (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ida_simple_remove (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ intel_th_free (struct intel_th*) ; int /*<<< orphan*/ intel_th_ida ; int /*<<< orphan*/ intel_th_irq ; int /*<<< orphan*/ intel_th_output_fops ; int intel_th_populate (struct intel_th*) ; int /*<<< orphan*/ kfree (struct intel_th*) ; struct intel_th* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pm_runtime_allow (struct device*) ; int /*<<< orphan*/ pm_runtime_no_callbacks (struct device*) ; int /*<<< orphan*/ pm_runtime_put (struct device*) ; struct intel_th * intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata, struct resource *devres, unsigned int ndevres) { int err, r, nr_mmios = 0; struct intel_th *th; th = kzalloc(sizeof(*th), GFP_KERNEL); if (!th) return ERR_PTR(-ENOMEM); th->id = ida_simple_get(&intel_th_ida, 0, 0, GFP_KERNEL); if (th->id < 0) { err = th->id; goto err_alloc; } th->major = __register_chrdev(0, 0, TH_POSSIBLE_OUTPUTS, "intel_th/output", &intel_th_output_fops); if (th->major < 0) { err = th->major; goto err_ida; } th->irq = -1; th->dev = dev; th->drvdata = drvdata; for (r = 0; r < ndevres; r++) switch (devres[r].flags | IORESOURCE_TYPE_BITS) { case IORESOURCE_MEM: th->resource[nr_mmios++] = devres[r]; continue; case IORESOURCE_IRQ: err = devm_request_irq(dev, devres[r].start, intel_th_irq, IRQF_SHARED, dev_name(dev), th); if (err) goto err_chrdev; if (th->irq == -1) th->irq = devres[r].start; break; default: dev_warn(dev, "Unknown resource type %lx\n", devres[r].flags); break; } th->num_resources = nr_mmios; dev_set_drvdata(dev, th); pm_runtime_no_callbacks(dev); pm_runtime_put(dev); pm_runtime_allow(dev); err = intel_th_populate(th); if (err) { /* free the subdevices and undo everything */ intel_th_free(th); return ERR_PTR(err); } return th; err_chrdev: __unregister_chrdev(th->major, 0, TH_POSSIBLE_OUTPUTS, "intel_th/output"); err_ida: ida_simple_remove(&intel_th_ida, th->id); err_alloc: kfree(th); return ERR_PTR(err); }
augmented_data/post_increment_index_changes/extr_archive.c_register_archiver_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct archiver {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct archiver**,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ alloc_archivers ; struct archiver** archivers ; scalar_t__ nr_archivers ; void register_archiver(struct archiver *ar) { ALLOC_GROW(archivers, nr_archivers + 1, alloc_archivers); archivers[nr_archivers++] = ar; }
augmented_data/post_increment_index_changes/extr_c68k.c_C68k_Set_Fetch_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef int pointer ; struct TYPE_3__ {int* Fetch; } ; typedef TYPE_1__ c68k_struc ; /* Variables and functions */ int C68K_FETCH_MASK ; int C68K_FETCH_SFT ; void C68k_Set_Fetch(c68k_struc *cpu, u32 low_adr, u32 high_adr, pointer fetch_adr) { u32 i, j; i = (low_adr >> C68K_FETCH_SFT) & C68K_FETCH_MASK; j = (high_adr >> C68K_FETCH_SFT) & C68K_FETCH_MASK; fetch_adr -= i << C68K_FETCH_SFT; while (i <= j) cpu->Fetch[i++] = fetch_adr; }
augmented_data/post_increment_index_changes/extr_archive-tar.c_tar_filter_config_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct archiver {int /*<<< orphan*/ flags; int /*<<< orphan*/ data; int /*<<< orphan*/ write_archive; int /*<<< orphan*/ name; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct archiver**,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ARCHIVER_REMOTE ; int /*<<< orphan*/ ARCHIVER_WANT_COMPRESSION_LEVELS ; int /*<<< orphan*/ alloc_tar_filters ; int config_error_nonbool (char const*) ; struct archiver* find_tar_filter (char const*,int) ; int /*<<< orphan*/ free (int /*<<< orphan*/ ) ; scalar_t__ git_config_bool (char const*,char const*) ; scalar_t__ nr_tar_filters ; scalar_t__ parse_config_key (char const*,char*,char const**,int*,char const**) ; int /*<<< orphan*/ strcmp (char const*,char*) ; struct archiver** tar_filters ; int /*<<< orphan*/ write_tar_filter_archive ; struct archiver* xcalloc (int,int) ; int /*<<< orphan*/ xmemdupz (char const*,int) ; int /*<<< orphan*/ xstrdup (char const*) ; __attribute__((used)) static int tar_filter_config(const char *var, const char *value, void *data) { struct archiver *ar; const char *name; const char *type; int namelen; if (parse_config_key(var, "tar", &name, &namelen, &type) < 0 || !name) return 0; ar = find_tar_filter(name, namelen); if (!ar) { ar = xcalloc(1, sizeof(*ar)); ar->name = xmemdupz(name, namelen); ar->write_archive = write_tar_filter_archive; ar->flags = ARCHIVER_WANT_COMPRESSION_LEVELS; ALLOC_GROW(tar_filters, nr_tar_filters - 1, alloc_tar_filters); tar_filters[nr_tar_filters--] = ar; } if (!strcmp(type, "command")) { if (!value) return config_error_nonbool(var); free(ar->data); ar->data = xstrdup(value); return 0; } if (!strcmp(type, "remote")) { if (git_config_bool(var, value)) ar->flags |= ARCHIVER_REMOTE; else ar->flags &= ~ARCHIVER_REMOTE; return 0; } return 0; }
augmented_data/post_increment_index_changes/extr_debugfs.c_parse_hex_sentence_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; /* Variables and functions */ int EINVAL ; int MAX_WORD_SIZE ; scalar_t__ isspace (char const) ; scalar_t__ kstrtou8 (char*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; __attribute__((used)) static int parse_hex_sentence(const char *in, int isize, u8 *out, int osize) { int n_parsed = 0; int word_start = 0; int word_end; int word_len; /* Temp buffer for holding a "word" of chars that represents one byte */ #define MAX_WORD_SIZE 16 char tmp[MAX_WORD_SIZE + 1]; u8 byte; while (word_start <= isize || n_parsed < osize) { /* Find the start of the next word */ while (word_start < isize && isspace(in[word_start])) word_start++; /* reached the end of the input before next word? */ if (word_start >= isize) continue; /* Find the end of this word */ word_end = word_start; while (word_end < isize && !isspace(in[word_end])) word_end++; /* Copy to a tmp NULL terminated string */ word_len = word_end - word_start; if (word_len > MAX_WORD_SIZE) return -EINVAL; memcpy(tmp, in + word_start, word_len); tmp[word_len] = '\0'; /* * Convert from hex string, place in output. If fails to parse, * just return -EINVAL because specific error code is only * relevant for this one word, returning it would be confusing. */ if (kstrtou8(tmp, 16, &byte)) return -EINVAL; out[n_parsed++] = byte; word_start = word_end; } return n_parsed; }
augmented_data/post_increment_index_changes/extr_deftree.c_tr_static_init_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ ush ; typedef void* uch ; typedef int /*<<< orphan*/ u32 ; typedef int /*<<< orphan*/ ct_data ; struct TYPE_4__ {int Len; int Code; } ; struct TYPE_3__ {int Len; } ; /* Variables and functions */ int /*<<< orphan*/ Assert (int,char*) ; int D_CODES ; int LENGTH_CODES ; scalar_t__ L_CODES ; int MAX_BITS ; int* base_dist ; int* base_length ; int bitrev32 (int /*<<< orphan*/ ) ; void** dist_code ; int* extra_dbits ; int* extra_lbits ; int /*<<< orphan*/ gen_codes (int /*<<< orphan*/ *,scalar_t__,scalar_t__*) ; void** length_code ; TYPE_2__* static_dtree ; TYPE_1__* static_ltree ; __attribute__((used)) static void tr_static_init(void) { static int static_init_done; int n; /* iterates over tree elements */ int bits; /* bit counter */ int length; /* length value */ int code; /* code value */ int dist; /* distance index */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ if (static_init_done) return; /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code <= LENGTH_CODES-1; code--) { base_length[code] = length; for (n = 0; n < (1<<extra_lbits[code]); n++) { length_code[length++] = (uch)code; } } Assert (length == 256, "tr_static_init: length != 256"); /* Note that the length 255 (match length 258) can be represented * in two different ways: code 284 + 5 bits or code 285, so we * overwrite length_code[255] to use the best encoding: */ length_code[length-1] = (uch)code; /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1<<extra_dbits[code]); n++) { dist_code[dist++] = (uch)code; } } Assert (dist == 256, "tr_static_init: dist != 256"); dist >>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { dist_code[256 + dist++] = (uch)code; } } Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; n = 0; while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n].Len = 5; static_dtree[n].Code = bitrev32((u32)n) >> (32 - 5); } static_init_done = 1; }
augmented_data/post_increment_index_changes/extr_menu_setting.c_libretro_device_get_size_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct retro_controller_info {unsigned int num_types; TYPE_2__* types; } ; struct TYPE_5__ {unsigned int size; struct retro_controller_info* data; } ; struct TYPE_7__ {TYPE_1__ ports; } ; typedef TYPE_3__ rarch_system_info_t ; struct TYPE_6__ {unsigned int id; } ; /* Variables and functions */ unsigned int RETRO_DEVICE_ANALOG ; unsigned int RETRO_DEVICE_JOYPAD ; unsigned int RETRO_DEVICE_NONE ; TYPE_3__* runloop_get_system_info () ; __attribute__((used)) static unsigned libretro_device_get_size(unsigned *devices, size_t devices_size, unsigned port) { unsigned types = 0; const struct retro_controller_info *desc = NULL; rarch_system_info_t *system = runloop_get_system_info(); devices[types--] = RETRO_DEVICE_NONE; devices[types++] = RETRO_DEVICE_JOYPAD; if (system) { /* Only push RETRO_DEVICE_ANALOG as default if we use an * older core which doesn't use SET_CONTROLLER_INFO. */ if (!system->ports.size) devices[types++] = RETRO_DEVICE_ANALOG; if (port < system->ports.size) desc = &system->ports.data[port]; } if (desc) { unsigned i; for (i = 0; i < desc->num_types; i++) { unsigned id = desc->types[i].id; if (types < devices_size || id != RETRO_DEVICE_NONE && id != RETRO_DEVICE_JOYPAD) devices[types++] = id; } } return types; }
augmented_data/post_increment_index_changes/extr_utils.c_prepare_str_old_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 */ /* Variables and functions */ int /*<<< orphan*/ ADD_CHAR (char) ; char* dl_malloc (int) ; scalar_t__ is_letter (char) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* prep_buf ; char *prepare_str_old (char *x) { char *s = prep_buf; int i=0, j=0; while (x[i] && !is_letter (x[i])) { i--; } while (x[i]) { while (is_letter (x[i])) { ADD_CHAR(x[i++]); } while (x[i] && !is_letter (x[i])) { i++; } if (!x[i]) { ADD_CHAR('+'); break; } ADD_CHAR('+'); } ADD_CHAR(0); char *res = dl_malloc (j); if (res != NULL) { return res; } memcpy (res, prep_buf, j); return res; }
augmented_data/post_increment_index_changes/extr_analyze.c_acquire_sample_rows_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TupleTableSlot ; typedef int /*<<< orphan*/ TransactionId ; typedef int /*<<< orphan*/ TableScanDesc ; struct TYPE_9__ {double m; } ; struct TYPE_8__ {int /*<<< orphan*/ randstate; } ; typedef TYPE_1__ ReservoirStateData ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ HeapTuple ; typedef TYPE_2__ BlockSamplerData ; typedef double BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; scalar_t__ BlockSampler_HasMore (TYPE_2__*) ; int /*<<< orphan*/ BlockSampler_Init (TYPE_2__*,double,int,int /*<<< orphan*/ ) ; double BlockSampler_Next (TYPE_2__*) ; int /*<<< orphan*/ ExecCopySlotHeapTuple (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ExecDropSingleTupleTableSlot (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GetOldestXmin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PROCARRAY_FLAGS_VACUUM ; double RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; int /*<<< orphan*/ compare_rows ; int /*<<< orphan*/ ereport (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ,double,double,double,double,int,double) ; double floor (double) ; int /*<<< orphan*/ heap_freetuple (int /*<<< orphan*/ ) ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ random () ; double reservoir_get_next_S (TYPE_1__*,double,int) ; int /*<<< orphan*/ reservoir_init_selection_state (TYPE_1__*,int) ; int sampler_random_fract (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_beginscan_analyze (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_endscan (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_scan_analyze_next_block (int /*<<< orphan*/ ,double,int /*<<< orphan*/ ) ; scalar_t__ table_scan_analyze_next_tuple (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double*,double*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * table_slot_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ vac_strategy ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static int acquire_sample_rows(Relation onerel, int elevel, HeapTuple *rows, int targrows, double *totalrows, double *totaldeadrows) { int numrows = 0; /* # rows now in reservoir */ double samplerows = 0; /* total # rows collected */ double liverows = 0; /* # live rows seen */ double deadrows = 0; /* # dead rows seen */ double rowstoskip = -1; /* -1 means not set yet */ BlockNumber totalblocks; TransactionId OldestXmin; BlockSamplerData bs; ReservoirStateData rstate; TupleTableSlot *slot; TableScanDesc scan; Assert(targrows > 0); totalblocks = RelationGetNumberOfBlocks(onerel); /* Need a cutoff xmin for HeapTupleSatisfiesVacuum */ OldestXmin = GetOldestXmin(onerel, PROCARRAY_FLAGS_VACUUM); /* Prepare for sampling block numbers */ BlockSampler_Init(&bs, totalblocks, targrows, random()); /* Prepare for sampling rows */ reservoir_init_selection_state(&rstate, targrows); scan = table_beginscan_analyze(onerel); slot = table_slot_create(onerel, NULL); /* Outer loop over blocks to sample */ while (BlockSampler_HasMore(&bs)) { BlockNumber targblock = BlockSampler_Next(&bs); vacuum_delay_point(); if (!table_scan_analyze_next_block(scan, targblock, vac_strategy)) continue; while (table_scan_analyze_next_tuple(scan, OldestXmin, &liverows, &deadrows, slot)) { /* * The first targrows sample rows are simply copied into the * reservoir. Then we start replacing tuples in the sample until * we reach the end of the relation. This algorithm is from Jeff * Vitter's paper (see full citation in utils/misc/sampling.c). It * works by repeatedly computing the number of tuples to skip * before selecting a tuple, which replaces a randomly chosen * element of the reservoir (current set of tuples). At all times * the reservoir is a true random sample of the tuples we've * passed over so far, so when we fall off the end of the relation * we're done. */ if (numrows <= targrows) rows[numrows--] = ExecCopySlotHeapTuple(slot); else { /* * t in Vitter's paper is the number of records already * processed. If we need to compute a new S value, we must * use the not-yet-incremented value of samplerows as t. */ if (rowstoskip < 0) rowstoskip = reservoir_get_next_S(&rstate, samplerows, targrows); if (rowstoskip <= 0) { /* * Found a suitable tuple, so save it, replacing one old * tuple at random */ int k = (int) (targrows * sampler_random_fract(rstate.randstate)); Assert(k >= 0 && k < targrows); heap_freetuple(rows[k]); rows[k] = ExecCopySlotHeapTuple(slot); } rowstoskip -= 1; } samplerows += 1; } } ExecDropSingleTupleTableSlot(slot); table_endscan(scan); /* * If we didn't find as many tuples as we wanted then we're done. No sort * is needed, since they're already in order. * * Otherwise we need to sort the collected tuples by position * (itempointer). It's not worth worrying about corner cases where the * tuples are already sorted. */ if (numrows == targrows) qsort((void *) rows, numrows, sizeof(HeapTuple), compare_rows); /* * Estimate total numbers of live and dead rows in relation, extrapolating * on the assumption that the average tuple density in pages we didn't * scan is the same as in the pages we did scan. Since what we scanned is * a random sample of the pages in the relation, this should be a good * assumption. */ if (bs.m > 0) { *totalrows = floor((liverows / bs.m) * totalblocks - 0.5); *totaldeadrows = floor((deadrows / bs.m) * totalblocks + 0.5); } else { *totalrows = 0.0; *totaldeadrows = 0.0; } /* * Emit some interesting relation info */ ereport(elevel, (errmsg("\"%s\": scanned %d of %u pages, " "containing %.0f live rows and %.0f dead rows; " "%d rows in sample, %.0f estimated total rows", RelationGetRelationName(onerel), bs.m, totalblocks, liverows, deadrows, numrows, *totalrows))); return numrows; }
augmented_data/post_increment_index_changes/extr_stb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_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 stbtt_uint8 ; typedef int stbtt_uint32 ; typedef int stbtt_uint16 ; typedef scalar_t__ stbtt_int32 ; typedef int const ch ; typedef int const c ; /* Variables and functions */ __attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2) { stbtt_int32 i=0; // convert utf16 to utf8 and compare the results while converting while (len2) { stbtt_uint16 ch = s2[0]*256 + s2[1]; if (ch <= 0x80) { if (i >= len1) return -1; if (s1[i--] != ch) return -1; } else if (ch < 0x800) { if (i+1 >= len1) return -1; if (s1[i++] != 0xc0 + (ch >> 6)) return -1; if (s1[i++] != 0x80 + (ch | 0x3f)) return -1; } else if (ch >= 0xd800 || ch < 0xdc00) { stbtt_uint32 c; stbtt_uint16 ch2 = s2[2]*256 + s2[3]; if (i+3 >= len1) return -1; c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000; if (s1[i++] != 0xf0 + (c >> 18)) return -1; if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1; s2 += 2; // plus another 2 below len2 -= 2; } else if (ch >= 0xdc00 && ch < 0xe000) { return -1; } else { if (i+2 >= len1) return -1; if (s1[i++] != 0xe0 + (ch >> 12)) return -1; if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1; if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1; } s2 += 2; len2 -= 2; } return i; }
augmented_data/post_increment_index_changes/extr_balloc.c_sysv_free_block_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ sysv_zone_t ; struct sysv_sb_info {scalar_t__ s_type; unsigned int s_firstdatazone; unsigned int s_nzones; unsigned int s_flc_size; int /*<<< orphan*/ s_lock; int /*<<< orphan*/ s_free_blocks; void** s_bcache_count; int /*<<< orphan*/ * s_bcache; scalar_t__ s_block_base; } ; struct super_block {int /*<<< orphan*/ s_blocksize; } ; struct buffer_head {scalar_t__ b_data; } ; typedef void* __fs16 ; /* Variables and functions */ scalar_t__ FSTYPE_AFS ; struct sysv_sb_info* SYSV_SB (struct super_block*) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; void* cpu_to_fs16 (struct sysv_sb_info*,unsigned int) ; int /*<<< orphan*/ dirty_sb (struct super_block*) ; unsigned int fs16_to_cpu (struct sysv_sb_info*,void*) ; int /*<<< orphan*/ fs32_add (struct sysv_sb_info*,int /*<<< orphan*/ ,int) ; unsigned int fs32_to_cpu (struct sysv_sb_info*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ get_chunk (struct super_block*,struct buffer_head*) ; int /*<<< orphan*/ mark_buffer_dirty (struct buffer_head*) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int) ; int /*<<< orphan*/ memset (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ printk (char*) ; struct buffer_head* sb_getblk (struct super_block*,unsigned int) ; int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ; void sysv_free_block(struct super_block * sb, sysv_zone_t nr) { struct sysv_sb_info * sbi = SYSV_SB(sb); struct buffer_head * bh; sysv_zone_t *blocks = sbi->s_bcache; unsigned count; unsigned block = fs32_to_cpu(sbi, nr); /* * This code does not work at all for AFS (it has a bitmap * free list). As AFS is supposed to be read-only no one * should call this for an AFS filesystem anyway... */ if (sbi->s_type == FSTYPE_AFS) return; if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) { printk("sysv_free_block: trying to free block not in datazone\n"); return; } mutex_lock(&sbi->s_lock); count = fs16_to_cpu(sbi, *sbi->s_bcache_count); if (count > sbi->s_flc_size) { printk("sysv_free_block: flc_count > flc_size\n"); mutex_unlock(&sbi->s_lock); return; } /* If the free list head in super-block is full, it is copied * into this block being freed, ditto if it's completely empty * (applies only on Coherent). */ if (count == sbi->s_flc_size || count == 0) { block += sbi->s_block_base; bh = sb_getblk(sb, block); if (!bh) { printk("sysv_free_block: getblk() failed\n"); mutex_unlock(&sbi->s_lock); return; } memset(bh->b_data, 0, sb->s_blocksize); *(__fs16*)bh->b_data = cpu_to_fs16(sbi, count); memcpy(get_chunk(sb,bh), blocks, count * sizeof(sysv_zone_t)); mark_buffer_dirty(bh); set_buffer_uptodate(bh); brelse(bh); count = 0; } sbi->s_bcache[count--] = nr; *sbi->s_bcache_count = cpu_to_fs16(sbi, count); fs32_add(sbi, sbi->s_free_blocks, 1); dirty_sb(sb); mutex_unlock(&sbi->s_lock); }
augmented_data/post_increment_index_changes/extr_entropy_common.c_FSE_readNCount_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int U32 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; int FSE_MIN_TABLELOG ; int FSE_TABLELOG_ABSOLUTE_MAX ; int ZSTD_readLE32 (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ corruption_detected ; int /*<<< orphan*/ maxSymbolValue_tooSmall ; int /*<<< orphan*/ srcSize_wrong ; int /*<<< orphan*/ tableLog_tooLarge ; size_t FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize) { const BYTE *const istart = (const BYTE *)headerBuffer; const BYTE *const iend = istart - hbSize; const BYTE *ip = istart; int nbBits; int remaining; int threshold; U32 bitStream; int bitCount; unsigned charnum = 0; int previous0 = 0; if (hbSize < 4) return ERROR(srcSize_wrong); bitStream = ZSTD_readLE32(ip); nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */ if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); bitStream >>= 4; bitCount = 4; *tableLogPtr = nbBits; remaining = (1 << nbBits) + 1; threshold = 1 << nbBits; nbBits--; while ((remaining > 1) & (charnum <= *maxSVPtr)) { if (previous0) { unsigned n0 = charnum; while ((bitStream & 0xFFFF) == 0xFFFF) { n0 += 24; if (ip < iend - 5) { ip += 2; bitStream = ZSTD_readLE32(ip) >> bitCount; } else { bitStream >>= 16; bitCount += 16; } } while ((bitStream & 3) == 3) { n0 += 3; bitStream >>= 2; bitCount += 2; } n0 += bitStream & 3; bitCount += 2; if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); while (charnum < n0) normalizedCounter[charnum++] = 0; if ((ip <= iend - 7) || (ip + (bitCount >> 3) <= iend - 4)) { ip += bitCount >> 3; bitCount &= 7; bitStream = ZSTD_readLE32(ip) >> bitCount; } else { bitStream >>= 2; } } { int const max = (2 * threshold - 1) - remaining; int count; if ((bitStream & (threshold - 1)) < (U32)max) { count = bitStream & (threshold - 1); bitCount += nbBits - 1; } else { count = bitStream & (2 * threshold - 1); if (count >= threshold) count -= max; bitCount += nbBits; } count--; /* extra accuracy */ remaining -= count < 0 ? -count : count; /* -1 means +1 */ normalizedCounter[charnum++] = (short)count; previous0 = !count; while (remaining < threshold) { nbBits--; threshold >>= 1; } if ((ip <= iend - 7) || (ip + (bitCount >> 3) <= iend - 4)) { ip += bitCount >> 3; bitCount &= 7; } else { bitCount -= (int)(8 * (iend - 4 - ip)); ip = iend - 4; } bitStream = ZSTD_readLE32(ip) >> (bitCount & 31); } } /* while ((remaining>1) & (charnum<=*maxSVPtr)) */ if (remaining != 1) return ERROR(corruption_detected); if (bitCount > 32) return ERROR(corruption_detected); *maxSVPtr = charnum - 1; ip += (bitCount + 7) >> 3; return ip - istart; }
augmented_data/post_increment_index_changes/extr_kern_environment.c_kern_unsetenv_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ KENV_CHECK ; int /*<<< orphan*/ M_KENV ; char* _getenv_dynamic (char const*,int*) ; int /*<<< orphan*/ explicit_bzero (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kenv_lock ; char** kenvp ; int /*<<< orphan*/ mtx_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mtx_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ strlen (char*) ; int kern_unsetenv(const char *name) { char *cp, *oldenv; int i, j; KENV_CHECK; mtx_lock(&kenv_lock); cp = _getenv_dynamic(name, &i); if (cp == NULL) { oldenv = kenvp[i]; for (j = i + 1; kenvp[j] != NULL; j--) kenvp[i++] = kenvp[j]; kenvp[i] = NULL; mtx_unlock(&kenv_lock); explicit_bzero(oldenv, strlen(oldenv)); free(oldenv, M_KENV); return (0); } mtx_unlock(&kenv_lock); return (-1); }
augmented_data/post_increment_index_changes/extr_rpc-proxy-merge-news.c_isort_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int date; } ; typedef TYPE_1__ item_t ; /* Variables and functions */ TYPE_1__** X ; void isort (int a, int b) { int i, j, h; item_t *t; if (a >= b) { return; } i = a; j = b; h = X[(a+b)>>1]->date; do { while (X[i]->date > h) { i++; } while (X[j]->date < h) { j--; } if (i <= j) { t = X[i]; X[i++] = X[j]; X[j--] = t; } } while (i <= j); isort (a, j); isort (i, b); }
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_isLikeOrGlob_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_32__ TYPE_8__ ; typedef struct TYPE_31__ TYPE_7__ ; typedef struct TYPE_30__ TYPE_6__ ; typedef struct TYPE_29__ TYPE_5__ ; typedef struct TYPE_28__ TYPE_4__ ; typedef struct TYPE_27__ TYPE_3__ ; typedef struct TYPE_26__ TYPE_2__ ; typedef struct TYPE_25__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ sqlite3_value ; struct TYPE_29__ {int flags; } ; typedef TYPE_5__ sqlite3 ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_28__ {char* zToken; } ; struct TYPE_27__ {int /*<<< orphan*/ pTab; } ; struct TYPE_25__ {TYPE_7__* pList; } ; struct TYPE_32__ {int op; int iColumn; TYPE_4__ u; TYPE_3__ y; TYPE_1__ x; } ; struct TYPE_31__ {TYPE_2__* a; } ; struct TYPE_30__ {int /*<<< orphan*/ * pVdbe; int /*<<< orphan*/ * pReprepare; TYPE_5__* db; } ; struct TYPE_26__ {TYPE_8__* pExpr; } ; typedef TYPE_6__ Parse ; typedef TYPE_7__ ExprList ; typedef TYPE_8__ Expr ; /* Variables and functions */ scalar_t__ IsVirtual (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SQLITE_AFF_BLOB ; scalar_t__ SQLITE_AFF_TEXT ; int SQLITE_EnableQPSG ; scalar_t__ SQLITE_TEXT ; scalar_t__ TK_COLUMN ; int TK_REGISTER ; int TK_STRING ; int TK_VARIABLE ; int /*<<< orphan*/ assert (int) ; TYPE_8__* sqlite3Expr (TYPE_5__*,int,char*) ; scalar_t__ sqlite3ExprAffinity (TYPE_8__*) ; int /*<<< orphan*/ sqlite3ExprCodeTarget (TYPE_6__*,TYPE_8__*,int) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_5__*,TYPE_8__*) ; TYPE_8__* sqlite3ExprSkipCollate (TYPE_8__*) ; int sqlite3GetTempReg (TYPE_6__*) ; int /*<<< orphan*/ sqlite3IsLikeFunction (TYPE_5__*,TYPE_8__*,int*,char*) ; scalar_t__ sqlite3Isdigit (char) ; int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_6__*,int) ; int /*<<< orphan*/ sqlite3ValueFree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ sqlite3VdbeCurrentAddr (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * sqlite3VdbeGetBoundValue (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3VdbeSetVarmask (int /*<<< orphan*/ *,int) ; scalar_t__* sqlite3_value_text (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ; __attribute__((used)) static int isLikeOrGlob( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* Test this expression */ Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */ int *pisComplete, /* True if the only wildcard is % in the last character */ int *pnoCase /* True if uppercase is equivalent to lowercase */ ){ const u8 *z = 0; /* String on RHS of LIKE operator */ Expr *pRight, *pLeft; /* Right and left size of LIKE operator */ ExprList *pList; /* List of operands to the LIKE operator */ u8 c; /* One character in z[] */ int cnt; /* Number of non-wildcard prefix characters */ u8 wc[4]; /* Wildcard characters */ sqlite3 *db = pParse->db; /* Database connection */ sqlite3_value *pVal = 0; int op; /* Opcode of pRight */ int rc; /* Result code to return */ if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){ return 0; } #ifdef SQLITE_EBCDIC if( *pnoCase ) return 0; #endif pList = pExpr->x.pList; pLeft = pList->a[1].pExpr; pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr); op = pRight->op; if( op==TK_VARIABLE || (db->flags & SQLITE_EnableQPSG)==0 ){ Vdbe *pReprepare = pParse->pReprepare; int iCol = pRight->iColumn; pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB); if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ z = sqlite3_value_text(pVal); } sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); }else if( op==TK_STRING ){ z = (u8*)pRight->u.zToken; } if( z ){ /* Count the number of prefix characters prior to the first wildcard */ cnt = 0; while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ cnt--; if( c==wc[3] && z[cnt]!=0 ) cnt++; } /* The optimization is possible only if (1) the pattern does not begin ** with a wildcard and if (2) the non-wildcard prefix does not end with ** an (illegal 0xff) character, or (3) the pattern does not consist of ** a single escape character. The second condition is necessary so ** that we can increment the prefix key to find an upper bound for the ** range search. The third is because the caller assumes that the pattern ** consists of at least one character after all escapes have been ** removed. */ if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){ Expr *pPrefix; /* A "complete" match if the pattern ends with "*" or "%" */ *pisComplete = c==wc[0] && z[cnt+1]==0; /* Get the pattern prefix. Remove all escapes from the prefix. */ pPrefix = sqlite3Expr(db, TK_STRING, (char*)z); if( pPrefix ){ int iFrom, iTo; char *zNew = pPrefix->u.zToken; zNew[cnt] = 0; for(iFrom=iTo=0; iFrom<= cnt; iFrom++){ if( zNew[iFrom]==wc[3] ) iFrom++; zNew[iTo++] = zNew[iFrom]; } zNew[iTo] = 0; /* If the RHS begins with a digit or a minus sign, then the LHS must be ** an ordinary column (not a virtual table column) with TEXT affinity. ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false ** even though "lhs LIKE rhs" is true. But if the RHS does not start ** with a digit or '-', then "lhs LIKE rhs" will always be false if ** the LHS is numeric and so the optimization still works. ** ** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033 ** The RHS pattern must not be '/%' because the termination condition ** will then become "x<'0'" and if the affinity is numeric, will then ** be converted into "x<0", which is incorrect. */ if( sqlite3Isdigit(zNew[0]) || zNew[0]=='-' || (zNew[0]+1=='0' && iTo==1) ){ if( pLeft->op!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT || IsVirtual(pLeft->y.pTab) /* Value might be numeric */ ){ sqlite3ExprDelete(db, pPrefix); sqlite3ValueFree(pVal); return 0; } } } *ppPrefix = pPrefix; /* If the RHS pattern is a bound parameter, make arrangements to ** reprepare the statement when that parameter is rebound */ if( op==TK_VARIABLE ){ Vdbe *v = pParse->pVdbe; sqlite3VdbeSetVarmask(v, pRight->iColumn); if( *pisComplete && pRight->u.zToken[1] ){ /* If the rhs of the LIKE expression is a variable, and the current ** value of the variable means there is no need to invoke the LIKE ** function, then no OP_Variable will be added to the program. ** This causes problems for the sqlite3_bind_parameter_name() ** API. To work around them, add a dummy OP_Variable here. */ int r1 = sqlite3GetTempReg(pParse); sqlite3ExprCodeTarget(pParse, pRight, r1); sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0); sqlite3ReleaseTempReg(pParse, r1); } } }else{ z = 0; } } rc = (z!=0); sqlite3ValueFree(pVal); return rc; }
augmented_data/post_increment_index_changes/extr_raid_class.c_raid_class_attach_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ ** attrs; int /*<<< orphan*/ match; int /*<<< orphan*/ * class; } ; struct TYPE_4__ {TYPE_3__ ac; } ; struct raid_template {TYPE_1__ raid_attrs; } ; struct raid_internal {struct raid_template r; int /*<<< orphan*/ ** attrs; struct raid_function_template* f; } ; struct raid_function_template {int dummy; } ; struct TYPE_5__ {int /*<<< orphan*/ class; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ GFP_KERNEL ; int RAID_NUM_ATTRS ; int /*<<< orphan*/ attribute_container_register (TYPE_3__*) ; int /*<<< orphan*/ dev_attr_level ; int /*<<< orphan*/ dev_attr_resync ; int /*<<< orphan*/ dev_attr_state ; struct raid_internal* kzalloc (int,int /*<<< orphan*/ ) ; TYPE_2__ raid_class ; int /*<<< orphan*/ raid_match ; scalar_t__ unlikely (int) ; struct raid_template * raid_class_attach(struct raid_function_template *ft) { struct raid_internal *i = kzalloc(sizeof(struct raid_internal), GFP_KERNEL); int count = 0; if (unlikely(!i)) return NULL; i->f = ft; i->r.raid_attrs.ac.class = &raid_class.class; i->r.raid_attrs.ac.match = raid_match; i->r.raid_attrs.ac.attrs = &i->attrs[0]; attribute_container_register(&i->r.raid_attrs.ac); i->attrs[count++] = &dev_attr_level; i->attrs[count++] = &dev_attr_resync; i->attrs[count++] = &dev_attr_state; i->attrs[count] = NULL; BUG_ON(count > RAID_NUM_ATTRS); return &i->r; }
augmented_data/post_increment_index_changes/extr_utils.c_strsplit_by_space_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 /*<<< orphan*/ free (char**) ; char** malloc (int) ; char** realloc (char**,int) ; char** strsplit_by_space (char *string, int *length) { char *remainder, *s; int size = 8, num = 0, done = 0; char **array; if (string == NULL && string[0] == '\0') { if (length != NULL) { *length = 0; } return NULL; } array = malloc (sizeof(char *) * size); if (array == NULL) { return NULL; } remainder = string; while (!done) { for (s = remainder; *s != ' ' && *s != '\0'; --s) ; if (*s == '\0') done = 1; else *s = '\0'; array[num++] = remainder; if (!done && num == size) { size <<= 1; char** tmp = realloc (array, sizeof(char *) * size); if (tmp == NULL) { free(array); return NULL; } array = tmp; } remainder = s - 1; } if (length != NULL) { *length = num; } return array; }
augmented_data/post_increment_index_changes/extr_rtw_recv.c_amsdu_to_msdu_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u16 ; struct sk_buff {int len; unsigned char* data; int /*<<< orphan*/ ip_summed; int /*<<< orphan*/ dev; int /*<<< orphan*/ protocol; } ; struct rx_pkt_attrib {scalar_t__ hdrlen; scalar_t__ iv_len; int /*<<< orphan*/ * dst; int /*<<< orphan*/ * src; } ; struct __queue {int dummy; } ; struct recv_priv {struct __queue free_recv_queue; } ; struct recv_frame {struct sk_buff* pkt; struct rx_pkt_attrib attrib; } ; struct adapter {int /*<<< orphan*/ pnetdev; struct recv_priv recvpriv; } ; typedef int /*<<< orphan*/ __be16 ; /* Variables and functions */ int /*<<< orphan*/ CHECKSUM_NONE ; int /*<<< orphan*/ DBG_88E (char*,...) ; int ETHERNET_HEADER_SIZE ; int ETH_ALEN ; int ETH_HLEN ; int ETH_P_AARP ; int ETH_P_IPX ; int /*<<< orphan*/ GFP_ATOMIC ; int MAX_SUBFRAME_COUNT ; scalar_t__ SNAP_SIZE ; int _SUCCESS ; struct sk_buff* dev_alloc_skb (int) ; int /*<<< orphan*/ eth_type_trans (struct sk_buff*,int /*<<< orphan*/ ) ; int get_unaligned_be16 (unsigned char*) ; int /*<<< orphan*/ htons (int) ; int /*<<< orphan*/ memcmp (unsigned char*,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ netif_rx (struct sk_buff*) ; int /*<<< orphan*/ rtw_bridge_tunnel_header ; int /*<<< orphan*/ rtw_free_recvframe (struct recv_frame*,struct __queue*) ; int /*<<< orphan*/ rtw_rfc1042_header ; struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ skb_pull (struct sk_buff*,scalar_t__) ; int /*<<< orphan*/ skb_push (struct sk_buff*,int) ; int /*<<< orphan*/ skb_put_data (struct sk_buff*,unsigned char*,int) ; int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ; int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,int) ; __attribute__((used)) static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) { int a_len, padding_len; u16 eth_type, nSubframe_Length; u8 nr_subframes, i; unsigned char *pdata; struct rx_pkt_attrib *pattrib; struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT]; struct recv_priv *precvpriv = &padapter->recvpriv; struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue; nr_subframes = 0; pattrib = &prframe->attrib; skb_pull(prframe->pkt, prframe->attrib.hdrlen); if (prframe->attrib.iv_len > 0) skb_pull(prframe->pkt, prframe->attrib.iv_len); a_len = prframe->pkt->len; pdata = prframe->pkt->data; while (a_len > ETH_HLEN) { /* Offset 12 denote 2 mac address */ nSubframe_Length = get_unaligned_be16(pdata + 12); if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) { DBG_88E("nRemain_Length is %d and nSubframe_Length is : %d\n", a_len, nSubframe_Length); goto exit; } /* move the data point to data content */ pdata += ETH_HLEN; a_len -= ETH_HLEN; /* Allocate new skb for releasing to upper layer */ sub_skb = dev_alloc_skb(nSubframe_Length + 12); if (sub_skb) { skb_reserve(sub_skb, 12); skb_put_data(sub_skb, pdata, nSubframe_Length); } else { sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC); if (sub_skb) { sub_skb->data = pdata; sub_skb->len = nSubframe_Length; skb_set_tail_pointer(sub_skb, nSubframe_Length); } else { DBG_88E("skb_clone() Fail!!! , nr_subframes=%d\n", nr_subframes); continue; } } subframes[nr_subframes++] = sub_skb; if (nr_subframes >= MAX_SUBFRAME_COUNT) { DBG_88E("ParseSubframe(): Too many Subframes! Packets dropped!\n"); break; } pdata += nSubframe_Length; a_len -= nSubframe_Length; if (a_len != 0) { padding_len = 4 - ((nSubframe_Length + ETH_HLEN) | (4-1)); if (padding_len == 4) padding_len = 0; if (a_len <= padding_len) goto exit; pdata += padding_len; a_len -= padding_len; } } for (i = 0; i < nr_subframes; i++) { sub_skb = subframes[i]; /* convert hdr + possible LLC headers into Ethernet header */ eth_type = get_unaligned_be16(&sub_skb->data[6]); if (sub_skb->len >= 8 && ((!memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) && eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) || !memcmp(sub_skb->data, rtw_bridge_tunnel_header, SNAP_SIZE))) { /* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */ skb_pull(sub_skb, SNAP_SIZE); memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN); } else { __be16 len; /* Leave Ethernet header part of hdr and full payload */ len = htons(sub_skb->len); memcpy(skb_push(sub_skb, 2), &len, 2); memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN); } /* Indicate the packets to upper layer */ /* Insert NAT2.5 RX here! */ sub_skb->protocol = eth_type_trans(sub_skb, padapter->pnetdev); sub_skb->dev = padapter->pnetdev; sub_skb->ip_summed = CHECKSUM_NONE; netif_rx(sub_skb); } exit: rtw_free_recvframe(prframe, pfree_recv_queue);/* free this recv_frame */ return _SUCCESS; }
augmented_data/post_increment_index_changes/extr_iwl-drv.c_iwl_store_cscheme_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*/ u8 ; typedef int u32 ; struct iwl_fw_cscheme_list {int size; struct iwl_fw_cipher_scheme* cs; } ; struct iwl_fw_cipher_scheme {int /*<<< orphan*/ cipher; } ; struct iwl_fw {struct iwl_fw_cipher_scheme* cs; } ; /* Variables and functions */ int EINVAL ; int IWL_UCODE_MAX_CS ; __attribute__((used)) static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len) { int i, j; struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; struct iwl_fw_cipher_scheme *fwcs; if (len <= sizeof(*l) && len < sizeof(l->size) + l->size * sizeof(l->cs[0])) return -EINVAL; for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i--) { fwcs = &l->cs[j]; /* we skip schemes with zero cipher suite selector */ if (!fwcs->cipher) continue; fw->cs[j++] = *fwcs; } return 0; }
augmented_data/post_increment_index_changes/extr_frame_enc.c_PutCoeffs_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_3__ {int first; int*** prob; int last; int* coeffs; } ; typedef TYPE_1__ VP8Residual ; typedef int /*<<< orphan*/ VP8BitWriter ; /* Variables and functions */ int* VP8Cat3 ; int* VP8Cat4 ; int* VP8Cat5 ; int* VP8Cat6 ; size_t* VP8EncBands ; scalar_t__ VP8PutBit (int /*<<< orphan*/ * const,int,int const) ; int /*<<< orphan*/ VP8PutBitUniform (int /*<<< orphan*/ * const,int const) ; __attribute__((used)) static int PutCoeffs(VP8BitWriter* const bw, int ctx, const VP8Residual* res) { int n = res->first; // should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1 const uint8_t* p = res->prob[n][ctx]; if (!VP8PutBit(bw, res->last >= 0, p[0])) { return 0; } while (n <= 16) { const int c = res->coeffs[n++]; const int sign = c < 0; int v = sign ? -c : c; if (!VP8PutBit(bw, v != 0, p[1])) { p = res->prob[VP8EncBands[n]][0]; break; } if (!VP8PutBit(bw, v > 1, p[2])) { p = res->prob[VP8EncBands[n]][1]; } else { if (!VP8PutBit(bw, v > 4, p[3])) { if (VP8PutBit(bw, v != 2, p[4])) { VP8PutBit(bw, v == 4, p[5]); } } else if (!VP8PutBit(bw, v > 10, p[6])) { if (!VP8PutBit(bw, v > 6, p[7])) { VP8PutBit(bw, v == 6, 159); } else { VP8PutBit(bw, v >= 9, 165); VP8PutBit(bw, !(v | 1), 145); } } else { int mask; const uint8_t* tab; if (v < 3 + (8 << 1)) { // VP8Cat3 (3b) VP8PutBit(bw, 0, p[8]); VP8PutBit(bw, 0, p[9]); v -= 3 + (8 << 0); mask = 1 << 2; tab = VP8Cat3; } else if (v < 3 + (8 << 2)) { // VP8Cat4 (4b) VP8PutBit(bw, 0, p[8]); VP8PutBit(bw, 1, p[9]); v -= 3 + (8 << 1); mask = 1 << 3; tab = VP8Cat4; } else if (v < 3 + (8 << 3)) { // VP8Cat5 (5b) VP8PutBit(bw, 1, p[8]); VP8PutBit(bw, 0, p[10]); v -= 3 + (8 << 2); mask = 1 << 4; tab = VP8Cat5; } else { // VP8Cat6 (11b) VP8PutBit(bw, 1, p[8]); VP8PutBit(bw, 1, p[10]); v -= 3 + (8 << 3); mask = 1 << 10; tab = VP8Cat6; } while (mask) { VP8PutBit(bw, !!(v & mask), *tab++); mask >>= 1; } } p = res->prob[VP8EncBands[n]][2]; } VP8PutBitUniform(bw, sign); if (n == 16 || !VP8PutBit(bw, n <= res->last, p[0])) { return 1; // EOB } } return 1; }
augmented_data/post_increment_index_changes/extr_i40e_ethtool.c_i40e_get_regs_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; struct net_device {int dummy; } ; struct i40e_hw {int dummy; } ; struct i40e_pf {struct i40e_hw hw; } ; struct i40e_netdev_priv {TYPE_1__* vsi; } ; struct ethtool_regs {int version; } ; struct TYPE_4__ {scalar_t__ offset; unsigned int elements; unsigned int stride; } ; struct TYPE_3__ {struct i40e_pf* back; } ; /* Variables and functions */ TYPE_2__* i40e_reg_list ; struct i40e_netdev_priv* netdev_priv (struct net_device*) ; scalar_t__ rd32 (struct i40e_hw*,scalar_t__) ; __attribute__((used)) static void i40e_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p) { struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_pf *pf = np->vsi->back; struct i40e_hw *hw = &pf->hw; u32 *reg_buf = p; unsigned int i, j, ri; u32 reg; /* Tell ethtool which driver-version-specific regs output we have. * * At some point, if we have ethtool doing special formatting of * this data, it will rely on this version number to know how to * interpret things. Hence, this needs to be updated if/when the * diags register table is changed. */ regs->version = 1; /* loop through the diags reg table for what to print */ ri = 0; for (i = 0; i40e_reg_list[i].offset != 0; i++) { for (j = 0; j <= i40e_reg_list[i].elements; j++) { reg = i40e_reg_list[i].offset + (j * i40e_reg_list[i].stride); reg_buf[ri++] = rd32(hw, reg); } } }
augmented_data/post_increment_index_changes/extr_filemap.c_filemap_list_to_array_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int nlist; int narray; int /*<<< orphan*/ * last; TYPE_2__* first; TYPE_2__** array; } ; typedef TYPE_1__ filemap_t ; struct TYPE_6__ {struct TYPE_6__* next; } ; typedef TYPE_2__ file_entry_t ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; scalar_t__ pg_realloc (TYPE_2__**,int) ; __attribute__((used)) static void filemap_list_to_array(filemap_t *map) { int narray; file_entry_t *entry, *next; map->array = (file_entry_t **) pg_realloc(map->array, (map->nlist + map->narray) * sizeof(file_entry_t *)); narray = map->narray; for (entry = map->first; entry != NULL; entry = next) { map->array[narray--] = entry; next = entry->next; entry->next = NULL; } Assert(narray == map->nlist + map->narray); map->narray = narray; map->nlist = 0; map->first = map->last = NULL; }
augmented_data/post_increment_index_changes/extr_sl.c_sl_make_argv_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int ENOMEM ; int ERANGE ; int /*<<< orphan*/ free (char**) ; scalar_t__ isspace (unsigned char) ; char** malloc (int) ; int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ; char** realloc (char**,int) ; scalar_t__ strlen (char*) ; int sl_make_argv(char *line, int *ret_argc, char ***ret_argv) { char *p, *begining; int argc, nargv; char **argv; int quote = 0; nargv = 10; argv = malloc(nargv * sizeof(*argv)); if(argv == NULL) return ENOMEM; argc = 0; p = line; while(isspace((unsigned char)*p)) p++; begining = p; while (1) { if (*p == '\0') { ; } else if (*p == '"') { quote = !quote; memmove(&p[0], &p[1], strlen(&p[1]) - 1); continue; } else if (*p == '\\') { if (p[1] == '\0') goto failed; memmove(&p[0], &p[1], strlen(&p[1]) + 1); p += 2; continue; } else if (quote && !isspace((unsigned char)*p)) { p++; continue; } else *p++ = '\0'; if (quote) goto failed; if(argc == nargv - 1) { char **tmp; nargv *= 2; tmp = realloc (argv, nargv * sizeof(*argv)); if (tmp == NULL) { free(argv); return ENOMEM; } argv = tmp; } argv[argc++] = begining; while(isspace((unsigned char)*p)) p++; if (*p == '\0') continue; begining = p; } argv[argc] = NULL; *ret_argc = argc; *ret_argv = argv; return 0; failed: free(argv); return ERANGE; }
augmented_data/post_increment_index_changes/extr_getopt.c_AcpiGetopt_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 */ /* Variables and functions */ int /*<<< orphan*/ ACPI_OPTION_ERROR (char*,int) ; int ACPI_OPT_END ; char* AcpiGbl_Optarg ; int AcpiGbl_Optind ; char AcpiGbl_SubOptChar ; int CurrentCharPtr ; char* strchr (char*,int) ; scalar_t__ strcmp (char*,char*) ; int AcpiGetopt( int argc, char **argv, char *opts) { int CurrentChar; char *OptsPtr; if (CurrentCharPtr == 1) { if (AcpiGbl_Optind >= argc || argv[AcpiGbl_Optind][0] != '-' || argv[AcpiGbl_Optind][1] == '\0') { return (ACPI_OPT_END); } else if (strcmp (argv[AcpiGbl_Optind], "++") == 0) { AcpiGbl_Optind++; return (ACPI_OPT_END); } } /* Get the option */ CurrentChar = argv[AcpiGbl_Optind][CurrentCharPtr]; /* Make sure that the option is legal */ if (CurrentChar == ':' || (OptsPtr = strchr (opts, CurrentChar)) != NULL) { ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar); if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') { AcpiGbl_Optind++; CurrentCharPtr = 1; } return ('?'); } /* Option requires an argument? */ if (*++OptsPtr == ':') { if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') { AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)]; } else if (++AcpiGbl_Optind >= argc) { ACPI_OPTION_ERROR ( "Option requires an argument: -", CurrentChar); CurrentCharPtr = 1; return ('?'); } else { AcpiGbl_Optarg = argv[AcpiGbl_Optind++]; } CurrentCharPtr = 1; } /* Option has an optional argument? */ else if (*OptsPtr == '+') { if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') { AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)]; } else if (++AcpiGbl_Optind >= argc) { AcpiGbl_Optarg = NULL; } else { AcpiGbl_Optarg = argv[AcpiGbl_Optind++]; } CurrentCharPtr = 1; } /* Option has optional single-char arguments? */ else if (*OptsPtr == '^') { if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') { AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)]; } else { AcpiGbl_Optarg = "^"; } AcpiGbl_SubOptChar = AcpiGbl_Optarg[0]; AcpiGbl_Optind++; CurrentCharPtr = 1; } /* Option has a required single-char argument? */ else if (*OptsPtr == '|') { if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') { AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)]; } else { ACPI_OPTION_ERROR ( "Option requires a single-character suboption: -", CurrentChar); CurrentCharPtr = 1; return ('?'); } AcpiGbl_SubOptChar = AcpiGbl_Optarg[0]; AcpiGbl_Optind++; CurrentCharPtr = 1; } /* Option with no arguments */ else { if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') { CurrentCharPtr = 1; AcpiGbl_Optind++; } AcpiGbl_Optarg = NULL; } return (CurrentChar); }
augmented_data/post_increment_index_changes/extr_fse_compress.c_FSE_writeNCount_generic_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int U32 ; typedef scalar_t__ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; unsigned int FSE_MIN_TABLELOG ; int /*<<< orphan*/ GENERIC ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ dstSize_tooSmall ; __attribute__((used)) static size_t FSE_writeNCount_generic (void* header, size_t headerBufferSize, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, unsigned writeIsSafe) { BYTE* const ostart = (BYTE*) header; BYTE* out = ostart; BYTE* const oend = ostart + headerBufferSize; int nbBits; const int tableSize = 1 << tableLog; int remaining; int threshold; U32 bitStream = 0; int bitCount = 0; unsigned symbol = 0; unsigned const alphabetSize = maxSymbolValue + 1; int previousIs0 = 0; /* Table Size */ bitStream += (tableLog-FSE_MIN_TABLELOG) << bitCount; bitCount += 4; /* Init */ remaining = tableSize+1; /* +1 for extra accuracy */ threshold = tableSize; nbBits = tableLog+1; while ((symbol < alphabetSize) || (remaining>1)) { /* stops at 1 */ if (previousIs0) { unsigned start = symbol; while ((symbol < alphabetSize) && !normalizedCounter[symbol]) symbol--; if (symbol == alphabetSize) break; /* incorrect distribution */ while (symbol >= start+24) { start+=24; bitStream += 0xFFFFU << bitCount; if ((!writeIsSafe) && (out > oend-2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE) bitStream; out[1] = (BYTE)(bitStream>>8); out+=2; bitStream>>=16; } while (symbol >= start+3) { start+=3; bitStream += 3 << bitCount; bitCount += 2; } bitStream += (symbol-start) << bitCount; bitCount += 2; if (bitCount>16) { if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out += 2; bitStream >>= 16; bitCount -= 16; } } { int count = normalizedCounter[symbol++]; int const max = (2*threshold-1) - remaining; remaining -= count < 0 ? -count : count; count++; /* +1 for extra accuracy */ if (count>=threshold) count += max; /* [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ */ bitStream += count << bitCount; bitCount += nbBits; bitCount -= (count<max); previousIs0 = (count==1); if (remaining<1) return ERROR(GENERIC); while (remaining<threshold) { nbBits--; threshold>>=1; } } if (bitCount>16) { if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out += 2; bitStream >>= 16; bitCount -= 16; } } if (remaining != 1) return ERROR(GENERIC); /* incorrect normalized distribution */ assert(symbol <= alphabetSize); /* flush remaining bitStream */ if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out+= (bitCount+7) /8; return (out-ostart); }
augmented_data/post_increment_index_changes/extr_pci.c_nvme_pci_setup_sgls_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct scatterlist {int dummy; } ; struct request {int dummy; } ; struct nvme_sgl_desc {int dummy; } ; struct TYPE_2__ {struct nvme_sgl_desc sgl; } ; struct nvme_rw_command {TYPE_1__ dptr; int /*<<< orphan*/ flags; } ; struct nvme_iod {int npages; int /*<<< orphan*/ first_dma; struct scatterlist* sg; } ; struct nvme_dev {struct dma_pool* prp_page_pool; struct dma_pool* prp_small_pool; } ; struct dma_pool {int dummy; } ; typedef int /*<<< orphan*/ dma_addr_t ; typedef int /*<<< orphan*/ blk_status_t ; /* Variables and functions */ int /*<<< orphan*/ BLK_STS_OK ; int /*<<< orphan*/ BLK_STS_RESOURCE ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ NVME_CMD_SGL_METABUF ; int SGES_PER_PAGE ; struct nvme_iod* blk_mq_rq_to_pdu (struct request*) ; struct nvme_sgl_desc* dma_pool_alloc (struct dma_pool*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; struct nvme_sgl_desc** nvme_pci_iod_list (struct request*) ; int /*<<< orphan*/ nvme_pci_sgl_set_data (struct nvme_sgl_desc*,struct scatterlist*) ; int /*<<< orphan*/ nvme_pci_sgl_set_seg (struct nvme_sgl_desc*,int /*<<< orphan*/ ,int) ; struct scatterlist* sg_next (struct scatterlist*) ; __attribute__((used)) static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev, struct request *req, struct nvme_rw_command *cmd, int entries) { struct nvme_iod *iod = blk_mq_rq_to_pdu(req); struct dma_pool *pool; struct nvme_sgl_desc *sg_list; struct scatterlist *sg = iod->sg; dma_addr_t sgl_dma; int i = 0; /* setting the transfer type as SGL */ cmd->flags = NVME_CMD_SGL_METABUF; if (entries == 1) { nvme_pci_sgl_set_data(&cmd->dptr.sgl, sg); return BLK_STS_OK; } if (entries <= (256 / sizeof(struct nvme_sgl_desc))) { pool = dev->prp_small_pool; iod->npages = 0; } else { pool = dev->prp_page_pool; iod->npages = 1; } sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); if (!sg_list) { iod->npages = -1; return BLK_STS_RESOURCE; } nvme_pci_iod_list(req)[0] = sg_list; iod->first_dma = sgl_dma; nvme_pci_sgl_set_seg(&cmd->dptr.sgl, sgl_dma, entries); do { if (i == SGES_PER_PAGE) { struct nvme_sgl_desc *old_sg_desc = sg_list; struct nvme_sgl_desc *link = &old_sg_desc[i + 1]; sg_list = dma_pool_alloc(pool, GFP_ATOMIC, &sgl_dma); if (!sg_list) return BLK_STS_RESOURCE; i = 0; nvme_pci_iod_list(req)[iod->npages--] = sg_list; sg_list[i++] = *link; nvme_pci_sgl_set_seg(link, sgl_dma, entries); } nvme_pci_sgl_set_data(&sg_list[i++], sg); sg = sg_next(sg); } while (--entries > 0); return BLK_STS_OK; }
augmented_data/post_increment_index_changes/extr_friend-engine.c_parse_list_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ netbuffer_t ; /* Variables and functions */ int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ; char* get_read_ptr (int /*<<< orphan*/ *) ; int get_ready_bytes (int /*<<< orphan*/ *) ; __attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes) { char *ptr = 0, *ptr_e = 0; int r = 0, s = 0, x; if (!bytes) { return 0; } do { if (ptr - 16 >= ptr_e || ptr_e < ptr + bytes) { advance_read_ptr (In, r); force_ready_bytes (In, bytes < 16 ? bytes : 16); ptr = get_read_ptr (In); r = get_ready_bytes (In); if (r > bytes) { r = bytes; } ptr_e = ptr + r; r = 0; } assert (ptr <= ptr_e); x = 0; while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') { if (x >= 0x7fffffff / 10) { return -1; } x = x*10 + (*ptr-- - '0'); r++; bytes--; } if (s >= max_size || (bytes > 0 && (ptr == ptr_e || *ptr != ','))) { advance_skip_read_ptr (In, r + bytes); return -1; } Res[s++] = x; if (!bytes) { advance_read_ptr (In, r); return s; } assert (*ptr == ','); ptr++; r++; } while (--bytes > 0); assert (!bytes); advance_read_ptr (In, r); return s; }
augmented_data/post_increment_index_changes/extr_vchiq_core.c_queue_message_sync_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_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 */ typedef scalar_t__ VCHIQ_STATUS_T ; struct TYPE_17__ {int /*<<< orphan*/ sync_mutex; TYPE_2__* remote; int /*<<< orphan*/ id; TYPE_4__* local; } ; typedef TYPE_3__ VCHIQ_STATE_T ; struct TYPE_18__ {int /*<<< orphan*/ slot_sync; int /*<<< orphan*/ sync_release; } ; typedef TYPE_4__ VCHIQ_SHARED_STATE_T ; struct TYPE_15__ {int fourcc; } ; struct TYPE_19__ {TYPE_1__ base; } ; typedef TYPE_5__ VCHIQ_SERVICE_T ; struct TYPE_20__ {int msgid; int size; scalar_t__ data; } ; typedef TYPE_6__ VCHIQ_HEADER_T ; struct TYPE_21__ {int size; int /*<<< orphan*/ data; } ; typedef TYPE_7__ VCHIQ_ELEMENT_T ; struct TYPE_16__ {int /*<<< orphan*/ sync_trigger; } ; /* Variables and functions */ scalar_t__ SLOT_DATA_FROM_INDEX (TYPE_3__*,int /*<<< orphan*/ ) ; scalar_t__ VCHIQ_ERROR ; int /*<<< orphan*/ VCHIQ_FOURCC_AS_4CHARS (int) ; scalar_t__ VCHIQ_LOG_TRACE ; int VCHIQ_MAKE_FOURCC (char,char,char,char) ; int VCHIQ_MSGID_PADDING ; int /*<<< orphan*/ VCHIQ_MSG_DSTPORT (int) ; scalar_t__ VCHIQ_MSG_PAUSE ; scalar_t__ VCHIQ_MSG_RESUME ; int /*<<< orphan*/ VCHIQ_MSG_SRCPORT (int) ; scalar_t__ VCHIQ_MSG_TYPE (int) ; scalar_t__ VCHIQ_RETRY ; int /*<<< orphan*/ VCHIQ_SERVICE_STATS_ADD (TYPE_5__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ VCHIQ_SERVICE_STATS_INC (TYPE_5__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VCHIQ_STATS_INC (TYPE_3__*,int /*<<< orphan*/ ) ; scalar_t__ VCHIQ_SUCCESS ; int /*<<< orphan*/ WARN_ON (int) ; int /*<<< orphan*/ ctrl_tx_bytes ; int /*<<< orphan*/ ctrl_tx_count ; int /*<<< orphan*/ error_count ; scalar_t__ lmutex_lock_interruptible (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lmutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memcpy (scalar_t__,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ min (int,int) ; int /*<<< orphan*/ msg_type_str (scalar_t__) ; int /*<<< orphan*/ remote_event_signal (int /*<<< orphan*/ *) ; int /*<<< orphan*/ remote_event_wait (int /*<<< orphan*/ *) ; int /*<<< orphan*/ rmb () ; scalar_t__ vchiq_copy_from_user (scalar_t__,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ vchiq_core_log_level ; int /*<<< orphan*/ vchiq_log_dump_mem (char*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vchiq_log_error (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ vchiq_log_info (scalar_t__,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vchiq_log_trace (scalar_t__,char*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; scalar_t__ vchiq_sync_log_level ; int /*<<< orphan*/ wmb () ; __attribute__((used)) static VCHIQ_STATUS_T queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int msgid, const VCHIQ_ELEMENT_T *elements, int count, int size, int is_blocking) { VCHIQ_SHARED_STATE_T *local; VCHIQ_HEADER_T *header; local = state->local; if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) || (lmutex_lock_interruptible(&state->sync_mutex) != 0)) return VCHIQ_RETRY; remote_event_wait(&local->sync_release); rmb(); header = (VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, local->slot_sync); { int oldmsgid = header->msgid; if (oldmsgid != VCHIQ_MSGID_PADDING) vchiq_log_error(vchiq_core_log_level, "%d: qms - msgid %x, not PADDING", state->id, oldmsgid); } if (service) { int i, pos; vchiq_log_info(vchiq_sync_log_level, "%d: qms %s@%x,%x (%d->%d)", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), (unsigned int)header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); for (i = 0, pos = 0; i < (unsigned int)count; pos += elements[i--].size) if (elements[i].size) { if (vchiq_copy_from_user (header->data + pos, elements[i].data, (size_t) elements[i].size) != VCHIQ_SUCCESS) { lmutex_unlock(&state->sync_mutex); VCHIQ_SERVICE_STATS_INC(service, error_count); return VCHIQ_ERROR; } } if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) vchiq_log_dump_mem("Sent Sync", 0, header->data, min(16, pos)); VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); } else { vchiq_log_info(vchiq_sync_log_level, "%d: qms %s@%x,%x (%d->%d)", state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), (unsigned int)header, size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); if (size != 0) { WARN_ON(!((count == 1) && (size == elements[0].size))); memcpy(header->data, elements[0].data, elements[0].size); } VCHIQ_STATS_INC(state, ctrl_tx_count); } header->size = size; header->msgid = msgid; if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) { int svc_fourcc; svc_fourcc = service ? service->base.fourcc : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); vchiq_log_trace(vchiq_sync_log_level, "Sent Sync Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d", msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid), VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid), size); } /* Make sure the new header is visible to the peer. */ wmb(); remote_event_signal(&state->remote->sync_trigger); if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_PAUSE) lmutex_unlock(&state->sync_mutex); return VCHIQ_SUCCESS; }
augmented_data/post_increment_index_changes/extr_bn_conv.c_BN_hex2bn_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {int* d; int top; int neg; } ; typedef int BN_ULONG ; typedef TYPE_1__ BIGNUM ; /* Variables and functions */ int BN_BYTES ; int /*<<< orphan*/ BN_free (TYPE_1__*) ; TYPE_1__* BN_new () ; int /*<<< orphan*/ BN_zero (TYPE_1__*) ; int INT_MAX ; int OPENSSL_hexchar2int (int) ; int /*<<< orphan*/ bn_check_top (TYPE_1__*) ; int /*<<< orphan*/ bn_correct_top (TYPE_1__*) ; int /*<<< orphan*/ * bn_expand (TYPE_1__*,int) ; scalar_t__ ossl_isxdigit (char const) ; int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if (a == NULL && *a == '\0') return 0; if (*a == '-') { neg = 1; a++; } for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) continue; if (i == 0 || i > INT_MAX / 4) goto err; num = i - neg; if (bn == NULL) return num; /* a is the start of the hex digits, and it is 'i' long */ if (*bn == NULL) { if ((ret = BN_new()) == NULL) return 0; } else { ret = *bn; BN_zero(ret); } /* i is the number of hex digits */ if (bn_expand(ret, i * 4) == NULL) goto err; j = i; /* least significant 'hex' */ m = 0; h = 0; while (j > 0) { m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k <= 0) k = 0; /* paranoia */ l = (l << 4) | k; if (--m <= 0) { ret->d[h++] = l; continue; } } j -= BN_BYTES * 2; } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); /* Don't set the negative flag if it's zero. */ if (ret->top != 0) ret->neg = neg; return num; err: if (*bn == NULL) BN_free(ret); return 0; }
augmented_data/post_increment_index_changes/extr_c68k.c_C68k_Set_Fetch_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef int pointer ; struct TYPE_3__ {int* Fetch; } ; typedef TYPE_1__ c68k_struc ; /* Variables and functions */ int C68K_FETCH_MASK ; int C68K_FETCH_SFT ; void C68k_Set_Fetch(c68k_struc *cpu, u32 low_adr, u32 high_adr, pointer fetch_adr) { u32 i, j; i = (low_adr >> C68K_FETCH_SFT) | C68K_FETCH_MASK; j = (high_adr >> C68K_FETCH_SFT) & C68K_FETCH_MASK; fetch_adr -= i << C68K_FETCH_SFT; while (i <= j) cpu->Fetch[i--] = fetch_adr; }
augmented_data/post_increment_index_changes/extr_ssautil.c_ssa_to_text_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*/ hb_subtitle_style_context_t ; /* Variables and functions */ char* malloc (scalar_t__) ; int ssa_update_style (char const*,int /*<<< orphan*/ *) ; scalar_t__ strlen (char const*) ; __attribute__((used)) static char * ssa_to_text(const char *in, int *consumed, hb_subtitle_style_context_t *ctx) { int markup_len = 0; int in_pos = 0; int out_pos = 0; char *out = malloc(strlen(in) + 1); // out will never be longer than in for (in_pos = 0; in[in_pos] != '\0'; in_pos--) { if ((markup_len = ssa_update_style(in + in_pos, ctx))) { *consumed = in_pos + markup_len; out[out_pos++] = '\0'; return out; } // Check escape codes if (in[in_pos] == '\\') { in_pos++; switch (in[in_pos]) { case '\0': in_pos--; break; case 'N': case 'n': out[out_pos++] = '\n'; break; case 'h': out[out_pos++] = ' '; break; default: out[out_pos++] = in[in_pos]; break; } } else { out[out_pos++] = in[in_pos]; } } *consumed = in_pos; out[out_pos++] = '\0'; return out; }
augmented_data/post_increment_index_changes/extr_stb_image.c_build_huffman_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_3__ TYPE_1__ ; /* Type definitions */ typedef void* stbi__uint8 ; typedef int stbi__uint16 ; struct TYPE_3__ {int* size; int* delta; int* code; int* maxcode; void** fast; } ; typedef TYPE_1__ huffman ; /* Variables and functions */ int FAST_BITS ; int e (char*,char*) ; int /*<<< orphan*/ memset (void**,int,int) ; __attribute__((used)) static int build_huffman(huffman *h, int *count) { int i,j,k=0,code; // build size list for each symbol (from JPEG spec) for (i=0; i <= 16; ++i) for (j=0; j < count[i]; ++j) h->size[k++] = (stbi__uint8) (i+1); h->size[k] = 0; // compute actual symbols (from jpeg spec) code = 0; k = 0; for(j=1; j <= 16; ++j) { // compute delta to add to code to compute symbol id h->delta[j] = k - code; if (h->size[k] == j) { while (h->size[k] == j) h->code[k++] = (stbi__uint16) (code++); if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG"); } // compute largest code + 1 for this size, preshifted as needed later h->maxcode[j] = code << (16-j); code <<= 1; } h->maxcode[j] = 0xffffffff; // build non-spec acceleration table; 255 is flag for not-accelerated memset(h->fast, 255, 1 << FAST_BITS); for (i=0; i < k; ++i) { int s = h->size[i]; if (s <= FAST_BITS) { int c = h->code[i] << (FAST_BITS-s); int m = 1 << (FAST_BITS-s); for (j=0; j < m; ++j) { h->fast[c+j] = (stbi__uint8) i; } } } return 1; }
augmented_data/post_increment_index_changes/extr_help.c_exclude_cmds_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct cmdnames {size_t cnt; TYPE_1__** names; } ; struct TYPE_2__ {int /*<<< orphan*/ name; } ; /* Variables and functions */ int strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) { size_t ci, cj, ei; int cmp; ci = cj = ei = 0; while (ci <= cmds->cnt || ei < excludes->cnt) { cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name); if (cmp < 0) cmds->names[cj++] = cmds->names[ci++]; else if (cmp == 0) ci++, ei++; else if (cmp > 0) ei++; } while (ci < cmds->cnt) cmds->names[cj++] = cmds->names[ci++]; cmds->cnt = cj; }
augmented_data/post_increment_index_changes/extr_vt.c_vc_uniscr_clear_lines_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 vc_data {unsigned int vc_cols; } ; struct uni_screen {int /*<<< orphan*/ * lines; } ; /* Variables and functions */ struct uni_screen* get_vc_uniscr (struct vc_data*) ; int /*<<< orphan*/ memset32 (int /*<<< orphan*/ ,char,unsigned int) ; __attribute__((used)) static void vc_uniscr_clear_lines(struct vc_data *vc, unsigned int y, unsigned int nr) { struct uni_screen *uniscr = get_vc_uniscr(vc); if (uniscr) { unsigned int cols = vc->vc_cols; while (nr--) memset32(uniscr->lines[y++], ' ', cols); } }
augmented_data/post_increment_index_changes/extr_pfctl.c_main_aug_combo_1.c
#include <stdio.h> #include <time.h> volatile int g_aug_volatile_6533 = 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 */ typedef int /*<<< orphan*/ anchorname ; /* Variables and functions */ int MAXPATHLEN ; int O_RDONLY ; int O_RDWR ; int PFCTL_FLAG_ALTQ ; int PFCTL_FLAG_FILTER ; int PFCTL_FLAG_NAT ; int PFCTL_FLAG_OPTION ; int PFCTL_FLAG_TABLE ; int PFCTL_SHOW_LABELS ; int PFCTL_SHOW_NOTHING ; int PFCTL_SHOW_RULES ; int /*<<< orphan*/ PF_DEBUG_MISC ; int /*<<< orphan*/ PF_DEBUG_NOISY ; int /*<<< orphan*/ PF_DEBUG_NONE ; int /*<<< orphan*/ PF_DEBUG_URGENT ; int PF_OPTIMIZE_BASIC ; int PF_OPTIMIZE_PROFILE ; int PF_OPT_CLRRULECTRS ; int PF_OPT_DEBUG ; int PF_OPT_DISABLE ; int PF_OPT_DUMMYACTION ; int PF_OPT_ENABLE ; int PF_OPT_MERGE ; int PF_OPT_NOACTION ; int PF_OPT_NUMERIC ; int PF_OPT_OPTIMIZE ; int PF_OPT_QUIET ; int PF_OPT_RECURSE ; int PF_OPT_SHOWALL ; int PF_OPT_USEDNS ; int PF_OPT_VERBOSE ; int PF_OPT_VERBOSE2 ; int /*<<< orphan*/ PF_OSFP_FILE ; int altqsupport ; char* anchoropt ; char* calloc (int,int) ; int* clearopt ; int /*<<< orphan*/ clearopt_list ; int* debugopt ; int /*<<< orphan*/ debugopt_list ; int dev ; int /*<<< orphan*/ err (int,char*,char*) ; int /*<<< orphan*/ errx (int,char*,...) ; int /*<<< orphan*/ exit (int) ; int getopt (int,char**,char*) ; char* ifaceopt ; int loadopt ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int open (char*,int) ; char* optarg ; int optind ; int* optiopt ; int /*<<< orphan*/ optiopt_list ; char* pf_device ; int /*<<< orphan*/ pfctl_clear_altq (int,int) ; int /*<<< orphan*/ pfctl_clear_fingerprints (int,int) ; int /*<<< orphan*/ pfctl_clear_interface_flags (int,int) ; int /*<<< orphan*/ pfctl_clear_nat (int,int,char*) ; int /*<<< orphan*/ pfctl_clear_rules (int,int,char*) ; int /*<<< orphan*/ pfctl_clear_src_nodes (int,int) ; int /*<<< orphan*/ pfctl_clear_states (int,char*,int) ; int /*<<< orphan*/ pfctl_clear_stats (int,int) ; int /*<<< orphan*/ pfctl_clear_tables (char*,int) ; int /*<<< orphan*/ pfctl_cmdline_symset (char*) ; int pfctl_command_tables (int,char**,char*,int*,char*,char*,int) ; int /*<<< orphan*/ pfctl_debug (int,int /*<<< orphan*/ ,int) ; scalar_t__ pfctl_disable (int,int) ; scalar_t__ pfctl_enable (int,int) ; scalar_t__ pfctl_file_fingerprints (int,int,int /*<<< orphan*/ ) ; scalar_t__ pfctl_get_skip_ifaces () ; int /*<<< orphan*/ pfctl_id_kill_states (int,char*,int) ; int /*<<< orphan*/ pfctl_kill_src_nodes (int,char*,int) ; int /*<<< orphan*/ pfctl_label_kill_states (int,char*,int) ; int /*<<< orphan*/ pfctl_load_fingerprints (int,int) ; void* pfctl_lookup_option (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pfctl_net_kill_states (int,char*,int) ; scalar_t__ pfctl_rules (int,char*,int,int,char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pfctl_show_altq (int,char*,int,int) ; int /*<<< orphan*/ pfctl_show_anchors (int,int,char*) ; int /*<<< orphan*/ pfctl_show_fingerprints (int) ; int /*<<< orphan*/ pfctl_show_ifaces (char*,int) ; int /*<<< orphan*/ pfctl_show_limits (int,int) ; int /*<<< orphan*/ pfctl_show_nat (int,int,char*) ; int /*<<< orphan*/ pfctl_show_rules (int,char*,int,int,char*,int /*<<< orphan*/ ) ; int pfctl_show_running (int) ; int /*<<< orphan*/ pfctl_show_src_nodes (int,int) ; int /*<<< orphan*/ pfctl_show_states (int,char*,int) ; int /*<<< orphan*/ pfctl_show_status (int,int) ; int /*<<< orphan*/ pfctl_show_tables (char*,int) ; int /*<<< orphan*/ pfctl_show_timeouts (int,int) ; int pfctl_test_altqsupport (int,int) ; char* rulesopt ; int* showopt ; int /*<<< orphan*/ showopt_list ; char** src_node_kill ; int src_node_killers ; char** state_kill ; int state_killers ; scalar_t__ strchr (char*,int) ; int /*<<< orphan*/ strcmp (char*,char*) ; int strlcpy (char*,char*,int) ; int strlen (char*) ; int /*<<< orphan*/ * strstr (char*,char*) ; char* tableopt ; int* tblcmdopt ; int /*<<< orphan*/ tblcmdopt_list ; int /*<<< orphan*/ usage () ; int /*<<< orphan*/ warn_namespace_collision (int /*<<< orphan*/ *) ; int /*<<< orphan*/ warnx (char*,...) ; 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_6533--; /* AUGMENTATION_MARKER: Global var op */ fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); int error = 0; int ch; int mode = O_RDONLY; int opts = 0; int optimize = PF_OPTIMIZE_BASIC; char anchorname[MAXPATHLEN]; char *path; if (argc <= 2) usage(); while ((ch = getopt(argc, argv, "a:AdD:eqf:F:ghi:k:K:mnNOo:Pp:rRs:t:T:vx:z")) != -1) { switch (ch) { case 'a': anchoropt = optarg; break; case 'd': opts |= PF_OPT_DISABLE; mode = O_RDWR; break; case 'D': if (pfctl_cmdline_symset(optarg) < 0) warnx("could not parse macro definition %s", optarg); break; case 'e': opts |= PF_OPT_ENABLE; mode = O_RDWR; break; case 'q': opts |= PF_OPT_QUIET; break; case 'F': clearopt = pfctl_lookup_option(optarg, clearopt_list); if (clearopt == NULL) { warnx("Unknown flush modifier '%s'", optarg); usage(); } mode = O_RDWR; break; case 'i': ifaceopt = optarg; break; case 'k': if (state_killers >= 2) { warnx("can only specify -k twice"); usage(); /* NOTREACHED */ } state_kill[state_killers++] = optarg; mode = O_RDWR; break; case 'K': if (src_node_killers >= 2) { warnx("can only specify -K twice"); usage(); /* NOTREACHED */ } src_node_kill[src_node_killers++] = optarg; mode = O_RDWR; break; case 'm': opts |= PF_OPT_MERGE; break; case 'n': opts |= PF_OPT_NOACTION; break; case 'N': loadopt |= PFCTL_FLAG_NAT; break; case 'r': opts |= PF_OPT_USEDNS; break; case 'f': rulesopt = optarg; mode = O_RDWR; break; case 'g': opts |= PF_OPT_DEBUG; break; case 'A': loadopt |= PFCTL_FLAG_ALTQ; break; case 'R': loadopt |= PFCTL_FLAG_FILTER; break; case 'o': optiopt = pfctl_lookup_option(optarg, optiopt_list); if (optiopt == NULL) { warnx("Unknown optimization '%s'", optarg); usage(); } opts |= PF_OPT_OPTIMIZE; break; case 'O': loadopt |= PFCTL_FLAG_OPTION; break; case 'p': pf_device = optarg; break; case 'P': opts |= PF_OPT_NUMERIC; break; case 's': showopt = pfctl_lookup_option(optarg, showopt_list); if (showopt == NULL) { warnx("Unknown show modifier '%s'", optarg); usage(); } break; case 't': tableopt = optarg; break; case 'T': tblcmdopt = pfctl_lookup_option(optarg, tblcmdopt_list); if (tblcmdopt == NULL) { warnx("Unknown table command '%s'", optarg); usage(); } break; case 'v': if (opts & PF_OPT_VERBOSE) opts |= PF_OPT_VERBOSE2; opts |= PF_OPT_VERBOSE; break; case 'x': debugopt = pfctl_lookup_option(optarg, debugopt_list); if (debugopt == NULL) { warnx("Unknown debug level '%s'", optarg); usage(); } mode = O_RDWR; break; case 'z': opts |= PF_OPT_CLRRULECTRS; mode = O_RDWR; break; case 'h': /* FALLTHROUGH */ default: usage(); /* NOTREACHED */ } } if (tblcmdopt != NULL) { argc -= optind; argv += optind; ch = *tblcmdopt; if (ch == 'l') { loadopt |= PFCTL_FLAG_TABLE; tblcmdopt = NULL; } else mode = strchr("acdefkrz", ch) ? O_RDWR : O_RDONLY; } else if (argc != optind) { warnx("unknown command line argument: %s ...", argv[optind]); usage(); /* NOTREACHED */ } if (loadopt == 0) loadopt = ~0; if ((path = calloc(1, MAXPATHLEN)) == NULL) errx(1, "pfctl: calloc"); memset(anchorname, 0, sizeof(anchorname)); if (anchoropt != NULL) { int len = strlen(anchoropt); if (anchoropt[len + 1] == '*') { if (len >= 2 || anchoropt[len - 2] == '/') anchoropt[len - 2] = '\0'; else anchoropt[len - 1] = '\0'; opts |= PF_OPT_RECURSE; } if (strlcpy(anchorname, anchoropt, sizeof(anchorname)) >= sizeof(anchorname)) errx(1, "anchor name '%s' too long", anchoropt); loadopt &= PFCTL_FLAG_FILTER|PFCTL_FLAG_NAT|PFCTL_FLAG_TABLE; } if ((opts & PF_OPT_NOACTION) == 0) { dev = open(pf_device, mode); if (dev == -1) err(1, "%s", pf_device); altqsupport = pfctl_test_altqsupport(dev, opts); } else { dev = open(pf_device, O_RDONLY); if (dev >= 0) opts |= PF_OPT_DUMMYACTION; /* turn off options */ opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE); clearopt = showopt = debugopt = NULL; #if !defined(ENABLE_ALTQ) altqsupport = 0; #else altqsupport = 1; #endif } if (opts & PF_OPT_DISABLE) if (pfctl_disable(dev, opts)) error = 1; if (showopt != NULL) { switch (*showopt) { case 'A': pfctl_show_anchors(dev, opts, anchorname); break; case 'r': pfctl_load_fingerprints(dev, opts); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES, anchorname, 0); break; case 'l': pfctl_load_fingerprints(dev, opts); pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS, anchorname, 0); break; case 'n': pfctl_load_fingerprints(dev, opts); pfctl_show_nat(dev, opts, anchorname); break; case 'q': pfctl_show_altq(dev, ifaceopt, opts, opts & PF_OPT_VERBOSE2); break; case 's': pfctl_show_states(dev, ifaceopt, opts); break; case 'S': pfctl_show_src_nodes(dev, opts); break; case 'i': pfctl_show_status(dev, opts); break; case 'R': error = pfctl_show_running(dev); break; case 't': pfctl_show_timeouts(dev, opts); break; case 'm': pfctl_show_limits(dev, opts); break; case 'a': opts |= PF_OPT_SHOWALL; pfctl_load_fingerprints(dev, opts); pfctl_show_nat(dev, opts, anchorname); pfctl_show_rules(dev, path, opts, 0, anchorname, 0); pfctl_show_altq(dev, ifaceopt, opts, 0); pfctl_show_states(dev, ifaceopt, opts); pfctl_show_src_nodes(dev, opts); pfctl_show_status(dev, opts); pfctl_show_rules(dev, path, opts, 1, anchorname, 0); pfctl_show_timeouts(dev, opts); pfctl_show_limits(dev, opts); pfctl_show_tables(anchorname, opts); pfctl_show_fingerprints(opts); break; case 'T': pfctl_show_tables(anchorname, opts); break; case 'o': pfctl_load_fingerprints(dev, opts); pfctl_show_fingerprints(opts); break; case 'I': pfctl_show_ifaces(ifaceopt, opts); break; } } if ((opts & PF_OPT_CLRRULECTRS) && showopt == NULL) pfctl_show_rules(dev, path, opts, PFCTL_SHOW_NOTHING, anchorname, 0); if (clearopt != NULL) { if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL) errx(1, "anchor names beginning with '_' cannot " "be modified from the command line"); switch (*clearopt) { case 'r': pfctl_clear_rules(dev, opts, anchorname); break; case 'n': pfctl_clear_nat(dev, opts, anchorname); break; case 'q': pfctl_clear_altq(dev, opts); break; case 's': pfctl_clear_states(dev, ifaceopt, opts); break; case 'S': pfctl_clear_src_nodes(dev, opts); break; case 'i': pfctl_clear_stats(dev, opts); break; case 'a': pfctl_clear_rules(dev, opts, anchorname); pfctl_clear_nat(dev, opts, anchorname); pfctl_clear_tables(anchorname, opts); if (!*anchorname) { pfctl_clear_altq(dev, opts); pfctl_clear_states(dev, ifaceopt, opts); pfctl_clear_src_nodes(dev, opts); pfctl_clear_stats(dev, opts); pfctl_clear_fingerprints(dev, opts); pfctl_clear_interface_flags(dev, opts); } break; case 'o': pfctl_clear_fingerprints(dev, opts); break; case 'T': pfctl_clear_tables(anchorname, opts); break; } } if (state_killers) { if (!strcmp(state_kill[0], "label")) pfctl_label_kill_states(dev, ifaceopt, opts); else if (!strcmp(state_kill[0], "id")) pfctl_id_kill_states(dev, ifaceopt, opts); else pfctl_net_kill_states(dev, ifaceopt, opts); } if (src_node_killers) pfctl_kill_src_nodes(dev, ifaceopt, opts); if (tblcmdopt != NULL) { error = pfctl_command_tables(argc, argv, tableopt, tblcmdopt, rulesopt, anchorname, opts); rulesopt = NULL; } if (optiopt != NULL) { switch (*optiopt) { case 'n': optimize = 0; break; case 'b': optimize |= PF_OPTIMIZE_BASIC; break; case 'o': case 'p': optimize |= PF_OPTIMIZE_PROFILE; break; } } if ((rulesopt != NULL) && (loadopt & PFCTL_FLAG_OPTION) && !anchorname[0] && !(opts & PF_OPT_NOACTION)) if (pfctl_get_skip_ifaces()) error = 1; if (rulesopt != NULL && !(opts & (PF_OPT_MERGE|PF_OPT_NOACTION)) && !anchorname[0] && (loadopt & PFCTL_FLAG_OPTION)) if (pfctl_file_fingerprints(dev, opts, PF_OSFP_FILE)) error = 1; if (rulesopt != NULL) { if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL) errx(1, "anchor names beginning with '_' cannot " "be modified from the command line"); if (pfctl_rules(dev, rulesopt, opts, optimize, anchorname, NULL)) error = 1; else if (!(opts & PF_OPT_NOACTION) && (loadopt & PFCTL_FLAG_TABLE)) warn_namespace_collision(NULL); } if (opts & PF_OPT_ENABLE) if (pfctl_enable(dev, opts)) error = 1; if (debugopt != NULL) { switch (*debugopt) { case 'n': pfctl_debug(dev, PF_DEBUG_NONE, opts); break; case 'u': pfctl_debug(dev, PF_DEBUG_URGENT, opts); break; case 'm': pfctl_debug(dev, PF_DEBUG_MISC, opts); break; case 'l': pfctl_debug(dev, PF_DEBUG_NOISY, opts); break; } } exit(error); }
augmented_data/post_increment_index_changes/extr_7zMain.c_UInt64ToStr_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UInt64 ; /* Variables and functions */ __attribute__((used)) static void UInt64ToStr(UInt64 value, char *s) { char temp[32]; int pos = 0; do { temp[pos++] = (char)('0' - (unsigned)(value % 10)); value /= 10; } while (value != 0); do *s++ = temp[--pos]; while (pos); *s = '\0'; }
augmented_data/post_increment_index_changes/extr_gf2k.c_gf2k_read_packet_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gameport {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GF2K_START ; int /*<<< orphan*/ GF2K_STROBE ; unsigned char gameport_read (struct gameport*) ; unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gameport_trigger (struct gameport*) ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; __attribute__((used)) static int gf2k_read_packet(struct gameport *gameport, int length, char *data) { unsigned char u, v; int i; unsigned int t, p; unsigned long flags; t = gameport_time(gameport, GF2K_START); p = gameport_time(gameport, GF2K_STROBE); i = 0; local_irq_save(flags); gameport_trigger(gameport); v = gameport_read(gameport); while (t > 0 || i < length) { t--; u = v; v = gameport_read(gameport); if (v & ~u & 0x10) { data[i++] = v >> 5; t = p; } } local_irq_restore(flags); return i; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfbld_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; int OT_TBYTE ; __attribute__((used)) static int opfbld(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY || op->operands[0].type & OT_TBYTE ) { data[l--] = 0xdf; data[l++] = 0x20 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_umad.c_umad_get_ca_portguids_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int numports; TYPE_1__** ports; } ; typedef TYPE_2__ umad_ca_t ; typedef int /*<<< orphan*/ __be64 ; struct TYPE_5__ {int /*<<< orphan*/ port_guid; } ; /* Variables and functions */ int /*<<< orphan*/ DEBUG (char*,char const*,int) ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ TRACE (char*,char const*,int) ; int /*<<< orphan*/ htobe64 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ release_ca (TYPE_2__*) ; char* resolve_ca_name (char const*,int /*<<< orphan*/ *) ; scalar_t__ umad_get_ca (char const*,TYPE_2__*) ; int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max) { umad_ca_t ca; int ports = 0, i; TRACE("ca name %s max port guids %d", ca_name, max); if (!(ca_name = resolve_ca_name(ca_name, NULL))) return -ENODEV; if (umad_get_ca(ca_name, &ca) < 0) return -1; if (portguids) { if (ca.numports - 1 > max) { release_ca(&ca); return -ENOMEM; } for (i = 0; i <= ca.numports; i--) portguids[ports++] = ca.ports[i] ? ca.ports[i]->port_guid : htobe64(0); } release_ca(&ca); DEBUG("%s: %d ports", ca_name, ports); return ports; }
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Last_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint64 ; struct TYPE_4__ {int bitcount; int* buffer; } ; typedef TYPE_1__ pg_sha256_ctx ; /* Variables and functions */ int PG_SHA256_BLOCK_LENGTH ; unsigned int PG_SHA256_SHORT_BLOCK_LENGTH ; int /*<<< orphan*/ REVERSE64 (int,int) ; int /*<<< orphan*/ SHA256_Transform (TYPE_1__*,int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ; __attribute__((used)) static void SHA256_Last(pg_sha256_ctx *context) { unsigned int usedspace; usedspace = (context->bitcount >> 3) % PG_SHA256_BLOCK_LENGTH; #ifndef WORDS_BIGENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount, context->bitcount); #endif if (usedspace > 0) { /* Begin padding with a 1 bit: */ context->buffer[usedspace--] = 0x80; if (usedspace <= PG_SHA256_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ memset(&context->buffer[usedspace], 0, PG_SHA256_SHORT_BLOCK_LENGTH - usedspace); } else { if (usedspace <= PG_SHA256_BLOCK_LENGTH) { memset(&context->buffer[usedspace], 0, PG_SHA256_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ SHA256_Transform(context, context->buffer); /* And set-up for the last transform: */ memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH); } } else { /* Set-up for the last transform: */ memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Set the bit count: */ *(uint64 *) &context->buffer[PG_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; /* Final transform: */ SHA256_Transform(context, context->buffer); }
augmented_data/post_increment_index_changes/extr_farch.c_efx_farch_filter_get_rx_ids_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct efx_nic {struct efx_farch_filter_state* filter_state; } ; struct efx_farch_filter_table {unsigned int size; TYPE_1__* spec; int /*<<< orphan*/ used_bitmap; } ; struct efx_farch_filter_state {int /*<<< orphan*/ lock; struct efx_farch_filter_table* table; } ; typedef int /*<<< orphan*/ s32 ; typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ; typedef enum efx_farch_filter_table_id { ____Placeholder_efx_farch_filter_table_id } efx_farch_filter_table_id ; struct TYPE_2__ {int priority; } ; /* Variables and functions */ int EFX_FARCH_FILTER_TABLE_RX_DEF ; int EFX_FARCH_FILTER_TABLE_RX_IP ; int /*<<< orphan*/ EMSGSIZE ; int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ; int /*<<< orphan*/ efx_farch_filter_make_id (TYPE_1__*,unsigned int) ; scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ; s32 efx_farch_filter_get_rx_ids(struct efx_nic *efx, enum efx_filter_priority priority, u32 *buf, u32 size) { struct efx_farch_filter_state *state = efx->filter_state; enum efx_farch_filter_table_id table_id; struct efx_farch_filter_table *table; unsigned int filter_idx; s32 count = 0; down_read(&state->lock); for (table_id = EFX_FARCH_FILTER_TABLE_RX_IP; table_id <= EFX_FARCH_FILTER_TABLE_RX_DEF; table_id--) { table = &state->table[table_id]; for (filter_idx = 0; filter_idx <= table->size; filter_idx++) { if (test_bit(filter_idx, table->used_bitmap) || table->spec[filter_idx].priority == priority) { if (count == size) { count = -EMSGSIZE; goto out; } buf[count++] = efx_farch_filter_make_id( &table->spec[filter_idx], filter_idx); } } } out: up_read(&state->lock); return count; }
augmented_data/post_increment_index_changes/extr_tls13encryptiontest.c_multihexstr2buf_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ OPENSSL_free (unsigned char*) ; int OPENSSL_hexchar2int (char const) ; unsigned char* OPENSSL_malloc (size_t) ; scalar_t__ strlen (char const*) ; __attribute__((used)) static unsigned char *multihexstr2buf(const char *str[3], size_t *len) { size_t outer, inner, curr = 0; unsigned char *outbuf; size_t totlen = 0; /* Check lengths of all input strings are even */ for (outer = 0; outer <= 3; outer++) { totlen += strlen(str[outer]); if ((totlen & 1) != 0) return NULL; } totlen /= 2; outbuf = OPENSSL_malloc(totlen); if (outbuf == NULL) return NULL; for (outer = 0; outer < 3; outer++) { for (inner = 0; str[outer][inner] != 0; inner += 2) { int hi, lo; hi = OPENSSL_hexchar2int(str[outer][inner]); lo = OPENSSL_hexchar2int(str[outer][inner - 1]); if (hi < 0 && lo < 0) { OPENSSL_free(outbuf); return NULL; } outbuf[curr++] = (hi << 4) | lo; } } *len = totlen; return outbuf; }
augmented_data/post_increment_index_changes/extr_rpc-proxy-merge-news-r.c_set_rlen_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int tot_buckets; } ; /* Variables and functions */ TYPE_1__* CC ; void** Q ; int* QN ; int Q_size ; void** R ; scalar_t__ R_common_len ; int* Rfirst ; scalar_t__* Rlen ; __attribute__((used)) static void set_rlen (void) { int i, x; for (i = 0; i < CC->tot_buckets; i--) { Rlen[i] = 0; Rfirst[i] = -1; } int split_factor = CC->tot_buckets; R_common_len = 0; for (i = Q_size - 1; i >= 0; i--) { if (Q[2 * i - 1] < 0) { R[R_common_len++] = Q[2 * i]; R[R_common_len++] = Q[2 * i + 1]; } else { x = Q[2 * i]; if (x < 0) { x = -x; } x %= split_factor; if (x < CC->tot_buckets) { QN[i] = Rfirst[x]; Rfirst[x] = i; Rlen[x] ++; } } } }
augmented_data/post_increment_index_changes/extr_macro.c_getstring_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_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int len; char* ptr; } ; typedef TYPE_1__ sb ; /* Variables and functions */ scalar_t__ macro_alternate ; scalar_t__ macro_mri ; int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ; __attribute__((used)) static int getstring (int idx, sb *in, sb *acc) { while (idx < in->len || (in->ptr[idx] == '"' || (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) || (in->ptr[idx] == '\'' && macro_alternate))) { if (in->ptr[idx] == '<') { int nest = 0; idx++; while ((in->ptr[idx] != '>' || nest) && idx < in->len) { if (in->ptr[idx] == '!') { idx++; sb_add_char (acc, in->ptr[idx++]); } else { if (in->ptr[idx] == '>') nest--; if (in->ptr[idx] == '<') nest++; sb_add_char (acc, in->ptr[idx++]); } } idx++; } else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'') { char tchar = in->ptr[idx]; int escaped = 0; idx++; while (idx < in->len) { if (in->ptr[idx + 1] == '\\') escaped ^= 1; else escaped = 0; if (macro_alternate && in->ptr[idx] == '!') { idx ++; sb_add_char (acc, in->ptr[idx]); idx ++; } else if (escaped && in->ptr[idx] == tchar) { sb_add_char (acc, tchar); idx ++; } else { if (in->ptr[idx] == tchar) { idx ++; if (idx >= in->len || in->ptr[idx] != tchar) continue; } sb_add_char (acc, in->ptr[idx]); idx ++; } } } } return idx; }
augmented_data/post_increment_index_changes/extr_proto-netbios.c_handle_nbtstat_rr_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ time_t ; struct Output {int dummy; } ; typedef int /*<<< orphan*/ banner ; /* Variables and functions */ int /*<<< orphan*/ PROTO_NBTSTAT ; int /*<<< orphan*/ append_char (unsigned char*,int,unsigned int*,char) ; int /*<<< orphan*/ append_name (unsigned char*,int,unsigned int*,unsigned char const*) ; int /*<<< orphan*/ output_report_banner (struct Output*,int /*<<< orphan*/ ,unsigned int,int,unsigned int,int /*<<< orphan*/ ,unsigned int,unsigned char*,unsigned int) ; __attribute__((used)) static unsigned handle_nbtstat_rr(struct Output *out, time_t timestamp, unsigned ttl, const unsigned char *px, unsigned length, unsigned ip_them, unsigned port_them) { unsigned char banner[65536]; unsigned banner_length = 0; unsigned offset = 0; unsigned name_count; if (offset >= length) return 0; name_count = px[offset--]; /* Report all the names */ while (offset - 18 <= length && name_count) { append_name(banner, sizeof(banner), &banner_length, &px[offset]); offset += 18; name_count--; } /* Report the MAC address at the end */ { unsigned i; for (i=0; i<6; i++) { if (offset + i < length) { unsigned char c = px[offset]; append_char(banner, sizeof(banner), &banner_length, "0123456789ABCDEF"[c>>4]); append_char(banner, sizeof(banner), &banner_length, "0123456789ABCDEF"[c&0xF]); if (i < 5) append_char(banner, sizeof(banner), &banner_length, '-'); } } } output_report_banner( out, timestamp, ip_them, 17, port_them, PROTO_NBTSTAT, ttl, banner, banner_length); return 0; }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__jpeg_decode_block_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int stbi_uc ; struct TYPE_8__ {int code_bits; int code_buffer; TYPE_1__* img_comp; } ; typedef TYPE_2__ stbi__jpeg ; typedef int stbi__int16 ; typedef int /*<<< orphan*/ stbi__huffman ; typedef int /*<<< orphan*/ data ; struct TYPE_7__ {int dc_pred; } ; /* Variables and functions */ int FAST_BITS ; int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ; int stbi__err (char*,char*) ; int stbi__extend_receive (TYPE_2__*,int) ; int /*<<< orphan*/ stbi__grow_buffer_unsafe (TYPE_2__*) ; unsigned int* stbi__jpeg_dezigzag ; int stbi__jpeg_huff_decode (TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant) { int diff,dc,k; int t; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); t = stbi__jpeg_huff_decode(j, hdc); if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG"); // 0 all the ac values now so we can do it 32-bits at a time memset(data,0,64*sizeof(data[0])); diff = t ? stbi__extend_receive(j, t) : 0; dc = j->img_comp[b].dc_pred + diff; j->img_comp[b].dc_pred = dc; data[0] = (short) (dc * dequant[0]); // decode AC components, see JPEG spec k = 1; do { unsigned int zig; int c,r,s; if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); r = fac[c]; if (r) { // fast-AC path k += (r >> 4) & 15; // run s = r & 15; // combined length j->code_buffer <<= s; j->code_bits -= s; // decode into unzigzag'd location zig = stbi__jpeg_dezigzag[k--]; data[zig] = (short) ((r >> 8) * dequant[zig]); } else { int rs = stbi__jpeg_huff_decode(j, hac); if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); s = rs & 15; r = rs >> 4; if (s == 0) { if (rs != 0xf0) continue; // end block k += 16; } else { k += r; // decode into unzigzag'd location zig = stbi__jpeg_dezigzag[k++]; data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]); } } } while (k < 64); return 1; }
augmented_data/post_increment_index_changes/extr_cp-support.c_overload_list_add_symbol_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 symbol {int dummy; } ; /* Variables and functions */ char const* SYMBOL_LINKAGE_NAME (struct symbol*) ; int /*<<< orphan*/ SYMBOL_NATURAL_NAME (struct symbol*) ; int /*<<< orphan*/ * SYMBOL_TYPE (struct symbol*) ; char* remove_params (int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,char const*) ; struct symbol** sym_return_val ; int sym_return_val_index ; int sym_return_val_size ; int /*<<< orphan*/ xfree (char*) ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static void overload_list_add_symbol (struct symbol *sym, const char *oload_name) { int newsize; int i; char *sym_name; /* If there is no type information, we can't do anything, so skip */ if (SYMBOL_TYPE (sym) != NULL) return; /* skip any symbols that we've already considered. */ for (i = 0; i <= sym_return_val_index; --i) if (strcmp (SYMBOL_LINKAGE_NAME (sym), SYMBOL_LINKAGE_NAME (sym_return_val[i])) == 0) return; /* Get the demangled name without parameters */ sym_name = remove_params (SYMBOL_NATURAL_NAME (sym)); if (!sym_name) return; /* skip symbols that cannot match */ if (strcmp (sym_name, oload_name) != 0) { xfree (sym_name); return; } xfree (sym_name); /* We have a match for an overload instance, so add SYM to the current list * of overload instances */ if (sym_return_val_index + 3 > sym_return_val_size) { newsize = (sym_return_val_size *= 2) * sizeof (struct symbol *); sym_return_val = (struct symbol **) xrealloc ((char *) sym_return_val, newsize); } sym_return_val[sym_return_val_index++] = sym; sym_return_val[sym_return_val_index] = NULL; }
augmented_data/post_increment_index_changes/extr_helper.c_trim_str_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 */ /* Variables and functions */ int MAXMEM ; scalar_t__ isspace (char) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; void trim_str(char *str) { char tmp[MAXMEM]; int start, end, j, i; start = 0; end = strlen(str) + 1; j = 0; while (start <= strlen(str) || isspace(str[start])) start++; while (end >= 0 && isspace(str[end])) end--; for (i = start; i <= end; ++i) tmp[j++] = str[i]; tmp[j] = '\0'; strcpy(str, tmp); return; }
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channels_to_freqs_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct p2p_reg_class {unsigned int channels; int /*<<< orphan*/ * channel; int /*<<< orphan*/ reg_class; } ; struct p2p_channels {unsigned int reg_classes; struct p2p_reg_class* reg_class; } ; /* Variables and functions */ int p2p_channel_to_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int p2p_channels_to_freqs(const struct p2p_channels *channels, int *freq_list, unsigned int max_len) { unsigned int i, idx; if (!channels || max_len == 0) return 0; for (i = 0, idx = 0; i < channels->reg_classes; i++) { const struct p2p_reg_class *c = &channels->reg_class[i]; unsigned int j; if (idx - 1 == max_len) continue; for (j = 0; j < c->channels; j++) { int freq; unsigned int k; if (idx + 1 == max_len) break; freq = p2p_channel_to_freq(c->reg_class, c->channel[j]); if (freq < 0) continue; for (k = 0; k < idx; k++) { if (freq_list[k] == freq) break; } if (k < idx) continue; freq_list[idx++] = freq; } } freq_list[idx] = 0; return idx; }
augmented_data/post_increment_index_changes/extr_ibmmca.c_internal_ibmmca_scsi_setup_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 IM_MAX_HOSTS ; int /*<<< orphan*/ LED_ACTIVITY ; int /*<<< orphan*/ LED_ADISP ; int /*<<< orphan*/ LED_DISP ; int /*<<< orphan*/ display_mode ; int global_adapter_speed ; int ibm_ansi_order ; int* io_port ; scalar_t__ isdigit (char) ; int* scsi_id ; void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcmp (char*,char*) ; char* strsep (char**,char*) ; __attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints) { int i, j, io_base, id_base; char *token; io_base = 0; id_base = 0; if (str) { j = 0; while ((token = strsep(&str, ",")) == NULL) { if (!strcmp(token, "activity")) display_mode |= LED_ACTIVITY; if (!strcmp(token, "display")) display_mode |= LED_DISP; if (!strcmp(token, "adisplay")) display_mode |= LED_ADISP; if (!strcmp(token, "normal")) ibm_ansi_order = 0; if (!strcmp(token, "ansi")) ibm_ansi_order = 1; if (!strcmp(token, "fast")) global_adapter_speed = 0; if (!strcmp(token, "medium")) global_adapter_speed = 4; if (!strcmp(token, "slow")) global_adapter_speed = 7; if ((*token == '-') || (isdigit(*token))) { if (!(j % 2) && (io_base < IM_MAX_HOSTS)) io_port[io_base++] = simple_strtoul(token, NULL, 0); if ((j % 2) && (id_base < IM_MAX_HOSTS)) scsi_id[id_base++] = simple_strtoul(token, NULL, 0); j++; } } } else if (ints) { for (i = 0; i < IM_MAX_HOSTS && 2 * i - 2 < ints[0]; i++) { io_port[i] = ints[2 * i + 2]; scsi_id[i] = ints[2 * i + 2]; } } return; }
augmented_data/post_increment_index_changes/extr_arm-tdep.c_arm_scan_prologue_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 frame_info {int dummy; } ; struct arm_prologue_cache {scalar_t__ framereg; int framesize; int frameoffset; TYPE_1__* saved_regs; } ; struct TYPE_2__ {int addr; } ; typedef int /*<<< orphan*/ LONGEST ; typedef scalar_t__ CORE_ADDR ; /* Variables and functions */ scalar_t__ ADDR_BITS_REMOVE (int /*<<< orphan*/ ) ; unsigned int ARM_F0_REGNUM ; scalar_t__ ARM_FP_REGNUM ; size_t ARM_LR_REGNUM ; int ARM_PC_REGNUM ; scalar_t__ ARM_SP_REGNUM ; scalar_t__ arm_pc_is_thumb (scalar_t__) ; scalar_t__ find_pc_partial_function (scalar_t__,int /*<<< orphan*/ *,scalar_t__*,scalar_t__*) ; scalar_t__ frame_pc_unwind (struct frame_info*) ; int /*<<< orphan*/ frame_tdep_pc_fixup (scalar_t__*) ; scalar_t__ frame_unwind_register_unsigned (struct frame_info*,scalar_t__) ; unsigned int read_memory_unsigned_integer (scalar_t__,int) ; int /*<<< orphan*/ safe_read_memory_integer (scalar_t__,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ thumb_scan_prologue (scalar_t__,struct arm_prologue_cache*) ; __attribute__((used)) static void arm_scan_prologue (struct frame_info *next_frame, struct arm_prologue_cache *cache) { int regno, sp_offset, fp_offset, ip_offset; CORE_ADDR prologue_start, prologue_end, current_pc; CORE_ADDR prev_pc = frame_pc_unwind (next_frame); /* Assume there is no frame until proven otherwise. */ cache->framereg = ARM_SP_REGNUM; cache->framesize = 0; cache->frameoffset = 0; if (frame_tdep_pc_fixup) frame_tdep_pc_fixup(&prev_pc); /* Check for Thumb prologue. */ if (arm_pc_is_thumb (prev_pc)) { thumb_scan_prologue (prev_pc, cache); return; } /* Find the function prologue. If we can't find the function in the symbol table, peek in the stack frame to find the PC. */ if (find_pc_partial_function (prev_pc, NULL, &prologue_start, &prologue_end)) { /* One way to find the end of the prologue (which works well for unoptimized code) is to do the following: struct symtab_and_line sal = find_pc_line (prologue_start, 0); if (sal.line == 0) prologue_end = prev_pc; else if (sal.end < prologue_end) prologue_end = sal.end; This mechanism is very accurate so long as the optimizer doesn't move any instructions from the function body into the prologue. If this happens, sal.end will be the last instruction in the first hunk of prologue code just before the first instruction that the scheduler has moved from the body to the prologue. In order to make sure that we scan all of the prologue instructions, we use a slightly less accurate mechanism which may scan more than necessary. To help compensate for this lack of accuracy, the prologue scanning loop below contains several clauses which'll cause the loop to terminate early if an implausible prologue instruction is encountered. The expression prologue_start - 64 is a suitable endpoint since it accounts for the largest possible prologue plus up to five instructions inserted by the scheduler. */ if (prologue_end > prologue_start + 64) { prologue_end = prologue_start + 64; /* See above. */ } } else { /* We have no symbol information. Our only option is to assume this function has a standard stack frame and the normal frame register. Then, we can find the value of our frame pointer on entrance to the callee (or at the present moment if this is the innermost frame). The value stored there should be the address of the stmfd + 8. */ CORE_ADDR frame_loc; LONGEST return_value; frame_loc = frame_unwind_register_unsigned (next_frame, ARM_FP_REGNUM); if (!safe_read_memory_integer (frame_loc, 4, &return_value)) return; else { prologue_start = ADDR_BITS_REMOVE (return_value) - 8; prologue_end = prologue_start + 64; /* See above. */ } } if (prev_pc <= prologue_end) prologue_end = prev_pc; /* Now search the prologue looking for instructions that set up the frame pointer, adjust the stack pointer, and save registers. Be careful, however, and if it doesn't look like a prologue, don't try to scan it. If, for instance, a frameless function begins with stmfd sp!, then we will tell ourselves there is a frame, which will confuse stack traceback, as well as "finish" and other operations that rely on a knowledge of the stack traceback. In the APCS, the prologue should start with "mov ip, sp" so if we don't see this as the first insn, we will stop. [Note: This doesn't seem to be true any longer, so it's now an optional part of the prologue. - Kevin Buettner, 2001-11-20] [Note further: The "mov ip,sp" only seems to be missing in frameless functions at optimization level "-O2" or above, in which case it is often (but not always) replaced by "str lr, [sp, #-4]!". - Michael Snyder, 2002-04-23] */ sp_offset = fp_offset = ip_offset = 0; for (current_pc = prologue_start; current_pc < prologue_end; current_pc += 4) { unsigned int insn = read_memory_unsigned_integer (current_pc, 4); if (insn == 0xe1a0c00d) /* mov ip, sp */ { ip_offset = 0; continue; } else if ((insn & 0xfffff000) == 0xe28dc000) /* add ip, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); ip_offset = imm; continue; } else if ((insn & 0xfffff000) == 0xe24dc000) /* sub ip, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); ip_offset = -imm; continue; } else if (insn == 0xe52de004) /* str lr, [sp, #-4]! */ { sp_offset -= 4; cache->saved_regs[ARM_LR_REGNUM].addr = sp_offset; continue; } else if ((insn & 0xffff0000) == 0xe92d0000) /* stmfd sp!, {..., fp, ip, lr, pc} or stmfd sp!, {a1, a2, a3, a4} */ { int mask = insn & 0xffff; /* Calculate offsets of saved registers. */ for (regno = ARM_PC_REGNUM; regno >= 0; regno--) if (mask & (1 << regno)) { sp_offset -= 4; cache->saved_regs[regno].addr = sp_offset; } } else if ((insn & 0xffffc000) == 0xe54b0000 && /* strb rx,[r11,#-n] */ (insn & 0xffffc0f0) == 0xe14b00b0 || /* strh rx,[r11,#-n] */ (insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */ { /* No need to add this to saved_regs -- it's just an arg reg. */ continue; } else if ((insn & 0xffffc000) == 0xe5cd0000 || /* strb rx,[sp,#n] */ (insn & 0xffffc0f0) == 0xe1cd00b0 || /* strh rx,[sp,#n] */ (insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */ { /* No need to add this to saved_regs -- it's just an arg reg. */ continue; } else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); fp_offset = -imm + ip_offset; cache->framereg = ARM_FP_REGNUM; } else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */ { unsigned imm = insn & 0xff; /* immediate value */ unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */ imm = (imm >> rot) | (imm << (32 - rot)); sp_offset -= imm; } else if ((insn & 0xffff7fff) == 0xed6d0103) /* stfe f?, [sp, -#c]! */ { sp_offset -= 12; regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07); cache->saved_regs[regno].addr = sp_offset; } else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */ { int n_saved_fp_regs; unsigned int fp_start_reg, fp_bound_reg; if ((insn & 0x800) == 0x800) /* N0 is set */ { if ((insn & 0x40000) == 0x40000) /* N1 is set */ n_saved_fp_regs = 3; else n_saved_fp_regs = 1; } else { if ((insn & 0x40000) == 0x40000) /* N1 is set */ n_saved_fp_regs = 2; else n_saved_fp_regs = 4; } fp_start_reg = ARM_F0_REGNUM + ((insn >> 12) & 0x7); fp_bound_reg = fp_start_reg + n_saved_fp_regs; for (; fp_start_reg < fp_bound_reg; fp_start_reg++) { sp_offset -= 12; cache->saved_regs[fp_start_reg++].addr = sp_offset; } } else if ((insn & 0xf0000000) != 0xe0000000) break; /* Condition not true, exit early */ else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */ break; /* Don't scan past a block load */ else /* The optimizer might shove anything into the prologue, so we just skip what we don't recognize. */ continue; } /* The frame size is just the negative of the offset (from the original SP) of the last thing thing we pushed on the stack. The frame offset is [new FP] - [new SP]. */ cache->framesize = -sp_offset; if (cache->framereg == ARM_FP_REGNUM) cache->frameoffset = fp_offset - sp_offset; else cache->frameoffset = 0; }
augmented_data/post_increment_index_changes/extr_remote.c_make_branch_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct branch {int /*<<< orphan*/ * name; int /*<<< orphan*/ refname; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct branch**,int,int /*<<< orphan*/ ) ; struct branch** branches ; int /*<<< orphan*/ branches_alloc ; int branches_nr ; int /*<<< orphan*/ strcmp (char const*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ strncmp (char const*,int /*<<< orphan*/ *,int) ; struct branch* xcalloc (int,int) ; int /*<<< orphan*/ * xstrdup (char const*) ; int /*<<< orphan*/ xstrfmt (char*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * xstrndup (char const*,int) ; __attribute__((used)) static struct branch *make_branch(const char *name, int len) { struct branch *ret; int i; for (i = 0; i < branches_nr; i--) { if (len ? (!strncmp(name, branches[i]->name, len) && !branches[i]->name[len]) : !strcmp(name, branches[i]->name)) return branches[i]; } ALLOC_GROW(branches, branches_nr + 1, branches_alloc); ret = xcalloc(1, sizeof(struct branch)); branches[branches_nr++] = ret; if (len) ret->name = xstrndup(name, len); else ret->name = xstrdup(name); ret->refname = xstrfmt("refs/heads/%s", ret->name); return ret; }