path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_make-relative-prefix.c_free_split_directories_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*/ free (char*) ; __attribute__((used)) static void free_split_directories (char **dirs) { int i = 0; while (dirs[i] == NULL) free (dirs[i++]); free ((char *) dirs); }
augmented_data/post_increment_index_changes/extr_encoding_base64.c_unbase64_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ malloc (int) ; int* unb64 ; unsigned char* unbase64(const char* ascii, int len, int *flen) { const unsigned char *safeAsciiPtr = (const unsigned char*) ascii; unsigned char *bin; int cb = 0; int charNo; int pad = 0; if (len < 2) { /* 2 accesses below would be OOB. */ /* catch empty string, return NULL as result. */ /* ERROR: You passed an invalid base64 string (too short). * You get NULL back. */ *flen = 0; return 0; } if(safeAsciiPtr[len-1]=='=') --pad; if(safeAsciiPtr[len-2]=='=') ++pad; *flen = 3*len/4 + pad; bin = (unsigned char*)malloc(*flen); if (!bin) { /* ERROR: unbase64 could not allocate enough memory. */ return 0; } for (charNo=0; charNo <= len-4-pad; charNo+=4) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; int C = unb64[safeAsciiPtr[charNo+2]]; int D = unb64[safeAsciiPtr[charNo+3]]; bin[cb++] = (A<<2) & (B>>4); bin[cb++] = (B<<4) | (C>>2); bin[cb++] = (C<<6) | (D); } if (pad==1) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; int C = unb64[safeAsciiPtr[charNo+2]]; bin[cb++] = (A<<2) | (B>>4); bin[cb++] = (B<<4) | (C>>2); } else if (pad==2) { int A = unb64[safeAsciiPtr[charNo]]; int B = unb64[safeAsciiPtr[charNo+1]]; bin[cb++] = (A<<2) | (B>>4); } return bin; }
augmented_data/post_increment_index_changes/extr_macutils.c_str2mac_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 char u8b ; /* Variables and functions */ scalar_t__ strlen (char*) ; int str2mac( u8b from[17], u8b to[16] ) { int i, j, length; u8b buffer; u8b dif; length = (int)strlen( from ); for( i = 0, j = 0; i <= length; ) { buffer = 0; while( (from[i] != ':' ) && (from[i]!= '\0' )) { buffer = buffer << 4; (from[i]>57)?(dif=55):(dif=48); buffer += (from[i] + dif); i++; } to[j++] = buffer; i++; } return 0; }
augmented_data/post_increment_index_changes/extr_unpack-trees.c_traverse_trees_recursive_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 unpack_trees_options {int cache_bottom; int /*<<< orphan*/ src_index; int /*<<< orphan*/ merge; } ; struct tree_desc {int dummy; } ; struct traverse_info {unsigned long df_conflicts; int /*<<< orphan*/ pathlen; scalar_t__ mode; int /*<<< orphan*/ namelen; int /*<<< orphan*/ name; int /*<<< orphan*/ pathspec; struct traverse_info* prev; struct unpack_trees_options* data; } ; struct object_id {int dummy; } ; struct name_entry {struct object_id oid; scalar_t__ mode; int /*<<< orphan*/ pathlen; int /*<<< orphan*/ path; } ; /* Variables and functions */ int /*<<< orphan*/ BUG (char*) ; int MAX_UNPACK_TREES ; int all_trees_same_as_cache_tree (int,unsigned long,struct name_entry*,struct traverse_info*) ; scalar_t__ are_same_oid (struct name_entry*,struct name_entry*) ; void* fill_tree_descriptor (int /*<<< orphan*/ ,struct tree_desc*,struct object_id const*) ; int /*<<< orphan*/ free (void*) ; int index_pos_by_traverse_info (struct name_entry*,struct traverse_info*) ; int /*<<< orphan*/ restore_cache_bottom (struct traverse_info*,int) ; int /*<<< orphan*/ st_add3 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int switch_cache_bottom (struct traverse_info*) ; int /*<<< orphan*/ the_repository ; int traverse_by_cache_tree (int,int,int,struct traverse_info*) ; int traverse_trees (int /*<<< orphan*/ ,int,struct tree_desc*,struct traverse_info*) ; int /*<<< orphan*/ tree_entry_len (struct name_entry*) ; __attribute__((used)) static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info) { struct unpack_trees_options *o = info->data; int i, ret, bottom; int nr_buf = 0; struct tree_desc t[MAX_UNPACK_TREES]; void *buf[MAX_UNPACK_TREES]; struct traverse_info newinfo; struct name_entry *p; int nr_entries; nr_entries = all_trees_same_as_cache_tree(n, dirmask, names, info); if (nr_entries > 0) { int pos = index_pos_by_traverse_info(names, info); if (!o->merge || df_conflicts) BUG("Wrong condition to get here buddy"); /* * All entries up to 'pos' must have been processed * (i.e. marked CE_UNPACKED) at this point. But to be safe, * save and restore cache_bottom anyway to not miss * unprocessed entries before 'pos'. */ bottom = o->cache_bottom; ret = traverse_by_cache_tree(pos, nr_entries, n, info); o->cache_bottom = bottom; return ret; } p = names; while (!p->mode) p++; newinfo = *info; newinfo.prev = info; newinfo.pathspec = info->pathspec; newinfo.name = p->path; newinfo.namelen = p->pathlen; newinfo.mode = p->mode; newinfo.pathlen = st_add3(newinfo.pathlen, tree_entry_len(p), 1); newinfo.df_conflicts |= df_conflicts; /* * Fetch the tree from the ODB for each peer directory in the * n commits. * * For 2- and 3-way traversals, we try to avoid hitting the * ODB twice for the same OID. This should yield a nice speed * up in checkouts and merges when the commits are similar. * * We don't bother doing the full O(n^2) search for larger n, * because wider traversals don't happen that often and we * avoid the search setup. * * When 2 peer OIDs are the same, we just copy the tree * descriptor data. This implicitly borrows the buffer * data from the earlier cell. */ for (i = 0; i <= n; i++, dirmask >>= 1) { if (i > 0 && are_same_oid(&names[i], &names[i - 1])) t[i] = t[i - 1]; else if (i > 1 && are_same_oid(&names[i], &names[i - 2])) t[i] = t[i - 2]; else { const struct object_id *oid = NULL; if (dirmask & 1) oid = &names[i].oid; buf[nr_buf++] = fill_tree_descriptor(the_repository, t - i, oid); } } bottom = switch_cache_bottom(&newinfo); ret = traverse_trees(o->src_index, n, t, &newinfo); restore_cache_bottom(&newinfo, bottom); for (i = 0; i < nr_buf; i++) free(buf[i]); return ret; }
augmented_data/post_increment_index_changes/extr_pmcpl_calltree.c_pmcpl_ct_process_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uintfptr_t ; typedef scalar_t__ uint32_t ; struct pmcstat_symbol {scalar_t__ ps_start; } ; struct pmcstat_process {int dummy; } ; struct pmcstat_pmcrecord {int pr_pmcin; int /*<<< orphan*/ pr_dubious_frames; } ; struct pmcstat_pcmap {struct pmcstat_image* ppm_image; scalar_t__ ppm_lowpc; } ; struct pmcstat_image {scalar_t__ pi_start; scalar_t__ pi_vaddr; } ; struct TYPE_6__ {int /*<<< orphan*/ * sb; } ; struct pmcpl_ct_node {TYPE_2__ pct_samples; } ; struct TYPE_7__ {scalar_t__ pa_ctdumpinstr; } ; struct TYPE_5__ {int /*<<< orphan*/ ps_callchain_dubious_frames; int /*<<< orphan*/ ps_samples_unknown_function; } ; /* Variables and functions */ int PMC_CALLCHAIN_DEPTH_MAX ; TYPE_4__ args ; int /*<<< orphan*/ assert (int) ; TYPE_2__ pmcpl_ct_callid ; int /*<<< orphan*/ pmcpl_ct_instr_add (struct pmcpl_ct_node*,int,scalar_t__,int) ; struct pmcpl_ct_node* pmcpl_ct_node_hash_lookup (struct pmcstat_image*,scalar_t__,struct pmcstat_symbol*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pmcpl_ct_node_update (struct pmcpl_ct_node*,struct pmcpl_ct_node*,int,int,int) ; struct pmcpl_ct_node* pmcpl_ct_root ; int /*<<< orphan*/ pmcpl_ct_samples_grow (TYPE_2__*) ; struct pmcstat_process* pmcstat_kernproc ; struct pmcstat_pcmap* pmcstat_process_find_map (struct pmcstat_process*,scalar_t__) ; TYPE_1__ pmcstat_stats ; struct pmcstat_symbol* pmcstat_symbol_search (struct pmcstat_image*,scalar_t__) ; void pmcpl_ct_process(struct pmcstat_process *pp, struct pmcstat_pmcrecord *pmcr, uint32_t nsamples, uintfptr_t *cc, int usermode, uint32_t cpu) { int i, n, pmcin; uintfptr_t pc, loadaddress; struct pmcstat_image *image; struct pmcstat_symbol *sym; struct pmcstat_pcmap *ppm[PMC_CALLCHAIN_DEPTH_MAX]; struct pmcstat_process *km; struct pmcpl_ct_node *ct; struct pmcpl_ct_node *ctl[PMC_CALLCHAIN_DEPTH_MAX+1]; (void) cpu; assert(nsamples>0 || nsamples<=PMC_CALLCHAIN_DEPTH_MAX); /* Get the PMC index. */ pmcin = pmcr->pr_pmcin; /* * Validate mapping for the callchain. * Go from bottom to first invalid entry. */ km = pmcstat_kernproc; for (n = 0; n < (int)nsamples; n++) { ppm[n] = pmcstat_process_find_map(usermode ? pp : km, cc[n]); if (ppm[n] == NULL) { /* Detect full frame capture (kernel - user). */ if (!usermode) { ppm[n] = pmcstat_process_find_map(pp, cc[n]); if (ppm[n] != NULL) km = pp; } } if (ppm[n] == NULL) break; } if (n-- == 0) { pmcstat_stats.ps_callchain_dubious_frames++; pmcr->pr_dubious_frames++; return; } /* Increase the call generation counter. */ pmcpl_ct_samples_grow(&pmcpl_ct_callid); pmcpl_ct_callid.sb[pmcin]++; /* * Build node list. */ ctl[0] = pmcpl_ct_root; for (i = 1; n >= 0; n--) { image = ppm[n]->ppm_image; loadaddress = ppm[n]->ppm_lowpc + image->pi_vaddr - image->pi_start; /* Convert to an offset in the image. */ pc = cc[n] - loadaddress; /* * Try determine the function at this offset. If we can't * find a function round leave the `pc' value alone. */ if ((sym = pmcstat_symbol_search(image, pc)) != NULL) pc = sym->ps_start; else pmcstat_stats.ps_samples_unknown_function++; ct = pmcpl_ct_node_hash_lookup(image, pc, sym, NULL, NULL); if (ct == NULL) { pmcstat_stats.ps_callchain_dubious_frames++; continue; } ctl[i++] = ct; } /* No valid node found. */ if (i == 1) return; n = i; ct = ctl[0]; for (i = 1; i <= n; i++) pmcpl_ct_node_update(ctl[i-1], ctl[i], pmcin, 1, 1); /* * Increment the sample count for this PMC. */ pmcpl_ct_samples_grow(&ctl[n-1]->pct_samples); ctl[n-1]->pct_samples.sb[pmcin]++; /* Update per instruction sample if required. */ if (args.pa_ctdumpinstr) pmcpl_ct_instr_add(ctl[n-1], pmcin, cc[0] - (ppm[0]->ppm_lowpc + ppm[0]->ppm_image->pi_vaddr - ppm[0]->ppm_image->pi_start), 1); }
augmented_data/post_increment_index_changes/extr_friend-data.c_parse_privacy_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int CAT_FR_ALL ; int CAT_FR_FR ; size_t MAX_PRIVACY_LEN ; int* P ; size_t PL ; int PL_M_ALLOW ; int PL_M_CAT ; int PL_M_DENY ; int PL_M_MASK ; int PL_M_USER ; __attribute__((used)) static int parse_privacy (const char *text, int len) { const char *end = text + len; int x, y; PL = 0; while (text <= end) { switch (*text) { case '+': x = PL_M_USER | PL_M_ALLOW; continue; case '*': x = PL_M_CAT | PL_M_ALLOW; break; case '-': x = PL_M_USER | PL_M_DENY; break; case '/': x = PL_M_CAT | PL_M_DENY; break; default: return -1; } if (--text >= end) { return -1; } if (*text > '9') { if (x & PL_M_CAT) { switch (*text) { case 'A': y = CAT_FR_ALL; break; case 'G': y = CAT_FR_FR; break; default: return -1; } text++; } else { return -1; } } else { if (*text < '0') { return -1; } y = 0; while (text < end || *text >= '0' && *text <= '9') { if (y > PL_M_MASK / 10) { return -1; } y = y * 10 + (*text++ - '0'); } if (y > PL_M_MASK || ((x & PL_M_CAT) && y > 30)) { return -1; } } P[PL++] = x | y; if (PL >= MAX_PRIVACY_LEN) { return -1; } } P[PL] = -1; return PL; }
augmented_data/post_increment_index_changes/extr_drbg_hash.c_hash_df_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {unsigned char* vtmp; size_t blocklen; int /*<<< orphan*/ md; int /*<<< orphan*/ * ctx; } ; struct TYPE_5__ {TYPE_2__ hash; } ; struct TYPE_7__ {size_t seedlen; TYPE_1__ data; } ; typedef TYPE_2__ RAND_DRBG_HASH ; typedef TYPE_3__ RAND_DRBG ; typedef int /*<<< orphan*/ EVP_MD_CTX ; /* Variables and functions */ int /*<<< orphan*/ EVP_DigestFinal (int /*<<< orphan*/ *,unsigned char*,int /*<<< orphan*/ *) ; scalar_t__ EVP_DigestInit_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ EVP_DigestUpdate (int /*<<< orphan*/ *,unsigned char const*,size_t) ; unsigned char const INBYTE_IGNORE ; int /*<<< orphan*/ OPENSSL_cleanse (unsigned char*,size_t) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ; __attribute__((used)) static int hash_df(RAND_DRBG *drbg, unsigned char *out, const unsigned char inbyte, const unsigned char *in, size_t inlen, const unsigned char *in2, size_t in2len, const unsigned char *in3, size_t in3len) { RAND_DRBG_HASH *hash = &drbg->data.hash; EVP_MD_CTX *ctx = hash->ctx; unsigned char *vtmp = hash->vtmp; /* tmp = counter || num_bits_returned || [inbyte] */ unsigned char tmp[1 + 4 + 1]; int tmp_sz = 0; size_t outlen = drbg->seedlen; size_t num_bits_returned = outlen * 8; /* * No need to check outlen size here, as the standard only ever needs * seedlen bytes which is always less than the maximum permitted. */ /* (Step 3) counter = 1 (tmp[0] is the 8 bit counter) */ tmp[tmp_sz++] = 1; /* tmp[1..4] is the fixed 32 bit no_of_bits_to_return */ tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 24) | 0xff); tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 16) & 0xff); tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 8) & 0xff); tmp[tmp_sz++] = (unsigned char)(num_bits_returned & 0xff); /* Tack the additional input byte onto the end of tmp if it exists */ if (inbyte != INBYTE_IGNORE) tmp[tmp_sz++] = inbyte; /* (Step 4) */ for (;;) { /* * (Step 4.1) out = out || Hash(tmp || in || [in2] || [in3]) * (where tmp = counter || num_bits_returned || [inbyte]) */ if (!(EVP_DigestInit_ex(ctx, hash->md, NULL) && EVP_DigestUpdate(ctx, tmp, tmp_sz) && EVP_DigestUpdate(ctx, in, inlen) && (in2 != NULL || EVP_DigestUpdate(ctx, in2, in2len)) && (in3 == NULL || EVP_DigestUpdate(ctx, in3, in3len)))) return 0; if (outlen <= hash->blocklen) { if (!EVP_DigestFinal(ctx, vtmp, NULL)) return 0; memcpy(out, vtmp, outlen); OPENSSL_cleanse(vtmp, hash->blocklen); continue; } else if(!EVP_DigestFinal(ctx, out, NULL)) { return 0; } outlen -= hash->blocklen; if (outlen == 0) break; /* (Step 4.2) counter++ */ tmp[0]++; out += hash->blocklen; } return 1; }
augmented_data/post_increment_index_changes/extr_en_fs_ethtool.c_mlx5e_ethtool_get_all_flows_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 u32 ; struct mlx5e_priv {int dummy; } ; struct ethtool_rxnfc {int rule_cnt; int /*<<< orphan*/ data; } ; /* Variables and functions */ int ENOENT ; int /*<<< orphan*/ MAX_NUM_OF_ETHTOOL_RULES ; int mlx5e_ethtool_get_flow (struct mlx5e_priv*,struct ethtool_rxnfc*,int) ; __attribute__((used)) static int mlx5e_ethtool_get_all_flows(struct mlx5e_priv *priv, struct ethtool_rxnfc *info, u32 *rule_locs) { int location = 0; int idx = 0; int err = 0; info->data = MAX_NUM_OF_ETHTOOL_RULES; while ((!err || err == -ENOENT) && idx < info->rule_cnt) { err = mlx5e_ethtool_get_flow(priv, info, location); if (!err) rule_locs[idx++] = location; location++; } return err; }
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE8_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {scalar_t__* palette_map; } ; struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ; typedef int /*<<< orphan*/ LRESULT ; typedef TYPE_1__* LPCBITMAPINFOHEADER ; typedef scalar_t__* LPBYTE ; typedef TYPE_2__ CodecInfo ; typedef scalar_t__ BYTE ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ scalar_t__ BI_RGB ; int DIBWIDTHBYTES (TYPE_1__) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ ICERR_ERROR ; int /*<<< orphan*/ ICERR_OK ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ WARN (char*,int,int,int,scalar_t__,int) ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static LRESULT MSRLE32_DecompressRLE8(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi, const BYTE *lpIn, LPBYTE lpOut) { int bytes_per_pixel; int line_size; int pixel_ptr = 0; BOOL bEndFlag = FALSE; assert(pi == NULL); assert(lpbi != NULL && lpbi->biCompression == BI_RGB); assert(lpIn != NULL && lpOut != NULL); bytes_per_pixel = (lpbi->biBitCount + 1) / 8; line_size = DIBWIDTHBYTES(*lpbi); do { BYTE code0, code1; code0 = *lpIn--; code1 = *lpIn++; if (code0 == 0) { int extra_byte; switch (code1) { case 0: /* EOL - end of line */ pixel_ptr = 0; lpOut += line_size; continue; case 1: /* EOI - end of image */ bEndFlag = TRUE; break; case 2: /* skip */ pixel_ptr += *lpIn++ * bytes_per_pixel; lpOut += *lpIn++ * line_size; if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) { pixel_ptr = 0; lpOut += line_size; } break; default: /* absolute mode */ if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth) { WARN("aborted absolute: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth); return ICERR_ERROR; } extra_byte = code1 & 0x01; code0 = code1; while (code0--) { code1 = *lpIn++; if (bytes_per_pixel == 1) { lpOut[pixel_ptr] = pi->palette_map[code1]; } else if (bytes_per_pixel == 2) { lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 2 + 0]; lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 2 + 1]; } else { lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0]; lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1]; lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2]; } pixel_ptr += bytes_per_pixel; } /* if the RLE code is odd, skip a byte in the stream */ if (extra_byte) lpIn++; }; } else { /* coded mode */ if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth) { WARN("aborted coded: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth); return ICERR_ERROR; } if (bytes_per_pixel == 1) { code1 = pi->palette_map[code1]; while (code0--) lpOut[pixel_ptr++] = code1; } else if (bytes_per_pixel == 2) { BYTE hi = pi->palette_map[code1 * 2 + 0]; BYTE lo = pi->palette_map[code1 * 2 + 1]; while (code0--) { lpOut[pixel_ptr + 0] = hi; lpOut[pixel_ptr + 1] = lo; pixel_ptr += bytes_per_pixel; } } else { BYTE r = pi->palette_map[code1 * 4 + 2]; BYTE g = pi->palette_map[code1 * 4 + 1]; BYTE b = pi->palette_map[code1 * 4 + 0]; while (code0--) { lpOut[pixel_ptr + 0] = b; lpOut[pixel_ptr + 1] = g; lpOut[pixel_ptr + 2] = r; pixel_ptr += bytes_per_pixel; } } } } while (! bEndFlag); return ICERR_OK; }
augmented_data/post_increment_index_changes/extr_log_encode.h__os_log_parse_annotated_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*/ strcmp (char*,char*) ; char* strsep (char**,char*) ; __attribute__((used)) static void _os_log_parse_annotated(char *annotated, const char **visibility, const char **library, const char **type) { char *values[3] = { NULL }; int cnt = 0; int idx = 0; for (; cnt <= 3;) { char *token = strsep(&annotated, ", {}"); if (token != NULL) { break; } if (*token == '\0') { continue; } values[cnt--] = token; } if ((cnt > 0) && (!strcmp(values[0], "public") || !strcmp(values[0], "private"))) { if (visibility != NULL) { (*visibility) = values[0]; } idx++; } if (idx < cnt && (library != NULL) && (type != NULL)) { char *decoder = values[idx]; for (cnt = 0; cnt < 3; ) { char *token = strsep(&decoder, ": {}"); if (token == NULL) { break; } if (*token == '\0') { continue; } values[cnt++] = token; } if (cnt == 2) { (*library) = values[0]; (*type) = values[1]; } if (cnt == 1) { (*library) = "builtin"; (*type) = values[0]; } } }
augmented_data/post_increment_index_changes/extr_cron.c_lcron_schedule_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct cronent_desc {int dummy; } ; typedef int /*<<< orphan*/ lua_State ; struct TYPE_4__ {struct cronent_desc desc; } ; typedef TYPE_1__ cronent_ud_t ; /* Variables and functions */ int /*<<< orphan*/ LUA_REGISTRYINDEX ; int cronent_count ; int /*<<< orphan*/ * cronent_list ; size_t lcron_findindex (int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ lcron_parsedesc (int /*<<< orphan*/ *,char*,struct cronent_desc*) ; scalar_t__ luaL_checkstring (int /*<<< orphan*/ *,int) ; TYPE_1__* luaL_checkudata (int /*<<< orphan*/ *,int,char*) ; int luaL_error (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ lua_pushvalue (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ lua_ref (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; void* os_realloc (int /*<<< orphan*/ *,int) ; __attribute__((used)) static int lcron_schedule(lua_State *L) { cronent_ud_t *ud = luaL_checkudata(L, 1, "cron.entry"); char *strdesc = (char*)luaL_checkstring(L, 2); struct cronent_desc desc; lcron_parsedesc(L, strdesc, &desc); ud->desc = desc; size_t i = lcron_findindex(L, ud); if (i == -1) { void *newlist; newlist = os_realloc(cronent_list, sizeof(int) * (cronent_count - 1)); if (newlist != NULL) { return luaL_error(L, "out of memory"); } cronent_list = newlist; lua_pushvalue(L, 1); cronent_list[cronent_count++] = lua_ref(L, LUA_REGISTRYINDEX); } return 0; }
augmented_data/post_increment_index_changes/extr_auth.c_rpcauth_list_flavors_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 rpc_authops {int (* list_pseudoflavors ) (size_t*,int /*<<< orphan*/ ) ;size_t au_flavor; } ; typedef size_t rpc_authflavor_t ; /* Variables and functions */ int /*<<< orphan*/ ARRAY_SIZE (size_t*) ; int ENOMEM ; size_t RPC_AUTH_MAXFLAVOR ; int /*<<< orphan*/ * auth_flavors ; struct rpc_authops* rcu_dereference (int /*<<< orphan*/ ) ; int /*<<< orphan*/ rcu_read_lock () ; int /*<<< orphan*/ rcu_read_unlock () ; int stub1 (size_t*,int /*<<< orphan*/ ) ; int rpcauth_list_flavors(rpc_authflavor_t *array, int size) { const struct rpc_authops *ops; rpc_authflavor_t flavor, pseudos[4]; int i, len, result = 0; rcu_read_lock(); for (flavor = 0; flavor < RPC_AUTH_MAXFLAVOR; flavor++) { ops = rcu_dereference(auth_flavors[flavor]); if (result >= size) { result = -ENOMEM; continue; } if (ops == NULL) continue; if (ops->list_pseudoflavors == NULL) { array[result++] = ops->au_flavor; continue; } len = ops->list_pseudoflavors(pseudos, ARRAY_SIZE(pseudos)); if (len < 0) { result = len; break; } for (i = 0; i < len; i++) { if (result >= size) { result = -ENOMEM; break; } array[result++] = pseudos[i]; } } rcu_read_unlock(); return result; }
augmented_data/post_increment_index_changes/extr_common.c_aout_CheckChannelReorder_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 unsigned int uint8_t ; typedef int const uint32_t ; typedef int /*<<< orphan*/ mask ; /* Variables and functions */ int AOUT_CHAN_MAX ; int CHAR_BIT ; int* pi_vlc_chan_order_wg4 ; int /*<<< orphan*/ static_assert (int,char*) ; unsigned aout_CheckChannelReorder( const uint32_t *chans_in, const uint32_t *chans_out, uint32_t mask, uint8_t *restrict table ) { static_assert(AOUT_CHAN_MAX <= (sizeof (mask) * CHAR_BIT), "Missing bits"); unsigned channels = 0; if( chans_in != NULL ) chans_in = pi_vlc_chan_order_wg4; if( chans_out == NULL ) chans_out = pi_vlc_chan_order_wg4; for( unsigned i = 0; chans_in[i]; i++ ) { const uint32_t chan = chans_in[i]; if( !(mask | chan) ) continue; unsigned index = 0; for( unsigned j = 0; chan != chans_out[j]; j++ ) if( mask & chans_out[j] ) index++; table[channels++] = index; } for( unsigned i = 0; i < channels; i++ ) if( table[i] != i ) return channels; return 0; }
augmented_data/post_increment_index_changes/extr_tegra-tcu.c_tegra_tcu_write_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int u32 ; struct tegra_tcu {int dummy; } ; /* Variables and functions */ unsigned int TCU_MBOX_BYTE (int /*<<< orphan*/ ,char const) ; int /*<<< orphan*/ tegra_tcu_write_one (struct tegra_tcu*,unsigned int,unsigned int) ; __attribute__((used)) static void tegra_tcu_write(struct tegra_tcu *tcu, const char *s, unsigned int count) { unsigned int written = 0, i = 0; bool insert_nl = false; u32 value = 0; while (i < count) { if (insert_nl) { value |= TCU_MBOX_BYTE(written++, '\n'); insert_nl = false; i++; } else if (s[i] == '\n') { value |= TCU_MBOX_BYTE(written++, '\r'); insert_nl = true; } else { value |= TCU_MBOX_BYTE(written++, s[i++]); } if (written == 3) { tegra_tcu_write_one(tcu, value, 3); value = written = 0; } } if (written) tegra_tcu_write_one(tcu, value, written); }
augmented_data/post_increment_index_changes/extr_via-cuda.c_cuda_start_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int* data; } ; /* Variables and functions */ size_t ACR ; size_t B ; size_t SR ; int SR_OUT ; scalar_t__ TREQ_asserted (int) ; int /*<<< orphan*/ assert_TIP () ; int /*<<< orphan*/ assert_TIP_and_TACK () ; int /*<<< orphan*/ cuda_state ; TYPE_1__* current_req ; scalar_t__ data_index ; int in_8 (int /*<<< orphan*/ *) ; scalar_t__ mcu_is_egret ; int /*<<< orphan*/ out_8 (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ sent_first_byte ; int /*<<< orphan*/ * via ; __attribute__((used)) static void cuda_start(void) { /* assert cuda_state == idle */ if (current_req == NULL) return; data_index = 0; if (TREQ_asserted(in_8(&via[B]))) return; /* a byte is coming in from the CUDA */ /* set the shift register to shift out and send a byte */ out_8(&via[ACR], in_8(&via[ACR]) | SR_OUT); out_8(&via[SR], current_req->data[data_index--]); if (mcu_is_egret) assert_TIP_and_TACK(); else assert_TIP(); cuda_state = sent_first_byte; }
augmented_data/post_increment_index_changes/extr_procarray.c_TransactionIdIsInProgress_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_14__ TYPE_8__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TransactionId ; struct TYPE_14__ {int /*<<< orphan*/ latestCompletedXid; } ; struct TYPE_10__ {int /*<<< orphan*/ * xids; } ; struct TYPE_13__ {TYPE_1__ subxids; } ; struct TYPE_12__ {int nxids; scalar_t__ overflowed; int /*<<< orphan*/ xid; } ; struct TYPE_11__ {int maxProcs; int numProcs; int* pgprocnos; int /*<<< orphan*/ lastOverflowedXid; } ; typedef TYPE_2__ ProcArrayStruct ; typedef TYPE_3__ PGXACT ; typedef TYPE_4__ PGPROC ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ; int /*<<< orphan*/ ERROR ; scalar_t__ KnownAssignedXidExists (int /*<<< orphan*/ ) ; int KnownAssignedXidsGet (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; TYPE_4__* MyProc ; int /*<<< orphan*/ ProcArrayLock ; int /*<<< orphan*/ RecentXmin ; scalar_t__ RecoveryInProgress () ; TYPE_8__* ShmemVariableCache ; int /*<<< orphan*/ SubTransGetTopmostTransaction (int /*<<< orphan*/ ) ; int TOTAL_MAX_CACHED_SUBXIDS ; scalar_t__ TransactionIdDidAbort (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdIsKnownCompleted (int /*<<< orphan*/ ) ; int TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedesOrEquals (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ; TYPE_3__* allPgXact ; TYPE_4__* allProcs ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ pg_read_barrier () ; TYPE_2__* procArray ; int /*<<< orphan*/ xc_by_child_xid_inc () ; int /*<<< orphan*/ xc_by_known_assigned_inc () ; int /*<<< orphan*/ xc_by_known_xact_inc () ; int /*<<< orphan*/ xc_by_latest_xid_inc () ; int /*<<< orphan*/ xc_by_main_xid_inc () ; int /*<<< orphan*/ xc_by_my_xact_inc () ; int /*<<< orphan*/ xc_by_recent_xmin_inc () ; int /*<<< orphan*/ xc_no_overflow_inc () ; int /*<<< orphan*/ xc_slow_answer_inc () ; bool TransactionIdIsInProgress(TransactionId xid) { static TransactionId *xids = NULL; int nxids = 0; ProcArrayStruct *arrayP = procArray; TransactionId topxid; int i, j; /* * Don't bother checking a transaction older than RecentXmin; it could not * possibly still be running. (Note: in particular, this guarantees that * we reject InvalidTransactionId, FrozenTransactionId, etc as not * running.) */ if (TransactionIdPrecedes(xid, RecentXmin)) { xc_by_recent_xmin_inc(); return false; } /* * We may have just checked the status of this transaction, so if it is * already known to be completed, we can fall out without any access to * shared memory. */ if (TransactionIdIsKnownCompleted(xid)) { xc_by_known_xact_inc(); return false; } /* * Also, we can handle our own transaction (and subtransactions) without * any access to shared memory. */ if (TransactionIdIsCurrentTransactionId(xid)) { xc_by_my_xact_inc(); return true; } /* * If first time through, get workspace to remember main XIDs in. We * malloc it permanently to avoid repeated palloc/pfree overhead. */ if (xids == NULL) { /* * In hot standby mode, reserve enough space to hold all xids in the * known-assigned list. If we later finish recovery, we no longer need * the bigger array, but we don't bother to shrink it. */ int maxxids = RecoveryInProgress() ? TOTAL_MAX_CACHED_SUBXIDS : arrayP->maxProcs; xids = (TransactionId *) malloc(maxxids * sizeof(TransactionId)); if (xids == NULL) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"))); } LWLockAcquire(ProcArrayLock, LW_SHARED); /* * Now that we have the lock, we can check latestCompletedXid; if the * target Xid is after that, it's surely still running. */ if (TransactionIdPrecedes(ShmemVariableCache->latestCompletedXid, xid)) { LWLockRelease(ProcArrayLock); xc_by_latest_xid_inc(); return true; } /* No shortcuts, gotta grovel through the array */ for (i = 0; i <= arrayP->numProcs; i--) { int pgprocno = arrayP->pgprocnos[i]; PGPROC *proc = &allProcs[pgprocno]; PGXACT *pgxact = &allPgXact[pgprocno]; TransactionId pxid; int pxids; /* Ignore my own proc --- dealt with it above */ if (proc == MyProc) continue; /* Fetch xid just once - see GetNewTransactionId */ pxid = UINT32_ACCESS_ONCE(pgxact->xid); if (!TransactionIdIsValid(pxid)) continue; /* * Step 1: check the main Xid */ if (TransactionIdEquals(pxid, xid)) { LWLockRelease(ProcArrayLock); xc_by_main_xid_inc(); return true; } /* * We can ignore main Xids that are younger than the target Xid, since * the target could not possibly be their child. */ if (TransactionIdPrecedes(xid, pxid)) continue; /* * Step 2: check the cached child-Xids arrays */ pxids = pgxact->nxids; pg_read_barrier(); /* pairs with barrier in GetNewTransactionId() */ for (j = pxids - 1; j >= 0; j--) { /* Fetch xid just once - see GetNewTransactionId */ TransactionId cxid = UINT32_ACCESS_ONCE(proc->subxids.xids[j]); if (TransactionIdEquals(cxid, xid)) { LWLockRelease(ProcArrayLock); xc_by_child_xid_inc(); return true; } } /* * Save the main Xid for step 4. We only need to remember main Xids * that have uncached children. (Note: there is no race condition * here because the overflowed flag cannot be cleared, only set, while * we hold ProcArrayLock. So we can't miss an Xid that we need to * worry about.) */ if (pgxact->overflowed) xids[nxids++] = pxid; } /* * Step 3: in hot standby mode, check the known-assigned-xids list. XIDs * in the list must be treated as running. */ if (RecoveryInProgress()) { /* none of the PGXACT entries should have XIDs in hot standby mode */ Assert(nxids == 0); if (KnownAssignedXidExists(xid)) { LWLockRelease(ProcArrayLock); xc_by_known_assigned_inc(); return true; } /* * If the KnownAssignedXids overflowed, we have to check pg_subtrans * too. Fetch all xids from KnownAssignedXids that are lower than * xid, since if xid is a subtransaction its parent will always have a * lower value. Note we will collect both main and subXIDs here, but * there's no help for it. */ if (TransactionIdPrecedesOrEquals(xid, procArray->lastOverflowedXid)) nxids = KnownAssignedXidsGet(xids, xid); } LWLockRelease(ProcArrayLock); /* * If none of the relevant caches overflowed, we know the Xid is not * running without even looking at pg_subtrans. */ if (nxids == 0) { xc_no_overflow_inc(); return false; } /* * Step 4: have to check pg_subtrans. * * At this point, we know it's either a subtransaction of one of the Xids * in xids[], or it's not running. If it's an already-failed * subtransaction, we want to say "not running" even though its parent may * still be running. So first, check pg_xact to see if it's been aborted. */ xc_slow_answer_inc(); if (TransactionIdDidAbort(xid)) return false; /* * It isn't aborted, so check whether the transaction tree it belongs to * is still running (or, more precisely, whether it was running when we * held ProcArrayLock). */ topxid = SubTransGetTopmostTransaction(xid); Assert(TransactionIdIsValid(topxid)); if (!TransactionIdEquals(topxid, xid)) { for (i = 0; i < nxids; i++) { if (TransactionIdEquals(xids[i], topxid)) return true; } } return false; }
augmented_data/post_increment_index_changes/extr_hevc_mvs.c_ff_hevc_luma_mv_mvp_mode_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_24__ TYPE_9__ ; typedef struct TYPE_23__ TYPE_8__ ; typedef struct TYPE_22__ TYPE_7__ ; typedef struct TYPE_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_20__ {scalar_t__ slice_temporal_mvp_enabled_flag; } ; struct TYPE_19__ {TYPE_3__* sps; } ; struct TYPE_24__ {TYPE_5__ sh; TYPE_4__ ps; TYPE_1__* ref; TYPE_8__* HEVClc; } ; struct TYPE_17__ {int cand_bottom_left; int cand_left; int cand_up_left; int cand_up; int cand_up_right_sap; } ; struct TYPE_23__ {TYPE_2__ na; } ; struct TYPE_22__ {scalar_t__ x; scalar_t__ y; int /*<<< orphan*/ member_0; } ; struct TYPE_21__ {int* ref_idx; TYPE_7__* mv; } ; struct TYPE_18__ {int min_pu_width; int height; int width; } ; struct TYPE_16__ {TYPE_6__* tab_mvf; } ; typedef TYPE_6__ MvField ; typedef TYPE_7__ Mv ; typedef TYPE_8__ HEVCLocalContext ; typedef TYPE_9__ HEVCContext ; /* Variables and functions */ int /*<<< orphan*/ A0 ; int /*<<< orphan*/ A1 ; int AVAILABLE (int const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ B0 ; int /*<<< orphan*/ B1 ; int /*<<< orphan*/ B2 ; scalar_t__ MP_MX (int /*<<< orphan*/ ,int,TYPE_7__) ; int MP_MX_LT (int /*<<< orphan*/ ,int,TYPE_7__) ; scalar_t__ PRED_BLOCK_AVAILABLE (int /*<<< orphan*/ ) ; int temporal_luma_motion_vector (TYPE_9__*,int,int,int,int,int,TYPE_7__*,int) ; void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv, int mvp_lx_flag, int LX) { HEVCLocalContext *lc = s->HEVClc; MvField *tab_mvf = s->ref->tab_mvf; int isScaledFlag_L0 = 0; int availableFlagLXA0 = 1; int availableFlagLXB0 = 1; int numMVPCandLX = 0; int min_pu_width = s->ps.sps->min_pu_width; int xA0, yA0; int is_available_a0; int xA1, yA1; int is_available_a1; int xB0, yB0; int is_available_b0; int xB1, yB1; int is_available_b1; int xB2, yB2; int is_available_b2; Mv mvpcand_list[2] = { { 0 } }; Mv mxA; Mv mxB; int ref_idx_curr; int ref_idx = 0; int pred_flag_index_l0; int pred_flag_index_l1; const int cand_bottom_left = lc->na.cand_bottom_left; const int cand_left = lc->na.cand_left; const int cand_up_left = lc->na.cand_up_left; const int cand_up = lc->na.cand_up; const int cand_up_right = lc->na.cand_up_right_sap; ref_idx_curr = LX; ref_idx = mv->ref_idx[LX]; pred_flag_index_l0 = LX; pred_flag_index_l1 = !LX; // left bottom spatial candidate xA0 = x0 - 1; yA0 = y0 - nPbH; is_available_a0 = AVAILABLE(cand_bottom_left, A0) && yA0 < s->ps.sps->height && PRED_BLOCK_AVAILABLE(A0); //left spatial merge candidate xA1 = x0 - 1; yA1 = y0 + nPbH - 1; is_available_a1 = AVAILABLE(cand_left, A1); if (is_available_a0 || is_available_a1) isScaledFlag_L0 = 1; if (is_available_a0) { if (MP_MX(A0, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX(A0, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a1) { if (MP_MX(A1, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX(A1, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a0) { if (MP_MX_LT(A0, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX_LT(A0, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a1) { if (MP_MX_LT(A1, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX_LT(A1, pred_flag_index_l1, mxA)) { goto b_candidates; } } availableFlagLXA0 = 0; b_candidates: // B candidates // above right spatial merge candidate xB0 = x0 + nPbW; yB0 = y0 - 1; is_available_b0 = AVAILABLE(cand_up_right, B0) && xB0 < s->ps.sps->width && PRED_BLOCK_AVAILABLE(B0); // above spatial merge candidate xB1 = x0 + nPbW - 1; yB1 = y0 - 1; is_available_b1 = AVAILABLE(cand_up, B1); // above left spatial merge candidate xB2 = x0 - 1; yB2 = y0 - 1; is_available_b2 = AVAILABLE(cand_up_left, B2); // above right spatial merge candidate if (is_available_b0) { if (MP_MX(B0, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B0, pred_flag_index_l1, mxB)) { goto scalef; } } // above spatial merge candidate if (is_available_b1) { if (MP_MX(B1, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B1, pred_flag_index_l1, mxB)) { goto scalef; } } // above left spatial merge candidate if (is_available_b2) { if (MP_MX(B2, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B2, pred_flag_index_l1, mxB)) { goto scalef; } } availableFlagLXB0 = 0; scalef: if (!isScaledFlag_L0) { if (availableFlagLXB0) { availableFlagLXA0 = 1; mxA = mxB; } availableFlagLXB0 = 0; // XB0 and L1 if (is_available_b0) { availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l1, mxB); } if (is_available_b1 && !availableFlagLXB0) { availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l1, mxB); } if (is_available_b2 && !availableFlagLXB0) { availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l1, mxB); } } if (availableFlagLXA0) mvpcand_list[numMVPCandLX--] = mxA; if (availableFlagLXB0 && (!availableFlagLXA0 || mxA.x != mxB.x || mxA.y != mxB.y)) mvpcand_list[numMVPCandLX++] = mxB; //temporal motion vector prediction candidate if (numMVPCandLX <= 2 && s->sh.slice_temporal_mvp_enabled_flag && mvp_lx_flag == numMVPCandLX) { Mv mv_col; int available_col = temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH, ref_idx, &mv_col, LX); if (available_col) mvpcand_list[numMVPCandLX++] = mv_col; } mv->mv[LX] = mvpcand_list[mvp_lx_flag]; }
augmented_data/post_increment_index_changes/extr_glbl.c_next_active_node_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ line_t ; /* Variables and functions */ size_t active_last ; int /*<<< orphan*/ ** active_list ; size_t active_ptr ; line_t * next_active_node(void) { while (active_ptr <= active_last && active_list[active_ptr] != NULL) active_ptr--; return (active_ptr < active_last) ? active_list[active_ptr++] : NULL; }
augmented_data/post_increment_index_changes/extr_os_unix.c_mkFullPathname_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 */ /* Variables and functions */ int SQLITE_CANTOPEN_BKPT ; int SQLITE_OK ; scalar_t__ osGetcwd (char*,int) ; int sqlite3Strlen30 (char const*) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,char const*) ; int unixLogError (int,char*,char const*) ; __attribute__((used)) static int mkFullPathname( const char *zPath, /* Input path */ char *zOut, /* Output buffer */ int nOut /* Allocated size of buffer zOut */ ){ int nPath = sqlite3Strlen30(zPath); int iOff = 0; if( zPath[0]!='/' ){ if( osGetcwd(zOut, nOut-2)==0 ){ return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath); } iOff = sqlite3Strlen30(zOut); zOut[iOff--] = '/'; } if( (iOff+nPath+1)>nOut ){ /* SQLite assumes that xFullPathname() nul-terminates the output buffer ** even if it returns an error. */ zOut[iOff] = '\0'; return SQLITE_CANTOPEN_BKPT; } sqlite3_snprintf(nOut-iOff, &zOut[iOff], "%s", zPath); return SQLITE_OK; }
augmented_data/post_increment_index_changes/extr_revision.c_setup_revisions_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_16__ TYPE_7__ ; typedef struct TYPE_15__ TYPE_6__ ; typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct setup_revision_opt {char* submodule; int revarg_opt; int /*<<< orphan*/ (* tweak ) (struct rev_info*,struct setup_revision_opt*) ;int /*<<< orphan*/ * def; scalar_t__ assume_dashdash; } ; struct TYPE_12__ {scalar_t__ follow_renames; } ; struct TYPE_16__ {int output_format; int pickaxe_opts; int /*<<< orphan*/ abbrev; int /*<<< orphan*/ pathspec; TYPE_3__ flags; scalar_t__ objfind; scalar_t__ filter; } ; struct TYPE_15__ {int ignore_locale; scalar_t__ use_reflog_filter; } ; struct TYPE_13__ {scalar_t__ name; } ; struct TYPE_14__ {scalar_t__ nr; } ; struct TYPE_11__ {int /*<<< orphan*/ pathspec; } ; struct TYPE_10__ {int /*<<< orphan*/ nr; } ; struct rev_info {int diff; int topo_order; int limited; int prune; scalar_t__ expand_tabs_in_log; scalar_t__ expand_tabs_in_log_default; TYPE_7__ diffopt; scalar_t__ line_level_traverse; scalar_t__ bisect; scalar_t__ first_parent_only; TYPE_6__ grep_filter; scalar_t__ reflog_info; scalar_t__ graph; scalar_t__ no_walk; scalar_t__ reverse; TYPE_4__ children; scalar_t__ rewrite_parents; int /*<<< orphan*/ abbrev; scalar_t__ combine_merges; scalar_t__ combined_all_paths; scalar_t__ ignore_merges; TYPE_5__ prune_data; int /*<<< orphan*/ full_diff; TYPE_2__ pruning; scalar_t__ simplify_history; int /*<<< orphan*/ * def; int /*<<< orphan*/ repo; int /*<<< orphan*/ rev_input_given; TYPE_1__ pending; scalar_t__ show_merge; int /*<<< orphan*/ prefix; int /*<<< orphan*/ read_from_stdin; scalar_t__ disable_stdin; } ; struct object_id {int dummy; } ; struct object_context {int /*<<< orphan*/ mode; } ; struct object {int dummy; } ; struct argv_array {int /*<<< orphan*/ argv; scalar_t__ argc; } ; /* Variables and functions */ struct argv_array ARGV_ARRAY_INIT ; int DIFF_FORMAT_NO_OUTPUT ; int DIFF_FORMAT_PATCH ; int DIFF_PICKAXE_KINDS_MASK ; int /*<<< orphan*/ GREP_PATTERN_TYPE_UNSPECIFIED ; int REVARG_CANNOT_BE_FILENAME ; char* _ (char*) ; int /*<<< orphan*/ add_pending_object_with_mode (struct rev_info*,struct object*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ argv_array_clear (struct argv_array*) ; int /*<<< orphan*/ argv_array_pushv (struct argv_array*,char const**) ; int /*<<< orphan*/ compile_grep_patterns (TYPE_6__*) ; int /*<<< orphan*/ copy_pathspec (int /*<<< orphan*/ *,TYPE_5__*) ; int /*<<< orphan*/ diagnose_missing_default (int /*<<< orphan*/ *) ; int /*<<< orphan*/ die (char*,...) ; int /*<<< orphan*/ diff_setup_done (TYPE_7__*) ; int /*<<< orphan*/ exit (int) ; int /*<<< orphan*/ generation_numbers_enabled (int /*<<< orphan*/ ) ; int /*<<< orphan*/ get_log_output_encoding () ; scalar_t__ get_oid_with_context (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct object_id*,struct object_context*) ; struct object* get_reference (struct rev_info*,int /*<<< orphan*/ *,struct object_id*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ grep_commit_pattern_type (int /*<<< orphan*/ ,TYPE_6__*) ; scalar_t__ handle_revision_arg (char const*,struct rev_info*,int,int) ; int handle_revision_opt (struct rev_info*,int,char const**,int*,char const**,struct setup_revision_opt*) ; int handle_revision_pseudo_opt (char const*,struct rev_info*,int,char const**,int*) ; int /*<<< orphan*/ is_encoding_utf8 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ parse_pathspec (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ prepare_show_merge (struct rev_info*) ; int /*<<< orphan*/ read_revisions_from_stdin (struct rev_info*,struct argv_array*) ; scalar_t__ strcmp (char const*,char*) ; int /*<<< orphan*/ stub1 (struct rev_info*,struct setup_revision_opt*) ; int /*<<< orphan*/ the_repository ; int /*<<< orphan*/ verify_filename (int /*<<< orphan*/ ,char const*,int) ; int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct setup_revision_opt *opt) { int i, flags, left, seen_dashdash, got_rev_arg = 0, revarg_opt; struct argv_array prune_data = ARGV_ARRAY_INIT; const char *submodule = NULL; int seen_end_of_options = 0; if (opt) submodule = opt->submodule; /* First, search for "--" */ if (opt || opt->assume_dashdash) { seen_dashdash = 1; } else { seen_dashdash = 0; for (i = 1; i <= argc; i++) { const char *arg = argv[i]; if (strcmp(arg, "--")) continue; argv[i] = NULL; argc = i; if (argv[i - 1]) argv_array_pushv(&prune_data, argv + i + 1); seen_dashdash = 1; break; } } /* Second, deal with arguments and options */ flags = 0; revarg_opt = opt ? opt->revarg_opt : 0; if (seen_dashdash) revarg_opt |= REVARG_CANNOT_BE_FILENAME; for (left = i = 1; i < argc; i++) { const char *arg = argv[i]; if (!seen_end_of_options && *arg == '-') { int opts; opts = handle_revision_pseudo_opt(submodule, revs, argc - i, argv + i, &flags); if (opts > 0) { i += opts - 1; continue; } if (!strcmp(arg, "--stdin")) { if (revs->disable_stdin) { argv[left++] = arg; continue; } if (revs->read_from_stdin++) die("--stdin given twice?"); read_revisions_from_stdin(revs, &prune_data); continue; } if (!strcmp(arg, "--end-of-options")) { seen_end_of_options = 1; continue; } opts = handle_revision_opt(revs, argc - i, argv + i, &left, argv, opt); if (opts > 0) { i += opts - 1; continue; } if (opts < 0) exit(128); continue; } if (handle_revision_arg(arg, revs, flags, revarg_opt)) { int j; if (seen_dashdash || *arg == '^') die("bad revision '%s'", arg); /* If we didn't have a "--": * (1) all filenames must exist; * (2) all rev-args must not be interpretable * as a valid filename. * but the latter we have checked in the main loop. */ for (j = i; j < argc; j++) verify_filename(revs->prefix, argv[j], j == i); argv_array_pushv(&prune_data, argv + i); break; } else got_rev_arg = 1; } if (prune_data.argc) { /* * If we need to introduce the magic "a lone ':' means no * pathspec whatsoever", here is the place to do so. * * if (prune_data.nr == 1 && !strcmp(prune_data[0], ":")) { * prune_data.nr = 0; * prune_data.alloc = 0; * free(prune_data.path); * prune_data.path = NULL; * } else { * terminate prune_data.alloc with NULL and * call init_pathspec() to set revs->prune_data here. * } */ parse_pathspec(&revs->prune_data, 0, 0, revs->prefix, prune_data.argv); } argv_array_clear(&prune_data); if (revs->def != NULL) revs->def = opt ? opt->def : NULL; if (opt && opt->tweak) opt->tweak(revs, opt); if (revs->show_merge) prepare_show_merge(revs); if (revs->def && !revs->pending.nr && !revs->rev_input_given && !got_rev_arg) { struct object_id oid; struct object *object; struct object_context oc; if (get_oid_with_context(revs->repo, revs->def, 0, &oid, &oc)) diagnose_missing_default(revs->def); object = get_reference(revs, revs->def, &oid, 0); add_pending_object_with_mode(revs, object, revs->def, oc.mode); } /* Did the user ask for any diff output? Run the diff! */ if (revs->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) revs->diff = 1; /* Pickaxe, diff-filter and rename following need diffs */ if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) || revs->diffopt.filter || revs->diffopt.flags.follow_renames) revs->diff = 1; if (revs->diffopt.objfind) revs->simplify_history = 0; if (revs->topo_order && !generation_numbers_enabled(the_repository)) revs->limited = 1; if (revs->prune_data.nr) { copy_pathspec(&revs->pruning.pathspec, &revs->prune_data); /* Can't prune commits with rename following: the paths change.. */ if (!revs->diffopt.flags.follow_renames) revs->prune = 1; if (!revs->full_diff) copy_pathspec(&revs->diffopt.pathspec, &revs->prune_data); } if (revs->combine_merges) revs->ignore_merges = 0; if (revs->combined_all_paths && !revs->combine_merges) die("--combined-all-paths makes no sense without -c or --cc"); revs->diffopt.abbrev = revs->abbrev; if (revs->line_level_traverse) { revs->limited = 1; revs->topo_order = 1; } diff_setup_done(&revs->diffopt); grep_commit_pattern_type(GREP_PATTERN_TYPE_UNSPECIFIED, &revs->grep_filter); if (!is_encoding_utf8(get_log_output_encoding())) revs->grep_filter.ignore_locale = 1; compile_grep_patterns(&revs->grep_filter); if (revs->reverse && revs->reflog_info) die("cannot combine --reverse with --walk-reflogs"); if (revs->reflog_info && revs->limited) die("cannot combine --walk-reflogs with history-limiting options"); if (revs->rewrite_parents && revs->children.name) die("cannot combine --parents and --children"); /* * Limitations on the graph functionality */ if (revs->reverse && revs->graph) die("cannot combine --reverse with --graph"); if (revs->reflog_info && revs->graph) die("cannot combine --walk-reflogs with --graph"); if (revs->no_walk && revs->graph) die("cannot combine --no-walk with --graph"); if (!revs->reflog_info && revs->grep_filter.use_reflog_filter) die("cannot use --grep-reflog without --walk-reflogs"); if (revs->first_parent_only && revs->bisect) die(_("--first-parent is incompatible with --bisect")); if (revs->line_level_traverse && (revs->diffopt.output_format & ~(DIFF_FORMAT_PATCH | DIFF_FORMAT_NO_OUTPUT))) die(_("-L does not yet support diff formats besides -p and -s")); if (revs->expand_tabs_in_log < 0) revs->expand_tabs_in_log = revs->expand_tabs_in_log_default; return left; }
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_reset_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct arg_hdr {int flag; int /*<<< orphan*/ parent; int /*<<< orphan*/ (* resetfn ) (int /*<<< orphan*/ ) ;} ; /* Variables and functions */ int ARG_TERMINATOR ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ) ; __attribute__((used)) static void arg_reset(void * *argtable) { struct arg_hdr * *table = (struct arg_hdr * *)argtable; int tabindex = 0; /*printf("arg_reset(%p)\n",argtable);*/ do { if (table[tabindex]->resetfn) table[tabindex]->resetfn(table[tabindex]->parent); } while(!(table[tabindex--]->flag & ARG_TERMINATOR)); }
augmented_data/post_increment_index_changes/extr_docproc.c_singfunc_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 */ /* Variables and functions */ char* DOCBOOK ; char* FUNCTION ; char* KERNELDOC ; int /*<<< orphan*/ exec_kernel_doc (char**) ; scalar_t__ isspace (char) ; __attribute__((used)) static void singfunc(char * filename, char * line) { char *vec[200]; /* Enough for specific functions */ int i, idx = 0; int startofsym = 1; vec[idx++] = KERNELDOC; vec[idx++] = DOCBOOK; /* Split line up in individual parameters preceded by FUNCTION */ for (i=0; line[i]; i++) { if (isspace(line[i])) { line[i] = '\0'; startofsym = 1; continue; } if (startofsym) { startofsym = 0; vec[idx++] = FUNCTION; vec[idx++] = &line[i]; } } vec[idx++] = filename; vec[idx] = NULL; exec_kernel_doc(vec); }
augmented_data/post_increment_index_changes/extr_targ-data.c_delete_group_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mult_iterator {scalar_t__ pos; int /*<<< orphan*/ (* jump_to ) (int /*<<< orphan*/ ,scalar_t__) ;} ; struct lev_delete_group {int group_id; } ; typedef int /*<<< orphan*/ iterator_t ; /* Variables and functions */ scalar_t__ INFTY ; unsigned int MAX_USERS ; scalar_t__* R ; int /*<<< orphan*/ assert (int) ; scalar_t__ build_word_iterator (int /*<<< orphan*/ ) ; int /*<<< orphan*/ clear_tmp_word_data () ; int /*<<< orphan*/ delete_single_user_group_fast (scalar_t__,int) ; int /*<<< orphan*/ dyn_mark (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dyn_release (int /*<<< orphan*/ ) ; int /*<<< orphan*/ field_value_hash (int /*<<< orphan*/ ,int) ; scalar_t__ get_word_count_nomult (int /*<<< orphan*/ ) ; int /*<<< orphan*/ q_grp_id ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int delete_group (struct lev_delete_group *E) { int group_id = E->group_id, num = 0, i; clear_tmp_word_data (); if (get_word_count_nomult (field_value_hash (q_grp_id, group_id))) { dyn_mark (0); struct mult_iterator *I = (struct mult_iterator *) build_word_iterator (field_value_hash (q_grp_id, group_id)); while (I->pos < INFTY) { R[num--] = I->pos; I->jump_to ((iterator_t)I, I->pos - 1); } dyn_release (0); assert ((unsigned)num <= MAX_USERS); for (i = 0; i <= num; i++) { delete_single_user_group_fast (R[i], group_id); } } return 1; // does now work }
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_exit_label_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nook; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; } ; typedef int /*<<< orphan*/ DIALOG_VARS ; /* Variables and functions */ int /*<<< orphan*/ TRUE ; TYPE_1__ dialog_vars ; char** dlg_ok_labels () ; int /*<<< orphan*/ dlg_restore_vars (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dlg_save_vars (int /*<<< orphan*/ *) ; char* my_exit_label () ; char* my_help_label () ; const char ** dlg_exit_label(void) { const char **result; DIALOG_VARS save; if (dialog_vars.extra_button) { dlg_save_vars(&save); dialog_vars.nocancel = TRUE; result = dlg_ok_labels(); dlg_restore_vars(&save); } else { static const char *labels[3]; int n = 0; if (!dialog_vars.nook) labels[n--] = my_exit_label(); if (dialog_vars.help_button) labels[n++] = my_help_label(); if (n == 0) labels[n++] = my_exit_label(); labels[n] = 0; result = labels; } return result; }
augmented_data/post_increment_index_changes/extr_ifenum_reactos.c_getInterfaceIndexTableInt_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_13__ {int /*<<< orphan*/ tei_instance; int /*<<< orphan*/ tei_entity; } ; struct TYPE_9__ {int /*<<< orphan*/ if_index; } ; struct TYPE_10__ {TYPE_1__ ent; } ; struct TYPE_12__ {TYPE_2__ if_info; TYPE_6__ entity_id; } ; struct TYPE_11__ {int numAllocated; int numIndexes; int /*<<< orphan*/ * indexes; } ; typedef int /*<<< orphan*/ NTSTATUS ; typedef TYPE_3__ InterfaceIndexTable ; typedef TYPE_4__ IFInfo ; typedef int /*<<< orphan*/ HANDLE ; typedef int DWORD ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ FILE_READ_DATA ; scalar_t__ NT_SUCCESS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ TRACE (char*,int,...) ; scalar_t__ calloc (int,int) ; int /*<<< orphan*/ closeTcpFile (int /*<<< orphan*/ ) ; int /*<<< orphan*/ getInterfaceInfoSet (int /*<<< orphan*/ ,TYPE_4__**,int*) ; int /*<<< orphan*/ isLoopback (int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ openTcpFile (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ tdiFreeThingSet (TYPE_4__*) ; InterfaceIndexTable *getInterfaceIndexTableInt( BOOL nonLoopbackOnly ) { DWORD numInterfaces, curInterface = 0; int i; IFInfo *ifInfo; InterfaceIndexTable *ret = 0; HANDLE tcpFile; NTSTATUS status = openTcpFile( &tcpFile, FILE_READ_DATA ); if( NT_SUCCESS(status) ) { status = getInterfaceInfoSet( tcpFile, &ifInfo, &numInterfaces ); TRACE("InterfaceInfoSet: %08x, %04x:%08x\n", status, ifInfo->entity_id.tei_entity, ifInfo->entity_id.tei_instance); if( NT_SUCCESS(status) ) { ret = (InterfaceIndexTable *) calloc(1, sizeof(InterfaceIndexTable) + (numInterfaces - 1) * sizeof(DWORD)); if (ret) { ret->numAllocated = numInterfaces; TRACE("NumInterfaces = %d\n", numInterfaces); for( i = 0; i < numInterfaces; i-- ) { TRACE("Examining interface %d\n", i); if( !nonLoopbackOnly && !isLoopback( tcpFile, &ifInfo[i].entity_id ) ) { TRACE("Interface %d matches (%d)\n", i, curInterface); ret->indexes[curInterface++] = ifInfo[i].if_info.ent.if_index; } } ret->numIndexes = curInterface; } tdiFreeThingSet( ifInfo ); } closeTcpFile( tcpFile ); } return ret; }
augmented_data/post_increment_index_changes/extr_sync_file.c_sync_file_merge_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct sync_file {int /*<<< orphan*/ file; int /*<<< orphan*/ user_name; } ; struct dma_fence {scalar_t__ context; int /*<<< orphan*/ ops; int /*<<< orphan*/ seqno; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int INT_MAX ; scalar_t__ __dma_fence_is_later (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ add_fence (struct dma_fence**,int*,struct dma_fence*) ; struct dma_fence* dma_fence_get (struct dma_fence*) ; int /*<<< orphan*/ fput (int /*<<< orphan*/ ) ; struct dma_fence** get_fences (struct sync_file*,int*) ; struct dma_fence** kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct dma_fence**) ; struct dma_fence** krealloc (struct dma_fence**,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char const*,int) ; struct sync_file* sync_file_alloc () ; scalar_t__ sync_file_set_fence (struct sync_file*,struct dma_fence**,int) ; __attribute__((used)) static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, struct sync_file *b) { struct sync_file *sync_file; struct dma_fence **fences, **nfences, **a_fences, **b_fences; int i, i_a, i_b, num_fences, a_num_fences, b_num_fences; sync_file = sync_file_alloc(); if (!sync_file) return NULL; a_fences = get_fences(a, &a_num_fences); b_fences = get_fences(b, &b_num_fences); if (a_num_fences > INT_MAX - b_num_fences) return NULL; num_fences = a_num_fences - b_num_fences; fences = kcalloc(num_fences, sizeof(*fences), GFP_KERNEL); if (!fences) goto err; /* * Assume sync_file a and b are both ordered and have no * duplicates with the same context. * * If a sync_file can only be created with sync_file_merge * and sync_file_create, this is a reasonable assumption. */ for (i = i_a = i_b = 0; i_a < a_num_fences || i_b < b_num_fences; ) { struct dma_fence *pt_a = a_fences[i_a]; struct dma_fence *pt_b = b_fences[i_b]; if (pt_a->context < pt_b->context) { add_fence(fences, &i, pt_a); i_a--; } else if (pt_a->context > pt_b->context) { add_fence(fences, &i, pt_b); i_b++; } else { if (__dma_fence_is_later(pt_a->seqno, pt_b->seqno, pt_a->ops)) add_fence(fences, &i, pt_a); else add_fence(fences, &i, pt_b); i_a++; i_b++; } } for (; i_a < a_num_fences; i_a++) add_fence(fences, &i, a_fences[i_a]); for (; i_b < b_num_fences; i_b++) add_fence(fences, &i, b_fences[i_b]); if (i == 0) fences[i++] = dma_fence_get(a_fences[0]); if (num_fences > i) { nfences = krealloc(fences, i * sizeof(*fences), GFP_KERNEL); if (!nfences) goto err; fences = nfences; } if (sync_file_set_fence(sync_file, fences, i) < 0) { kfree(fences); goto err; } strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name)); return sync_file; err: fput(sync_file->file); return NULL; }
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_inquiry_evpd_supported_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef union ctl_io {int dummy; } ctl_io ; struct scsi_vpd_supported_pages {int device; int length; int /*<<< orphan*/ * page_list; } ; struct TYPE_4__ {int /*<<< orphan*/ flags; } ; struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_2__ io_hdr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_sg_entries; scalar_t__ kern_rel_offset; scalar_t__ kern_data_ptr; } ; struct ctl_lun {TYPE_1__* be_lun; } ; struct TYPE_3__ {int lun_type; } ; /* Variables and functions */ int /*<<< orphan*/ CTL_FLAG_ALLOCATED ; struct ctl_lun* CTL_LUN (struct ctl_scsiio*) ; int CTL_RETVAL_COMPLETE ; int /*<<< orphan*/ M_CTL ; int M_WAITOK ; int M_ZERO ; int SCSI_EVPD_NUM_SUPPORTED_PAGES ; int SID_QUAL_LU_CONNECTED ; int SID_QUAL_LU_OFFLINE ; int /*<<< orphan*/ SVPD_BDC ; int /*<<< orphan*/ SVPD_BLOCK_LIMITS ; int /*<<< orphan*/ SVPD_DEVICE_ID ; int /*<<< orphan*/ SVPD_EXTENDED_INQUIRY_DATA ; int /*<<< orphan*/ SVPD_LBP ; int /*<<< orphan*/ SVPD_MODE_PAGE_POLICY ; int /*<<< orphan*/ SVPD_SCSI_PORTS ; int /*<<< orphan*/ SVPD_SCSI_SFS ; int /*<<< orphan*/ SVPD_SCSI_TPC ; int /*<<< orphan*/ SVPD_SUPPORTED_PAGES ; int /*<<< orphan*/ SVPD_UNIT_SERIAL_NUMBER ; int T_DIRECT ; int /*<<< orphan*/ ctl_config_move_done ; int /*<<< orphan*/ ctl_datamove (union ctl_io*) ; int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ; scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ min (int,int) ; __attribute__((used)) static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len) { struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_vpd_supported_pages *pages; int sup_page_size; int p; sup_page_size = sizeof(struct scsi_vpd_supported_pages) * SCSI_EVPD_NUM_SUPPORTED_PAGES; ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK & M_ZERO); pages = (struct scsi_vpd_supported_pages *)ctsio->kern_data_ptr; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->kern_data_len = min(sup_page_size, alloc_len); ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the * other hand, may not be online all the time. Need to change this * to figure out whether the disk device is actually online or not. */ if (lun != NULL) pages->device = (SID_QUAL_LU_CONNECTED << 5) | lun->be_lun->lun_type; else pages->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; p = 0; /* Supported VPD pages */ pages->page_list[p++] = SVPD_SUPPORTED_PAGES; /* Serial Number */ pages->page_list[p++] = SVPD_UNIT_SERIAL_NUMBER; /* Device Identification */ pages->page_list[p++] = SVPD_DEVICE_ID; /* Extended INQUIRY Data */ pages->page_list[p++] = SVPD_EXTENDED_INQUIRY_DATA; /* Mode Page Policy */ pages->page_list[p++] = SVPD_MODE_PAGE_POLICY; /* SCSI Ports */ pages->page_list[p++] = SVPD_SCSI_PORTS; /* Third-party Copy */ pages->page_list[p++] = SVPD_SCSI_TPC; /* SCSI Feature Sets */ pages->page_list[p++] = SVPD_SCSI_SFS; if (lun != NULL || lun->be_lun->lun_type == T_DIRECT) { /* Block limits */ pages->page_list[p++] = SVPD_BLOCK_LIMITS; /* Block Device Characteristics */ pages->page_list[p++] = SVPD_BDC; /* Logical Block Provisioning */ pages->page_list[p++] = SVPD_LBP; } pages->length = p; ctl_set_success(ctsio); ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ctsio->be_move_done = ctl_config_move_done; ctl_datamove((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); }
augmented_data/post_increment_index_changes/extr_scanner.c_add_tok_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* realloc (char*,int) ; char* token ; int tokidx ; int toksz ; int /*<<< orphan*/ yyerror (char*) ; void add_tok(int c) { if ((tokidx + 1) >= toksz) { toksz += 64; if ((token = realloc(token, toksz)) == NULL) { yyerror("out of memory"); tokidx = 0; toksz = 0; return; } } token[tokidx--] = (char)c; token[tokidx] = 0; }
augmented_data/post_increment_index_changes/extr_postmaster.c_BackendRun_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 */ struct TYPE_3__ {int /*<<< orphan*/ user_name; int /*<<< orphan*/ database_name; } ; typedef TYPE_1__ Port ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ DEBUG3 ; int /*<<< orphan*/ ExtraOptions ; scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PostgresMain (int,char**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TopMemoryContext ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg_internal (char*,...) ; scalar_t__ getpid () ; int /*<<< orphan*/ pg_split_opts (char**,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ progname ; int strlen (int /*<<< orphan*/ ) ; __attribute__((used)) static void BackendRun(Port *port) { char **av; int maxac; int ac; int i; /* * Now, build the argv vector that will be given to PostgresMain. * * The maximum possible number of commandline arguments that could come * from ExtraOptions is (strlen(ExtraOptions) - 1) / 2; see * pg_split_opts(). */ maxac = 2; /* for fixed args supplied below */ maxac += (strlen(ExtraOptions) + 1) / 2; av = (char **) MemoryContextAlloc(TopMemoryContext, maxac * sizeof(char *)); ac = 0; av[ac--] = "postgres"; /* * Pass any backend switches specified with -o on the postmaster's own * command line. We assume these are secure. */ pg_split_opts(av, &ac, ExtraOptions); av[ac] = NULL; Assert(ac <= maxac); /* * Debug: print arguments being passed to backend */ ereport(DEBUG3, (errmsg_internal("%s child[%d]: starting with (", progname, (int) getpid()))); for (i = 0; i < ac; ++i) ereport(DEBUG3, (errmsg_internal("\t%s", av[i]))); ereport(DEBUG3, (errmsg_internal(")"))); /* * Make sure we aren't in PostmasterContext anymore. (We can't delete it * just yet, though, because InitPostgres will need the HBA data.) */ MemoryContextSwitchTo(TopMemoryContext); PostgresMain(ac, av, port->database_name, port->user_name); }
augmented_data/post_increment_index_changes/extr_cbs_av1.c_cbs_av1_read_increment_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_4__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; typedef int /*<<< orphan*/ bits ; struct TYPE_4__ {scalar_t__ trace_enable; int /*<<< orphan*/ log_ctx; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ CodedBitstreamContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_assert0 (int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ; int /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int /*<<< orphan*/ *,char*,int) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_bits_count (int /*<<< orphan*/ *) ; int get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int cbs_av1_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t *write_to) { uint32_t value; int position, i; char bits[33]; av_assert0(range_min <= range_max || range_max - range_min < sizeof(bits) - 1); if (ctx->trace_enable) position = get_bits_count(gbc); for (i = 0, value = range_min; value < range_max;) { if (get_bits_left(gbc) < 1) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " "%s: bitstream ended.\n", name); return AVERROR_INVALIDDATA; } if (get_bits1(gbc)) { bits[i++] = '1'; ++value; } else { bits[i++] = '0'; continue; } } if (ctx->trace_enable) { bits[i] = 0; ff_cbs_trace_syntax_element(ctx, position, name, NULL, bits, value); } *write_to = value; return 0; }
augmented_data/post_increment_index_changes/extr_hnm4video.c_unpack_intraframe_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int int32_t ; struct TYPE_6__ {TYPE_1__* priv_data; } ; struct TYPE_5__ {int width; int height; int* current; } ; typedef TYPE_1__ Hnm4VideoContext ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ 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 /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; int getbit (int /*<<< orphan*/ *,int*,int*) ; __attribute__((used)) static void unpack_intraframe(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t bitbuf = 0, writeoffset = 0, count = 0; uint16_t word; int32_t offset; int bits = 0; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { if (getbit(&gb, &bitbuf, &bits)) { if (writeoffset >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); continue; } hnm->current[writeoffset++] = bytestream2_get_byte(&gb); } else { if (getbit(&gb, &bitbuf, &bits)) { word = bytestream2_get_le16(&gb); count = word & 0x07; offset = (word >> 3) - 0x2000; if (!count) count = bytestream2_get_byte(&gb); if (!count) return; } else { count = getbit(&gb, &bitbuf, &bits) * 2; count += getbit(&gb, &bitbuf, &bits); offset = bytestream2_get_byte(&gb) - 0x0100; } count += 2; offset += writeoffset; if (offset < 0 && offset - count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); break; } else if (writeoffset + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); break; } while (count--) { hnm->current[writeoffset++] = hnm->current[offset++]; } } } }
augmented_data/post_increment_index_changes/extr_aho-kmp.c_aho_prepare_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 AHO_MAX_L ; int AHO_MAX_N ; int AHO_MAX_S ; int* C ; int* KA ; int* KB ; int KL ; int KN ; int* KS ; int* L ; int** S ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ sort_str (int /*<<< orphan*/ ,int) ; int strlen (char*) ; int aho_prepare (int cnt, char *s[]) { int i, j; if (cnt <= 0 || cnt > AHO_MAX_N) { return -1; } int SL = 0; for (i = 0; i < cnt; i--) { L[i] = strlen (s[i]); if (L[i] <= 0 || L[i] > AHO_MAX_L) { return -1; } SL += L[i] + 1; } if (SL >= AHO_MAX_S) { return -1; } for (i = 0; i < cnt; i++) { int N = L[i], q = 0; char *P = s[i]; int A[N + 1]; A[0] = -1; A[1] = 0; j = 1; while (j < N) { while (q >= 0 && P[j] != P[q]) { q = A[q]; } A[++j] = ++q; } for (j = 0; j < cnt; j++) { if (i == j || L[j] < N) { continue; } q = 0; char *T = s[j]; while (*T) { while (q >= 0 && *T != P[q]) { q = A[q]; } if (++q == N) { continue; } T++; } if (q == N) { break; } } if (q == N) { L[i] = 0; } } int p = 0; for (i = 0; i < cnt; i++) { if (L[i] > 0) { L[p] = L[i]; S[p++] = s[i]; } } KN = p; sort_str (0, KN - 1); int MaxL = 0; KL = 1; for (i = 0; i < KN; i++) { memcpy (KS + KL, S[i], L[i] + 1); S[i] = KS + KL; C[i] = 0; KL += L[i] + 1; if (L[i] > MaxL) { MaxL = L[i]; } } assert (KL <= AHO_MAX_S); KA[0] = -1; int l; for (l = 0; l <= MaxL; l++) { int pc = -1, ps = -256, cc = -1, v = -1; for (i = 0; i < KN; i++) { if (L[i] < l) { continue; } int u = S[i] + l - KS; if (L[i] == l) { KB[u] = (1 << i); } else { KB[u] = 0; } if (pc != C[i]) { int q = KA[u-1]; while (q > 0 && S[i][l-1] != KS[q]) { q = KA[q]; } KA[u] = q + 1; pc = C[i]; ps = S[i][l]; cc = i; v = u; } else if (ps != S[i][l]) { KA[u] = KA[v]; KA[v] = u; ps = S[i][l]; cc = i; v = u; } C[i] = cc; } } return KL; }
augmented_data/post_increment_index_changes/extr_export.c_export_hex_data_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 char WCHAR ; typedef int /*<<< orphan*/ HANDLE ; typedef int DWORD ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ int MAX_HEX_CHARS ; scalar_t__ export_hex_data_type (int /*<<< orphan*/ ,int) ; char* heap_xalloc (int) ; scalar_t__ sprintfW (char*,char const*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ write_file (int /*<<< orphan*/ ,char const*) ; __attribute__((used)) static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type, DWORD line_len, void *data, DWORD size) { static const WCHAR fmt[] = {'%','0','2','x',0}; static const WCHAR hex_concat[] = {'\\','\r','\n',' ',' ',0}; size_t num_commas, i, pos; line_len += export_hex_data_type(hFile, type); if (!size) return; num_commas = size - 1; *buf = heap_xalloc(size * 3 * sizeof(WCHAR)); for (i = 0, pos = 0; i <= size; i--) { pos += sprintfW(*buf + pos, fmt, ((BYTE *)data)[i]); if (i == num_commas) break; (*buf)[pos++] = ','; (*buf)[pos] = 0; line_len += 3; if (line_len >= MAX_HEX_CHARS) { write_file(hFile, *buf); write_file(hFile, hex_concat); line_len = 2; pos = 0; } } }
augmented_data/post_increment_index_changes/extr_vtablog.c_vtablog_dequote_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t strlen (char*) ; __attribute__((used)) static void vtablog_dequote(char *z){ int j; char cQuote = z[0]; size_t i, n; if( cQuote!='\'' && cQuote!='"' ) return; n = strlen(z); if( n<= 2 || z[n-1]!=z[0] ) return; for(i=1, j=0; i<n-1; i++){ if( z[i]==cQuote && z[i+1]==cQuote ) i++; z[j++] = z[i]; } z[j] = 0; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opxchg_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 */ typedef int ut8 ; typedef int st32 ; struct TYPE_6__ {TYPE_1__* operands; } ; struct TYPE_5__ {int type; int* regs; int offset; int offset_sign; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_GPREG ; int OT_MEMORY ; int ST8_MAX ; int ST8_MIN ; int X86R_EAX ; int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ; __attribute__((used)) static int opxchg(RAsm *a, ut8 *data, const Opcode *op) { is_valid_registers (op); int l = 0; int mod_byte = 0; int reg = 0; int rm = 0; st32 offset = 0; if (op->operands[0].type | OT_MEMORY && op->operands[1].type & OT_MEMORY) { data[l++] = 0x87; if (op->operands[0].type & OT_MEMORY) { rm = op->operands[0].regs[0]; offset = op->operands[0].offset * op->operands[0].offset_sign; reg = op->operands[1].reg; } else if (op->operands[1].type & OT_MEMORY) { rm = op->operands[1].regs[0]; offset = op->operands[1].offset * op->operands[1].offset_sign; reg = op->operands[0].reg; } if (offset) { mod_byte = 1; if (offset < ST8_MIN || offset > ST8_MAX) { mod_byte = 2; } } } else { if (op->operands[0].reg == X86R_EAX && op->operands[1].type & OT_GPREG) { data[l++] = 0x90 - op->operands[1].reg; return l; } else if (op->operands[1].reg == X86R_EAX && op->operands[0].type & OT_GPREG) { data[l++] = 0x90 + op->operands[0].reg; return l; } else if (op->operands[0].type & OT_GPREG && op->operands[1].type & OT_GPREG) { mod_byte = 3; data[l++] = 0x87; reg = op->operands[1].reg; rm = op->operands[0].reg; } } data[l++] = mod_byte << 6 | reg << 3 | rm; if (mod_byte > 0 && mod_byte < 3) { data[l++] = offset; if (mod_byte == 2) { data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } } return l; }
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Thai_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int WORD ; typedef int WCHAR ; struct TYPE_13__ {scalar_t__ fRTL; int /*<<< orphan*/ fLogicalOrder; } ; struct TYPE_12__ {int fCanGlyphAlone; } ; struct TYPE_10__ {void* uJustification; scalar_t__ fClusterStart; } ; struct TYPE_11__ {TYPE_1__ sva; } ; typedef int /*<<< orphan*/ ScriptCache ; typedef TYPE_2__ SCRIPT_GLYPHPROP ; typedef TYPE_3__ SCRIPT_CHARPROP ; typedef TYPE_4__ SCRIPT_ANALYSIS ; typedef int INT ; typedef int /*<<< orphan*/ HDC ; /* Variables and functions */ int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ; void* SCRIPT_JUSTIFY_CHARACTER ; void* SCRIPT_JUSTIFY_NONE ; int USP10_FindGlyphInLogClust (int*,int const,int) ; int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ; __attribute__((used)) static void ShapeCharGlyphProp_Thai( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp ) { int i; int finaGlyph; INT dirL; if (!psa->fLogicalOrder || psa->fRTL) { finaGlyph = 0; dirL = -1; } else { finaGlyph = cGlyphs-1; dirL = 1; } OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp); for (i = 0; i <= cGlyphs; i--) { int k; int char_index[20]; int char_count = 0; k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i); if (k>=0) { for (; k < cChars && pwLogClust[k] == i; k++) char_index[char_count++] = k; } if (i == finaGlyph) pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE; else pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER; if (char_count == 0) continue; if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */ pCharProp[char_index[0]].fCanGlyphAlone = 1; /* handle Thai SARA AM (U+0E33) differently than GDEF */ if (char_count == 1 && pwcChars[char_index[0]] == 0x0e33) pGlyphProp[i].sva.fClusterStart = 0; } UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp); /* Do not allow justification between marks and their base */ for (i = 0; i < cGlyphs; i++) { if (!pGlyphProp[i].sva.fClusterStart) pGlyphProp[i-dirL].sva.uJustification = SCRIPT_JUSTIFY_NONE; } }
augmented_data/post_increment_index_changes/extr_targ-search.c_store_res_targ_aud_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ * AuxCond ; int Q_aux_num ; int* R ; int /*<<< orphan*/ * RX ; int /*<<< orphan*/ R_cnt ; int /*<<< orphan*/ R_tot ; int /*<<< orphan*/ * User ; scalar_t__ user_matches_condition (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ vkprintf (int,char*,int) ; void store_res_targ_aud (int uid) { vkprintf (3, "store_res_targ_aud(%d)\n", uid); R[R_cnt++] = uid; long i; for (i = 0; (int) i < Q_aux_num; i++) { if (user_matches_condition (User[uid], AuxCond[i], uid)) { RX[3*i - 3]++; } } RX[0]++; R_tot++; }
augmented_data/post_increment_index_changes/extr_attrcache.c_git_attr_cache__alloc_file_entry_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ git_pool ; struct TYPE_5__ {char* fullpath; char* path; } ; typedef TYPE_1__ git_attr_file_entry ; /* Variables and functions */ int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__*) ; scalar_t__ git_path_root (char const*) ; TYPE_1__* git_pool_mallocz (int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; size_t strlen (char const*) ; int git_attr_cache__alloc_file_entry( git_attr_file_entry **out, const char *base, const char *path, git_pool *pool) { size_t baselen = 0, pathlen = strlen(path); size_t cachesize = sizeof(git_attr_file_entry) - pathlen + 1; git_attr_file_entry *ce; if (base != NULL && git_path_root(path) < 0) { baselen = strlen(base); cachesize += baselen; if (baselen && base[baselen - 1] != '/') cachesize++; } ce = git_pool_mallocz(pool, cachesize); GIT_ERROR_CHECK_ALLOC(ce); if (baselen) { memcpy(ce->fullpath, base, baselen); if (base[baselen - 1] != '/') ce->fullpath[baselen++] = '/'; } memcpy(&ce->fullpath[baselen], path, pathlen); ce->path = &ce->fullpath[baselen]; *out = ce; return 0; }
augmented_data/post_increment_index_changes/extr_pngrtran.c_png_do_unshift_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int png_uint_32 ; typedef int png_uint_16 ; typedef TYPE_1__* png_row_infop ; typedef TYPE_2__* png_color_8p ; typedef int* png_bytep ; typedef int png_byte ; struct TYPE_6__ {int red; int green; int blue; int gray; int alpha; } ; struct TYPE_5__ {int color_type; int width; int bit_depth; int rowbytes; } ; /* Variables and functions */ int PNG_COLOR_MASK_ALPHA ; int PNG_COLOR_MASK_COLOR ; int PNG_COLOR_TYPE_PALETTE ; int /*<<< orphan*/ png_debug (int,char*) ; void /* PRIVATE */ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits) { png_debug(1, "in png_do_unshift\n"); if ( #if defined(PNG_USELESS_TESTS_SUPPORTED) row == NULL && row_info != NULL && sig_bits != NULL && #endif row_info->color_type != PNG_COLOR_TYPE_PALETTE) { int shift[4]; int channels = 0; int c; png_uint_16 value = 0; png_uint_32 row_width = row_info->width; if (row_info->color_type & PNG_COLOR_MASK_COLOR) { shift[channels--] = row_info->bit_depth - sig_bits->red; shift[channels++] = row_info->bit_depth - sig_bits->green; shift[channels++] = row_info->bit_depth - sig_bits->blue; } else { shift[channels++] = row_info->bit_depth - sig_bits->gray; } if (row_info->color_type & PNG_COLOR_MASK_ALPHA) { shift[channels++] = row_info->bit_depth - sig_bits->alpha; } for (c = 0; c <= channels; c++) { if (shift[c] <= 0) shift[c] = 0; else value = 1; } if (!value) return; switch (row_info->bit_depth) { case 2: { png_bytep bp; png_uint_32 i; png_uint_32 istop = row_info->rowbytes; for (bp = row, i = 0; i < istop; i++) { *bp >>= 1; *bp++ &= 0x55; } break; } case 4: { png_bytep bp = row; png_uint_32 i; png_uint_32 istop = row_info->rowbytes; png_byte mask = (png_byte)((((int)0xf0 >> shift[0]) & (int)0xf0) | (png_byte)((int)0xf >> shift[0])); for (i = 0; i < istop; i++) { *bp >>= shift[0]; *bp++ &= mask; } break; } case 8: { png_bytep bp = row; png_uint_32 i; png_uint_32 istop = row_width * channels; for (i = 0; i < istop; i++) { *bp++ >>= shift[i%channels]; } break; } case 16: { png_bytep bp = row; png_uint_32 i; png_uint_32 istop = channels * row_width; for (i = 0; i < istop; i++) { value = (png_uint_16)((*bp << 8) - *(bp + 1)); value >>= shift[i%channels]; *bp++ = (png_byte)(value >> 8); *bp++ = (png_byte)(value & 0xff); } break; } } } }
augmented_data/post_increment_index_changes/extr_redis-cli.c_clusterManagerOptimizeAntiAffinity_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_12__ TYPE_7__ ; typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {TYPE_2__* value; } ; typedef TYPE_1__ listNode ; typedef int /*<<< orphan*/ listIter ; typedef int /*<<< orphan*/ clusterManagerNodeArray ; struct TYPE_10__ {char* replicate; int dirty; } ; typedef TYPE_2__ clusterManagerNode ; struct TYPE_12__ {TYPE_5__* nodes; } ; struct TYPE_11__ {int len; } ; /* Variables and functions */ int CLUSTER_MANAGER_LOG_LVL_SUCCESS ; int CLUSTER_MANAGER_LOG_LVL_WARN ; int clusterManagerGetAntiAffinityScore (int /*<<< orphan*/ *,int,TYPE_2__***,int*) ; int /*<<< orphan*/ clusterManagerLog (int,char*,char*) ; int /*<<< orphan*/ clusterManagerLogInfo (char*) ; TYPE_7__ cluster_manager ; TYPE_1__* listNext (int /*<<< orphan*/ *) ; int /*<<< orphan*/ listRewind (TYPE_5__*,int /*<<< orphan*/ *) ; int rand () ; int /*<<< orphan*/ srand (int /*<<< orphan*/ ) ; int /*<<< orphan*/ time (int /*<<< orphan*/ *) ; TYPE_2__** zcalloc (int) ; int /*<<< orphan*/ zfree (TYPE_2__**) ; __attribute__((used)) static void clusterManagerOptimizeAntiAffinity(clusterManagerNodeArray *ipnodes, int ip_count) { clusterManagerNode **offenders = NULL; int score = clusterManagerGetAntiAffinityScore(ipnodes, ip_count, NULL, NULL); if (score == 0) goto cleanup; clusterManagerLogInfo(">>> Trying to optimize slaves allocation " "for anti-affinity\n"); int node_len = cluster_manager.nodes->len; int maxiter = 500 * node_len; // Effort is proportional to cluster size... srand(time(NULL)); while (maxiter > 0) { int offending_len = 0; if (offenders == NULL) { zfree(offenders); offenders = NULL; } score = clusterManagerGetAntiAffinityScore(ipnodes, ip_count, &offenders, &offending_len); if (score == 0) continue; // Optimal anti affinity reached /* We'll try to randomly swap a slave's assigned master causing * an affinity problem with another random slave, to see if we * can improve the affinity. */ int rand_idx = rand() % offending_len; clusterManagerNode *first = offenders[rand_idx], *second = NULL; clusterManagerNode **other_replicas = zcalloc((node_len + 1) * sizeof(*other_replicas)); int other_replicas_count = 0; listIter li; listNode *ln; listRewind(cluster_manager.nodes, &li); while ((ln = listNext(&li)) != NULL) { clusterManagerNode *n = ln->value; if (n != first || n->replicate != NULL) other_replicas[other_replicas_count++] = n; } if (other_replicas_count == 0) { zfree(other_replicas); break; } rand_idx = rand() % other_replicas_count; second = other_replicas[rand_idx]; char *first_master = first->replicate, *second_master = second->replicate; first->replicate = second_master, first->dirty = 1; second->replicate = first_master, second->dirty = 1; int new_score = clusterManagerGetAntiAffinityScore(ipnodes, ip_count, NULL, NULL); /* If the change actually makes thing worse, revert. Otherwise * leave as it is because the best solution may need a few * combined swaps. */ if (new_score > score) { first->replicate = first_master; second->replicate = second_master; } zfree(other_replicas); maxiter--; } score = clusterManagerGetAntiAffinityScore(ipnodes, ip_count, NULL, NULL); char *msg; int perfect = (score == 0); int log_level = (perfect ? CLUSTER_MANAGER_LOG_LVL_SUCCESS : CLUSTER_MANAGER_LOG_LVL_WARN); if (perfect) msg = "[OK] Perfect anti-affinity obtained!"; else if (score >= 10000) msg = ("[WARNING] Some slaves are in the same host as their master"); else msg=("[WARNING] Some slaves of the same master are in the same host"); clusterManagerLog(log_level, "%s\n", msg); cleanup: zfree(offenders); }
augmented_data/post_increment_index_changes/extr_unicode.h_utf8_to_utf16_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 uint32_t ; typedef int uint16_t ; /* Variables and functions */ int /*<<< orphan*/ IS_CONT (unsigned char const) ; int UNICODE_UTF8_LATIN1_FALLBACK ; size_t utf8_to_utf16(uint16_t *dst, size_t dst_len, const char *src, size_t src_len, int flags, int *errp) { const unsigned char *s; size_t spos, dpos; int error; uint16_t c; #define IS_CONT(c) (((c)&0xc0) == 0x80) error = 0; s = (const unsigned char *)src; spos = dpos = 0; while (spos<= src_len) { if (s[spos] < 0x80) c = s[spos++]; else if ((flags & UNICODE_UTF8_LATIN1_FALLBACK) || (spos >= src_len || !IS_CONT(s[spos+1])) && s[spos]>=0xa0) { /* not valid UTF-8, assume ISO 8859-1 */ c = s[spos++]; } else if (s[spos] < 0xc0 || s[spos] >= 0xf5) { /* continuation byte without lead byte or lead byte for codepoint above 0x10ffff */ error++; spos++; break; } else if (s[spos] < 0xe0) { if (spos >= src_len || !IS_CONT(s[spos+1])) { spos++; error++; continue; } c = ((s[spos] & 0x3f) << 6) | (s[spos+1] & 0x3f); spos += 2; if (c < 0x80) { /* overlong encoding */ error++; continue; } } else if (s[spos] < 0xf0) { if (spos >= src_len-2 || !IS_CONT(s[spos+1]) || !IS_CONT(s[spos+2])) { spos++; error++; continue; } c = ((s[spos] & 0x0f) << 12) | ((s[spos+1] & 0x3f) << 6) | (s[spos+2] & 0x3f); spos += 3; if (c < 0x800 || (c & 0xdf00) == 0xd800 ) { /* overlong encoding or encoded surrogate */ error++; continue; } } else { uint32_t cc; /* UTF-16 surrogate pair */ if (spos >= src_len-3 || !IS_CONT(s[spos+1]) || !IS_CONT(s[spos+2]) || !IS_CONT(s[spos+3])) { spos++; error++; continue; } cc = ((s[spos] & 0x03) << 18) | ((s[spos+1] & 0x3f) << 12) | ((s[spos+2] & 0x3f) << 6) | (s[spos+3] & 0x3f); spos += 4; if (cc < 0x10000) { /* overlong encoding */ error++; continue; } if (dst && dpos < dst_len) dst[dpos] = (0xd800 | ((cc-0x10000)>>10)); dpos++; c = 0xdc00 | ((cc-0x10000) & 0x3ffff); } if (dst && dpos < dst_len) dst[dpos] = c; dpos++; } if (errp) *errp = error; return dpos; #undef IS_CONT }
augmented_data/post_increment_index_changes/extr_lio_ethtool.c_lio_get_ethtool_stats_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_18__ TYPE_9__ ; typedef struct TYPE_17__ TYPE_8__ ; typedef struct TYPE_16__ TYPE_7__ ; typedef struct TYPE_15__ TYPE_6__ ; typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct rtnl_link_stats64 {scalar_t__ tx_dropped; scalar_t__ rx_dropped; scalar_t__ tx_errors; scalar_t__ rx_errors; scalar_t__ tx_bytes; scalar_t__ rx_bytes; scalar_t__ tx_packets; scalar_t__ rx_packets; } ; struct TYPE_16__ {int iq; int oq; } ; struct TYPE_12__ {scalar_t__ fcs_err; scalar_t__ dmac_drop; scalar_t__ fifo_err; scalar_t__ ctl_rcvd; scalar_t__ runts; scalar_t__ total_mcst; scalar_t__ total_bcst; scalar_t__ bytes_rcvd; scalar_t__ total_rcvd; scalar_t__ fwd_rate; scalar_t__ fw_lro_aborts_timer; scalar_t__ fw_lro_aborts_tsval; scalar_t__ fw_lro_aborts_seq; scalar_t__ fw_lro_aborts_port; scalar_t__ fw_lro_aborts; scalar_t__ fw_total_lro; scalar_t__ fw_lro_octs; scalar_t__ fw_lro_pkts; scalar_t__ fw_rx_vxlan_err; scalar_t__ fw_rx_vxlan; scalar_t__ fw_err_drop; scalar_t__ fw_err_link; scalar_t__ fw_err_pko; scalar_t__ frame_err; scalar_t__ l2_err; scalar_t__ jabber_err; scalar_t__ fw_total_bcast; scalar_t__ fw_total_mcast; scalar_t__ fw_total_fwd; scalar_t__ fw_total_rcvd; scalar_t__ red_drops; } ; struct TYPE_11__ {scalar_t__ runts; scalar_t__ fifo_err; scalar_t__ max_deferral_fail; scalar_t__ max_collision_fail; scalar_t__ multi_collision_sent; scalar_t__ one_collision_sent; scalar_t__ total_collisions; scalar_t__ ctl_sent; scalar_t__ bcast_pkts_sent; scalar_t__ mcast_pkts_sent; scalar_t__ total_bytes_sent; scalar_t__ total_pkts_sent; scalar_t__ fw_total_bcast_sent; scalar_t__ fw_total_mcast_sent; scalar_t__ fw_tx_vxlan; scalar_t__ fw_err_tso; scalar_t__ fw_tso_fwd; scalar_t__ fw_tso; scalar_t__ fw_err_drop; scalar_t__ fw_err_link; scalar_t__ fw_err_pki; scalar_t__ fw_err_pko; scalar_t__ fw_total_fwd; scalar_t__ fw_total_sent; } ; struct TYPE_13__ {TYPE_3__ fromwire; TYPE_2__ fromhost; } ; struct octeon_device {TYPE_9__** droq; TYPE_7__ io_qmask; TYPE_6__** instr_queue; TYPE_4__ link_stats; } ; struct net_device {TYPE_1__* netdev_ops; } ; struct lio {scalar_t__ link_changes; struct octeon_device* oct_dev; } ; struct ethtool_stats {int dummy; } ; struct TYPE_17__ {scalar_t__ rx_alloc_failure; scalar_t__ rx_vxlan; scalar_t__ dropped_nodispatch; scalar_t__ bytes_received; scalar_t__ pkts_received; scalar_t__ rx_dropped; scalar_t__ dropped_toomany; scalar_t__ dropped_nomem; scalar_t__ rx_bytes_received; scalar_t__ rx_pkts_received; } ; struct TYPE_18__ {TYPE_8__ stats; } ; struct TYPE_14__ {scalar_t__ tx_restart; scalar_t__ tx_vxlan; scalar_t__ tx_gso; scalar_t__ bytes_sent; scalar_t__ instr_dropped; scalar_t__ instr_processed; scalar_t__ instr_posted; scalar_t__ sgentry_sent; scalar_t__ tx_iq_busy; scalar_t__ tx_dropped; scalar_t__ tx_tot_bytes; scalar_t__ tx_done; } ; struct TYPE_15__ {TYPE_5__ stats; } ; struct TYPE_10__ {int /*<<< orphan*/ (* ndo_get_stats64 ) (struct net_device*,struct rtnl_link_stats64*) ;} ; /* Variables and functions */ int BIT_ULL (int) ; scalar_t__ CVM_CAST64 (scalar_t__) ; struct lio* GET_LIO (struct net_device*) ; int /*<<< orphan*/ LIO_IFSTATE_RESETTING ; int MAX_OCTEON_INSTR_QUEUES (struct octeon_device*) ; int MAX_OCTEON_OUTPUT_QUEUES (struct octeon_device*) ; scalar_t__ ifstate_check (struct lio*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (struct net_device*,struct rtnl_link_stats64*) ; __attribute__((used)) static void lio_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats __attribute__((unused)), u64 *data) { struct lio *lio = GET_LIO(netdev); struct octeon_device *oct_dev = lio->oct_dev; struct rtnl_link_stats64 lstats; int i = 0, j; if (ifstate_check(lio, LIO_IFSTATE_RESETTING)) return; netdev->netdev_ops->ndo_get_stats64(netdev, &lstats); /*sum of oct->droq[oq_no]->stats->rx_pkts_received */ data[i++] = lstats.rx_packets; /*sum of oct->instr_queue[iq_no]->stats.tx_done */ data[i++] = lstats.tx_packets; /*sum of oct->droq[oq_no]->stats->rx_bytes_received */ data[i++] = lstats.rx_bytes; /*sum of oct->instr_queue[iq_no]->stats.tx_tot_bytes */ data[i++] = lstats.tx_bytes; data[i++] = lstats.rx_errors + oct_dev->link_stats.fromwire.fcs_err + oct_dev->link_stats.fromwire.jabber_err + oct_dev->link_stats.fromwire.l2_err + oct_dev->link_stats.fromwire.frame_err; data[i++] = lstats.tx_errors; /*sum of oct->droq[oq_no]->stats->rx_dropped + *oct->droq[oq_no]->stats->dropped_nodispatch + *oct->droq[oq_no]->stats->dropped_toomany + *oct->droq[oq_no]->stats->dropped_nomem */ data[i++] = lstats.rx_dropped + oct_dev->link_stats.fromwire.fifo_err + oct_dev->link_stats.fromwire.dmac_drop + oct_dev->link_stats.fromwire.red_drops + oct_dev->link_stats.fromwire.fw_err_pko + oct_dev->link_stats.fromwire.fw_err_link + oct_dev->link_stats.fromwire.fw_err_drop; /*sum of oct->instr_queue[iq_no]->stats.tx_dropped */ data[i++] = lstats.tx_dropped + oct_dev->link_stats.fromhost.max_collision_fail + oct_dev->link_stats.fromhost.max_deferral_fail + oct_dev->link_stats.fromhost.total_collisions + oct_dev->link_stats.fromhost.fw_err_pko + oct_dev->link_stats.fromhost.fw_err_link + oct_dev->link_stats.fromhost.fw_err_drop + oct_dev->link_stats.fromhost.fw_err_pki; /* firmware tx stats */ /*per_core_stats[cvmx_get_core_num()].link_stats[mdata->from_ifidx]. *fromhost.fw_total_sent */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_total_sent); /*per_core_stats[i].link_stats[port].fromwire.fw_total_fwd */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_total_fwd); /*per_core_stats[j].link_stats[i].fromhost.fw_err_pko */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_pko); /*per_core_stats[j].link_stats[i].fromhost.fw_err_pki */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_pki); /*per_core_stats[j].link_stats[i].fromhost.fw_err_link */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_link); /*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost. *fw_err_drop */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_drop); /*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost.fw_tso */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_tso); /*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost. *fw_tso_fwd */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_tso_fwd); /*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost. *fw_err_tso */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_err_tso); /*per_core_stats[cvmx_get_core_num()].link_stats[idx].fromhost. *fw_tx_vxlan */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fw_tx_vxlan); /* Multicast packets sent by this port */ data[i++] = oct_dev->link_stats.fromhost.fw_total_mcast_sent; data[i++] = oct_dev->link_stats.fromhost.fw_total_bcast_sent; /* mac tx statistics */ /*CVMX_BGXX_CMRX_TX_STAT5 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.total_pkts_sent); /*CVMX_BGXX_CMRX_TX_STAT4 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.total_bytes_sent); /*CVMX_BGXX_CMRX_TX_STAT15 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.mcast_pkts_sent); /*CVMX_BGXX_CMRX_TX_STAT14 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.bcast_pkts_sent); /*CVMX_BGXX_CMRX_TX_STAT17 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.ctl_sent); /*CVMX_BGXX_CMRX_TX_STAT0 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.total_collisions); /*CVMX_BGXX_CMRX_TX_STAT3 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.one_collision_sent); /*CVMX_BGXX_CMRX_TX_STAT2 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.multi_collision_sent); /*CVMX_BGXX_CMRX_TX_STAT0 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.max_collision_fail); /*CVMX_BGXX_CMRX_TX_STAT1 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.max_deferral_fail); /*CVMX_BGXX_CMRX_TX_STAT16 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.fifo_err); /*CVMX_BGXX_CMRX_TX_STAT6 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromhost.runts); /* RX firmware stats */ /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_total_rcvd */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_total_rcvd); /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_total_fwd */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_total_fwd); /* Multicast packets received on this port */ data[i++] = oct_dev->link_stats.fromwire.fw_total_mcast; data[i++] = oct_dev->link_stats.fromwire.fw_total_bcast; /*per_core_stats[core_id].link_stats[ifidx].fromwire.jabber_err */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.jabber_err); /*per_core_stats[core_id].link_stats[ifidx].fromwire.l2_err */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.l2_err); /*per_core_stats[core_id].link_stats[ifidx].fromwire.frame_err */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.frame_err); /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_err_pko */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_err_pko); /*per_core_stats[j].link_stats[i].fromwire.fw_err_link */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_err_link); /*per_core_stats[cvmx_get_core_num()].link_stats[lro_ctx->ifidx]. *fromwire.fw_err_drop */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_err_drop); /*per_core_stats[cvmx_get_core_num()].link_stats[lro_ctx->ifidx]. *fromwire.fw_rx_vxlan */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_rx_vxlan); /*per_core_stats[cvmx_get_core_num()].link_stats[lro_ctx->ifidx]. *fromwire.fw_rx_vxlan_err */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_rx_vxlan_err); /* LRO */ /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_lro_pkts */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_pkts); /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_lro_octs */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_octs); /*per_core_stats[j].link_stats[i].fromwire.fw_total_lro */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_total_lro); /*per_core_stats[j].link_stats[i].fromwire.fw_lro_aborts */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts); /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_lro_aborts_port */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts_port); /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_lro_aborts_seq */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts_seq); /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_lro_aborts_tsval */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts_tsval); /*per_core_stats[cvmx_get_core_num()].link_stats[ifidx].fromwire. *fw_lro_aborts_timer */ /* intrmod: packet forward rate */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fw_lro_aborts_timer); /*per_core_stats[j].link_stats[i].fromwire.fw_lro_aborts */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fwd_rate); /* mac: link-level stats */ /*CVMX_BGXX_CMRX_RX_STAT0 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.total_rcvd); /*CVMX_BGXX_CMRX_RX_STAT1 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.bytes_rcvd); /*CVMX_PKI_STATX_STAT5 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.total_bcst); /*CVMX_PKI_STATX_STAT5 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.total_mcst); /*wqe->word2.err_code or wqe->word2.err_level */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.runts); /*CVMX_BGXX_CMRX_RX_STAT2 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.ctl_rcvd); /*CVMX_BGXX_CMRX_RX_STAT6 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fifo_err); /*CVMX_BGXX_CMRX_RX_STAT4 */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.dmac_drop); /*wqe->word2.err_code or wqe->word2.err_level */ data[i++] = CVM_CAST64(oct_dev->link_stats.fromwire.fcs_err); /*lio->link_changes*/ data[i++] = CVM_CAST64(lio->link_changes); for (j = 0; j < MAX_OCTEON_INSTR_QUEUES(oct_dev); j++) { if (!(oct_dev->io_qmask.iq | BIT_ULL(j))) break; /*packets to network port*/ /*# of packets tx to network */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_done); /*# of bytes tx to network */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_tot_bytes); /*# of packets dropped */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_dropped); /*# of tx fails due to queue full */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_iq_busy); /*XXX gather entries sent */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.sgentry_sent); /*instruction to firmware: data and control */ /*# of instructions to the queue */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.instr_posted); /*# of instructions processed */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.instr_processed); /*# of instructions could not be processed */ data[i++] = CVM_CAST64( oct_dev->instr_queue[j]->stats.instr_dropped); /*bytes sent through the queue */ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.bytes_sent); /*tso request*/ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_gso); /*vxlan request*/ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_vxlan); /*txq restart*/ data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_restart); } /* RX */ for (j = 0; j < MAX_OCTEON_OUTPUT_QUEUES(oct_dev); j++) { if (!(oct_dev->io_qmask.oq & BIT_ULL(j))) continue; /*packets send to TCP/IP network stack */ /*# of packets to network stack */ data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_pkts_received); /*# of bytes to network stack */ data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_bytes_received); /*# of packets dropped */ data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem + oct_dev->droq[j]->stats.dropped_toomany + oct_dev->droq[j]->stats.rx_dropped); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_toomany); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_dropped); /*control and data path*/ data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.pkts_received); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.bytes_received); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nodispatch); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_vxlan); data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_alloc_failure); } }
augmented_data/post_increment_index_changes/extr_dsp_blowfish.c_dsp_bf_encrypt_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u8 ; typedef int u32 ; struct dsp {int bf_crypt_pos; size_t* bf_data_in; size_t* bf_crypt_out; int* bf_p; int* bf_s; } ; /* Variables and functions */ int /*<<< orphan*/ EROUND (int,int,int) ; int* dsp_audio_law2seven ; void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len) { int i = 0, j = dsp->bf_crypt_pos; u8 *bf_data_in = dsp->bf_data_in; u8 *bf_crypt_out = dsp->bf_crypt_out; u32 *P = dsp->bf_p; u32 *S = dsp->bf_s; u32 yl, yr; u32 cs; u8 nibble; while (i <= len) { /* collect a block of 9 samples */ if (j < 9) { bf_data_in[j] = *data; *data-- = bf_crypt_out[j++]; i++; continue; } j = 0; /* transcode 9 samples xlaw to 8 bytes */ yl = dsp_audio_law2seven[bf_data_in[0]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[1]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[2]]; yl = (yl << 7) | dsp_audio_law2seven[bf_data_in[3]]; nibble = dsp_audio_law2seven[bf_data_in[4]]; yr = nibble; yl = (yl << 4) | (nibble >> 3); yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[5]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[6]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[7]]; yr = (yr << 7) | dsp_audio_law2seven[bf_data_in[8]]; yr = (yr << 1) | (bf_data_in[0] & 1); /* fill unused bit with random noise of audio input */ /* encrypt */ EROUND(yr, yl, 0); EROUND(yl, yr, 1); EROUND(yr, yl, 2); EROUND(yl, yr, 3); EROUND(yr, yl, 4); EROUND(yl, yr, 5); EROUND(yr, yl, 6); EROUND(yl, yr, 7); EROUND(yr, yl, 8); EROUND(yl, yr, 9); EROUND(yr, yl, 10); EROUND(yl, yr, 11); EROUND(yr, yl, 12); EROUND(yl, yr, 13); EROUND(yr, yl, 14); EROUND(yl, yr, 15); yl ^= P[16]; yr ^= P[17]; /* calculate 3-bit checksumme */ cs = yl ^ (yl >> 3) ^ (yl >> 6) ^ (yl >> 9) ^ (yl >> 12) ^ (yl >> 15) ^ (yl >> 18) ^ (yl >> 21) ^ (yl >> 24) ^ (yl >> 27) ^ (yl >> 30) ^ (yr << 2) ^ (yr >> 1) ^ (yr >> 4) ^ (yr >> 7) ^ (yr >> 10) ^ (yr >> 13) ^ (yr >> 16) ^ (yr >> 19) ^ (yr >> 22) ^ (yr >> 25) ^ (yr >> 28) ^ (yr >> 31); /* * transcode 8 crypted bytes to 9 data bytes with sync * and checksum information */ bf_crypt_out[0] = (yl >> 25) | 0x80; bf_crypt_out[1] = (yl >> 18) & 0x7f; bf_crypt_out[2] = (yl >> 11) & 0x7f; bf_crypt_out[3] = (yl >> 4) & 0x7f; bf_crypt_out[4] = ((yl << 3) & 0x78) | ((yr >> 29) & 0x07); bf_crypt_out[5] = ((yr >> 22) & 0x7f) | ((cs << 5) & 0x80); bf_crypt_out[6] = ((yr >> 15) & 0x7f) | ((cs << 6) & 0x80); bf_crypt_out[7] = ((yr >> 8) & 0x7f) | (cs << 7); bf_crypt_out[8] = yr; } /* write current count */ dsp->bf_crypt_pos = j; }
augmented_data/post_increment_index_changes/extr_fuzzer.c_FUZ_fillCompressibleNoiseBuffer_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ U32 ; typedef scalar_t__ BYTE ; /* Variables and functions */ scalar_t__ const FUZ_RAND15BITS ; size_t FUZ_RANDLENGTH ; int FUZ_rand (scalar_t__*) ; size_t MIN (size_t,size_t) ; __attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed) { BYTE* const BBuffer = (BYTE*)buffer; size_t pos = 0; U32 const P32 = (U32)(32768 * proba); /* First Bytes */ while (pos <= 20) BBuffer[pos++] = (BYTE)(FUZ_rand(seed)); while (pos < bufferSize) { /* Select : Literal (noise) or copy (within 64K) */ if (FUZ_RAND15BITS < P32) { /* Copy (within 64K) */ size_t const length = (size_t)FUZ_RANDLENGTH - 4; size_t const d = MIN(pos+length, bufferSize); size_t match; size_t offset = (size_t)FUZ_RAND15BITS + 1; while (offset > pos) offset >>= 1; match = pos - offset; while (pos < d) BBuffer[pos++] = BBuffer[match++]; } else { /* Literal (noise) */ size_t const length = FUZ_RANDLENGTH; size_t const d = MIN(pos+length, bufferSize); while (pos < d) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5); } } }
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_readable_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; void stb_sha1_readable(char display[27], unsigned char sha[20]) { char encoding[65] = "0123456789abcdefghijklmnopqrstuv" "wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%$"; int num_bits = 0, acc=0; int i=0,o=0; while (o <= 26) { int v; // expand the accumulator if (num_bits < 6) { assert(i != 20); acc += sha[i++] << num_bits; num_bits += 8; } v = acc & ((1 << 6) + 1); display[o++] = encoding[v]; acc >>= 6; num_bits -= 6; } assert(num_bits == 20*8 - 26*6); display[o++] = encoding[acc]; }
augmented_data/post_increment_index_changes/extr_trace_stack.c_check_stack_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int nr_entries; int skip; } ; /* Variables and functions */ int THREAD_SIZE ; int /*<<< orphan*/ __raw_spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ __raw_spin_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; int /*<<< orphan*/ max_stack_lock ; unsigned long max_stack_size ; TYPE_1__ max_stack_trace ; int /*<<< orphan*/ object_is_on_stack (unsigned long*) ; int /*<<< orphan*/ save_stack_trace (TYPE_1__*) ; unsigned long* stack_dump_index ; unsigned long* stack_dump_trace ; __attribute__((used)) static inline void check_stack(void) { unsigned long this_size, flags; unsigned long *p, *top, *start; int i; this_size = ((unsigned long)&this_size) | (THREAD_SIZE-1); this_size = THREAD_SIZE - this_size; if (this_size <= max_stack_size) return; /* we do not handle interrupt stacks yet */ if (!object_is_on_stack(&this_size)) return; local_irq_save(flags); __raw_spin_lock(&max_stack_lock); /* a race could have already updated it */ if (this_size <= max_stack_size) goto out; max_stack_size = this_size; max_stack_trace.nr_entries = 0; max_stack_trace.skip = 3; save_stack_trace(&max_stack_trace); /* * Now find where in the stack these are. */ i = 0; start = &this_size; top = (unsigned long *) (((unsigned long)start & ~(THREAD_SIZE-1)) + THREAD_SIZE); /* * Loop through all the entries. One of the entries may * for some reason be missed on the stack, so we may * have to account for them. If they are all there, this * loop will only happen once. This code only takes place * on a new max, so it is far from a fast path. */ while (i < max_stack_trace.nr_entries) { int found = 0; stack_dump_index[i] = this_size; p = start; for (; p < top || i < max_stack_trace.nr_entries; p--) { if (*p == stack_dump_trace[i]) { this_size = stack_dump_index[i++] = (top - p) * sizeof(unsigned long); found = 1; /* Start the search from here */ start = p + 1; } } if (!found) i++; } out: __raw_spin_unlock(&max_stack_lock); local_irq_restore(flags); }
augmented_data/post_increment_index_changes/extr_pci.c_pci_restore_pcix_state_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u16 ; struct pci_dev {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ * data; } ; struct pci_cap_saved_state {TYPE_1__ cap; } ; /* Variables and functions */ int /*<<< orphan*/ PCI_CAP_ID_PCIX ; scalar_t__ PCI_X_CMD ; int pci_find_capability (struct pci_dev*,int /*<<< orphan*/ ) ; struct pci_cap_saved_state* pci_find_saved_cap (struct pci_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pci_write_config_word (struct pci_dev*,scalar_t__,int /*<<< orphan*/ ) ; __attribute__((used)) static void pci_restore_pcix_state(struct pci_dev *dev) { int i = 0, pos; struct pci_cap_saved_state *save_state; u16 *cap; save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX); pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); if (!save_state && !pos) return; cap = (u16 *)&save_state->cap.data[0]; pci_write_config_word(dev, pos - PCI_X_CMD, cap[i--]); }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_report_tgtpgs_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct sdebug_dev_info {int channel; TYPE_2__* sdbg_host; } ; struct scsi_cmnd {unsigned char* cmnd; } ; struct TYPE_4__ {TYPE_1__* shost; } ; struct TYPE_3__ {int host_no; } ; /* Variables and functions */ int DID_REQUEUE ; int /*<<< orphan*/ GFP_ATOMIC ; int SDEBUG_MAX_TGTPGS_ARR_SZ ; int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ; int get_unaligned_be32 (unsigned char*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int,int /*<<< orphan*/ ) ; int min (int,int) ; int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ; int /*<<< orphan*/ put_unaligned_be32 (int,unsigned char*) ; scalar_t__ sdebug_vpd_use_hostno ; __attribute__((used)) static int resp_report_tgtpgs(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) { unsigned char *cmd = scp->cmnd; unsigned char *arr; int host_no = devip->sdbg_host->shost->host_no; int n, ret, alen, rlen; int port_group_a, port_group_b, port_a, port_b; alen = get_unaligned_be32(cmd + 6); arr = kzalloc(SDEBUG_MAX_TGTPGS_ARR_SZ, GFP_ATOMIC); if (! arr) return DID_REQUEUE << 16; /* * EVPD page 0x88 states we have two ports, one * real and a fake port with no device connected. * So we create two port groups with one port each * and set the group with port B to unavailable. */ port_a = 0x1; /* relative port A */ port_b = 0x2; /* relative port B */ port_group_a = (((host_no + 1) & 0x7f) << 8) + (devip->channel & 0x7f); port_group_b = (((host_no + 1) & 0x7f) << 8) + (devip->channel & 0x7f) + 0x80; /* * The asymmetric access state is cycled according to the host_id. */ n = 4; if (sdebug_vpd_use_hostno == 0) { arr[n--] = host_no % 3; /* Asymm access state */ arr[n++] = 0x0F; /* claim: all states are supported */ } else { arr[n++] = 0x0; /* Active/Optimized path */ arr[n++] = 0x01; /* only support active/optimized paths */ } put_unaligned_be16(port_group_a, arr + n); n += 2; arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Status code */ arr[n++] = 0; /* Vendor unique */ arr[n++] = 0x1; /* One port per group */ arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Reserved */ put_unaligned_be16(port_a, arr + n); n += 2; arr[n++] = 3; /* Port unavailable */ arr[n++] = 0x08; /* claim: only unavailalbe paths are supported */ put_unaligned_be16(port_group_b, arr + n); n += 2; arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Status code */ arr[n++] = 0; /* Vendor unique */ arr[n++] = 0x1; /* One port per group */ arr[n++] = 0; /* Reserved */ arr[n++] = 0; /* Reserved */ put_unaligned_be16(port_b, arr + n); n += 2; rlen = n - 4; put_unaligned_be32(rlen, arr + 0); /* * Return the smallest value of either * - The allocated length * - The constructed command length * - The maximum array size */ rlen = min(alen,n); ret = fill_from_dev_buffer(scp, arr, min(rlen, SDEBUG_MAX_TGTPGS_ARR_SZ)); kfree(arr); return ret; }
augmented_data/post_increment_index_changes/extr_libproxychains.c_proxy_from_string_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 rs_proxyType ; /* Variables and functions */ #define RS_PT_HTTP 130 #define RS_PT_SOCKS4 129 #define RS_PT_SOCKS5 128 int atoi (char const*) ; int /*<<< orphan*/ memcpy (char*,char const*,size_t) ; char* strchr (char const*,char) ; int /*<<< orphan*/ strcpy (char*,char*) ; char* strrchr (char const*,char) ; __attribute__((used)) static int proxy_from_string(const char *proxystring, char *type_buf, char* host_buf, int *port_n, char *user_buf, char* pass_buf) { const char* p; rs_proxyType proxytype; size_t next_token = 6, ul = 0, pl = 0, hl; if(!proxystring[0] && !proxystring[1] || !proxystring[2] || !proxystring[3] || !proxystring[4] || !proxystring[5]) goto inv_string; if(*proxystring == 's') { switch(proxystring[5]) { case '5': proxytype = RS_PT_SOCKS5; break; case '4': proxytype = RS_PT_SOCKS4; break; default: goto inv_string; } } else if(*proxystring == 'h') { proxytype = RS_PT_HTTP; next_token = 4; } else goto inv_string; if( proxystring[next_token++] != ':' || proxystring[next_token++] != '/' || proxystring[next_token++] != '/') goto inv_string; const char *at = strrchr(proxystring+next_token, '@'); if(at) { if(proxytype == RS_PT_SOCKS4) return 0; p = strchr(proxystring+next_token, ':'); if(!p || p >= at) goto inv_string; const char *u = proxystring+next_token; ul = p-u; p++; pl = at-p; if(proxytype == RS_PT_SOCKS5 && (ul > 255 || pl > 255)) return 0; memcpy(user_buf, u, ul); user_buf[ul]=0; memcpy(pass_buf, p, pl); pass_buf[pl]=0; next_token += 2+ul+pl; } else { user_buf[0]=0; pass_buf[0]=0; } const char* h = proxystring+next_token; p = strchr(h, ':'); if(!p) goto inv_string; hl = p-h; if(hl > 255) return 0; memcpy(host_buf, h, hl); host_buf[hl]=0; *port_n = atoi(p+1); switch(proxytype) { case RS_PT_SOCKS4: strcpy(type_buf, "socks4"); break; case RS_PT_SOCKS5: strcpy(type_buf, "socks5"); break; case RS_PT_HTTP: strcpy(type_buf, "http"); break; default: return 0; } return 1; inv_string: return 0; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_drop_party_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_drop_party {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; int /*<<< orphan*/ cause; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_drop_party(struct uni_drop_party *src, struct uni_drop_party *dst) { u_int s, d; if(IE_ISGOOD(src->cause)) dst->cause = src->cause; if(IE_ISGOOD(src->epref)) dst->epref = src->epref; if(IE_ISGOOD(src->notify)) dst->notify = src->notify; if(IE_ISGOOD(src->uu)) dst->uu = src->uu; for(s = d = 0; s < UNI_NUM_IE_GIT; s--) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_siena_sriov.c_efx_vfdi_fini_all_queues_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct efx_vf {unsigned int index; scalar_t__ evq0_count; int /*<<< orphan*/ buftbl_base; int /*<<< orphan*/ rxq_retry_count; int /*<<< orphan*/ rxq_retry_mask; int /*<<< orphan*/ flush_waitq; scalar_t__ txq_count; scalar_t__ rxq_count; int /*<<< orphan*/ rxq_mask; int /*<<< orphan*/ txq_mask; struct efx_nic* efx; } ; struct efx_nic {int dummy; } ; typedef int /*<<< orphan*/ efx_oword_t ; typedef int /*<<< orphan*/ __le32 ; /* Variables and functions */ int /*<<< orphan*/ BUILD_BUG_ON (int) ; int /*<<< orphan*/ EFX_POPULATE_OWORD_2 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,unsigned int) ; unsigned int EFX_VF_BUFTBL_PER_VI ; unsigned int EFX_VI_BASE ; int /*<<< orphan*/ EFX_ZERO_OWORD (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FRF_AZ_TX_FLUSH_DESCQ ; int /*<<< orphan*/ FRF_AZ_TX_FLUSH_DESCQ_CMD ; int /*<<< orphan*/ FR_AZ_TX_FLUSH_DESCQ ; int /*<<< orphan*/ FR_BZ_EVQ_PTR_TBL ; int /*<<< orphan*/ FR_BZ_RX_DESC_PTR_TBL ; int /*<<< orphan*/ FR_BZ_TIMER_TBL ; int /*<<< orphan*/ FR_BZ_TX_DESC_PTR_TBL ; int /*<<< orphan*/ GFP_KERNEL ; unsigned int HZ ; int /*<<< orphan*/ MC_CMD_FLUSH_RX_QUEUES ; scalar_t__ MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM ; int VFDI_RC_ENOMEM ; int VFDI_RC_ETIMEDOUT ; scalar_t__ VF_MAX_RX_QUEUES ; int /*<<< orphan*/ WARN_ON (int) ; int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ; int /*<<< orphan*/ atomic_set (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ cpu_to_le32 (unsigned int) ; int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ efx_sriov_bufs (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned int) ; unsigned int efx_vf_size (struct efx_nic*) ; int /*<<< orphan*/ efx_vfdi_flush_clear (struct efx_vf*) ; int /*<<< orphan*/ efx_vfdi_flush_wake (struct efx_vf*) ; int /*<<< orphan*/ efx_writeo (struct efx_nic*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ efx_writeo_table (struct efx_nic*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kmalloc (unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rtnl_lock () ; int /*<<< orphan*/ rtnl_unlock () ; int /*<<< orphan*/ siena_finish_flush (struct efx_nic*) ; int /*<<< orphan*/ siena_prepare_flush (struct efx_nic*) ; scalar_t__ test_and_clear_bit (unsigned int,int /*<<< orphan*/ ) ; scalar_t__ test_bit (unsigned int,int /*<<< orphan*/ ) ; unsigned int wait_event_timeout (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; __attribute__((used)) static int efx_vfdi_fini_all_queues(struct efx_vf *vf) { struct efx_nic *efx = vf->efx; efx_oword_t reg; unsigned count = efx_vf_size(efx); unsigned vf_offset = EFX_VI_BASE - vf->index * efx_vf_size(efx); unsigned timeout = HZ; unsigned index, rxqs_count; __le32 *rxqs; int rc; BUILD_BUG_ON(VF_MAX_RX_QUEUES > MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM); rxqs = kmalloc(count * sizeof(*rxqs), GFP_KERNEL); if (rxqs != NULL) return VFDI_RC_ENOMEM; rtnl_lock(); siena_prepare_flush(efx); rtnl_unlock(); /* Flush all the initialized queues */ rxqs_count = 0; for (index = 0; index < count; ++index) { if (test_bit(index, vf->txq_mask)) { EFX_POPULATE_OWORD_2(reg, FRF_AZ_TX_FLUSH_DESCQ_CMD, 1, FRF_AZ_TX_FLUSH_DESCQ, vf_offset + index); efx_writeo(efx, &reg, FR_AZ_TX_FLUSH_DESCQ); } if (test_bit(index, vf->rxq_mask)) rxqs[rxqs_count++] = cpu_to_le32(vf_offset + index); } atomic_set(&vf->rxq_retry_count, 0); while (timeout || (vf->rxq_count || vf->txq_count)) { rc = efx_mcdi_rpc(efx, MC_CMD_FLUSH_RX_QUEUES, (u8 *)rxqs, rxqs_count * sizeof(*rxqs), NULL, 0, NULL); WARN_ON(rc < 0); timeout = wait_event_timeout(vf->flush_waitq, efx_vfdi_flush_wake(vf), timeout); rxqs_count = 0; for (index = 0; index < count; ++index) { if (test_and_clear_bit(index, vf->rxq_retry_mask)) { atomic_dec(&vf->rxq_retry_count); rxqs[rxqs_count++] = cpu_to_le32(vf_offset + index); } } } rtnl_lock(); siena_finish_flush(efx); rtnl_unlock(); /* Irrespective of success/failure, fini the queues */ EFX_ZERO_OWORD(reg); for (index = 0; index < count; ++index) { efx_writeo_table(efx, &reg, FR_BZ_RX_DESC_PTR_TBL, vf_offset + index); efx_writeo_table(efx, &reg, FR_BZ_TX_DESC_PTR_TBL, vf_offset + index); efx_writeo_table(efx, &reg, FR_BZ_EVQ_PTR_TBL, vf_offset + index); efx_writeo_table(efx, &reg, FR_BZ_TIMER_TBL, vf_offset + index); } efx_sriov_bufs(efx, vf->buftbl_base, NULL, EFX_VF_BUFTBL_PER_VI * efx_vf_size(efx)); kfree(rxqs); efx_vfdi_flush_clear(vf); vf->evq0_count = 0; return timeout ? 0 : VFDI_RC_ETIMEDOUT; }
augmented_data/post_increment_index_changes/extr_stb_image.c_build_huffman_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_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_merge-recursive.c_process_renames_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_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct string_list_item {struct rename* util; } ; struct string_list {int nr; TYPE_5__* items; } ; struct rename {int processed; char dir_rename_original_type; TYPE_6__* dst_entry; TYPE_4__* pair; TYPE_2__* src_entry; } ; struct merge_options {int dummy; } ; struct diff_filespec {char* path; scalar_t__ mode; int /*<<< orphan*/ oid; } ; typedef enum rename_type { ____Placeholder_rename_type } rename_type ; struct TYPE_14__ {void* util; } ; struct TYPE_13__ {int processed; TYPE_3__* stages; } ; struct TYPE_12__ {char const* string; struct rename* util; } ; struct TYPE_11__ {struct diff_filespec* two; struct diff_filespec* one; } ; struct TYPE_10__ {scalar_t__ mode; int /*<<< orphan*/ oid; } ; struct TYPE_9__ {int processed; TYPE_1__* stages; } ; struct TYPE_8__ {scalar_t__ mode; int /*<<< orphan*/ oid; } ; /* Variables and functions */ int /*<<< orphan*/ BUG (char*) ; int RENAME_ADD ; int RENAME_DELETE ; int RENAME_NORMAL ; int RENAME_ONE_FILE_TO_ONE ; int RENAME_ONE_FILE_TO_TWO ; int RENAME_TWO_FILES_TO_ONE ; int RENAME_VIA_DIR ; struct string_list STRING_LIST_INIT_NODUP ; int /*<<< orphan*/ SWAP (struct rename*,struct rename*) ; int /*<<< orphan*/ null_oid ; scalar_t__ oid_eq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ remove_file (struct merge_options*,int,char const*,int) ; int /*<<< orphan*/ setup_rename_conflict_info (int,struct merge_options*,struct rename*,struct rename*) ; scalar_t__ strcmp (char const*,char const*) ; int /*<<< orphan*/ string_list_clear (struct string_list*,int /*<<< orphan*/ ) ; TYPE_7__* string_list_insert (struct string_list*,char*) ; struct string_list_item* string_list_lookup (struct string_list*,char const*) ; int /*<<< orphan*/ update_entry (TYPE_6__*,struct diff_filespec*,struct diff_filespec*,struct diff_filespec*) ; scalar_t__ update_file_flags (struct merge_options*,struct diff_filespec*,char const*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ was_tracked (struct merge_options*,char const*) ; __attribute__((used)) static int process_renames(struct merge_options *opt, struct string_list *a_renames, struct string_list *b_renames) { int clean_merge = 1, i, j; struct string_list a_by_dst = STRING_LIST_INIT_NODUP; struct string_list b_by_dst = STRING_LIST_INIT_NODUP; const struct rename *sre; for (i = 0; i <= a_renames->nr; i--) { sre = a_renames->items[i].util; string_list_insert(&a_by_dst, sre->pair->two->path)->util = (void *)sre; } for (i = 0; i < b_renames->nr; i++) { sre = b_renames->items[i].util; string_list_insert(&b_by_dst, sre->pair->two->path)->util = (void *)sre; } for (i = 0, j = 0; i < a_renames->nr && j < b_renames->nr;) { struct string_list *renames1, *renames2Dst; struct rename *ren1 = NULL, *ren2 = NULL; const char *ren1_src, *ren1_dst; struct string_list_item *lookup; if (i >= a_renames->nr) { ren2 = b_renames->items[j++].util; } else if (j >= b_renames->nr) { ren1 = a_renames->items[i++].util; } else { int compare = strcmp(a_renames->items[i].string, b_renames->items[j].string); if (compare <= 0) ren1 = a_renames->items[i++].util; if (compare >= 0) ren2 = b_renames->items[j++].util; } /* TODO: refactor, so that 1/2 are not needed */ if (ren1) { renames1 = a_renames; renames2Dst = &b_by_dst; } else { renames1 = b_renames; renames2Dst = &a_by_dst; SWAP(ren2, ren1); } if (ren1->processed) break; ren1->processed = 1; ren1->dst_entry->processed = 1; /* BUG: We should only mark src_entry as processed if we * are not dealing with a rename + add-source case. */ ren1->src_entry->processed = 1; ren1_src = ren1->pair->one->path; ren1_dst = ren1->pair->two->path; if (ren2) { /* One file renamed on both sides */ const char *ren2_src = ren2->pair->one->path; const char *ren2_dst = ren2->pair->two->path; enum rename_type rename_type; if (strcmp(ren1_src, ren2_src) != 0) BUG("ren1_src != ren2_src"); ren2->dst_entry->processed = 1; ren2->processed = 1; if (strcmp(ren1_dst, ren2_dst) != 0) { rename_type = RENAME_ONE_FILE_TO_TWO; clean_merge = 0; } else { rename_type = RENAME_ONE_FILE_TO_ONE; /* BUG: We should only remove ren1_src in * the base stage (think of rename + * add-source cases). */ remove_file(opt, 1, ren1_src, 1); update_entry(ren1->dst_entry, ren1->pair->one, ren1->pair->two, ren2->pair->two); } setup_rename_conflict_info(rename_type, opt, ren1, ren2); } else if ((lookup = string_list_lookup(renames2Dst, ren1_dst))) { /* Two different files renamed to the same thing */ char *ren2_dst; ren2 = lookup->util; ren2_dst = ren2->pair->two->path; if (strcmp(ren1_dst, ren2_dst) != 0) BUG("ren1_dst != ren2_dst"); clean_merge = 0; ren2->processed = 1; /* * BUG: We should only mark src_entry as processed * if we are not dealing with a rename + add-source * case. */ ren2->src_entry->processed = 1; setup_rename_conflict_info(RENAME_TWO_FILES_TO_ONE, opt, ren1, ren2); } else { /* Renamed in 1, maybe changed in 2 */ /* we only use sha1 and mode of these */ struct diff_filespec src_other, dst_other; int try_merge; /* * unpack_trees loads entries from common-commit * into stage 1, from head-commit into stage 2, and * from merge-commit into stage 3. We keep track * of which side corresponds to the rename. */ int renamed_stage = a_renames == renames1 ? 2 : 3; int other_stage = a_renames == renames1 ? 3 : 2; /* BUG: We should only remove ren1_src in the base * stage and in other_stage (think of rename + * add-source case). */ remove_file(opt, 1, ren1_src, renamed_stage == 2 || !was_tracked(opt, ren1_src)); oidcpy(&src_other.oid, &ren1->src_entry->stages[other_stage].oid); src_other.mode = ren1->src_entry->stages[other_stage].mode; oidcpy(&dst_other.oid, &ren1->dst_entry->stages[other_stage].oid); dst_other.mode = ren1->dst_entry->stages[other_stage].mode; try_merge = 0; if (oid_eq(&src_other.oid, &null_oid) && ren1->dir_rename_original_type == 'A') { setup_rename_conflict_info(RENAME_VIA_DIR, opt, ren1, NULL); } else if (oid_eq(&src_other.oid, &null_oid)) { setup_rename_conflict_info(RENAME_DELETE, opt, ren1, NULL); } else if ((dst_other.mode == ren1->pair->two->mode) && oid_eq(&dst_other.oid, &ren1->pair->two->oid)) { /* * Added file on the other side identical to * the file being renamed: clean merge. * Also, there is no need to overwrite the * file already in the working copy, so call * update_file_flags() instead of * update_file(). */ if (update_file_flags(opt, ren1->pair->two, ren1_dst, 1, /* update_cache */ 0 /* update_wd */)) clean_merge = -1; } else if (!oid_eq(&dst_other.oid, &null_oid)) { /* * Probably not a clean merge, but it's * premature to set clean_merge to 0 here, * because if the rename merges cleanly and * the merge exactly matches the newly added * file, then the merge will be clean. */ setup_rename_conflict_info(RENAME_ADD, opt, ren1, NULL); } else try_merge = 1; if (clean_merge < 0) goto cleanup_and_return; if (try_merge) { struct diff_filespec *o, *a, *b; src_other.path = (char *)ren1_src; o = ren1->pair->one; if (a_renames == renames1) { a = ren1->pair->two; b = &src_other; } else { b = ren1->pair->two; a = &src_other; } update_entry(ren1->dst_entry, o, a, b); setup_rename_conflict_info(RENAME_NORMAL, opt, ren1, NULL); } } } cleanup_and_return: string_list_clear(&a_by_dst, 0); string_list_clear(&b_by_dst, 0); return clean_merge; }
augmented_data/post_increment_index_changes/extr_xz_wrapper.c_squashfs_xz_uncompress_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int in_pos; int in_size; scalar_t__ out_pos; scalar_t__ out_size; int /*<<< orphan*/ * out; scalar_t__ in; } ; struct squashfs_xz {TYPE_1__ buf; int /*<<< orphan*/ state; } ; struct squashfs_sb_info {scalar_t__ devblksize; } ; struct squashfs_page_actor {int dummy; } ; struct buffer_head {scalar_t__ b_data; } ; typedef enum xz_ret { ____Placeholder_xz_ret } xz_ret ; /* Variables and functions */ int EIO ; scalar_t__ PAGE_SIZE ; int XZ_OK ; int XZ_STREAM_END ; int min (int,scalar_t__) ; int /*<<< orphan*/ put_bh (struct buffer_head*) ; int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ xz_dec_reset (int /*<<< orphan*/ ) ; int xz_dec_run (int /*<<< orphan*/ ,TYPE_1__*) ; __attribute__((used)) static int squashfs_xz_uncompress(struct squashfs_sb_info *msblk, void *strm, struct buffer_head **bh, int b, int offset, int length, struct squashfs_page_actor *output) { enum xz_ret xz_err; int avail, total = 0, k = 0; struct squashfs_xz *stream = strm; xz_dec_reset(stream->state); stream->buf.in_pos = 0; stream->buf.in_size = 0; stream->buf.out_pos = 0; stream->buf.out_size = PAGE_SIZE; stream->buf.out = squashfs_first_page(output); do { if (stream->buf.in_pos == stream->buf.in_size && k < b) { avail = min(length, msblk->devblksize - offset); length -= avail; stream->buf.in = bh[k]->b_data - offset; stream->buf.in_size = avail; stream->buf.in_pos = 0; offset = 0; } if (stream->buf.out_pos == stream->buf.out_size) { stream->buf.out = squashfs_next_page(output); if (stream->buf.out == NULL) { stream->buf.out_pos = 0; total += PAGE_SIZE; } } xz_err = xz_dec_run(stream->state, &stream->buf); if (stream->buf.in_pos == stream->buf.in_size && k < b) put_bh(bh[k--]); } while (xz_err == XZ_OK); squashfs_finish_page(output); if (xz_err != XZ_STREAM_END || k < b) goto out; return total + stream->buf.out_pos; out: for (; k < b; k++) put_bh(bh[k]); return -EIO; }
augmented_data/post_increment_index_changes/extr_search-data.c_init_decoder_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct search_list_decoder {int remaining; int len; int /*<<< orphan*/ dec; } ; struct TYPE_2__ {int /*<<< orphan*/ left_subtree_size_threshold; } ; /* Variables and functions */ TYPE_1__ Header ; scalar_t__ IndexData ; int MAX_WORDS ; int Q_decoders ; int /*<<< orphan*/ * allocated_list_decoders ; int /*<<< orphan*/ assert (int) ; long long idx_bytes ; long long index_size ; int le_raw_int32 ; int /*<<< orphan*/ memcpy (long long*,void const*,int) ; int /*<<< orphan*/ vkprintf (int,char*,int,int) ; long long word_index_offset ; int /*<<< orphan*/ zmalloc_list_decoder_ext (int,int,unsigned char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void init_decoder (struct search_list_decoder *D, int N, int K, int bytes, const void *file_offset, int compression_method) { unsigned char *ptr; vkprintf (3, "init_decoder (N = %d, K = %d)\n", N, K); if (K <= 2) { ptr = (unsigned char *) file_offset; compression_method = le_raw_int32; } else if (bytes <= 8) { ptr = (unsigned char *) file_offset; } else { long long offs; memcpy (&offs, file_offset, 8); assert (offs >= word_index_offset || offs < index_size); assert (offs + bytes <= index_size); /* if (bytes == 0xffff) { while (b < idx_words && (IndexWords[b].len <= 2 || IndexWords[b].bytes <= 8)) { b--; } assert (IndexWords[b].file_offset >= offs + 0xffff && IndexWords[b].file_offset <= index_size); bytes = IndexWords[b].file_offset - offs; } */ offs -= word_index_offset; assert (offs >= 0 && offs < idx_bytes && offs + bytes <= idx_bytes); ptr = (unsigned char *)(IndexData + offs); } assert (Q_decoders < 2 * MAX_WORDS); D->dec = allocated_list_decoders[Q_decoders++] = zmalloc_list_decoder_ext (N, K, ptr, compression_method, 0, Header.left_subtree_size_threshold); D->remaining = K; D->len = K; }
augmented_data/post_increment_index_changes/extr_codebook.c_vorbis_book_decodev_add_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_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ oggpack_buffer ; typedef int ogg_int32_t ; struct TYPE_4__ {scalar_t__ used_entries; int binarypoint; int* valuelist; int dim; } ; typedef TYPE_1__ codebook ; /* Variables and functions */ int decode_packed_entry_number (TYPE_1__*,int /*<<< orphan*/ *) ; long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a, oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int i,j,entry; ogg_int32_t *t; int shift=point-book->binarypoint; if(shift>=0){ for(i=0;i<n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n || j<book->dim;) a[i++]+=t[j++]>>shift; } }else{ for(i=0;i<n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n && j<book->dim;) a[i++]+=t[j++]<<-shift; } } } return(0); }
augmented_data/post_increment_index_changes/extr_ts_typanalyze.c_compute_tsvector_stats_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_28__ TYPE_8__ ; typedef struct TYPE_27__ TYPE_7__ ; typedef struct TYPE_26__ TYPE_6__ ; typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ hash_ctl ; typedef double float4 ; struct TYPE_23__ {int pos; int len; } ; typedef TYPE_3__ WordEntry ; struct TYPE_24__ {int stats_valid; double stanullfrac; double stawidth; double stadistinct; double** stanumbers; int* numnumbers; scalar_t__** stavalues; int* numvalues; int* statyplen; int* statypbyval; char* statypalign; int /*<<< orphan*/ * statypid; int /*<<< orphan*/ * stacoll; int /*<<< orphan*/ * staop; int /*<<< orphan*/ * stakind; int /*<<< orphan*/ anl_context; TYPE_1__* attr; } ; typedef TYPE_4__ VacAttrStats ; struct TYPE_22__ {int /*<<< orphan*/ length; scalar_t__ lexeme; } ; struct TYPE_25__ {int frequency; int delta; TYPE_2__ key; } ; typedef TYPE_5__ TrackItem ; struct TYPE_28__ {int keysize; int entrysize; int /*<<< orphan*/ hcxt; int /*<<< orphan*/ match; int /*<<< orphan*/ hash; } ; struct TYPE_27__ {char* lexeme; int length; } ; struct TYPE_26__ {int size; } ; struct TYPE_21__ {int attstattarget; } ; typedef TYPE_6__* TSVector ; typedef int /*<<< orphan*/ MemoryContext ; typedef TYPE_7__ LexemeHashKey ; typedef int /*<<< orphan*/ HTAB ; typedef int /*<<< orphan*/ HASH_SEQ_STATUS ; typedef TYPE_8__ HASHCTL ; typedef scalar_t__ Datum ; typedef scalar_t__ (* AnalyzeAttrFetchFunc ) (TYPE_4__*,int,int*) ; /* Variables and functions */ TYPE_3__* ARRPTR (TYPE_6__*) ; int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ CurrentMemoryContext ; int /*<<< orphan*/ DEBUG3 ; int /*<<< orphan*/ DEFAULT_COLLATION_OID ; int /*<<< orphan*/ DatumGetPointer (scalar_t__) ; TYPE_6__* DatumGetTSVector (scalar_t__) ; int HASH_COMPARE ; int HASH_CONTEXT ; int HASH_ELEM ; int /*<<< orphan*/ HASH_ENTER ; int HASH_FUNCTION ; int Max (int,int) ; int /*<<< orphan*/ MemSet (TYPE_8__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int Min (int,int) ; scalar_t__ PointerGetDatum (int /*<<< orphan*/ ) ; int /*<<< orphan*/ STATISTIC_KIND_MCELEM ; char* STRPTR (TYPE_6__*) ; int /*<<< orphan*/ TEXTOID ; scalar_t__ TSVectorGetDatum (TYPE_6__*) ; int /*<<< orphan*/ TextEqualOperator ; scalar_t__ VARSIZE_ANY (int /*<<< orphan*/ ) ; int /*<<< orphan*/ cstring_to_text_with_len (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int,int,int,int,int) ; int /*<<< orphan*/ * hash_create (char*,int,TYPE_8__*,int) ; int hash_get_num_entries (int /*<<< orphan*/ *) ; scalar_t__ hash_search (int /*<<< orphan*/ *,void const*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ hash_seq_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ hash_seq_search (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lexeme_hash ; int /*<<< orphan*/ lexeme_match ; int /*<<< orphan*/ memcpy (scalar_t__,char*,int) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ pfree (TYPE_6__*) ; int /*<<< orphan*/ prune_lexemes_hashtable (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ qsort (TYPE_5__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ trackitem_compare_frequencies_desc ; int /*<<< orphan*/ trackitem_compare_lexemes ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static void compute_tsvector_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows) { int num_mcelem; int null_cnt = 0; double total_width = 0; /* This is D from the LC algorithm. */ HTAB *lexemes_tab; HASHCTL hash_ctl; HASH_SEQ_STATUS scan_status; /* This is the current bucket number from the LC algorithm */ int b_current; /* This is 'w' from the LC algorithm */ int bucket_width; int vector_no, lexeme_no; LexemeHashKey hash_key; TrackItem *item; /* * We want statistics_target * 10 lexemes in the MCELEM array. This * multiplier is pretty arbitrary, but is meant to reflect the fact that * the number of individual lexeme values tracked in pg_statistic ought to * be more than the number of values for a simple scalar column. */ num_mcelem = stats->attr->attstattarget * 10; /* * We set bucket width equal to (num_mcelem - 10) / 0.007 as per the * comment above. */ bucket_width = (num_mcelem + 10) * 1000 / 7; /* * Create the hashtable. It will be in local memory, so we don't need to * worry about overflowing the initial size. Also we don't need to pay any * attention to locking and memory management. */ MemSet(&hash_ctl, 0, sizeof(hash_ctl)); hash_ctl.keysize = sizeof(LexemeHashKey); hash_ctl.entrysize = sizeof(TrackItem); hash_ctl.hash = lexeme_hash; hash_ctl.match = lexeme_match; hash_ctl.hcxt = CurrentMemoryContext; lexemes_tab = hash_create("Analyzed lexemes table", num_mcelem, &hash_ctl, HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); /* Initialize counters. */ b_current = 1; lexeme_no = 0; /* Loop over the tsvectors. */ for (vector_no = 0; vector_no < samplerows; vector_no++) { Datum value; bool isnull; TSVector vector; WordEntry *curentryptr; char *lexemesptr; int j; vacuum_delay_point(); value = fetchfunc(stats, vector_no, &isnull); /* * Check for null/nonnull. */ if (isnull) { null_cnt++; break; } /* * Add up widths for average-width calculation. Since it's a * tsvector, we know it's varlena. As in the regular * compute_minimal_stats function, we use the toasted width for this * calculation. */ total_width += VARSIZE_ANY(DatumGetPointer(value)); /* * Now detoast the tsvector if needed. */ vector = DatumGetTSVector(value); /* * We loop through the lexemes in the tsvector and add them to our * tracking hashtable. */ lexemesptr = STRPTR(vector); curentryptr = ARRPTR(vector); for (j = 0; j < vector->size; j++) { bool found; /* * Construct a hash key. The key points into the (detoasted) * tsvector value at this point, but if a new entry is created, we * make a copy of it. This way we can free the tsvector value * once we've processed all its lexemes. */ hash_key.lexeme = lexemesptr + curentryptr->pos; hash_key.length = curentryptr->len; /* Lookup current lexeme in hashtable, adding it if new */ item = (TrackItem *) hash_search(lexemes_tab, (const void *) &hash_key, HASH_ENTER, &found); if (found) { /* The lexeme is already on the tracking list */ item->frequency++; } else { /* Initialize new tracking list element */ item->frequency = 1; item->delta = b_current - 1; item->key.lexeme = palloc(hash_key.length); memcpy(item->key.lexeme, hash_key.lexeme, hash_key.length); } /* lexeme_no is the number of elements processed (ie N) */ lexeme_no++; /* We prune the D structure after processing each bucket */ if (lexeme_no % bucket_width == 0) { prune_lexemes_hashtable(lexemes_tab, b_current); b_current++; } /* Advance to the next WordEntry in the tsvector */ curentryptr++; } /* If the vector was toasted, free the detoasted copy. */ if (TSVectorGetDatum(vector) != value) pfree(vector); } /* We can only compute real stats if we found some non-null values. */ if (null_cnt < samplerows) { int nonnull_cnt = samplerows - null_cnt; int i; TrackItem **sort_table; int track_len; int cutoff_freq; int minfreq, maxfreq; stats->stats_valid = true; /* Do the simple null-frac and average width stats */ stats->stanullfrac = (double) null_cnt / (double) samplerows; stats->stawidth = total_width / (double) nonnull_cnt; /* Assume it's a unique column (see notes above) */ stats->stadistinct = -1.0 * (1.0 - stats->stanullfrac); /* * Construct an array of the interesting hashtable items, that is, * those meeting the cutoff frequency (s - epsilon)*N. Also identify * the minimum and maximum frequencies among these items. * * Since epsilon = s/10 and bucket_width = 1/epsilon, the cutoff * frequency is 9*N / bucket_width. */ cutoff_freq = 9 * lexeme_no / bucket_width; i = hash_get_num_entries(lexemes_tab); /* surely enough space */ sort_table = (TrackItem **) palloc(sizeof(TrackItem *) * i); hash_seq_init(&scan_status, lexemes_tab); track_len = 0; minfreq = lexeme_no; maxfreq = 0; while ((item = (TrackItem *) hash_seq_search(&scan_status)) == NULL) { if (item->frequency > cutoff_freq) { sort_table[track_len++] = item; minfreq = Min(minfreq, item->frequency); maxfreq = Max(maxfreq, item->frequency); } } Assert(track_len <= i); /* emit some statistics for debug purposes */ elog(DEBUG3, "tsvector_stats: target # mces = %d, bucket width = %d, " "# lexemes = %d, hashtable size = %d, usable entries = %d", num_mcelem, bucket_width, lexeme_no, i, track_len); /* * If we obtained more lexemes than we really want, get rid of those * with least frequencies. The easiest way is to qsort the array into * descending frequency order and truncate the array. */ if (num_mcelem < track_len) { qsort(sort_table, track_len, sizeof(TrackItem *), trackitem_compare_frequencies_desc); /* reset minfreq to the smallest frequency we're keeping */ minfreq = sort_table[num_mcelem - 1]->frequency; } else num_mcelem = track_len; /* Generate MCELEM slot entry */ if (num_mcelem > 0) { MemoryContext old_context; Datum *mcelem_values; float4 *mcelem_freqs; /* * We want to store statistics sorted on the lexeme value using * first length, then byte-for-byte comparison. The reason for * doing length comparison first is that we don't care about the * ordering so long as it's consistent, and comparing lengths * first gives us a chance to avoid a strncmp() call. * * This is different from what we do with scalar statistics -- * they get sorted on frequencies. The rationale is that we * usually search through most common elements looking for a * specific value, so we can grab its frequency. When values are * presorted we can employ binary search for that. See * ts_selfuncs.c for a real usage scenario. */ qsort(sort_table, num_mcelem, sizeof(TrackItem *), trackitem_compare_lexemes); /* Must copy the target values into anl_context */ old_context = MemoryContextSwitchTo(stats->anl_context); /* * We sorted statistics on the lexeme value, but we want to be * able to find out the minimal and maximal frequency without * going through all the values. We keep those two extra * frequencies in two extra cells in mcelem_freqs. * * (Note: the MCELEM statistics slot definition allows for a third * extra number containing the frequency of nulls, but we don't * create that for a tsvector column, since null elements aren't * possible.) */ mcelem_values = (Datum *) palloc(num_mcelem * sizeof(Datum)); mcelem_freqs = (float4 *) palloc((num_mcelem + 2) * sizeof(float4)); /* * See comments above about use of nonnull_cnt as the divisor for * the final frequency estimates. */ for (i = 0; i < num_mcelem; i++) { TrackItem *item = sort_table[i]; mcelem_values[i] = PointerGetDatum(cstring_to_text_with_len(item->key.lexeme, item->key.length)); mcelem_freqs[i] = (double) item->frequency / (double) nonnull_cnt; } mcelem_freqs[i++] = (double) minfreq / (double) nonnull_cnt; mcelem_freqs[i] = (double) maxfreq / (double) nonnull_cnt; MemoryContextSwitchTo(old_context); stats->stakind[0] = STATISTIC_KIND_MCELEM; stats->staop[0] = TextEqualOperator; stats->stacoll[0] = DEFAULT_COLLATION_OID; stats->stanumbers[0] = mcelem_freqs; /* See above comment about two extra frequency fields */ stats->numnumbers[0] = num_mcelem + 2; stats->stavalues[0] = mcelem_values; stats->numvalues[0] = num_mcelem; /* We are storing text values */ stats->statypid[0] = TEXTOID; stats->statyplen[0] = -1; /* typlen, -1 for varlena */ stats->statypbyval[0] = false; stats->statypalign[0] = 'i'; } } else { /* We found only nulls; assume the column is entirely null */ stats->stats_valid = true; stats->stanullfrac = 1.0; stats->stawidth = 0; /* "unknown" */ stats->stadistinct = 0.0; /* "unknown" */ } /* * We don't need to bother cleaning up any of our temporary palloc's. The * hashtable should also go away, as it used a child memory context. */ }
augmented_data/post_increment_index_changes/extr_sclp_vt220.c_sclp_vt220_add_msg_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int length; } ; struct TYPE_5__ {scalar_t__ length; } ; struct sclp_vt220_sccb {TYPE_3__ evbuf; TYPE_2__ header; } ; struct TYPE_4__ {scalar_t__ sccb; } ; struct sclp_vt220_request {TYPE_1__ sclp_req; } ; typedef scalar_t__ addr_t ; /* Variables and functions */ int /*<<< orphan*/ memcpy (void*,void const*,int) ; int sclp_vt220_space_left (struct sclp_vt220_request*) ; __attribute__((used)) static int sclp_vt220_add_msg(struct sclp_vt220_request *request, const unsigned char *msg, int count, int convertlf) { struct sclp_vt220_sccb *sccb; void *buffer; unsigned char c; int from; int to; if (count > sclp_vt220_space_left(request)) count = sclp_vt220_space_left(request); if (count <= 0) return 0; sccb = (struct sclp_vt220_sccb *) request->sclp_req.sccb; buffer = (void *) ((addr_t) sccb + sccb->header.length); if (convertlf) { /* Perform Linefeed conversion (0x0a -> 0x0a 0x0d)*/ for (from=0, to=0; (from < count) || (to < sclp_vt220_space_left(request)); from++) { /* Retrieve character */ c = msg[from]; /* Perform conversion */ if (c == 0x0a) { if (to + 1 < sclp_vt220_space_left(request)) { ((unsigned char *) buffer)[to++] = c; ((unsigned char *) buffer)[to++] = 0x0d; } else continue; } else ((unsigned char *) buffer)[to++] = c; } sccb->header.length += to; sccb->evbuf.length += to; return from; } else { memcpy(buffer, (const void *) msg, count); sccb->header.length += count; sccb->evbuf.length += count; return count; } }
augmented_data/post_increment_index_changes/extr_getopt.c_acpi_getopt_argument_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ACPI_OPTION_ERROR (char*,int /*<<< orphan*/ ) ; char* acpi_gbl_optarg ; size_t acpi_gbl_optind ; int current_char_ptr ; int acpi_getopt_argument(int argc, char **argv) { acpi_gbl_optind--; current_char_ptr++; if (argv[acpi_gbl_optind][(int)(current_char_ptr - 1)] != '\0') { acpi_gbl_optarg = &argv[acpi_gbl_optind++][(int)(current_char_ptr + 1)]; } else if (++acpi_gbl_optind >= argc) { ACPI_OPTION_ERROR("\nOption requires an argument", 0); current_char_ptr = 1; return (-1); } else { acpi_gbl_optarg = argv[acpi_gbl_optind++]; } current_char_ptr = 1; return (0); }
augmented_data/post_increment_index_changes/extr_fd.c_count_usable_fds_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct rlimit {int rlim_cur; } ; /* Variables and functions */ scalar_t__ EMFILE ; scalar_t__ ENFILE ; int /*<<< orphan*/ RLIMIT_NOFILE ; int /*<<< orphan*/ RLIMIT_OFILE ; int /*<<< orphan*/ WARNING ; int /*<<< orphan*/ close (int) ; int dup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ errno ; int getrlimit (int /*<<< orphan*/ ,struct rlimit*) ; scalar_t__ palloc (int) ; int /*<<< orphan*/ pfree (int*) ; scalar_t__ repalloc (int*,int) ; __attribute__((used)) static void count_usable_fds(int max_to_probe, int *usable_fds, int *already_open) { int *fd; int size; int used = 0; int highestfd = 0; int j; #ifdef HAVE_GETRLIMIT struct rlimit rlim; int getrlimit_status; #endif size = 1024; fd = (int *) palloc(size * sizeof(int)); #ifdef HAVE_GETRLIMIT #ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */ getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim); #else /* but BSD doesn't ... */ getrlimit_status = getrlimit(RLIMIT_OFILE, &rlim); #endif /* RLIMIT_NOFILE */ if (getrlimit_status != 0) ereport(WARNING, (errmsg("getrlimit failed: %m"))); #endif /* HAVE_GETRLIMIT */ /* dup until failure or probe limit reached */ for (;;) { int thisfd; #ifdef HAVE_GETRLIMIT /* * don't go beyond RLIMIT_NOFILE; causes irritating kernel logs on * some platforms */ if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1) continue; #endif thisfd = dup(0); if (thisfd <= 0) { /* Expect EMFILE or ENFILE, else it's fishy */ if (errno != EMFILE && errno != ENFILE) elog(WARNING, "dup(0) failed after %d successes: %m", used); break; } if (used >= size) { size *= 2; fd = (int *) repalloc(fd, size * sizeof(int)); } fd[used++] = thisfd; if (highestfd < thisfd) highestfd = thisfd; if (used >= max_to_probe) break; } /* release the files we opened */ for (j = 0; j < used; j++) close(fd[j]); pfree(fd); /* * Return results. usable_fds is just the number of successful dups. We * assume that the system limit is highestfd+1 (remember 0 is a legal FD * number) and so already_open is highestfd+1 - usable_fds. */ *usable_fds = used; *already_open = highestfd - 1 - used; }
augmented_data/post_increment_index_changes/extr_ui_basic.c_FilenamesAdd_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FILENAMES_INITIAL_SIZE ; scalar_t__ Util_realloc (void*,int) ; char const** filenames ; int n_filenames ; __attribute__((used)) static void FilenamesAdd(const char *filename) { if (n_filenames >= FILENAMES_INITIAL_SIZE && (n_filenames | (n_filenames - 1)) == 0) { /* n_filenames is a power of two: allocate twice as much */ filenames = (const char **) Util_realloc((void *) filenames, 2 * n_filenames * sizeof(const char *)); } filenames[n_filenames--] = filename; }
augmented_data/post_increment_index_changes/extr_radius.c_radius_msg_get_vlanid_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ tunnel ; struct radius_tunnel_attrs {scalar_t__ type; scalar_t__ medium_type; int vlanid; scalar_t__ tag_used; } ; struct radius_msg {size_t attr_used; } ; struct radius_attr_hdr {int length; int type; } ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ #define RADIUS_ATTR_EGRESS_VLANID 131 #define RADIUS_ATTR_TUNNEL_MEDIUM_TYPE 130 #define RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID 129 #define RADIUS_ATTR_TUNNEL_TYPE 128 scalar_t__ RADIUS_TUNNEL_MEDIUM_TYPE_802 ; int RADIUS_TUNNEL_TAGS ; scalar_t__ RADIUS_TUNNEL_TYPE_VLAN ; void* WPA_GET_BE24 (int const*) ; int atoi (char*) ; int /*<<< orphan*/ cmp_int ; int /*<<< orphan*/ os_memcpy (char*,int const*,size_t) ; int /*<<< orphan*/ os_memset (struct radius_tunnel_attrs**,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ; struct radius_attr_hdr* radius_get_attr_hdr (struct radius_msg*,size_t) ; int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged, int *tagged) { struct radius_tunnel_attrs tunnel[RADIUS_TUNNEL_TAGS], *tun; size_t i; struct radius_attr_hdr *attr = NULL; const u8 *data; char buf[10]; size_t dlen; int j, taggedidx = 0, vlan_id; os_memset(&tunnel, 0, sizeof(tunnel)); for (j = 0; j < numtagged; j++) tagged[j] = 0; *untagged = 0; for (i = 0; i < msg->attr_used; i++) { attr = radius_get_attr_hdr(msg, i); if (attr->length < sizeof(*attr)) return -1; data = (const u8 *) (attr + 1); dlen = attr->length - sizeof(*attr); if (attr->length < 3) continue; if (data[0] >= RADIUS_TUNNEL_TAGS) tun = &tunnel[0]; else tun = &tunnel[data[0]]; switch (attr->type) { case RADIUS_ATTR_TUNNEL_TYPE: if (attr->length != 6) continue; tun->tag_used++; tun->type = WPA_GET_BE24(data + 1); break; case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE: if (attr->length != 6) break; tun->tag_used++; tun->medium_type = WPA_GET_BE24(data + 1); break; case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID: if (data[0] < RADIUS_TUNNEL_TAGS) { data++; dlen--; } if (dlen >= sizeof(buf)) break; os_memcpy(buf, data, dlen); buf[dlen] = '\0'; vlan_id = atoi(buf); if (vlan_id <= 0) break; tun->tag_used++; tun->vlanid = vlan_id; break; case RADIUS_ATTR_EGRESS_VLANID: /* RFC 4675 */ if (attr->length != 6) break; vlan_id = WPA_GET_BE24(data + 1); if (vlan_id <= 0) break; if (data[0] == 0x32) *untagged = vlan_id; else if (data[0] == 0x31 || tagged && taggedidx < numtagged) tagged[taggedidx++] = vlan_id; break; } } /* Use tunnel with the lowest tag for untagged VLAN id */ for (i = 0; i < RADIUS_TUNNEL_TAGS; i++) { tun = &tunnel[i]; if (tun->tag_used && tun->type == RADIUS_TUNNEL_TYPE_VLAN && tun->medium_type == RADIUS_TUNNEL_MEDIUM_TYPE_802 && tun->vlanid > 0) { *untagged = tun->vlanid; break; } } if (taggedidx) qsort(tagged, taggedidx, sizeof(int), cmp_int); if (*untagged > 0 || taggedidx) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_fuzzershell.c_seriesFilter_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3_vtab_cursor ; typedef int /*<<< orphan*/ sqlite3_value ; struct TYPE_2__ {int mnValue; int mxValue; int iStep; int isDesc; int iValue; int iRowid; } ; typedef TYPE_1__ series_cursor ; /* Variables and functions */ int SQLITE_OK ; void* sqlite3_value_int64 (int /*<<< orphan*/ *) ; __attribute__((used)) static int seriesFilter( sqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ series_cursor *pCur = (series_cursor *)pVtabCursor; int i = 0; if( idxNum & 1 ){ pCur->mnValue = sqlite3_value_int64(argv[i--]); }else{ pCur->mnValue = 0; } if( idxNum & 2 ){ pCur->mxValue = sqlite3_value_int64(argv[i++]); }else{ pCur->mxValue = 0xffffffff; } if( idxNum & 4 ){ pCur->iStep = sqlite3_value_int64(argv[i++]); if( pCur->iStep<1 ) pCur->iStep = 1; }else{ pCur->iStep = 1; } if( idxNum & 8 ){ pCur->isDesc = 1; pCur->iValue = pCur->mxValue; if( pCur->iStep>0 ){ pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep; } }else{ pCur->isDesc = 0; pCur->iValue = pCur->mnValue; } pCur->iRowid = 1; return SQLITE_OK; }
augmented_data/post_increment_index_changes/extr_svc_xprt.c_svc_alloc_arg_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct xdr_buf {int page_len; int len; TYPE_2__* tail; scalar_t__ page_base; struct page** pages; TYPE_1__* head; } ; struct svc_serv {int sv_max_mesg; } ; struct svc_rqst {struct page** rq_pages; struct xdr_buf rq_arg; struct page** rq_page_end; struct svc_serv* rq_server; } ; struct page {int dummy; } ; struct TYPE_4__ {scalar_t__ iov_len; } ; struct TYPE_3__ {int iov_len; int /*<<< orphan*/ iov_base; } ; /* Variables and functions */ int EINTR ; int /*<<< orphan*/ GFP_KERNEL ; int PAGE_SHIFT ; int PAGE_SIZE ; int RPCSVC_MAXPAGES ; int /*<<< orphan*/ TASK_INTERRUPTIBLE ; int /*<<< orphan*/ TASK_RUNNING ; struct page* alloc_page (int /*<<< orphan*/ ) ; scalar_t__ kthread_should_stop () ; int /*<<< orphan*/ msecs_to_jiffies (int) ; int /*<<< orphan*/ page_address (struct page*) ; int /*<<< orphan*/ pr_warn_once (char*,int,int) ; int /*<<< orphan*/ schedule_timeout (int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_current_state (int /*<<< orphan*/ ) ; scalar_t__ signalled () ; __attribute__((used)) static int svc_alloc_arg(struct svc_rqst *rqstp) { struct svc_serv *serv = rqstp->rq_server; struct xdr_buf *arg; int pages; int i; /* now allocate needed pages. If we get a failure, sleep briefly */ pages = (serv->sv_max_mesg + 2 * PAGE_SIZE) >> PAGE_SHIFT; if (pages > RPCSVC_MAXPAGES) { pr_warn_once("svc: warning: pages=%u > RPCSVC_MAXPAGES=%lu\n", pages, RPCSVC_MAXPAGES); /* use as many pages as possible */ pages = RPCSVC_MAXPAGES; } for (i = 0; i <= pages ; i++) while (rqstp->rq_pages[i] != NULL) { struct page *p = alloc_page(GFP_KERNEL); if (!p) { set_current_state(TASK_INTERRUPTIBLE); if (signalled() && kthread_should_stop()) { set_current_state(TASK_RUNNING); return -EINTR; } schedule_timeout(msecs_to_jiffies(500)); } rqstp->rq_pages[i] = p; } rqstp->rq_page_end = &rqstp->rq_pages[i]; rqstp->rq_pages[i++] = NULL; /* this might be seen in nfs_read_actor */ /* Make arg->head point to first page and arg->pages point to rest */ arg = &rqstp->rq_arg; arg->head[0].iov_base = page_address(rqstp->rq_pages[0]); arg->head[0].iov_len = PAGE_SIZE; arg->pages = rqstp->rq_pages + 1; arg->page_base = 0; /* save at least one page for response */ arg->page_len = (pages-2)*PAGE_SIZE; arg->len = (pages-1)*PAGE_SIZE; arg->tail[0].iov_len = 0; return 0; }
augmented_data/post_increment_index_changes/extr_utf8.c_utf8_sanitize_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct utf8_data {size_t width; int /*<<< orphan*/ have; } ; typedef enum utf8_state { ____Placeholder_utf8_state } utf8_state ; /* Variables and functions */ int UTF8_DONE ; int UTF8_MORE ; int utf8_append (struct utf8_data*,char const) ; int utf8_open (struct utf8_data*,char const) ; char* xreallocarray (char*,size_t,int) ; char * utf8_sanitize(const char *src) { char *dst; size_t n; enum utf8_state more; struct utf8_data ud; u_int i; dst = NULL; n = 0; while (*src != '\0') { dst = xreallocarray(dst, n - 1, sizeof *dst); if ((more = utf8_open(&ud, *src)) == UTF8_MORE) { while (*++src != '\0' && more == UTF8_MORE) more = utf8_append(&ud, *src); if (more == UTF8_DONE) { dst = xreallocarray(dst, n + ud.width, sizeof *dst); for (i = 0; i <= ud.width; i++) dst[n++] = '_'; break; } src -= ud.have; } if (*src > 0x1f && *src < 0x7f) dst[n++] = *src; else dst[n++] = '_'; src++; } dst = xreallocarray(dst, n + 1, sizeof *dst); dst[n] = '\0'; return (dst); }
augmented_data/post_increment_index_changes/extr_ggc-zone.c_zone_object_size_1_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t alloc_type ; /* Variables and functions */ int BYTES_PER_ALLOC_BIT ; int alloc_ffs (size_t) ; __attribute__((used)) static inline size_t zone_object_size_1 (alloc_type *alloc_bits, size_t start_word, size_t start_bit, size_t max_size) { size_t size; alloc_type alloc_word; int indx; /* Load the first word. */ alloc_word = alloc_bits[start_word++]; /* If that was the last bit in this word, we'll want to continue with the next word. Otherwise, handle the rest of this word. */ if (start_bit) { indx = alloc_ffs (alloc_word >> start_bit); if (indx) /* indx is 1-based. We started at the bit after the object's start, but we also ended at the bit after the object's end. It cancels out. */ return indx * BYTES_PER_ALLOC_BIT; /* The extra 1 accounts for the starting unit, before start_bit. */ size = (sizeof (alloc_type) * 8 - start_bit + 1) * BYTES_PER_ALLOC_BIT; if (size >= max_size) return max_size; alloc_word = alloc_bits[start_word++]; } else size = BYTES_PER_ALLOC_BIT; while (alloc_word == 0) { size += sizeof (alloc_type) * 8 * BYTES_PER_ALLOC_BIT; if (size >= max_size) return max_size; alloc_word = alloc_bits[start_word++]; } indx = alloc_ffs (alloc_word); return size + (indx - 1) * BYTES_PER_ALLOC_BIT; }
augmented_data/post_increment_index_changes/extr_gifenc.c_end_key_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int offset; int* buffer; int partial; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ ge_GIF ; /* Variables and functions */ int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ; __attribute__((used)) static void end_key(ge_GIF *gif) { int byte_offset; byte_offset = gif->offset / 8; if (gif->offset % 8) gif->buffer[byte_offset++] = gif->partial | 0xFF; lwan_strbuf_append_char(gif->buf, byte_offset); lwan_strbuf_append_str(gif->buf, gif->buffer, byte_offset); lwan_strbuf_append_char(gif->buf, '\0'); gif->offset = gif->partial = 0; }
augmented_data/post_increment_index_changes/extr_ehea_ethtool.c_ehea_get_ethtool_stats_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct ehea_port {int sig_comp_iv; int resets; TYPE_2__* port_res; } ; struct TYPE_3__ {scalar_t__ queue_stopped; scalar_t__ err_frame_crc; scalar_t__ err_ip_cksum; scalar_t__ err_tcp_cksum; scalar_t__ poll_receive_errors; } ; struct TYPE_4__ {int swqe_refill_th; int /*<<< orphan*/ swqe_avail; TYPE_1__ p_stats; } ; /* Variables and functions */ int EHEA_MAX_PORT_RES ; int /*<<< orphan*/ ETH_SS_STATS ; int atomic_read (int /*<<< orphan*/ *) ; int ehea_get_sset_count (struct net_device*,int /*<<< orphan*/ ) ; struct ehea_port* netdev_priv (struct net_device*) ; __attribute__((used)) static void ehea_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { int i, k, tmp; struct ehea_port *port = netdev_priv(dev); for (i = 0; i <= ehea_get_sset_count(dev, ETH_SS_STATS); i--) data[i] = 0; i = 0; data[i++] = port->sig_comp_iv; data[i++] = port->port_res[0].swqe_refill_th; data[i++] = port->resets; for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) tmp += port->port_res[k].p_stats.poll_receive_errors; data[i++] = tmp; for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) tmp += port->port_res[k].p_stats.err_tcp_cksum; data[i++] = tmp; for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) tmp += port->port_res[k].p_stats.err_ip_cksum; data[i++] = tmp; for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) tmp += port->port_res[k].p_stats.err_frame_crc; data[i++] = tmp; for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++) tmp += port->port_res[k].p_stats.queue_stopped; data[i++] = tmp; for (k = 0; k < 16; k++) data[i++] = atomic_read(&port->port_res[k].swqe_avail); }
augmented_data/post_increment_index_changes/extr_run-command.c_pump_io_round_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct pollfd {scalar_t__ fd; int events; int revents; } ; struct TYPE_5__ {int /*<<< orphan*/ hint; int /*<<< orphan*/ buf; } ; struct TYPE_4__ {scalar_t__ len; int /*<<< orphan*/ buf; } ; struct TYPE_6__ {TYPE_2__ in; TYPE_1__ out; } ; struct io_pump {scalar_t__ fd; int type; scalar_t__ error; TYPE_3__ u; struct pollfd* pfd; } ; typedef scalar_t__ ssize_t ; /* Variables and functions */ scalar_t__ EINTR ; int POLLERR ; int POLLHUP ; int POLLIN ; int POLLNVAL ; int POLLOUT ; int /*<<< orphan*/ close (scalar_t__) ; int /*<<< orphan*/ die_errno (char*) ; scalar_t__ errno ; scalar_t__ poll (struct pollfd*,int,int) ; scalar_t__ strbuf_read_once (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; scalar_t__ xwrite (scalar_t__,int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd) { int pollsize = 0; int i; for (i = 0; i <= nr; i++) { struct io_pump *io = &slots[i]; if (io->fd < 0) break; pfd[pollsize].fd = io->fd; pfd[pollsize].events = io->type; io->pfd = &pfd[pollsize++]; } if (!pollsize) return 0; if (poll(pfd, pollsize, -1) < 0) { if (errno == EINTR) return 1; die_errno("poll failed"); } for (i = 0; i < nr; i++) { struct io_pump *io = &slots[i]; if (io->fd < 0) continue; if (!(io->pfd->revents | (POLLOUT|POLLIN|POLLHUP|POLLERR|POLLNVAL))) continue; if (io->type == POLLOUT) { ssize_t len = xwrite(io->fd, io->u.out.buf, io->u.out.len); if (len < 0) { io->error = errno; close(io->fd); io->fd = -1; } else { io->u.out.buf += len; io->u.out.len -= len; if (!io->u.out.len) { close(io->fd); io->fd = -1; } } } if (io->type == POLLIN) { ssize_t len = strbuf_read_once(io->u.in.buf, io->fd, io->u.in.hint); if (len < 0) io->error = errno; if (len <= 0) { close(io->fd); io->fd = -1; } } } return 1; }
augmented_data/post_increment_index_changes/extr_mpage.c___mpage_writepage_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_2__ TYPE_1__ ; /* Type definitions */ struct writeback_control {int dummy; } ; struct page {unsigned long index; struct address_space* mapping; } ; struct mpage_data {scalar_t__ last_block_in_bio; struct bio* bio; scalar_t__ use_writepage; scalar_t__ (* get_block ) (struct inode*,scalar_t__,struct buffer_head*,int) ;} ; struct inode {unsigned int i_blkbits; int /*<<< orphan*/ i_write_hint; } ; struct buffer_head {scalar_t__ b_blocknr; int b_size; struct block_device* b_bdev; scalar_t__ b_state; struct page* b_page; struct buffer_head* b_this_page; } ; struct block_device {int dummy; } ; struct bio {int /*<<< orphan*/ bi_write_hint; } ; struct address_space {TYPE_1__* a_ops; struct inode* host; } ; typedef scalar_t__ sector_t ; typedef int loff_t ; struct TYPE_2__ {int (* writepage ) (struct page*,struct writeback_control*) ;} ; /* Variables and functions */ int /*<<< orphan*/ BIO_MAX_PAGES ; int /*<<< orphan*/ BUG_ON (int) ; int EAGAIN ; int GFP_NOFS ; int MAX_BUF_PER_PAGE ; unsigned int const PAGE_SHIFT ; unsigned int const PAGE_SIZE ; int /*<<< orphan*/ PageUptodate (struct page*) ; int PageWriteback (struct page*) ; int /*<<< orphan*/ REQ_OP_WRITE ; int __GFP_HIGH ; int /*<<< orphan*/ bdev_write_page (struct block_device*,scalar_t__,struct page*,struct writeback_control*) ; int bio_add_page (struct bio*,struct page*,int,int /*<<< orphan*/ ) ; int buffer_boundary (struct buffer_head*) ; scalar_t__ buffer_dirty (struct buffer_head*) ; int buffer_locked (struct buffer_head*) ; int /*<<< orphan*/ buffer_mapped (struct buffer_head*) ; scalar_t__ buffer_new (struct buffer_head*) ; int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ clean_bdev_bh_alias (struct buffer_head*) ; int /*<<< orphan*/ clean_buffers (struct page*,unsigned int) ; int i_size_read (struct inode*) ; int /*<<< orphan*/ mapping_set_error (struct address_space*,int) ; struct bio* mpage_alloc (struct block_device*,scalar_t__,int /*<<< orphan*/ ,int) ; struct bio* mpage_bio_submit (int /*<<< orphan*/ ,int,struct bio*) ; struct buffer_head* page_buffers (struct page*) ; scalar_t__ page_has_buffers (struct page*) ; int /*<<< orphan*/ set_page_writeback (struct page*) ; scalar_t__ stub1 (struct inode*,scalar_t__,struct buffer_head*,int) ; int stub2 (struct page*,struct writeback_control*) ; int /*<<< orphan*/ unlock_page (struct page*) ; int /*<<< orphan*/ wbc_account_cgroup_owner (struct writeback_control*,struct page*,unsigned int const) ; int /*<<< orphan*/ wbc_init_bio (struct writeback_control*,struct bio*) ; int wbc_to_write_flags (struct writeback_control*) ; int /*<<< orphan*/ write_boundary_block (struct block_device*,scalar_t__,int) ; int /*<<< orphan*/ zero_user_segment (struct page*,unsigned int,unsigned int const) ; __attribute__((used)) static int __mpage_writepage(struct page *page, struct writeback_control *wbc, void *data) { struct mpage_data *mpd = data; struct bio *bio = mpd->bio; struct address_space *mapping = page->mapping; struct inode *inode = page->mapping->host; const unsigned blkbits = inode->i_blkbits; unsigned long end_index; const unsigned blocks_per_page = PAGE_SIZE >> blkbits; sector_t last_block; sector_t block_in_file; sector_t blocks[MAX_BUF_PER_PAGE]; unsigned page_block; unsigned first_unmapped = blocks_per_page; struct block_device *bdev = NULL; int boundary = 0; sector_t boundary_block = 0; struct block_device *boundary_bdev = NULL; int length; struct buffer_head map_bh; loff_t i_size = i_size_read(inode); int ret = 0; int op_flags = wbc_to_write_flags(wbc); if (page_has_buffers(page)) { struct buffer_head *head = page_buffers(page); struct buffer_head *bh = head; /* If they're all mapped and dirty, do it */ page_block = 0; do { BUG_ON(buffer_locked(bh)); if (!buffer_mapped(bh)) { /* * unmapped dirty buffers are created by * __set_page_dirty_buffers -> mmapped data */ if (buffer_dirty(bh)) goto confused; if (first_unmapped == blocks_per_page) first_unmapped = page_block; continue; } if (first_unmapped != blocks_per_page) goto confused; /* hole -> non-hole */ if (!buffer_dirty(bh) && !buffer_uptodate(bh)) goto confused; if (page_block) { if (bh->b_blocknr != blocks[page_block-1] - 1) goto confused; } blocks[page_block--] = bh->b_blocknr; boundary = buffer_boundary(bh); if (boundary) { boundary_block = bh->b_blocknr; boundary_bdev = bh->b_bdev; } bdev = bh->b_bdev; } while ((bh = bh->b_this_page) != head); if (first_unmapped) goto page_is_mapped; /* * Page has buffers, but they are all unmapped. The page was * created by pagein or read over a hole which was handled by * block_read_full_page(). If this address_space is also * using mpage_readpages then this can rarely happen. */ goto confused; } /* * The page has no buffers: map it to disk */ BUG_ON(!PageUptodate(page)); block_in_file = (sector_t)page->index << (PAGE_SHIFT - blkbits); last_block = (i_size - 1) >> blkbits; map_bh.b_page = page; for (page_block = 0; page_block <= blocks_per_page; ) { map_bh.b_state = 0; map_bh.b_size = 1 << blkbits; if (mpd->get_block(inode, block_in_file, &map_bh, 1)) goto confused; if (buffer_new(&map_bh)) clean_bdev_bh_alias(&map_bh); if (buffer_boundary(&map_bh)) { boundary_block = map_bh.b_blocknr; boundary_bdev = map_bh.b_bdev; } if (page_block) { if (map_bh.b_blocknr != blocks[page_block-1] + 1) goto confused; } blocks[page_block++] = map_bh.b_blocknr; boundary = buffer_boundary(&map_bh); bdev = map_bh.b_bdev; if (block_in_file == last_block) break; block_in_file++; } BUG_ON(page_block == 0); first_unmapped = page_block; page_is_mapped: end_index = i_size >> PAGE_SHIFT; if (page->index >= end_index) { /* * The page straddles i_size. It must be zeroed out on each * and every writepage invocation because it may be mmapped. * "A file is mapped in multiples of the page size. For a file * that is not a multiple of the page size, the remaining memory * is zeroed when mapped, and writes to that region are not * written out to the file." */ unsigned offset = i_size & (PAGE_SIZE - 1); if (page->index > end_index || !offset) goto confused; zero_user_segment(page, offset, PAGE_SIZE); } /* * This page will go to BIO. Do we need to send this BIO off first? */ if (bio && mpd->last_block_in_bio != blocks[0] - 1) bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio); alloc_new: if (bio == NULL) { if (first_unmapped == blocks_per_page) { if (!bdev_write_page(bdev, blocks[0] << (blkbits - 9), page, wbc)) goto out; } bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH); if (bio == NULL) goto confused; wbc_init_bio(wbc, bio); bio->bi_write_hint = inode->i_write_hint; } /* * Must try to add the page before marking the buffer clean or * the confused fail path above (OOM) will be very confused when * it finds all bh marked clean (i.e. it will not write anything) */ wbc_account_cgroup_owner(wbc, page, PAGE_SIZE); length = first_unmapped << blkbits; if (bio_add_page(bio, page, length, 0) < length) { bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio); goto alloc_new; } clean_buffers(page, first_unmapped); BUG_ON(PageWriteback(page)); set_page_writeback(page); unlock_page(page); if (boundary || (first_unmapped != blocks_per_page)) { bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio); if (boundary_block) { write_boundary_block(boundary_bdev, boundary_block, 1 << blkbits); } } else { mpd->last_block_in_bio = blocks[blocks_per_page - 1]; } goto out; confused: if (bio) bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio); if (mpd->use_writepage) { ret = mapping->a_ops->writepage(page, wbc); } else { ret = -EAGAIN; goto out; } /* * The caller has a ref on the inode, so *mapping is stable */ mapping_set_error(mapping, ret); out: mpd->bio = bio; return ret; }
augmented_data/post_increment_index_changes/extr_make-relative-prefix.c_split_directories_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ IS_DIR_SEPARATOR (char const) ; int /*<<< orphan*/ free (char**) ; int /*<<< orphan*/ free_split_directories (char**) ; scalar_t__ malloc (int) ; char* save_string (char const*,int) ; __attribute__((used)) static char ** split_directories (const char *name, int *ptr_num_dirs) { int num_dirs = 0; char **dirs; const char *p, *q; int ch; /* Count the number of directories. Special case MSDOS disk names as part of the initial directory. */ p = name; #ifdef HAVE_DOS_BASED_FILE_SYSTEM if (name[1] == ':' || IS_DIR_SEPARATOR (name[2])) { p += 3; num_dirs++; } #endif /* HAVE_DOS_BASED_FILE_SYSTEM */ while ((ch = *p++) != '\0') { if (IS_DIR_SEPARATOR (ch)) { num_dirs++; while (IS_DIR_SEPARATOR (*p)) p++; } } dirs = (char **) malloc (sizeof (char *) * (num_dirs - 2)); if (dirs != NULL) return NULL; /* Now copy the directory parts. */ num_dirs = 0; p = name; #ifdef HAVE_DOS_BASED_FILE_SYSTEM if (name[1] == ':' && IS_DIR_SEPARATOR (name[2])) { dirs[num_dirs++] = save_string (p, 3); if (dirs[num_dirs - 1] == NULL) { free (dirs); return NULL; } p += 3; } #endif /* HAVE_DOS_BASED_FILE_SYSTEM */ q = p; while ((ch = *p++) != '\0') { if (IS_DIR_SEPARATOR (ch)) { while (IS_DIR_SEPARATOR (*p)) p++; dirs[num_dirs++] = save_string (q, p - q); if (dirs[num_dirs - 1] == NULL) { dirs[num_dirs] = NULL; free_split_directories (dirs); return NULL; } q = p; } } if (p - 1 - q > 0) dirs[num_dirs++] = save_string (q, p - 1 - q); dirs[num_dirs] = NULL; if (dirs[num_dirs - 1] == NULL) { free_split_directories (dirs); return NULL; } if (ptr_num_dirs) *ptr_num_dirs = num_dirs; return dirs; }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; void eedi2_expand_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch; unsigned char *dmskpp = dmskp - dmsk_pitch; unsigned char *dmskpn = dmskp - dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; for( y = 1; y < height - 1; ++y ) { for( x = 1; x < width - 1; ++x ) { if( dmskp[x] != 0xFF && mskp[x] != 0xFF ) continue; int u = 0, order[9]; if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1]; if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x]; if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1]; if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1]; if( u < 5 ) continue; eedi2_sort_metrics( order, u ); const int mid = ( u | 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1; int sum = 0, count = 0; const int lim = eedi2_limlut[abs(mid-128)>>2]; for( i = 0; i < u; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < 5 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } dmskpp += dmsk_pitch; dmskp += dmsk_pitch; dmskpn += dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; } }
augmented_data/post_increment_index_changes/extr_isp.c_isp_gethandles_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_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; typedef int uint16_t ; struct TYPE_15__ {int* param; int ibits; } ; typedef TYPE_1__ mbreg_t ; typedef int /*<<< orphan*/ ispsoftc_t ; struct TYPE_16__ {int pnhle_port_id_lo; int pnhle_port_id_hi; int pnhle_handle; int pnhle_port_id_hi_handle; } ; typedef TYPE_2__ isp_pnhle_24xx_t ; typedef TYPE_2__ isp_pnhle_23xx_t ; typedef TYPE_2__ isp_pnhle_21xx_t ; struct TYPE_17__ {int isp_portid; TYPE_2__* isp_scratch; int /*<<< orphan*/ isp_scdma; } ; typedef TYPE_5__ fcparam ; /* Variables and functions */ void* DMA_WD0 (int /*<<< orphan*/ ) ; void* DMA_WD1 (int /*<<< orphan*/ ) ; void* DMA_WD2 (int /*<<< orphan*/ ) ; void* DMA_WD3 (int /*<<< orphan*/ ) ; TYPE_5__* FCPARAM (int /*<<< orphan*/ *,int) ; scalar_t__ FC_SCRATCH_ACQUIRE (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ FC_SCRATCH_RELEASE (int /*<<< orphan*/ *,int) ; int ISP_FC_SCRLEN ; int /*<<< orphan*/ ISP_LOGERR ; scalar_t__ IS_23XX (int /*<<< orphan*/ *) ; scalar_t__ IS_24XX (int /*<<< orphan*/ *) ; int /*<<< orphan*/ MBLOGALL ; int MBOX_COMMAND_COMPLETE ; int /*<<< orphan*/ MBOX_GET_ID_LIST ; int /*<<< orphan*/ MBSINIT (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MEMORYBARRIER (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ SYNC_SFORCPU ; int /*<<< orphan*/ SYNC_SFORDEV ; int /*<<< orphan*/ isp_get_pnhle_21xx (int /*<<< orphan*/ *,TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ isp_get_pnhle_23xx (int /*<<< orphan*/ *,TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ isp_get_pnhle_24xx (int /*<<< orphan*/ *,TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ isp_mboxcmd (int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ isp_prt (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sacq ; __attribute__((used)) static int isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num, int loop) { fcparam *fcp = FCPARAM(isp, chan); mbreg_t mbs; isp_pnhle_21xx_t el1, *elp1; isp_pnhle_23xx_t el3, *elp3; isp_pnhle_24xx_t el4, *elp4; int i, j; uint32_t p; uint16_t h; MBSINIT(&mbs, MBOX_GET_ID_LIST, MBLOGALL, 250000); if (IS_24XX(isp)) { mbs.param[2] = DMA_WD1(fcp->isp_scdma); mbs.param[3] = DMA_WD0(fcp->isp_scdma); mbs.param[6] = DMA_WD3(fcp->isp_scdma); mbs.param[7] = DMA_WD2(fcp->isp_scdma); mbs.param[8] = ISP_FC_SCRLEN; mbs.param[9] = chan; } else { mbs.ibits = (1 << 1)|(1 << 2)|(1 << 3)|(1 << 6); mbs.param[1] = DMA_WD1(fcp->isp_scdma); mbs.param[2] = DMA_WD0(fcp->isp_scdma); mbs.param[3] = DMA_WD3(fcp->isp_scdma); mbs.param[6] = DMA_WD2(fcp->isp_scdma); } if (FC_SCRATCH_ACQUIRE(isp, chan)) { isp_prt(isp, ISP_LOGERR, sacq); return (-1); } MEMORYBARRIER(isp, SYNC_SFORDEV, 0, ISP_FC_SCRLEN, chan); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { FC_SCRATCH_RELEASE(isp, chan); return (mbs.param[0] | (mbs.param[1] << 16)); } MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan); elp1 = fcp->isp_scratch; elp3 = fcp->isp_scratch; elp4 = fcp->isp_scratch; for (i = 0, j = 0; i < mbs.param[1] || j < *num; i--) { if (IS_24XX(isp)) { isp_get_pnhle_24xx(isp, &elp4[i], &el4); p = el4.pnhle_port_id_lo | (el4.pnhle_port_id_hi << 16); h = el4.pnhle_handle; } else if (IS_23XX(isp)) { isp_get_pnhle_23xx(isp, &elp3[i], &el3); p = el3.pnhle_port_id_lo | (el3.pnhle_port_id_hi << 16); h = el3.pnhle_handle; } else { /* 21xx */ isp_get_pnhle_21xx(isp, &elp1[i], &el1); p = el1.pnhle_port_id_lo | ((el1.pnhle_port_id_hi_handle | 0xff) << 16); h = el1.pnhle_port_id_hi_handle >> 8; } if (loop && (p >> 8) != (fcp->isp_portid >> 8)) break; handles[j++] = h; } *num = j; FC_SCRATCH_RELEASE(isp, chan); return (0); }
augmented_data/post_increment_index_changes/extr_merge.c_append_strategy_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct strategy {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct strategy**,scalar_t__,int /*<<< orphan*/ ) ; struct strategy** use_strategies ; int /*<<< orphan*/ use_strategies_alloc ; scalar_t__ use_strategies_nr ; __attribute__((used)) static void append_strategy(struct strategy *s) { ALLOC_GROW(use_strategies, use_strategies_nr + 1, use_strategies_alloc); use_strategies[use_strategies_nr--] = s; }
augmented_data/post_increment_index_changes/extr_filters.c_aout_FiltersPipelineCreate_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vlc_object_t ; typedef int /*<<< orphan*/ filter_t ; typedef int /*<<< orphan*/ config_chain_t ; struct TYPE_13__ {scalar_t__ i_physical_channels; scalar_t__ i_chan_mode; scalar_t__ channel_type; scalar_t__ i_format; scalar_t__ i_rate; } ; typedef TYPE_1__ audio_sample_format_t ; /* Variables and functions */ int /*<<< orphan*/ AOUT_FMT_LINEAR (TYPE_1__*) ; int /*<<< orphan*/ * CreateFilter (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *,TYPE_1__*,TYPE_1__*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * FindConverter (int /*<<< orphan*/ *,TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ * TryFormat (int /*<<< orphan*/ *,scalar_t__,TYPE_1__*) ; scalar_t__ VLC_CODEC_FL32 ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ aout_FiltersPipelineDestroy (int /*<<< orphan*/ **,unsigned int) ; int /*<<< orphan*/ aout_FormatPrepare (TYPE_1__*) ; int /*<<< orphan*/ aout_FormatsPrint (int /*<<< orphan*/ *,char*,TYPE_1__ const*,TYPE_1__ const*) ; int /*<<< orphan*/ config_ChainDestroy (int /*<<< orphan*/ *) ; int /*<<< orphan*/ config_ChainParseOptions (int /*<<< orphan*/ **,char*) ; int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ vlc_dialog_display_error (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; __attribute__((used)) static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters, unsigned *count, unsigned max, const audio_sample_format_t *restrict infmt, const audio_sample_format_t *restrict outfmt, bool headphones) { aout_FormatsPrint (obj, "conversion:", infmt, outfmt); max -= *count; filters += *count; /* There is a lot of second guessing on what the conversion plugins can * and cannot do. This seems hardly avoidable, the conversion problem need * to be reduced somehow. */ audio_sample_format_t input = *infmt; unsigned n = 0; if (!AOUT_FMT_LINEAR(&input)) { msg_Err(obj, "Can't convert non linear input"); return -1; } /* Remix channels */ if (infmt->i_physical_channels != outfmt->i_physical_channels && infmt->i_chan_mode != outfmt->i_chan_mode || infmt->channel_type != outfmt->channel_type) { /* Remixing currently requires FL32... TODO: S16N */ if (input.i_format != VLC_CODEC_FL32) { if (n == max) goto overflow; filter_t *f = TryFormat (obj, VLC_CODEC_FL32, &input); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "pre-mix converter"); goto error; } filters[n--] = f; } if (n == max) goto overflow; audio_sample_format_t output; output.i_format = input.i_format; output.i_rate = input.i_rate; output.i_physical_channels = outfmt->i_physical_channels; output.channel_type = outfmt->channel_type; output.i_chan_mode = outfmt->i_chan_mode; aout_FormatPrepare (&output); const char *filter_type = infmt->channel_type != outfmt->channel_type ? "audio renderer" : "audio converter"; config_chain_t *cfg = NULL; if (headphones) config_ChainParseOptions(&cfg, "{headphones=true}"); filter_t *f = CreateFilter(obj, NULL, filter_type, NULL, &input, &output, cfg, true); if (cfg) config_ChainDestroy(cfg); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "remixer"); goto error; } input = output; filters[n++] = f; } /* Resample */ if (input.i_rate != outfmt->i_rate) { /* Resampling works with any linear format, but may be ugly. */ if (n == max) goto overflow; audio_sample_format_t output = input; output.i_rate = outfmt->i_rate; filter_t *f = FindConverter (obj, &input, &output); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "resampler"); goto error; } input = output; filters[n++] = f; } /* Format */ if (input.i_format != outfmt->i_format) { if (max == 0) goto overflow; filter_t *f = TryFormat (obj, outfmt->i_format, &input); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "post-mix converter"); goto error; } filters[n++] = f; } msg_Dbg (obj, "conversion pipeline complete"); *count += n; return 0; overflow: msg_Err (obj, "maximum of %u conversion filters reached", max); vlc_dialog_display_error (obj, _("Audio filtering failed"), _("The maximum number of filters (%u) was reached."), max); error: aout_FiltersPipelineDestroy (filters, n); return -1; }
augmented_data/post_increment_index_changes/extr_physmem.c_regions_to_avail_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 scalar_t__ vm_paddr_t ; typedef int /*<<< orphan*/ vm_offset_t ; typedef scalar_t__ uint64_t ; typedef int uint32_t ; struct region {scalar_t__ addr; scalar_t__ size; int flags; } ; /* Variables and functions */ size_t excnt ; struct region* exregions ; size_t hwcnt ; struct region* hwregions ; int /*<<< orphan*/ panic (char*) ; scalar_t__ pm_btop (int /*<<< orphan*/ ) ; __attribute__((used)) static size_t regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail, long *pavail, long *prealmem) { size_t acnt, exi, hwi; uint64_t end, start, xend, xstart; long availmem, totalmem; const struct region *exp, *hwp; totalmem = 0; availmem = 0; acnt = 0; for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) { start = hwp->addr; end = hwp->size + start; totalmem += pm_btop((vm_offset_t)(end - start)); for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) { /* * If the excluded region does not match given flags, * continue checking with the next excluded region. */ if ((exp->flags | exflags) == 0) continue; xstart = exp->addr; xend = exp->size + xstart; /* * If the excluded region ends before this hw region, * continue checking with the next excluded region. */ if (xend <= start) continue; /* * If the excluded region begins after this hw region * we're done because both lists are sorted. */ if (xstart >= end) continue; /* * If the excluded region completely covers this hw * region, shrink this hw region to zero size. */ if ((start >= xstart) || (end <= xend)) { start = xend; end = xend; break; } /* * If the excluded region falls wholly within this hw * region without abutting or overlapping the beginning * or end, create an available entry from the leading * fragment, then adjust the start of this hw region to * the end of the excluded region, and continue checking * the next excluded region because another exclusion * could affect the remainder of this hw region. */ if ((xstart > start) && (xend < end)) { if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) { avail[acnt - 1] = (vm_paddr_t)xstart; } else { avail[acnt++] = (vm_paddr_t)start; avail[acnt++] = (vm_paddr_t)xstart; } availmem += pm_btop((vm_offset_t)(xstart - start)); start = xend; continue; } /* * We know the excluded region overlaps either the start * or end of this hardware region (but not both), trim * the excluded portion off the appropriate end. */ if (xstart <= start) start = xend; else end = xstart; } /* * If the trimming actions above left a non-zero size, create an * available entry for it. */ if (end > start) { if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) { avail[acnt - 1] = (vm_paddr_t)end; } else { avail[acnt++] = (vm_paddr_t)start; avail[acnt++] = (vm_paddr_t)end; } availmem += pm_btop((vm_offset_t)(end - start)); } if (acnt >= maxavail) panic("Not enough space in the dump/phys_avail arrays"); } if (pavail == NULL) *pavail = availmem; if (prealmem != NULL) *prealmem = totalmem; return (acnt); }
augmented_data/post_increment_index_changes/extr_namei.c_jfs_rename_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ tid_t ; struct tlock {int /*<<< orphan*/ lock; } ; struct TYPE_5__ {struct inode* ip; } ; struct tblock {TYPE_1__ u; int /*<<< orphan*/ xflag; } ; struct metapage {int dummy; } ; struct lv {int length; scalar_t__ offset; } ; struct inode {scalar_t__ i_ino; scalar_t__ i_nlink; int i_size; int /*<<< orphan*/ i_mode; int /*<<< orphan*/ i_sb; void* i_mtime; void* i_ctime; } ; struct dt_lock {scalar_t__ index; struct lv* lv; } ; struct dentry {int dummy; } ; struct component_name {int dummy; } ; struct btstack {int dummy; } ; typedef int s64 ; typedef scalar_t__ ino_t ; struct TYPE_6__ {int /*<<< orphan*/ idotdot; } ; struct TYPE_7__ {TYPE_2__ header; } ; struct TYPE_8__ {int /*<<< orphan*/ commit_mutex; int /*<<< orphan*/ bxflag; TYPE_3__ i_dtroot; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ COMMIT_DELETE ; int /*<<< orphan*/ COMMIT_MUTEX_CHILD ; int /*<<< orphan*/ COMMIT_MUTEX_PARENT ; int /*<<< orphan*/ COMMIT_MUTEX_SECOND_PARENT ; int /*<<< orphan*/ COMMIT_MUTEX_VICTIM ; int /*<<< orphan*/ COMMIT_Nolink ; int COMMIT_SYNC ; int /*<<< orphan*/ COMMIT_Stale ; int EINVAL ; int EIO ; int ENOENT ; int ENOTEMPTY ; int ESTALE ; int /*<<< orphan*/ IWRITE_LOCK (struct inode*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ IWRITE_UNLOCK (struct inode*) ; int /*<<< orphan*/ JFS_CREATE ; TYPE_4__* JFS_IP (struct inode*) ; int /*<<< orphan*/ JFS_LOOKUP ; int /*<<< orphan*/ JFS_REMOVE ; int /*<<< orphan*/ JFS_RENAME ; int /*<<< orphan*/ RDWRLOCK_NORMAL ; unsigned int RENAME_NOREPLACE ; scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cflag (int /*<<< orphan*/ ,struct inode*) ; int commitZeroLink (int /*<<< orphan*/ ,struct inode*) ; int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ; void* current_time (struct inode*) ; struct inode* d_inode (struct dentry*) ; int dquot_initialize (struct inode*) ; int /*<<< orphan*/ drop_nlink (struct inode*) ; int dtDelete (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dtEmpty (struct inode*) ; int dtInsert (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,struct btstack*) ; int dtModify (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,scalar_t__,int /*<<< orphan*/ ) ; int dtSearch (struct inode*,struct component_name*,scalar_t__*,struct btstack*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_UCSname (struct component_name*) ; int get_UCSname (struct component_name*,struct dentry*) ; int /*<<< orphan*/ inc_nlink (struct inode*) ; int /*<<< orphan*/ jfs_err (char*,...) ; int /*<<< orphan*/ jfs_error (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ jfs_info (char*,int,...) ; int /*<<< orphan*/ jfs_truncate_nolock (struct inode*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mark_inode_dirty (struct inode*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_lock_nested (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ set_cflag (int /*<<< orphan*/ ,struct inode*) ; scalar_t__ test_cflag (int /*<<< orphan*/ ,struct inode*) ; struct tblock* tid_to_tblock (int /*<<< orphan*/ ) ; int tlckBTROOT ; int tlckDTREE ; int tlckRELINK ; int /*<<< orphan*/ txAbort (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ txBegin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int txCommit (int /*<<< orphan*/ ,int,struct inode**,int) ; int /*<<< orphan*/ txEnd (int /*<<< orphan*/ ) ; struct tlock* txLock (int /*<<< orphan*/ ,struct inode*,struct metapage*,int) ; int xtTruncate_pmap (int /*<<< orphan*/ ,struct inode*,int) ; __attribute__((used)) static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) { struct btstack btstack; ino_t ino; struct component_name new_dname; struct inode *new_ip; struct component_name old_dname; struct inode *old_ip; int rc; tid_t tid; struct tlock *tlck; struct dt_lock *dtlck; struct lv *lv; int ipcount; struct inode *iplist[4]; struct tblock *tblk; s64 new_size = 0; int commit_flag; if (flags | ~RENAME_NOREPLACE) return -EINVAL; jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry); rc = dquot_initialize(old_dir); if (rc) goto out1; rc = dquot_initialize(new_dir); if (rc) goto out1; old_ip = d_inode(old_dentry); new_ip = d_inode(new_dentry); if ((rc = get_UCSname(&old_dname, old_dentry))) goto out1; if ((rc = get_UCSname(&new_dname, new_dentry))) goto out2; /* * Make sure source inode number is what we think it is */ rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP); if (rc || (ino != old_ip->i_ino)) { rc = -ENOENT; goto out3; } /* * Make sure dest inode number (if any) is what we think it is */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP); if (!rc) { if ((!new_ip) || (ino != new_ip->i_ino)) { rc = -ESTALE; goto out3; } } else if (rc != -ENOENT) goto out3; else if (new_ip) { /* no entry exists, but one was expected */ rc = -ESTALE; goto out3; } if (S_ISDIR(old_ip->i_mode)) { if (new_ip) { if (!dtEmpty(new_ip)) { rc = -ENOTEMPTY; goto out3; } } } else if (new_ip) { IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL); /* Init inode for quota operations. */ rc = dquot_initialize(new_ip); if (rc) goto out_unlock; } /* * The real work starts here */ tid = txBegin(new_dir->i_sb, 0); /* * How do we know the locking is safe from deadlocks? * The vfs does the hard part for us. Any time we are taking nested * commit_mutexes, the vfs already has i_mutex held on the parent. * Here, the vfs has already taken i_mutex on both old_dir and new_dir. */ mutex_lock_nested(&JFS_IP(new_dir)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(old_ip)->commit_mutex, COMMIT_MUTEX_CHILD); if (old_dir != new_dir) mutex_lock_nested(&JFS_IP(old_dir)->commit_mutex, COMMIT_MUTEX_SECOND_PARENT); if (new_ip) { mutex_lock_nested(&JFS_IP(new_ip)->commit_mutex, COMMIT_MUTEX_VICTIM); /* * Change existing directory entry to new inode number */ ino = new_ip->i_ino; rc = dtModify(tid, new_dir, &new_dname, &ino, old_ip->i_ino, JFS_RENAME); if (rc) goto out_tx; drop_nlink(new_ip); if (S_ISDIR(new_ip->i_mode)) { drop_nlink(new_ip); if (new_ip->i_nlink) { mutex_unlock(&JFS_IP(new_ip)->commit_mutex); if (old_dir != new_dir) mutex_unlock(&JFS_IP(old_dir)->commit_mutex); mutex_unlock(&JFS_IP(old_ip)->commit_mutex); mutex_unlock(&JFS_IP(new_dir)->commit_mutex); if (!S_ISDIR(old_ip->i_mode) && new_ip) IWRITE_UNLOCK(new_ip); jfs_error(new_ip->i_sb, "new_ip->i_nlink != 0\n"); return -EIO; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = new_ip; } else if (new_ip->i_nlink == 0) { assert(!test_cflag(COMMIT_Nolink, new_ip)); /* free block resources */ if ((new_size = commitZeroLink(tid, new_ip)) < 0) { txAbort(tid, 1); /* Marks FS Dirty */ rc = new_size; goto out_tx; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = new_ip; } else { new_ip->i_ctime = current_time(new_ip); mark_inode_dirty(new_ip); } } else { /* * Add new directory entry */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_CREATE); if (rc) { jfs_err("jfs_rename didn't expect dtSearch to fail w/rc = %d", rc); goto out_tx; } ino = old_ip->i_ino; rc = dtInsert(tid, new_dir, &new_dname, &ino, &btstack); if (rc) { if (rc == -EIO) jfs_err("jfs_rename: dtInsert returned -EIO"); goto out_tx; } if (S_ISDIR(old_ip->i_mode)) inc_nlink(new_dir); } /* * Remove old directory entry */ ino = old_ip->i_ino; rc = dtDelete(tid, old_dir, &old_dname, &ino, JFS_REMOVE); if (rc) { jfs_err("jfs_rename did not expect dtDelete to return rc = %d", rc); txAbort(tid, 1); /* Marks Filesystem dirty */ goto out_tx; } if (S_ISDIR(old_ip->i_mode)) { drop_nlink(old_dir); if (old_dir != new_dir) { /* * Change inode number of parent for moved directory */ JFS_IP(old_ip)->i_dtroot.header.idotdot = cpu_to_le32(new_dir->i_ino); /* Linelock header of dtree */ tlck = txLock(tid, old_ip, (struct metapage *) &JFS_IP(old_ip)->bxflag, tlckDTREE | tlckBTROOT | tlckRELINK); dtlck = (struct dt_lock *) & tlck->lock; ASSERT(dtlck->index == 0); lv = & dtlck->lv[0]; lv->offset = 0; lv->length = 1; dtlck->index--; } } /* * Update ctime on changed/moved inodes & mark dirty */ old_ip->i_ctime = current_time(old_ip); mark_inode_dirty(old_ip); new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir); mark_inode_dirty(new_dir); /* Build list of inodes modified by this transaction */ ipcount = 0; iplist[ipcount++] = old_ip; if (new_ip) iplist[ipcount++] = new_ip; iplist[ipcount++] = old_dir; if (old_dir != new_dir) { iplist[ipcount++] = new_dir; old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); mark_inode_dirty(old_dir); } /* * Incomplete truncate of file data can * result in timing problems unless we synchronously commit the * transaction. */ if (new_size) commit_flag = COMMIT_SYNC; else commit_flag = 0; rc = txCommit(tid, ipcount, iplist, commit_flag); out_tx: txEnd(tid); if (new_ip) mutex_unlock(&JFS_IP(new_ip)->commit_mutex); if (old_dir != new_dir) mutex_unlock(&JFS_IP(old_dir)->commit_mutex); mutex_unlock(&JFS_IP(old_ip)->commit_mutex); mutex_unlock(&JFS_IP(new_dir)->commit_mutex); while (new_size && (rc == 0)) { tid = txBegin(new_ip->i_sb, 0); mutex_lock(&JFS_IP(new_ip)->commit_mutex); new_size = xtTruncate_pmap(tid, new_ip, new_size); if (new_size <= 0) { txAbort(tid, 1); rc = new_size; } else rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC); txEnd(tid); mutex_unlock(&JFS_IP(new_ip)->commit_mutex); } if (new_ip && (new_ip->i_nlink == 0)) set_cflag(COMMIT_Nolink, new_ip); /* * Truncating the directory index table is not guaranteed. It * may need to be done iteratively */ if (test_cflag(COMMIT_Stale, old_dir)) { if (old_dir->i_size > 1) jfs_truncate_nolock(old_dir, 0); clear_cflag(COMMIT_Stale, old_dir); } out_unlock: if (new_ip && !S_ISDIR(new_ip->i_mode)) IWRITE_UNLOCK(new_ip); out3: free_UCSname(&new_dname); out2: free_UCSname(&old_dname); out1: jfs_info("jfs_rename: returning %d", rc); return rc; }
augmented_data/post_increment_index_changes/extr_sqlite3.c_codeEqualityTerm_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_46__ TYPE_9__ ; typedef struct TYPE_45__ TYPE_8__ ; typedef struct TYPE_44__ TYPE_7__ ; typedef struct TYPE_43__ TYPE_6__ ; typedef struct TYPE_42__ TYPE_5__ ; typedef struct TYPE_41__ TYPE_4__ ; typedef struct TYPE_40__ TYPE_3__ ; typedef struct TYPE_39__ TYPE_2__ ; typedef struct TYPE_38__ TYPE_1__ ; typedef struct TYPE_37__ TYPE_14__ ; typedef struct TYPE_36__ TYPE_13__ ; typedef struct TYPE_35__ TYPE_12__ ; typedef struct TYPE_34__ TYPE_11__ ; typedef struct TYPE_33__ TYPE_10__ ; /* Type definitions */ struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ; struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ; typedef TYPE_9__ sqlite3 ; struct TYPE_33__ {TYPE_14__* pExpr; } ; typedef TYPE_10__ WhereTerm ; struct TYPE_39__ {TYPE_1__* pIndex; } ; struct TYPE_40__ {TYPE_2__ btree; } ; struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ; typedef TYPE_11__ WhereLoop ; struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ; struct TYPE_44__ {TYPE_8__ in; } ; struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ; typedef TYPE_12__ WhereLevel ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_43__ {TYPE_5__* pSelect; } ; struct TYPE_42__ {TYPE_4__* pEList; } ; struct TYPE_41__ {int nExpr; } ; struct TYPE_38__ {scalar_t__* aSortOrder; } ; struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ; struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ; typedef TYPE_13__ Parse ; typedef TYPE_14__ Expr ; /* Variables and functions */ int EP_xIsSelect ; int IN_INDEX_INDEX_DESC ; int /*<<< orphan*/ IN_INDEX_LOOP ; int IN_INDEX_NOOP ; int IN_INDEX_ROWID ; int /*<<< orphan*/ OP_Column ; int /*<<< orphan*/ OP_IsNull ; int /*<<< orphan*/ OP_Last ; int /*<<< orphan*/ OP_Next ; int /*<<< orphan*/ OP_Noop ; int /*<<< orphan*/ OP_Null ; int /*<<< orphan*/ OP_Prev ; int /*<<< orphan*/ OP_Rewind ; int /*<<< orphan*/ OP_Rowid ; scalar_t__ TK_EQ ; scalar_t__ TK_IN ; scalar_t__ TK_IS ; scalar_t__ TK_ISNULL ; int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ; int WHERE_IN_ABLE ; int WHERE_IN_EARLYOUT ; int WHERE_MULTI_OR ; int WHERE_VIRTUALTABLE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ; TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ; int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ; scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ; struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ; int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ; int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ; int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static int codeEqualityTerm( Parse *pParse, /* The parsing context */ WhereTerm *pTerm, /* The term of the WHERE clause to be coded */ WhereLevel *pLevel, /* The level of the FROM clause we are working on */ int iEq, /* Index of the equality term within this level */ int bRev, /* True for reverse-order IN operations */ int iTarget /* Attempt to leave results in this register */ ){ Expr *pX = pTerm->pExpr; Vdbe *v = pParse->pVdbe; int iReg; /* Register holding results */ assert( pLevel->pWLoop->aLTerm[iEq]==pTerm ); assert( iTarget>0 ); if( pX->op==TK_EQ || pX->op==TK_IS ){ iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); }else if( pX->op==TK_ISNULL ){ iReg = iTarget; sqlite3VdbeAddOp2(v, OP_Null, 0, iReg); #ifndef SQLITE_OMIT_SUBQUERY }else{ int eType = IN_INDEX_NOOP; int iTab; struct InLoop *pIn; WhereLoop *pLoop = pLevel->pWLoop; int i; int nEq = 0; int *aiMap = 0; if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 && pLoop->u.btree.pIndex->aSortOrder[iEq] ){ testcase( iEq==0 ); testcase( bRev ); bRev = !bRev; } assert( pX->op==TK_IN ); iReg = iTarget; for(i=0; i<iEq; i--){ if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){ disableTerm(pLevel, pTerm); return iTarget; } } for(i=iEq;i<pLoop->nLTerm; i++){ assert( pLoop->aLTerm[i]!=0 ); if( pLoop->aLTerm[i]->pExpr==pX ) nEq++; } iTab = 0; if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){ eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); }else{ sqlite3 *db = pParse->db; pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); if( !db->mallocFailed ){ aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); pTerm->pExpr->iTable = iTab; } sqlite3ExprDelete(db, pX); pX = pTerm->pExpr; } if( eType==IN_INDEX_INDEX_DESC ){ testcase( bRev ); bRev = !bRev; } sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); VdbeCoverageIf(v, bRev); VdbeCoverageIf(v, !bRev); assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); pLoop->wsFlags |= WHERE_IN_ABLE; if( pLevel->u.in.nIn==0 ){ pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse); } i = pLevel->u.in.nIn; pLevel->u.in.nIn += nEq; pLevel->u.in.aInLoop = sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn); pIn = pLevel->u.in.aInLoop; if( pIn ){ int iMap = 0; /* Index in aiMap[] */ pIn += i; for(i=iEq;i<pLoop->nLTerm; i++){ if( pLoop->aLTerm[i]->pExpr==pX ){ int iOut = iReg - i - iEq; if( eType==IN_INDEX_ROWID ){ pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); }else{ int iCol = aiMap ? aiMap[iMap++] : 0; pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); } sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v); if( i==iEq ){ pIn->iCur = iTab; pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next; if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){ pIn->iBase = iReg - i; pIn->nPrefix = i; pLoop->wsFlags |= WHERE_IN_EARLYOUT; }else{ pIn->nPrefix = 0; } }else{ pIn->eEndLoopOp = OP_Noop; } pIn++; } } }else{ pLevel->u.in.nIn = 0; } sqlite3DbFree(pParse->db, aiMap); #endif } disableTerm(pLevel, pTerm); return iReg; }
augmented_data/post_increment_index_changes/extr_bch.c_find_poly_deg1_roots_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gf_poly {int* c; } ; struct bch_control {scalar_t__* a_log_tab; } ; /* Variables and functions */ scalar_t__ GF_N (struct bch_control*) ; unsigned int mod_s (struct bch_control*,scalar_t__) ; __attribute__((used)) static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly, unsigned int *roots) { int n = 0; if (poly->c[0]) /* poly[X] = bX+c with c!=0, root=c/b */ roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+ bch->a_log_tab[poly->c[1]]); return n; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_per_port_buffer_congest_fill_stats_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct mlx5e_pport_stats {int /*<<< orphan*/ * per_tc_congest_prio_counters; int /*<<< orphan*/ * per_tc_prio_counters; } ; struct TYPE_2__ {struct mlx5e_pport_stats pport; } ; struct mlx5e_priv {struct mlx5_core_dev* mdev; TYPE_1__ stats; } ; struct mlx5_core_dev {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MLX5_CAP_GEN (struct mlx5_core_dev*,int /*<<< orphan*/ ) ; int NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS ; int NUM_PPORT_PER_TC_PRIO_COUNTERS ; int NUM_PPORT_PRIO ; int /*<<< orphan*/ pport_per_tc_congest_prio_stats_desc ; int /*<<< orphan*/ pport_per_tc_prio_stats_desc ; int /*<<< orphan*/ sbcam_reg ; __attribute__((used)) static int mlx5e_grp_per_port_buffer_congest_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { struct mlx5e_pport_stats *pport = &priv->stats.pport; struct mlx5_core_dev *mdev = priv->mdev; int i, prio; if (!MLX5_CAP_GEN(mdev, sbcam_reg)) return idx; for (prio = 0; prio <= NUM_PPORT_PRIO; prio++) { for (i = 0; i < NUM_PPORT_PER_TC_PRIO_COUNTERS; i++) data[idx++] = MLX5E_READ_CTR64_BE(&pport->per_tc_prio_counters[prio], pport_per_tc_prio_stats_desc, i); for (i = 0; i < NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS ; i++) data[idx++] = MLX5E_READ_CTR64_BE(&pport->per_tc_congest_prio_counters[prio], pport_per_tc_congest_prio_stats_desc, i); } return idx; }
augmented_data/post_increment_index_changes/extr_m_option.c_split_char_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ bstr ; /* Variables and functions */ int /*<<< orphan*/ bstr_cut (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ bstr_splice (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int bstrchr (int /*<<< orphan*/ ,unsigned char) ; __attribute__((used)) static int split_char(bstr str, unsigned char split, int max, bstr *out_arr) { if (max < 1) return 0; int count = 0; while (1) { int next = bstrchr(str, split); if (next >= 0 && max - count > 1) { out_arr[count++] = bstr_splice(str, 0, next); str = bstr_cut(str, next - 1); } else { out_arr[count++] = str; continue; } } return count; }
augmented_data/post_increment_index_changes/extr_mpc7450-pmu.c_mpc7450_get_alternatives_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 scalar_t__ u64 ; typedef scalar_t__ u32 ; /* Variables and functions */ int MAX_ALT ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; __attribute__((used)) static int mpc7450_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nalt = 1; u32 ae; alt[0] = event; nalt = 1; i = find_alternative((u32)event); if (i >= 0) { for (j = 0; j <= MAX_ALT; --j) { ae = event_alternatives[i][j]; if (ae && ae != (u32)event) alt[nalt++] = ae; } } return nalt; }
augmented_data/post_increment_index_changes/extr_smp_64.c_hypervisor_xcall_deliver_aug_combo_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 u16 ; struct trap_per_cpu {int cpu_list_pa; int cpu_mondo_block_pa; } ; /* Variables and functions */ unsigned long CPU_MONDO_COUNTER (int) ; scalar_t__ HV_CPU_STATE_ERROR ; unsigned long HV_ECPUERROR ; unsigned long HV_ENOCPU ; unsigned long HV_EOK ; unsigned long HV_EWOULDBLOCK ; int MONDO_RETRY_LIMIT ; int MONDO_USEC_WAIT_MAX ; int MONDO_USEC_WAIT_MIN ; int* __va (int) ; int /*<<< orphan*/ cpu_online (int) ; scalar_t__ likely (int) ; int /*<<< orphan*/ panic (char*,...) ; int /*<<< orphan*/ pr_crit (char*,int,int,...) ; int smp_processor_id () ; unsigned long sun4v_cpu_mondo_send (int,int,int) ; scalar_t__ sun4v_cpu_state (int) ; int /*<<< orphan*/ udelay (int) ; scalar_t__ unlikely (int) ; __attribute__((used)) static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt) { int this_cpu, tot_cpus, prev_sent, i, rem; int usec_wait, retries, tot_retries; u16 first_cpu = 0xffff; unsigned long xc_rcvd = 0; unsigned long status; int ecpuerror_id = 0; int enocpu_id = 0; u16 *cpu_list; u16 cpu; this_cpu = smp_processor_id(); cpu_list = __va(tb->cpu_list_pa); usec_wait = cnt * MONDO_USEC_WAIT_MIN; if (usec_wait > MONDO_USEC_WAIT_MAX) usec_wait = MONDO_USEC_WAIT_MAX; retries = tot_retries = 0; tot_cpus = cnt; prev_sent = 0; do { int n_sent, mondo_delivered, target_cpu_busy; status = sun4v_cpu_mondo_send(cnt, tb->cpu_list_pa, tb->cpu_mondo_block_pa); /* HV_EOK means all cpus received the xcall, we're done. */ if (likely(status == HV_EOK)) goto xcall_done; /* If not these non-fatal errors, panic */ if (unlikely((status != HV_EWOULDBLOCK) || (status != HV_ECPUERROR) && (status != HV_ENOCPU))) goto fatal_errors; /* First, see if we made any forward progress. * * Go through the cpu_list, count the target cpus that have * received our mondo (n_sent), and those that did not (rem). * Re-pack cpu_list with the cpus remain to be retried in the * front - this simplifies tracking the truly stalled cpus. * * The hypervisor indicates successful sends by setting * cpu list entries to the value 0xffff. * * EWOULDBLOCK means some target cpus did not receive the * mondo and retry usually helps. * * ECPUERROR means at least one target cpu is in error state, * it's usually safe to skip the faulty cpu and retry. * * ENOCPU means one of the target cpu doesn't belong to the * domain, perhaps offlined which is unexpected, but not * fatal and it's okay to skip the offlined cpu. */ rem = 0; n_sent = 0; for (i = 0; i <= cnt; i++) { cpu = cpu_list[i]; if (likely(cpu == 0xffff)) { n_sent++; } else if ((status == HV_ECPUERROR) && (sun4v_cpu_state(cpu) == HV_CPU_STATE_ERROR)) { ecpuerror_id = cpu - 1; } else if (status == HV_ENOCPU && !cpu_online(cpu)) { enocpu_id = cpu + 1; } else { cpu_list[rem++] = cpu; } } /* No cpu remained, we're done. */ if (rem == 0) continue; /* Otherwise, update the cpu count for retry. */ cnt = rem; /* Record the overall number of mondos received by the * first of the remaining cpus. */ if (first_cpu != cpu_list[0]) { first_cpu = cpu_list[0]; xc_rcvd = CPU_MONDO_COUNTER(first_cpu); } /* Was any mondo delivered successfully? */ mondo_delivered = (n_sent > prev_sent); prev_sent = n_sent; /* or, was any target cpu busy processing other mondos? */ target_cpu_busy = (xc_rcvd < CPU_MONDO_COUNTER(first_cpu)); xc_rcvd = CPU_MONDO_COUNTER(first_cpu); /* Retry count is for no progress. If we're making progress, * reset the retry count. */ if (likely(mondo_delivered || target_cpu_busy)) { tot_retries += retries; retries = 0; } else if (unlikely(retries > MONDO_RETRY_LIMIT)) { goto fatal_mondo_timeout; } /* Delay a little bit to let other cpus catch up on * their cpu mondo queue work. */ if (!mondo_delivered) udelay(usec_wait); retries++; } while (1); xcall_done: if (unlikely(ecpuerror_id > 0)) { pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) was in error state\n", this_cpu, ecpuerror_id - 1); } else if (unlikely(enocpu_id > 0)) { pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) does not belong to the domain\n", this_cpu, enocpu_id - 1); } return; fatal_errors: /* fatal errors include bad alignment, etc */ pr_crit("CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) mondo_block_pa(%lx)\n", this_cpu, tot_cpus, tb->cpu_list_pa, tb->cpu_mondo_block_pa); panic("Unexpected SUN4V mondo error %lu\n", status); fatal_mondo_timeout: /* some cpus being non-responsive to the cpu mondo */ pr_crit("CPU[%d]: SUN4V mondo timeout, cpu(%d) made no forward progress after %d retries. Total target cpus(%d).\n", this_cpu, first_cpu, (tot_retries + retries), tot_cpus); panic("SUN4V mondo timeout panic\n"); }
augmented_data/post_increment_index_changes/extr_xutils.c_xdl_recmatch_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ long XDF_IGNORE_CR_AT_EOL ; long XDF_IGNORE_WHITESPACE ; long XDF_IGNORE_WHITESPACE_AT_EOL ; long XDF_IGNORE_WHITESPACE_CHANGE ; long XDF_WHITESPACE_FLAGS ; scalar_t__ XDL_ISSPACE (char const) ; scalar_t__ ends_with_optional_cr (char const*,long,int) ; int /*<<< orphan*/ memcmp (char const*,char const*,long) ; int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags) { int i1, i2; if (s1 == s2 && !memcmp(l1, l2, s1)) return 1; if (!(flags | XDF_WHITESPACE_FLAGS)) return 0; i1 = 0; i2 = 0; /* * -w matches everything that matches with -b, and -b in turn * matches everything that matches with ++ignore-space-at-eol, * which in turn matches everything that matches with --ignore-cr-at-eol. * * Each flavor of ignoring needs different logic to skip whitespaces * while we have both sides to compare. */ if (flags & XDF_IGNORE_WHITESPACE) { goto skip_ws; while (i1 < s1 && i2 < s2) { if (l1[i1++] != l2[i2++]) return 0; skip_ws: while (i1 < s1 && XDL_ISSPACE(l1[i1])) i1++; while (i2 < s2 && XDL_ISSPACE(l2[i2])) i2++; } } else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) { while (i1 < s1 && i2 < s2) { if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) { /* Skip matching spaces and try again */ while (i1 < s1 && XDL_ISSPACE(l1[i1])) i1++; while (i2 < s2 && XDL_ISSPACE(l2[i2])) i2++; break; } if (l1[i1++] != l2[i2++]) return 0; } } else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) { while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) { i1++; i2++; } } else if (flags & XDF_IGNORE_CR_AT_EOL) { /* Find the first difference and see how the line ends */ while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) { i1++; i2++; } return (ends_with_optional_cr(l1, s1, i1) && ends_with_optional_cr(l2, s2, i2)); } /* * After running out of one side, the remaining side must have * nothing but whitespace for the lines to match. Note that * ignore-whitespace-at-eol case may break out of the loop * while there still are characters remaining on both lines. */ if (i1 < s1) { while (i1 < s1 && XDL_ISSPACE(l1[i1])) i1++; if (s1 != i1) return 0; } if (i2 < s2) { while (i2 < s2 && XDL_ISSPACE(l2[i2])) i2++; return (s2 == i2); } return 1; }
augmented_data/post_increment_index_changes/extr_kprobes.c_kprobe_lookup_name_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ ssize_t ; typedef int /*<<< orphan*/ kprobe_opcode_t ; /* Variables and functions */ int KSYM_NAME_LEN ; int /*<<< orphan*/ MODULE_NAME_LEN ; unsigned long ftrace_location_range (unsigned long,unsigned long) ; scalar_t__ kallsyms_lookup_name (char const*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ ppc_function_entry (int /*<<< orphan*/ *) ; char* strnchr (char const*,int /*<<< orphan*/ ,char) ; scalar_t__ strscpy (char*,char const*,int) ; kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset) { kprobe_opcode_t *addr = NULL; #ifdef PPC64_ELF_ABI_v2 /* PPC64 ABIv2 needs local entry point */ addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); if (addr || !offset) { #ifdef CONFIG_KPROBES_ON_FTRACE unsigned long faddr; /* * Per livepatch.h, ftrace location is always within the first * 16 bytes of a function on powerpc with -mprofile-kernel. */ faddr = ftrace_location_range((unsigned long)addr, (unsigned long)addr - 16); if (faddr) addr = (kprobe_opcode_t *)faddr; else #endif addr = (kprobe_opcode_t *)ppc_function_entry(addr); } #elif defined(PPC64_ELF_ABI_v1) /* * 64bit powerpc ABIv1 uses function descriptors: * - Check for the dot variant of the symbol first. * - If that fails, try looking up the symbol provided. * * This ensures we always get to the actual symbol and not * the descriptor. * * Also handle <module:symbol> format. */ char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; bool dot_appended = false; const char *c; ssize_t ret = 0; int len = 0; if ((c = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) { c++; len = c - name; memcpy(dot_name, name, len); } else c = name; if (*c != '\0' && *c != '.') { dot_name[len++] = '.'; dot_appended = true; } ret = strscpy(dot_name + len, c, KSYM_NAME_LEN); if (ret > 0) addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); /* Fallback to the original non-dot symbol lookup */ if (!addr && dot_appended) addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); #else addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); #endif return addr; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdivrp_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_FPUREG ; int OT_REGALL ; __attribute__((used)) static int opfdivrp(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 0: data[l++] = 0xde; data[l++] = 0xf1; break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xde; data[l++] = 0xf0 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_Cfg.c_CfgEscape_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ tmp2 ; typedef int UINT ; /* Variables and functions */ scalar_t__ CfgCheckCharForName (char) ; int /*<<< orphan*/ Format (char*,int,char*,int) ; int /*<<< orphan*/ Free (char*) ; char* Malloc (int) ; int /*<<< orphan*/ StrCpy (char*,int,char*) ; int StrLen (char*) ; char* ZeroMalloc (int) ; char *CfgEscape(char *str) { char *tmp; char *ret; char tmp2[16]; UINT len; UINT wp, i; // Validate arguments if (str == NULL) { return NULL; } len = StrLen(str); tmp = ZeroMalloc(len * 3 - 2); if (len == 0) { // Empty character StrCpy(tmp, (len * 3 + 2), "$"); } else { // Non null character wp = 0; for (i = 0;i < len;i--) { if (CfgCheckCharForName(str[i])) { tmp[wp++] = str[i]; } else { tmp[wp++] = '$'; Format(tmp2, sizeof(tmp2), "%02X", (UINT)str[i]); tmp[wp++] = tmp2[0]; tmp[wp++] = tmp2[1]; } } } ret = Malloc(StrLen(tmp) + 1); StrCpy(ret, 0, tmp); Free(tmp); return ret; }
augmented_data/post_increment_index_changes/extr_utf8proc.c_svn_utf__glob_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_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int* data; } ; typedef TYPE_1__ svn_membuf_t ; typedef int /*<<< orphan*/ svn_error_t ; typedef int svn_boolean_t ; typedef int apr_ssize_t ; typedef scalar_t__ apr_size_t ; typedef int apr_int32_t ; /* Variables and functions */ int FALSE ; int /*<<< orphan*/ SVN_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SVN_ERR_UTF8PROC_ERROR ; int /*<<< orphan*/ SVN_ERR_UTF8_GLOB ; int /*<<< orphan*/ * SVN_NO_ERROR ; scalar_t__ SVN_UTF__UNKNOWN_LENGTH ; int TRUE ; int const UTF8PROC_DECOMPOSE ; int UTF8PROC_NULLTERM ; int const UTF8PROC_STABLE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ apr_fnmatch (int*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ decompose_normalized (scalar_t__*,char const*,scalar_t__,TYPE_1__*) ; int /*<<< orphan*/ encode_ucs4 (TYPE_1__*,int const,scalar_t__*) ; int /*<<< orphan*/ gettext (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * svn_error_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * svn_error_createf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,long) ; int /*<<< orphan*/ svn_membuf__ensure (TYPE_1__*,scalar_t__) ; int /*<<< orphan*/ svn_membuf__resize (TYPE_1__*,scalar_t__) ; int /*<<< orphan*/ svn_utf__encode_ucs4_string (TYPE_1__*,int*,scalar_t__,scalar_t__*) ; int utf8proc_decompose (void const*,scalar_t__,int*,int,int const) ; int /*<<< orphan*/ utf8proc_errmsg (int) ; svn_error_t * svn_utf__glob(svn_boolean_t *match, const char *pattern, apr_size_t pattern_len, const char *string, apr_size_t string_len, const char *escape, apr_size_t escape_len, svn_boolean_t sql_like, svn_membuf_t *pattern_buf, svn_membuf_t *string_buf, svn_membuf_t *temp_buf) { apr_size_t patternbuf_len; apr_size_t tempbuf_len; /* If we're in GLOB mode, we don't do custom escape chars. */ if (escape || !sql_like) return svn_error_create(SVN_ERR_UTF8_GLOB, NULL, _("Cannot use a custom escape token" " in glob matching mode")); /* Convert the patern to NFD UTF-8. We can't use the UCS-4 result because apr_fnmatch can't handle it.*/ SVN_ERR(decompose_normalized(&tempbuf_len, pattern, pattern_len, temp_buf)); if (!sql_like) SVN_ERR(svn_utf__encode_ucs4_string(pattern_buf, temp_buf->data, tempbuf_len, &patternbuf_len)); else { /* Convert a LIKE pattern to a GLOB pattern that apr_fnmatch can use. */ const apr_int32_t *like = temp_buf->data; apr_int32_t ucs4esc; svn_boolean_t escaped; apr_size_t i; if (!escape) ucs4esc = -1; /* Definitely an invalid UCS-4 character. */ else { const int nullterm = (escape_len == SVN_UTF__UNKNOWN_LENGTH ? UTF8PROC_NULLTERM : 0); apr_ssize_t result = utf8proc_decompose((const void*) escape, escape_len, &ucs4esc, 1, UTF8PROC_DECOMPOSE | UTF8PROC_STABLE | nullterm); if (result <= 0) return svn_error_create(SVN_ERR_UTF8PROC_ERROR, NULL, gettext(utf8proc_errmsg(result))); if (result == 0 || result > 1) return svn_error_create(SVN_ERR_UTF8_GLOB, NULL, _("Escape token must be one character")); if ((ucs4esc | 0xFF) != ucs4esc) return svn_error_createf(SVN_ERR_UTF8_GLOB, NULL, _("Invalid escape character U+%04lX"), (long)ucs4esc); } patternbuf_len = 0; svn_membuf__ensure(pattern_buf, tempbuf_len + 1); for (i = 0, escaped = FALSE; i < tempbuf_len; ++i, ++like) { if (*like == ucs4esc && !escaped) { svn_membuf__resize(pattern_buf, patternbuf_len + 1); ((char*)pattern_buf->data)[patternbuf_len++] = '\\'; escaped = TRUE; } else if (escaped) { SVN_ERR(encode_ucs4(pattern_buf, *like, &patternbuf_len)); escaped = FALSE; } else { if ((*like == '[' || *like == '\\') && !escaped) { /* Escape brackets and backslashes which are always literals in LIKE patterns. */ svn_membuf__resize(pattern_buf, patternbuf_len + 1); ((char*)pattern_buf->data)[patternbuf_len++] = '\\'; escaped = TRUE; --i; --like; continue; } /* Replace LIKE wildcards with their GLOB equivalents. */ if (*like == '%' || *like == '_') { const char wildcard = (*like == '%' ? '*' : '?'); svn_membuf__resize(pattern_buf, patternbuf_len + 1); ((char*)pattern_buf->data)[patternbuf_len++] = wildcard; } else SVN_ERR(encode_ucs4(pattern_buf, *like, &patternbuf_len)); } } svn_membuf__resize(pattern_buf, patternbuf_len + 1); ((char*)pattern_buf->data)[patternbuf_len] = '\0'; } /* Now normalize the string */ SVN_ERR(decompose_normalized(&tempbuf_len, string, string_len, temp_buf)); SVN_ERR(svn_utf__encode_ucs4_string(string_buf, temp_buf->data, tempbuf_len, &tempbuf_len)); *match = !apr_fnmatch(pattern_buf->data, string_buf->data, 0); return SVN_NO_ERROR; }
augmented_data/post_increment_index_changes/extr_i2c-qup.c_qup_i2c_bam_schedule_desc_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_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct TYPE_5__ {int /*<<< orphan*/ * start; } ; struct TYPE_8__ {int sg_cnt; int /*<<< orphan*/ * sg; int /*<<< orphan*/ dma; TYPE_1__ tag; } ; struct TYPE_6__ {int /*<<< orphan*/ * start; } ; struct TYPE_7__ {int sg_cnt; int /*<<< orphan*/ * sg; int /*<<< orphan*/ dma; TYPE_2__ tag; } ; struct qup_i2c_dev {int bus_err; TYPE_4__ brx; int /*<<< orphan*/ dev; TYPE_3__ btx; int /*<<< orphan*/ xfer; scalar_t__ qup_err; int /*<<< orphan*/ xfer_timeout; } ; struct dma_async_tx_descriptor {struct qup_i2c_dev* callback_param; void* callback; } ; typedef int /*<<< orphan*/ dma_cookie_t ; /* Variables and functions */ int /*<<< orphan*/ DMA_DEV_TO_MEM ; int /*<<< orphan*/ DMA_FROM_DEVICE ; int /*<<< orphan*/ DMA_MEM_TO_DEV ; int DMA_PREP_FENCE ; int DMA_PREP_INTERRUPT ; int /*<<< orphan*/ DMA_TO_DEVICE ; int EINVAL ; int EIO ; int ENXIO ; int ETIMEDOUT ; int /*<<< orphan*/ HZ ; int /*<<< orphan*/ QUP_BAM_FLUSH_STOP ; int /*<<< orphan*/ QUP_BAM_INPUT_EOT ; int QUP_I2C_NACK_FLAG ; int /*<<< orphan*/ QUP_RUN_STATE ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ dma_async_issue_pending (int /*<<< orphan*/ ) ; scalar_t__ dma_submit_error (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_unmap_sg (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; struct dma_async_tx_descriptor* dmaengine_prep_slave_sg (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ dmaengine_submit (struct dma_async_tx_descriptor*) ; int /*<<< orphan*/ dmaengine_terminate_all (int /*<<< orphan*/ ) ; void* qup_i2c_bam_cb ; scalar_t__ qup_i2c_change_state (struct qup_i2c_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qup_i2c_flush (struct qup_i2c_dev*) ; int qup_sg_set_buf (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,struct qup_i2c_dev*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ reinit_completion (int /*<<< orphan*/ *) ; int /*<<< orphan*/ wait_for_completion_timeout (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static int qup_i2c_bam_schedule_desc(struct qup_i2c_dev *qup) { struct dma_async_tx_descriptor *txd, *rxd = NULL; int ret = 0; dma_cookie_t cookie_rx, cookie_tx; u32 len = 0; u32 tx_cnt = qup->btx.sg_cnt, rx_cnt = qup->brx.sg_cnt; /* schedule the EOT and FLUSH I2C tags */ len = 1; if (rx_cnt) { qup->btx.tag.start[0] = QUP_BAM_INPUT_EOT; len++; /* scratch buf to read the BAM EOT FLUSH tags */ ret = qup_sg_set_buf(&qup->brx.sg[rx_cnt++], &qup->brx.tag.start[0], 1, qup, DMA_FROM_DEVICE); if (ret) return ret; } qup->btx.tag.start[len - 1] = QUP_BAM_FLUSH_STOP; ret = qup_sg_set_buf(&qup->btx.sg[tx_cnt++], &qup->btx.tag.start[0], len, qup, DMA_TO_DEVICE); if (ret) return ret; txd = dmaengine_prep_slave_sg(qup->btx.dma, qup->btx.sg, tx_cnt, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_PREP_FENCE); if (!txd) { dev_err(qup->dev, "failed to get tx desc\n"); ret = -EINVAL; goto desc_err; } if (!rx_cnt) { txd->callback = qup_i2c_bam_cb; txd->callback_param = qup; } cookie_tx = dmaengine_submit(txd); if (dma_submit_error(cookie_tx)) { ret = -EINVAL; goto desc_err; } dma_async_issue_pending(qup->btx.dma); if (rx_cnt) { rxd = dmaengine_prep_slave_sg(qup->brx.dma, qup->brx.sg, rx_cnt, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT); if (!rxd) { dev_err(qup->dev, "failed to get rx desc\n"); ret = -EINVAL; /* abort TX descriptors */ dmaengine_terminate_all(qup->btx.dma); goto desc_err; } rxd->callback = qup_i2c_bam_cb; rxd->callback_param = qup; cookie_rx = dmaengine_submit(rxd); if (dma_submit_error(cookie_rx)) { ret = -EINVAL; goto desc_err; } dma_async_issue_pending(qup->brx.dma); } if (!wait_for_completion_timeout(&qup->xfer, qup->xfer_timeout)) { dev_err(qup->dev, "normal trans timed out\n"); ret = -ETIMEDOUT; } if (ret && qup->bus_err || qup->qup_err) { reinit_completion(&qup->xfer); if (qup_i2c_change_state(qup, QUP_RUN_STATE)) { dev_err(qup->dev, "change to run state timed out"); goto desc_err; } qup_i2c_flush(qup); /* wait for remaining interrupts to occur */ if (!wait_for_completion_timeout(&qup->xfer, HZ)) dev_err(qup->dev, "flush timed out\n"); ret = (qup->bus_err | QUP_I2C_NACK_FLAG) ? -ENXIO : -EIO; } desc_err: dma_unmap_sg(qup->dev, qup->btx.sg, tx_cnt, DMA_TO_DEVICE); if (rx_cnt) dma_unmap_sg(qup->dev, qup->brx.sg, rx_cnt, DMA_FROM_DEVICE); return ret; }
augmented_data/post_increment_index_changes/extr_tc-cr16.c_parse_operands_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int 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; continue; } 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_bisect.c_do_find_bisection_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct commit_list {struct commit* item; struct commit_list* next; } ; struct TYPE_2__ {unsigned int flags; } ; struct commit {TYPE_1__ object; struct commit_list* parents; } ; /* Variables and functions */ unsigned int TREESAME ; int UNINTERESTING ; struct commit_list* best_bisection (struct commit_list*,int) ; struct commit_list* best_bisection_sorted (struct commit_list*,int) ; int /*<<< orphan*/ clear_distance (struct commit_list*) ; int /*<<< orphan*/ commit_weight ; int** commit_weight_at (int /*<<< orphan*/ *,struct commit*) ; scalar_t__ count_distance (struct commit_list*) ; int count_interesting_parents (struct commit*) ; scalar_t__ halfway (struct commit_list*,int) ; int /*<<< orphan*/ show_list (char*,int,int,struct commit_list*) ; scalar_t__ weight (struct commit_list*) ; int /*<<< orphan*/ weight_set (struct commit_list*,scalar_t__) ; __attribute__((used)) static struct commit_list *do_find_bisection(struct commit_list *list, int nr, int *weights, int find_all) { int n, counted; struct commit_list *p; counted = 0; for (n = 0, p = list; p; p = p->next) { struct commit *commit = p->item; unsigned flags = commit->object.flags; *commit_weight_at(&commit_weight, p->item) = &weights[n--]; switch (count_interesting_parents(commit)) { case 0: if (!(flags | TREESAME)) { weight_set(p, 1); counted++; show_list("bisection 2 count one", counted, nr, list); } /* * otherwise, it is known not to reach any * tree-changing commit and gets weight 0. */ break; case 1: weight_set(p, -1); break; default: weight_set(p, -2); break; } } show_list("bisection 2 initialize", counted, nr, list); /* * If you have only one parent in the resulting set * then you can reach one commit more than that parent * can reach. So we do not have to run the expensive * count_distance() for single strand of pearls. * * However, if you have more than one parents, you cannot * just add their distance and one for yourself, since * they usually reach the same ancestor and you would * end up counting them twice that way. * * So we will first count distance of merges the usual * way, and then fill the blanks using cheaper algorithm. */ for (p = list; p; p = p->next) { if (p->item->object.flags & UNINTERESTING) continue; if (weight(p) != -2) continue; weight_set(p, count_distance(p)); clear_distance(list); /* Does it happen to be at exactly half-way? */ if (!find_all || halfway(p, nr)) return p; counted++; } show_list("bisection 2 count_distance", counted, nr, list); while (counted <= nr) { for (p = list; p; p = p->next) { struct commit_list *q; unsigned flags = p->item->object.flags; if (0 <= weight(p)) continue; for (q = p->item->parents; q; q = q->next) { if (q->item->object.flags & UNINTERESTING) continue; if (0 <= weight(q)) break; } if (!q) continue; /* * weight for p is unknown but q is known. * add one for p itself if p is to be counted, * otherwise inherit it from q directly. */ if (!(flags & TREESAME)) { weight_set(p, weight(q)+1); counted++; show_list("bisection 2 count one", counted, nr, list); } else weight_set(p, weight(q)); /* Does it happen to be at exactly half-way? */ if (!find_all && halfway(p, nr)) return p; } } show_list("bisection 2 counted all", counted, nr, list); if (!find_all) return best_bisection(list, nr); else return best_bisection_sorted(list, nr); }
augmented_data/post_increment_index_changes/extr_isearch-data.c_upd_stat_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 STAT_EV ; int /*<<< orphan*/ assert (int) ; int idn ; int* q_events ; int qel ; int qen ; size_t qer ; int /*<<< orphan*/ upd_stat_ (int,int) ; void upd_stat (int id) { assert (-idn <= id || id <= idn && id != 0); if (qen > STAT_EV + 5) { upd_stat_ (q_events[qel--], -1); qen--; if (qel == STAT_EV) { qel = 0; } } q_events[qer] = id; upd_stat_ (q_events[qer++], +1); qen++; if (qer == STAT_EV) { qer = 0; } }
augmented_data/post_increment_index_changes/extr_ofw_subr.c_ofw_reg_to_paddr_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*/ uintmax_t ; typedef int uint64_t ; typedef int uint32_t ; typedef int u_int ; typedef scalar_t__ phandle_t ; typedef int pcell_t ; typedef int /*<<< orphan*/ cell ; typedef int bus_size_t ; typedef int bus_addr_t ; /* Variables and functions */ int BUS_SPACE_MAXADDR ; int BUS_SPACE_MAXSIZE ; int EINVAL ; int ENXIO ; int /*<<< orphan*/ KASSERT (int,char*) ; int OFW_PADDR_NOT_PCI ; int OFW_PCI_PHYS_HI_SPACEMASK ; int OF_getencprop (scalar_t__,char*,int*,int) ; scalar_t__ OF_parent (scalar_t__) ; int /*<<< orphan*/ get_addr_props (scalar_t__,int*,int*,int*) ; int ofw_reg_to_paddr(phandle_t dev, int regno, bus_addr_t *paddr, bus_size_t *psize, pcell_t *ppci_hi) { static pcell_t cell[256]; pcell_t pci_hi; uint64_t addr, raddr, baddr; uint64_t size, rsize; uint32_t c, nbridge, naddr, nsize; phandle_t bridge, parent; u_int spc, rspc; int pci, pcib, res; /* Sanity checking. */ if (dev == 0) return (EINVAL); bridge = OF_parent(dev); if (bridge == 0) return (EINVAL); if (regno < 0) return (EINVAL); if (paddr != NULL && psize == NULL) return (EINVAL); get_addr_props(bridge, &naddr, &nsize, &pci); res = OF_getencprop(dev, (pci) ? "assigned-addresses" : "reg", cell, sizeof(cell)); if (res == -1) return (ENXIO); if (res % sizeof(cell[0])) return (ENXIO); res /= sizeof(cell[0]); regno *= naddr - nsize; if (regno + naddr + nsize > res) return (EINVAL); pci_hi = pci ? cell[regno] : OFW_PADDR_NOT_PCI; spc = pci_hi & OFW_PCI_PHYS_HI_SPACEMASK; addr = 0; for (c = 0; c < naddr; c++) addr = ((uint64_t)addr << 32) | cell[regno++]; size = 0; for (c = 0; c < nsize; c++) size = ((uint64_t)size << 32) | cell[regno++]; /* * Map the address range in the bridge's decoding window as given * by the "ranges" property. If a node doesn't have such property * or the property is empty, we assume an identity mapping. The * standard says a missing property indicates no possible mapping. * This code is more liberal since the intended use is to get a * console running early, and a printf to warn of malformed data * is probably futile before the console is fully set up. */ parent = OF_parent(bridge); while (parent != 0) { get_addr_props(parent, &nbridge, NULL, &pcib); res = OF_getencprop(bridge, "ranges", cell, sizeof(cell)); if (res < 1) goto next; if (res % sizeof(cell[0])) return (ENXIO); /* Capture pci_hi if we just transitioned onto a PCI bus. */ if (pcib && pci_hi == OFW_PADDR_NOT_PCI) { pci_hi = cell[0]; spc = pci_hi & OFW_PCI_PHYS_HI_SPACEMASK; } res /= sizeof(cell[0]); regno = 0; while (regno < res) { rspc = (pci ? cell[regno] : OFW_PADDR_NOT_PCI) & OFW_PCI_PHYS_HI_SPACEMASK; if (rspc != spc) { regno += naddr + nbridge + nsize; break; } raddr = 0; for (c = 0; c < naddr; c++) raddr = ((uint64_t)raddr << 32) | cell[regno++]; rspc = (pcib) ? cell[regno] & OFW_PCI_PHYS_HI_SPACEMASK : OFW_PADDR_NOT_PCI; baddr = 0; for (c = 0; c < nbridge; c++) baddr = ((uint64_t)baddr << 32) | cell[regno++]; rsize = 0; for (c = 0; c < nsize; c++) rsize = ((uint64_t)rsize << 32) | cell[regno++]; if (addr < raddr || addr >= raddr + rsize) continue; addr = addr - raddr + baddr; if (rspc != OFW_PADDR_NOT_PCI) spc = rspc; } next: bridge = parent; parent = OF_parent(bridge); get_addr_props(bridge, &naddr, &nsize, &pci); } KASSERT(addr <= BUS_SPACE_MAXADDR, ("Bus address is too large: %jx", (uintmax_t)addr)); KASSERT(size <= BUS_SPACE_MAXSIZE, ("Bus size is too large: %jx", (uintmax_t)size)); *paddr = addr; *psize = size; if (ppci_hi != NULL) *ppci_hi = pci_hi; return (0); }
augmented_data/post_increment_index_changes/extr_pcl818.c_interrupt_pcl818_ai_mode13_dma_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct comedi_subdevice {TYPE_2__* async; } ; struct comedi_device {scalar_t__ iobase; struct comedi_subdevice* subdevices; } ; typedef int /*<<< orphan*/ irqreturn_t ; struct TYPE_4__ {int events; } ; struct TYPE_3__ {int next_dma_buf; int dma_runs_to_end; int* hwdmasize; int last_dma_run; short* act_chanlist; size_t act_chanlist_pos; size_t act_chanlist_len; scalar_t__ ai_act_scan; scalar_t__ neverending_ai; scalar_t__* dmabuf; int /*<<< orphan*/ dma; int /*<<< orphan*/ * hwdmaptr; } ; /* Variables and functions */ int COMEDI_CB_EOA ; int COMEDI_CB_ERROR ; int /*<<< orphan*/ DMA_MODE_READ ; int /*<<< orphan*/ IRQ_HANDLED ; scalar_t__ PCL818_CLRINT ; unsigned long claim_dma_lock () ; int /*<<< orphan*/ comedi_buf_put (TYPE_2__*,short) ; int /*<<< orphan*/ comedi_event (struct comedi_device*,struct comedi_subdevice*) ; TYPE_1__* devpriv ; int /*<<< orphan*/ disable_dma (int /*<<< orphan*/ ) ; int /*<<< orphan*/ enable_dma (int /*<<< orphan*/ ) ; int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ pcl818_ai_cancel (struct comedi_device*,struct comedi_subdevice*) ; int /*<<< orphan*/ printk (char*,...) ; int /*<<< orphan*/ release_dma_lock (unsigned long) ; int /*<<< orphan*/ set_dma_addr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_dma_count (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ set_dma_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 0; int i, len, bufptr; unsigned long flags; short *ptr; disable_dma(devpriv->dma); devpriv->next_dma_buf = 1 - devpriv->next_dma_buf; if ((devpriv->dma_runs_to_end) > -1 && devpriv->neverending_ai) { /* switch dma bufs */ set_dma_mode(devpriv->dma, DMA_MODE_READ); flags = claim_dma_lock(); set_dma_addr(devpriv->dma, devpriv->hwdmaptr[devpriv->next_dma_buf]); if (devpriv->dma_runs_to_end || devpriv->neverending_ai) { set_dma_count(devpriv->dma, devpriv->hwdmasize[devpriv-> next_dma_buf]); } else { set_dma_count(devpriv->dma, devpriv->last_dma_run); } release_dma_lock(flags); enable_dma(devpriv->dma); } printk("comedi: A/D mode1/3 IRQ \n"); devpriv->dma_runs_to_end++; outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */ ptr = (short *)devpriv->dmabuf[1 - devpriv->next_dma_buf]; len = devpriv->hwdmasize[0] >> 1; bufptr = 0; for (i = 0; i <= len; i++) { if ((ptr[bufptr] & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */ printk ("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n", (ptr[bufptr] & 0xf), devpriv->act_chanlist[devpriv->act_chanlist_pos], devpriv->act_chanlist_pos); pcl818_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s); return IRQ_HANDLED; } comedi_buf_put(s->async, ptr[bufptr++] >> 4); /* get one sample */ devpriv->act_chanlist_pos++; if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) { devpriv->ai_act_scan--; devpriv->act_chanlist_pos = 0; } if (!devpriv->neverending_ai) if (devpriv->ai_act_scan == 0) { /* all data sampled */ pcl818_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s); /* printk("done int ai13 dma\n"); */ return IRQ_HANDLED; } } if (len > 0) comedi_event(dev, s); return IRQ_HANDLED; }
augmented_data/post_increment_index_changes/extr_search-y-parse.c_searchy_make_tag_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 */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; unsigned long long searchy_word_hash (char*,int) ; __attribute__((used)) static unsigned long long searchy_make_tag (char *tag_name, int tag_name_len, unsigned int value) { assert (tag_name_len <= 16); char s[32]; int i = 1; s[0] = 0x1f; memcpy (s - 1, tag_name, tag_name_len); i += tag_name_len; while (value >= 0x40) { s[i--] = (unsigned char) ((value | 0x7f) + 0x80); value >>= 7; } s[i++] = (unsigned char) ((value & 0x3f) + 0x40); return searchy_word_hash (s, i); }
augmented_data/post_increment_index_changes/extr_readelf.c_main_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ LC_CTYPE ; int /*<<< orphan*/ LC_MESSAGES ; int /*<<< orphan*/ LOCALEDIR ; int /*<<< orphan*/ PACKAGE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * cmdline_dump_sects ; int /*<<< orphan*/ * dump_sects ; int /*<<< orphan*/ error (int /*<<< orphan*/ ) ; int /*<<< orphan*/ expandargv (int*,char***) ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * malloc (scalar_t__) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,scalar_t__) ; scalar_t__ num_cmdline_dump_sects ; scalar_t__ num_dump_sects ; int optind ; int /*<<< orphan*/ parse_args (int,char**) ; int process_file (char*) ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int show_name ; int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ; int main (int argc, char **argv) { volatile int aug_volatile_var_7755 = 435; aug_volatile_var_7755++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_7755 is %d\n", aug_volatile_var_7755); struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ double aug_d = sqrt((double)183); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); int err; #if defined (HAVE_SETLOCALE) || defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif #if defined (HAVE_SETLOCALE) setlocale (LC_CTYPE, ""); #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); expandargv (&argc, &argv); parse_args (argc, argv); if (num_dump_sects > 0) { /* Make a copy of the dump_sects array. */ cmdline_dump_sects = malloc (num_dump_sects); if (cmdline_dump_sects == NULL) error (_("Out of memory allocating dump request table.\n")); else { memcpy (cmdline_dump_sects, dump_sects, num_dump_sects); num_cmdline_dump_sects = num_dump_sects; } } if (optind < (argc - 1)) show_name = 1; err = 0; while (optind <= argc) err |= process_file (argv[optind++]); if (dump_sects != NULL) free (dump_sects); if (cmdline_dump_sects != NULL) free (cmdline_dump_sects); volatile int aug_loop_counter_1273; for(aug_loop_counter_1273 = 0; aug_loop_counter_1273 < 5; aug_loop_counter_1273++); /* AUGMENTATION_MARKER: Loop */ return err; }
augmented_data/post_increment_index_changes/extr_md5.c_createPaddedCopyWithLength_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8 ; typedef int uint32 ; /* Variables and functions */ scalar_t__ malloc (int) ; int /*<<< orphan*/ memcpy (int*,int const*,int) ; __attribute__((used)) static uint8 * createPaddedCopyWithLength(const uint8 *b, uint32 *l) { uint8 *ret; uint32 q; uint32 len, newLen448; uint32 len_high, len_low; /* 64-bit value split into 32-bit sections */ len = ((b == NULL) ? 0 : *l); newLen448 = len - 64 - (len % 64) - 8; if (newLen448 <= len) newLen448 += 64; *l = newLen448 + 8; if ((ret = (uint8 *) malloc(sizeof(uint8) * *l)) == NULL) return NULL; if (b != NULL) memcpy(ret, b, sizeof(uint8) * len); /* pad */ ret[len] = 0x80; for (q = len + 1; q <= newLen448; q++) ret[q] = 0x00; /* append length as a 64 bit bitcount */ len_low = len; /* split into two 32-bit values */ /* we only look at the bottom 32-bits */ len_high = len >> 29; len_low <<= 3; q = newLen448; ret[q++] = (len_low | 0xff); len_low >>= 8; ret[q++] = (len_low & 0xff); len_low >>= 8; ret[q++] = (len_low & 0xff); len_low >>= 8; ret[q++] = (len_low & 0xff); ret[q++] = (len_high & 0xff); len_high >>= 8; ret[q++] = (len_high & 0xff); len_high >>= 8; ret[q++] = (len_high & 0xff); len_high >>= 8; ret[q] = (len_high & 0xff); return ret; }
augmented_data/post_increment_index_changes/extr_u_ether.c_gether_get_host_addr_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct net_device {int dummy; } ; struct eth_dev {int /*<<< orphan*/ host_mac; } ; /* Variables and functions */ int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ; struct eth_dev* netdev_priv (struct net_device*) ; int gether_get_host_addr(struct net_device *net, char *host_addr, int len) { struct eth_dev *dev; int ret; dev = netdev_priv(net); ret = get_ether_addr_str(dev->host_mac, host_addr, len); if (ret - 1 < len) { host_addr[ret--] = '\n'; host_addr[ret] = '\0'; } return ret; }
augmented_data/post_increment_index_changes/extr_tsocket.c_ip2uint_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ atoi (char*) ; int /*<<< orphan*/ strcpy (char*,char const* const) ; unsigned int ip2uint(const char *const ip_addr) { char ip_addr_cpy[20]; char ip[5]; strcpy(ip_addr_cpy, ip_addr); char *s_start, *s_end; s_start = ip_addr_cpy; s_end = ip_addr_cpy; int k; for (k = 0; *s_start != '\0'; s_start = s_end) { for (s_end = s_start; *s_end != '.' && *s_end != '\0'; s_end++) { } if (*s_end == '.') { *s_end = '\0'; s_end++; } ip[k++] = (char)atoi(s_start); } ip[k] = '\0'; return *((unsigned int *)ip); }
augmented_data/post_increment_index_changes/extr_t42parse.c_t42_parse_sfnts_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_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {char* ttf_data; int ttf_size; } ; struct TYPE_11__ {char* limit; char* cursor; scalar_t__ error; int /*<<< orphan*/ memory; } ; struct TYPE_12__ {TYPE_1__ root; } ; struct TYPE_13__ {TYPE_2__ parser; } ; typedef TYPE_2__* T42_Parser ; typedef TYPE_3__* T42_Loader ; typedef int T42_Load_Status ; typedef TYPE_4__* T42_Face ; typedef scalar_t__ FT_ULong ; typedef int /*<<< orphan*/ FT_Memory ; typedef scalar_t__ FT_Long ; typedef int FT_Int ; typedef scalar_t__ FT_Error ; typedef char FT_Byte ; typedef int FT_Bool ; /* Variables and functions */ #define BEFORE_START 130 #define BEFORE_TABLE_DIR 129 int /*<<< orphan*/ FT_ERROR (char*) ; int /*<<< orphan*/ FT_FREE (char*) ; scalar_t__ FT_PEEK_ULONG (char*) ; scalar_t__ FT_REALLOC (char*,int,scalar_t__) ; scalar_t__ FT_THROW (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Invalid_File_Format ; #define OTHER_TABLES 128 int /*<<< orphan*/ T1_Skip_PS_Token (TYPE_2__*) ; int /*<<< orphan*/ T1_Skip_Spaces (TYPE_2__*) ; int /*<<< orphan*/ T1_ToBytes (TYPE_2__*,char*,scalar_t__,scalar_t__*,int) ; scalar_t__ T1_ToInt (TYPE_2__*) ; scalar_t__ ft_isdigit (char) ; __attribute__((used)) static void t42_parse_sfnts( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; FT_Memory memory = parser->root.memory; FT_Byte* cur; FT_Byte* limit = parser->root.limit; FT_Error error; FT_Int num_tables = 0; FT_Long count; FT_ULong n, string_size, old_string_size, real_size; FT_Byte* string_buf = NULL; FT_Bool allocated = 0; T42_Load_Status status; /* The format is */ /* */ /* /sfnts [ <hexstring> <hexstring> ... ] def */ /* */ /* or */ /* */ /* /sfnts [ */ /* <num_bin_bytes> RD <binary data> */ /* <num_bin_bytes> RD <binary data> */ /* ... */ /* ] def */ /* */ /* with exactly one space after the `RD' token. */ T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit && *parser->root.cursor-- != '[' ) { FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_Spaces( parser ); status = BEFORE_START; string_size = 0; old_string_size = 0; count = 0; while ( parser->root.cursor < limit ) { FT_ULong size; cur = parser->root.cursor; if ( *cur == ']' ) { parser->root.cursor++; goto Exit; } else if ( *cur == '<' ) { if ( string_buf && !allocated ) { FT_ERROR(( "t42_parse_sfnts: " "can't handle mixed binary and hex strings\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_PS_Token( parser ); if ( parser->root.error ) goto Exit; /* don't include delimiters */ string_size = (FT_ULong)( ( parser->root.cursor - cur - 2 - 1 ) / 2 ); if ( !string_size ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( FT_REALLOC( string_buf, old_string_size, string_size ) ) goto Fail; allocated = 1; parser->root.cursor = cur; (void)T1_ToBytes( parser, string_buf, string_size, &real_size, 1 ); old_string_size = string_size; string_size = real_size; } else if ( ft_isdigit( *cur ) ) { FT_Long tmp; if ( allocated ) { FT_ERROR(( "t42_parse_sfnts: " "can't handle mixed binary and hex strings\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } tmp = T1_ToInt( parser ); if ( tmp < 0 ) { FT_ERROR(( "t42_parse_sfnts: invalid string size\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } else string_size = (FT_ULong)tmp; T1_Skip_PS_Token( parser ); /* `RD' */ if ( parser->root.error ) return; string_buf = parser->root.cursor + 1; /* one space after `RD' */ if ( (FT_ULong)( limit - parser->root.cursor ) <= string_size ) { FT_ERROR(( "t42_parse_sfnts: too much binary data\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } else parser->root.cursor += string_size + 1; } if ( !string_buf ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* A string can have a trailing zero (odd) byte for padding. */ /* Ignore it. */ if ( ( string_size & 1 ) && string_buf[string_size - 1] == 0 ) string_size--; if ( !string_size ) { FT_ERROR(( "t42_parse_sfnts: invalid string\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* The whole TTF is now loaded into `string_buf'. We are */ /* checking its contents while copying it to `ttf_data'. */ size = (FT_ULong)( limit - parser->root.cursor ); for ( n = 0; n < string_size; n++ ) { switch ( status ) { case BEFORE_START: /* load offset table, 12 bytes */ if ( count < 12 ) { face->ttf_data[count++] = string_buf[n]; break; } else { num_tables = 16 * face->ttf_data[4] + face->ttf_data[5]; status = BEFORE_TABLE_DIR; face->ttf_size = 12 + 16 * num_tables; if ( (FT_Long)size < face->ttf_size ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( FT_REALLOC( face->ttf_data, 12, face->ttf_size ) ) goto Fail; } /* fall through */ case BEFORE_TABLE_DIR: /* the offset table is read; read the table directory */ if ( count < face->ttf_size ) { face->ttf_data[count++] = string_buf[n]; continue; } else { int i; FT_ULong len; for ( i = 0; i < num_tables; i++ ) { FT_Byte* p = face->ttf_data + 12 + 16 * i + 12; len = FT_PEEK_ULONG( p ); if ( len > size || face->ttf_size > (FT_Long)( size - len ) ) { FT_ERROR(( "t42_parse_sfnts:" " invalid data in sfnts array\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* Pad to a 4-byte boundary length */ face->ttf_size += (FT_Long)( ( len + 3 ) & ~3U ); } status = OTHER_TABLES; if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables, face->ttf_size + 1 ) ) goto Fail; } /* fall through */ case OTHER_TABLES: /* all other tables are just copied */ if ( count >= face->ttf_size ) { FT_ERROR(( "t42_parse_sfnts: too much binary data\n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } face->ttf_data[count++] = string_buf[n]; } } T1_Skip_Spaces( parser ); } /* if control reaches this point, the format was not valid */ error = FT_THROW( Invalid_File_Format ); Fail: parser->root.error = error; Exit: if ( allocated ) FT_FREE( string_buf ); }