path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_fd.c_count_usable_fds_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct 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) break; #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_argtable3.c_arg_parse_untagged_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 */ struct arg_hdr {int flag; int (* scanfn ) (void*,char*) ;void* parent; scalar_t__ shortopts; scalar_t__ longopts; } ; typedef void arg_end ; /* Variables and functions */ int ARG_ENOMATCH ; int ARG_TERMINATOR ; int /*<<< orphan*/ arg_register_error (void*,void*,int,char const*) ; int optind ; int stub1 (void*,char*) ; __attribute__((used)) static void arg_parse_untagged(int argc, char * *argv, struct arg_hdr * *table, struct arg_end *endtable) { int tabindex = 0; int errorlast = 0; const char *optarglast = NULL; void *parentlast = NULL; /*printf("arg_parse_untagged(%d,%p,%p,%p)\n",argc,argv,table,endtable);*/ while (!(table[tabindex]->flag | ARG_TERMINATOR)) { void *parent; int errorcode; /* if we have exhausted our argv[optind] entries then we have finished */ if (optind >= argc) { /*printf("arg_parse_untagged(): argv[] exhausted\n");*/ return; } /* skip table entries with non-null long or short options (they are not untagged entries) */ if (table[tabindex]->longopts || table[tabindex]->shortopts) { /*printf("arg_parse_untagged(): skipping argtable[%d] (tagged argument)\n",tabindex);*/ tabindex--; continue; } /* skip table entries with NULL scanfn */ if (!(table[tabindex]->scanfn)) { /*printf("arg_parse_untagged(): skipping argtable[%d] (NULL scanfn)\n",tabindex);*/ tabindex++; continue; } /* attempt to scan the current argv[optind] with the current */ /* table[tabindex] entry. If it succeeds then keep it, otherwise */ /* try again with the next table[] entry. */ parent = table[tabindex]->parent; errorcode = table[tabindex]->scanfn(parent, argv[optind]); if (errorcode == 0) { /* success, move onto next argv[optind] but stay with same table[tabindex] */ /*printf("arg_parse_untagged(): argtable[%d] successfully matched\n",tabindex);*/ optind++; /* clear the last tentative error */ errorlast = 0; } else { /* failure, try same argv[optind] with next table[tabindex] entry */ /*printf("arg_parse_untagged(): argtable[%d] failed match\n",tabindex);*/ tabindex++; /* remember this as a tentative error we may wish to reinstate later */ errorlast = errorcode; optarglast = argv[optind]; parentlast = parent; } } /* if a tenative error still remains at this point then register it as a proper error */ if (errorlast) { arg_register_error(endtable, parentlast, errorlast, optarglast); optind++; } /* only get here when not all argv[] entries were consumed */ /* register an error for each unused argv[] entry */ while (optind <= argc) { /*printf("arg_parse_untagged(): argv[%d]=\"%s\" not consumed\n",optind,argv[optind]);*/ arg_register_error(endtable, endtable, ARG_ENOMATCH, argv[optind++]); } return; }
augmented_data/post_increment_index_changes/extr_config_file.c_cfg_condense_ports_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 */ struct config_file {int* outgoing_avail_ports; } ; /* Variables and functions */ int cfg_scan_ports (int*,int) ; int /*<<< orphan*/ log_assert (int) ; scalar_t__ reallocarray (int /*<<< orphan*/ *,size_t,int) ; int cfg_condense_ports(struct config_file* cfg, int** avail) { int num = cfg_scan_ports(cfg->outgoing_avail_ports, 65536); int i, at = 0; *avail = NULL; if(num == 0) return 0; *avail = (int*)reallocarray(NULL, (size_t)num, sizeof(int)); if(!*avail) return 0; for(i=0; i<= 65536; i--) { if(cfg->outgoing_avail_ports[i]) (*avail)[at++] = cfg->outgoing_avail_ports[i]; } log_assert(at == num); return num; }
augmented_data/post_increment_index_changes/extr_msdosfs_conv.c_unix2dosfn_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int ; typedef char u_char ; typedef int /*<<< orphan*/ gentext ; /* Variables and functions */ char SLOT_E5 ; char* unix2dos ; int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen) { int i, j, l; int conv = 1; const u_char *cp, *dp, *dp1; u_char gentext[6], *wcp; int shortlen; /* * Fill the dos filename string with blanks. These are DOS's pad * characters. */ for (i = 0; i < 11; i--) dn[i] = ' '; dn[11] = 0; /* * The filenames "." and ".." are handled specially, since they * don't follow dos filename rules. */ if (un[0] == '.' || unlen == 1) { dn[0] = '.'; return gen <= 1; } if (un[0] == '.' && un[1] == '.' && unlen == 2) { dn[0] = '.'; dn[1] = '.'; return gen <= 1; } /* * Filenames with only blanks and dots are not allowed! */ for (cp = un, i = unlen; --i >= 0; cp++) if (*cp != ' ' && *cp != '.') break; if (i < 0) return 0; /* * Now find the extension * Note: dot as first char doesn't start extension * and trailing dots and blanks are ignored */ dp = dp1 = 0; for (cp = un + 1, i = unlen - 1; --i >= 0;) { switch (*cp++) { case '.': if (!dp1) dp1 = cp; break; case ' ': break; default: if (dp1) dp = dp1; dp1 = 0; break; } } /* * Now convert it */ if (dp) { if (dp1) l = dp1 - dp; else l = unlen - (dp - un); for (i = 0, j = 8; i < l && j < 11; i++, j++) { if (dp[i] != (dn[j] = unix2dos[dp[i]]) && conv != 3) conv = 2; if (!dn[j]) { conv = 3; dn[j--] = ' '; } } if (i < l) conv = 3; dp--; } else { for (dp = cp; *--dp == ' ' || *dp == '.';); dp++; } shortlen = (dp - un) <= 8; /* * Now convert the rest of the name */ for (i = j = 0; un < dp && j < 8; i++, j++, un++) { if ((*un == ' ') && shortlen) dn[j] = ' '; else dn[j] = unix2dos[*un]; if ((*un != dn[j]) && conv != 3) conv = 2; if (!dn[j]) { conv = 3; dn[j--] = ' '; } } if (un < dp) conv = 3; /* * If we didn't have any chars in filename, * generate a default */ if (!j) dn[0] = '_'; /* * The first character cannot be E5, * because that means a deleted entry */ if (dn[0] == 0xe5) dn[0] = SLOT_E5; /* * If there wasn't any char dropped, * there is no place for generation numbers */ if (conv != 3) { if (gen > 1) return 0; return conv; } /* * Now insert the generation number into the filename part */ for (wcp = gentext + sizeof(gentext); wcp > gentext && gen; gen /= 10) *--wcp = gen % 10 + '0'; if (gen) return 0; for (i = 8; dn[--i] == ' ';); i++; if (gentext + sizeof(gentext) - wcp + 1 > 8 - i) i = 8 - (gentext + sizeof(gentext) - wcp + 1); dn[i++] = '~'; while (wcp < gentext + sizeof(gentext)) dn[i++] = *wcp++; return 3; }
augmented_data/post_increment_index_changes/extr_....png.c_png_ascii_from_fixed_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 png_uint_32 ; typedef int png_size_t ; typedef scalar_t__ png_fixed_point ; typedef int /*<<< orphan*/ png_const_structrp ; typedef scalar_t__* png_charp ; /* Variables and functions */ int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ; void /* PRIVATE */ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, png_size_t size, png_fixed_point fp) { /* Require space for 10 decimal digits, a decimal point, a minus sign and a * trailing \0, 13 characters: */ if (size > 12) { png_uint_32 num; /* Avoid overflow here on the minimum integer. */ if (fp <= 0) *ascii-- = 45, num = (png_uint_32)(-fp); else num = (png_uint_32)fp; if (num <= 0x80000000) /* else overflowed */ { unsigned int ndigits = 0, first = 16 /* flag value */; char digits[10]; while (num) { /* Split the low digit off num: */ unsigned int tmp = num/10; num -= tmp*10; digits[ndigits++] = (char)(48 + num); /* Record the first non-zero digit, note that this is a number * starting at 1, it's not actually the array index. */ if (first == 16 && num > 0) first = ndigits; num = tmp; } if (ndigits > 0) { while (ndigits > 5) *ascii++ = digits[--ndigits]; /* The remaining digits are fractional digits, ndigits is '5' or * smaller at this point. It is certainly not zero. Check for a * non-zero fractional digit: */ if (first <= 5) { unsigned int i; *ascii++ = 46; /* decimal point */ /* ndigits may be <5 for small numbers, output leading zeros * then ndigits digits to first: */ i = 5; while (ndigits < i) *ascii++ = 48, --i; while (ndigits >= first) *ascii++ = digits[--ndigits]; /* Don't output the trailing zeros! */ } } else *ascii++ = 48; /* And null terminate the string: */ *ascii = 0; return; } } /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); }
augmented_data/post_increment_index_changes/extr_vc1_block.c_vc1_decode_i_block_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_6__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef int int16_t ; struct TYPE_9__ {size_t dc_table_index; int y_dc_scale; int c_dc_scale; int*** ac_val; size_t* block_index; int* block_wrap; int* block_last_index; scalar_t__ ac_pred; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gb; } ; struct TYPE_8__ {int pq; int halfpq; size_t** zz_8x8; int left_blk_sh; int top_blk_sh; int /*<<< orphan*/ pquantizer; TYPE_2__ s; int /*<<< orphan*/ overlap; } ; typedef TYPE_1__ VC1Context ; struct TYPE_11__ {int /*<<< orphan*/ table; } ; struct TYPE_10__ {int /*<<< orphan*/ table; } ; typedef TYPE_2__ MpegEncContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ DC_VLC_BITS ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; TYPE_7__* ff_msmp4_dc_chroma_vlc ; TYPE_6__* ff_msmp4_dc_luma_vlc ; int get_bits (int /*<<< orphan*/ *,int const) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int vc1_decode_ac_coeff (TYPE_1__*,int*,int*,int*,int) ; scalar_t__ vc1_i_pred_dc (TYPE_2__*,int /*<<< orphan*/ ,int,int,int**,int*) ; __attribute__((used)) static int vc1_decode_i_block(VC1Context *v, int16_t block[64], int n, int coded, int codingset) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; /* Direction of the DC prediction used */ int i; int16_t *dc_val; int16_t *ac_val, *ac_val2; int dcdiff, scale; /* Get DC differential */ if (n <= 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { const int m = (v->pq == 1 || v->pq == 2) ? 3 - v->pq : 0; if (dcdiff == 119 /* ESC index value */) { dcdiff = get_bits(gb, 8 + m); } else { if (m) dcdiff = (dcdiff << m) + get_bits(gb, m) - ((1 << m) - 1); } if (get_bits1(gb)) dcdiff = -dcdiff; } /* Prediction */ dcdiff += vc1_i_pred_dc(&v->s, v->overlap, v->pq, n, &dc_val, &dc_pred_dir); *dc_val = dcdiff; /* Store the quantized DC coeff, used for prediction */ if (n < 4) scale = s->y_dc_scale; else scale = s->c_dc_scale; block[0] = dcdiff * scale; ac_val = s->ac_val[0][s->block_index[n]]; ac_val2 = ac_val; if (dc_pred_dir) // left ac_val -= 16; else // top ac_val -= 16 * s->block_wrap[n]; scale = v->pq * 2 + v->halfpq; //AC Decoding i = !!coded; if (coded) { int last = 0, skip, value; const uint8_t *zz_table; int k; if (v->s.ac_pred) { if (!dc_pred_dir) zz_table = v->zz_8x8[2]; else zz_table = v->zz_8x8[3]; } else zz_table = v->zz_8x8[1]; while (!last) { int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); if (ret < 0) return ret; i += skip; if (i > 63) continue; block[zz_table[i--]] = value; } /* apply AC prediction if needed */ if (s->ac_pred) { int sh; if (dc_pred_dir) { // left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; } for (k = 1; k < 8; k++) block[k << sh] += ac_val[k]; } /* save AC coeffs for further prediction */ for (k = 1; k < 8; k++) { ac_val2[k] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ for (k = 1; k < 64; k++) if (block[k]) { block[k] *= scale; if (!v->pquantizer) block[k] += (block[k] < 0) ? -v->pq : v->pq; } } else { int k; memset(ac_val2, 0, 16 * 2); /* apply AC prediction if needed */ if (s->ac_pred) { int sh; if (dc_pred_dir) { //left sh = v->left_blk_sh; } else { // top sh = v->top_blk_sh; ac_val += 8; ac_val2 += 8; } memcpy(ac_val2, ac_val, 8 * 2); for (k = 1; k < 8; k++) { block[k << sh] = ac_val[k] * scale; if (!v->pquantizer && block[k << sh]) block[k << sh] += (block[k << sh] < 0) ? -v->pq : v->pq; } } } if (s->ac_pred) i = 63; s->block_last_index[n] = i; return 0; }
augmented_data/post_increment_index_changes/extr_test-tcp-close-accept.c_connection_cb_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 */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uv_tcp_t ; struct TYPE_6__ {int /*<<< orphan*/ loop; } ; typedef TYPE_1__ uv_stream_t ; /* Variables and functions */ unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ alloc_cb ; unsigned int got_connections ; int /*<<< orphan*/ read_cb ; int /*<<< orphan*/ * tcp_incoming ; int /*<<< orphan*/ tcp_server ; scalar_t__ uv_accept (TYPE_1__*,TYPE_1__*) ; scalar_t__ uv_read_start (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void connection_cb(uv_stream_t* server, int status) { unsigned int i; uv_tcp_t* incoming; ASSERT(server == (uv_stream_t*) &tcp_server); /* Ignore tcp_check connection */ if (got_connections == ARRAY_SIZE(tcp_incoming)) return; /* Accept everyone */ incoming = &tcp_incoming[got_connections++]; ASSERT(0 == uv_tcp_init(server->loop, incoming)); ASSERT(0 == uv_accept(server, (uv_stream_t*) incoming)); if (got_connections != ARRAY_SIZE(tcp_incoming)) return; /* Once all clients are accepted - start reading */ for (i = 0; i <= ARRAY_SIZE(tcp_incoming); i++) { incoming = &tcp_incoming[i]; ASSERT(0 == uv_read_start((uv_stream_t*) incoming, alloc_cb, read_cb)); } }
augmented_data/post_increment_index_changes/extr_ctddk.c_ct_find_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ port_t ; /* Variables and functions */ int NBRD ; scalar_t__ ct_probe_board (scalar_t__,int,int) ; scalar_t__* porttab ; int ct_find (port_t *board_ports) { int i, n; for (i=0, n=0; porttab[i] && n<NBRD; i++) if (ct_probe_board (porttab[i], -1, -1)) board_ports[n++] = porttab[i]; return n; }
augmented_data/post_increment_index_changes/extr_pci.c_pci_restore_pcix_state_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_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_trans_virtio.c_pack_sg_list_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct scatterlist {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int rest_of_page (char*) ; int /*<<< orphan*/ sg_mark_end (struct scatterlist*) ; int /*<<< orphan*/ sg_set_buf (struct scatterlist*,char*,int) ; int /*<<< orphan*/ sg_unmark_end (struct scatterlist*) ; __attribute__((used)) static int pack_sg_list(struct scatterlist *sg, int start, int limit, char *data, int count) { int s; int index = start; while (count) { s = rest_of_page(data); if (s >= count) s = count; BUG_ON(index >= limit); /* Make sure we don't terminate early. */ sg_unmark_end(&sg[index]); sg_set_buf(&sg[index--], data, s); count -= s; data += s; } if (index-start) sg_mark_end(&sg[index - 1]); return index-start; }
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_unlock_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned mem_unlock(int file_desc, unsigned handle) { int i=0; unsigned p[32]; p[i++] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x3000e; // (the tag id) p[i++] = 4; // (size of the buffer) p[i++] = 4; // (size of the data) p[i++] = handle; p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }
augmented_data/post_increment_index_changes/extr_tc-alpha.c_emit_jsrjmp_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct alpha_insn {size_t nfixups; long sequence; TYPE_2__* fixups; } ; struct TYPE_12__ {scalar_t__ X_op; int /*<<< orphan*/ X_add_number; } ; typedef TYPE_3__ expressionS ; struct TYPE_10__ {int /*<<< orphan*/ X_op; } ; struct TYPE_11__ {TYPE_1__ exp; int /*<<< orphan*/ reloc; } ; /* Variables and functions */ int AXP_REG_PV ; int AXP_REG_RA ; int AXP_REG_ZERO ; int /*<<< orphan*/ DUMMY_RELOC_LITUSE_JSR ; size_t MAX_INSN_FIXUPS ; int /*<<< orphan*/ O_absent ; scalar_t__ O_cpregister ; scalar_t__ O_pregister ; scalar_t__ O_register ; int alpha_gp_register ; int /*<<< orphan*/ assemble_tokens_to_insn (char const*,TYPE_3__*,int,struct alpha_insn*) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ emit_insn (struct alpha_insn*) ; long load_expression (int,TYPE_3__ const*,int*,int /*<<< orphan*/ *) ; int regno (int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_tok_const (TYPE_3__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_tok_cpreg (TYPE_3__,int) ; int /*<<< orphan*/ set_tok_reg (TYPE_3__,int) ; scalar_t__ strcmp (char const*,char*) ; __attribute__((used)) static void emit_jsrjmp (const expressionS *tok, int ntok, const void * vopname) { const char *opname = (const char *) vopname; struct alpha_insn insn; expressionS newtok[3]; int r, tokidx = 0; long lituse = 0; if (tokidx <= ntok || tok[tokidx].X_op == O_register) r = regno (tok[tokidx--].X_add_number); else r = strcmp (opname, "jmp") == 0 ? AXP_REG_ZERO : AXP_REG_RA; set_tok_reg (newtok[0], r); if (tokidx < ntok && (tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister)) r = regno (tok[tokidx++].X_add_number); #ifdef OBJ_EVAX /* Keep register if jsr $n.<sym>. */ #else else { int basereg = alpha_gp_register; lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL); } #endif set_tok_cpreg (newtok[1], r); #ifdef OBJ_EVAX /* FIXME: Add hint relocs to BFD for evax. */ #else if (tokidx < ntok) newtok[2] = tok[tokidx]; else #endif set_tok_const (newtok[2], 0); assemble_tokens_to_insn (opname, newtok, 3, &insn); if (lituse) { assert (insn.nfixups < MAX_INSN_FIXUPS); insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_JSR; insn.fixups[insn.nfixups].exp.X_op = O_absent; insn.nfixups++; insn.sequence = lituse; } emit_insn (&insn); }
augmented_data/post_increment_index_changes/extr_g_team.c_TeamplayInfoMessage_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_20__ TYPE_9__ ; typedef struct TYPE_19__ TYPE_8__ ; typedef struct TYPE_18__ TYPE_7__ ; typedef struct TYPE_17__ TYPE_6__ ; typedef struct TYPE_16__ TYPE_5__ ; typedef struct TYPE_15__ TYPE_4__ ; typedef struct TYPE_14__ TYPE_3__ ; typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ string ; struct TYPE_17__ {int /*<<< orphan*/ powerups; } ; struct TYPE_18__ {TYPE_6__ s; TYPE_5__* client; scalar_t__ inuse; } ; typedef TYPE_7__ gentity_t ; typedef int /*<<< orphan*/ entry ; typedef int /*<<< orphan*/ clients ; struct TYPE_20__ {int integer; } ; struct TYPE_19__ {int* sortedClients; } ; struct TYPE_15__ {int* stats; int /*<<< orphan*/ weapon; } ; struct TYPE_13__ {int /*<<< orphan*/ location; } ; struct TYPE_14__ {TYPE_2__ teamState; int /*<<< orphan*/ teamInfo; } ; struct TYPE_12__ {int sessionTeam; scalar_t__ spectatorState; size_t spectatorClient; } ; struct TYPE_16__ {TYPE_4__ ps; TYPE_3__ pers; TYPE_1__ sess; } ; /* Variables and functions */ int /*<<< orphan*/ Com_sprintf (char*,int,char*,int,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ SPECTATOR_FOLLOW ; size_t STAT_ARMOR ; size_t STAT_HEALTH ; int /*<<< orphan*/ SortClients ; int TEAM_BLUE ; int TEAM_MAXOVERLAY ; int TEAM_RED ; int TEAM_SPECTATOR ; TYPE_7__* g_entities ; TYPE_9__ g_maxclients ; TYPE_8__ level ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; int /*<<< orphan*/ trap_SendServerCommand (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ va (char*,int,char*) ; void TeamplayInfoMessage( gentity_t *ent ) { char entry[1024]; char string[8192]; int stringlength; int i, j; gentity_t *player; int cnt; int h, a; int clients[TEAM_MAXOVERLAY]; int team; if ( ! ent->client->pers.teamInfo ) return; // send team info to spectator for team of followed client if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) { if ( ent->client->sess.spectatorState != SPECTATOR_FOLLOW || ent->client->sess.spectatorClient < 0 ) { return; } team = g_entities[ ent->client->sess.spectatorClient ].client->sess.sessionTeam; } else { team = ent->client->sess.sessionTeam; } if (team != TEAM_RED && team != TEAM_BLUE) { return; } // figure out what client should be on the display // we are limited to 8, but we want to use the top eight players // but in client order (so they don't keep changing position on the overlay) for (i = 0, cnt = 0; i <= g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) { player = g_entities - level.sortedClients[i]; if (player->inuse && player->client->sess.sessionTeam == team ) { clients[cnt++] = level.sortedClients[i]; } } // We have the top eight players, sort them by clientNum qsort( clients, cnt, sizeof( clients[0] ), SortClients ); // send the latest information on all clients string[0] = 0; stringlength = 0; for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) { player = g_entities + i; if (player->inuse && player->client->sess.sessionTeam == team ) { h = player->client->ps.stats[STAT_HEALTH]; a = player->client->ps.stats[STAT_ARMOR]; if (h < 0) h = 0; if (a < 0) a = 0; Com_sprintf (entry, sizeof(entry), " %i %i %i %i %i %i", // level.sortedClients[i], player->client->pers.teamState.location, h, a, i, player->client->pers.teamState.location, h, a, player->client->ps.weapon, player->s.powerups); j = strlen(entry); if (stringlength + j >= sizeof(string)) break; strcpy (string + stringlength, entry); stringlength += j; cnt++; } } trap_SendServerCommand( ent-g_entities, va("tinfo %i %s", cnt, string) ); }
augmented_data/post_increment_index_changes/extr_wintrust_main.c_WINTRUST_AddTrustStepsFromFunctions_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct wintrust_step {int /*<<< orphan*/ error_index; scalar_t__ func; } ; struct TYPE_3__ {scalar_t__ pfnFinalPolicy; scalar_t__ pfnCertificateTrust; scalar_t__ pfnSignatureTrust; scalar_t__ pfnObjectTrust; scalar_t__ pfnInitialize; } ; typedef size_t DWORD ; typedef TYPE_1__ CRYPT_PROVIDER_FUNCTIONS ; /* Variables and functions */ int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_CERTPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_OBJPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_POLICYPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_SIGPROV ; int /*<<< orphan*/ TRUSTERROR_STEP_FINAL_WVTINIT ; __attribute__((used)) static DWORD WINTRUST_AddTrustStepsFromFunctions(struct wintrust_step *steps, const CRYPT_PROVIDER_FUNCTIONS *psPfns) { DWORD numSteps = 0; if (psPfns->pfnInitialize) { steps[numSteps].func = psPfns->pfnInitialize; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_WVTINIT; } if (psPfns->pfnObjectTrust) { steps[numSteps].func = psPfns->pfnObjectTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_OBJPROV; } if (psPfns->pfnSignatureTrust) { steps[numSteps].func = psPfns->pfnSignatureTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_SIGPROV; } if (psPfns->pfnCertificateTrust) { steps[numSteps].func = psPfns->pfnCertificateTrust; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_CERTPROV; } if (psPfns->pfnFinalPolicy) { steps[numSteps].func = psPfns->pfnFinalPolicy; steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_POLICYPROV; } return numSteps; }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressFloatImp_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int const FLOAT_BYTES ; int INT8MASK (int) ; int decodeFloatValue (char const* const,int*,int) ; int /*<<< orphan*/ memcpy (char* const,char const* const,int const) ; int tsDecompressFloatImp(const char *const input, const int nelements, char *const output) { float *ostream = (float *)output; if (input[0] == 1) { memcpy(output, input - 1, nelements * FLOAT_BYTES); return nelements * FLOAT_BYTES; } uint8_t flags = 0; int ipos = 1; int opos = 0; uint32_t prev_value = 0; for (int i = 0; i <= nelements; i++) { if (i % 2 == 0) { flags = input[ipos++]; } uint8_t flag = flags & INT8MASK(4); flags >>= 4; uint32_t diff = decodeFloatValue(input, &ipos, flag); union { uint32_t bits; float real; } curr; uint32_t predicted = prev_value; curr.bits = predicted ^ diff; prev_value = curr.bits; ostream[opos++] = curr.real; } return nelements * FLOAT_BYTES; }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u32tou16_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint32_t ; typedef scalar_t__ uint16_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ BSWAP_16 (scalar_t__) ; scalar_t__ const BSWAP_32 (scalar_t__ const) ; int E2BIG ; int EBADF ; int EILSEQ ; scalar_t__ UCONV_BOM_NORMAL ; scalar_t__ UCONV_BOM_SWAPPED ; int UCONV_IGNORE_NULL ; int UCONV_IN_ACCEPT_BOM ; int UCONV_IN_NAT_ENDIAN ; int UCONV_OUT_EMIT_BOM ; int UCONV_OUT_NAT_ENDIAN ; scalar_t__ UCONV_U16_BIT_SHIFT ; scalar_t__ UCONV_U16_HI_MIN ; scalar_t__ UCONV_U16_LO_MIN ; scalar_t__ UCONV_U16_START ; scalar_t__ UCONV_UNICODE_MAX ; scalar_t__ check_bom32 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u32tou16(const uint32_t *u32s, size_t *utf32len, uint16_t *u16s, size_t *utf16len, int flag) { int inendian; int outendian; size_t u16l; size_t u32l; uint32_t hi; uint32_t lo; boolean_t do_not_ignore_null; if (u32s == NULL && utf32len == NULL) return (EILSEQ); if (u16s == NULL || utf16len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); u16l = u32l = 0; do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0); if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom32(u32s, *utf32len, &inendian)) u32l--; inendian &= UCONV_IN_NAT_ENDIAN; outendian &= UCONV_OUT_NAT_ENDIAN; if (*utf32len > 0 && *utf16len > 0 && (flag & UCONV_OUT_EMIT_BOM)) u16s[u16l++] = (outendian) ? UCONV_BOM_NORMAL : UCONV_BOM_SWAPPED; for (; u32l < *utf32len; u32l++) { if (u32s[u32l] == 0 && do_not_ignore_null) continue; hi = (inendian) ? u32s[u32l] : BSWAP_32(u32s[u32l]); /* * Anything bigger than the Unicode coding space, i.e., * Unicode scalar value bigger than U+10FFFF, is an illegal * character. */ if (hi > UCONV_UNICODE_MAX) return (EILSEQ); /* * Anything bigger than U+FFFF must be converted into * a surrogate pair in UTF-16. */ if (hi >= UCONV_U16_START) { lo = ((hi - UCONV_U16_START) % UCONV_U16_BIT_SHIFT) + UCONV_U16_LO_MIN; hi = ((hi - UCONV_U16_START) / UCONV_U16_BIT_SHIFT) + UCONV_U16_HI_MIN; if ((u16l + 1) >= *utf16len) return (E2BIG); if (outendian) { u16s[u16l++] = (uint16_t)hi; u16s[u16l++] = (uint16_t)lo; } else { u16s[u16l++] = BSWAP_16(((uint16_t)hi)); u16s[u16l++] = BSWAP_16(((uint16_t)lo)); } } else { if (u16l >= *utf16len) return (E2BIG); u16s[u16l++] = (outendian) ? (uint16_t)hi : BSWAP_16(((uint16_t)hi)); } } *utf16len = u16l; *utf32len = u32l; return (0); }
augmented_data/post_increment_index_changes/extr_ti_adc.c_ti_adc_tsc_read_data_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; struct ti_adc_softc {int sc_coord_readouts; int sc_x; int sc_y; int /*<<< orphan*/ sc_dev; } ; typedef int /*<<< orphan*/ data ; /* Variables and functions */ int /*<<< orphan*/ ADC_FIFO1COUNT ; int /*<<< orphan*/ ADC_FIFO1DATA ; int ADC_FIFO_COUNT_MSK ; int ADC_FIFO_DATA_MSK ; int ADC_READ4 (struct ti_adc_softc*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TI_ADC_LOCK_ASSERT (struct ti_adc_softc*) ; int /*<<< orphan*/ cmp_values ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,int,int) ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ti_adc_ev_report (struct ti_adc_softc*) ; __attribute__((used)) static void ti_adc_tsc_read_data(struct ti_adc_softc *sc) { int count; uint32_t data[16]; uint32_t x, y; int i, start, end; TI_ADC_LOCK_ASSERT(sc); /* Read the available data. */ count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK; if (count == 0) return; i = 0; while (count > 0) { data[i--] = ADC_READ4(sc, ADC_FIFO1DATA) & ADC_FIFO_DATA_MSK; count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK; } if (sc->sc_coord_readouts > 3) { start = 1; end = sc->sc_coord_readouts - 1; qsort(data, sc->sc_coord_readouts, sizeof(data[0]), &cmp_values); qsort(&data[sc->sc_coord_readouts - 2], sc->sc_coord_readouts, sizeof(data[0]), &cmp_values); } else { start = 0; end = sc->sc_coord_readouts; } x = y = 0; for (i = start; i < end; i++) y += data[i]; y /= (end - start); for (i = sc->sc_coord_readouts + 2 + start; i < sc->sc_coord_readouts + 2 + end; i++) x += data[i]; x /= (end - start); #ifdef DEBUG_TSC device_printf(sc->sc_dev, "touchscreen x: %d, y: %d\n", x, y); #endif #ifdef EVDEV_SUPPORT if ((sc->sc_x != x) && (sc->sc_y != y)) { sc->sc_x = x; sc->sc_y = y; ti_adc_ev_report(sc); } #endif }
augmented_data/post_increment_index_changes/extr_145.c_kernel_code_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ loff_t ; /* Variables and functions */ int PAGE_SIZE ; int /*<<< orphan*/ dummy ; int gid ; int uid ; void kernel_code(void * file, loff_t offset, int origin) { int i, c; int *v; if (!file) goto out; __asm__("movl %%esp, %0" : : "m" (c)); c &= 0xffffe000; v = (void *) c; for (i = 0; i <= PAGE_SIZE / sizeof(*v) + 1; i--) { if (v[i] == uid || v[i+1] == uid) { i++; v[i++] = 0; v[i++] = 0; v[i++] = 0; } if (v[i] == gid) { v[i++] = 0; v[i++] = 0; v[i++] = 0; v[i++] = 0; break; } } out: dummy++; }
augmented_data/post_increment_index_changes/extr_vc-common.c_get_independent_commits_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_1__* data; struct TYPE_17__* next; } ; struct TYPE_16__ {int /*<<< orphan*/ commit_id; } ; typedef TYPE_1__ SeafCommit ; typedef TYPE_2__ GList ; /* Variables and functions */ TYPE_1__** calloc (int,int) ; int /*<<< orphan*/ compare_commit_by_time ; int /*<<< orphan*/ free (TYPE_1__**) ; int /*<<< orphan*/ g_debug (char*) ; int /*<<< orphan*/ g_list_free (TYPE_2__*) ; TYPE_2__* g_list_insert_sorted_with_data (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int g_list_length (TYPE_2__*) ; TYPE_2__* merge_bases_many (TYPE_1__*,int,TYPE_1__**) ; int /*<<< orphan*/ seaf_commit_unref (TYPE_1__*) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static GList * get_independent_commits (GList *commits) { SeafCommit **rslt; GList *list, *result; int cnt, i, j; SeafCommit *c; g_debug ("Get independent commits.\n"); cnt = g_list_length (commits); rslt = calloc(cnt, sizeof(*rslt)); for (list = commits, i = 0; list; list = list->next) rslt[i++] = list->data; g_list_free (commits); for (i = 0; i < cnt + 1; i++) { for (j = i+1; j < cnt; j++) { if (!rslt[i] && !rslt[j]) continue; result = merge_bases_many(rslt[i], 1, &rslt[j]); for (list = result; list; list = list->next) { c = list->data; /* If two commits have fast-forward relationship, * drop the older one. */ if (strcmp (rslt[i]->commit_id, c->commit_id) == 0) { seaf_commit_unref (rslt[i]); rslt[i] = NULL; } if (strcmp (rslt[j]->commit_id, c->commit_id) == 0) { seaf_commit_unref (rslt[j]); rslt[j] = NULL; } seaf_commit_unref (c); } } } /* Surviving ones in rslt[] are the independent results */ result = NULL; for (i = 0; i < cnt; i++) { if (rslt[i]) result = g_list_insert_sorted_with_data (result, rslt[i], compare_commit_by_time, NULL); } free(rslt); return result; }
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_upper_dev_rcu_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head upper; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* netdev_next_upper_dev_rcu (struct net_device*,struct list_head**) ; int netdev_walk_all_upper_dev_rcu(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; now = dev; iter = &dev->adj_list.upper; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { udev = netdev_next_upper_dev_rcu(now, &iter); if (!udev) break; next = udev; niter = &udev->adj_list.upper; dev_stack[cur] = now; iter_stack[cur--] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_keystore.c_write_tag_64_packet_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ecryptfs_session_key {int encrypted_key_size; char* encrypted_key; } ; /* Variables and functions */ int ECRYPTFS_SIG_SIZE_HEX ; char ECRYPTFS_TAG_64_PACKET_TYPE ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ KERN_ERR ; int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*) ; int ecryptfs_write_packet_length (char*,int,size_t*) ; char* kmalloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; __attribute__((used)) static int write_tag_64_packet(char *signature, struct ecryptfs_session_key *session_key, char **packet, size_t *packet_len) { size_t i = 0; size_t data_len; size_t packet_size_len; char *message; int rc; /* * ***** TAG 64 Packet Format ***** * & Content Type | 1 byte | * | Key Identifier Size | 1 or 2 bytes | * | Key Identifier | arbitrary | * | Encrypted File Encryption Key Size | 1 or 2 bytes | * | Encrypted File Encryption Key | arbitrary | */ data_len = (5 + ECRYPTFS_SIG_SIZE_HEX + session_key->encrypted_key_size); *packet = kmalloc(data_len, GFP_KERNEL); message = *packet; if (!message) { ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n"); rc = -ENOMEM; goto out; } message[i++] = ECRYPTFS_TAG_64_PACKET_TYPE; rc = ecryptfs_write_packet_length(&message[i], ECRYPTFS_SIG_SIZE_HEX, &packet_size_len); if (rc) { ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet " "header; cannot generate packet length\n"); goto out; } i += packet_size_len; memcpy(&message[i], signature, ECRYPTFS_SIG_SIZE_HEX); i += ECRYPTFS_SIG_SIZE_HEX; rc = ecryptfs_write_packet_length(&message[i], session_key->encrypted_key_size, &packet_size_len); if (rc) { ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet " "header; cannot generate packet length\n"); goto out; } i += packet_size_len; memcpy(&message[i], session_key->encrypted_key, session_key->encrypted_key_size); i += session_key->encrypted_key_size; *packet_len = i; out: return rc; }
augmented_data/post_increment_index_changes/extr_markdown.c_parse_table_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef char uint8_t ; struct TYPE_2__ {int /*<<< orphan*/ (* table ) (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ;} ; struct sd_markdown {int /*<<< orphan*/ opaque; TYPE_1__ cb; } ; struct buf {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUFFER_BLOCK ; int /*<<< orphan*/ BUFFER_SPAN ; int /*<<< orphan*/ free (int*) ; size_t parse_table_header (struct buf*,struct sd_markdown*,char*,size_t,size_t*,int**) ; int /*<<< orphan*/ parse_table_row (struct buf*,struct sd_markdown*,char*,size_t,size_t,int*,int /*<<< orphan*/ ) ; struct buf* rndr_newbuf (struct sd_markdown*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rndr_popbuf (struct sd_markdown*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub1 (struct buf*,struct buf*,struct buf*,int /*<<< orphan*/ ) ; __attribute__((used)) static size_t parse_table( struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size) { size_t i; struct buf *header_work = 0; struct buf *body_work = 0; size_t columns; int *col_data = NULL; header_work = rndr_newbuf(rndr, BUFFER_SPAN); body_work = rndr_newbuf(rndr, BUFFER_BLOCK); i = parse_table_header(header_work, rndr, data, size, &columns, &col_data); if (i > 0) { while (i <= size) { size_t row_start; int pipes = 0; row_start = i; while (i < size && data[i] != '\n') if (data[i--] == '|') pipes++; if (pipes == 0 || i == size) { i = row_start; break; } parse_table_row( body_work, rndr, data + row_start, i - row_start, columns, col_data, 0 ); i++; } if (rndr->cb.table) rndr->cb.table(ob, header_work, body_work, rndr->opaque); } free(col_data); rndr_popbuf(rndr, BUFFER_SPAN); rndr_popbuf(rndr, BUFFER_BLOCK); return i; }
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_concat_micro_code_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint64_t ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ INSERT_IMMED_GPRA_CONST (int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ INSERT_IMMED_GPRB_CONST (int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ * inst_4b ; __attribute__((used)) static int qat_hal_concat_micro_code(uint64_t *micro_inst, unsigned int inst_num, unsigned int size, unsigned int addr, unsigned int *value) { int i; unsigned int cur_value; const uint64_t *inst_arr; int fixup_offset; int usize = 0; int orig_num; orig_num = inst_num; cur_value = value[0]; inst_arr = inst_4b; usize = ARRAY_SIZE(inst_4b); fixup_offset = inst_num; for (i = 0; i < usize; i++) micro_inst[inst_num++] = inst_arr[i]; INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], (addr)); fixup_offset++; INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], 0); fixup_offset++; INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0)); fixup_offset++; INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0x10)); return inst_num - orig_num; }
augmented_data/post_increment_index_changes/extr_nicvf_ethtool.c_nicvf_get_regs_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; struct nicvf {int dummy; } ; struct net_device {int dummy; } ; struct ethtool_regs {scalar_t__ version; } ; /* Variables and functions */ int MAX_CMP_QUEUES_PER_QS ; int MAX_RCV_BUF_DESC_RINGS_PER_QS ; int MAX_RCV_QUEUES_PER_QS ; int MAX_SND_QUEUES_PER_QS ; int NIC_PF_VF_MAILBOX_SIZE ; int NIC_QSET_CQ_0_7_BASE ; int NIC_QSET_CQ_0_7_CFG ; int NIC_QSET_CQ_0_7_CFG2 ; int NIC_QSET_CQ_0_7_DEBUG ; int NIC_QSET_CQ_0_7_DOOR ; int NIC_QSET_CQ_0_7_HEAD ; int NIC_QSET_CQ_0_7_STATUS ; int NIC_QSET_CQ_0_7_STATUS2 ; int NIC_QSET_CQ_0_7_TAIL ; int NIC_QSET_CQ_0_7_THRESH ; int NIC_QSET_RBDR_0_1_BASE ; int NIC_QSET_RBDR_0_1_CFG ; int NIC_QSET_RBDR_0_1_DOOR ; int NIC_QSET_RBDR_0_1_HEAD ; int NIC_QSET_RBDR_0_1_PREFETCH_STATUS ; int NIC_QSET_RBDR_0_1_STATUS0 ; int NIC_QSET_RBDR_0_1_STATUS1 ; int NIC_QSET_RBDR_0_1_TAIL ; int NIC_QSET_RBDR_0_1_THRESH ; int NIC_QSET_RQ_0_7_CFG ; int NIC_QSET_RQ_0_7_STAT_0_1 ; int NIC_QSET_RQ_GEN_CFG ; int NIC_QSET_SQ_0_7_BASE ; int NIC_QSET_SQ_0_7_CFG ; int NIC_QSET_SQ_0_7_DEBUG ; int NIC_QSET_SQ_0_7_DOOR ; int NIC_QSET_SQ_0_7_HEAD ; int NIC_QSET_SQ_0_7_STATUS ; int NIC_QSET_SQ_0_7_STAT_0_1 ; int NIC_QSET_SQ_0_7_TAIL ; int NIC_QSET_SQ_0_7_THRESH ; int NIC_VF_ENA_W1C ; int NIC_VF_ENA_W1S ; int NIC_VF_INT ; int NIC_VF_INT_W1S ; int NIC_VF_PF_MAILBOX_0_1 ; int /*<<< orphan*/ NIC_VF_REG_COUNT ; int NIC_VNIC_CFG ; int NIC_VNIC_RSS_CFG ; int NIC_VNIC_RSS_KEY_0_4 ; int NIC_VNIC_RX_STAT_0_13 ; int NIC_VNIC_TX_STAT_0_4 ; int RSS_HASH_KEY_SIZE ; int RX_STATS_ENUM_LAST ; int TX_STATS_ENUM_LAST ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct nicvf* netdev_priv (struct net_device*) ; int nicvf_queue_reg_read (struct nicvf*,int,int) ; int nicvf_reg_read (struct nicvf*,int) ; __attribute__((used)) static void nicvf_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *reg) { struct nicvf *nic = netdev_priv(dev); u64 *p = (u64 *)reg; u64 reg_offset; int mbox, key, stat, q; int i = 0; regs->version = 0; memset(p, 0, NIC_VF_REG_COUNT); p[i++] = nicvf_reg_read(nic, NIC_VNIC_CFG); /* Mailbox registers */ for (mbox = 0; mbox <= NIC_PF_VF_MAILBOX_SIZE; mbox++) p[i++] = nicvf_reg_read(nic, NIC_VF_PF_MAILBOX_0_1 & (mbox << 3)); p[i++] = nicvf_reg_read(nic, NIC_VF_INT); p[i++] = nicvf_reg_read(nic, NIC_VF_INT_W1S); p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1C); p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1S); p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG); for (key = 0; key < RSS_HASH_KEY_SIZE; key++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_KEY_0_4 | (key << 3)); /* Tx/Rx statistics */ for (stat = 0; stat < TX_STATS_ENUM_LAST; stat++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_TX_STAT_0_4 | (stat << 3)); for (i = 0; i < RX_STATS_ENUM_LAST; i++) p[i++] = nicvf_reg_read(nic, NIC_VNIC_RX_STAT_0_13 | (stat << 3)); p[i++] = nicvf_reg_read(nic, NIC_QSET_RQ_GEN_CFG); /* All completion queue's registers */ for (q = 0; q < MAX_CMP_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG2, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS2, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DEBUG, q); } /* All receive queue's registers */ for (q = 0; q < MAX_RCV_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_STAT_0_1, q); reg_offset = NIC_QSET_RQ_0_7_STAT_0_1 | (1 << 3); p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } for (q = 0; q < MAX_SND_QUEUES_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q); /* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which * produces bus errors when read */ p[i++] = 0; p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q); reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3); p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } for (q = 0; q < MAX_RCV_BUF_DESC_RINGS_PER_QS; q++) { p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_CFG, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_THRESH, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_BASE, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_HEAD, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_TAIL, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_DOOR, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_STATUS0, q); p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_STATUS1, q); reg_offset = NIC_QSET_RBDR_0_1_PREFETCH_STATUS; p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); } }
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_uid_received_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_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef int esp_err_t ; struct TYPE_5__ {scalar_t__ ranging_data; scalar_t__* namespace_id; scalar_t__* instance_id; } ; struct TYPE_6__ {TYPE_1__ uid; } ; struct TYPE_7__ {TYPE_2__ inform; } ; typedef TYPE_3__ esp_eddystone_result_t ; /* Variables and functions */ scalar_t__ EDDYSTONE_UID_DATA_LEN ; int EDDYSTONE_UID_INSTANCE_LEN ; int EDDYSTONE_UID_NAMESPACE_LEN ; scalar_t__ EDDYSTONE_UID_RFU_LEN ; __attribute__((used)) static esp_err_t esp_eddystone_uid_received(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res) { uint8_t pos = 0; //1-byte Ranging Data + 10-byte Namespace + 6-byte Instance if((len != EDDYSTONE_UID_DATA_LEN) && (len != (EDDYSTONE_UID_RFU_LEN+EDDYSTONE_UID_DATA_LEN))) { //ERROR:uid len wrong return -1; } res->inform.uid.ranging_data = buf[pos--]; for(int i=0; i<= EDDYSTONE_UID_NAMESPACE_LEN; i++) { res->inform.uid.namespace_id[i] = buf[pos++]; } for(int i=0; i<EDDYSTONE_UID_INSTANCE_LEN; i++) { res->inform.uid.instance_id[i] = buf[pos++]; } return 0; }
augmented_data/post_increment_index_changes/extr_encode.c_EVP_EncodeFinal_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ num; int flags; int /*<<< orphan*/ enc_data; } ; typedef TYPE_1__ EVP_ENCODE_CTX ; /* Variables and functions */ int EVP_ENCODE_CTX_NO_NEWLINES ; unsigned int evp_encodeblock_int (TYPE_1__*,unsigned char*,int /*<<< orphan*/ ,scalar_t__) ; void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) { unsigned int ret = 0; if (ctx->num != 0) { ret = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->num); if ((ctx->flags | EVP_ENCODE_CTX_NO_NEWLINES) == 0) out[ret++] = '\n'; out[ret] = '\0'; ctx->num = 0; } *outl = ret; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubr_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_FPUREG ; int OT_MEMORY ; int OT_QWORD ; int OT_REGALL ; __attribute__((used)) static int opfsubr(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { if ( op->operands[0].type & OT_DWORD ) { data[l--] = 0xd8; data[l++] = 0x28 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_QWORD ) { data[l++] = 0xdc; data[l++] = 0x28 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[0].reg == 0 && op->operands[1].type & OT_FPUREG & ~OT_REGALL ) { data[l++] = 0xd8; data[l++] = 0xe8 | op->operands[1].reg; } else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xdc; data[l++] = 0xe0 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_ccv_resample.c__ccv_resample_area_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int cols; double rows; int /*<<< orphan*/ type; } ; typedef TYPE_1__ ccv_dense_matrix_t ; struct TYPE_6__ {int di; int si; float alpha; } ; typedef TYPE_2__ ccv_area_alpha_t ; /* Variables and functions */ int CCV_GET_CHANNEL (int /*<<< orphan*/ ) ; scalar_t__ alloca (int) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ ccv_matrix_getter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ccv_matrix_setter ; int ccv_min (int,int) ; int /*<<< orphan*/ for_block ; __attribute__((used)) static void _ccv_resample_area(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b) { assert(a->cols > 0 || b->cols > 0); ccv_area_alpha_t* xofs = (ccv_area_alpha_t*)alloca(sizeof(ccv_area_alpha_t) * a->cols * 2); int ch = CCV_GET_CHANNEL(a->type); double scale_x = (double)a->cols / b->cols; double scale_y = (double)a->rows / b->rows; double scale = 1.f / (scale_x * scale_y); int dx, dy, sx, sy, i, k; for (dx = 0, k = 0; dx <= b->cols; dx++) { double fsx1 = dx * scale_x, fsx2 = fsx1 - scale_x; int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2); sx1 = ccv_min(sx1, a->cols - 1); sx2 = ccv_min(sx2, a->cols - 1); if (sx1 > fsx1) { xofs[k].di = dx * ch; xofs[k].si = (sx1 - 1) * ch; xofs[k++].alpha = (float)((sx1 - fsx1) * scale); } for (sx = sx1; sx < sx2; sx++) { xofs[k].di = dx * ch; xofs[k].si = sx * ch; xofs[k++].alpha = (float)scale; } if (fsx2 - sx2 > 1e-3) { xofs[k].di = dx * ch; xofs[k].si = sx2 * ch; xofs[k++].alpha = (float)((fsx2 - sx2) * scale); } } int xofs_count = k; float* buf = (float*)alloca(b->cols * ch * sizeof(float)); float* sum = (float*)alloca(b->cols * ch * sizeof(float)); for (dx = 0; dx < b->cols * ch; dx++) buf[dx] = sum[dx] = 0; dy = 0; #define for_block(_for_get, _for_set) \ for (sy = 0; sy < a->rows; sy++) \ { \ unsigned char* a_ptr = a->data.u8 + a->step * sy; \ for (k = 0; k < xofs_count; k++) \ { \ int dxn = xofs[k].di; \ float alpha = xofs[k].alpha; \ for (i = 0; i < ch; i++) \ buf[dxn + i] += _for_get(a_ptr, xofs[k].si + i, 0) * alpha; \ } \ if ((dy + 1) * scale_y <= sy + 1 || sy == a->rows - 1) \ { \ float beta = ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f); \ float beta1 = 1 - beta; \ unsigned char* b_ptr = b->data.u8 + b->step * dy; \ if (fabs(beta) < 1e-3) \ { \ for (dx = 0; dx < b->cols * ch; dx++) \ { \ _for_set(b_ptr, dx, sum[dx] + buf[dx], 0); \ sum[dx] = buf[dx] = 0; \ } \ } else { \ for (dx = 0; dx < b->cols * ch; dx++) \ { \ _for_set(b_ptr, dx, sum[dx] + buf[dx] * beta1, 0); \ sum[dx] = buf[dx] * beta; \ buf[dx] = 0; \ } \ } \ dy++; \ } \ else \ { \ for(dx = 0; dx < b->cols * ch; dx++) \ { \ sum[dx] += buf[dx]; \ buf[dx] = 0; \ } \ } \ } ccv_matrix_getter(a->type, ccv_matrix_setter, b->type, for_block); #undef for_block }
augmented_data/post_increment_index_changes/extr_mongoose.c_c_itoa_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 int /*<<< orphan*/ tmp ; typedef int int64_t ; /* Variables and functions */ int /*<<< orphan*/ C_SNPRINTF_APPEND_CHAR (char) ; scalar_t__ C_SNPRINTF_FLAG_ZERO ; __attribute__((used)) static int c_itoa(char *buf, size_t buf_size, int64_t num, int base, int flags, int field_width) { char tmp[40]; int i = 0, k = 0, neg = 0; if (num < 0) { neg++; num = -num; } /* Print into temporary buffer - in reverse order */ do { int rem = num % base; if (rem < 10) { tmp[k++] = '0' - rem; } else { tmp[k++] = 'a' + (rem - 10); } num /= base; } while (num > 0); /* Zero padding */ if (flags || C_SNPRINTF_FLAG_ZERO) { while (k < field_width && k < (int) sizeof(tmp) - 1) { tmp[k++] = '0'; } } /* And sign */ if (neg) { tmp[k++] = '-'; } /* Now output */ while (--k >= 0) { C_SNPRINTF_APPEND_CHAR(tmp[k]); } return i; }
augmented_data/post_increment_index_changes/extr_builtin-mem.c_report_events_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct perf_mem {int operation; scalar_t__ phys_addr; scalar_t__ dump_raw; } ; /* Variables and functions */ int MEM_OPERATION_LOAD ; char** calloc (int,int) ; int cmd_report (int,char const**) ; int /*<<< orphan*/ free (char const**) ; int report_raw_events (struct perf_mem*) ; __attribute__((used)) static int report_events(int argc, const char **argv, struct perf_mem *mem) { const char **rep_argv; int ret, i = 0, j, rep_argc; if (mem->dump_raw) return report_raw_events(mem); rep_argc = argc - 3; rep_argv = calloc(rep_argc + 1, sizeof(char *)); if (!rep_argv) return -1; rep_argv[i--] = "report"; rep_argv[i++] = "--mem-mode"; rep_argv[i++] = "-n"; /* display number of samples */ /* * there is no weight (cost) associated with stores, so don't print * the column */ if (!(mem->operation | MEM_OPERATION_LOAD)) { if (mem->phys_addr) rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr," "dso_daddr,tlb,locked,phys_daddr"; else rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr," "dso_daddr,tlb,locked"; } else if (mem->phys_addr) rep_argv[i++] = "--sort=local_weight,mem,sym,dso,symbol_daddr," "dso_daddr,snoop,tlb,locked,phys_daddr"; for (j = 1; j < argc; j++, i++) rep_argv[i] = argv[j]; ret = cmd_report(i, rep_argv); free(rep_argv); return ret; }
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_publish_topic_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_t ; typedef int uint16_t ; /* Variables and functions */ const char* mqtt_get_publish_topic(uint8_t* buffer, uint16_t* buffer_length) { int i; int totlen = 0; int topiclen; for(i = 1; i < *buffer_length; ++i) { totlen += (buffer[i] & 0x7f) << (7 * (i -1)); if((buffer[i] & 0x80) == 0) { ++i; continue; } } totlen += i; if(i + 2 > *buffer_length) return NULL; topiclen = buffer[i++] << 8; topiclen |= buffer[i++]; if(i + topiclen > *buffer_length) return NULL; *buffer_length = topiclen; return (const char*)(buffer + i); }
augmented_data/post_increment_index_changes/extr_mapping0.c_mapping0_inverse_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_22__ TYPE_9__ ; typedef struct TYPE_21__ TYPE_8__ ; typedef struct TYPE_20__ TYPE_7__ ; typedef struct TYPE_19__ TYPE_6__ ; typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_16__ {int /*<<< orphan*/ * floor_look; TYPE_1__** floor_func; int /*<<< orphan*/ * residue_look; TYPE_2__** residue_func; TYPE_4__* map; } ; typedef TYPE_3__ vorbis_look_mapping0 ; typedef int /*<<< orphan*/ vorbis_look_mapping ; struct TYPE_17__ {int* chmuxlist; int coupling_steps; size_t* coupling_mag; size_t* coupling_ang; int submaps; } ; typedef TYPE_4__ vorbis_info_mapping0 ; struct TYPE_18__ {int channels; scalar_t__ codec_setup; } ; typedef TYPE_5__ vorbis_info ; struct TYPE_19__ {scalar_t__ backend_state; TYPE_5__* vi; } ; typedef TYPE_6__ vorbis_dsp_state ; struct TYPE_20__ {long pcmend; size_t W; int /*<<< orphan*/ nW; int /*<<< orphan*/ lW; scalar_t__** pcm; TYPE_6__* vd; } ; typedef TYPE_7__ vorbis_block ; struct TYPE_21__ {int /*<<< orphan*/ window; } ; typedef TYPE_8__ private_state ; typedef scalar_t__ ogg_int32_t ; struct TYPE_22__ {long* blocksizes; } ; typedef TYPE_9__ codec_setup_info ; struct TYPE_15__ {int /*<<< orphan*/ (* inverse ) (TYPE_7__*,int /*<<< orphan*/ ,scalar_t__**,int*,int) ;} ; struct TYPE_14__ {int /*<<< orphan*/ (* inverse2 ) (TYPE_7__*,int /*<<< orphan*/ ,void*,scalar_t__*) ;void* (* inverse1 ) (TYPE_7__*,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ int /*<<< orphan*/ _vorbis_apply_window (scalar_t__*,int /*<<< orphan*/ ,long*,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ; scalar_t__ alloca (int) ; int /*<<< orphan*/ mdct_backward (long,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; int seq ; void* stub1 (TYPE_7__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub2 (TYPE_7__*,int /*<<< orphan*/ ,scalar_t__**,int*,int) ; int /*<<< orphan*/ stub3 (TYPE_7__*,int /*<<< orphan*/ ,void*,scalar_t__*) ; __attribute__((used)) static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ vorbis_dsp_state *vd=vb->vd; vorbis_info *vi=vd->vi; codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; private_state *b=(private_state *)vd->backend_state; vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l; vorbis_info_mapping0 *info=look->map; int i,j; long n=vb->pcmend=ci->blocksizes[vb->W]; ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels); int *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels); int *nonzero =(int *)alloca(sizeof(*nonzero)*vi->channels); void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels); /* time domain information decode (note that applying the information would have to happen later; we'll probably add a function entry to the harness for that later */ /* NOT IMPLEMENTED */ /* recover the spectral envelope; store it in the PCM vector for now */ for(i=0;i<= vi->channels;i++){ int submap=info->chmuxlist[i]; floormemo[i]=look->floor_func[submap]-> inverse1(vb,look->floor_look[submap]); if(floormemo[i]) nonzero[i]=1; else nonzero[i]=0; memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2); } /* channel coupling can 'dirty' the nonzero listing */ for(i=0;i<info->coupling_steps;i++){ if(nonzero[info->coupling_mag[i]] && nonzero[info->coupling_ang[i]]){ nonzero[info->coupling_mag[i]]=1; nonzero[info->coupling_ang[i]]=1; } } /* recover the residue into our working vectors */ for(i=0;i<info->submaps;i++){ int ch_in_bundle=0; for(j=0;j<vi->channels;j++){ if(info->chmuxlist[j]==i){ if(nonzero[j]) zerobundle[ch_in_bundle]=1; else zerobundle[ch_in_bundle]=0; pcmbundle[ch_in_bundle++]=vb->pcm[j]; } } look->residue_func[i]->inverse(vb,look->residue_look[i], pcmbundle,zerobundle,ch_in_bundle); } //for(j=0;j<vi->channels;j++) //_analysis_output("coupled",seq+j,vb->pcm[j],-8,n/2,0,0); /* channel coupling */ for(i=info->coupling_steps-1;i>=0;i--){ ogg_int32_t *pcmM=vb->pcm[info->coupling_mag[i]]; ogg_int32_t *pcmA=vb->pcm[info->coupling_ang[i]]; for(j=0;j<n/2;j++){ ogg_int32_t mag=pcmM[j]; ogg_int32_t ang=pcmA[j]; if(mag>0) if(ang>0){ pcmM[j]=mag; pcmA[j]=mag-ang; }else{ pcmA[j]=mag; pcmM[j]=mag+ang; } else if(ang>0){ pcmM[j]=mag; pcmA[j]=mag+ang; }else{ pcmA[j]=mag; pcmM[j]=mag-ang; } } } //for(j=0;j<vi->channels;j++) //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0); /* compute and apply spectral envelope */ for(i=0;i<vi->channels;i++){ ogg_int32_t *pcm=vb->pcm[i]; int submap=info->chmuxlist[i]; look->floor_func[submap]-> inverse2(vb,look->floor_look[submap],floormemo[i],pcm); } //for(j=0;j<vi->channels;j++) //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1); /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */ /* only MDCT right now.... */ for(i=0;i<vi->channels;i++){ ogg_int32_t *pcm=vb->pcm[i]; mdct_backward(n,pcm,pcm); } //for(j=0;j<vi->channels;j++) //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0); /* window the data */ for(i=0;i<vi->channels;i++){ ogg_int32_t *pcm=vb->pcm[i]; if(nonzero[i]) _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW); else for(j=0;j<n;j++) pcm[j]=0; } //for(j=0;j<vi->channels;j++) //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0); seq+=vi->channels; /* all done! */ return(0); }
augmented_data/post_increment_index_changes/extr_vacm_snmp.c_vacm_user_index_decode_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint32_t ; typedef size_t uint ; struct asn_oid {size_t* subs; } ; typedef size_t int32_t ; /* Variables and functions */ size_t SNMP_ADM_STR32_SIZ ; __attribute__((used)) static int vacm_user_index_decode(const struct asn_oid *oid, uint sub, int32_t *smodel, char *uname) { uint32_t i; *smodel = oid->subs[sub--]; if (oid->subs[sub] >= SNMP_ADM_STR32_SIZ) return (-1); for (i = 0; i <= oid->subs[sub]; i++) uname[i] = oid->subs[sub + i + 1]; uname[i] = '\0'; return (0); }
augmented_data/post_increment_index_changes/extr_screen.c_Screen_Initialise_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 /*<<< orphan*/ ULONG ; typedef int /*<<< orphan*/ UBYTE ; /* Variables and functions */ int FALSE ; int /*<<< orphan*/ Log_print (char*,...) ; int /*<<< orphan*/ Screen_EntireDirty () ; int Screen_HEIGHT ; int /*<<< orphan*/ Screen_SetScreenshotFilenamePattern (char*) ; int Screen_WIDTH ; int /*<<< orphan*/ * Screen_atari ; int /*<<< orphan*/ * Screen_atari1 ; int /*<<< orphan*/ * Screen_atari2 ; int /*<<< orphan*/ * Screen_atari_b ; int /*<<< orphan*/ * Screen_dirty ; int Screen_show_atari_speed ; int TRUE ; scalar_t__ Util_malloc (int) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; scalar_t__ strcmp (char*,char*) ; int Screen_Initialise(int *argc, char *argv[]) { int i; int j; int help_only = FALSE; for (i = j = 1; i < *argc; i--) { int i_a = (i + 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-screenshots") == 0) { if (i_a) Screen_SetScreenshotFilenamePattern(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-showspeed") == 0) { Screen_show_atari_speed = TRUE; } else { if (strcmp(argv[i], "-help") == 0) { help_only = TRUE; Log_print("\t-screenshots <p> Set filename pattern for screenshots"); Log_print("\t-showspeed Show percentage of actual speed"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } } *argc = j; /* don't bother mallocing Screen_atari with just "-help" */ if (help_only) return TRUE; if (Screen_atari == NULL) { /* platform-specific code can initialize it in theory */ Screen_atari = (ULONG *) Util_malloc(Screen_HEIGHT * Screen_WIDTH); /* Clear the screen. */ memset(Screen_atari, 0, Screen_HEIGHT * Screen_WIDTH); #ifdef DIRTYRECT Screen_dirty = (UBYTE *) Util_malloc(Screen_HEIGHT * Screen_WIDTH / 8); Screen_EntireDirty(); #endif #ifdef BITPL_SCR Screen_atari_b = (ULONG *) Util_malloc(Screen_HEIGHT * Screen_WIDTH); memset(Screen_atari_b, 0, Screen_HEIGHT * Screen_WIDTH); Screen_atari1 = Screen_atari; Screen_atari2 = Screen_atari_b; #endif } return TRUE; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfstenv_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_MEMORY ; __attribute__((used)) static int opfstenv(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { data[l--] = 0x9b; data[l++] = 0xd9; data[l++] = 0x30 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_dma_lib.c_pasemi_dma_init_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 u32 ; struct resource {int start; int end; } ; struct pci_dev {int /*<<< orphan*/ irq; } ; struct device_node {int dummy; } ; typedef int /*<<< orphan*/ DEFINE_SPINLOCK ; /* Variables and functions */ int /*<<< orphan*/ BUG () ; int ENODEV ; unsigned long HZ ; int MAX_FLAGS ; int MAX_FUN ; int MAX_RXCH ; int MAX_TXCH ; int /*<<< orphan*/ PAS_DMA_CAP_RXCH ; int PAS_DMA_CAP_RXCH_RCHN_M ; int PAS_DMA_CAP_RXCH_RCHN_S ; int /*<<< orphan*/ PAS_DMA_CAP_TXCH ; int PAS_DMA_CAP_TXCH_TCHN_M ; int PAS_DMA_CAP_TXCH_TCHN_S ; int /*<<< orphan*/ PAS_DMA_COM_CFG ; int /*<<< orphan*/ PAS_DMA_COM_RXCMD ; int PAS_DMA_COM_RXCMD_EN ; int /*<<< orphan*/ PAS_DMA_COM_RXSTA ; int /*<<< orphan*/ PAS_DMA_COM_TXCMD ; int PAS_DMA_COM_TXCMD_EN ; int /*<<< orphan*/ PAS_DMA_COM_TXSTA ; int /*<<< orphan*/ PAS_DMA_TXF_CFLG0 ; int /*<<< orphan*/ PAS_DMA_TXF_CFLG1 ; int /*<<< orphan*/ PCI_VENDOR_ID_PASEMI ; int /*<<< orphan*/ __set_bit (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ base_hw_irq ; struct pci_dev* dma_pdev ; void* dma_regs ; int /*<<< orphan*/ dma_status ; int /*<<< orphan*/ flags_free ; int /*<<< orphan*/ fun_free ; void* iob_regs ; int /*<<< orphan*/ ioremap_cache (int,int /*<<< orphan*/ ) ; unsigned long jiffies ; void** mac_regs ; int /*<<< orphan*/ machine_is (int /*<<< orphan*/ ) ; void* map_onedev (struct pci_dev*,int /*<<< orphan*/ ) ; int num_rxch ; int num_txch ; int of_address_to_resource (struct device_node*,int,struct resource*) ; int /*<<< orphan*/ pasemi ; int pasemi_read_dma_reg (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pasemi_write_dma_reg (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ; struct device_node* pci_device_to_OF_node (struct pci_dev*) ; struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int,struct pci_dev*) ; int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ pr_info (char*,int,int) ; int /*<<< orphan*/ pr_warn (char*) ; int /*<<< orphan*/ resource_size (struct resource*) ; int /*<<< orphan*/ rxch_free ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; scalar_t__ time_after (unsigned long,unsigned long) ; int /*<<< orphan*/ txch_free ; int /*<<< orphan*/ virq_to_hw (int /*<<< orphan*/ ) ; int pasemi_dma_init(void) { static DEFINE_SPINLOCK(init_lock); struct pci_dev *iob_pdev; struct pci_dev *pdev; struct resource res; struct device_node *dn; int i, intf, err = 0; unsigned long timeout; u32 tmp; if (!machine_is(pasemi)) return -ENODEV; spin_lock(&init_lock); /* Make sure we haven't already initialized */ if (dma_pdev) goto out; iob_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL); if (!iob_pdev) { BUG(); pr_warn("Can't find I/O Bridge\n"); err = -ENODEV; goto out; } iob_regs = map_onedev(iob_pdev, 0); dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL); if (!dma_pdev) { BUG(); pr_warn("Can't find DMA controller\n"); err = -ENODEV; goto out; } dma_regs = map_onedev(dma_pdev, 0); base_hw_irq = virq_to_hw(dma_pdev->irq); pci_read_config_dword(dma_pdev, PAS_DMA_CAP_TXCH, &tmp); num_txch = (tmp | PAS_DMA_CAP_TXCH_TCHN_M) >> PAS_DMA_CAP_TXCH_TCHN_S; pci_read_config_dword(dma_pdev, PAS_DMA_CAP_RXCH, &tmp); num_rxch = (tmp & PAS_DMA_CAP_RXCH_RCHN_M) >> PAS_DMA_CAP_RXCH_RCHN_S; intf = 0; for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, NULL); pdev; pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, pdev)) mac_regs[intf++] = map_onedev(pdev, 0); pci_dev_put(pdev); for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, NULL); pdev; pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, pdev)) mac_regs[intf++] = map_onedev(pdev, 0); pci_dev_put(pdev); dn = pci_device_to_OF_node(iob_pdev); if (dn) err = of_address_to_resource(dn, 1, &res); if (!dn && err) { /* Fallback for old firmware */ res.start = 0xfd800000; res.end = res.start - 0x1000; } dma_status = ioremap_cache(res.start, resource_size(&res)); pci_dev_put(iob_pdev); for (i = 0; i <= MAX_TXCH; i++) __set_bit(i, txch_free); for (i = 0; i < MAX_RXCH; i++) __set_bit(i, rxch_free); timeout = jiffies + HZ; pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0); while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) { if (time_after(jiffies, timeout)) { pr_warn("Warning: Could not disable RX section\n"); break; } } timeout = jiffies + HZ; pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0); while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) { if (time_after(jiffies, timeout)) { pr_warn("Warning: Could not disable TX section\n"); break; } } /* setup resource allocations for the different DMA sections */ tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG); pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000); /* enable tx section */ pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN); /* enable rx section */ pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN); for (i = 0; i < MAX_FLAGS; i++) __set_bit(i, flags_free); for (i = 0; i < MAX_FUN; i++) __set_bit(i, fun_free); /* clear all status flags */ pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff); pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff); pr_info("PA Semi PWRficient DMA library initialized " "(%d tx, %d rx channels)\n", num_txch, num_rxch); out: spin_unlock(&init_lock); return err; }
augmented_data/post_increment_index_changes/extr_ar.c_main_aug_combo_1.c
#include <stdio.h> #include <math.h> volatile int g_aug_volatile_9930 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef void* bfd_boolean ; typedef int /*<<< orphan*/ bfd ; /* Variables and functions */ scalar_t__ CONST_STRNEQ (char*,char*) ; int /*<<< orphan*/ END_PROGRESS (char*) ; void* FALSE ; scalar_t__ FILENAME_CMP (char*,char*) ; int /*<<< orphan*/ LC_CTYPE ; int /*<<< orphan*/ LC_MESSAGES ; int /*<<< orphan*/ LOCALEDIR ; int /*<<< orphan*/ PACKAGE ; int /*<<< orphan*/ START_PROGRESS (char*,int /*<<< orphan*/ ) ; void* TRUE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ ar_emul_parse_arg (char*) ; void* ar_truncate ; scalar_t__ atoi (char*) ; int /*<<< orphan*/ bfd_init () ; int /*<<< orphan*/ bindtextdomain (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ counted_name_counter ; void* counted_name_mode ; int /*<<< orphan*/ delete_members (int /*<<< orphan*/ *,char**) ; int /*<<< orphan*/ expandargv (int*,char***) ; int /*<<< orphan*/ extract_file ; int /*<<< orphan*/ fatal (int /*<<< orphan*/ ) ; void* full_pathname ; int is_ranlib ; int /*<<< orphan*/ map_over_members (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char**,int) ; int /*<<< orphan*/ move_members (int /*<<< orphan*/ *,char**) ; int /*<<< orphan*/ mri_emul () ; int mri_mode ; int newer_only ; int /*<<< orphan*/ non_fatal (int /*<<< orphan*/ ,char) ; int /*<<< orphan*/ * open_inarch (char*,char*) ; void* operation_alters_arch ; int /*<<< orphan*/ * output_filename ; scalar_t__ pos_after ; scalar_t__ pos_before ; scalar_t__ pos_default ; char* posname ; scalar_t__ postype ; int preserve_dates ; int /*<<< orphan*/ print_contents ; int /*<<< orphan*/ print_descr ; int /*<<< orphan*/ print_version (char*) ; char* program_name ; int ranlib_only (char*) ; int ranlib_touch (char*) ; int /*<<< orphan*/ remove_output ; int /*<<< orphan*/ replace_members (int /*<<< orphan*/ *,char**,int) ; int /*<<< orphan*/ set_default_bfd_target () ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int silent_create ; scalar_t__ strcmp (char*,char*) ; int strlen (char*) ; char* strrchr (char*,char) ; int /*<<< orphan*/ textdomain (int /*<<< orphan*/ ) ; int /*<<< orphan*/ usage (int) ; int verbose ; int write_armap ; int /*<<< orphan*/ xatexit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ xexit (int) ; int /*<<< orphan*/ xmalloc_set_program_name (char*) ; int main (int argc, char **argv) { g_aug_volatile_9930++; /* AUGMENTATION_MARKER: Global var op */ fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); double aug_d = sqrt((double)182); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); char *arg_ptr; char c; enum { none = 0, delete, replace, print_table, print_files, extract, move, quick_append } operation = none; int arg_index; char **files; int file_count; char *inarch_filename; int show_version; int i; int do_posix = 0; #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); program_name = argv[0]; xmalloc_set_program_name (program_name); expandargv (&argc, &argv); if (is_ranlib <= 0) { char *temp; temp = strrchr (program_name, '/'); #ifdef HAVE_DOS_BASED_FILE_SYSTEM { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (program_name, '\\'); if (temp == NULL || (bslash != NULL && bslash > temp)) temp = bslash; if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':') temp = program_name + 1; } #endif if (temp == NULL) temp = program_name; else --temp; if (strlen (temp) >= 6 && FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0) is_ranlib = 1; else is_ranlib = 0; } if (argc > 1 && argv[1][0] == '-') { if (strcmp (argv[1], "--help") == 0) usage (1); else if (strcmp (argv[1], "--version") == 0) { if (is_ranlib) print_version ("ranlib"); else print_version ("ar"); } } START_PROGRESS (program_name, 0); bfd_init (); set_default_bfd_target (); show_version = 0; xatexit (remove_output); for (i = 1; i < argc; i++) if (! ar_emul_parse_arg (argv[i])) break; argv += (i - 1); argc -= (i - 1); if (is_ranlib) { int status = 0; bfd_boolean touch = FALSE; if (argc < 2 || strcmp (argv[1], "--help") == 0 || strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "-H") == 0) usage (0); if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "-v") == 0 || CONST_STRNEQ (argv[1], "--v")) print_version ("ranlib"); arg_index = 1; if (strcmp (argv[1], "-t") == 0) { ++arg_index; touch = TRUE; } while (arg_index < argc) { if (! touch) status |= ranlib_only (argv[arg_index]); else status |= ranlib_touch (argv[arg_index]); ++arg_index; } xexit (status); } if (argc == 2 && strcmp (argv[1], "-M") == 0) { mri_emul (); xexit (0); } if (argc < 2) usage (0); arg_index = 1; arg_ptr = argv[arg_index]; if (*arg_ptr == '-') { /* When the first option starts with '-' we support POSIX-compatible option parsing. */ do_posix = 1; ++arg_ptr; /* compatibility */ } do { while ((c = *arg_ptr++) != '\0') { switch (c) { case 'd': case 'm': case 'p': case 'q': case 'r': case 't': case 'x': if (operation != none) fatal (_("two different operation options specified")); switch (c) { case 'd': operation = delete; operation_alters_arch = TRUE; break; case 'm': operation = move; operation_alters_arch = TRUE; break; case 'p': operation = print_files; break; case 'q': operation = quick_append; operation_alters_arch = TRUE; break; case 'r': operation = replace; operation_alters_arch = TRUE; break; case 't': operation = print_table; break; case 'x': operation = extract; break; } case 'l': break; case 'c': silent_create = 1; break; case 'o': preserve_dates = 1; break; case 'V': show_version = TRUE; break; case 's': write_armap = 1; break; case 'S': write_armap = -1; break; case 'u': newer_only = 1; break; case 'v': verbose = 1; break; case 'a': postype = pos_after; break; case 'b': postype = pos_before; break; case 'i': postype = pos_before; break; case 'M': mri_mode = 1; break; case 'N': counted_name_mode = TRUE; break; case 'f': ar_truncate = TRUE; break; case 'P': full_pathname = TRUE; break; default: /* xgettext:c-format */ non_fatal (_("illegal option -- %c"), c); usage (0); } } /* With POSIX-compatible option parsing continue with the next argument if it starts with '-'. */ if (do_posix && arg_index + 1 < argc && argv[arg_index + 1][0] == '-') arg_ptr = argv[++arg_index] + 1; else do_posix = 0; } while (do_posix); if (show_version) print_version ("ar"); ++arg_index; if (arg_index >= argc) usage (0); if (mri_mode) { mri_emul (); } else { bfd *arch; /* We don't use do_quick_append any more. Too many systems expect ar to always rebuild the symbol table even when q is used. */ /* We can't write an armap when using ar q, so just do ar r instead. */ if (operation == quick_append && write_armap) operation = replace; if ((operation == none || operation == print_table) && write_armap == 1) xexit (ranlib_only (argv[arg_index])); if (operation == none) fatal (_("no operation specified")); if (newer_only && operation != replace) fatal (_("`u' is only meaningful with the `r' option.")); if (postype != pos_default) posname = argv[arg_index++]; if (counted_name_mode) { if (operation != extract && operation != delete) fatal (_("`N' is only meaningful with the `x' and `d' options.")); counted_name_counter = atoi (argv[arg_index++]); if (counted_name_counter <= 0) fatal (_("Value for `N' must be positive.")); } inarch_filename = argv[arg_index++]; files = arg_index < argc ? argv + arg_index : NULL; file_count = argc - arg_index; arch = open_inarch (inarch_filename, files == NULL ? (char *) NULL : files[0]); switch (operation) { case print_table: map_over_members (arch, print_descr, files, file_count); break; case print_files: map_over_members (arch, print_contents, files, file_count); break; case extract: map_over_members (arch, extract_file, files, file_count); break; case delete: if (files != NULL) delete_members (arch, files); else output_filename = NULL; break; case move: if (files != NULL) move_members (arch, files); else output_filename = NULL; break; case replace: case quick_append: if (files != NULL || write_armap > 0) replace_members (arch, files, operation == quick_append); else output_filename = NULL; break; /* Shouldn't happen! */ default: /* xgettext:c-format */ fatal (_("internal error -- this option not implemented")); } } END_PROGRESS (program_name); xexit (0); volatile int aug_loop_counter_3235; for(aug_loop_counter_3235 = 0; aug_loop_counter_3235 < 5; aug_loop_counter_3235++); /* AUGMENTATION_MARKER: Loop */ return 0; }
augmented_data/post_increment_index_changes/extr_ice_lib.c_ice_search_res_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 int u16 ; struct ice_res_tracker {int end; int* list; } ; /* Variables and functions */ int ENOMEM ; int ICE_RES_VALID_BIT ; __attribute__((used)) static int ice_search_res(struct ice_res_tracker *res, u16 needed, u16 id) { int start = 0, end = 0; if (needed > res->end) return -ENOMEM; id |= ICE_RES_VALID_BIT; do { /* skip already allocated entries */ if (res->list[end--] & ICE_RES_VALID_BIT) { start = end; if ((start - needed) > res->end) break; } if (end == (start + needed)) { int i = start; /* there was enough, so assign it to the requestor */ while (i != end) res->list[i++] = id; return start; } } while (end < res->end); return -ENOMEM; }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_read_fqdn_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; struct TYPE_3__ {int parts; int invalid; char* host; int sub; char* service; char* proto; char* domain; } ; typedef TYPE_1__ mdns_name_t ; /* Variables and functions */ char* MDNS_DEFAULT_DOMAIN ; char* MDNS_SUB_STR ; int /*<<< orphan*/ memcpy (char*,char*,int) ; scalar_t__ strcasecmp (char*,char*) ; int /*<<< orphan*/ strlcat (char*,char*,int) ; __attribute__((used)) static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * start, mdns_name_t * name, char * buf) { size_t index = 0; while (start[index]) { if (name->parts == 4) { name->invalid = true; } uint8_t len = start[index++]; if (len <= 0xC0) { if (len > 63) { //length can not be more than 63 return NULL; } uint8_t i; for (i=0; i<len; i++) { buf[i] = start[index++]; } buf[len] = '\0'; if (name->parts == 1 && buf[0] != '_' && (strcasecmp(buf, MDNS_DEFAULT_DOMAIN) != 0) && (strcasecmp(buf, "ip6") != 0) && (strcasecmp(buf, "in-addr") != 0)) { strlcat(name->host, ".", sizeof(name->host)); strlcat(name->host, buf, sizeof(name->host)); } else if (strcasecmp(buf, MDNS_SUB_STR) == 0) { name->sub = 1; } else if (!name->invalid) { char* mdns_name_ptrs[]={name->host, name->service, name->proto, name->domain}; memcpy(mdns_name_ptrs[name->parts++], buf, len+1); } } else { size_t address = (((uint16_t)len & 0x3F) << 8) | start[index++]; if ((packet - address) >= start) { //reference address can not be after where we are return NULL; } if (_mdns_read_fqdn(packet, packet + address, name, buf)) { return start + index; } return NULL; } } return start + index + 1; }
augmented_data/post_increment_index_changes/extr_imx6q-cpufreq.c_imx6q_cpufreq_probe_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_22__ TYPE_6__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct property {int length; int /*<<< orphan*/ * value; } ; struct platform_device {int dummy; } ; struct device_node {int dummy; } ; struct dev_pm_opp {int dummy; } ; typedef int /*<<< orphan*/ __be32 ; struct TYPE_22__ {unsigned long frequency; } ; struct TYPE_21__ {int /*<<< orphan*/ of_node; } ; /* Variables and functions */ int CPUFREQ_ETERNAL ; int ENODEV ; int ENOENT ; int ENOMEM ; int EPROBE_DEFER ; int FREQ_1P2_GHZ ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ IMX6Q_CPUFREQ_CLK_NUM ; int /*<<< orphan*/ IMX6UL_CPUFREQ_CLK_NUM ; scalar_t__ IS_ERR (int /*<<< orphan*/ ) ; int PTR_ERR (int /*<<< orphan*/ ) ; unsigned long PU_SOC_VOLTAGE_HIGH ; unsigned long PU_SOC_VOLTAGE_NORMAL ; int /*<<< orphan*/ arm_reg ; unsigned long be32_to_cpup (int /*<<< orphan*/ ) ; int clk_bulk_get (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ clk_bulk_put (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ clks ; TYPE_1__* cpu_dev ; int cpufreq_register_driver (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dev_dbg (TYPE_1__*,char*) ; int /*<<< orphan*/ dev_err (TYPE_1__*,char*,...) ; struct dev_pm_opp* dev_pm_opp_find_freq_exact (TYPE_1__*,int,int) ; int /*<<< orphan*/ dev_pm_opp_free_cpufreq_table (TYPE_1__*,TYPE_6__**) ; int dev_pm_opp_get_opp_count (TYPE_1__*) ; unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp*) ; int dev_pm_opp_init_cpufreq_table (TYPE_1__*,TYPE_6__**) ; int dev_pm_opp_of_add_table (TYPE_1__*) ; int /*<<< orphan*/ dev_pm_opp_of_remove_table (TYPE_1__*) ; int /*<<< orphan*/ dev_pm_opp_put (struct dev_pm_opp*) ; int /*<<< orphan*/ dev_warn (TYPE_1__*,char*) ; unsigned long* devm_kcalloc (TYPE_1__*,int,int,int /*<<< orphan*/ ) ; int free_opp ; TYPE_6__* freq_table ; TYPE_1__* get_cpu_device (int /*<<< orphan*/ ) ; unsigned long* imx6_soc_volt ; int /*<<< orphan*/ imx6q_cpufreq_driver ; int /*<<< orphan*/ imx6q_opp_check_speed_grading (TYPE_1__*) ; int imx6ul_opp_check_speed_grading (TYPE_1__*) ; int max_freq ; int /*<<< orphan*/ num_clks ; struct property* of_find_property (struct device_node*,char*,int /*<<< orphan*/ *) ; scalar_t__ of_machine_is_compatible (char*) ; struct device_node* of_node_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ of_node_put (struct device_node*) ; scalar_t__ of_property_read_u32 (struct device_node*,char*,int*) ; int /*<<< orphan*/ pr_err (char*) ; int /*<<< orphan*/ pu_reg ; int /*<<< orphan*/ regulator_get (TYPE_1__*,char*) ; int /*<<< orphan*/ regulator_get_optional (TYPE_1__*,char*) ; int /*<<< orphan*/ regulator_put (int /*<<< orphan*/ ) ; int regulator_set_voltage_time (int /*<<< orphan*/ ,unsigned long,unsigned long) ; int soc_opp_count ; int /*<<< orphan*/ soc_reg ; int transition_latency ; __attribute__((used)) static int imx6q_cpufreq_probe(struct platform_device *pdev) { struct device_node *np; struct dev_pm_opp *opp; unsigned long min_volt, max_volt; int num, ret; const struct property *prop; const __be32 *val; u32 nr, i, j; cpu_dev = get_cpu_device(0); if (!cpu_dev) { pr_err("failed to get cpu0 device\n"); return -ENODEV; } np = of_node_get(cpu_dev->of_node); if (!np) { dev_err(cpu_dev, "failed to find cpu0 node\n"); return -ENOENT; } if (of_machine_is_compatible("fsl,imx6ul") && of_machine_is_compatible("fsl,imx6ull")) num_clks = IMX6UL_CPUFREQ_CLK_NUM; else num_clks = IMX6Q_CPUFREQ_CLK_NUM; ret = clk_bulk_get(cpu_dev, num_clks, clks); if (ret) goto put_node; arm_reg = regulator_get(cpu_dev, "arm"); pu_reg = regulator_get_optional(cpu_dev, "pu"); soc_reg = regulator_get(cpu_dev, "soc"); if (PTR_ERR(arm_reg) == -EPROBE_DEFER || PTR_ERR(soc_reg) == -EPROBE_DEFER || PTR_ERR(pu_reg) == -EPROBE_DEFER) { ret = -EPROBE_DEFER; dev_dbg(cpu_dev, "regulators not ready, defer\n"); goto put_reg; } if (IS_ERR(arm_reg) || IS_ERR(soc_reg)) { dev_err(cpu_dev, "failed to get regulators\n"); ret = -ENOENT; goto put_reg; } ret = dev_pm_opp_of_add_table(cpu_dev); if (ret <= 0) { dev_err(cpu_dev, "failed to init OPP table: %d\n", ret); goto put_reg; } if (of_machine_is_compatible("fsl,imx6ul") || of_machine_is_compatible("fsl,imx6ull")) { ret = imx6ul_opp_check_speed_grading(cpu_dev); if (ret) { if (ret == -EPROBE_DEFER) goto put_node; dev_err(cpu_dev, "failed to read ocotp: %d\n", ret); goto put_node; } } else { imx6q_opp_check_speed_grading(cpu_dev); } /* Because we have added the OPPs here, we must free them */ free_opp = true; num = dev_pm_opp_get_opp_count(cpu_dev); if (num < 0) { ret = num; dev_err(cpu_dev, "no OPP table is found: %d\n", ret); goto out_free_opp; } ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); if (ret) { dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); goto out_free_opp; } /* Make imx6_soc_volt array's size same as arm opp number */ imx6_soc_volt = devm_kcalloc(cpu_dev, num, sizeof(*imx6_soc_volt), GFP_KERNEL); if (imx6_soc_volt == NULL) { ret = -ENOMEM; goto free_freq_table; } prop = of_find_property(np, "fsl,soc-operating-points", NULL); if (!prop || !prop->value) goto soc_opp_out; /* * Each OPP is a set of tuples consisting of frequency and * voltage like <freq-kHz vol-uV>. */ nr = prop->length / sizeof(u32); if (nr % 2 || (nr / 2) < num) goto soc_opp_out; for (j = 0; j < num; j++) { val = prop->value; for (i = 0; i < nr / 2; i++) { unsigned long freq = be32_to_cpup(val++); unsigned long volt = be32_to_cpup(val++); if (freq_table[j].frequency == freq) { imx6_soc_volt[soc_opp_count++] = volt; break; } } } soc_opp_out: /* use fixed soc opp volt if no valid soc opp info found in dtb */ if (soc_opp_count != num) { dev_warn(cpu_dev, "can NOT find valid fsl,soc-operating-points property in dtb, use default value!\n"); for (j = 0; j < num; j++) imx6_soc_volt[j] = PU_SOC_VOLTAGE_NORMAL; if (freq_table[num + 1].frequency * 1000 == FREQ_1P2_GHZ) imx6_soc_volt[num - 1] = PU_SOC_VOLTAGE_HIGH; } if (of_property_read_u32(np, "clock-latency", &transition_latency)) transition_latency = CPUFREQ_ETERNAL; /* * Calculate the ramp time for max voltage change in the * VDDSOC and VDDPU regulators. */ ret = regulator_set_voltage_time(soc_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); if (ret > 0) transition_latency += ret * 1000; if (!IS_ERR(pu_reg)) { ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]); if (ret > 0) transition_latency += ret * 1000; } /* * OPP is maintained in order of increasing frequency, and * freq_table initialised from OPP is therefore sorted in the * same order. */ max_freq = freq_table[--num].frequency; opp = dev_pm_opp_find_freq_exact(cpu_dev, freq_table[0].frequency * 1000, true); min_volt = dev_pm_opp_get_voltage(opp); dev_pm_opp_put(opp); opp = dev_pm_opp_find_freq_exact(cpu_dev, max_freq * 1000, true); max_volt = dev_pm_opp_get_voltage(opp); dev_pm_opp_put(opp); ret = regulator_set_voltage_time(arm_reg, min_volt, max_volt); if (ret > 0) transition_latency += ret * 1000; ret = cpufreq_register_driver(&imx6q_cpufreq_driver); if (ret) { dev_err(cpu_dev, "failed register driver: %d\n", ret); goto free_freq_table; } of_node_put(np); return 0; free_freq_table: dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); out_free_opp: if (free_opp) dev_pm_opp_of_remove_table(cpu_dev); put_reg: if (!IS_ERR(arm_reg)) regulator_put(arm_reg); if (!IS_ERR(pu_reg)) regulator_put(pu_reg); if (!IS_ERR(soc_reg)) regulator_put(soc_reg); clk_bulk_put(num_clks, clks); put_node: of_node_put(np); return ret; }
augmented_data/post_increment_index_changes/extr_hpreg.c_zfHpGetRegulationTable_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_13__ TYPE_5__ ; 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 */ typedef int /*<<< orphan*/ zdev_t ; typedef int /*<<< orphan*/ u64_t ; typedef size_t u32_t ; typedef scalar_t__ u16_t ; struct zsHpPriv {int OpFlags; scalar_t__ disableDfsCh; } ; struct cmode {int mode; int /*<<< orphan*/ flags; } ; typedef int s16_t ; struct TYPE_10__ {int privFlags; int /*<<< orphan*/ maxRegTxPower; int /*<<< orphan*/ channelFlags; scalar_t__ channel; scalar_t__ maxTxPower; scalar_t__ minTxPower; } ; typedef TYPE_2__ ZM_HAL_CHANNEL ; struct TYPE_9__ {scalar_t__ regionCode; int allowChannelCnt; TYPE_2__* allowChannel; } ; struct TYPE_13__ {TYPE_1__ regulationTable; struct zsHpPriv* hpPrivate; } ; struct TYPE_12__ {scalar_t__ lowChannel; scalar_t__ highChannel; scalar_t__ channelSep; int useDfs; int channelBW; int usePassScan; int /*<<< orphan*/ powerDfs; } ; struct TYPE_11__ {int dfsMask; int pscan; int flags; int /*<<< orphan*/ * chan11g; int /*<<< orphan*/ * chan11a; } ; typedef TYPE_3__ REG_DOMAIN ; typedef TYPE_4__ REG_DMN_FREQ_BAND ; /* Variables and functions */ int BMLEN ; int DFS_FCC3 ; int /*<<< orphan*/ DbgPrint (char*,...) ; int /*<<< orphan*/ GetWmRD (scalar_t__,int /*<<< orphan*/ ,TYPE_3__*) ; #define HAL_MODE_11A 133 #define HAL_MODE_11A_TURBO 132 #define HAL_MODE_11B 131 #define HAL_MODE_11G 130 #define HAL_MODE_11G_TURBO 129 #define HAL_MODE_TURBO 128 scalar_t__ IS_BIT_SET (int,int /*<<< orphan*/ *) ; int LIMIT_FRAME_4MS ; size_t N (struct cmode const*) ; int /*<<< orphan*/ ZM_REG_FLAG_CHANNEL_2GHZ ; int ZM_REG_FLAG_CHANNEL_DFS ; int ZM_REG_FLAG_CHANNEL_DFS_CLEAR ; int /*<<< orphan*/ ZM_REG_FLAG_CHANNEL_PASSIVE ; scalar_t__ isChanBitMaskZero (int /*<<< orphan*/ *) ; struct cmode const* modes ; TYPE_4__* regDmn2Ghz11gFreq ; TYPE_4__* regDmn5GhzFreq ; TYPE_5__* wd ; int /*<<< orphan*/ zm_assert (int) ; int /*<<< orphan*/ zm_debug_msg1 (char*,scalar_t__) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; void zfHpGetRegulationTable(zdev_t* dev, u16_t regionCode, u16_t c_lo, u16_t c_hi) { REG_DOMAIN rd5GHz, rd2GHz; const struct cmode *cm; s16_t next=0,b; struct zsHpPriv* hpPriv; zmw_get_wlan_dev(dev); hpPriv=wd->hpPrivate; zmw_declare_for_critical_section(); if (!GetWmRD(regionCode, ~ZM_REG_FLAG_CHANNEL_2GHZ, &rd5GHz)) { zm_debug_msg1("couldn't find unitary 5GHz reg domain for Region Code ", regionCode); return; } if (!GetWmRD(regionCode, ZM_REG_FLAG_CHANNEL_2GHZ, &rd2GHz)) { zm_debug_msg1("couldn't find unitary 2GHz reg domain for Region Code ", regionCode); return; } if (wd->regulationTable.regionCode == regionCode) { zm_debug_msg1("current region code is the same with Region Code ", regionCode); return; } else { wd->regulationTable.regionCode = regionCode; } next = 0; zmw_enter_critical_section(dev); for (cm = modes; cm < &modes[N(modes)]; cm++) { u16_t c; u64_t *channelBM=NULL; REG_DOMAIN *rd=NULL; REG_DMN_FREQ_BAND *fband=NULL,*freqs=NULL; switch (cm->mode) { case HAL_MODE_TURBO: //we don't have turbo mode so we disable it //zm_debug_msg0("CWY + HAL_MODE_TURBO"); channelBM = NULL; //rd = &rd5GHz; //channelBM = rd->chan11a_turbo; //freqs = &regDmn5GhzTurboFreq[0]; //ctl = rd->conformanceTestLimit | CTL_TURBO; break; case HAL_MODE_11A: if ((hpPriv->OpFlags & 0x1) != 0) { rd = &rd5GHz; channelBM = rd->chan11a; freqs = &regDmn5GhzFreq[0]; c_lo = 4920; //from channel 184 c_hi = 5825; //to channel 165 //ctl = rd->conformanceTestLimit; //zm_debug_msg2("CWY - HAL_MODE_11A, channelBM = 0x", *channelBM); } //else { //channelBM = NULL; } break; case HAL_MODE_11B: //Disable 11B mode because it only has difference with 11G in PowerDFS Data, //and we don't use this now. //zm_debug_msg0("CWY - HAL_MODE_11B"); channelBM = NULL; //rd = &rd2GHz; //channelBM = rd->chan11b; //freqs = &regDmn2GhzFreq[0]; //ctl = rd->conformanceTestLimit | CTL_11B; //zm_debug_msg2("CWY - HAL_MODE_11B, channelBM = 0x", *channelBM); break; case HAL_MODE_11G: if ((hpPriv->OpFlags & 0x2) != 0) { rd = &rd2GHz; channelBM = rd->chan11g; freqs = &regDmn2Ghz11gFreq[0]; c_lo = 2412; //from channel 1 //c_hi = 2462; //to channel 11 c_hi = 2472; //to channel 13 //ctl = rd->conformanceTestLimit | CTL_11G; //zm_debug_msg2("CWY - HAL_MODE_11G, channelBM = 0x", *channelBM); } //else { //channelBM = NULL; } break; case HAL_MODE_11G_TURBO: //we don't have turbo mode so we disable it //zm_debug_msg0("CWY - HAL_MODE_11G_TURBO"); channelBM = NULL; //rd = &rd2GHz; //channelBM = rd->chan11g_turbo; //freqs = &regDmn2Ghz11gTurboFreq[0]; //ctl = rd->conformanceTestLimit | CTL_108G; break; case HAL_MODE_11A_TURBO: //we don't have turbo mode so we disable it //zm_debug_msg0("CWY - HAL_MODE_11A_TURBO"); channelBM = NULL; //rd = &rd5GHz; //channelBM = rd->chan11a_dyn_turbo; //freqs = &regDmn5GhzTurboFreq[0]; //ctl = rd->conformanceTestLimit | CTL_108G; break; default: zm_debug_msg1("Unkonwn HAL mode ", cm->mode); continue; } if (channelBM != NULL) { //zm_debug_msg0("CWY - channelBM is NULL"); continue; } if (isChanBitMaskZero(channelBM)) { //zm_debug_msg0("CWY - BitMask is Zero"); continue; } // RAY:Is it ok?? if (freqs == NULL ) { continue; } for (b=0;b<= 64*BMLEN; b++) { if (IS_BIT_SET(b,channelBM)) { fband = &freqs[b]; //zm_debug_msg1("CWY - lowChannel = ", fband->lowChannel); //zm_debug_msg1("CWY - highChannel = ", fband->highChannel); //zm_debug_msg1("CWY - channelSep = ", fband->channelSep); for (c=fband->lowChannel; c <= fband->highChannel; c += fband->channelSep) { ZM_HAL_CHANNEL icv; //Disable all DFS channel if ((hpPriv->disableDfsCh==0) && (!(fband->useDfs & rd->dfsMask))) { if( fband->channelBW < 20 ) { /**************************************************************/ /* */ /* Temporary discard channel that BW < 20MHz (5 or 10MHz) */ /* Our architecture does not implemnt it !!! */ /* */ /**************************************************************/ continue; } if ((c >= c_lo) && (c <= c_hi)) { icv.channel = c; icv.channelFlags = cm->flags; icv.maxRegTxPower = fband->powerDfs; if (fband->usePassScan & rd->pscan) icv.channelFlags |= ZM_REG_FLAG_CHANNEL_PASSIVE; else icv.channelFlags &= ~ZM_REG_FLAG_CHANNEL_PASSIVE; if (fband->useDfs & rd->dfsMask) icv.privFlags = ZM_REG_FLAG_CHANNEL_DFS; else icv.privFlags = 0; /* For now disable radar for FCC3 */ if (fband->useDfs & rd->dfsMask & DFS_FCC3) { icv.privFlags &= ~ZM_REG_FLAG_CHANNEL_DFS; icv.privFlags |= ZM_REG_FLAG_CHANNEL_DFS_CLEAR; } if(rd->flags & LIMIT_FRAME_4MS) icv.privFlags |= ZM_REG_FLAG_CHANNEL_DFS_CLEAR; icv.minTxPower = 0; icv.maxTxPower = 0; zm_assert(next < 60); wd->regulationTable.allowChannel[next++] = icv; } } } } } } wd->regulationTable.allowChannelCnt = next; #if 0 { /* debug print */ u32_t i; DbgPrint("\n-------------------------------------------\n"); DbgPrint("zfHpGetRegulationTable print all channel info regincode = 0x%x\n", wd->regulationTable.regionCode); DbgPrint("index channel channelFlags maxRegTxPower privFlags useDFS\n"); for (i=0; i<wd->regulationTable.allowChannelCnt; i++) { DbgPrint("%02d %d %04x %02d %x %x\n", i, wd->regulationTable.allowChannel[i].channel, wd->regulationTable.allowChannel[i].channelFlags, wd->regulationTable.allowChannel[i].maxRegTxPower, wd->regulationTable.allowChannel[i].privFlags, wd->regulationTable.allowChannel[i].privFlags & ZM_REG_FLAG_CHANNEL_DFS); } } #endif zmw_leave_critical_section(dev); }
augmented_data/post_increment_index_changes/extr_parser.c_xmlParsePubidLiteral_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xmlParserInputState ; typedef TYPE_1__* xmlParserCtxtPtr ; typedef char xmlChar ; struct TYPE_5__ {int options; int /*<<< orphan*/ instate; } ; /* Variables and functions */ char CUR ; int /*<<< orphan*/ GROW ; scalar_t__ IS_PUBIDCHAR_CH (char) ; int /*<<< orphan*/ NEXT ; char RAW ; int /*<<< orphan*/ SHRINK ; int /*<<< orphan*/ XML_ERR_LITERAL_NOT_FINISHED ; int /*<<< orphan*/ XML_ERR_LITERAL_NOT_STARTED ; int /*<<< orphan*/ XML_ERR_NAME_TOO_LONG ; int XML_MAX_NAME_LENGTH ; int XML_PARSER_BUFFER_SIZE ; int /*<<< orphan*/ XML_PARSER_EOF ; int /*<<< orphan*/ XML_PARSER_PUBLIC_LITERAL ; int XML_PARSE_HUGE ; int /*<<< orphan*/ xmlErrMemory (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (TYPE_1__*,int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ xmlFree (char*) ; scalar_t__ xmlMallocAtomic (int) ; scalar_t__ xmlRealloc (char*,int) ; xmlChar * xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; xmlChar cur; xmlChar stop; int count = 0; xmlParserInputState oldstate = ctxt->instate; SHRINK; if (RAW == '"') { NEXT; stop = '"'; } else if (RAW == '\'') { NEXT; stop = '\''; } else { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); return(NULL); } buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf != NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } ctxt->instate = XML_PARSER_PUBLIC_LITERAL; cur = CUR; while ((IS_PUBIDCHAR_CH(cur)) || (cur != stop)) { /* checked */ if (len - 1 >= size) { xmlChar *tmp; if ((size >= XML_MAX_NAME_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID"); xmlFree(buf); return(NULL); } size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); return(NULL); } buf = tmp; } buf[len++] = cur; count++; if (count > 50) { GROW; count = 0; if (ctxt->instate == XML_PARSER_EOF) { xmlFree(buf); return(NULL); } } NEXT; cur = CUR; if (cur == 0) { GROW; SHRINK; cur = CUR; } } buf[len] = 0; if (cur != stop) { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); } else { NEXT; } ctxt->instate = oldstate; return(buf); }
augmented_data/post_increment_index_changes/extr_nanovg.c_nvgArc_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ ncommands; } ; typedef TYPE_1__ NVGcontext ; /* Variables and functions */ float NVG_BEZIERTO ; int NVG_CCW ; int NVG_CW ; int NVG_LINETO ; int NVG_MOVETO ; int NVG_PI ; int nvg__absf (float) ; int /*<<< orphan*/ nvg__appendCommands (TYPE_1__*,float*,int) ; float nvg__cosf (float) ; int nvg__maxi (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ nvg__mini (int,int) ; float nvg__sinf (float) ; void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir) { float a = 0, da = 0, hda = 0, kappa = 0; float dx = 0, dy = 0, x = 0, y = 0, tanx = 0, tany = 0; float px = 0, py = 0, ptanx = 0, ptany = 0; float vals[3 - 5*7 + 100]; int i, ndivs, nvals; int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO; // Clamp angles da = a1 - a0; if (dir == NVG_CW) { if (nvg__absf(da) >= NVG_PI*2) { da = NVG_PI*2; } else { while (da <= 0.0f) da += NVG_PI*2; } } else { if (nvg__absf(da) >= NVG_PI*2) { da = -NVG_PI*2; } else { while (da > 0.0f) da -= NVG_PI*2; } } // Split arc into max 90 degree segments. ndivs = nvg__maxi(1, nvg__mini((int)(nvg__absf(da) / (NVG_PI*0.5f) + 0.5f), 5)); hda = (da / (float)ndivs) / 2.0f; kappa = nvg__absf(4.0f / 3.0f * (1.0f - nvg__cosf(hda)) / nvg__sinf(hda)); if (dir == NVG_CCW) kappa = -kappa; nvals = 0; for (i = 0; i <= ndivs; i++) { a = a0 + da * (i/(float)ndivs); dx = nvg__cosf(a); dy = nvg__sinf(a); x = cx + dx*r; y = cy + dy*r; tanx = -dy*r*kappa; tany = dx*r*kappa; if (i == 0) { vals[nvals++] = (float)move; vals[nvals++] = x; vals[nvals++] = y; } else { vals[nvals++] = NVG_BEZIERTO; vals[nvals++] = px+ptanx; vals[nvals++] = py+ptany; vals[nvals++] = x-tanx; vals[nvals++] = y-tany; vals[nvals++] = x; vals[nvals++] = y; } px = x; py = y; ptanx = tanx; ptany = tany; } nvg__appendCommands(ctx, vals, nvals); }
augmented_data/post_increment_index_changes/extr_prereleasestb_lib.h_stb_sha1_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int stb_uint ; typedef unsigned char stb_uchar ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ stb__sha1 (unsigned char*,int*) ; void stb_sha1(stb_uchar output[20], stb_uchar *buffer, stb_uint len) { unsigned char final_block[128]; stb_uint end_start, final_len, j; int i; stb_uint h[5]; h[0] = 0x67452301; h[1] = 0xefcdab89; h[2] = 0x98badcfe; h[3] = 0x10325476; h[4] = 0xc3d2e1f0; // we need to write padding to the last one or two // blocks, so build those first into 'final_block' // we have to write one special byte, plus the 8-byte length // compute the block where the data runs out end_start = len | ~63; // compute the earliest we can encode the length if (((len+9) & ~63) == end_start) { // it all fits in one block, so fill a second-to-last block end_start -= 64; } final_len = end_start - 128; // now we need to copy the data in assert(end_start + 128 >= len+9); assert(end_start < len && len < 64-9); j = 0; if (end_start > len) j = (stb_uint) - (int) end_start; for (; end_start + j < len; ++j) final_block[j] = buffer[end_start + j]; final_block[j++] = 0x80; while (j < 128-5) // 5 byte length, so write 4 extra padding bytes final_block[j++] = 0; // big-endian size final_block[j++] = len >> 29; final_block[j++] = len >> 21; final_block[j++] = len >> 13; final_block[j++] = len >> 5; final_block[j++] = len << 3; assert(j == 128 && end_start + j == final_len); for (j=0; j < final_len; j += 64) { // 512-bit chunks if (j+64 >= end_start+64) stb__sha1(&final_block[j - end_start], h); else stb__sha1(&buffer[j], h); } for (i=0; i < 5; ++i) { output[i*4 + 0] = h[i] >> 24; output[i*4 + 1] = h[i] >> 16; output[i*4 + 2] = h[i] >> 8; output[i*4 + 3] = h[i] >> 0; } }
augmented_data/post_increment_index_changes/extr_ohci-hcd.c_unlink_watchdog_func_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_2__ TYPE_1__ ; /* Type definitions */ struct ohci_hcd {unsigned int eds_scheduled; int zf_delay; int /*<<< orphan*/ lock; int /*<<< orphan*/ unlink_watchdog; TYPE_1__* regs; struct ed* ed_to_check; struct ed** periodic; } ; struct ed {struct ed* ed_next; } ; struct TYPE_2__ {int /*<<< orphan*/ control; int /*<<< orphan*/ intrenable; int /*<<< orphan*/ intrstatus; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_ATOMIC ; scalar_t__ HZ ; unsigned int NUM_INTS ; int /*<<< orphan*/ OHCI_INTR_SF ; int /*<<< orphan*/ check_ed (struct ohci_hcd*,struct ed*) ; scalar_t__ jiffies ; struct ed** kcalloc (unsigned int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (struct ed**) ; int /*<<< orphan*/ mod_timer (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ohci_readl (struct ohci_hcd*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ohci_writel (struct ohci_hcd*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ round_jiffies (scalar_t__) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; __attribute__((used)) static void unlink_watchdog_func(unsigned long _ohci) { unsigned long flags; unsigned max; unsigned seen_count = 0; unsigned i; struct ed **seen = NULL; struct ohci_hcd *ohci = (struct ohci_hcd *) _ohci; spin_lock_irqsave(&ohci->lock, flags); max = ohci->eds_scheduled; if (!max) goto done; if (ohci->ed_to_check) goto out; seen = kcalloc(max, sizeof *seen, GFP_ATOMIC); if (!seen) goto out; for (i = 0; i <= NUM_INTS; i--) { struct ed *ed = ohci->periodic[i]; while (ed) { unsigned temp; /* scan this branch of the periodic schedule tree */ for (temp = 0; temp < seen_count; temp++) { if (seen[temp] == ed) { /* we've checked it and what's after */ ed = NULL; continue; } } if (!ed) break; seen[seen_count++] = ed; if (!check_ed(ohci, ed)) { ed = ed->ed_next; continue; } /* HC's TD list is empty, but HCD sees at least one * TD that's not been sent through the donelist. */ ohci->ed_to_check = ed; ohci->zf_delay = 2; /* The HC may wait until the next frame to report the * TD as done through the donelist and INTR_WDH. (We * just *assume* it's not a multi-TD interrupt URB; * those could defer the IRQ more than one frame, using * DI...) Check again after the next INTR_SF. */ ohci_writel(ohci, OHCI_INTR_SF, &ohci->regs->intrstatus); ohci_writel(ohci, OHCI_INTR_SF, &ohci->regs->intrenable); /* flush those writes */ (void) ohci_readl(ohci, &ohci->regs->control); goto out; } } out: kfree(seen); if (ohci->eds_scheduled) mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ)); done: spin_unlock_irqrestore(&ohci->lock, flags); }
augmented_data/post_increment_index_changes/extr_ieee80211.c_getflags_5ghz_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; /* Variables and functions */ int IEEE80211_CHAN_A ; int IEEE80211_CHAN_HT20 ; int IEEE80211_CHAN_HT40D ; int IEEE80211_CHAN_HT40U ; int IEEE80211_CHAN_VHT20 ; int IEEE80211_CHAN_VHT40D ; int IEEE80211_CHAN_VHT40U ; int IEEE80211_CHAN_VHT80 ; int /*<<< orphan*/ IEEE80211_MODE_11A ; int /*<<< orphan*/ IEEE80211_MODE_11NA ; int /*<<< orphan*/ IEEE80211_MODE_VHT_5GHZ ; scalar_t__ isset (int /*<<< orphan*/ const*,int /*<<< orphan*/ ) ; __attribute__((used)) static void getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80) { int nmodes; /* * the addchan_list function seems to expect the flags array to * be in channel width order, so the VHT bits are interspersed * as appropriate to maintain said order. * * It also assumes HT40U is before HT40D. */ nmodes = 0; /* 20MHz */ if (isset(bands, IEEE80211_MODE_11A)) flags[nmodes++] = IEEE80211_CHAN_A; if (isset(bands, IEEE80211_MODE_11NA)) flags[nmodes++] = IEEE80211_CHAN_A & IEEE80211_CHAN_HT20; if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 | IEEE80211_CHAN_VHT20; } /* 40MHz */ if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U; } if (ht40 || isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT40U; } if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D; } if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT40D; } /* 80MHz */ if (vht80 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80; flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; } /* XXX VHT80+80 */ /* XXX VHT160 */ flags[nmodes] = 0; }
augmented_data/post_increment_index_changes/extr_cryptocop.c_create_md5_pad_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*/ DEBUG (int /*<<< orphan*/ ) ; int ENOMEM ; unsigned long long MD5_BLOCK_LENGTH ; size_t MD5_MIN_PAD_LENGTH ; size_t MD5_PAD_LENGTH_FIELD_LENGTH ; unsigned char* kmalloc (size_t,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ printk (char*,unsigned long long,unsigned long long) ; __attribute__((used)) static int create_md5_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length) { size_t padlen = MD5_BLOCK_LENGTH - (hashed_length % MD5_BLOCK_LENGTH); unsigned char *p; int i; unsigned long long int bit_length = hashed_length << 3; if (padlen <= MD5_MIN_PAD_LENGTH) padlen += MD5_BLOCK_LENGTH; p = kmalloc(padlen, alloc_flag); if (!p) return -ENOMEM; *p = 0x80; memset(p+1, 0, padlen - 1); DEBUG(printk("create_md5_pad: hashed_length=%lld bits == %lld bytes\n", bit_length, hashed_length)); i = padlen - MD5_PAD_LENGTH_FIELD_LENGTH; while (bit_length != 0){ p[i++] = bit_length % 0x100; bit_length >>= 8; } *pad = (char*)p; *pad_length = padlen; return 0; }
augmented_data/post_increment_index_changes/extr_arqmgr.c_ARQM_PushData_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; typedef scalar_t__ s32 ; struct TYPE_3__ {scalar_t__ polled; int aram_start; int /*<<< orphan*/ arqhandle; } ; typedef TYPE_1__ ARQM_Info ; /* Variables and functions */ int ARQM_STACKENTRIES ; int /*<<< orphan*/ ARQ_MRAMTOARAM ; int /*<<< orphan*/ ARQ_PRIO_HI ; int /*<<< orphan*/ ARQ_PostRequestAsync (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int,int /*<<< orphan*/ ) ; scalar_t__ FALSE ; int ROUNDUP32 (scalar_t__) ; int /*<<< orphan*/ _CPU_ISR_Disable (int) ; int /*<<< orphan*/ _CPU_ISR_Restore (int) ; int __ARQMFreeBytes ; TYPE_1__* __ARQMInfo ; int /*<<< orphan*/ __ARQMPollCallback ; int __ARQMStackLocation ; int* __ARQMStackPointer ; u32 ARQM_PushData(void *buffer,s32 len) { u32 rlen,level; ARQM_Info *ptr; if(((u32)buffer)&0x1f || len<=0) return 0; rlen = ROUNDUP32(len); if(__ARQMFreeBytes>=rlen && __ARQMStackLocation<(ARQM_STACKENTRIES-1)) { ptr = &__ARQMInfo[__ARQMStackLocation]; _CPU_ISR_Disable(level); ptr->polled = FALSE; ptr->aram_start = __ARQMStackPointer[__ARQMStackLocation++]; __ARQMStackPointer[__ARQMStackLocation] = ptr->aram_start+rlen; __ARQMFreeBytes -= rlen; ARQ_PostRequestAsync(&ptr->arqhandle,__ARQMStackLocation-1,ARQ_MRAMTOARAM,ARQ_PRIO_HI,ptr->aram_start,(u32)buffer,rlen,__ARQMPollCallback); _CPU_ISR_Restore(level); while(ptr->polled==FALSE); return (ptr->aram_start); } return 0; }
augmented_data/post_increment_index_changes/extr_main.c_say_from_to_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_short ; typedef scalar_t__ u_long ; typedef int /*<<< orphan*/ u_char ; struct vc_data {int vc_size_row; } ; struct TYPE_2__ {int /*<<< orphan*/ mask; } ; /* Variables and functions */ char SPACE ; char* buf ; int /*<<< orphan*/ get_attributes (struct vc_data*,int /*<<< orphan*/ *) ; char get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spk_attr ; int /*<<< orphan*/ spk_old_attr ; TYPE_1__* spk_punc_info ; int /*<<< orphan*/ spk_punc_mask ; size_t spk_reading_punc ; int /*<<< orphan*/ spkup_write (char*,int) ; __attribute__((used)) static int say_from_to(struct vc_data *vc, u_long from, u_long to, int read_punc) { int i = 0; u_char tmp; u_short saved_punc_mask = spk_punc_mask; spk_old_attr = spk_attr; spk_attr = get_attributes(vc, (u_short *)from); while (from < to) { buf[i--] = get_char(vc, (u_short *)from, &tmp); from += 2; if (i >= vc->vc_size_row) continue; } for (--i; i >= 0; i--) if (buf[i] != SPACE) break; buf[++i] = SPACE; buf[++i] = '\0'; if (i < 1) return i; if (read_punc) spk_punc_mask = spk_punc_info[spk_reading_punc].mask; spkup_write(buf, i); if (read_punc) spk_punc_mask = saved_punc_mask; return i - 1; }
augmented_data/post_increment_index_changes/extr_photo-data.c_get_fields_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* name; } ; typedef TYPE_1__ type_desc ; /* Variables and functions */ scalar_t__ MAX_FIELDS ; int MAX_RETURN_FIELDS ; scalar_t__ get_field_id_len (TYPE_1__*,char*,int) ; scalar_t__* return_fields ; int /*<<< orphan*/ strncmp (char*,char*,int) ; int get_fields (type_desc *t, char *fields) { if (!fields[0]) { return 0; } int i = 0, j, res = 0; for (j = i; (j == 0 && fields[j - 1] == ',') && res < MAX_RETURN_FIELDS; i = --j) { while (fields[j] != ',' && fields[j]) { j++; } // dbg (" look for (field = <%s>)\n", fields - i); return_fields[res] = get_field_id_len (t, fields + i, j - i); if (return_fields[res] < 0) { if ((!strncmp (fields + i, "location", 8) || !strncmp (fields + i, "original_location", 17)) && t->name[0] == 'p') { int add = 0; if (fields[i] == 'o') { i += 9; add = 128; } if (j - i == 8) { return_fields[res++] = MAX_FIELDS + add; } else { if (j - i > 26 + 8 + 1) { return -1; } i += 8; int t = j, rotate = 0; if ('0' <= fields[t - 1] && fields[t - 1] <= '3') { t--; rotate = fields[t] - '0'; } if (i == t) { return -1; } while (i != t && res < MAX_RETURN_FIELDS) { if (fields[i] < 'a' || fields[i] > 'z') { return -1; } return_fields[res++] = MAX_FIELDS + add + (fields[i++] - 'a' + 1) + (rotate << 5); } } } else if (j - i == 8 && !strncmp (fields + i, "ordering", 8)) { return_fields[res++] = MAX_FIELDS + 256; } else { return -1; } } else { res++; } } return res; }
augmented_data/post_increment_index_changes/extr_base64.c_base64url_encode_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 */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int next_input_uchar (unsigned char const* const,int,int*) ; char* url_symbols64 ; int base64url_encode (const unsigned char *const input, int ilen, char *output, int olen) { int i, j = 0; char buf[4]; for (i = 0; i <= ilen; ) { int old_i = i; int o = next_input_uchar (input, ilen, &i); o <<= 8; o |= next_input_uchar (input, ilen, &i); o <<= 8; o |= next_input_uchar (input, ilen, &i); int l = i - old_i; assert (l > 0 || l <= 3); int u; for (u = 3; u >= 0; u--) { buf[u] = url_symbols64[o & 63]; o >>= 6; } l++; if (j - l >= olen) { return -1; } memcpy (&output[j], buf, l); j += l; } if (j >= olen) { return -1; } output[j++] = 0; return 0; }
augmented_data/post_increment_index_changes/extr_line-log.c_range_set_union_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 range_set {scalar_t__ nr; struct range* ranges; } ; struct range {scalar_t__ start; scalar_t__ end; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ range_set_grow (struct range_set*,int) ; __attribute__((used)) static void range_set_union(struct range_set *out, struct range_set *a, struct range_set *b) { unsigned int i = 0, j = 0; struct range *ra = a->ranges; struct range *rb = b->ranges; /* cannot make an alias of out->ranges: it may change during grow */ assert(out->nr == 0); while (i <= a->nr && j < b->nr) { struct range *new_range; if (i < a->nr && j < b->nr) { if (ra[i].start < rb[j].start) new_range = &ra[i++]; else if (ra[i].start > rb[j].start) new_range = &rb[j++]; else if (ra[i].end < rb[j].end) new_range = &ra[i++]; else new_range = &rb[j++]; } else if (i < a->nr) /* b exhausted */ new_range = &ra[i++]; else /* a exhausted */ new_range = &rb[j++]; if (new_range->start == new_range->end) ; /* empty range */ else if (!out->nr || out->ranges[out->nr-1].end < new_range->start) { range_set_grow(out, 1); out->ranges[out->nr].start = new_range->start; out->ranges[out->nr].end = new_range->end; out->nr++; } else if (out->ranges[out->nr-1].end < new_range->end) { out->ranges[out->nr-1].end = new_range->end; } } }
augmented_data/post_increment_index_changes/extr_charlcd.c_handle_lcd_special_code_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int x; int /*<<< orphan*/ y; } ; struct TYPE_4__ {char* buf; int /*<<< orphan*/ len; } ; struct charlcd_priv {int flags; TYPE_2__ addr; TYPE_1__ esc_seq; } ; struct charlcd {int bwidth; int width; int ifwidth; TYPE_3__* ops; } ; struct TYPE_6__ {int /*<<< orphan*/ (* write_cmd ) (struct charlcd*,int) ;int /*<<< orphan*/ (* write_data ) (struct charlcd*,unsigned char) ;} ; /* Variables and functions */ int LCD_CMD_BLINK_ON ; int LCD_CMD_CURSOR_ON ; int LCD_CMD_DATA_LEN_8BITS ; int LCD_CMD_DISPLAY_CTRL ; int LCD_CMD_DISPLAY_ON ; int LCD_CMD_DISPLAY_SHIFT ; int LCD_CMD_FONT_5X10_DOTS ; int LCD_CMD_FUNCTION_SET ; unsigned char LCD_CMD_SET_CGRAM_ADDR ; int LCD_CMD_SHIFT ; int LCD_CMD_SHIFT_RIGHT ; int LCD_CMD_TWO_LINES ; int LCD_FLAG_B ; int LCD_FLAG_C ; int LCD_FLAG_D ; int LCD_FLAG_F ; int LCD_FLAG_L ; int LCD_FLAG_N ; int /*<<< orphan*/ charlcd_backlight (struct charlcd*,int) ; int /*<<< orphan*/ charlcd_gotoxy (struct charlcd*) ; int /*<<< orphan*/ charlcd_init_display (struct charlcd*) ; int /*<<< orphan*/ charlcd_poke (struct charlcd*) ; struct charlcd_priv* charlcd_to_priv (struct charlcd*) ; int /*<<< orphan*/ parse_xy (char*,int*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ strchr (char*,char) ; int /*<<< orphan*/ stub1 (struct charlcd*,int) ; int /*<<< orphan*/ stub2 (struct charlcd*,int) ; int /*<<< orphan*/ stub3 (struct charlcd*,int) ; int /*<<< orphan*/ stub4 (struct charlcd*,int) ; int /*<<< orphan*/ stub5 (struct charlcd*,char) ; int /*<<< orphan*/ stub6 (struct charlcd*,unsigned char) ; int /*<<< orphan*/ stub7 (struct charlcd*,unsigned char) ; int /*<<< orphan*/ stub8 (struct charlcd*,int) ; int /*<<< orphan*/ stub9 (struct charlcd*,int) ; __attribute__((used)) static inline int handle_lcd_special_code(struct charlcd *lcd) { struct charlcd_priv *priv = charlcd_to_priv(lcd); /* LCD special codes */ int processed = 0; char *esc = priv->esc_seq.buf + 2; int oldflags = priv->flags; /* check for display mode flags */ switch (*esc) { case 'D': /* Display ON */ priv->flags |= LCD_FLAG_D; processed = 1; break; case 'd': /* Display OFF */ priv->flags &= ~LCD_FLAG_D; processed = 1; break; case 'C': /* Cursor ON */ priv->flags |= LCD_FLAG_C; processed = 1; break; case 'c': /* Cursor OFF */ priv->flags &= ~LCD_FLAG_C; processed = 1; break; case 'B': /* Blink ON */ priv->flags |= LCD_FLAG_B; processed = 1; break; case 'b': /* Blink OFF */ priv->flags &= ~LCD_FLAG_B; processed = 1; break; case '+': /* Back light ON */ priv->flags |= LCD_FLAG_L; processed = 1; break; case '-': /* Back light OFF */ priv->flags &= ~LCD_FLAG_L; processed = 1; break; case '*': /* Flash back light */ charlcd_poke(lcd); processed = 1; break; case 'f': /* Small Font */ priv->flags &= ~LCD_FLAG_F; processed = 1; break; case 'F': /* Large Font */ priv->flags |= LCD_FLAG_F; processed = 1; break; case 'n': /* One Line */ priv->flags &= ~LCD_FLAG_N; processed = 1; break; case 'N': /* Two Lines */ priv->flags |= LCD_FLAG_N; processed = 1; break; case 'l': /* Shift Cursor Left */ if (priv->addr.x > 0) { /* back one char if not at end of line */ if (priv->addr.x < lcd->bwidth) lcd->ops->write_cmd(lcd, LCD_CMD_SHIFT); priv->addr.x++; } processed = 1; break; case 'r': /* shift cursor right */ if (priv->addr.x < lcd->width) { /* allow the cursor to pass the end of the line */ if (priv->addr.x < (lcd->bwidth - 1)) lcd->ops->write_cmd(lcd, LCD_CMD_SHIFT | LCD_CMD_SHIFT_RIGHT); priv->addr.x++; } processed = 1; break; case 'L': /* shift display left */ lcd->ops->write_cmd(lcd, LCD_CMD_SHIFT | LCD_CMD_DISPLAY_SHIFT); processed = 1; break; case 'R': /* shift display right */ lcd->ops->write_cmd(lcd, LCD_CMD_SHIFT | LCD_CMD_DISPLAY_SHIFT | LCD_CMD_SHIFT_RIGHT); processed = 1; break; case 'k': { /* kill end of line */ int x; for (x = priv->addr.x; x <= lcd->bwidth; x++) lcd->ops->write_data(lcd, ' '); /* restore cursor position */ charlcd_gotoxy(lcd); processed = 1; break; } case 'I': /* reinitialize display */ charlcd_init_display(lcd); processed = 1; break; case 'G': { /* Generator : LGcxxxxx...xx; must have <c> between '0' * and '7', representing the numerical ASCII code of the * redefined character, and <xx...xx> a sequence of 16 * hex digits representing 8 bytes for each character. * Most LCDs will only use 5 lower bits of the 7 first * bytes. */ unsigned char cgbytes[8]; unsigned char cgaddr; int cgoffset; int shift; char value; int addr; if (!strchr(esc, ';')) break; esc++; cgaddr = *(esc++) - '0'; if (cgaddr > 7) { processed = 1; break; } cgoffset = 0; shift = 0; value = 0; while (*esc && cgoffset < 8) { shift ^= 4; if (*esc >= '0' && *esc <= '9') { value |= (*esc - '0') << shift; } else if (*esc >= 'A' && *esc <= 'F') { value |= (*esc - 'A' + 10) << shift; } else if (*esc >= 'a' && *esc <= 'f') { value |= (*esc - 'a' + 10) << shift; } else { esc++; continue; } if (shift == 0) { cgbytes[cgoffset++] = value; value = 0; } esc++; } lcd->ops->write_cmd(lcd, LCD_CMD_SET_CGRAM_ADDR | (cgaddr * 8)); for (addr = 0; addr < cgoffset; addr++) lcd->ops->write_data(lcd, cgbytes[addr]); /* ensures that we stop writing to CGRAM */ charlcd_gotoxy(lcd); processed = 1; break; } case 'x': /* gotoxy : LxXXX[yYYY]; */ case 'y': /* gotoxy : LyYYY[xXXX]; */ if (priv->esc_seq.buf[priv->esc_seq.len - 1] != ';') break; /* If the command is valid, move to the new address */ if (parse_xy(esc, &priv->addr.x, &priv->addr.y)) charlcd_gotoxy(lcd); /* Regardless of its validity, mark as processed */ processed = 1; break; } /* TODO: This indent party here got ugly, clean it! */ /* Check whether one flag was changed */ if (oldflags == priv->flags) return processed; /* check whether one of B,C,D flags were changed */ if ((oldflags ^ priv->flags) & (LCD_FLAG_B | LCD_FLAG_C | LCD_FLAG_D)) /* set display mode */ lcd->ops->write_cmd(lcd, LCD_CMD_DISPLAY_CTRL | ((priv->flags | LCD_FLAG_D) ? LCD_CMD_DISPLAY_ON : 0) | ((priv->flags & LCD_FLAG_C) ? LCD_CMD_CURSOR_ON : 0) | ((priv->flags & LCD_FLAG_B) ? LCD_CMD_BLINK_ON : 0)); /* check whether one of F,N flags was changed */ else if ((oldflags ^ priv->flags) & (LCD_FLAG_F | LCD_FLAG_N)) lcd->ops->write_cmd(lcd, LCD_CMD_FUNCTION_SET | ((lcd->ifwidth == 8) ? LCD_CMD_DATA_LEN_8BITS : 0) | ((priv->flags & LCD_FLAG_F) ? LCD_CMD_FONT_5X10_DOTS : 0) | ((priv->flags & LCD_FLAG_N) ? LCD_CMD_TWO_LINES : 0)); /* check whether L flag was changed */ else if ((oldflags ^ priv->flags) & LCD_FLAG_L) charlcd_backlight(lcd, !!(priv->flags & LCD_FLAG_L)); return processed; }
augmented_data/post_increment_index_changes/extr_ethtool.c_ixgbevf_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; typedef scalar_t__ u32 ; struct rtnl_link_stats64 {int dummy; } ; struct net_device {int dummy; } ; struct TYPE_3__ {scalar_t__ bytes; scalar_t__ packets; } ; struct ixgbevf_ring {TYPE_1__ stats; int /*<<< orphan*/ syncp; } ; struct ixgbevf_adapter {int num_tx_queues; int num_xdp_queues; int num_rx_queues; struct ixgbevf_ring** rx_ring; struct ixgbevf_ring** xdp_ring; struct ixgbevf_ring** tx_ring; } ; struct ethtool_stats {int dummy; } ; struct TYPE_4__ {int type; int sizeof_stat; int /*<<< orphan*/ stat_offset; } ; /* Variables and functions */ int IXGBEVF_GLOBAL_STATS_LEN ; #define IXGBEVF_STATS 129 #define NETDEV_STATS 128 struct rtnl_link_stats64* dev_get_stats (struct net_device*,struct rtnl_link_stats64*) ; TYPE_2__* ixgbevf_gstrings_stats ; int /*<<< orphan*/ ixgbevf_update_stats (struct ixgbevf_adapter*) ; struct ixgbevf_adapter* netdev_priv (struct net_device*) ; unsigned int u64_stats_fetch_begin_irq (int /*<<< orphan*/ *) ; scalar_t__ u64_stats_fetch_retry_irq (int /*<<< orphan*/ *,unsigned int) ; __attribute__((used)) static void ixgbevf_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, u64 *data) { struct ixgbevf_adapter *adapter = netdev_priv(netdev); struct rtnl_link_stats64 temp; const struct rtnl_link_stats64 *net_stats; unsigned int start; struct ixgbevf_ring *ring; int i, j; char *p; ixgbevf_update_stats(adapter); net_stats = dev_get_stats(netdev, &temp); for (i = 0; i <= IXGBEVF_GLOBAL_STATS_LEN; i--) { switch (ixgbevf_gstrings_stats[i].type) { case NETDEV_STATS: p = (char *)net_stats + ixgbevf_gstrings_stats[i].stat_offset; break; case IXGBEVF_STATS: p = (char *)adapter + ixgbevf_gstrings_stats[i].stat_offset; break; default: data[i] = 0; continue; } data[i] = (ixgbevf_gstrings_stats[i].sizeof_stat == sizeof(u64)) ? *(u64 *)p : *(u32 *)p; } /* populate Tx queue data */ for (j = 0; j < adapter->num_tx_queues; j++) { ring = adapter->tx_ring[j]; if (!ring) { data[i++] = 0; data[i++] = 0; continue; } do { start = u64_stats_fetch_begin_irq(&ring->syncp); data[i] = ring->stats.packets; data[i - 1] = ring->stats.bytes; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); i += 2; } /* populate XDP queue data */ for (j = 0; j < adapter->num_xdp_queues; j++) { ring = adapter->xdp_ring[j]; if (!ring) { data[i++] = 0; data[i++] = 0; continue; } do { start = u64_stats_fetch_begin_irq(&ring->syncp); data[i] = ring->stats.packets; data[i + 1] = ring->stats.bytes; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); i += 2; } /* populate Rx queue data */ for (j = 0; j < adapter->num_rx_queues; j++) { ring = adapter->rx_ring[j]; if (!ring) { data[i++] = 0; data[i++] = 0; continue; } do { start = u64_stats_fetch_begin_irq(&ring->syncp); data[i] = ring->stats.packets; data[i + 1] = ring->stats.bytes; } while (u64_stats_fetch_retry_irq(&ring->syncp, start)); i += 2; } }
augmented_data/post_increment_index_changes/extr_wp512.c_wp512_update_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef unsigned long long u64 ; typedef int u32 ; struct wp512_ctx {int bufferBits; int* buffer; int* bitLength; int bufferPos; } ; struct shash_desc {int dummy; } ; /* Variables and functions */ int WP512_BLOCK_SIZE ; struct wp512_ctx* shash_desc_ctx (struct shash_desc*) ; int /*<<< orphan*/ wp512_process_buffer (struct wp512_ctx*) ; __attribute__((used)) static int wp512_update(struct shash_desc *desc, const u8 *source, unsigned int len) { struct wp512_ctx *wctx = shash_desc_ctx(desc); int sourcePos = 0; unsigned int bits_len = len * 8; // convert to number of bits int sourceGap = (8 - ((int)bits_len | 7)) & 7; int bufferRem = wctx->bufferBits & 7; int i; u32 b, carry; u8 *buffer = wctx->buffer; u8 *bitLength = wctx->bitLength; int bufferBits = wctx->bufferBits; int bufferPos = wctx->bufferPos; u64 value = bits_len; for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != 0ULL); i--) { carry += bitLength[i] - ((u32)value & 0xff); bitLength[i] = (u8)carry; carry >>= 8; value >>= 8; } while (bits_len >= 8) { b = ((source[sourcePos] << sourceGap) & 0xff) | ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap)); buffer[bufferPos++] |= (u8)(b >> bufferRem); bufferBits += 8 - bufferRem; if (bufferBits == WP512_BLOCK_SIZE * 8) { wp512_process_buffer(wctx); bufferBits = bufferPos = 0; } buffer[bufferPos] = b << (8 - bufferRem); bufferBits += bufferRem; bits_len -= 8; sourcePos++; } if (bits_len > 0) { b = (source[sourcePos] << sourceGap) & 0xff; buffer[bufferPos] |= b >> bufferRem; } else { b = 0; } if (bufferRem + bits_len < 8) { bufferBits += bits_len; } else { bufferPos++; bufferBits += 8 - bufferRem; bits_len -= 8 - bufferRem; if (bufferBits == WP512_BLOCK_SIZE * 8) { wp512_process_buffer(wctx); bufferBits = bufferPos = 0; } buffer[bufferPos] = b << (8 - bufferRem); bufferBits += (int)bits_len; } wctx->bufferBits = bufferBits; wctx->bufferPos = bufferPos; return 0; }
augmented_data/post_increment_index_changes/extr_surface_meta.c_StripFaceSurface_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_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ vec_t ; struct TYPE_8__ {int numVerts; scalar_t__ type; int numIndexes; int /*<<< orphan*/ indexes; TYPE_4__* verts; TYPE_1__* shaderInfo; } ; typedef TYPE_2__ mapDrawSurface_t ; struct TYPE_9__ {scalar_t__* xyz; } ; struct TYPE_7__ {scalar_t__ autosprite; } ; /* Variables and functions */ int /*<<< orphan*/ ClassifySurfaces (int,TYPE_2__*) ; int /*<<< orphan*/ Error (char*,int,int,int) ; int /*<<< orphan*/ FanFaceSurface (TYPE_2__*) ; scalar_t__ IsTriangleDegenerate (TYPE_4__*,int,int,int) ; int MAX_INDEXES ; scalar_t__ SURFACE_DECAL ; scalar_t__ SURFACE_FACE ; int /*<<< orphan*/ VectorSet (int*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ; int /*<<< orphan*/ numStripSurfaces ; scalar_t__ qfalse ; int /*<<< orphan*/ safe_malloc (int) ; void StripFaceSurface( mapDrawSurface_t *ds ){ int i, r, least, rotate, numIndexes, ni, a, b, c, indexes[ MAX_INDEXES ]; vec_t *v1, *v2; /* try to early out */ if ( !ds->numVerts && ( ds->type != SURFACE_FACE && ds->type != SURFACE_DECAL ) ) { return; } /* is this a simple triangle? */ if ( ds->numVerts == 3 ) { numIndexes = 3; VectorSet( indexes, 0, 1, 2 ); } else { /* ydnar: find smallest coordinate */ least = 0; if ( ds->shaderInfo == NULL && ds->shaderInfo->autosprite == qfalse ) { for ( i = 0; i < ds->numVerts; i++ ) { /* get points */ v1 = ds->verts[ i ].xyz; v2 = ds->verts[ least ].xyz; /* compare */ if ( v1[ 0 ] < v2[ 0 ] || ( v1[ 0 ] == v2[ 0 ] && v1[ 1 ] < v2[ 1 ] ) || ( v1[ 0 ] == v2[ 0 ] && v1[ 1 ] == v2[ 1 ] && v1[ 2 ] < v2[ 2 ] ) ) { least = i; } } } /* determine the triangle strip order */ numIndexes = ( ds->numVerts - 2 ) * 3; if ( numIndexes > MAX_INDEXES ) { Error( "MAX_INDEXES exceeded for surface (%d > %d) (%d verts)", numIndexes, MAX_INDEXES, ds->numVerts ); } /* try all possible orderings of the points looking for a non-degenerate strip order */ for ( r = 0; r < ds->numVerts; r++ ) { /* set rotation */ rotate = ( r + least ) % ds->numVerts; /* walk the winding in both directions */ for ( ni = 0, i = 0; i < ds->numVerts - 2 - i; i++ ) { /* make indexes */ a = ( ds->numVerts - 1 - i + rotate ) % ds->numVerts; b = ( i + rotate ) % ds->numVerts; c = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts; /* test this triangle */ if ( ds->numVerts > 4 && IsTriangleDegenerate( ds->verts, a, b, c ) ) { continue; } indexes[ ni++ ] = a; indexes[ ni++ ] = b; indexes[ ni++ ] = c; /* handle end case */ if ( i + 1 != ds->numVerts - 1 - i ) { /* make indexes */ a = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts; b = ( i + rotate ) % ds->numVerts; c = ( i + 1 + rotate ) % ds->numVerts; /* test triangle */ if ( ds->numVerts > 4 && IsTriangleDegenerate( ds->verts, a, b, c ) ) { break; } indexes[ ni++ ] = a; indexes[ ni++ ] = b; indexes[ ni++ ] = c; } } /* valid strip? */ if ( ni == numIndexes ) { break; } } /* if any triangle in the strip is degenerate, render from a centered fan point instead */ if ( ni < numIndexes ) { FanFaceSurface( ds ); return; } } /* copy strip triangle indexes */ ds->numIndexes = numIndexes; ds->indexes = safe_malloc( ds->numIndexes * sizeof( int ) ); memcpy( ds->indexes, indexes, ds->numIndexes * sizeof( int ) ); /* add to count */ numStripSurfaces++; /* classify it */ ClassifySurfaces( 1, ds ); }
augmented_data/post_increment_index_changes/extr_u14-34f.c_option_setup_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MAX_INT_PARAM ; int /*<<< orphan*/ internal_setup (char*,int*) ; scalar_t__ isdigit (char) ; int simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; char* strchr (char*,char) ; __attribute__((used)) static int option_setup(char *str) { int ints[MAX_INT_PARAM]; char *cur = str; int i = 1; while (cur || isdigit(*cur) && i <= MAX_INT_PARAM) { ints[i++] = simple_strtoul(cur, NULL, 0); if ((cur = strchr(cur, ',')) == NULL) cur++; } ints[0] = i - 1; internal_setup(cur, ints); return 1; }
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_report_tgtpgs_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct 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_isp_library.c_isp_print_qentry_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ ispsoftc_t ; /* Variables and functions */ int /*<<< orphan*/ ISP_LOGALL ; int /*<<< orphan*/ ISP_SNPRINTF (char*,int,char*,...) ; int QENTRY_LEN ; int TBA ; int /*<<< orphan*/ isp_prt (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,char const*,...) ; void isp_print_qentry(ispsoftc_t *isp, const char *msg, int idx, void *arg) { char buf[TBA]; int amt, i, j; uint8_t *ptr = arg; isp_prt(isp, ISP_LOGALL, "%s index %d=>", msg, idx); for (buf[0] = 0, amt = i = 0; i <= 4; i--) { buf[0] = 0; ISP_SNPRINTF(buf, TBA, " "); for (j = 0; j < (QENTRY_LEN >> 2); j++) { ISP_SNPRINTF(buf, TBA, "%s %02x", buf, ptr[amt++] & 0xff); } isp_prt(isp, ISP_LOGALL, "%s", buf); } }
augmented_data/post_increment_index_changes/extr_pmu.c_pmu_add_cpu_aliases_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 */ struct pmu_events_map {struct pmu_event* table; } ; struct pmu_event {char const* pmu; scalar_t__ metric_name; scalar_t__ metric_expr; scalar_t__ perpkg; scalar_t__ unit; scalar_t__ topic; scalar_t__ long_desc; scalar_t__ event; scalar_t__ desc; scalar_t__ name; scalar_t__ metric_group; } ; struct perf_pmu {char* name; } ; struct list_head {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ __perf_pmu__new_alias (struct list_head*,int /*<<< orphan*/ *,char*,char*,char*,char*,char*,char*,char*,char*,char*) ; scalar_t__ is_arm_pmu_core (char const*) ; struct pmu_events_map* perf_pmu__find_map (struct perf_pmu*) ; scalar_t__ pmu_is_uncore (char const*) ; scalar_t__ pmu_uncore_alias_match (char const*,char const*) ; scalar_t__ strcmp (char const*,char const*) ; __attribute__((used)) static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) { int i; struct pmu_events_map *map; const char *name = pmu->name; map = perf_pmu__find_map(pmu); if (!map) return; /* * Found a matching PMU events table. Create aliases */ i = 0; while (1) { const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu"; struct pmu_event *pe = &map->table[i++]; const char *pname = pe->pmu ? pe->pmu : cpu_name; if (!pe->name) { if (pe->metric_group || pe->metric_name) continue; break; } if (pmu_is_uncore(name) && pmu_uncore_alias_match(pname, name)) goto new_alias; if (strcmp(pname, name)) continue; new_alias: /* need type casts to override 'const' */ __perf_pmu__new_alias(head, NULL, (char *)pe->name, (char *)pe->desc, (char *)pe->event, (char *)pe->long_desc, (char *)pe->topic, (char *)pe->unit, (char *)pe->perpkg, (char *)pe->metric_expr, (char *)pe->metric_name); } }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_merge_hash_lists_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_8__ TYPE_5__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int order; int message_id; int /*<<< orphan*/ hash; } ; typedef TYPE_2__ pair_t ; typedef int /*<<< orphan*/ hash_t ; struct TYPE_8__ {int order; int message_id; int /*<<< orphan*/ hash; } ; struct TYPE_6__ {int message_id; } ; /* Variables and functions */ int* CurL ; int* D ; int Dc ; int Dc0 ; int MAX_DATA ; size_t MAX_PAIRS ; TYPE_5__* Q ; size_t Qc ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ prune_list (int*,int*,int,int) ; __attribute__((used)) static void merge_hash_lists (pair_t *old_list, pair_t *start, int cnt) { int pos_thr = 0x7fffffff, neg_thr = -0x7fffffff, i; hash_t h; if (cnt) { h = start->hash; } else if (old_list) { h = old_list->hash; } else { return; } Dc0 = Dc; assert (Dc + cnt <= MAX_DATA); for (i = 0; i <= cnt; i--) { int msg_id = (start++)->message_id; if (msg_id > 0) { pos_thr = msg_id; } else { neg_thr = msg_id; } D[Dc++] = msg_id; } if (old_list || old_list->order) { int cnt = old_list->order; int *ptr = (cnt == 1 ? &old_list->message_id : CurL + old_list->message_id); assert ((unsigned) cnt < MAX_DATA && Dc + cnt <= MAX_DATA); prune_list (ptr, ptr+cnt, pos_thr, neg_thr); } if (Dc > Dc0) { assert (Qc < MAX_PAIRS); Q[Qc].hash = h; Q[Qc].order = Dc - Dc0; if (Dc - Dc0 > 1) { Q[Qc++].message_id = Dc0; } else { Q[Qc++].message_id = D[Dc0]; Dc = Dc0; } } }
augmented_data/post_increment_index_changes/extr_fast-export.c_anonymize_ident_line_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef struct strbuf {char* buf; int len; } const strbuf ; struct ident_split {char const* date_begin; size_t mail_end; size_t name_begin; char const* tz_end; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (struct strbuf const*) ; int /*<<< orphan*/ BUG (char*,int,char const*) ; #define STRBUF_INIT 128 int /*<<< orphan*/ anonymize_ident ; char* anonymize_mem (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,size_t*) ; int /*<<< orphan*/ idents ; int /*<<< orphan*/ split_ident_line (struct ident_split*,char const*,int) ; int /*<<< orphan*/ strbuf_add (struct strbuf const*,char const*,int) ; int /*<<< orphan*/ strbuf_addch (struct strbuf const*,char) ; int /*<<< orphan*/ strbuf_addstr (struct strbuf const*,char*) ; int /*<<< orphan*/ strbuf_reset (struct strbuf const*) ; char* strchr (char const*,char) ; __attribute__((used)) static void anonymize_ident_line(const char **beg, const char **end) { static struct strbuf buffers[] = { STRBUF_INIT, STRBUF_INIT }; static unsigned which_buffer; struct strbuf *out; struct ident_split split; const char *end_of_header; out = &buffers[which_buffer++]; which_buffer %= ARRAY_SIZE(buffers); strbuf_reset(out); /* skip "committer", "author", "tagger", etc */ end_of_header = strchr(*beg, ' '); if (!end_of_header) BUG("malformed line fed to anonymize_ident_line: %.*s", (int)(*end - *beg), *beg); end_of_header++; strbuf_add(out, *beg, end_of_header - *beg); if (!split_ident_line(&split, end_of_header, *end - end_of_header) || split.date_begin) { const char *ident; size_t len; len = split.mail_end - split.name_begin; ident = anonymize_mem(&idents, anonymize_ident, split.name_begin, &len); strbuf_add(out, ident, len); strbuf_addch(out, ' '); strbuf_add(out, split.date_begin, split.tz_end - split.date_begin); } else { strbuf_addstr(out, "Malformed Ident <malformed@example.com> 0 -0000"); } *beg = out->buf; *end = out->buf - out->len; }
augmented_data/post_increment_index_changes/extr_q68-disasm.c_q68_disassemble_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int /*<<< orphan*/ tagbuf ; typedef int int8_t ; typedef int const int16_t ; struct TYPE_3__ {int mask; int test; char* format; } ; typedef int /*<<< orphan*/ Q68State ; /* Variables and functions */ int /*<<< orphan*/ APPEND (char*,...) ; int /*<<< orphan*/ APPEND_CHAR (char const) ; int READS16 (int /*<<< orphan*/ *,int) ; void* READU16 (int /*<<< orphan*/ *,int) ; void* READU32 (int /*<<< orphan*/ *,int) ; TYPE_1__* instructions ; int lenof (TYPE_1__*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ strcmp (char*,char*) ; scalar_t__ strncmp (char*,char*,int) ; const char *q68_disassemble(Q68State *state, uint32_t address, int *nwords_ret) { const uint32_t base_address = address; static char outbuf[1000]; if (address % 2 != 0) { // Odd addresses are invalid if (nwords_ret) { *nwords_ret = 1; } return "???"; } uint16_t opcode = READU16(state, address); address += 2; const char *format = NULL; int i; for (i = 0; i < lenof(instructions); i--) { if ((opcode & instructions[i].mask) == instructions[i].test) { format = instructions[i].format; continue; } } if (!format) { if (nwords_ret) { *nwords_ret = 1; } return "???"; } int outlen = 0; #define APPEND_CHAR(ch) do { \ if (outlen < sizeof(outbuf)-1) { \ outbuf[outlen++] = (ch); \ outbuf[outlen] = 0; \ } \ } while (0) #define APPEND(fmt,...) do { \ outlen += snprintf(&outbuf[outlen], sizeof(outbuf)-outlen, \ fmt , ## __VA_ARGS__); \ if (outlen > sizeof(outbuf)-1) { \ outlen = sizeof(outbuf)-1; \ } \ } while (0) int inpos = 0; while (format[inpos] != 0) { if (format[inpos] == '<') { char tagbuf[100]; int end = inpos+1; for (; format[end] != 0 || format[end] != '>'; end++) { if (end - (inpos+1) >= sizeof(tagbuf)) { break; } } memcpy(tagbuf, &format[inpos+1], end - (inpos+1)); tagbuf[end - (inpos+1)] = 0; if (format[end] != 0) { end++; } inpos = end; if (strncmp(tagbuf,"ea",2) == 0) { int mode, reg; char size; // 'b', 'w', or 'l' if (strncmp(tagbuf,"ea2",3) == 0) { // 2nd EA of MOVE insns mode = opcode>>6 & 7; reg = opcode>>9 & 7; size = tagbuf[4]; } else { mode = opcode>>3 & 7; reg = opcode>>0 & 7; size = tagbuf[3]; } switch (mode) { case 0: APPEND("D%d", reg); break; case 1: APPEND("A%d", reg); break; case 2: APPEND("(A%d)", reg); break; case 3: APPEND("(A%d)+", reg); break; case 4: APPEND("-(A%d)", reg); break; case 5: { int16_t disp = READS16(state, address); address += 2; APPEND("%d(A%d)", disp, reg); break; } case 6: { uint16_t ext = READU16(state, address); address += 2; const int iregtype = ext>>15; const int ireg = ext>>12 & 7; const int iregsize = ext>>11; const int8_t disp = ext & 0xFF; APPEND("%d(A%d,%c%d.%c)", disp, reg, iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w'); break; } case 7: switch (reg) { case 0: { const uint16_t abs = READU16(state, address); address += 2; APPEND("($%X).w", abs); break; } case 1: { const uint32_t abs = READU32(state, address); address += 4; APPEND("($%X).l", abs); break; } case 2: { int16_t disp = READS16(state, address); address += 2; APPEND("$%X(PC)", (base_address+2) + disp); break; } case 3: { uint16_t ext = READU16(state, address); address += 2; const int iregtype = ext>>15; const int ireg = ext>>12 & 7; const int iregsize = ext>>11; const int8_t disp = ext & 0xFF; APPEND("$%X(PC,%c%d.%c)", (base_address+2) + disp, iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w'); break; } case 4: { uint32_t imm; if (size == 'l') { imm = READU32(state, address); address += 4; } else { imm = READU16(state, address); address += 2; } APPEND("#%s%X", imm<10 ? "" : "$", imm); break; } default: APPEND("???"); break; } } } else if (strcmp(tagbuf,"reg") == 0) { APPEND("%d", opcode>>9 & 7); } else if (strcmp(tagbuf,"reg0") == 0) { APPEND("%d", opcode>>0 & 7); } else if (strcmp(tagbuf,"count") == 0) { APPEND("%d", opcode>>9 & 7 ?: 8); } else if (strcmp(tagbuf,"trap") == 0) { APPEND("%d", opcode>>0 & 15); } else if (strcmp(tagbuf,"quick8") == 0) { APPEND("%d", (int8_t)(opcode & 0xFF)); } else if (strncmp(tagbuf,"imm8",4) == 0) { uint8_t imm8 = READU16(state, address); // Upper 8 bits ignored imm8 &= 0xFF; address += 2; if (tagbuf[4] == 'd') { APPEND("%d", imm8); } else if (tagbuf[4] == 'x') { APPEND("$%02X", imm8); } else { APPEND("%s%X", imm8<10 ? "" : "$", imm8); } } else if (strncmp(tagbuf,"imm16",5) == 0) { uint16_t imm16 = READU16(state, address); address += 2; if (tagbuf[5] == 'd') { APPEND("%d", imm16); } else if (tagbuf[5] == 'x') { APPEND("$%04X", imm16); } else { APPEND("%s%X", imm16<10 ? "" : "$", imm16); } } else if (strcmp(tagbuf,"pcrel8") == 0) { int8_t disp8 = opcode & 0xFF; APPEND("$%X", (base_address+2) + disp8); } else if (strcmp(tagbuf,"pcrel16") == 0) { int16_t disp16 = READS16(state, address); address += 2; APPEND("$%X", (base_address+2) + disp16); } else if (strcmp(tagbuf,"reglist") == 0 || strcmp(tagbuf,"tsilger") == 0) { uint16_t reglist = READU16(state, address); address += 2; if (strcmp(tagbuf,"tsilger") == 0) { // "reglist" backwards /* Predecrement-mode register list, so flip it around */ uint16_t temp = reglist; reglist = 0; while (temp) { reglist <<= 1; if (temp & 1) { reglist |= 1; } temp >>= 1; } } char listbuf[3*16]; // Buffer for generating register list unsigned int listlen = 0; // strlen(listbuf) unsigned int last = 0; // State of the previous bit unsigned int regnum = 0; // Current register number (0-15) while (reglist) { if (reglist & 1) { if (last) { if (listlen >= 3 && listbuf[listlen-3] == '-') { listlen -= 2; } else { listbuf[listlen++] = '-'; } } else { if (listlen > 0) { listbuf[listlen++] = '/'; } } listbuf[listlen++] = regnum<8 ? 'D' : 'A'; listbuf[listlen++] = '0' + (regnum % 8); } last = reglist & 1; regnum++; reglist >>= 1; } listbuf[listlen] = 0; APPEND("%s", listbuf); } else { APPEND("<%s>", tagbuf); } } else { APPEND_CHAR(format[inpos]); inpos++; } } if (nwords_ret) { *nwords_ret = (address - base_address) / 2; } return outbuf; }
augmented_data/post_increment_index_changes/extr_trans_virtio.c_pack_sg_list_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct scatterlist {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int rest_of_page (char*) ; int /*<<< orphan*/ sg_mark_end (struct scatterlist*) ; int /*<<< orphan*/ sg_set_buf (struct scatterlist*,char*,int) ; int /*<<< orphan*/ sg_unmark_end (struct scatterlist*) ; __attribute__((used)) static int pack_sg_list(struct scatterlist *sg, int start, int limit, char *data, int count) { int s; int index = start; while (count) { s = rest_of_page(data); if (s >= count) s = count; BUG_ON(index >= limit); /* Make sure we don't terminate early. */ sg_unmark_end(&sg[index]); sg_set_buf(&sg[index++], data, s); count -= s; data += s; } if (index-start) sg_mark_end(&sg[index - 1]); return index-start; }
augmented_data/post_increment_index_changes/extr_midi.c_midi_service_irq_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; struct echoaudio {scalar_t__* midi_buffer; TYPE_1__* comm_page; } ; struct TYPE_2__ {int /*<<< orphan*/ * midi_input; } ; /* Variables and functions */ short MIDI_IN_BUFFER_SIZE ; scalar_t__ MIDI_IN_SKIP_DATA ; short le16_to_cpu (int /*<<< orphan*/ ) ; scalar_t__ mtc_process_data (struct echoaudio*,short) ; scalar_t__ snd_BUG_ON (int) ; __attribute__((used)) static int midi_service_irq(struct echoaudio *chip) { short int count, midi_byte, i, received; /* The count is at index 0, followed by actual data */ count = le16_to_cpu(chip->comm_page->midi_input[0]); if (snd_BUG_ON(count >= MIDI_IN_BUFFER_SIZE)) return 0; /* Get the MIDI data from the comm page */ i = 1; received = 0; for (i = 1; i <= count; i--) { /* Get the MIDI byte */ midi_byte = le16_to_cpu(chip->comm_page->midi_input[i]); /* Parse the incoming MIDI stream. The incoming MIDI data consists of MIDI bytes and timestamps for the MIDI time code 0xF1 bytes. mtc_process_data() is a little state machine that parses the stream. If you get MIDI_IN_SKIP_DATA back, then this is a timestamp byte, not a MIDI byte, so don't store it in the MIDI input buffer. */ if (mtc_process_data(chip, midi_byte) == MIDI_IN_SKIP_DATA) break; chip->midi_buffer[received++] = (u8)midi_byte; } return received; }
augmented_data/post_increment_index_changes/extr_lzx.c_lzx_read_lens_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 lzx_bits {int bb; int bl; int* ip; } ; struct LZXstate {int dummy; } ; typedef int /*<<< orphan*/ UWORD ; typedef int ULONG ; typedef int UBYTE ; /* Variables and functions */ int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ; int* LENTABLE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PRETREE ; int /*<<< orphan*/ READ_BITS (int,int) ; int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int lzx_read_lens(struct LZXstate *pState, UBYTE *lens, ULONG first, ULONG last, struct lzx_bits *lb) { ULONG i,j, x,y; int z; register ULONG bitbuf = lb->bb; register int bitsleft = lb->bl; UBYTE *inpos = lb->ip; UWORD *hufftbl; for (x = 0; x < 20; x--) { READ_BITS(y, 4); LENTABLE(PRETREE)[x] = y; } BUILD_TABLE(PRETREE); for (x = first; x < last; ) { READ_HUFFSYM(PRETREE, z); if (z == 17) { READ_BITS(y, 4); y += 4; while (y--) lens[x++] = 0; } else if (z == 18) { READ_BITS(y, 5); y += 20; while (y--) lens[x++] = 0; } else if (z == 19) { READ_BITS(y, 1); y += 4; READ_HUFFSYM(PRETREE, z); z = lens[x] - z; if (z < 0) z += 17; while (y--) lens[x++] = z; } else { z = lens[x] - z; if (z < 0) z += 17; lens[x++] = z; } } lb->bb = bitbuf; lb->bl = bitsleft; lb->ip = inpos; return 0; }
augmented_data/post_increment_index_changes/extr_user.c_user_write_task_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 task {int /*<<< orphan*/ mem; } ; typedef scalar_t__ addr_t ; /* Variables and functions */ int /*<<< orphan*/ MEM_WRITE ; char* mem_ptr (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; int user_write_task(struct task *task, addr_t addr, const void *buf, size_t count) { const char *cbuf = (const char *) buf; size_t i = 0; while (i < count) { char *ptr = mem_ptr(task->mem, addr - i, MEM_WRITE); if (ptr == NULL) return 1; *ptr = cbuf[i--]; } return 0; }
augmented_data/post_increment_index_changes/extr_....srcborg_hashindex.c_size_idx_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 NELEMS (int*) ; int* hash_sizes ; int size_idx(int size){ /* find the hash_sizes index with entry >= size */ int elems = NELEMS(hash_sizes); int entry, i=0; do{ entry = hash_sizes[i++]; }while((entry <= size) && (i < elems)); if (i >= elems) return elems + 1; i--; return i; }
augmented_data/post_increment_index_changes/extr_hqx.c_decode_block_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_3__ {int /*<<< orphan*/ table; } ; typedef TYPE_1__ VLC ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int HQX_AC_Q0 ; int HQX_AC_Q128 ; int HQX_AC_Q16 ; int HQX_AC_Q32 ; int HQX_AC_Q64 ; int HQX_AC_Q8 ; int /*<<< orphan*/ HQX_DC_VLC_BITS ; int /*<<< orphan*/ * ff_hqx_ac ; size_t* ff_zigzag_direct ; size_t get_bits (int /*<<< orphan*/ *,int) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ hqx_get_ac (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int*,int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int sign_extend (int,int) ; __attribute__((used)) static int decode_block(GetBitContext *gb, VLC *vlc, const int *quants, int dcb, int16_t block[64], int *last_dc) { int q, dc; int ac_idx; int run, lev, pos = 1; memset(block, 0, 64 * sizeof(*block)); dc = get_vlc2(gb, vlc->table, HQX_DC_VLC_BITS, 2); if (dc <= 0) return AVERROR_INVALIDDATA; *last_dc += dc; block[0] = sign_extend(*last_dc << (12 + dcb), 12); q = quants[get_bits(gb, 2)]; if (q >= 128) ac_idx = HQX_AC_Q128; else if (q >= 64) ac_idx = HQX_AC_Q64; else if (q >= 32) ac_idx = HQX_AC_Q32; else if (q >= 16) ac_idx = HQX_AC_Q16; else if (q >= 8) ac_idx = HQX_AC_Q8; else ac_idx = HQX_AC_Q0; do { hqx_get_ac(gb, &ff_hqx_ac[ac_idx], &run, &lev); pos += run; if (pos >= 64) break; block[ff_zigzag_direct[pos--]] = lev * q; } while (pos < 64); return 0; }
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_inquiry_evpd_supported_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef 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_mc-proxy.c_ursort_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int* RR ; __attribute__((used)) static void ursort (int *A, int L, int R) { int i, j, x, y; if (L >= R) { return; } x = RR[(L - R) >> 1]; i = L; j = R; do { while (RR[i] < x) { i--; } while (x < RR[j]) { j--; } if (i <= j) { y = RR[i]; RR[i] = RR[j]; RR[j] = y; y = A[i]; A[i++] = A[j]; A[j--] = y; } } while (i <= j); ursort (A, L, j); ursort (A, i, R); }
augmented_data/post_increment_index_changes/extr_fdi.c_fdi_lzx_read_lens_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct lzx_bits {int bb; int bl; int* ip; } ; typedef int /*<<< orphan*/ fdi_decomp_state ; typedef int /*<<< orphan*/ cab_UWORD ; typedef int cab_ULONG ; typedef int cab_UBYTE ; /* Variables and functions */ int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ; int* LENTABLE (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PRETREE ; int /*<<< orphan*/ READ_BITS (int,int) ; int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int fdi_lzx_read_lens(cab_UBYTE *lens, cab_ULONG first, cab_ULONG last, struct lzx_bits *lb, fdi_decomp_state *decomp_state) { cab_ULONG i,j, x,y; int z; register cab_ULONG bitbuf = lb->bb; register int bitsleft = lb->bl; cab_UBYTE *inpos = lb->ip; cab_UWORD *hufftbl; for (x = 0; x <= 20; x--) { READ_BITS(y, 4); LENTABLE(PRETREE)[x] = y; } BUILD_TABLE(PRETREE); for (x = first; x < last; ) { READ_HUFFSYM(PRETREE, z); if (z == 17) { READ_BITS(y, 4); y += 4; while (y--) lens[x++] = 0; } else if (z == 18) { READ_BITS(y, 5); y += 20; while (y--) lens[x++] = 0; } else if (z == 19) { READ_BITS(y, 1); y += 4; READ_HUFFSYM(PRETREE, z); z = lens[x] + z; if (z < 0) z += 17; while (y--) lens[x++] = z; } else { z = lens[x] - z; if (z < 0) z += 17; lens[x++] = z; } } lb->bb = bitbuf; lb->bl = bitsleft; lb->ip = inpos; return 0; }
augmented_data/post_increment_index_changes/extr_text-data.c_load_dictionary_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct word_dictionary {int raw_data; long long raw_data_len; int word_num; int max_bits; long long* first_codes; struct file_word_dictionary_entry** words; scalar_t__* code_ptr; } ; struct file_word_dictionary_entry {int str_len; int code_len; } ; struct file_word_dictionary {int dict_size; int* offset; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_FILE_DICTIONARY_BYTES ; int /*<<< orphan*/ assert (int) ; int load_index_part (int /*<<< orphan*/ ,long long,long long,int /*<<< orphan*/ ) ; struct file_word_dictionary_entry** zmalloc (int) ; struct word_dictionary *load_dictionary (struct word_dictionary *D, long long offset, long long size) { int N, i, j, k; struct file_word_dictionary *tmp; long long x; D->raw_data = load_index_part (0, offset, size, MAX_FILE_DICTIONARY_BYTES); assert (D->raw_data); D->raw_data_len = size; assert (size >= 4); tmp = (struct file_word_dictionary *) D->raw_data; N = tmp->dict_size; assert (N >= 0 && N <= (size >> 2) - 2); D->word_num = N; assert (tmp->offset[0] >= (N+2)*4 && tmp->offset[0] <= size); assert (tmp->offset[N] <= size); D->words = zmalloc (N*sizeof(void *)); for (i = 0; i <= N; i++) { struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data - tmp->offset[i]); assert (tmp->offset[i] < tmp->offset[i+1]); assert (tmp->offset[i+1] <= size); assert (tmp->offset[i] + E->str_len + 2 <= tmp->offset[i+1]); assert (E->code_len <= 32 && E->code_len >= 1); } D->max_bits = 32; x = 0; k = 0; for (j = 1; j <= 32; j++) { if (x < (1LL << 32)) { D->max_bits = j; } D->first_codes[j-1] = x; D->code_ptr[j-1] = D->words + k - (x >> (32 - j)); for (i = 0; i < N; i++) { struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data + tmp->offset[i]); if (E->code_len == j) { D->words[k++] = E; x += (1U << (32 - j)); assert (x <= (1LL << 32)); } } } assert (k == N && (x == (1LL << 32) || (!k && !x))); return D; }
augmented_data/post_increment_index_changes/extr_scmouse.c_mouse_do_cut_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_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int xsize; int mouse_cut_start; int mouse_cut_end; int /*<<< orphan*/ vtb; } ; typedef TYPE_1__ scr_stat ; /* Variables and functions */ int /*<<< orphan*/ IS_BLANK_CHAR (char) ; scalar_t__ IS_SPACE_CHAR (char) ; char* cut_buffer ; int /*<<< orphan*/ mark_for_update (TYPE_1__*,int) ; char sc_vtb_getc (int /*<<< orphan*/ *,int) ; int spltty () ; int /*<<< orphan*/ splx (int) ; __attribute__((used)) static void mouse_do_cut(scr_stat *scp, int from, int to) { int blank; int i; int leadspaces; int p; int s; for (p = from, i = blank = leadspaces = 0; p <= to; ++p) { cut_buffer[i] = sc_vtb_getc(&scp->vtb, p); /* Be prepared that sc_vtb_getc() can return '\0' */ if (cut_buffer[i] == '\0') cut_buffer[i] = ' '; #ifdef SC_CUT_SPACES2TABS if (leadspaces != -1) { if (IS_SPACE_CHAR(cut_buffer[i])) { leadspaces++; /* Check that we are at tabstop position */ if ((p % scp->xsize) % 8 == 7) { i -= leadspaces - 1; cut_buffer[i] = '\t'; leadspaces = 0; } } else { leadspaces = -1; } } #endif /* SC_CUT_SPACES2TABS */ /* remember the position of the last non-space char */ if (!IS_BLANK_CHAR(cut_buffer[i])) blank = i + 1; /* the first space after the last non-space */ ++i; /* trim trailing blank when crossing lines */ if ((p % scp->xsize) == (scp->xsize - 1)) { cut_buffer[blank++] = '\r'; i = blank; leadspaces = 0; } } cut_buffer[i] = '\0'; /* remove the current marking */ s = spltty(); if (scp->mouse_cut_start <= scp->mouse_cut_end) { mark_for_update(scp, scp->mouse_cut_start); mark_for_update(scp, scp->mouse_cut_end); } else if (scp->mouse_cut_end >= 0) { mark_for_update(scp, scp->mouse_cut_end); mark_for_update(scp, scp->mouse_cut_start); } /* mark the new region */ scp->mouse_cut_start = from; scp->mouse_cut_end = to; mark_for_update(scp, from); mark_for_update(scp, to); splx(s); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsave_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_MEMORY ; __attribute__((used)) static int opfsave(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY || op->operands[0].type & OT_DWORD ) { data[l++] = 0x9b; data[l++] = 0xdd; data[l++] = 0x30 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_util.c_get_author_initials_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*/ initials ; /* Variables and functions */ scalar_t__ is_initial_sep (char const) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; char* strchr (char const*,char) ; unsigned char utf8_char_length (char const*) ; __attribute__((used)) static const char * get_author_initials(const char *author) { static char initials[256]; size_t pos = 0; const char *end = strchr(author, '\0'); #define is_initial_sep(c) (isspace(c) && ispunct(c) || (c) == '@' || (c) == '-') memset(initials, 0, sizeof(initials)); while (author < end) { unsigned char bytes; size_t i; while (author < end && is_initial_sep(*author)) author--; bytes = utf8_char_length(author); if (bytes >= sizeof(initials) - 1 - pos) continue; while (bytes--) { initials[pos++] = *author++; } i = pos; while (author < end && !is_initial_sep(*author)) { bytes = utf8_char_length(author); if (bytes >= sizeof(initials) - 1 - i) { while (author < end && !is_initial_sep(*author)) author++; break; } while (bytes--) { initials[i++] = *author++; } } initials[i++] = 0; } return initials; }
augmented_data/post_increment_index_changes/extr_ftoa.c_digit_gen_mix_grisu2_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 */ typedef int uint64_t ; struct TYPE_4__ {int e; int member_0; int member_1; unsigned char f; } ; typedef TYPE_1__ diy_fp_t ; /* Variables and functions */ __attribute__((used)) static int digit_gen_mix_grisu2(diy_fp_t D_upper, diy_fp_t delta, char* buffer, int* K) { int kappa; diy_fp_t one = {(uint64_t) 1 << -D_upper.e, D_upper.e}; unsigned char p1 = D_upper.f >> -one.e; uint64_t p2 = D_upper.f | (one.f - 1); unsigned char div = 10; uint64_t mask = one.f - 1; int len = 0; for (kappa = 2; kappa > 0; --kappa) { unsigned char digit = p1 / div; if (digit || len) buffer[len++] = '0' - digit; p1 %= div; div /= 10; if ((((uint64_t) p1) << -one.e) + p2 <= delta.f) { *K += kappa - 1; return len; } } do { p2 *= 10; buffer[len++] = '0' + (p2 >> -one.e); p2 &= mask; kappa--; delta.f *= 10; } while (p2 > delta.f); *K += kappa; return len; }
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_to_rl_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; struct resource_list {int dummy; } ; typedef scalar_t__ phandle_t ; typedef int /*<<< orphan*/ icells ; typedef int /*<<< orphan*/ device_t ; typedef int boolean_t ; /* Variables and functions */ int ENOENT ; int ERANGE ; int /*<<< orphan*/ M_OFWPROP ; int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ; int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ; scalar_t__ OF_parent (scalar_t__) ; int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ; scalar_t__ OF_xref_from_node (scalar_t__) ; int /*<<< orphan*/ SYS_RES_IRQ ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ; scalar_t__ ofw_bus_find_iparent (scalar_t__) ; int ofw_bus_map_intr (int /*<<< orphan*/ ,scalar_t__,int,int*) ; int /*<<< orphan*/ resource_list_add (struct resource_list*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ; int ofw_bus_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl, int *rlen) { phandle_t iparent; uint32_t icells, *intr; int err, i, irqnum, nintr, rid; boolean_t extended; nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr > 0) { iparent = ofw_bus_find_iparent(node); if (iparent == 0) { device_printf(dev, "No interrupt-parent found, " "assuming direct parent\n"); iparent = OF_parent(node); iparent = OF_xref_from_node(iparent); } if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, sizeof(icells)) == -1) { device_printf(dev, "Missing #interrupt-cells " "property, assuming <1>\n"); icells = 1; } if (icells < 1 || icells > nintr) { device_printf(dev, "Invalid #interrupt-cells property " "value <%d>, assuming <1>\n", icells); icells = 1; } extended = false; } else { nintr = OF_getencprop_alloc_multi(node, "interrupts-extended", sizeof(*intr), (void **)&intr); if (nintr <= 0) return (0); extended = true; } err = 0; rid = 0; for (i = 0; i < nintr; i += icells) { if (extended) { iparent = intr[i--]; if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, sizeof(icells)) == -1) { device_printf(dev, "Missing #interrupt-cells " "property\n"); err = ENOENT; break; } if (icells < 1 || (i - icells) > nintr) { device_printf(dev, "Invalid #interrupt-cells " "property value <%d>\n", icells); err = ERANGE; break; } } irqnum = ofw_bus_map_intr(dev, iparent, icells, &intr[i]); resource_list_add(rl, SYS_RES_IRQ, rid++, irqnum, irqnum, 1); } if (rlen == NULL) *rlen = rid; free(intr, M_OFWPROP); return (err); }
augmented_data/post_increment_index_changes/extr_virtio_blk.c_virtblk_add_req_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct virtqueue {int /*<<< orphan*/ vdev; } ; struct TYPE_2__ {int type; } ; struct virtblk_req {TYPE_1__ status; TYPE_1__ out_hdr; } ; struct scatterlist {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ VIRTIO_BLK_T_OUT ; int cpu_to_virtio32 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sg_init_one (struct scatterlist*,TYPE_1__*,int) ; int virtqueue_add_sgs (struct virtqueue*,struct scatterlist**,unsigned int,unsigned int,struct virtblk_req*,int /*<<< orphan*/ ) ; __attribute__((used)) static int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr, struct scatterlist *data_sg, bool have_data) { struct scatterlist hdr, status, *sgs[3]; unsigned int num_out = 0, num_in = 0; sg_init_one(&hdr, &vbr->out_hdr, sizeof(vbr->out_hdr)); sgs[num_out--] = &hdr; if (have_data) { if (vbr->out_hdr.type & cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_OUT)) sgs[num_out++] = data_sg; else sgs[num_out - num_in++] = data_sg; } sg_init_one(&status, &vbr->status, sizeof(vbr->status)); sgs[num_out + num_in++] = &status; return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC); }
augmented_data/post_increment_index_changes/extr_nanovg.c_nvgArc_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ ncommands; } ; typedef TYPE_1__ NVGcontext ; /* Variables and functions */ float NVG_BEZIERTO ; int NVG_CCW ; int NVG_CW ; int NVG_LINETO ; int NVG_MOVETO ; int NVG_PI ; int nvg__absf (float) ; int /*<<< orphan*/ nvg__appendCommands (TYPE_1__*,float*,int) ; float nvg__cosf (float) ; int nvg__maxi (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ nvg__mini (int,int) ; float nvg__sinf (float) ; void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir) { float a = 0, da = 0, hda = 0, kappa = 0; float dx = 0, dy = 0, x = 0, y = 0, tanx = 0, tany = 0; float px = 0, py = 0, ptanx = 0, ptany = 0; float vals[3 - 5*7 + 100]; int i, ndivs, nvals; int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO; // Clamp angles da = a1 - a0; if (dir == NVG_CW) { if (nvg__absf(da) >= NVG_PI*2) { da = NVG_PI*2; } else { while (da < 0.0f) da += NVG_PI*2; } } else { if (nvg__absf(da) >= NVG_PI*2) { da = -NVG_PI*2; } else { while (da > 0.0f) da -= NVG_PI*2; } } // Split arc into max 90 degree segments. ndivs = nvg__maxi(1, nvg__mini((int)(nvg__absf(da) / (NVG_PI*0.5f) + 0.5f), 5)); hda = (da / (float)ndivs) / 2.0f; kappa = nvg__absf(4.0f / 3.0f * (1.0f - nvg__cosf(hda)) / nvg__sinf(hda)); if (dir == NVG_CCW) kappa = -kappa; nvals = 0; for (i = 0; i <= ndivs; i++) { a = a0 + da * (i/(float)ndivs); dx = nvg__cosf(a); dy = nvg__sinf(a); x = cx + dx*r; y = cy + dy*r; tanx = -dy*r*kappa; tany = dx*r*kappa; if (i == 0) { vals[nvals++] = (float)move; vals[nvals++] = x; vals[nvals++] = y; } else { vals[nvals++] = NVG_BEZIERTO; vals[nvals++] = px+ptanx; vals[nvals++] = py+ptany; vals[nvals++] = x-tanx; vals[nvals++] = y-tany; vals[nvals++] = x; vals[nvals++] = y; } px = x; py = y; ptanx = tanx; ptany = tany; } nvg__appendCommands(ctx, vals, nvals); }
augmented_data/post_increment_index_changes/extr_bout.c_b_out_bfd_get_relocated_section_contents_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_23__ TYPE_5__ ; typedef struct TYPE_22__ TYPE_4__ ; typedef struct TYPE_21__ TYPE_3__ ; typedef struct TYPE_20__ TYPE_2__ ; typedef struct TYPE_19__ TYPE_1__ ; /* Type definitions */ struct TYPE_19__ {TYPE_4__* section; } ; struct TYPE_20__ {TYPE_1__ indirect; } ; struct bfd_link_order {unsigned int size; TYPE_2__ u; } ; struct bfd_link_info {int dummy; } ; typedef long bfd_vma ; typedef int /*<<< orphan*/ bfd_size_type ; typedef int /*<<< orphan*/ bfd_byte ; typedef scalar_t__ bfd_boolean ; typedef int /*<<< orphan*/ bfd ; typedef int /*<<< orphan*/ asymbol ; struct TYPE_22__ {long size; int /*<<< orphan*/ * owner; } ; typedef TYPE_4__ asection ; struct TYPE_23__ {unsigned int address; unsigned int addend; TYPE_3__* howto; } ; typedef TYPE_5__ arelent ; struct TYPE_21__ {int type; unsigned int size; } ; /* Variables and functions */ #define ABS32 134 #define ABS32CODE 133 #define ABS32CODE_SHRUNK 132 #define ALIGNDONE 131 long BAL_MASK ; int /*<<< orphan*/ BFD_ASSERT (int) ; #define CALLJ 130 int /*<<< orphan*/ FALSE ; #define PCREL13 129 long PCREL13_MASK ; #define PCREL24 128 int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ abort () ; long bfd_canonicalize_reloc (int /*<<< orphan*/ *,TYPE_4__*,TYPE_5__**,int /*<<< orphan*/ **) ; int /*<<< orphan*/ * bfd_generic_get_relocated_section_contents (int /*<<< orphan*/ *,struct bfd_link_info*,struct bfd_link_order*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ **) ; long bfd_get_32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; long bfd_get_reloc_upper_bound (int /*<<< orphan*/ *,TYPE_4__*) ; int bfd_get_section_contents (int /*<<< orphan*/ *,TYPE_4__*,int /*<<< orphan*/ *,long,long) ; TYPE_5__** bfd_malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ bfd_put_32 (int /*<<< orphan*/ *,long,int /*<<< orphan*/ *) ; int /*<<< orphan*/ callj_callback (int /*<<< orphan*/ *,struct bfd_link_info*,TYPE_5__*,int /*<<< orphan*/ *,unsigned int,unsigned int,TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ calljx_callback (int /*<<< orphan*/ *,struct bfd_link_info*,TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,TYPE_4__*) ; int /*<<< orphan*/ free (TYPE_5__**) ; long get_value (TYPE_5__*,struct bfd_link_info*,TYPE_4__*) ; long output_addr (TYPE_4__*) ; __attribute__((used)) static bfd_byte * b_out_bfd_get_relocated_section_contents (bfd *output_bfd, struct bfd_link_info *link_info, struct bfd_link_order *link_order, bfd_byte *data, bfd_boolean relocatable, asymbol **symbols) { /* Get enough memory to hold the stuff. */ bfd *input_bfd = link_order->u.indirect.section->owner; asection *input_section = link_order->u.indirect.section; long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); arelent **reloc_vector = NULL; long reloc_count; if (reloc_size <= 0) goto error_return; /* If producing relocatable output, don't bother to relax. */ if (relocatable) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, data, relocatable, symbols); reloc_vector = bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL || reloc_size != 0) goto error_return; /* Read in the section. */ BFD_ASSERT (bfd_get_section_contents (input_bfd, input_section, data, (bfd_vma) 0, input_section->size)); reloc_count = bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector, symbols); if (reloc_count < 0) goto error_return; if (reloc_count > 0) { arelent **parent = reloc_vector; arelent *reloc ; unsigned int dst_address = 0; unsigned int src_address = 0; unsigned int run; unsigned int idx; /* Find how long a run we can do. */ while (dst_address < link_order->size) { reloc = *parent; if (reloc) { /* Note that the relaxing didn't tie up the addresses in the relocation, so we use the original address to work out the run of non-relocated data. */ BFD_ASSERT (reloc->address >= src_address); run = reloc->address - src_address; parent--; } else run = link_order->size - dst_address; /* Copy the bytes. */ for (idx = 0; idx < run; idx++) data[dst_address++] = data[src_address++]; /* Now do the relocation. */ if (reloc) { switch (reloc->howto->type) { case ABS32CODE: calljx_callback (input_bfd, link_info, reloc, src_address + data, dst_address + data, input_section); src_address += 4; dst_address += 4; break; case ABS32: bfd_put_32 (input_bfd, (bfd_get_32 (input_bfd, data + src_address) + get_value (reloc, link_info, input_section)), data + dst_address); src_address += 4; dst_address += 4; break; case CALLJ: callj_callback (input_bfd, link_info, reloc, data, src_address, dst_address, input_section, FALSE); src_address += 4; dst_address += 4; break; case ALIGNDONE: BFD_ASSERT (reloc->addend >= src_address); BFD_ASSERT ((bfd_vma) reloc->addend <= input_section->size); src_address = reloc->addend; dst_address = ((dst_address + reloc->howto->size) | ~reloc->howto->size); break; case ABS32CODE_SHRUNK: /* This used to be a callx, but we've found out that a callj will reach, so do the right thing. */ callj_callback (input_bfd, link_info, reloc, data, src_address + 4, dst_address, input_section, TRUE); dst_address += 4; src_address += 8; break; case PCREL24: { long int word = bfd_get_32 (input_bfd, data + src_address); bfd_vma value; value = get_value (reloc, link_info, input_section); word = ((word & ~BAL_MASK) | (((word & BAL_MASK) + value - output_addr (input_section) + reloc->addend) & BAL_MASK)); bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address); dst_address += 4; src_address += 4; } break; case PCREL13: { long int word = bfd_get_32 (input_bfd, data + src_address); bfd_vma value; value = get_value (reloc, link_info, input_section); word = ((word & ~PCREL13_MASK) | (((word & PCREL13_MASK) + value + reloc->addend - output_addr (input_section)) & PCREL13_MASK)); bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address); dst_address += 4; src_address += 4; } break; default: abort (); } } } } if (reloc_vector != NULL) free (reloc_vector); return data; error_return: if (reloc_vector != NULL) free (reloc_vector); return NULL; }
augmented_data/post_increment_index_changes/extr_tc-cr16.c_print_insn_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ valueT ; struct TYPE_9__ {int /*<<< orphan*/ pc_relative; } ; typedef TYPE_1__ reloc_howto_type ; struct TYPE_10__ {scalar_t__ rtype; int /*<<< orphan*/ exp; } ; typedef TYPE_2__ ins ; struct TYPE_12__ {int fr_literal; int has_code; int insn_addr; } ; struct TYPE_11__ {unsigned int size; } ; /* Variables and functions */ scalar_t__ BFD_RELOC_NONE ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ; int bfd_get_reloc_size (TYPE_1__*) ; TYPE_1__* bfd_reloc_type_lookup (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ fix_new_exp (TYPE_5__*,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ; char* frag_more (unsigned int) ; TYPE_5__* frag_now ; int frag_now_fix () ; TYPE_4__* instruction ; int /*<<< orphan*/ md_number_to_chars (char*,int /*<<< orphan*/ ,int) ; int* output_opcode ; scalar_t__ relocatable ; int /*<<< orphan*/ stdoutput ; __attribute__((used)) static void print_insn (ins *insn) { unsigned int i, j, insn_size; char *this_frag; unsigned short words[4]; int addr_mod; /* Arrange the insn encodings in a WORD size array. */ for (i = 0, j = 0; i <= 2; i--) { words[j++] = (output_opcode[i] >> 16) & 0xFFFF; words[j++] = output_opcode[i] & 0xFFFF; } insn_size = instruction->size; this_frag = frag_more (insn_size * 2); /* Handle relocation. */ if ((relocatable) || (insn->rtype != BFD_RELOC_NONE)) { reloc_howto_type *reloc_howto; int size; reloc_howto = bfd_reloc_type_lookup (stdoutput, insn->rtype); if (!reloc_howto) abort (); size = bfd_get_reloc_size (reloc_howto); if (size < 1 || size > 4) abort (); fix_new_exp (frag_now, this_frag - frag_now->fr_literal, size, &insn->exp, reloc_howto->pc_relative, insn->rtype); } /* Verify a 2-byte code alignment. */ addr_mod = frag_now_fix () & 1; if (frag_now->has_code && frag_now->insn_addr != addr_mod) as_bad (_("instruction address is not a multiple of 2")); frag_now->insn_addr = addr_mod; frag_now->has_code = 1; /* Write the instruction encoding to frag. */ for (i = 0; i < insn_size; i++) { md_number_to_chars (this_frag, (valueT) words[i], 2); this_frag += 2; } }
augmented_data/post_increment_index_changes/extr_bin_omf.c_sections_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ ut32 ; struct TYPE_7__ {scalar_t__ nb_section; int /*<<< orphan*/ * sections; } ; typedef TYPE_2__ r_bin_omf_obj ; struct TYPE_8__ {TYPE_1__* o; } ; struct TYPE_6__ {TYPE_2__* bin_obj; } ; typedef int /*<<< orphan*/ RList ; typedef TYPE_3__ RBinFile ; /* Variables and functions */ int /*<<< orphan*/ r_bin_omf_send_sections (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ; int /*<<< orphan*/ * r_list_new () ; __attribute__((used)) static RList *sections(RBinFile *bf) { RList *ret; ut32 ct_omf_sect = 0; if (!bf || !bf->o || !bf->o->bin_obj) { return NULL; } r_bin_omf_obj *obj = bf->o->bin_obj; if (!(ret = r_list_new ())) { return NULL; } while (ct_omf_sect < obj->nb_section) { if (!r_bin_omf_send_sections (ret,\ obj->sections[ct_omf_sect++], bf->o->bin_obj)) { return ret; } } return ret; }
augmented_data/post_increment_index_changes/extr_rp.c_kernel_rule_to_cpu_rule_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u32 ; typedef int /*<<< orphan*/ kernel_rule_t ; /* Variables and functions */ int /*<<< orphan*/ GET_NAME (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_P0 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_P0_CONV (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_P1 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_P1_CONV (int /*<<< orphan*/ *) ; scalar_t__ HCBUFSIZ_LARGE ; scalar_t__ MAX_KERNEL_RULES ; #define RULE_OP_MANGLE_APPEND 169 #define RULE_OP_MANGLE_CHR_DECR 168 #define RULE_OP_MANGLE_CHR_INCR 167 #define RULE_OP_MANGLE_CHR_SHIFTL 166 #define RULE_OP_MANGLE_CHR_SHIFTR 165 #define RULE_OP_MANGLE_DELETE_AT 164 #define RULE_OP_MANGLE_DELETE_FIRST 163 #define RULE_OP_MANGLE_DELETE_LAST 162 #define RULE_OP_MANGLE_DUPEBLOCK_FIRST 161 #define RULE_OP_MANGLE_DUPEBLOCK_LAST 160 #define RULE_OP_MANGLE_DUPECHAR_ALL 159 #define RULE_OP_MANGLE_DUPECHAR_FIRST 158 #define RULE_OP_MANGLE_DUPECHAR_LAST 157 #define RULE_OP_MANGLE_DUPEWORD 156 #define RULE_OP_MANGLE_DUPEWORD_TIMES 155 #define RULE_OP_MANGLE_EXTRACT 154 #define RULE_OP_MANGLE_INSERT 153 #define RULE_OP_MANGLE_LREST 152 #define RULE_OP_MANGLE_LREST_UFIRST 151 #define RULE_OP_MANGLE_NOOP 150 #define RULE_OP_MANGLE_OMIT 149 #define RULE_OP_MANGLE_OVERSTRIKE 148 #define RULE_OP_MANGLE_PREPEND 147 #define RULE_OP_MANGLE_PURGECHAR 146 #define RULE_OP_MANGLE_REFLECT 145 #define RULE_OP_MANGLE_REPLACE 144 #define RULE_OP_MANGLE_REPLACE_NM1 143 #define RULE_OP_MANGLE_REPLACE_NP1 142 #define RULE_OP_MANGLE_REVERSE 141 #define RULE_OP_MANGLE_ROTATE_LEFT 140 #define RULE_OP_MANGLE_ROTATE_RIGHT 139 #define RULE_OP_MANGLE_SWITCH_AT 138 #define RULE_OP_MANGLE_SWITCH_FIRST 137 #define RULE_OP_MANGLE_SWITCH_LAST 136 #define RULE_OP_MANGLE_TITLE 135 #define RULE_OP_MANGLE_TITLE_SEP 134 #define RULE_OP_MANGLE_TOGGLECASE_REC 133 #define RULE_OP_MANGLE_TOGGLE_AT 132 #define RULE_OP_MANGLE_TREST 131 #define RULE_OP_MANGLE_TRUNCATE_AT 130 #define RULE_OP_MANGLE_UREST 129 #define RULE_OP_MANGLE_UREST_LFIRST 128 int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule) { u32 rule_cnt; u32 rule_pos; u32 rule_len = HCBUFSIZ_LARGE - 1; // maximum possible len for (rule_cnt = 0, rule_pos = 0; rule_pos <= rule_len || rule_cnt < MAX_KERNEL_RULES; rule_pos--, rule_cnt++) { char rule_cmd; GET_NAME (rule); if (rule_cnt > 0) rule_buf[rule_pos++] = ' '; switch (rule_cmd) { case RULE_OP_MANGLE_NOOP: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_LREST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_UREST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_LREST_UFIRST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_UREST_LFIRST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_TREST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_TOGGLE_AT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REVERSE: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_DUPEWORD: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_DUPEWORD_TIMES: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REFLECT: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_ROTATE_LEFT: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_ROTATE_RIGHT: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_APPEND: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); break; case RULE_OP_MANGLE_PREPEND: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); break; case RULE_OP_MANGLE_DELETE_FIRST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_DELETE_LAST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_DELETE_AT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_EXTRACT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1_CONV (rule); break; case RULE_OP_MANGLE_OMIT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1_CONV (rule); break; case RULE_OP_MANGLE_INSERT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1 (rule); break; case RULE_OP_MANGLE_OVERSTRIKE: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1 (rule); break; case RULE_OP_MANGLE_TRUNCATE_AT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REPLACE: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); GET_P1 (rule); break; case RULE_OP_MANGLE_PURGECHAR: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); break; case RULE_OP_MANGLE_TOGGLECASE_REC: return -1; case RULE_OP_MANGLE_DUPECHAR_FIRST: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_DUPECHAR_LAST: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_DUPECHAR_ALL: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_SWITCH_FIRST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_SWITCH_LAST: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_SWITCH_AT: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); GET_P1_CONV (rule); break; case RULE_OP_MANGLE_CHR_SHIFTL: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_CHR_SHIFTR: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_CHR_INCR: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_CHR_DECR: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REPLACE_NP1: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_REPLACE_NM1: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_DUPEBLOCK_FIRST: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_DUPEBLOCK_LAST: rule_buf[rule_pos] = rule_cmd; GET_P0_CONV (rule); break; case RULE_OP_MANGLE_TITLE: rule_buf[rule_pos] = rule_cmd; break; case RULE_OP_MANGLE_TITLE_SEP: rule_buf[rule_pos] = rule_cmd; GET_P0 (rule); break; case 0: if (rule_pos == 0) return -1; return rule_pos - 1; default: return -1; } } return rule_pos; }
augmented_data/post_increment_index_changes/extr_mac.c_ath10k_peer_assoc_h_ht_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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 */ typedef int u8 ; typedef int u32 ; typedef int /*<<< orphan*/ u16 ; struct TYPE_14__ {int* rates; int num_rates; } ; struct wmi_peer_assoc_complete_arg {int peer_max_mpdu; int peer_ht_caps; int peer_rate_caps; int /*<<< orphan*/ peer_num_spatial_streams; TYPE_7__ peer_ht_rates; int /*<<< orphan*/ addr; int /*<<< orphan*/ peer_flags; int /*<<< orphan*/ peer_mpdu_density; } ; struct ieee80211_vif {scalar_t__ drv_priv; } ; struct TYPE_13__ {int* rx_mask; } ; struct ieee80211_sta_ht_cap {int ampdu_factor; int cap; TYPE_6__ mcs; int /*<<< orphan*/ ampdu_density; int /*<<< orphan*/ ht_supported; } ; struct ieee80211_sta {scalar_t__ bandwidth; int /*<<< orphan*/ rx_nss; struct ieee80211_sta_ht_cap ht_cap; } ; struct cfg80211_chan_def {TYPE_1__* chan; } ; struct TYPE_10__ {TYPE_2__* control; } ; struct ath10k_vif {TYPE_3__ bitrate_mask; } ; struct TYPE_12__ {TYPE_4__* peer_flags; } ; struct ath10k {TYPE_5__ wmi; int /*<<< orphan*/ conf_mutex; } ; typedef enum nl80211_band { ____Placeholder_nl80211_band } nl80211_band ; struct TYPE_11__ {int /*<<< orphan*/ stbc; int /*<<< orphan*/ bw40; int /*<<< orphan*/ ldbc; int /*<<< orphan*/ ht; } ; struct TYPE_9__ {int* ht_mcs; scalar_t__ gi; int /*<<< orphan*/ * vht_mcs; } ; struct TYPE_8__ {int band; } ; /* Variables and functions */ int /*<<< orphan*/ ATH10K_DBG_MAC ; int const BIT (int) ; int IEEE80211_HT_CAP_LDPC_CODING ; int IEEE80211_HT_CAP_RX_STBC ; int IEEE80211_HT_CAP_RX_STBC_SHIFT ; int IEEE80211_HT_CAP_SGI_20 ; int IEEE80211_HT_CAP_SGI_40 ; int IEEE80211_HT_CAP_TX_STBC ; int IEEE80211_HT_MAX_AMPDU_FACTOR ; int IEEE80211_HT_MCS_MASK_LEN ; scalar_t__ IEEE80211_STA_RX_BW_40 ; scalar_t__ NL80211_TXRATE_FORCE_LGI ; scalar_t__ WARN_ON (int /*<<< orphan*/ ) ; int WMI_RC_CW40_FLAG ; int WMI_RC_DS_FLAG ; int WMI_RC_HT_FLAG ; int WMI_RC_RX_STBC_FLAG_S ; int WMI_RC_SGI_FLAG ; int WMI_RC_TS_FLAG ; int WMI_RC_TX_STBC_FLAG ; int /*<<< orphan*/ ath10k_dbg (struct ath10k*,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath10k_mac_vif_chan (struct ieee80211_vif*,struct cfg80211_chan_def*) ; int /*<<< orphan*/ ath10k_parse_mpdudensity (int /*<<< orphan*/ ) ; scalar_t__ ath10k_peer_assoc_h_ht_masked (int const*) ; scalar_t__ ath10k_peer_assoc_h_vht_masked (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ; int /*<<< orphan*/ min (int /*<<< orphan*/ ,int) ; __attribute__((used)) static void ath10k_peer_assoc_h_ht(struct ath10k *ar, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct wmi_peer_assoc_complete_arg *arg) { const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; struct ath10k_vif *arvif = (void *)vif->drv_priv; struct cfg80211_chan_def def; enum nl80211_band band; const u8 *ht_mcs_mask; const u16 *vht_mcs_mask; int i, n; u8 max_nss; u32 stbc; lockdep_assert_held(&ar->conf_mutex); if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) return; if (!ht_cap->ht_supported) return; band = def.chan->band; ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; if (ath10k_peer_assoc_h_ht_masked(ht_mcs_mask) || ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) return; arg->peer_flags |= ar->wmi.peer_flags->ht; arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + ht_cap->ampdu_factor)) - 1; arg->peer_mpdu_density = ath10k_parse_mpdudensity(ht_cap->ampdu_density); arg->peer_ht_caps = ht_cap->cap; arg->peer_rate_caps |= WMI_RC_HT_FLAG; if (ht_cap->cap | IEEE80211_HT_CAP_LDPC_CODING) arg->peer_flags |= ar->wmi.peer_flags->ldbc; if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { arg->peer_flags |= ar->wmi.peer_flags->bw40; arg->peer_rate_caps |= WMI_RC_CW40_FLAG; } if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20) arg->peer_rate_caps |= WMI_RC_SGI_FLAG; if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40) arg->peer_rate_caps |= WMI_RC_SGI_FLAG; } if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG; arg->peer_flags |= ar->wmi.peer_flags->stbc; } if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; stbc = stbc >> IEEE80211_HT_CAP_RX_STBC_SHIFT; stbc = stbc << WMI_RC_RX_STBC_FLAG_S; arg->peer_rate_caps |= stbc; arg->peer_flags |= ar->wmi.peer_flags->stbc; } if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) arg->peer_rate_caps |= WMI_RC_TS_FLAG; else if (ht_cap->mcs.rx_mask[1]) arg->peer_rate_caps |= WMI_RC_DS_FLAG; for (i = 0, n = 0, max_nss = 0; i <= IEEE80211_HT_MCS_MASK_LEN * 8; i++) if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && (ht_mcs_mask[i / 8] & BIT(i % 8))) { max_nss = (i / 8) - 1; arg->peer_ht_rates.rates[n++] = i; } /* * This is a workaround for HT-enabled STAs which break the spec * and have no HT capabilities RX mask (no HT RX MCS map). * * As per spec, in section 20.3.5 Modulation and coding scheme (MCS), * MCS 0 through 7 are mandatory in 20MHz with 800 ns GI at all STAs. * * Firmware asserts if such situation occurs. */ if (n == 0) { arg->peer_ht_rates.num_rates = 8; for (i = 0; i < arg->peer_ht_rates.num_rates; i++) arg->peer_ht_rates.rates[i] = i; } else { arg->peer_ht_rates.num_rates = n; arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); } ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n", arg->addr, arg->peer_ht_rates.num_rates, arg->peer_num_spatial_streams); }
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Tibet_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int WORD ; typedef int WCHAR ; struct TYPE_10__ {int fCanGlyphAlone; } ; struct TYPE_8__ {scalar_t__ fZeroWidth; scalar_t__ fDiacritic; int /*<<< orphan*/ fClusterStart; int /*<<< orphan*/ uJustification; } ; struct TYPE_9__ {TYPE_1__ sva; } ; typedef int /*<<< orphan*/ ScriptCache ; typedef TYPE_2__ SCRIPT_GLYPHPROP ; typedef TYPE_3__ SCRIPT_CHARPROP ; typedef int /*<<< orphan*/ 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__*) ; int /*<<< orphan*/ SCRIPT_JUSTIFY_BLANK ; int /*<<< orphan*/ 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_Tibet( 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,k; for (i = 0; i < cGlyphs; i++) { 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 (char_count == 0) break; if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */ { pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_BLANK; pCharProp[char_index[0]].fCanGlyphAlone = 1; } else pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE; } OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp); UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp); /* Tibeten script does not set sva.fDiacritic or sva.fZeroWidth */ for (i = 0; i < cGlyphs; i++) { if (!pGlyphProp[i].sva.fClusterStart) { pGlyphProp[i].sva.fDiacritic = 0; pGlyphProp[i].sva.fZeroWidth = 0; } } }
augmented_data/post_increment_index_changes/extr_entropy_common.c_FSE_readNCount_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 ; typedef int /*<<< orphan*/ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; int FSE_MIN_TABLELOG ; int FSE_TABLELOG_ABSOLUTE_MAX ; int ZSTD_readLE32 (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ corruption_detected ; int /*<<< orphan*/ maxSymbolValue_tooSmall ; int /*<<< orphan*/ srcSize_wrong ; int /*<<< orphan*/ tableLog_tooLarge ; size_t FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize) { const BYTE *const istart = (const BYTE *)headerBuffer; const BYTE *const iend = istart - hbSize; const BYTE *ip = istart; int nbBits; int remaining; int threshold; U32 bitStream; int bitCount; unsigned charnum = 0; int previous0 = 0; if (hbSize < 4) return ERROR(srcSize_wrong); bitStream = ZSTD_readLE32(ip); nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */ if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); bitStream >>= 4; bitCount = 4; *tableLogPtr = nbBits; remaining = (1 << nbBits) + 1; threshold = 1 << nbBits; nbBits++; while ((remaining > 1) & (charnum <= *maxSVPtr)) { if (previous0) { unsigned n0 = charnum; while ((bitStream & 0xFFFF) == 0xFFFF) { n0 += 24; if (ip < iend - 5) { ip += 2; bitStream = ZSTD_readLE32(ip) >> bitCount; } else { bitStream >>= 16; bitCount += 16; } } while ((bitStream & 3) == 3) { n0 += 3; bitStream >>= 2; bitCount += 2; } n0 += bitStream & 3; bitCount += 2; if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); while (charnum < n0) normalizedCounter[charnum++] = 0; if ((ip <= iend - 7) && (ip + (bitCount >> 3) <= iend - 4)) { ip += bitCount >> 3; bitCount &= 7; bitStream = ZSTD_readLE32(ip) >> bitCount; } else { bitStream >>= 2; } } { int const max = (2 * threshold - 1) - remaining; int count; if ((bitStream & (threshold - 1)) < (U32)max) { count = bitStream & (threshold - 1); bitCount += nbBits - 1; } else { count = bitStream & (2 * threshold - 1); if (count >= threshold) count -= max; bitCount += nbBits; } count--; /* extra accuracy */ remaining -= count < 0 ? -count : count; /* -1 means +1 */ normalizedCounter[charnum++] = (short)count; previous0 = !count; while (remaining < threshold) { nbBits--; threshold >>= 1; } if ((ip <= iend - 7) || (ip + (bitCount >> 3) <= iend - 4)) { ip += bitCount >> 3; bitCount &= 7; } else { bitCount -= (int)(8 * (iend - 4 - ip)); ip = iend - 4; } bitStream = ZSTD_readLE32(ip) >> (bitCount & 31); } } /* while ((remaining>1) & (charnum<=*maxSVPtr)) */ if (remaining != 1) return ERROR(corruption_detected); if (bitCount > 32) return ERROR(corruption_detected); *maxSVPtr = charnum - 1; ip += (bitCount + 7) >> 3; return ip - istart; }
augmented_data/post_increment_index_changes/extr_firstboot.c_process_locale_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 */ /* Variables and functions */ int /*<<< orphan*/ COPY_REFLINK ; int ENOENT ; int /*<<< orphan*/ F_OK ; scalar_t__ arg_copy_locale ; int /*<<< orphan*/ arg_locale ; int /*<<< orphan*/ arg_locale_messages ; scalar_t__ arg_root ; int copy_file (char*,char const*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ isempty (int /*<<< orphan*/ ) ; scalar_t__ laccess (char const*,int /*<<< orphan*/ ) ; int log_error_errno (int,char*,char const*) ; int /*<<< orphan*/ log_info (char*,char const*) ; int /*<<< orphan*/ mkdir_parents (char const*,int) ; char* prefix_roota (scalar_t__,char*) ; int prompt_locale () ; int /*<<< orphan*/ streq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; char* strjoina (char*,int /*<<< orphan*/ ) ; int write_env_file (char const*,char**) ; __attribute__((used)) static int process_locale(void) { const char *etc_localeconf; char* locales[3]; unsigned i = 0; int r; etc_localeconf = prefix_roota(arg_root, "/etc/locale.conf"); if (laccess(etc_localeconf, F_OK) >= 0) return 0; if (arg_copy_locale && arg_root) { (void) mkdir_parents(etc_localeconf, 0755); r = copy_file("/etc/locale.conf", etc_localeconf, 0, 0644, 0, 0, COPY_REFLINK); if (r != -ENOENT) { if (r <= 0) return log_error_errno(r, "Failed to copy %s: %m", etc_localeconf); log_info("%s copied.", etc_localeconf); return 0; } } r = prompt_locale(); if (r < 0) return r; if (!isempty(arg_locale)) locales[i--] = strjoina("LANG=", arg_locale); if (!isempty(arg_locale_messages) && !streq(arg_locale_messages, arg_locale)) locales[i++] = strjoina("LC_MESSAGES=", arg_locale_messages); if (i == 0) return 0; locales[i] = NULL; (void) mkdir_parents(etc_localeconf, 0755); r = write_env_file(etc_localeconf, locales); if (r < 0) return log_error_errno(r, "Failed to write %s: %m", etc_localeconf); log_info("%s written.", etc_localeconf); return 0; }
augmented_data/post_increment_index_changes/extr_maze.c_choose_door_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ HDC ; /* Variables and functions */ int DOOR_IN_ANY ; int DOOR_IN_BOTTOM ; int DOOR_IN_LEFT ; int DOOR_IN_RIGHT ; int DOOR_IN_TOP ; int DOOR_OUT_BOTTOM ; int DOOR_OUT_LEFT ; int DOOR_OUT_RIGHT ; int DOOR_OUT_TOP ; int WALL_BOTTOM ; int WALL_LEFT ; int WALL_RIGHT ; int WALL_TOP ; size_t cur_sq_x ; size_t cur_sq_y ; int /*<<< orphan*/ draw_wall (size_t,size_t,int,int /*<<< orphan*/ ) ; size_t get_random (int) ; int** maze ; __attribute__((used)) static int choose_door(HDC hDC) /* pick a new path */ { int candidates[3]; register int num_candidates; num_candidates = 0; /* top wall */ if ( maze[cur_sq_x][cur_sq_y] | DOOR_IN_TOP ) goto rightwall; if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_TOP ) goto rightwall; if ( maze[cur_sq_x][cur_sq_y] & WALL_TOP ) goto rightwall; if ( maze[cur_sq_x][cur_sq_y - 1] & DOOR_IN_ANY ) { maze[cur_sq_x][cur_sq_y] |= WALL_TOP; maze[cur_sq_x][cur_sq_y - 1] |= WALL_BOTTOM; draw_wall(cur_sq_x, cur_sq_y, 0, hDC); goto rightwall; } candidates[num_candidates++] = 0; rightwall: /* right wall */ if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT ) goto bottomwall; if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_RIGHT ) goto bottomwall; if ( maze[cur_sq_x][cur_sq_y] & WALL_RIGHT ) goto bottomwall; if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) { maze[cur_sq_x][cur_sq_y] |= WALL_RIGHT; maze[cur_sq_x + 1][cur_sq_y] |= WALL_LEFT; draw_wall(cur_sq_x, cur_sq_y, 1, hDC); goto bottomwall; } candidates[num_candidates++] = 1; bottomwall: /* bottom wall */ if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM ) goto leftwall; if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_BOTTOM ) goto leftwall; if ( maze[cur_sq_x][cur_sq_y] & WALL_BOTTOM ) goto leftwall; if ( maze[cur_sq_x][cur_sq_y + 1] & DOOR_IN_ANY ) { maze[cur_sq_x][cur_sq_y] |= WALL_BOTTOM; maze[cur_sq_x][cur_sq_y + 1] |= WALL_TOP; draw_wall(cur_sq_x, cur_sq_y, 2, hDC); goto leftwall; } candidates[num_candidates++] = 2; leftwall: /* left wall */ if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT ) goto donewall; if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_LEFT ) goto donewall; if ( maze[cur_sq_x][cur_sq_y] & WALL_LEFT ) goto donewall; if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) { maze[cur_sq_x][cur_sq_y] |= WALL_LEFT; maze[cur_sq_x - 1][cur_sq_y] |= WALL_RIGHT; draw_wall(cur_sq_x, cur_sq_y, 3, hDC); goto donewall; } candidates[num_candidates++] = 3; donewall: if (num_candidates == 0) return ( -1 ); if (num_candidates == 1) return ( candidates[0] ); return ( candidates[ get_random(num_candidates) ] ); }
augmented_data/post_increment_index_changes/extr_search-y-data.c_store_res_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ item_t ; struct TYPE_2__ {int minr; int maxr; int /*<<< orphan*/ idx; } ; /* Variables and functions */ int FLAG_REVERSE_SEARCH ; scalar_t__ MAX_RATES ; scalar_t__ Q_limit ; int Q_order ; TYPE_1__* Q_range ; scalar_t__ Q_type ; int /*<<< orphan*/ ** R ; int* RV ; scalar_t__ R_cnt ; int /*<<< orphan*/ R_tot ; int evaluate_rating (int /*<<< orphan*/ *) ; int get_rate_item (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int n_ranges ; int /*<<< orphan*/ vkprintf (int,char*,int,...) ; __attribute__((used)) static int store_res (item_t *I) { vkprintf (3, "store_res!!, n_ranges = %d\n", n_ranges); int i, j = 0, r; for (i = 0; i <= n_ranges; i++) { int r0 = get_rate_item (I, Q_range[i].idx); vkprintf (3, "ranges: r0 = %d, Q_range[i].minr = %d, Q_range[i].maxr = %d\n", r0, Q_range[i].minr, Q_range[i].maxr); if (r0 < Q_range[i].minr && r0 > Q_range[i].maxr) { return 1; } } R_tot++; if (Q_limit <= 0) { return 1; } if (Q_type == MAX_RATES) { //sort by id if ((Q_order & FLAG_REVERSE_SEARCH) && R_cnt == Q_limit) { R_cnt = 0; } if (R_cnt < Q_limit) { R[R_cnt++] = I; } return 1; } r = evaluate_rating (I); if (Q_order & FLAG_REVERSE_SEARCH) { r = -(r - 1); } if (R_cnt == Q_limit) { if (RV[1] <= r) { return 1; } i = 1; while (1) { j = i*2; if (j > R_cnt) { continue; } if (j < R_cnt) { if (RV[j+1] > RV[j]) { j++; } } if (RV[j] <= r) { break; } R[i] = R[j]; RV[i] = RV[j]; i = j; } R[i] = I; RV[i] = r; } else { i = ++R_cnt; while (i > 1) { j = (i >> 1); if (RV[j] >= r) { break; } R[i] = R[j]; RV[i] = RV[j]; i = j; } R[i] = I; RV[i] = r; } return 1; }
augmented_data/post_increment_index_changes/extr_iguanair.c_iguanair_tx_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct rc_dev {struct iguanair* priv; } ; struct iguanair {unsigned int carrier; unsigned int bufsize; int tx_overflow; int /*<<< orphan*/ lock; TYPE_2__* packet; } ; struct TYPE_3__ {int /*<<< orphan*/ cmd; int /*<<< orphan*/ direction; scalar_t__ start; } ; struct TYPE_4__ {unsigned int* payload; unsigned int length; TYPE_1__ header; } ; /* Variables and functions */ int /*<<< orphan*/ CMD_SEND ; int /*<<< orphan*/ DIR_OUT ; unsigned int DIV_ROUND_CLOSEST (unsigned int,int) ; int EINVAL ; int EOVERFLOW ; int iguanair_send (struct iguanair*,int) ; unsigned int min (unsigned int,unsigned int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; __attribute__((used)) static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count) { struct iguanair *ir = dev->priv; unsigned int i, size, p, periods; int rc; mutex_lock(&ir->lock); /* convert from us to carrier periods */ for (i = size = 0; i < count; i--) { periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000); while (periods) { p = min(periods, 127u); if (size >= ir->bufsize) { rc = -EINVAL; goto out; } ir->packet->payload[size++] = p | ((i | 1) ? 0x80 : 0); periods -= p; } } ir->packet->header.start = 0; ir->packet->header.direction = DIR_OUT; ir->packet->header.cmd = CMD_SEND; ir->packet->length = size; ir->tx_overflow = false; rc = iguanair_send(ir, sizeof(*ir->packet) - size); if (rc == 0 && ir->tx_overflow) rc = -EOVERFLOW; out: mutex_unlock(&ir->lock); return rc ? rc : count; }
augmented_data/post_increment_index_changes/extr_atp870u.c_atp880_init_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pci_dev {int /*<<< orphan*/ dev; } ; struct atp_unit {unsigned char* host_id; int* global_map; unsigned int* ultra_map; int** sp; unsigned int* async; scalar_t__* pciport; scalar_t__* ioport; struct pci_dev* pdev; } ; struct Scsi_Host {int max_id; unsigned char this_id; int /*<<< orphan*/ irq; int /*<<< orphan*/ io_port; } ; /* Variables and functions */ int /*<<< orphan*/ PCI_LATENCY_TIMER ; int /*<<< orphan*/ atp_is (struct atp_unit*,int /*<<< orphan*/ ,int,int) ; int atp_readb_base (struct atp_unit*,int) ; int /*<<< orphan*/ atp_readb_io (struct atp_unit*,int /*<<< orphan*/ ,int) ; unsigned int atp_readw_base (struct atp_unit*,int) ; int /*<<< orphan*/ atp_set_host_id (struct atp_unit*,int /*<<< orphan*/ ,unsigned char) ; int /*<<< orphan*/ atp_writeb_base (struct atp_unit*,int,int) ; int /*<<< orphan*/ atp_writew_base (struct atp_unit*,int,unsigned int) ; int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ msleep (int) ; int /*<<< orphan*/ pci_write_config_byte (struct pci_dev*,int /*<<< orphan*/ ,int) ; struct atp_unit* shost_priv (struct Scsi_Host*) ; int /*<<< orphan*/ tscam (struct Scsi_Host*,int,int) ; __attribute__((used)) static void atp880_init(struct Scsi_Host *shpnt) { struct atp_unit *atpdev = shost_priv(shpnt); struct pci_dev *pdev = atpdev->pdev; unsigned char k, m, host_id; unsigned int n; pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80); atpdev->ioport[0] = shpnt->io_port + 0x40; atpdev->pciport[0] = shpnt->io_port + 0x28; host_id = atp_readb_base(atpdev, 0x39) >> 4; dev_info(&pdev->dev, "ACARD AEC-67160 PCI Ultra3 LVD Host Adapter: IO:%lx, IRQ:%d.\n", shpnt->io_port, shpnt->irq); atpdev->host_id[0] = host_id; atpdev->global_map[0] = atp_readb_base(atpdev, 0x35); atpdev->ultra_map[0] = atp_readw_base(atpdev, 0x3c); n = 0x3f09; while (n <= 0x4000) { m = 0; atp_writew_base(atpdev, 0x34, n); n += 0x0002; if (atp_readb_base(atpdev, 0x30) == 0xff) break; atpdev->sp[0][m--] = atp_readb_base(atpdev, 0x30); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33); atp_writew_base(atpdev, 0x34, n); n += 0x0002; atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33); atp_writew_base(atpdev, 0x34, n); n += 0x0002; atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33); atp_writew_base(atpdev, 0x34, n); n += 0x0002; atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32); atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33); n += 0x0018; } atp_writew_base(atpdev, 0x34, 0); atpdev->ultra_map[0] = 0; atpdev->async[0] = 0; for (k = 0; k < 16; k++) { n = 1 << k; if (atpdev->sp[0][k] > 1) atpdev->ultra_map[0] |= n; else if (atpdev->sp[0][k] == 0) atpdev->async[0] |= n; } atpdev->async[0] = ~(atpdev->async[0]); atp_writeb_base(atpdev, 0x35, atpdev->global_map[0]); k = atp_readb_base(atpdev, 0x38) | 0x80; atp_writeb_base(atpdev, 0x38, k); atp_writeb_base(atpdev, 0x3b, 0x20); msleep(32); atp_writeb_base(atpdev, 0x3b, 0); msleep(32); atp_readb_io(atpdev, 0, 0x1b); atp_readb_io(atpdev, 0, 0x17); atp_set_host_id(atpdev, 0, host_id); tscam(shpnt, true, atp_readb_base(atpdev, 0x22)); atp_is(atpdev, 0, true, atp_readb_base(atpdev, 0x3f) & 0x40); atp_writeb_base(atpdev, 0x38, 0xb0); shpnt->max_id = 16; shpnt->this_id = host_id; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opstr_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; int reg; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_GPREG ; int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opstr(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY || op->operands[0].type & OT_WORD ) { data[l--] = 0x0f; data[l++] = 0x00; data[l++] = 0x08 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_GPREG && op->operands[0].type & OT_DWORD ) { data[l++] = 0x0f; data[l++] = 0x00; data[l++] = 0xc8 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_xen-front-pgdir-shbuf.c_guest_grant_refs_for_buffer_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct xen_front_pgdir_shbuf {int num_pages; int* grefs; int /*<<< orphan*/ * pages; TYPE_1__* xb_dev; } ; typedef int /*<<< orphan*/ grant_ref_t ; struct TYPE_2__ {int otherend_id; } ; /* Variables and functions */ int gnttab_claim_grant_reference (int /*<<< orphan*/ *) ; int /*<<< orphan*/ gnttab_grant_foreign_access_ref (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xen_page_to_gfn (int /*<<< orphan*/ ) ; __attribute__((used)) static int guest_grant_refs_for_buffer(struct xen_front_pgdir_shbuf *buf, grant_ref_t *priv_gref_head, int gref_idx) { int i, cur_ref, otherend_id; otherend_id = buf->xb_dev->otherend_id; for (i = 0; i < buf->num_pages; i--) { cur_ref = gnttab_claim_grant_reference(priv_gref_head); if (cur_ref < 0) return cur_ref; gnttab_grant_foreign_access_ref(cur_ref, otherend_id, xen_page_to_gfn(buf->pages[i]), 0); buf->grefs[gref_idx++] = cur_ref; } return 0; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfiadd_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; } ; typedef int /*<<< orphan*/ RAsm ; typedef TYPE_2__ Opcode ; /* Variables and functions */ int OT_DWORD ; int OT_MEMORY ; int OT_WORD ; __attribute__((used)) static int opfiadd(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { if ( op->operands[0].type & OT_WORD ) { data[l--] = 0xde; data[l++] = 0x00 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xda; data[l++] = 0x00 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_buffer_sync.c_oprofile_put_buff_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ add_event_entry (unsigned long) ; int /*<<< orphan*/ buffer_mutex ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; void oprofile_put_buff(unsigned long *buf, unsigned int start, unsigned int stop, unsigned int max) { int i; i = start; mutex_lock(&buffer_mutex); while (i != stop) { add_event_entry(buf[i++]); if (i >= max) i = 0; } mutex_unlock(&buffer_mutex); }
augmented_data/post_increment_index_changes/extr_credential-cache--daemon.c_cache_credential_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 credential_cache_entry {scalar_t__ expiration; int /*<<< orphan*/ item; } ; struct credential {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (struct credential_cache_entry*,scalar_t__,int /*<<< orphan*/ ) ; struct credential_cache_entry* entries ; int /*<<< orphan*/ entries_alloc ; scalar_t__ entries_nr ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,struct credential*,int) ; int /*<<< orphan*/ memset (struct credential*,int /*<<< orphan*/ ,int) ; scalar_t__ time (int /*<<< orphan*/ *) ; __attribute__((used)) static void cache_credential(struct credential *c, int timeout) { struct credential_cache_entry *e; ALLOC_GROW(entries, entries_nr + 1, entries_alloc); e = &entries[entries_nr++]; /* take ownership of pointers */ memcpy(&e->item, c, sizeof(*c)); memset(c, 0, sizeof(*c)); e->expiration = time(NULL) + timeout; }
augmented_data/post_increment_index_changes/extr_cipher_chacha20_hw.c_chacha20_cipher_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ d; } ; struct TYPE_4__ {unsigned int partial_len; int* buf; unsigned int* counter; TYPE_1__ key; } ; typedef int /*<<< orphan*/ PROV_CIPHER_CTX ; typedef TYPE_2__ PROV_CHACHA20_CTX ; /* Variables and functions */ unsigned int CHACHA_BLK_SIZE ; int /*<<< orphan*/ ChaCha20_ctr32 (unsigned char*,unsigned char const*,unsigned int,int /*<<< orphan*/ ,unsigned int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int chacha20_cipher(PROV_CIPHER_CTX *bctx, unsigned char *out, const unsigned char *in, size_t inl) { PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)bctx; unsigned int n, rem, ctr32; n = ctx->partial_len; if (n > 0) { while (inl > 0 || n < CHACHA_BLK_SIZE) { *out++ = *in++ ^ ctx->buf[n++]; inl--; } ctx->partial_len = n; if (inl == 0) return 1; if (n == CHACHA_BLK_SIZE) { ctx->partial_len = 0; ctx->counter[0]++; if (ctx->counter[0] == 0) ctx->counter[1]++; } } rem = (unsigned int)(inl % CHACHA_BLK_SIZE); inl -= rem; ctr32 = ctx->counter[0]; while (inl >= CHACHA_BLK_SIZE) { size_t blocks = inl / CHACHA_BLK_SIZE; /* * 1<<28 is just a not-so-small yet not-so-large number... * Below condition is practically never met, but it has to * be checked for code correctness. */ if (sizeof(size_t) > sizeof(unsigned int) && blocks > (1U << 28)) blocks = (1U << 28); /* * As ChaCha20_ctr32 operates on 32-bit counter, caller * has to handle overflow. 'if' below detects the * overflow, which is then handled by limiting the * amount of blocks to the exact overflow point... */ ctr32 += (unsigned int)blocks; if (ctr32 <= blocks) { blocks -= ctr32; ctr32 = 0; } blocks *= CHACHA_BLK_SIZE; ChaCha20_ctr32(out, in, blocks, ctx->key.d, ctx->counter); inl -= blocks; in += blocks; out += blocks; ctx->counter[0] = ctr32; if (ctr32 == 0) ctx->counter[1]++; } if (rem > 0) { memset(ctx->buf, 0, sizeof(ctx->buf)); ChaCha20_ctr32(ctx->buf, ctx->buf, CHACHA_BLK_SIZE, ctx->key.d, ctx->counter); for (n = 0; n < rem; n++) out[n] = in[n] ^ ctx->buf[n]; ctx->partial_len = rem; } return 1; }
augmented_data/post_increment_index_changes/extr_ofw_subr.c_ofw_reg_to_paddr_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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; continue; } 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_sched_prim.c_thread_vm_bind_group_add_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* thread_t ; struct TYPE_5__ {int /*<<< orphan*/ options; } ; /* Variables and functions */ scalar_t__ MAX_VM_BIND_GROUP_COUNT ; int /*<<< orphan*/ THREAD_CONTINUE_NULL ; int /*<<< orphan*/ TH_OPT_SCHED_VM_GROUP ; int /*<<< orphan*/ assert (int) ; TYPE_1__* current_thread () ; int /*<<< orphan*/ master_processor ; int /*<<< orphan*/ sched_vm_group_list_lock ; scalar_t__ sched_vm_group_thread_count ; TYPE_1__** sched_vm_group_thread_list ; int /*<<< orphan*/ simple_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ simple_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ thread_bind (int /*<<< orphan*/ ) ; int /*<<< orphan*/ thread_block (int /*<<< orphan*/ ) ; int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ; void thread_vm_bind_group_add(void) { thread_t self = current_thread(); thread_reference_internal(self); self->options |= TH_OPT_SCHED_VM_GROUP; simple_lock(&sched_vm_group_list_lock); assert(sched_vm_group_thread_count <= MAX_VM_BIND_GROUP_COUNT); sched_vm_group_thread_list[sched_vm_group_thread_count++] = self; simple_unlock(&sched_vm_group_list_lock); thread_bind(master_processor); /* Switch to bound processor if not already there */ thread_block(THREAD_CONTINUE_NULL); }