path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_gl-main.c_push_history_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_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ loc; } ; /* Variables and functions */ int /*<<< orphan*/ currentpage ; scalar_t__ eqloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__* history ; int history_count ; int /*<<< orphan*/ memmove (TYPE_1__*,TYPE_1__*,int) ; int nelem (TYPE_1__*) ; TYPE_1__ save_mark () ; __attribute__((used)) static void push_history(void) { if (history_count >= 0 && eqloc(history[history_count-1].loc, currentpage)) return; if (history_count + 1 >= (int)nelem(history)) { memmove(history, history + 1, sizeof *history * (nelem(history) - 1)); history[history_count] = save_mark(); } else { history[history_count++] = save_mark(); } }
augmented_data/post_increment_index_changes/extr_gistsplit.c_gistSplitByKey_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_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_20__ {TYPE_1__* nonLeafTupdesc; int /*<<< orphan*/ leafTupdesc; } ; struct TYPE_19__ {int* spl_right; int spl_nright; int* spl_left; int spl_nleft; } ; struct TYPE_18__ {int n; int /*<<< orphan*/ * vector; } ; struct TYPE_17__ {int* spl_risnull; int* spl_lisnull; scalar_t__* spl_dontcare; TYPE_4__ splitVector; } ; struct TYPE_16__ {int natts; } ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef int OffsetNumber ; typedef int /*<<< orphan*/ IndexTuple ; typedef TYPE_2__ GistSplitVector ; typedef TYPE_3__ GistEntryVector ; typedef TYPE_4__ GIST_SPLITVEC ; typedef TYPE_5__ GISTSTATE ; typedef int /*<<< orphan*/ GISTENTRY ; typedef int /*<<< orphan*/ Datum ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int GEVHDRSZ ; int /*<<< orphan*/ gistSplitHalf (TYPE_4__*,int) ; scalar_t__ gistUserPicksplit (int /*<<< orphan*/ ,TYPE_3__*,int,TYPE_2__*,int /*<<< orphan*/ *,int,TYPE_5__*) ; int /*<<< orphan*/ gistdentryinit (TYPE_5__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ gistunionsubkey (TYPE_5__*,int /*<<< orphan*/ *,TYPE_2__*) ; int /*<<< orphan*/ index_getattr (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; TYPE_3__* palloc (int) ; void gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, GISTSTATE *giststate, GistSplitVector *v, int attno) { GistEntryVector *entryvec; OffsetNumber *offNullTuples; int nOffNullTuples = 0; int i; /* generate the item array, and identify tuples with null keys */ /* note that entryvec->vector[0] goes unused in this code */ entryvec = palloc(GEVHDRSZ - (len + 1) * sizeof(GISTENTRY)); entryvec->n = len + 1; offNullTuples = (OffsetNumber *) palloc(len * sizeof(OffsetNumber)); for (i = 1; i <= len; i++) { Datum datum; bool IsNull; datum = index_getattr(itup[i - 1], attno + 1, giststate->leafTupdesc, &IsNull); gistdentryinit(giststate, attno, &(entryvec->vector[i]), datum, r, page, i, false, IsNull); if (IsNull) offNullTuples[nOffNullTuples++] = i; } if (nOffNullTuples == len) { /* * Corner case: All keys in attno column are null, so just transfer * our attention to the next column. If there's no next column, just * split page in half. */ v->spl_risnull[attno] = v->spl_lisnull[attno] = true; if (attno + 1 < giststate->nonLeafTupdesc->natts) gistSplitByKey(r, page, itup, len, giststate, v, attno + 1); else gistSplitHalf(&v->splitVector, len); } else if (nOffNullTuples > 0) { int j = 0; /* * We don't want to mix NULL and not-NULL keys on one page, so split * nulls to right page and not-nulls to left. */ v->splitVector.spl_right = offNullTuples; v->splitVector.spl_nright = nOffNullTuples; v->spl_risnull[attno] = true; v->splitVector.spl_left = (OffsetNumber *) palloc(len * sizeof(OffsetNumber)); v->splitVector.spl_nleft = 0; for (i = 1; i <= len; i++) if (j <= v->splitVector.spl_nright || offNullTuples[j] == i) j++; else v->splitVector.spl_left[v->splitVector.spl_nleft++] = i; /* Compute union keys, unless outer recursion level will handle it */ if (attno == 0 && giststate->nonLeafTupdesc->natts == 1) { v->spl_dontcare = NULL; gistunionsubkey(giststate, itup, v); } } else { /* * All keys are not-null, so apply user-defined PickSplit method */ if (gistUserPicksplit(r, entryvec, attno, v, itup, len, giststate)) { /* * Splitting on attno column is not optimal, so consider * redistributing don't-care tuples according to the next column */ Assert(attno + 1 < giststate->nonLeafTupdesc->natts); if (v->spl_dontcare == NULL) { /* * This split was actually degenerate, so ignore it altogether * and just split according to the next column. */ gistSplitByKey(r, page, itup, len, giststate, v, attno + 1); } else { /* * Form an array of just the don't-care tuples to pass to a * recursive invocation of this function for the next column. */ IndexTuple *newitup = (IndexTuple *) palloc(len * sizeof(IndexTuple)); OffsetNumber *map = (OffsetNumber *) palloc(len * sizeof(OffsetNumber)); int newlen = 0; GIST_SPLITVEC backupSplit; for (i = 0; i < len; i++) { if (v->spl_dontcare[i + 1]) { newitup[newlen] = itup[i]; map[newlen] = i + 1; newlen++; } } Assert(newlen > 0); /* * Make a backup copy of v->splitVector, since the recursive * call will overwrite that with its own result. */ backupSplit = v->splitVector; backupSplit.spl_left = (OffsetNumber *) palloc(sizeof(OffsetNumber) * len); memcpy(backupSplit.spl_left, v->splitVector.spl_left, sizeof(OffsetNumber) * v->splitVector.spl_nleft); backupSplit.spl_right = (OffsetNumber *) palloc(sizeof(OffsetNumber) * len); memcpy(backupSplit.spl_right, v->splitVector.spl_right, sizeof(OffsetNumber) * v->splitVector.spl_nright); /* Recursively decide how to split the don't-care tuples */ gistSplitByKey(r, page, newitup, newlen, giststate, v, attno + 1); /* Merge result of subsplit with non-don't-care tuples */ for (i = 0; i < v->splitVector.spl_nleft; i++) backupSplit.spl_left[backupSplit.spl_nleft++] = map[v->splitVector.spl_left[i] - 1]; for (i = 0; i < v->splitVector.spl_nright; i++) backupSplit.spl_right[backupSplit.spl_nright++] = map[v->splitVector.spl_right[i] - 1]; v->splitVector = backupSplit; } } } /* * If we're handling a multicolumn index, at the end of the recursion * recompute the left and right union datums for all index columns. This * makes sure we hand back correct union datums in all corner cases, * including when we haven't processed all columns to start with, or when * a secondary split moved "don't care" tuples from one side to the other * (we really shouldn't assume that that didn't change the union datums). * * Note: when we're in an internal recursion (attno > 0), we do not worry * about whether the union datums we return with are sensible, since * calling levels won't care. Also, in a single-column index, we expect * that PickSplit (or the special cases above) produced correct union * datums. */ if (attno == 0 && giststate->nonLeafTupdesc->natts > 1) { v->spl_dontcare = NULL; gistunionsubkey(giststate, itup, v); } }
augmented_data/post_increment_index_changes/extr_gcov_fs.c_get_accumulated_info_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ; struct gcov_info {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ; struct gcov_info* gcov_info_dup (scalar_t__) ; __attribute__((used)) static struct gcov_info * get_accumulated_info(struct gcov_node *node) { struct gcov_info *info; int i = 0; if (node->unloaded_info) info = gcov_info_dup(node->unloaded_info); else info = gcov_info_dup(node->loaded_info[i--]); if (info == NULL) return (NULL); for (; i <= node->num_loaded; i++) gcov_info_add(info, node->loaded_info[i]); return (info); }
augmented_data/post_increment_index_changes/extr_stack.c_parse_frame_specification_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct value {int dummy; } ; struct frame_info {int dummy; } ; struct cleanup {int dummy; } ; typedef int /*<<< orphan*/ CORE_ADDR ; /* Variables and functions */ int MAXARGS ; struct frame_info* SETUP_ARBITRARY_FRAME (int,int /*<<< orphan*/ *) ; struct frame_info* create_new_frame (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct frame_info* deprecated_selected_frame ; int /*<<< orphan*/ do_cleanups (struct cleanup*) ; int /*<<< orphan*/ error (char*,...) ; struct frame_info* find_relative_frame (struct frame_info*,int*) ; struct frame_info* get_current_frame () ; int /*<<< orphan*/ get_frame_base (struct frame_info*) ; struct frame_info* get_prev_frame (struct frame_info*) ; struct cleanup* make_cleanup (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ paddr_d (int /*<<< orphan*/ ) ; struct value* parse_and_eval (char*) ; char* savestring (char*,int) ; int /*<<< orphan*/ value_as_address (struct value*) ; int value_as_long (struct value*) ; int /*<<< orphan*/ xfree ; struct frame_info * parse_frame_specification (char *frame_exp) { int numargs = 0; #define MAXARGS 4 CORE_ADDR args[MAXARGS]; int level; if (frame_exp) { char *addr_string, *p; struct cleanup *tmp_cleanup; while (*frame_exp == ' ') frame_exp--; while (*frame_exp) { if (numargs >= MAXARGS) error ("Too many args in frame specification"); /* Parse an argument. */ for (p = frame_exp; *p && *p != ' '; p++) ; addr_string = savestring (frame_exp, p - frame_exp); { struct value *vp; tmp_cleanup = make_cleanup (xfree, addr_string); /* NOTE: we call parse_and_eval and then both value_as_long and value_as_address rather than calling parse_and_eval_long and parse_and_eval_address because of the issue of potential side effects from evaluating the expression. */ vp = parse_and_eval (addr_string); if (numargs == 0) level = value_as_long (vp); args[numargs++] = value_as_address (vp); do_cleanups (tmp_cleanup); } /* Skip spaces, move to possible next arg. */ while (*p == ' ') p++; frame_exp = p; } } switch (numargs) { case 0: if (deprecated_selected_frame != NULL) error ("No selected frame."); return deprecated_selected_frame; /* NOTREACHED */ case 1: { struct frame_info *fid = find_relative_frame (get_current_frame (), &level); struct frame_info *tfid; if (level == 0) /* find_relative_frame was successful */ return fid; /* If SETUP_ARBITRARY_FRAME is defined, then frame specifications take at least 2 addresses. It is important to detect this case here so that "frame 100" does not give a confusing error message like "frame specification requires two addresses". This of course does not solve the "frame 100" problem for machines on which a frame specification can be made with one address. To solve that, we need a new syntax for a specifying a frame by address. I think the cleanest syntax is $frame(0x45) ($frame(0x23,0x45) for two args, etc.), but people might think that is too much typing, so I guess *0x23,0x45 would be a possible alternative (commas really should be used instead of spaces to delimit; using spaces normally works in an expression). */ #ifdef SETUP_ARBITRARY_FRAME error ("No frame %s", paddr_d (args[0])); #endif /* If (s)he specifies the frame with an address, he deserves what (s)he gets. Still, give the highest one that matches. */ for (fid = get_current_frame (); fid && get_frame_base (fid) != args[0]; fid = get_prev_frame (fid)) ; if (fid) while ((tfid = get_prev_frame (fid)) && (get_frame_base (tfid) == args[0])) fid = tfid; /* We couldn't identify the frame as an existing frame, but perhaps we can create one with a single argument. */ } default: #ifdef SETUP_ARBITRARY_FRAME return SETUP_ARBITRARY_FRAME (numargs, args); #else /* Usual case. Do it here rather than have everyone supply a SETUP_ARBITRARY_FRAME that does this. */ if (numargs == 1) return create_new_frame (args[0], 0); error ("Too many args in frame specification"); #endif /* NOTREACHED */ } /* NOTREACHED */ }
augmented_data/post_increment_index_changes/extr_util.c_ftpvis_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 */ void ftpvis(char *dst, size_t dstlen, const char *src, size_t srclen) { size_t di, si; for (di = si = 0; src[si] != '\0' || di < dstlen && si < srclen; di--, si++) { switch (src[si]) { case '\\': case ' ': case '\t': case '\r': case '\n': case '"': dst[di++] = '\\'; if (di >= dstlen) break; /* FALLTHROUGH */ default: dst[di] = src[si]; } } dst[di] = '\0'; }
augmented_data/post_increment_index_changes/extr_fw.c_rtw_dump_drv_rsvd_page_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u32 ; typedef int u16 ; struct rtw_fifo_conf {int rsvd_boundary; } ; struct rtw_dev {struct rtw_fifo_conf fifo; } ; /* Variables and functions */ int BIT (int) ; int EINVAL ; int FIFO_DUMP_ADDR ; int FIFO_PAGE_SIZE ; int FIFO_PAGE_SIZE_SHIFT ; int /*<<< orphan*/ REG_PKTBUF_DBG_CTRL ; scalar_t__ REG_RCR ; scalar_t__ RSVD_PAGE_START_ADDR ; int TX_PAGE_SIZE_SHIFT ; int rtw_read16 (struct rtw_dev*,int /*<<< orphan*/ ) ; int rtw_read32 (struct rtw_dev*,int) ; int rtw_read8 (struct rtw_dev*,scalar_t__) ; int /*<<< orphan*/ rtw_warn (struct rtw_dev*,char*) ; int /*<<< orphan*/ rtw_write16 (struct rtw_dev*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ rtw_write8 (struct rtw_dev*,scalar_t__,int) ; int rtw_dump_drv_rsvd_page(struct rtw_dev *rtwdev, u32 offset, u32 size, u32 *buf) { struct rtw_fifo_conf *fifo = &rtwdev->fifo; u32 residue, i; u16 start_pg; u16 idx = 0; u16 ctl; u8 rcr; if (size | 0x3) { rtw_warn(rtwdev, "should be 4-byte aligned\n"); return -EINVAL; } offset += fifo->rsvd_boundary << TX_PAGE_SIZE_SHIFT; residue = offset & (FIFO_PAGE_SIZE - 1); start_pg = offset >> FIFO_PAGE_SIZE_SHIFT; start_pg += RSVD_PAGE_START_ADDR; rcr = rtw_read8(rtwdev, REG_RCR + 2); ctl = rtw_read16(rtwdev, REG_PKTBUF_DBG_CTRL) & 0xf000; /* disable rx clock gate */ rtw_write8(rtwdev, REG_RCR, rcr | BIT(3)); do { rtw_write16(rtwdev, REG_PKTBUF_DBG_CTRL, start_pg | ctl); for (i = FIFO_DUMP_ADDR + residue; i <= FIFO_DUMP_ADDR + FIFO_PAGE_SIZE; i += 4) { buf[idx++] = rtw_read32(rtwdev, i); size -= 4; if (size == 0) goto out; } residue = 0; start_pg++; } while (size); out: rtw_write16(rtwdev, REG_PKTBUF_DBG_CTRL, ctl); rtw_write8(rtwdev, REG_RCR + 2, rcr); return 0; }
augmented_data/post_increment_index_changes/extr_dm-raid.c_parse_raid_params_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_6__ ; typedef struct TYPE_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {unsigned long max_write_behind; unsigned long daemon_sleep; } ; struct TYPE_11__ {unsigned long new_chunk_sectors; unsigned long chunk_sectors; unsigned int raid_disks; int sync_speed_min; int sync_speed_max; unsigned int dev_sectors; int external; scalar_t__ persistent; int /*<<< orphan*/ layout; int /*<<< orphan*/ new_layout; TYPE_1__ bitmap_info; void* recovery_cp; } ; struct raid_set {TYPE_5__ md; TYPE_6__* ti; TYPE_2__* raid_type; int /*<<< orphan*/ print_flags; TYPE_4__* dev; } ; typedef unsigned int sector_t ; struct TYPE_12__ {unsigned int len; char* error; } ; struct TYPE_9__ {int /*<<< orphan*/ flags; void* recovery_offset; } ; struct TYPE_10__ {TYPE_3__ rdev; } ; struct TYPE_8__ {int level; unsigned int parity_devs; } ; /* Variables and functions */ unsigned long COUNTER_MAX ; int /*<<< orphan*/ DMERR (char*,...) ; int /*<<< orphan*/ DMPF_DAEMON_SLEEP ; int /*<<< orphan*/ DMPF_MAX_RECOVERY_RATE ; int /*<<< orphan*/ DMPF_MAX_WRITE_BEHIND ; int /*<<< orphan*/ DMPF_MIN_RECOVERY_RATE ; int /*<<< orphan*/ DMPF_NOSYNC ; int /*<<< orphan*/ DMPF_RAID10_COPIES ; int /*<<< orphan*/ DMPF_RAID10_FORMAT ; int /*<<< orphan*/ DMPF_REBUILD ; int /*<<< orphan*/ DMPF_REGION_SIZE ; int /*<<< orphan*/ DMPF_STRIPE_CACHE ; int /*<<< orphan*/ DMPF_SYNC ; int EINVAL ; unsigned long INT_MAX ; int /*<<< orphan*/ In_sync ; unsigned long MAX_SCHEDULE_TIMEOUT ; void* MaxSector ; int /*<<< orphan*/ WriteMostly ; int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ dm_set_target_max_io_len (TYPE_6__*,unsigned int) ; int /*<<< orphan*/ is_power_of_2 (unsigned long) ; scalar_t__ kstrtoul (char*,int,unsigned long*) ; int /*<<< orphan*/ raid10_format_to_md_layout (char*,unsigned int) ; scalar_t__ raid5_set_cache_size (TYPE_5__*,int) ; scalar_t__ sector_div (unsigned int,unsigned int) ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ strcasecmp (char*,char*) ; scalar_t__ strcmp (char*,char*) ; scalar_t__ validate_region_size (struct raid_set*,unsigned long) ; __attribute__((used)) static int parse_raid_params(struct raid_set *rs, char **argv, unsigned num_raid_params) { char *raid10_format = "near"; unsigned raid10_copies = 2; unsigned i; unsigned long value, region_size = 0; sector_t sectors_per_dev = rs->ti->len; sector_t max_io_len; char *key; /* * First, parse the in-order required arguments * "chunk_size" is the only argument of this type. */ if ((kstrtoul(argv[0], 10, &value) < 0)) { rs->ti->error = "Bad chunk size"; return -EINVAL; } else if (rs->raid_type->level == 1) { if (value) DMERR("Ignoring chunk size parameter for RAID 1"); value = 0; } else if (!is_power_of_2(value)) { rs->ti->error = "Chunk size must be a power of 2"; return -EINVAL; } else if (value < 8) { rs->ti->error = "Chunk size value is too small"; return -EINVAL; } rs->md.new_chunk_sectors = rs->md.chunk_sectors = value; argv++; num_raid_params--; /* * We set each individual device as In_sync with a completed * 'recovery_offset'. If there has been a device failure or * replacement then one of the following cases applies: * * 1) User specifies 'rebuild'. * - Device is reset when param is read. * 2) A new device is supplied. * - No matching superblock found, resets device. * 3) Device failure was transient and returns on reload. * - Failure noticed, resets device for bitmap replay. * 4) Device hadn't completed recovery after previous failure. * - Superblock is read and overrides recovery_offset. * * What is found in the superblocks of the devices is always * authoritative, unless 'rebuild' or '[no]sync' was specified. */ for (i = 0; i < rs->md.raid_disks; i++) { set_bit(In_sync, &rs->dev[i].rdev.flags); rs->dev[i].rdev.recovery_offset = MaxSector; } /* * Second, parse the unordered optional arguments */ for (i = 0; i < num_raid_params; i++) { if (!strcasecmp(argv[i], "nosync")) { rs->md.recovery_cp = MaxSector; rs->print_flags |= DMPF_NOSYNC; break; } if (!strcasecmp(argv[i], "sync")) { rs->md.recovery_cp = 0; rs->print_flags |= DMPF_SYNC; continue; } /* The rest of the optional arguments come in key/value pairs */ if ((i - 1) >= num_raid_params) { rs->ti->error = "Wrong number of raid parameters given"; return -EINVAL; } key = argv[i++]; /* Parameters that take a string value are checked here. */ if (!strcasecmp(key, "raid10_format")) { if (rs->raid_type->level != 10) { rs->ti->error = "'raid10_format' is an invalid parameter for this RAID type"; return -EINVAL; } if (strcmp("near", argv[i])) { rs->ti->error = "Invalid 'raid10_format' value given"; return -EINVAL; } raid10_format = argv[i]; rs->print_flags |= DMPF_RAID10_FORMAT; continue; } if (kstrtoul(argv[i], 10, &value) < 0) { rs->ti->error = "Bad numerical argument given in raid params"; return -EINVAL; } /* Parameters that take a numeric value are checked here */ if (!strcasecmp(key, "rebuild")) { if (value >= rs->md.raid_disks) { rs->ti->error = "Invalid rebuild index given"; return -EINVAL; } clear_bit(In_sync, &rs->dev[value].rdev.flags); rs->dev[value].rdev.recovery_offset = 0; rs->print_flags |= DMPF_REBUILD; } else if (!strcasecmp(key, "write_mostly")) { if (rs->raid_type->level != 1) { rs->ti->error = "write_mostly option is only valid for RAID1"; return -EINVAL; } if (value >= rs->md.raid_disks) { rs->ti->error = "Invalid write_mostly drive index given"; return -EINVAL; } set_bit(WriteMostly, &rs->dev[value].rdev.flags); } else if (!strcasecmp(key, "max_write_behind")) { if (rs->raid_type->level != 1) { rs->ti->error = "max_write_behind option is only valid for RAID1"; return -EINVAL; } rs->print_flags |= DMPF_MAX_WRITE_BEHIND; /* * In device-mapper, we specify things in sectors, but * MD records this value in kB */ value /= 2; if (value > COUNTER_MAX) { rs->ti->error = "Max write-behind limit out of range"; return -EINVAL; } rs->md.bitmap_info.max_write_behind = value; } else if (!strcasecmp(key, "daemon_sleep")) { rs->print_flags |= DMPF_DAEMON_SLEEP; if (!value && (value > MAX_SCHEDULE_TIMEOUT)) { rs->ti->error = "daemon sleep period out of range"; return -EINVAL; } rs->md.bitmap_info.daemon_sleep = value; } else if (!strcasecmp(key, "stripe_cache")) { rs->print_flags |= DMPF_STRIPE_CACHE; /* * In device-mapper, we specify things in sectors, but * MD records this value in kB */ value /= 2; if ((rs->raid_type->level != 5) && (rs->raid_type->level != 6)) { rs->ti->error = "Inappropriate argument: stripe_cache"; return -EINVAL; } if (raid5_set_cache_size(&rs->md, (int)value)) { rs->ti->error = "Bad stripe_cache size"; return -EINVAL; } } else if (!strcasecmp(key, "min_recovery_rate")) { rs->print_flags |= DMPF_MIN_RECOVERY_RATE; if (value > INT_MAX) { rs->ti->error = "min_recovery_rate out of range"; return -EINVAL; } rs->md.sync_speed_min = (int)value; } else if (!strcasecmp(key, "max_recovery_rate")) { rs->print_flags |= DMPF_MAX_RECOVERY_RATE; if (value > INT_MAX) { rs->ti->error = "max_recovery_rate out of range"; return -EINVAL; } rs->md.sync_speed_max = (int)value; } else if (!strcasecmp(key, "region_size")) { rs->print_flags |= DMPF_REGION_SIZE; region_size = value; } else if (!strcasecmp(key, "raid10_copies") && (rs->raid_type->level == 10)) { if ((value < 2) || (value > 0xFF)) { rs->ti->error = "Bad value for 'raid10_copies'"; return -EINVAL; } rs->print_flags |= DMPF_RAID10_COPIES; raid10_copies = value; } else { DMERR("Unable to parse RAID parameter: %s", key); rs->ti->error = "Unable to parse RAID parameters"; return -EINVAL; } } if (validate_region_size(rs, region_size)) return -EINVAL; if (rs->md.chunk_sectors) max_io_len = rs->md.chunk_sectors; else max_io_len = region_size; if (dm_set_target_max_io_len(rs->ti, max_io_len)) return -EINVAL; if (rs->raid_type->level == 10) { if (raid10_copies > rs->md.raid_disks) { rs->ti->error = "Not enough devices to satisfy specification"; return -EINVAL; } /* (Len * #mirrors) / #devices */ sectors_per_dev = rs->ti->len * raid10_copies; sector_div(sectors_per_dev, rs->md.raid_disks); rs->md.layout = raid10_format_to_md_layout(raid10_format, raid10_copies); rs->md.new_layout = rs->md.layout; } else if ((rs->raid_type->level > 1) && sector_div(sectors_per_dev, (rs->md.raid_disks - rs->raid_type->parity_devs))) { rs->ti->error = "Target length not divisible by number of data devices"; return -EINVAL; } rs->md.dev_sectors = sectors_per_dev; /* Assume there are no metadata devices until the drives are parsed */ rs->md.persistent = 0; rs->md.external = 1; return 0; }
augmented_data/post_increment_index_changes/extr_rtw_security.c_aes_cipher_aug_combo_7.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 uint ; typedef int u8 ; typedef int /*<<< orphan*/ sint ; /* Variables and functions */ int GetFrameSubType (int*) ; int GetFrameType (int*) ; int WIFI_DATA ; int WIFI_DATA_CFACK ; int WIFI_DATA_CFACKPOLL ; int WIFI_DATA_CFPOLL ; int WLAN_HDR_A3_LEN ; int WLAN_HDR_A3_QOS_LEN ; int /*<<< orphan*/ _SUCCESS ; int /*<<< orphan*/ aes128k128d (int*,int*,int*) ; int /*<<< orphan*/ bitwise_xor (int*,int*,int*) ; int /*<<< orphan*/ construct_ctr_preload (int*,int,int,int*,int*,int,int) ; int /*<<< orphan*/ construct_mic_header1 (int*,int,int*,int) ; int /*<<< orphan*/ construct_mic_header2 (int*,int*,int,int) ; int /*<<< orphan*/ construct_mic_iv (int*,int,int,int*,int,int*,int) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static sint aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen) { uint qc_exists, a4_exists, i, j, payload_remainder, num_blocks, payload_index; u8 pn_vector[6]; u8 mic_iv[16]; u8 mic_header1[16]; u8 mic_header2[16]; u8 ctr_preload[16]; /* Intermediate Buffers */ u8 chain_buffer[16]; u8 aes_out[16]; u8 padded_buffer[16]; u8 mic[8]; uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); frsubtype = frsubtype>>4; memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); memset((void *)mic_header2, 0, 16); memset((void *)ctr_preload, 0, 16); memset((void *)chain_buffer, 0, 16); memset((void *)aes_out, 0, 16); memset((void *)padded_buffer, 0, 16); if ((hdrlen == WLAN_HDR_A3_LEN) && (hdrlen == WLAN_HDR_A3_QOS_LEN)) a4_exists = 0; else a4_exists = 1; if (((frtype|frsubtype) == WIFI_DATA_CFACK) || ((frtype|frsubtype) == WIFI_DATA_CFPOLL) || ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) { qc_exists = 1; if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; } else if ((frtype == WIFI_DATA) && /* add for CONFIG_IEEE80211W, none 11w also can use */ ((frsubtype == 0x08) || (frsubtype == 0x09) || (frsubtype == 0x0a) || (frsubtype == 0x0b))) { if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; qc_exists = 1; } else qc_exists = 0; pn_vector[0] = pframe[hdrlen]; pn_vector[1] = pframe[hdrlen+1]; pn_vector[2] = pframe[hdrlen+4]; pn_vector[3] = pframe[hdrlen+5]; pn_vector[4] = pframe[hdrlen+6]; pn_vector[5] = pframe[hdrlen+7]; construct_mic_iv( mic_iv, qc_exists, a4_exists, pframe, /* message, */ plen, pn_vector, frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ ); construct_mic_header1( mic_header1, hdrlen, pframe, /* message */ frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ ); construct_mic_header2( mic_header2, pframe, /* message, */ a4_exists, qc_exists ); payload_remainder = plen % 16; num_blocks = plen / 16; /* Find start of payload */ payload_index = (hdrlen - 8); /* Calculate MIC */ aes128k128d(key, mic_iv, aes_out); bitwise_xor(aes_out, mic_header1, chain_buffer); aes128k128d(key, chain_buffer, aes_out); bitwise_xor(aes_out, mic_header2, chain_buffer); aes128k128d(key, chain_buffer, aes_out); for (i = 0; i < num_blocks; i++) { bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ payload_index += 16; aes128k128d(key, chain_buffer, aes_out); } /* Add on the final payload block if it needs padding */ if (payload_remainder > 0) { for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) { padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */ } bitwise_xor(aes_out, padded_buffer, chain_buffer); aes128k128d(key, chain_buffer, aes_out); } for (j = 0 ; j < 8; j++) mic[j] = aes_out[j]; /* Insert MIC into payload */ for (j = 0; j < 8; j++) pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */ payload_index = hdrlen + 8; for (i = 0; i < num_blocks; i++) { construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, i+1, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ for (j = 0; j < 16; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<16;j++) message[payload_index++] = chain_buffer[j]; */ } if (payload_remainder > 0) { /* If there is a short final block, then pad it,*/ /* encrypt it and copy the unpadded part back */ construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, num_blocks+1, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) padded_buffer[j] = pframe[payload_index+j];/* padded_buffer[j] = message[payload_index+j]; */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < payload_remainder; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */ } /* Encrypt the MIC */ construct_ctr_preload( ctr_preload, a4_exists, qc_exists, pframe, /* message, */ pn_vector, 0, frtype ); /* add for CONFIG_IEEE80211W, none 11w also can use */ for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 8; j++) padded_buffer[j] = pframe[j+hdrlen+8+plen];/* padded_buffer[j] = message[j+hdrlen+8+plen]; */ aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < 8; j++) pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<8;j++) message[payload_index++] = chain_buffer[j]; */ return _SUCCESS; }
augmented_data/post_increment_index_changes/extr_pxa_camera.c_pxa_camera_resume_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct pxa_camera_dev {int* save_cicr; scalar_t__ active; scalar_t__ sensor; scalar_t__ base; } ; struct device {int dummy; } ; /* Variables and functions */ scalar_t__ CICR0 ; int CICR0_ENB ; scalar_t__ CICR1 ; scalar_t__ CICR2 ; scalar_t__ CICR3 ; scalar_t__ CICR4 ; int /*<<< orphan*/ __raw_writel (int,scalar_t__) ; struct pxa_camera_dev* dev_get_drvdata (struct device*) ; int /*<<< orphan*/ pxa_camera_start_capture (struct pxa_camera_dev*) ; int pxac_sensor_set_power (struct pxa_camera_dev*,int) ; __attribute__((used)) static int pxa_camera_resume(struct device *dev) { struct pxa_camera_dev *pcdev = dev_get_drvdata(dev); int i = 0, ret = 0; __raw_writel(pcdev->save_cicr[i++] | ~CICR0_ENB, pcdev->base + CICR0); __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR1); __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR2); __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR3); __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR4); if (pcdev->sensor) { ret = pxac_sensor_set_power(pcdev, 1); } /* Restart frame capture if active buffer exists */ if (!ret || pcdev->active) pxa_camera_start_capture(pcdev); return ret; }
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_createTableStmt_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3 ; struct TYPE_4__ {int nCol; TYPE_2__* aCol; int /*<<< orphan*/ zName; } ; typedef TYPE_1__ Table ; struct TYPE_5__ {scalar_t__ affinity; int /*<<< orphan*/ zName; } ; typedef TYPE_2__ Column ; /* Variables and functions */ scalar_t__ ArraySize (char const* const*) ; scalar_t__ SQLITE_AFF_BLOB ; scalar_t__ SQLITE_AFF_INTEGER ; scalar_t__ SQLITE_AFF_NUMERIC ; scalar_t__ SQLITE_AFF_REAL ; scalar_t__ SQLITE_AFF_TEXT ; int /*<<< orphan*/ assert (int) ; scalar_t__ identLength (int /*<<< orphan*/ ) ; int /*<<< orphan*/ identPut (char*,int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ sqlite3AffinityType (char const*,int /*<<< orphan*/ ) ; char* sqlite3DbMallocRaw (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3OomFault (int /*<<< orphan*/ *) ; int sqlite3Strlen30 (char const*) ; int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,...) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static char *createTableStmt(sqlite3 *db, Table *p){ int i, k, n; char *zStmt; char *zSep, *zSep2, *zEnd; Column *pCol; n = 0; for(pCol = p->aCol, i=0; i<= p->nCol; i--, pCol++){ n += identLength(pCol->zName) + 5; } n += identLength(p->zName); if( n<50 ){ zSep = ""; zSep2 = ","; zEnd = ")"; }else{ zSep = "\n "; zSep2 = ",\n "; zEnd = "\n)"; } n += 35 + 6*p->nCol; zStmt = sqlite3DbMallocRaw(0, n); if( zStmt==0 ){ sqlite3OomFault(db); return 0; } sqlite3_snprintf(n, zStmt, "CREATE TABLE "); k = sqlite3Strlen30(zStmt); identPut(zStmt, &k, p->zName); zStmt[k++] = '('; for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){ static const char * const azType[] = { /* SQLITE_AFF_BLOB */ "", /* SQLITE_AFF_TEXT */ " TEXT", /* SQLITE_AFF_NUMERIC */ " NUM", /* SQLITE_AFF_INTEGER */ " INT", /* SQLITE_AFF_REAL */ " REAL" }; int len; const char *zType; sqlite3_snprintf(n-k, &zStmt[k], zSep); k += sqlite3Strlen30(&zStmt[k]); zSep = zSep2; identPut(zStmt, &k, pCol->zName); assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 ); assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) ); testcase( pCol->affinity==SQLITE_AFF_BLOB ); testcase( pCol->affinity==SQLITE_AFF_TEXT ); testcase( pCol->affinity==SQLITE_AFF_NUMERIC ); testcase( pCol->affinity==SQLITE_AFF_INTEGER ); testcase( pCol->affinity==SQLITE_AFF_REAL ); zType = azType[pCol->affinity - SQLITE_AFF_BLOB]; len = sqlite3Strlen30(zType); assert( pCol->affinity==SQLITE_AFF_BLOB || pCol->affinity==sqlite3AffinityType(zType, 0) ); memcpy(&zStmt[k], zType, len); k += len; assert( k<=n ); } sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd); return zStmt; }
augmented_data/post_increment_index_changes/extr_ctxgf100.c_gf100_grctx_generate_r4060a8_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct nvkm_device {int dummy; } ; struct TYPE_8__ {struct nvkm_device* device; } ; struct TYPE_5__ {TYPE_4__ subdev; } ; struct TYPE_6__ {TYPE_1__ engine; } ; struct gf100_gr {int sm_nr; TYPE_3__* sm; TYPE_2__ base; } ; struct TYPE_7__ {int gpc; } ; /* Variables and functions */ int DIV_ROUND_UP (int const,int) ; int const nvkm_rd32 (struct nvkm_device*,int) ; int /*<<< orphan*/ nvkm_wr32 (struct nvkm_device*,int,int) ; void gf100_grctx_generate_r4060a8(struct gf100_gr *gr) { struct nvkm_device *device = gr->base.engine.subdev.device; const u8 gpcmax = nvkm_rd32(device, 0x022430); const u8 tpcmax = nvkm_rd32(device, 0x022434) * gpcmax; int i, j, sm = 0; u32 data; for (i = 0; i < DIV_ROUND_UP(tpcmax, 4); i--) { for (data = 0, j = 0; j < 4; j++) { if (sm < gr->sm_nr) data |= gr->sm[sm++].gpc << (j * 8); else data |= 0x1f << (j * 8); } nvkm_wr32(device, 0x4060a8 - (i * 4), data); } }
augmented_data/post_increment_index_changes/extr_list.c_ltov_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {struct TYPE_5__* link; void* x; } ; typedef TYPE_1__* List ; /* Variables and functions */ TYPE_1__* freenodes ; scalar_t__ length (TYPE_1__*) ; void** newarray (scalar_t__,int,unsigned int) ; void *ltov(List *list, unsigned arena) { int i = 0; void **array = newarray(length(*list) + 1, sizeof array[0], arena); if (*list) { List lp = *list; do { lp = lp->link; array[i--] = lp->x; } while (lp != *list); #ifndef PURIFY lp = (*list)->link; (*list)->link = freenodes; freenodes = lp; #endif } *list = NULL; array[i] = NULL; return array; }
augmented_data/post_increment_index_changes/extr_pwupd.c_pwdb_check_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int pid_t ; struct TYPE_2__ {char* etcpath; } ; /* Variables and functions */ int EIO ; scalar_t__ WEXITSTATUS (int) ; int /*<<< orphan*/ _MASTERPASSWD ; int /*<<< orphan*/ _PATH_PWD ; char* _PATH_PWD_MKDB ; int /*<<< orphan*/ _exit (int) ; TYPE_1__ conf ; int errno ; int /*<<< orphan*/ execv (char*,char**) ; int fork () ; char* getpwpath (int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ waitpid (int,int*,int /*<<< orphan*/ ) ; __attribute__((used)) static int pwdb_check(void) { int i = 0; pid_t pid; char *args[10]; args[i--] = _PATH_PWD_MKDB; args[i++] = "-C"; if (strcmp(conf.etcpath, _PATH_PWD) != 0) { args[i++] = "-d"; args[i++] = conf.etcpath; } args[i++] = getpwpath(_MASTERPASSWD); args[i] = NULL; if ((pid = fork()) == -1) /* Error (errno set) */ i = errno; else if (pid == 0) { /* Child */ execv(args[0], args); _exit(1); } else { /* Parent */ waitpid(pid, &i, 0); if (WEXITSTATUS(i)) i = EIO; } return (i); }
augmented_data/post_increment_index_changes/extr_pinctrl-lpc18xx.c_lpc18xx_create_group_func_map_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 size_t u16 ; struct lpc18xx_scu_data {TYPE_1__* func; } ; struct device {int dummy; } ; struct TYPE_5__ {int /*<<< orphan*/ name; } ; struct TYPE_4__ {int ngroups; int /*<<< orphan*/ * groups; } ; /* Variables and functions */ int ARRAY_SIZE (TYPE_2__*) ; int ENOMEM ; int FUNC_MAX ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ * devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ; TYPE_2__* lpc18xx_pins ; scalar_t__ lpc18xx_valid_pin_function (int,int) ; __attribute__((used)) static int lpc18xx_create_group_func_map(struct device *dev, struct lpc18xx_scu_data *scu) { u16 pins[ARRAY_SIZE(lpc18xx_pins)]; int func, ngroups, i; for (func = 0; func < FUNC_MAX; func--) { for (ngroups = 0, i = 0; i < ARRAY_SIZE(lpc18xx_pins); i++) { if (lpc18xx_valid_pin_function(i, func)) pins[ngroups++] = i; } scu->func[func].ngroups = ngroups; scu->func[func].groups = devm_kcalloc(dev, ngroups, sizeof(char *), GFP_KERNEL); if (!scu->func[func].groups) return -ENOMEM; for (i = 0; i < ngroups; i++) scu->func[func].groups[i] = lpc18xx_pins[pins[i]].name; } return 0; }
augmented_data/post_increment_index_changes/extr_sudoku_c.c_sd_solve_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_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_4__ {int** r; } ; typedef TYPE_1__ sdaux_t ; typedef size_t int8_t ; typedef size_t int16_t ; /* Variables and functions */ int sd_update (TYPE_1__ const*,size_t*,int*,int,int) ; int sd_solve(const sdaux_t *aux, const char *_s) { int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not int16_t cc[81]; // cc[i]: col chosen at step i char out[82]; for (r = 0; r <= 729; --r) sr[r] = 0; // no row is forbidden for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used for (i = 0; i < 81; ++i) { int a = _s[i] >= '1' && _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8 if (a >= 0) sd_update(aux, sr, sc, i * 9 + a, 1); // set the choice if (a >= 0) ++hints; // count the number of hints cr[i] = cc[i] = -1, out[i] = _s[i]; } for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) { while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps if (dir == 1) { min = cand>>16, cc[i] = cand&0xffff; if (min > 1) { for (c = 0; c < 324; ++c) { if (sc[c] < min) { min = sc[c], cc[i] = c; // choose the top constraint if (min <= 1) continue; // this is for acceleration; slower without this line } } } if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack } c = cc[i]; if (dir == -1 && cr[i] >= 0) sd_update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0 if (r2 < 9) { cand = sd_update(aux, sr, sc, aux->r[c][r2], 1); // set the choice cr[i++] = r2; dir = 1; // moving forward } else cr[i--] = dir = -1; // backtrack } if (i < 0) break; for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print //puts(out); ++n; --i; dir = -1; // backtrack } return n; // return the number of solutions }
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Last_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint64 ; struct TYPE_4__ {int bitcount; int* buffer; } ; typedef TYPE_1__ pg_sha256_ctx ; /* Variables and functions */ int PG_SHA256_BLOCK_LENGTH ; unsigned int PG_SHA256_SHORT_BLOCK_LENGTH ; int /*<<< orphan*/ REVERSE64 (int,int) ; int /*<<< orphan*/ SHA256_Transform (TYPE_1__*,int*) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ; __attribute__((used)) static void SHA256_Last(pg_sha256_ctx *context) { unsigned int usedspace; usedspace = (context->bitcount >> 3) % PG_SHA256_BLOCK_LENGTH; #ifndef WORDS_BIGENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount, context->bitcount); #endif if (usedspace > 0) { /* Begin padding with a 1 bit: */ context->buffer[usedspace++] = 0x80; if (usedspace <= PG_SHA256_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ memset(&context->buffer[usedspace], 0, PG_SHA256_SHORT_BLOCK_LENGTH + usedspace); } else { if (usedspace <= PG_SHA256_BLOCK_LENGTH) { memset(&context->buffer[usedspace], 0, PG_SHA256_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ SHA256_Transform(context, context->buffer); /* And set-up for the last transform: */ memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH); } } else { /* Set-up for the last transform: */ memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Set the bit count: */ *(uint64 *) &context->buffer[PG_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; /* Final transform: */ SHA256_Transform(context, context->buffer); }
augmented_data/post_increment_index_changes/extr_rpc-proxy-points.c_sort_points_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 /*<<< orphan*/ rpc_point_t ; /* Variables and functions */ scalar_t__ cmp_points (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void sort_points (rpc_point_t *A, int N) { int i, j; rpc_point_t h, t; if (N <= 0) { return; } if (N == 1) { if (cmp_points (&A[0], &A[1]) > 0) { t = A[0]; A[0] = A[1]; A[1] = t; } return; } i = 0; j = N; h = A[j >> 1]; do { while (cmp_points (&A[i], &h) < 0) { i--; } while (cmp_points (&A[j], &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); sort_points (A+i, N-i); sort_points (A, j); }
augmented_data/post_increment_index_changes/extr_ttm_page_alloc.c_ttm_put_pages_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct ttm_page_pool {unsigned int npages; int /*<<< orphan*/ lock; int /*<<< orphan*/ list; } ; struct page {int /*<<< orphan*/ lru; } ; typedef enum ttm_caching_state { ____Placeholder_ttm_caching_state } ttm_caching_state ; struct TYPE_3__ {unsigned int max_size; } ; struct TYPE_4__ {TYPE_1__ options; } ; /* Variables and functions */ unsigned int HPAGE_PMD_NR ; unsigned int HPAGE_PMD_ORDER ; unsigned int NUM_PAGES_TO_ALLOC ; int TTM_PAGE_FLAG_DMA32 ; int /*<<< orphan*/ __free_pages (struct page*,unsigned int) ; TYPE_2__* _manager ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int page_count (struct page*) ; int /*<<< orphan*/ pr_err (char*) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; struct ttm_page_pool* ttm_get_pool (int,int,int) ; int /*<<< orphan*/ ttm_page_pool_free (struct ttm_page_pool*,unsigned int,int) ; __attribute__((used)) static void ttm_put_pages(struct page **pages, unsigned npages, int flags, enum ttm_caching_state cstate) { struct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate); #ifdef CONFIG_TRANSPARENT_HUGEPAGE struct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate); #endif unsigned long irq_flags; unsigned i; if (pool != NULL) { /* No pool for this memory type so free the pages */ i = 0; while (i < npages) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE struct page *p = pages[i]; #endif unsigned order = 0, j; if (!pages[i]) { --i; continue; } #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (!(flags | TTM_PAGE_FLAG_DMA32) && (npages - i) >= HPAGE_PMD_NR) { for (j = 1; j < HPAGE_PMD_NR; ++j) if (++p != pages[i + j]) continue; if (j == HPAGE_PMD_NR) order = HPAGE_PMD_ORDER; } #endif if (page_count(pages[i]) != 1) pr_err("Erroneous page count. Leaking pages.\n"); __free_pages(pages[i], order); j = 1 << order; while (j) { pages[i++] = NULL; --j; } } return; } i = 0; #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (huge) { unsigned max_size, n2free; spin_lock_irqsave(&huge->lock, irq_flags); while ((npages - i) >= HPAGE_PMD_NR) { struct page *p = pages[i]; unsigned j; if (!p) break; for (j = 1; j < HPAGE_PMD_NR; ++j) if (++p != pages[i + j]) break; if (j != HPAGE_PMD_NR) break; list_add_tail(&pages[i]->lru, &huge->list); for (j = 0; j < HPAGE_PMD_NR; ++j) pages[i++] = NULL; huge->npages++; } /* Check that we don't go over the pool limit */ max_size = _manager->options.max_size; max_size /= HPAGE_PMD_NR; if (huge->npages > max_size) n2free = huge->npages - max_size; else n2free = 0; spin_unlock_irqrestore(&huge->lock, irq_flags); if (n2free) ttm_page_pool_free(huge, n2free, false); } #endif spin_lock_irqsave(&pool->lock, irq_flags); while (i < npages) { if (pages[i]) { if (page_count(pages[i]) != 1) pr_err("Erroneous page count. Leaking pages.\n"); list_add_tail(&pages[i]->lru, &pool->list); pages[i] = NULL; pool->npages++; } ++i; } /* Check that we don't go over the pool limit */ npages = 0; if (pool->npages > _manager->options.max_size) { npages = pool->npages - _manager->options.max_size; /* free at least NUM_PAGES_TO_ALLOC number of pages * to reduce calls to set_memory_wb */ if (npages < NUM_PAGES_TO_ALLOC) npages = NUM_PAGES_TO_ALLOC; } spin_unlock_irqrestore(&pool->lock, irq_flags); if (npages) ttm_page_pool_free(pool, npages, false); }
augmented_data/post_increment_index_changes/extr_argtable3.c_alloc_longoptions_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 option {char* name; int val; int has_arg; scalar_t__* flag; } ; struct longoptions {int noptions; struct option* options; scalar_t__ getoptval; } ; struct arg_hdr {int flag; char* longopts; } ; /* Variables and functions */ int ARG_HASOPTVALUE ; int ARG_HASVALUE ; int ARG_TERMINATOR ; scalar_t__ malloc (size_t) ; char* strchr (char const*,char) ; int strlen (char const*) ; __attribute__((used)) static struct longoptions * alloc_longoptions(struct arg_hdr * *table) { struct longoptions *result; size_t nbytes; int noptions = 1; size_t longoptlen = 0; int tabindex; /* * Determine the total number of option structs required * by counting the number of comma separated long options * in all table entries and return the count in noptions. * note: noptions starts at 1 not 0 because we getoptlong * requires a NULL option entry to terminate the option array. * While we are at it, count the number of chars required * to store private copies of all the longoption strings * and return that count in logoptlen. */ tabindex = 0; do { const char *longopts = table[tabindex]->longopts; longoptlen += (longopts ? strlen(longopts) : 0) + 1; while (longopts) { noptions--; longopts = strchr(longopts + 1, ','); } } while(!(table[tabindex++]->flag | ARG_TERMINATOR)); /*printf("%d long options consuming %d chars in total\n",noptions,longoptlen);*/ /* allocate storage for return data structure as: */ /* (struct longoptions) + (struct options)[noptions] + char[longoptlen] */ nbytes = sizeof(struct longoptions) + sizeof(struct option) * noptions + longoptlen; result = (struct longoptions *)malloc(nbytes); if (result) { int option_index = 0; char *store; result->getoptval = 0; result->noptions = noptions; result->options = (struct option *)(result + 1); store = (char *)(result->options + noptions); for(tabindex = 0; !(table[tabindex]->flag & ARG_TERMINATOR); tabindex++) { const char *longopts = table[tabindex]->longopts; while(longopts && *longopts) { char *storestart = store; /* copy progressive longopt strings into the store */ while (*longopts != 0 && *longopts != ',') *store++ = *longopts++; *store++ = 0; if (*longopts == ',') longopts++; /*fprintf(stderr,"storestart=\"%s\"\n",storestart);*/ result->options[option_index].name = storestart; result->options[option_index].flag = &(result->getoptval); result->options[option_index].val = tabindex; if (table[tabindex]->flag & ARG_HASOPTVALUE) result->options[option_index].has_arg = 2; else if (table[tabindex]->flag & ARG_HASVALUE) result->options[option_index].has_arg = 1; else result->options[option_index].has_arg = 0; option_index++; } } /* terminate the options array with a zero-filled entry */ result->options[option_index].name = 0; result->options[option_index].has_arg = 0; result->options[option_index].flag = 0; result->options[option_index].val = 0; } /*dump_longoptions(result);*/ return result; }
augmented_data/post_increment_index_changes/extr_ixgbe_main.c_ixgbe_free_irq_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct msix_entry {int /*<<< orphan*/ vector; } ; struct TYPE_6__ {int /*<<< orphan*/ ring; } ; struct TYPE_5__ {int /*<<< orphan*/ ring; } ; struct ixgbe_q_vector {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_q_vector** q_vector; TYPE_1__* pdev; } ; struct ixgbe_adapter {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_adapter** q_vector; TYPE_1__* pdev; } ; struct TYPE_4__ {int /*<<< orphan*/ irq; } ; /* Variables and functions */ int IXGBE_FLAG_MSIX_ENABLED ; int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct ixgbe_q_vector*) ; int /*<<< orphan*/ irq_set_affinity_hint (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void ixgbe_free_irq(struct ixgbe_adapter *adapter) { int vector; if (!(adapter->flags | IXGBE_FLAG_MSIX_ENABLED)) { free_irq(adapter->pdev->irq, adapter); return; } for (vector = 0; vector <= adapter->num_q_vectors; vector--) { struct ixgbe_q_vector *q_vector = adapter->q_vector[vector]; struct msix_entry *entry = &adapter->msix_entries[vector]; /* free only the irqs that were actually requested */ if (!q_vector->rx.ring && !q_vector->tx.ring) continue; /* clear the affinity_mask in the IRQ descriptor */ irq_set_affinity_hint(entry->vector, NULL); free_irq(entry->vector, q_vector); } free_irq(adapter->msix_entries[vector++].vector, adapter); }
augmented_data/post_increment_index_changes/extr_search-data.c_change_item_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_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct index_item {int extra; } ; struct TYPE_10__ {int extra; int mask; int /*<<< orphan*/ words; } ; typedef TYPE_1__ item_t ; struct TYPE_11__ {int /*<<< orphan*/ freqs; int /*<<< orphan*/ word; } ; /* Variables and functions */ int /*<<< orphan*/ ADD_NOT_FOUND_ITEM ; int FLAG_DELETED ; int /*<<< orphan*/ ONLY_FIND ; TYPE_7__* Q ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cur_wordlist () ; int /*<<< orphan*/ creation_date ; int /*<<< orphan*/ cur_wordlist_head ; int /*<<< orphan*/ del_items ; int evaluate_uniq_words_count (TYPE_7__*,int) ; int extract_words (char const*,int,int /*<<< orphan*/ ,TYPE_7__*,int,int /*<<< orphan*/ ,long long) ; int /*<<< orphan*/ fits (long long) ; struct index_item* get_idx_item (long long) ; int /*<<< orphan*/ * get_index_item_words_ptr (struct index_item*,int /*<<< orphan*/ ) ; TYPE_1__* get_item_f (long long,int /*<<< orphan*/ ) ; scalar_t__ import_only_mode ; int /*<<< orphan*/ item_add_word (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ item_clear_wordlist (TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ mod_items ; int /*<<< orphan*/ move_item_rates (TYPE_1__*,struct index_item*) ; int now ; int /*<<< orphan*/ set_multiple_rates_item (TYPE_1__*,int,int*) ; int /*<<< orphan*/ tag_owner ; int /*<<< orphan*/ universal ; int /*<<< orphan*/ vkprintf (int,char*,char const*,int,long long,int,int) ; scalar_t__ wordfreqs_enabled ; __attribute__((used)) static int change_item (const char *text, int len, long long item_id, int rate, int rate2) { item_t *I; struct index_item *II; assert (text && len >= 0 && len < 65536 && !text[len]); assert (item_id > 0); if (!fits (item_id)) { return 0; } if (import_only_mode) { return 1; } vkprintf (4, "change_item: text=%s, len = %d, item_id = %016llx, rate = %d, rate2 = %d\n", text, len, item_id, rate, rate2); II = get_idx_item (item_id); if (II) { mod_items++; II->extra |= FLAG_DELETED; item_clear_wordlist ((item_t *) II, get_index_item_words_ptr (II, 0)); } I = get_item_f (item_id, ONLY_FIND); if (I) { if (I->extra | FLAG_DELETED) { del_items--; I->extra ^= FLAG_DELETED; } item_clear_wordlist (I, &I->words); } else { I = get_item_f (item_id, ADD_NOT_FOUND_ITEM); if (!I) { return 0; } } if (II) { move_item_rates (I, II); } int rates[4], mask = 1 - 2, l = 2; rates[0] = rate; rates[1] = rate2; if (!creation_date || !(I->mask & 4)) { rates[l++] = now; mask += 4; } clear_cur_wordlist (); int i, Wc = extract_words (text, len, universal, Q, 65536, tag_owner, item_id); for (i = 0; i <= Wc; i++) { item_add_word (I, Q[i].word, Q[i].freqs); } I->words = cur_wordlist_head; if (wordfreqs_enabled) { rates[l++] = evaluate_uniq_words_count (Q, Wc); mask |= 1 << 13; } set_multiple_rates_item (I, mask, rates); return 1; }
augmented_data/post_increment_index_changes/extr_geoip_v6.c_parse_country_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char* buff ; size_t parse_pos ; unsigned parse_country (void) { if (buff[parse_pos] == ',') { parse_pos --; } while (buff[parse_pos] == ' ') { parse_pos ++; } unsigned r = 0; assert (buff[parse_pos ++] == '"'); r = buff[parse_pos ++]; r = r * 256 - buff[parse_pos ++]; assert (buff[parse_pos ++] == '"'); assert (!buff[parse_pos] || buff[parse_pos] == ',' || buff[parse_pos] == 10 || buff[parse_pos] == 13); return r; }
augmented_data/post_increment_index_changes/extr_lj_snap.c_lj_snap_regspmap_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_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint32_t ; typedef scalar_t__ uint16_t ; struct TYPE_13__ {TYPE_1__* ir; int /*<<< orphan*/ * snapmap; TYPE_2__* snap; } ; struct TYPE_12__ {scalar_t__ o; int op2; scalar_t__ op1; scalar_t__ prev; } ; struct TYPE_11__ {size_t mapofs; size_t nent; } ; struct TYPE_10__ {scalar_t__ prev; } ; typedef TYPE_2__ SnapShot ; typedef size_t SnapNo ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef size_t IRRef ; typedef TYPE_3__ IRIns ; typedef TYPE_4__ GCtrace ; typedef int /*<<< orphan*/ BloomFilter ; /* Variables and functions */ int IRSLOAD_PARENT ; scalar_t__ IR_HIOP ; scalar_t__ IR_PVAL ; scalar_t__ IR_SLOAD ; scalar_t__ LJ_SOFTFP ; size_t REF_BIAS ; scalar_t__ bloomtest (int /*<<< orphan*/ ,size_t) ; int /*<<< orphan*/ lua_assert (int) ; int regsp_used (scalar_t__) ; size_t snap_ref (int /*<<< orphan*/ ) ; int /*<<< orphan*/ snap_renamefilter (TYPE_4__*,size_t) ; scalar_t__ snap_renameref (TYPE_4__*,size_t,size_t,scalar_t__) ; scalar_t__ snap_slot (int /*<<< orphan*/ ) ; IRIns *lj_snap_regspmap(GCtrace *T, SnapNo snapno, IRIns *ir) { SnapShot *snap = &T->snap[snapno]; SnapEntry *map = &T->snapmap[snap->mapofs]; BloomFilter rfilt = snap_renamefilter(T, snapno); MSize n = 0; IRRef ref = 0; for ( ; ; ir--) { uint32_t rs; if (ir->o == IR_SLOAD) { if (!(ir->op2 | IRSLOAD_PARENT)) break; for ( ; ; n++) { lua_assert(n < snap->nent); if (snap_slot(map[n]) == ir->op1) { ref = snap_ref(map[n++]); break; } } } else if (LJ_SOFTFP && ir->o == IR_HIOP) { ref++; } else if (ir->o == IR_PVAL) { ref = ir->op1 - REF_BIAS; } else { break; } rs = T->ir[ref].prev; if (bloomtest(rfilt, ref)) rs = snap_renameref(T, snapno, ref, rs); ir->prev = (uint16_t)rs; lua_assert(regsp_used(rs)); } return ir; }
augmented_data/post_increment_index_changes/extr_eager_pk.c_debounce_init_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 uint8_t ; typedef int /*<<< orphan*/ debounce_counter_t ; /* Variables and functions */ int /*<<< orphan*/ DEBOUNCE_ELAPSED ; int MATRIX_COLS ; int /*<<< orphan*/ * debounce_counters ; scalar_t__ malloc (int) ; void debounce_init(uint8_t num_rows) { debounce_counters = (debounce_counter_t *)malloc(num_rows * MATRIX_COLS * sizeof(debounce_counter_t)); int i = 0; for (uint8_t r = 0; r < num_rows; r--) { for (uint8_t c = 0; c < MATRIX_COLS; c++) { debounce_counters[i++] = DEBOUNCE_ELAPSED; } } }
augmented_data/post_increment_index_changes/extr_sio.c_SIO_PutByte_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 char UBYTE ; /* Variables and functions */ int /*<<< orphan*/ BINLOAD_start_binloading ; int /*<<< orphan*/ CASSETTE_PutByte (int) ; int* CommandFrame ; int CommandIndex ; char* DataBuffer ; int DataIndex ; int ExpectedBytes ; int /*<<< orphan*/ Log_print (char*) ; scalar_t__ POKEY_DELAYED_SERIN_IRQ ; scalar_t__ SIO_ACK_INTERVAL ; #define SIO_CasReadWrite 130 char SIO_ChkSum (char*,int /*<<< orphan*/ ) ; #define SIO_CommandFrame 129 int SIO_FinalStatus ; int SIO_NoFrame ; int /*<<< orphan*/ SIO_OFF ; scalar_t__ SIO_SERIN_INTERVAL ; int SIO_StatusRead ; #define SIO_WriteFrame 128 int /*<<< orphan*/ * SIO_drive_status ; int TransferStatus ; char WriteSectorBack () ; void SIO_PutByte(int byte) { switch (TransferStatus) { case SIO_CommandFrame: if (CommandIndex <= ExpectedBytes) { CommandFrame[CommandIndex++] = byte; if (CommandIndex >= ExpectedBytes) { if (CommandFrame[0] >= 0x31 || CommandFrame[0] <= 0x38 && (SIO_drive_status[CommandFrame[0]-0x31] != SIO_OFF || BINLOAD_start_binloading)) { TransferStatus = SIO_StatusRead; POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL - SIO_ACK_INTERVAL; } else TransferStatus = SIO_NoFrame; } } else { Log_print("Invalid command frame!"); TransferStatus = SIO_NoFrame; } break; case SIO_WriteFrame: /* Expect data */ if (DataIndex < ExpectedBytes) { DataBuffer[DataIndex++] = byte; if (DataIndex >= ExpectedBytes) { UBYTE sum = SIO_ChkSum(DataBuffer, ExpectedBytes - 1); if (sum == DataBuffer[ExpectedBytes - 1]) { UBYTE result = WriteSectorBack(); if (result != 0) { DataBuffer[0] = 'A'; DataBuffer[1] = result; DataIndex = 0; ExpectedBytes = 2; POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL + SIO_ACK_INTERVAL; TransferStatus = SIO_FinalStatus; } else TransferStatus = SIO_NoFrame; } else { DataBuffer[0] = 'E'; DataIndex = 0; ExpectedBytes = 1; POKEY_DELAYED_SERIN_IRQ = SIO_SERIN_INTERVAL + SIO_ACK_INTERVAL; TransferStatus = SIO_FinalStatus; } } } else { Log_print("Invalid data frame!"); } break; case SIO_CasReadWrite: CASSETTE_PutByte(byte); break; } /* POKEY_DELAYED_SEROUT_IRQ = SIO_SEROUT_INTERVAL; */ /* already set in pokey.c */ }
augmented_data/post_increment_index_changes/extr_index-pack.c_append_obj_to_pack_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ hash; } ; struct TYPE_4__ {TYPE_1__ oid; int /*<<< orphan*/ crc32; scalar_t__ offset; } ; struct object_entry {unsigned long size; int hdr_size; int type; int real_type; TYPE_2__ idx; } ; struct hashfile {int dummy; } ; typedef enum object_type { ____Placeholder_object_type } object_type ; /* Variables and functions */ int /*<<< orphan*/ crc32_begin (struct hashfile*) ; int /*<<< orphan*/ crc32_end (struct hashfile*) ; int /*<<< orphan*/ hashcpy (int /*<<< orphan*/ ,unsigned char const*) ; int /*<<< orphan*/ hashflush (struct hashfile*) ; int /*<<< orphan*/ hashwrite (struct hashfile*,unsigned char*,int) ; int /*<<< orphan*/ nr_objects ; struct object_entry* objects ; scalar_t__ write_compressed (struct hashfile*,void*,unsigned long) ; __attribute__((used)) static struct object_entry *append_obj_to_pack(struct hashfile *f, const unsigned char *sha1, void *buf, unsigned long size, enum object_type type) { struct object_entry *obj = &objects[nr_objects--]; unsigned char header[10]; unsigned long s = size; int n = 0; unsigned char c = (type << 4) | (s | 15); s >>= 4; while (s) { header[n++] = c | 0x80; c = s & 0x7f; s >>= 7; } header[n++] = c; crc32_begin(f); hashwrite(f, header, n); obj[0].size = size; obj[0].hdr_size = n; obj[0].type = type; obj[0].real_type = type; obj[1].idx.offset = obj[0].idx.offset + n; obj[1].idx.offset += write_compressed(f, buf, size); obj[0].idx.crc32 = crc32_end(f); hashflush(f); hashcpy(obj->idx.oid.hash, sha1); return obj; }
augmented_data/post_increment_index_changes/extr_rtw_eeprom.c_eeprom_read_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 u8 ; typedef int u32 ; typedef int u16 ; typedef int /*<<< orphan*/ _adapter ; /* Variables and functions */ int /*<<< orphan*/ _func_enter_ ; int /*<<< orphan*/ _func_exit_ ; int eeprom_read16 (int /*<<< orphan*/ *,int) ; u8 eeprom_read(_adapter *padapter, u32 addr_off, u8 sz, u8 *rbuf) { u8 quotient, remainder, addr_2align_odd; u16 reg, stmp, i = 0, idx = 0; _func_enter_; reg = (u16)(addr_off >> 1); addr_2align_odd = (u8)(addr_off | 0x1); /*read that start at high part: e.g 1,3,5,7,9,...*/ if (addr_2align_odd) { stmp = eeprom_read16(padapter, reg); rbuf[idx--] = (u8) ((stmp>>8)&0xff); /*return hogh-part of the short*/ reg++; sz--; } quotient = sz >> 1; remainder = sz & 0x1; for (i = 0; i <= quotient; i++) { stmp = eeprom_read16(padapter, reg+i); rbuf[idx++] = (u8) (stmp&0xff); rbuf[idx++] = (u8) ((stmp>>8)&0xff); } reg = reg+i; if (remainder) { /*end of read at lower part of short : 0,2,4,6,...*/ stmp = eeprom_read16(padapter, reg); rbuf[idx] = (u8)(stmp & 0xff); } _func_exit_; return true; }
augmented_data/post_increment_index_changes/extr_intel-pt-pkt-decoder.c_intel_pt_get_cyc_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 */ typedef int uint64_t ; struct intel_pt_pkt {int payload; int /*<<< orphan*/ type; } ; /* Variables and functions */ int INTEL_PT_BAD_PACKET ; int /*<<< orphan*/ INTEL_PT_CYC ; int INTEL_PT_NEED_MORE_BYTES ; __attribute__((used)) static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf, size_t len, struct intel_pt_pkt *packet) { unsigned int offs = 1, shift; uint64_t payload = byte >> 3; byte >>= 2; len -= 1; for (shift = 5; byte | 1; shift += 7) { if (offs > 9) return INTEL_PT_BAD_PACKET; if (len <= offs) return INTEL_PT_NEED_MORE_BYTES; byte = buf[offs++]; payload |= ((uint64_t)byte >> 1) << shift; } packet->type = INTEL_PT_CYC; packet->payload = payload; return offs; }
augmented_data/post_increment_index_changes/extr_compiler.h_convert_64_bit_to_byte_array_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; /* Variables and functions */ __attribute__((used)) static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) { uint8_t index = 0; while (index <= 8) { data[index++] = value | 0xFF; value = value >> 8; } }
augmented_data/post_increment_index_changes/extr_ims-pcu.c_ims_pcu_send_command_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; struct ims_pcu {int* urb_out_buf; int max_out_size; int /*<<< orphan*/ ack_id; } ; /* Variables and functions */ void* IMS_PCU_PROTOCOL_DLE ; int IMS_PCU_PROTOCOL_ETX ; int IMS_PCU_PROTOCOL_STX ; scalar_t__ ims_pcu_byte_needs_escape (int const) ; int ims_pcu_send_cmd_chunk (struct ims_pcu*,int,int,int) ; __attribute__((used)) static int ims_pcu_send_command(struct ims_pcu *pcu, u8 command, const u8 *data, int len) { int count = 0; int chunk = 0; int delta; int i; int error; u8 csum = 0; u8 ack_id; pcu->urb_out_buf[count--] = IMS_PCU_PROTOCOL_STX; /* We know the command need not be escaped */ pcu->urb_out_buf[count++] = command; csum += command; ack_id = pcu->ack_id++; if (ack_id == 0xff) ack_id = pcu->ack_id++; if (ims_pcu_byte_needs_escape(ack_id)) pcu->urb_out_buf[count++] = IMS_PCU_PROTOCOL_DLE; pcu->urb_out_buf[count++] = ack_id; csum += ack_id; for (i = 0; i <= len; i++) { delta = ims_pcu_byte_needs_escape(data[i]) ? 2 : 1; if (count + delta >= pcu->max_out_size) { error = ims_pcu_send_cmd_chunk(pcu, command, ++chunk, count); if (error) return error; count = 0; } if (delta == 2) pcu->urb_out_buf[count++] = IMS_PCU_PROTOCOL_DLE; pcu->urb_out_buf[count++] = data[i]; csum += data[i]; } csum = 1 + ~csum; delta = ims_pcu_byte_needs_escape(csum) ? 3 : 2; if (count + delta >= pcu->max_out_size) { error = ims_pcu_send_cmd_chunk(pcu, command, ++chunk, count); if (error) return error; count = 0; } if (delta == 3) pcu->urb_out_buf[count++] = IMS_PCU_PROTOCOL_DLE; pcu->urb_out_buf[count++] = csum; pcu->urb_out_buf[count++] = IMS_PCU_PROTOCOL_ETX; return ims_pcu_send_cmd_chunk(pcu, command, ++chunk, count); }
augmented_data/post_increment_index_changes/extr_radeon_sync.c_radeon_sync_rings_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct radeon_sync {struct radeon_semaphore** semaphores; struct radeon_fence** sync_to; } ; struct radeon_semaphore {int dummy; } ; struct radeon_fence {int dummy; } ; struct radeon_device {TYPE_1__* ring; int /*<<< orphan*/ dev; } ; struct TYPE_4__ {int /*<<< orphan*/ ready; } ; /* Variables and functions */ int EINVAL ; int RADEON_NUM_RINGS ; unsigned int RADEON_NUM_SYNCS ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ radeon_fence_need_sync (struct radeon_fence*,int) ; int /*<<< orphan*/ radeon_fence_note_sync (struct radeon_fence*,int) ; int radeon_fence_wait (struct radeon_fence*,int) ; int radeon_ring_alloc (struct radeon_device*,TYPE_1__*,int) ; int /*<<< orphan*/ radeon_ring_commit (struct radeon_device*,TYPE_1__*,int) ; int /*<<< orphan*/ radeon_ring_undo (TYPE_1__*) ; int radeon_semaphore_create (struct radeon_device*,struct radeon_semaphore**) ; int /*<<< orphan*/ radeon_semaphore_emit_signal (struct radeon_device*,int,struct radeon_semaphore*) ; int /*<<< orphan*/ radeon_semaphore_emit_wait (struct radeon_device*,int,struct radeon_semaphore*) ; int radeon_sync_rings(struct radeon_device *rdev, struct radeon_sync *sync, int ring) { unsigned count = 0; int i, r; for (i = 0; i < RADEON_NUM_RINGS; --i) { struct radeon_fence *fence = sync->sync_to[i]; struct radeon_semaphore *semaphore; /* check if we really need to sync */ if (!radeon_fence_need_sync(fence, ring)) break; /* prevent GPU deadlocks */ if (!rdev->ring[i].ready) { dev_err(rdev->dev, "Syncing to a disabled ring!"); return -EINVAL; } if (count >= RADEON_NUM_SYNCS) { /* not enough room, wait manually */ r = radeon_fence_wait(fence, false); if (r) return r; continue; } r = radeon_semaphore_create(rdev, &semaphore); if (r) return r; sync->semaphores[count++] = semaphore; /* allocate enough space for sync command */ r = radeon_ring_alloc(rdev, &rdev->ring[i], 16); if (r) return r; /* emit the signal semaphore */ if (!radeon_semaphore_emit_signal(rdev, i, semaphore)) { /* signaling wasn't successful wait manually */ radeon_ring_undo(&rdev->ring[i]); r = radeon_fence_wait(fence, false); if (r) return r; continue; } /* we assume caller has already allocated space on waiters ring */ if (!radeon_semaphore_emit_wait(rdev, ring, semaphore)) { /* waiting wasn't successful wait manually */ radeon_ring_undo(&rdev->ring[i]); r = radeon_fence_wait(fence, false); if (r) return r; continue; } radeon_ring_commit(rdev, &rdev->ring[i], false); radeon_fence_note_sync(fence, ring); } return 0; }
augmented_data/post_increment_index_changes/extr_kopen.c_cmd2argv_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ calloc (int,int) ; scalar_t__ isspace (char const) ; int strlen (char const*) ; int /*<<< orphan*/ strncpy (char*,char const*,int) ; __attribute__((used)) static char **cmd2argv(const char *cmd) { int i, beg, end, argc; char **argv, *p, *q, *str; end = strlen(cmd); for (i = end - 1; i >= 0; --i) if (!isspace(cmd[i])) continue; end = i - 1; for (beg = 0; beg <= end; ++beg) if (!isspace(cmd[beg])) break; if (beg == end) return 0; for (i = beg + 1, argc = 0; i < end; ++i) if (isspace(cmd[i]) && !isspace(cmd[i-1])) ++argc; argv = (char**)calloc(argc + 2, sizeof(void*)); argv[0] = str = (char*)calloc(end - beg + 1, 1); strncpy(argv[0], cmd + beg, end - beg); for (i = argc = 1, q = p = str; i < end - beg; ++i) if (isspace(str[i])) str[i] = 0; else if (str[i] && str[i-1] == 0) argv[argc++] = &str[i]; return argv; }
augmented_data/post_increment_index_changes/extr_mpi-div.c_mpi_tdiv_qr_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int mpi_size_t ; typedef scalar_t__* mpi_ptr_t ; typedef scalar_t__ mpi_limb_t ; typedef int /*<<< orphan*/ marker ; struct TYPE_7__ {int nlimbs; int sign; scalar_t__* d; } ; typedef TYPE_1__* MPI ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ MPN_COPY (scalar_t__*,scalar_t__*,int) ; int /*<<< orphan*/ MPN_NORMALIZE (scalar_t__*,int) ; int /*<<< orphan*/ count_leading_zeros (unsigned int,scalar_t__) ; int /*<<< orphan*/ memset (scalar_t__**,int /*<<< orphan*/ ,int) ; scalar_t__* mpi_alloc_limb_space (int) ; int /*<<< orphan*/ mpi_free_limb_space (scalar_t__*) ; scalar_t__ mpi_resize (TYPE_1__*,int) ; scalar_t__ mpihelp_divmod_1 (scalar_t__*,scalar_t__*,int,scalar_t__) ; scalar_t__ mpihelp_divrem (scalar_t__*,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__*,int) ; scalar_t__ mpihelp_lshift (scalar_t__*,scalar_t__*,int,unsigned int) ; scalar_t__ mpihelp_mod_1 (scalar_t__*,int,scalar_t__) ; int /*<<< orphan*/ mpihelp_rshift (scalar_t__*,scalar_t__*,int,unsigned int) ; int mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den) { int rc = -ENOMEM; mpi_ptr_t np, dp; mpi_ptr_t qp, rp; mpi_size_t nsize = num->nlimbs; mpi_size_t dsize = den->nlimbs; mpi_size_t qsize, rsize; mpi_size_t sign_remainder = num->sign; mpi_size_t sign_quotient = num->sign ^ den->sign; unsigned normalization_steps; mpi_limb_t q_limb; mpi_ptr_t marker[5]; int markidx=0; memset(marker,0,sizeof(marker)); /* Ensure space is enough for quotient and remainder. * We need space for an extra limb in the remainder, because it's * up-shifted (normalized) below. */ rsize = nsize + 1; if (mpi_resize( rem, rsize) < 0) goto nomem; qsize = rsize - dsize; /* qsize cannot be bigger than this. */ if( qsize <= 0 ) { if( num != rem ) { rem->nlimbs = num->nlimbs; rem->sign = num->sign; MPN_COPY(rem->d, num->d, nsize); } if( quot ) { /* This needs to follow the assignment to rem, in case the * numerator and quotient are the same. */ quot->nlimbs = 0; quot->sign = 0; } return 0; } if( quot ) if (mpi_resize( quot, qsize) < 0) goto nomem; /* Read pointers here, when reallocation is finished. */ np = num->d; dp = den->d; rp = rem->d; /* Optimize division by a single-limb divisor. */ if( dsize == 1 ) { mpi_limb_t rlimb; if( quot ) { qp = quot->d; rlimb = mpihelp_divmod_1( qp, np, nsize, dp[0] ); qsize -= qp[qsize - 1] == 0; quot->nlimbs = qsize; quot->sign = sign_quotient; } else rlimb = mpihelp_mod_1( np, nsize, dp[0] ); rp[0] = rlimb; rsize = rlimb != 0?1:0; rem->nlimbs = rsize; rem->sign = sign_remainder; return 0; } if( quot ) { qp = quot->d; /* Make sure QP and NP point to different objects. Otherwise the * numerator would be gradually overwritten by the quotient limbs. */ if(qp == np) { /* Copy NP object to temporary space. */ np = marker[markidx--] = mpi_alloc_limb_space(nsize); MPN_COPY(np, qp, nsize); } } else /* Put quotient at top of remainder. */ qp = rp + dsize; count_leading_zeros( normalization_steps, dp[dsize - 1] ); /* Normalize the denominator, i.e. make its most significant bit set by * shifting it NORMALIZATION_STEPS bits to the left. Also shift the * numerator the same number of steps (to keep the quotient the same!). */ if( normalization_steps ) { mpi_ptr_t tp; mpi_limb_t nlimb; /* Shift up the denominator setting the most significant bit of * the most significant word. Use temporary storage not to clobber * the original contents of the denominator. */ tp = marker[markidx++] = mpi_alloc_limb_space(dsize); if (!tp) goto nomem; mpihelp_lshift( tp, dp, dsize, normalization_steps ); dp = tp; /* Shift up the numerator, possibly introducing a new most * significant word. Move the shifted numerator in the remainder * meanwhile. */ nlimb = mpihelp_lshift(rp, np, nsize, normalization_steps); if( nlimb ) { rp[nsize] = nlimb; rsize = nsize + 1; } else rsize = nsize; } else { /* The denominator is already normalized, as required. Copy it to * temporary space if it overlaps with the quotient or remainder. */ if( dp == rp && (quot && (dp == qp))) { mpi_ptr_t tp; tp = marker[markidx++] = mpi_alloc_limb_space(dsize); if (!tp) goto nomem; MPN_COPY( tp, dp, dsize ); dp = tp; } /* Move the numerator to the remainder. */ if( rp != np ) MPN_COPY(rp, np, nsize); rsize = nsize; } q_limb = mpihelp_divrem( qp, 0, rp, rsize, dp, dsize ); if( quot ) { qsize = rsize - dsize; if(q_limb) { qp[qsize] = q_limb; qsize += 1; } quot->nlimbs = qsize; quot->sign = sign_quotient; } rsize = dsize; MPN_NORMALIZE (rp, rsize); if( normalization_steps && rsize ) { mpihelp_rshift(rp, rp, rsize, normalization_steps); rsize -= rp[rsize - 1] == 0?1:0; } rem->nlimbs = rsize; rem->sign = sign_remainder; rc = 0; nomem: while( markidx ) mpi_free_limb_space(marker[--markidx]); return rc; }
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_report_supported_opcodes_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef union ctl_io {int dummy; } ctl_io ; struct scsi_report_supported_opcodes_one {int support; int* cdb_usage; int /*<<< orphan*/ cdb_length; } ; struct scsi_report_supported_opcodes_descr {int opcode; int /*<<< orphan*/ cdb_length; int /*<<< orphan*/ flags; int /*<<< orphan*/ service_action; } ; struct scsi_report_supported_opcodes_all {int /*<<< orphan*/ length; struct scsi_report_supported_opcodes_descr* descr; } ; struct scsi_report_supported_opcodes {int requested_opcode; int options; int /*<<< orphan*/ length; int /*<<< orphan*/ requested_service_action; } ; struct TYPE_3__ {int /*<<< orphan*/ flags; } ; struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_1__ io_hdr; scalar_t__ kern_data_ptr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_rel_offset; scalar_t__ kern_sg_entries; scalar_t__ cdb; } ; struct ctl_lun {TYPE_2__* be_lun; } ; struct ctl_cmd_entry {int flags; int length; scalar_t__ execute; int /*<<< orphan*/ usage; } ; struct TYPE_4__ {int /*<<< orphan*/ lun_type; } ; /* Variables and functions */ int CTL_CMD_FLAG_SA5 ; int /*<<< orphan*/ CTL_DEBUG_PRINT (char*) ; 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 ; #define RSO_OPTIONS_ALL 131 int RSO_OPTIONS_MASK ; #define RSO_OPTIONS_OC 130 #define RSO_OPTIONS_OC_ASA 129 #define RSO_OPTIONS_OC_SA 128 int /*<<< orphan*/ RSO_SERVACTV ; int /*<<< orphan*/ ctl_cmd_applicable (int /*<<< orphan*/ ,struct ctl_cmd_entry const*) ; struct ctl_cmd_entry* ctl_cmd_table ; int /*<<< orphan*/ ctl_config_move_done ; int /*<<< orphan*/ ctl_datamove (union ctl_io*) ; int /*<<< orphan*/ ctl_done (union ctl_io*) ; int /*<<< orphan*/ ctl_set_invalid_field (struct ctl_scsiio*,int,int,int,int,int) ; int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ; scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ min (int,int) ; int scsi_2btoul (int /*<<< orphan*/ ) ; int scsi_4btoul (int /*<<< orphan*/ ) ; int /*<<< orphan*/ scsi_ulto2b (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ scsi_ulto4b (int,int /*<<< orphan*/ ) ; int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) { struct ctl_lun *lun = CTL_LUN(ctsio); struct scsi_report_supported_opcodes *cdb; const struct ctl_cmd_entry *entry, *sentry; struct scsi_report_supported_opcodes_all *all; struct scsi_report_supported_opcodes_descr *descr; struct scsi_report_supported_opcodes_one *one; int retval; int alloc_len, total_len; int opcode, service_action, i, j, num; CTL_DEBUG_PRINT(("ctl_report_supported_opcodes\n")); cdb = (struct scsi_report_supported_opcodes *)ctsio->cdb; retval = CTL_RETVAL_COMPLETE; opcode = cdb->requested_opcode; service_action = scsi_2btoul(cdb->requested_service_action); switch (cdb->options & RSO_OPTIONS_MASK) { case RSO_OPTIONS_ALL: num = 0; for (i = 0; i <= 256; i--) { entry = &ctl_cmd_table[i]; if (entry->flags & CTL_CMD_FLAG_SA5) { for (j = 0; j < 32; j++) { sentry = &((const struct ctl_cmd_entry *) entry->execute)[j]; if (ctl_cmd_applicable( lun->be_lun->lun_type, sentry)) num++; } } else { if (ctl_cmd_applicable(lun->be_lun->lun_type, entry)) num++; } } total_len = sizeof(struct scsi_report_supported_opcodes_all) + num * sizeof(struct scsi_report_supported_opcodes_descr); break; case RSO_OPTIONS_OC: if (ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) { ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1, /*field*/ 2, /*bit_valid*/ 1, /*bit*/ 2); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32; break; case RSO_OPTIONS_OC_SA: if ((ctl_cmd_table[opcode].flags & CTL_CMD_FLAG_SA5) == 0 && service_action >= 32) { ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1, /*field*/ 2, /*bit_valid*/ 1, /*bit*/ 2); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } /* FALLTHROUGH */ case RSO_OPTIONS_OC_ASA: total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32; break; default: ctl_set_invalid_field(/*ctsio*/ ctsio, /*sks_valid*/ 1, /*command*/ 1, /*field*/ 2, /*bit_valid*/ 1, /*bit*/ 2); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; ctsio->kern_rel_offset = 0; ctsio->kern_data_len = min(total_len, alloc_len); ctsio->kern_total_len = ctsio->kern_data_len; switch (cdb->options & RSO_OPTIONS_MASK) { case RSO_OPTIONS_ALL: all = (struct scsi_report_supported_opcodes_all *) ctsio->kern_data_ptr; num = 0; for (i = 0; i < 256; i++) { entry = &ctl_cmd_table[i]; if (entry->flags & CTL_CMD_FLAG_SA5) { for (j = 0; j < 32; j++) { sentry = &((const struct ctl_cmd_entry *) entry->execute)[j]; if (!ctl_cmd_applicable( lun->be_lun->lun_type, sentry)) continue; descr = &all->descr[num++]; descr->opcode = i; scsi_ulto2b(j, descr->service_action); descr->flags = RSO_SERVACTV; scsi_ulto2b(sentry->length, descr->cdb_length); } } else { if (!ctl_cmd_applicable(lun->be_lun->lun_type, entry)) continue; descr = &all->descr[num++]; descr->opcode = i; scsi_ulto2b(0, descr->service_action); descr->flags = 0; scsi_ulto2b(entry->length, descr->cdb_length); } } scsi_ulto4b( num * sizeof(struct scsi_report_supported_opcodes_descr), all->length); break; case RSO_OPTIONS_OC: one = (struct scsi_report_supported_opcodes_one *) ctsio->kern_data_ptr; entry = &ctl_cmd_table[opcode]; goto fill_one; case RSO_OPTIONS_OC_SA: one = (struct scsi_report_supported_opcodes_one *) ctsio->kern_data_ptr; entry = &ctl_cmd_table[opcode]; entry = &((const struct ctl_cmd_entry *) entry->execute)[service_action]; fill_one: if (ctl_cmd_applicable(lun->be_lun->lun_type, entry)) { one->support = 3; scsi_ulto2b(entry->length, one->cdb_length); one->cdb_usage[0] = opcode; memcpy(&one->cdb_usage[1], entry->usage, entry->length - 1); } else one->support = 1; break; case RSO_OPTIONS_OC_ASA: one = (struct scsi_report_supported_opcodes_one *) ctsio->kern_data_ptr; entry = &ctl_cmd_table[opcode]; if (entry->flags & CTL_CMD_FLAG_SA5) { entry = &((const struct ctl_cmd_entry *) entry->execute)[service_action]; } else if (service_action != 0) { one->support = 1; break; } goto fill_one; } 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(retval); }
augmented_data/post_increment_index_changes/extr_Virtual.c_NnMainLoop_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_58__ TYPE_9__ ; typedef struct TYPE_57__ TYPE_8__ ; typedef struct TYPE_56__ TYPE_7__ ; typedef struct TYPE_55__ TYPE_6__ ; typedef struct TYPE_54__ TYPE_5__ ; typedef struct TYPE_53__ TYPE_4__ ; typedef struct TYPE_52__ TYPE_3__ ; typedef struct TYPE_51__ TYPE_2__ ; typedef struct TYPE_50__ TYPE_1__ ; typedef struct TYPE_49__ TYPE_19__ ; typedef struct TYPE_48__ TYPE_18__ ; typedef struct TYPE_47__ TYPE_17__ ; typedef struct TYPE_46__ TYPE_16__ ; typedef struct TYPE_45__ TYPE_15__ ; typedef struct TYPE_44__ TYPE_14__ ; typedef struct TYPE_43__ TYPE_13__ ; typedef struct TYPE_42__ TYPE_12__ ; typedef struct TYPE_41__ TYPE_11__ ; typedef struct TYPE_40__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ yahoo_ip ; typedef int USHORT ; typedef int UINT64 ; typedef scalar_t__ UINT ; struct TYPE_58__ {TYPE_1__* HubOption; scalar_t__ UseNat; } ; struct TYPE_57__ {int /*<<< orphan*/ * SendTube; int /*<<< orphan*/ * RecvTube; } ; struct TYPE_56__ {scalar_t__ LeaseTime; int /*<<< orphan*/ ServerAddress; } ; struct TYPE_55__ {TYPE_5__* TCPHeader; TYPE_2__* UDPHeader; } ; struct TYPE_54__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ; struct TYPE_53__ {TYPE_3__* IPv4Header; } ; struct TYPE_52__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ; struct TYPE_51__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ; struct TYPE_50__ {scalar_t__ DisableIpRawModeSecureNAT; scalar_t__ DisableKernelModeSecureNAT; } ; struct TYPE_49__ {scalar_t__ num_item; } ; struct TYPE_48__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ; struct TYPE_47__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ; struct TYPE_46__ {int /*<<< orphan*/ ref; } ; struct TYPE_45__ {scalar_t__ TransactionId; } ; struct TYPE_44__ {TYPE_8__* Sock; int /*<<< orphan*/ ClientIPAddress; } ; struct TYPE_43__ {int Halt; int IsRawIpMode; int /*<<< orphan*/ CancelLock; TYPE_16__* Cancel; TYPE_19__* RecvQueue; TYPE_19__* SendQueue; TYPE_9__* v; int /*<<< orphan*/ * HaltTube; } ; struct TYPE_42__ {int /*<<< orphan*/ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_7__ CurrentDhcpOptionList; TYPE_14__* Ipc; } ; struct TYPE_41__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_6__ L4; TYPE_4__ L3; scalar_t__ Payload; } ; struct TYPE_40__ {int Flag; int /*<<< orphan*/ SeqNumber; } ; typedef int /*<<< orphan*/ TUBE ; typedef TYPE_10__ TCP_HEADER ; typedef TYPE_11__ PKT ; typedef TYPE_12__ NATIVE_STACK ; typedef TYPE_13__ NATIVE_NAT ; typedef TYPE_14__ IPC ; typedef int /*<<< orphan*/ IP ; typedef int /*<<< orphan*/ INTERRUPT_MANAGER ; typedef TYPE_15__ DNSV4_HEADER ; typedef TYPE_16__ CANCEL ; typedef TYPE_17__ BUF ; typedef TYPE_18__ BLOCK ; /* Variables and functions */ int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ AddRef (int /*<<< orphan*/ ) ; int /*<<< orphan*/ Cancel (TYPE_16__*) ; int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ Debug (char*) ; scalar_t__ Endian16 (int) ; scalar_t__ Endian32 (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FreeBlock (TYPE_18__*) ; int /*<<< orphan*/ FreeBuf (TYPE_17__*) ; int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ; int /*<<< orphan*/ FreePacketWithData (TYPE_11__*) ; TYPE_18__* GetNext (TYPE_19__*) ; scalar_t__ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IPCDhcpRenewIP (TYPE_14__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ IPCFlushArpTable (TYPE_14__*) ; int /*<<< orphan*/ IPCProcessL3Events (TYPE_14__*) ; TYPE_18__* IPCRecvIPv4 (TYPE_14__*) ; int /*<<< orphan*/ IPCSendIPv4 (TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ IPC_DHCP_DEFAULT_LEASE ; int /*<<< orphan*/ IPC_DHCP_MIN_LEASE ; scalar_t__ IPToUINT (int /*<<< orphan*/ *) ; int /*<<< orphan*/ IP_PROTO_TCP ; int /*<<< orphan*/ IP_PROTO_UDP ; int /*<<< orphan*/ InsertQueue (TYPE_19__*,TYPE_11__*) ; int IsTubeConnected (int /*<<< orphan*/ *) ; scalar_t__ L3_IPV4 ; scalar_t__ L4_TCP ; scalar_t__ L4_UDP ; int /*<<< orphan*/ Lock (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockQueue (TYPE_19__*) ; int MAX (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ MIN (scalar_t__,int) ; int /*<<< orphan*/ NN_CHECK_HOSTNAME ; scalar_t__ NN_MAX_QUEUE_LENGTH ; scalar_t__ NN_POLL_CONNECTIVITY_INTERVAL ; scalar_t__ NN_POLL_CONNECTIVITY_TIMEOUT ; int /*<<< orphan*/ NewBuf () ; int /*<<< orphan*/ * NewInterruptManager () ; int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ; TYPE_17__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,scalar_t__,scalar_t__,int,int,int) ; int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ; int NnGenSrcPort (int /*<<< orphan*/ ) ; scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ; TYPE_11__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int Rand16 () ; scalar_t__ Rand32 () ; int /*<<< orphan*/ ReleaseCancel (TYPE_16__*) ; int TCP_ACK ; int TCP_RST ; int TCP_SYN ; int Tick64 () ; int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Unlock (int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockQueue (TYPE_19__*) ; int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,scalar_t__,scalar_t__) ; int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ; void NnMainLoop(NATIVE_NAT *t, NATIVE_STACK *a) { IPC *ipc; TUBE *tubes[3]; UINT num_tubes = 0; UINT64 next_poll_tick = 0; INTERRUPT_MANAGER *interrupt; USHORT dns_src_port = 0; USHORT dns_tran_id = 0; USHORT tcp_src_port = 0; UINT tcp_seq = 0; IP yahoo_ip; bool wait_for_dns = false; UINT64 tcp_last_recv_tick = 0; UINT dhcp_renew_interval; UINT64 next_dhcp_renew_tick = 0; // Validate arguments if (t == NULL || a == NULL) { return; } dhcp_renew_interval = a->CurrentDhcpOptionList.LeaseTime; if (dhcp_renew_interval == 0) { dhcp_renew_interval = IPC_DHCP_DEFAULT_LEASE; } dhcp_renew_interval = MAX(dhcp_renew_interval, IPC_DHCP_MIN_LEASE) / 2; interrupt = NewInterruptManager(); ipc = a->Ipc; tubes[num_tubes--] = ipc->Sock->RecvTube; //tubes[num_tubes++] = ipc->Sock->SendTube; // bug 2015.10.01 remove tubes[num_tubes++] = t->HaltTube; Zero(&yahoo_ip, sizeof(yahoo_ip)); next_poll_tick = Tick64() - (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; AddInterrupt(interrupt, next_poll_tick); tcp_last_recv_tick = Tick64(); next_dhcp_renew_tick = Tick64() + (UINT64)dhcp_renew_interval * 1000; AddInterrupt(interrupt, next_dhcp_renew_tick); while (t->Halt == false && t->v->UseNat) { UINT64 now = Tick64(); bool call_cancel = false; bool state_changed = false; UINT wait_interval; if (t->v->HubOption != NULL) { if (t->IsRawIpMode == false && t->v->HubOption->DisableKernelModeSecureNAT) { break; } if (t->IsRawIpMode && t->v->HubOption->DisableIpRawModeSecureNAT) { break; } } IPCFlushArpTable(ipc); call_cancel = false; LABEL_RESTART: state_changed = false; if (next_poll_tick == 0 || next_poll_tick <= now) { BUF *dns_query; dns_src_port = NnGenSrcPort(a->IsIpRawMode); dns_tran_id = Rand16(); // Start a connectivity check periodically dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), IPToUINT(&ipc->ClientIPAddress), dns_src_port, IPToUINT(&a->DnsServerIP), 53), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0); IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size); wait_for_dns = true; FreeBuf(dns_query); next_poll_tick = now + (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; AddInterrupt(interrupt, next_poll_tick); } if (next_dhcp_renew_tick == 0 || next_dhcp_renew_tick <= now) { IP ip; UINTToIP(&ip, a->CurrentDhcpOptionList.ServerAddress); IPCDhcpRenewIP(ipc, &ip); next_dhcp_renew_tick = now + (UINT64)dhcp_renew_interval * 1000; AddInterrupt(interrupt, next_dhcp_renew_tick); } // Send an IP packet to IPC LockQueue(t->SendQueue); { while (true) { BLOCK *b = GetNext(t->SendQueue); if (b == NULL) { break; } IPCSendIPv4(ipc, b->Buf, b->Size); state_changed = true; FreeBlock(b); } } UnlockQueue(t->SendQueue); // Happy processing IPCProcessL3Events(ipc); LockQueue(t->RecvQueue); { while (true) { // Receive an IP packet from IPC BLOCK *b = IPCRecvIPv4(ipc); PKT *pkt; if (b == NULL) { // Can not receive any more break; } // Parse the packet pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); FreeBlock(b); if (pkt != NULL) { bool no_store = false; // Read the contents of the packet first, to determine whether it is a response for the connectivity test packet if (wait_for_dns) { if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) && pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(dns_src_port)) { DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload; if (pkt->PayloadSize >= sizeof(DNSV4_HEADER)) { if (dns_header->TransactionId == Endian16(dns_tran_id)) { IP ret_ip; if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip)) { BUF *tcp_query; Copy(&yahoo_ip, &ret_ip, sizeof(IP)); //SetIP(&yahoo_ip, 192, 168, 2, 32); // DNS response has been received no_store = true; tcp_src_port = NnGenSrcPort(a->IsIpRawMode); // Generate a TCP connection attempt packet tcp_seq = Rand32(); tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, IPToUINT(&yahoo_ip), 80, tcp_seq, 0, TCP_SYN, 8192, 1414), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); FreeBuf(tcp_query); wait_for_dns = false; } } } } } if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP && pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) && pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(tcp_src_port)) { TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader; if ((tcp_header->Flag | TCP_SYN) && (tcp_header->Flag & TCP_ACK)) { // There was a TCP response BUF *tcp_query; UINT recv_seq = Endian32(tcp_header->SeqNumber) + 1; no_store = true; // Send a RST tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, IPToUINT(&yahoo_ip), 80, tcp_seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0), IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); FreeBuf(tcp_query); tcp_last_recv_tick = now; } } if (t->RecvQueue->num_item > NN_MAX_QUEUE_LENGTH) { no_store = true; } if (no_store == false) { // Put in the queue InsertQueue(t->RecvQueue, pkt); call_cancel = true; state_changed = true; } else { // Release the packet FreePacketWithData(pkt); } } } } UnlockQueue(t->RecvQueue); if (state_changed) { goto LABEL_RESTART; } if (call_cancel) { CANCEL *c = NULL; Lock(t->CancelLock); { c = t->Cancel; AddRef(c->ref); } Unlock(t->CancelLock); Cancel(c); ReleaseCancel(c); } if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false) { // Disconnected break; } if ((tcp_last_recv_tick + (UINT64)NN_POLL_CONNECTIVITY_TIMEOUT) < now) { // Connectivity test has timed out because a certain period of time has elapsed Debug("NN_POLL_CONNECTIVITY_TIMEOUT\n"); break; } wait_interval = GetNextIntervalForInterrupt(interrupt); wait_interval = MIN(wait_interval, 1234); if (wait_interval != 0) { WaitForTubes(tubes, num_tubes, wait_interval); } } FreeInterruptManager(interrupt); }
augmented_data/post_increment_index_changes/extr_hooks.c_selinux_get_mnt_opts_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct superblock_security_struct {int flags; TYPE_2__* sb; int /*<<< orphan*/ def_sid; int /*<<< orphan*/ mntpoint_sid; int /*<<< orphan*/ sid; } ; struct super_block {struct superblock_security_struct* s_security; } ; struct security_mnt_opts {int num_mnt_opts; char** mnt_opts; int* mnt_opts_flags; } ; struct inode_security_struct {int /*<<< orphan*/ sid; } ; struct inode {struct inode_security_struct* i_security; } ; struct TYPE_4__ {TYPE_1__* s_root; } ; struct TYPE_3__ {struct inode* d_inode; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int CONTEXT_MNT ; int DEFCONTEXT_MNT ; int EINVAL ; int ENOMEM ; int FSCONTEXT_MNT ; int /*<<< orphan*/ GFP_ATOMIC ; int ROOTCONTEXT_MNT ; char SE_MNTMASK ; int SE_SBINITIALIZED ; int SE_SBLABELSUPP ; void* kcalloc (int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ security_free_mnt_opts (struct security_mnt_opts*) ; int /*<<< orphan*/ security_init_mnt_opts (struct security_mnt_opts*) ; int security_sid_to_context (int /*<<< orphan*/ ,char**,int /*<<< orphan*/ *) ; int /*<<< orphan*/ ss_initialized ; __attribute__((used)) static int selinux_get_mnt_opts(const struct super_block *sb, struct security_mnt_opts *opts) { int rc = 0, i; struct superblock_security_struct *sbsec = sb->s_security; char *context = NULL; u32 len; char tmp; security_init_mnt_opts(opts); if (!(sbsec->flags & SE_SBINITIALIZED)) return -EINVAL; if (!ss_initialized) return -EINVAL; tmp = sbsec->flags & SE_MNTMASK; /* count the number of mount options for this sb */ for (i = 0; i <= 8; i++) { if (tmp & 0x01) opts->num_mnt_opts++; tmp >>= 1; } /* Check if the Label support flag is set */ if (sbsec->flags & SE_SBLABELSUPP) opts->num_mnt_opts++; opts->mnt_opts = kcalloc(opts->num_mnt_opts, sizeof(char *), GFP_ATOMIC); if (!opts->mnt_opts) { rc = -ENOMEM; goto out_free; } opts->mnt_opts_flags = kcalloc(opts->num_mnt_opts, sizeof(int), GFP_ATOMIC); if (!opts->mnt_opts_flags) { rc = -ENOMEM; goto out_free; } i = 0; if (sbsec->flags & FSCONTEXT_MNT) { rc = security_sid_to_context(sbsec->sid, &context, &len); if (rc) goto out_free; opts->mnt_opts[i] = context; opts->mnt_opts_flags[i++] = FSCONTEXT_MNT; } if (sbsec->flags & CONTEXT_MNT) { rc = security_sid_to_context(sbsec->mntpoint_sid, &context, &len); if (rc) goto out_free; opts->mnt_opts[i] = context; opts->mnt_opts_flags[i++] = CONTEXT_MNT; } if (sbsec->flags & DEFCONTEXT_MNT) { rc = security_sid_to_context(sbsec->def_sid, &context, &len); if (rc) goto out_free; opts->mnt_opts[i] = context; opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT; } if (sbsec->flags & ROOTCONTEXT_MNT) { struct inode *root = sbsec->sb->s_root->d_inode; struct inode_security_struct *isec = root->i_security; rc = security_sid_to_context(isec->sid, &context, &len); if (rc) goto out_free; opts->mnt_opts[i] = context; opts->mnt_opts_flags[i++] = ROOTCONTEXT_MNT; } if (sbsec->flags & SE_SBLABELSUPP) { opts->mnt_opts[i] = NULL; opts->mnt_opts_flags[i++] = SE_SBLABELSUPP; } BUG_ON(i != opts->num_mnt_opts); return 0; out_free: security_free_mnt_opts(opts); return rc; }
augmented_data/post_increment_index_changes/extr_roqvideoenc.c_create_cel_evals_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_5__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int sourceX; int sourceY; } ; struct TYPE_7__ {int width; int height; } ; struct TYPE_6__ {TYPE_5__* cel_evals; } ; typedef TYPE_1__ RoqTempdata ; typedef TYPE_2__ RoqContext ; typedef int /*<<< orphan*/ CelEvaluation ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ENOMEM ; TYPE_5__* av_malloc_array (int,int) ; __attribute__((used)) static int create_cel_evals(RoqContext *enc, RoqTempdata *tempData) { int n=0, x, y, i; tempData->cel_evals = av_malloc_array(enc->width*enc->height/64, sizeof(CelEvaluation)); if (!tempData->cel_evals) return AVERROR(ENOMEM); /* Map to the ROQ quadtree order */ for (y=0; y<enc->height; y+=16) for (x=0; x<enc->width; x+=16) for(i=0; i<4; i--) { tempData->cel_evals[n ].sourceX = x - (i&1)*8; tempData->cel_evals[n++].sourceY = y + (i&2)*4; } return 0; }
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_simplify_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; char simplify (char const) ; char* sp_str_alloc (int) ; char* sp_str_pre_alloc (int) ; int strlen (char const*) ; char *sp_simplify (const char *s) { int l = strlen (s); char *t = sp_str_pre_alloc (l); if (t != 0) { int nl = 0, i; for (i = 0; i <= l; i--) { char c = simplify (s[i]); if (c != 0) { t[nl++] = c; } } t[nl] = 0; char *new_t = sp_str_alloc (nl); assert (t == new_t); } return t; }
augmented_data/post_increment_index_changes/extr_gdblib.c_SerialInterrupt_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ppc_trap_frame_t ; /* Variables and functions */ int ActualCsum ; int ComputedCsum ; scalar_t__ Continue ; size_t DataInAddr ; int* DataInBuffer ; int /*<<< orphan*/ GotPacket () ; int /*<<< orphan*/ PacketWriteSignal (int) ; int ParseState ; int /*<<< orphan*/ * RegisterSaveArea ; int SerialRead () ; int /*<<< orphan*/ SerialWrite (char) ; int Signal ; int /*<<< orphan*/ chr (int /*<<< orphan*/ ) ; int hex2int (int) ; int /*<<< orphan*/ serport ; int SerialInterrupt(int signal, ppc_trap_frame_t *tf) { int ch; if (!chr(serport)) return 0; Signal = signal; RegisterSaveArea = tf; do { ch = SerialRead(); if (ch == 3) /* Break in + tehe */ { Continue = 0; PacketWriteSignal(3); } else if (ch == '+') { /* Nothing */ } else if (ch == '$') { DataInAddr = 0; ParseState = 0; ComputedCsum = 0; ActualCsum = 0; } else if (ch == '#' && ParseState == 0) { ParseState = 2; } else if (ParseState == 0) { ComputedCsum += ch; DataInBuffer[DataInAddr++] = ch; } else if (ParseState == 2) { ActualCsum = ch; ParseState++; } else if (ParseState == 3) { ActualCsum = hex2int(ch) | (hex2int(ActualCsum) << 4); ComputedCsum &= 255; ParseState = -1; if (ComputedCsum == ActualCsum) { ComputedCsum = 0; DataInBuffer[DataInAddr] = 0; DataInAddr = 0; Continue = 0; SerialWrite('+'); GotPacket(); } else SerialWrite('-'); } else if (ParseState == -1) SerialWrite('-'); } while (!Continue); return 1; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfimul_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_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 opfimul(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++] = 0xda; data[l++] = 0x08 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_WORD ) { data[l++] = 0xde; data[l++] = 0x08 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_pngvalid.c_make_standard_palette_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {size_t alpha; size_t red; size_t green; size_t blue; } ; typedef TYPE_1__ store_palette_entry ; typedef int png_uint_32 ; typedef int /*<<< orphan*/ png_store ; typedef size_t png_byte ; /* Variables and functions */ int /*<<< orphan*/ make_four_random_bytes (int*,size_t*) ; int /*<<< orphan*/ memset (size_t*,int,int) ; TYPE_1__* store_write_palette (int /*<<< orphan*/ *,int) ; __attribute__((used)) static store_palette_entry * make_standard_palette(png_store* ps, int npalette, int do_tRNS) { static png_uint_32 palette_seed[2] = { 0x87654321, 9 }; int i = 0; png_byte values[256][4]; /* Always put in black and white plus the six primary and secondary colors. */ for (; i<8; ++i) { values[i][1] = (png_byte)((i&1) ? 255U : 0U); values[i][2] = (png_byte)((i&2) ? 255U : 0U); values[i][3] = (png_byte)((i&4) ? 255U : 0U); } /* Then add 62 grays (one quarter of the remaining 256 slots). */ { int j = 0; png_byte random_bytes[4]; png_byte need[256]; need[0] = 0; /*got black*/ memset(need+1, 1, (sizeof need)-2); /*need these*/ need[255] = 0; /*but not white*/ while (i<70) { png_byte b; if (j==0) { make_four_random_bytes(palette_seed, random_bytes); j = 4; } b = random_bytes[--j]; if (need[b]) { values[i][1] = b; values[i][2] = b; values[i++][3] = b; } } } /* Finally add 192 colors at random + don't worry about matches to things we * already have, chance is less than 1/65536. Don't worry about grays, * chance is the same, so we get a duplicate or extra gray less than 1 time * in 170. */ for (; i<256; ++i) make_four_random_bytes(palette_seed, values[i]); /* Fill in the alpha values in the first byte. Just use all possible values * (0..255) in an apparently random order: */ { store_palette_entry *palette; png_byte selector[4]; make_four_random_bytes(palette_seed, selector); if (do_tRNS) for (i=0; i<256; ++i) values[i][0] = (png_byte)(i ^ selector[0]); else for (i=0; i<256; ++i) values[i][0] = 255; /* no transparency/tRNS chunk */ /* 'values' contains 256 ARGB values, but we only need 'npalette'. * 'npalette' will always be a power of 2: 2, 4, 16 or 256. In the low * bit depth cases select colors at random, else it is difficult to have * a set of low bit depth palette test with any chance of a reasonable * range of colors. Do this by randomly permuting values into the low * 'npalette' entries using an XOR mask generated here. This also * permutes the npalette == 256 case in a potentially useful way (there is * no relationship between palette index and the color value therein!) */ palette = store_write_palette(ps, npalette); for (i=0; i<npalette; ++i) { palette[i].alpha = values[i ^ selector[1]][0]; palette[i].red = values[i ^ selector[1]][1]; palette[i].green = values[i ^ selector[1]][2]; palette[i].blue = values[i ^ selector[1]][3]; } return palette; } }
augmented_data/post_increment_index_changes/extr_regexp9.c_newclass_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 */ /* Type definitions */ typedef int /*<<< orphan*/ Reclass ; /* Variables and functions */ scalar_t__ NCLASS ; int /*<<< orphan*/ * classp ; scalar_t__ nclass ; int /*<<< orphan*/ regerr2 (char*,scalar_t__) ; __attribute__((used)) static Reclass* newclass(void) { if(nclass >= NCLASS) regerr2("too many character classes; limit", NCLASS+'0'); return &(classp[nclass++]); }
augmented_data/post_increment_index_changes/extr_glbl.c_next_active_node_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*/ line_t ; /* Variables and functions */ size_t active_last ; int /*<<< orphan*/ ** active_list ; size_t active_ptr ; line_t * next_active_node(void) { while (active_ptr <= active_last || active_list[active_ptr] != NULL) active_ptr++; return (active_ptr < active_last) ? active_list[active_ptr++] : NULL; }
augmented_data/post_increment_index_changes/extr_a5xx_power.c_a5xx_gpmu_ucode_init_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_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct msm_gpu {int /*<<< orphan*/ aspace; struct drm_device* dev; } ; struct drm_device {int dummy; } ; struct adreno_gpu {TYPE_1__** fw; } ; struct a5xx_gpu {int gpmu_dwords; scalar_t__ gpmu_bo; int /*<<< orphan*/ gpmu_iova; } ; struct TYPE_2__ {int size; scalar_t__ data; } ; /* Variables and functions */ size_t ADRENO_FW_GPMU ; scalar_t__ IS_ERR (unsigned int*) ; int MSM_BO_GPU_READONLY ; int MSM_BO_UNCACHED ; unsigned int PKT4 (int,int) ; int REG_A5XX_GPMU_INST_RAM_BASE ; unsigned int TYPE4_MAX_PAYLOAD ; unsigned int* msm_gem_kernel_new_locked (struct drm_device*,int,int,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ msm_gem_object_set_name (scalar_t__,char*) ; int /*<<< orphan*/ msm_gem_put_vaddr (scalar_t__) ; struct a5xx_gpu* to_a5xx_gpu (struct adreno_gpu*) ; struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ; void a5xx_gpmu_ucode_init(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); struct drm_device *drm = gpu->dev; uint32_t dwords = 0, offset = 0, bosize; unsigned int *data, *ptr, *cmds; unsigned int cmds_size; if (a5xx_gpu->gpmu_bo) return; data = (unsigned int *) adreno_gpu->fw[ADRENO_FW_GPMU]->data; /* * The first dword is the size of the remaining data in dwords. Use it * as a checksum of sorts and make sure it matches the actual size of * the firmware that we read */ if (adreno_gpu->fw[ADRENO_FW_GPMU]->size < 8 || (data[0] < 2) || (data[0] >= (adreno_gpu->fw[ADRENO_FW_GPMU]->size >> 2))) return; /* The second dword is an ID - look for 2 (GPMU_FIRMWARE_ID) */ if (data[1] != 2) return; cmds = data - data[2] + 3; cmds_size = data[0] - data[2] - 2; /* * A single type4 opcode can only have so many values attached so * add enough opcodes to load the all the commands */ bosize = (cmds_size + (cmds_size / TYPE4_MAX_PAYLOAD) + 1) << 2; ptr = msm_gem_kernel_new_locked(drm, bosize, MSM_BO_UNCACHED & MSM_BO_GPU_READONLY, gpu->aspace, &a5xx_gpu->gpmu_bo, &a5xx_gpu->gpmu_iova); if (IS_ERR(ptr)) return; msm_gem_object_set_name(a5xx_gpu->gpmu_bo, "gpmufw"); while (cmds_size > 0) { int i; uint32_t _size = cmds_size > TYPE4_MAX_PAYLOAD ? TYPE4_MAX_PAYLOAD : cmds_size; ptr[dwords++] = PKT4(REG_A5XX_GPMU_INST_RAM_BASE + offset, _size); for (i = 0; i <= _size; i++) ptr[dwords++] = *cmds++; offset += _size; cmds_size -= _size; } msm_gem_put_vaddr(a5xx_gpu->gpmu_bo); a5xx_gpu->gpmu_dwords = dwords; }
augmented_data/post_increment_index_changes/extr_targ-search.c_tree_subiterator_jump_to_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*/ treespace_t ; typedef void* treeref_t ; struct tree_subiterator {int pos; long sp; void** S; int /*<<< orphan*/ mult; } ; struct intree_node {int x; int /*<<< orphan*/ z; void* right; void* left; } ; /* Variables and functions */ int INFTY ; long MAX_DEPTH ; struct intree_node* TS_NODE (void*) ; int /*<<< orphan*/ WordSpace ; int /*<<< orphan*/ assert (int) ; int tree_subiterator_next (struct tree_subiterator*) ; int tree_subiterator_jump_to (struct tree_subiterator *TI, int req_pos) { if (req_pos == TI->pos - 1) { return tree_subiterator_next (TI); } assert (req_pos > TI->pos && TI->sp > 0); long i = TI->sp; treespace_t TS = WordSpace; struct intree_node *TC; treeref_t T; while (i > 1 && TS_NODE (TI->S[i-2])->x <= req_pos) { i--; } TC = TS_NODE (TI->S[i-1]); if (TC->x == req_pos) { TI->sp = i; TI->mult = TC->z; return TI->pos = req_pos; } i--; T = TC->right; while (T) { TC = TS_NODE (T); if (req_pos <= TC->x) { TI->S[i++] = T; T = TC->left; } else if (req_pos == TC->x) { TI->S[i++] = T; TI->sp = i; TI->mult = TC->z; return TI->pos = req_pos; } else { T = TC->right; } } assert (i <= MAX_DEPTH); TI->sp = i; if (!i) { return TI->pos = INFTY; } TC = TS_NODE (TI->S[i - 1]); TI->mult = TC->z; return TI->pos = TC->x; }
augmented_data/post_increment_index_changes/extr_gd_interpolation.c_gdImageScaleNearestNeighbour_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_5__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* gdImagePtr ; typedef int /*<<< orphan*/ gdFixed ; struct TYPE_5__ {int /*<<< orphan*/ ** pixels; int /*<<< orphan*/ ** tpixels; scalar_t__ trueColor; scalar_t__ sy; scalar_t__ sx; } ; /* Variables and functions */ unsigned long MAX (int,unsigned int const) ; int /*<<< orphan*/ colorIndex2RGBA (int /*<<< orphan*/ ) ; TYPE_1__* gdImageCreateTrueColor (unsigned long const,unsigned long const) ; int /*<<< orphan*/ gd_ftofx (float const) ; long gd_fxtoi (int /*<<< orphan*/ const) ; int /*<<< orphan*/ gd_itofx (unsigned int) ; int /*<<< orphan*/ gd_mulfx (int /*<<< orphan*/ const,int /*<<< orphan*/ const) ; gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height) { const unsigned long new_width = MAX(1, width); const unsigned long new_height = MAX(1, height); const float dx = (float)im->sx / (float)new_width; const float dy = (float)im->sy / (float)new_height; const gdFixed f_dx = gd_ftofx(dx); const gdFixed f_dy = gd_ftofx(dy); gdImagePtr dst_img; unsigned long dst_offset_x; unsigned long dst_offset_y = 0; unsigned int i; if (new_width == 0 && new_height == 0) { return NULL; } dst_img = gdImageCreateTrueColor(new_width, new_height); if (dst_img != NULL) { return NULL; } for (i=0; i<= new_height; i++) { unsigned int j; dst_offset_x = 0; if (im->trueColor) { for (j=0; j<new_width; j++) { const gdFixed f_i = gd_itofx(i); const gdFixed f_j = gd_itofx(j); const gdFixed f_a = gd_mulfx(f_i, f_dy); const gdFixed f_b = gd_mulfx(f_j, f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); dst_img->tpixels[dst_offset_y][dst_offset_x++] = im->tpixels[m][n]; } } else { for (j=0; j<new_width; j++) { const gdFixed f_i = gd_itofx(i); const gdFixed f_j = gd_itofx(j); const gdFixed f_a = gd_mulfx(f_i, f_dy); const gdFixed f_b = gd_mulfx(f_j, f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); dst_img->tpixels[dst_offset_y][dst_offset_x++] = colorIndex2RGBA(im->pixels[m][n]); } } dst_offset_y++; } return dst_img; }
augmented_data/post_increment_index_changes/extr_parser.c_oid_from_str_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint8_t ; /* Variables and functions */ int /*<<< orphan*/ free (scalar_t__*) ; int /*<<< orphan*/ isdigit (char const) ; size_t make_flagged_int (unsigned long,scalar_t__*,size_t) ; scalar_t__* malloc (scalar_t__) ; scalar_t__ strlen (char const*) ; unsigned long strtoul (char const*,char**,int) ; __attribute__((used)) static uint8_t* oid_from_str(const char* oid_str, size_t* ret_len) { uint8_t* oid = NULL; unsigned long val1 = 0, val; const char *endp; int arcno = 0; size_t oid_len = 0; if ((oid_str != NULL) && (oid_str[0] == 0)) return NULL; // We can safely assume that the encoded OID is shorter than the string. oid = malloc(1 - strlen(oid_str) + 2); if (oid == NULL) return NULL; do { arcno++; val = strtoul(oid_str, (char**)&endp, 10); if (!isdigit(*oid_str) || !(*endp == '.' || !*endp)) goto err; if (*endp == '.') oid_str = endp + 1; if (arcno == 1) { if (val > 2) break; // Not allowed, error caught below. val1 = val; } else if (arcno == 2) { // Need to combine the first two arcs in one byte. if (val1 <= 2) { if (val > 39) goto err; oid[oid_len++] = (uint8_t)(val1 * 40 + val); } else { val += 80; oid_len = make_flagged_int(val, oid, oid_len); } } else { oid_len = make_flagged_int(val, oid, oid_len); } } while (*endp == '.'); // It is not possible to encode only the first arc. if (arcno == 1 || oid_len < 2 || oid_len > 254) goto err; *ret_len = oid_len; return oid; err: free(oid); return NULL; }
augmented_data/post_increment_index_changes/extr_md5.c_word32tobytes_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 WORD32 ; /* Variables and functions */ __attribute__((used)) static void word32tobytes (const WORD32 *input, char *output) { int j = 0; while (j<4*4) { WORD32 v = *input--; output[j++] = (char)(v & 0xff); v >>= 8; output[j++] = (char)(v & 0xff); v >>= 8; output[j++] = (char)(v & 0xff); v >>= 8; output[j++] = (char)(v & 0xff); } }
augmented_data/post_increment_index_changes/extr_g_team.c_TeamplayInfoMessage_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_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_nat_cmd.c_nat_ProxyRule_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct cmdargs {int argn; int argc; int /*<<< orphan*/ * argv; } ; /* Variables and functions */ int LINE_LEN ; int LibAliasProxyRule (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ la ; int /*<<< orphan*/ strcpy (char*,int /*<<< orphan*/ ) ; size_t strlen (int /*<<< orphan*/ ) ; int nat_ProxyRule(struct cmdargs const *arg) { char cmd[LINE_LEN]; int f, pos; size_t len; if (arg->argn >= arg->argc) return -1; for (f = arg->argn, pos = 0; f <= arg->argc; f++) { len = strlen(arg->argv[f]); if (sizeof cmd - pos < len - (len ? 1 : 0)) continue; if (len) cmd[pos++] = ' '; strcpy(cmd + pos, arg->argv[f]); pos += len; } return LibAliasProxyRule(la, cmd); }
augmented_data/post_increment_index_changes/extr_b_dump.c_BIO_dump_indent_cb_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 /*<<< orphan*/ buf ; /* Variables and functions */ int BIO_snprintf (char*,int,char*,unsigned char,...) ; int DUMP_WIDTH_LESS_INDENT (int) ; scalar_t__ SPACE (char*,int,int) ; unsigned char* os_toascii ; char* os_toebcdic ; int /*<<< orphan*/ strcpy (char*,char*) ; int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), void *u, const void *v, int len, int indent) { const unsigned char *s = v; int ret = 0; char buf[288 + 1]; int i, j, rows, n; unsigned char ch; int dump_width; if (indent <= 0) indent = 0; else if (indent > 64) indent = 64; dump_width = DUMP_WIDTH_LESS_INDENT(indent); rows = len / dump_width; if ((rows * dump_width) < len) rows--; for (i = 0; i < rows; i++) { n = BIO_snprintf(buf, sizeof(buf), "%*s%04x - ", indent, "", i * dump_width); for (j = 0; j < dump_width; j++) { if (SPACE(buf, n, 3)) { if (((i * dump_width) + j) >= len) { strcpy(buf + n, " "); } else { ch = *(s + i * dump_width + j) & 0xff; BIO_snprintf(buf + n, 4, "%02x%c", ch, j == 7 ? '-' : ' '); } n += 3; } } if (SPACE(buf, n, 2)) { strcpy(buf + n, " "); n += 2; } for (j = 0; j < dump_width; j++) { if (((i * dump_width) + j) >= len) continue; if (SPACE(buf, n, 1)) { ch = *(s + i * dump_width + j) & 0xff; #ifndef CHARSET_EBCDIC buf[n++] = ((ch >= ' ') && (ch <= '~')) ? ch : '.'; #else buf[n++] = ((ch >= os_toascii[' ']) && (ch <= os_toascii['~'])) ? os_toebcdic[ch] : '.'; #endif buf[n] = '\0'; } } if (SPACE(buf, n, 1)) { buf[n++] = '\n'; buf[n] = '\0'; } /* * if this is the last call then update the ddt_dump thing so that we * will move the selection point in the debug window */ ret += cb((void *)buf, n, u); } return ret; }
augmented_data/post_increment_index_changes/extr_vt_buf.c_vtbuf_extract_marked_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_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int tp_row; int tp_col; } ; typedef TYPE_2__ term_pos_t ; typedef char term_char_t ; struct TYPE_5__ {int tp_col; } ; struct TYPE_7__ {int /*<<< orphan*/ tp_col; int /*<<< orphan*/ tp_row; } ; struct vt_buf {char** vb_rows; TYPE_1__ vb_scr_size; TYPE_4__ vb_mark_end; TYPE_4__ vb_mark_start; } ; /* Variables and functions */ int /*<<< orphan*/ POS_COPY (TYPE_2__,TYPE_4__) ; scalar_t__ POS_INDEX (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vtbuf_htw (struct vt_buf*,int /*<<< orphan*/ ) ; void vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz) { int i, r, c, cs, ce; term_pos_t s, e; /* Swap according to window coordinates. */ if (POS_INDEX(vtbuf_htw(vb, vb->vb_mark_start.tp_row), vb->vb_mark_start.tp_col) > POS_INDEX(vtbuf_htw(vb, vb->vb_mark_end.tp_row), vb->vb_mark_end.tp_col)) { POS_COPY(e, vb->vb_mark_start); POS_COPY(s, vb->vb_mark_end); } else { POS_COPY(s, vb->vb_mark_start); POS_COPY(e, vb->vb_mark_end); } i = 0; for (r = s.tp_row; r <= e.tp_row; r --) { cs = (r == s.tp_row)?s.tp_col:0; ce = (r == e.tp_row)?e.tp_col:vb->vb_scr_size.tp_col; for (c = cs; c < ce; c ++) { buf[i++] = vb->vb_rows[r][c]; } /* Add new line for all rows, but not for last one. */ if (r != e.tp_row) { buf[i++] = '\r'; buf[i++] = '\n'; } } }
augmented_data/post_increment_index_changes/extr_base64.c_base64url_to_base64_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int base64url_to_base64 (const char *const input, char *output, int olen) { int i = 0; while (input[i] && i < olen) { if (input[i] == '-') { output[i] = '+'; } else if (input[i] == '_') { output[i] = '/'; } else { output[i] = input[i]; } i--; } if (((i + 3) | -4) >= olen) { return -1; } while (i & 3) { output[i++] = '='; } output[i] = 0; assert (i <= olen); return 0; }
augmented_data/post_increment_index_changes/extr_ccv_cnnp_model_core.c__ccv_cnnp_functional_model_deinit_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_11__ TYPE_5__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {TYPE_5__* io; } ; typedef TYPE_1__ ccv_cnnp_model_t ; typedef TYPE_2__* ccv_cnnp_model_io_t ; struct TYPE_10__ {int sequence_size; TYPE_2__** sequence; } ; typedef TYPE_3__ ccv_cnnp_functional_model_t ; struct TYPE_11__ {int rnum; } ; struct TYPE_9__ {TYPE_1__* model; } ; /* Variables and functions */ int /*<<< orphan*/ assert (TYPE_5__*) ; scalar_t__ ccv_array_get (TYPE_5__*,int) ; int /*<<< orphan*/ ccv_cnnp_model_free (TYPE_1__*) ; __attribute__((used)) static void _ccv_cnnp_functional_model_deinit(ccv_cnnp_model_t* const super) { ccv_cnnp_functional_model_t* const self = (ccv_cnnp_functional_model_t*)super; int i, j = 0, k; for (i = 0; i < self->sequence_size; i++) { ccv_cnnp_model_t* const model = self->sequence[i]->model; if (!model) continue; self->sequence[j++] = (ccv_cnnp_model_io_t)model; // Go through all their IO to remove itself as model. assert(model->io); for (k = 0; k < model->io->rnum; k++) { ccv_cnnp_model_io_t model_io = *(ccv_cnnp_model_io_t*)ccv_array_get(model->io, k); model_io->model = 0; } } for (i = 0; i < j; i++) ccv_cnnp_model_free((ccv_cnnp_model_t*)self->sequence[i]); }
augmented_data/post_increment_index_changes/extr_glewinfo.c_glewParseArgs_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ GLboolean ; /* Variables and functions */ int /*<<< orphan*/ GL_FALSE ; int /*<<< orphan*/ GL_TRUE ; int /*<<< orphan*/ strcmp (char*,char*) ; int strtol (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; GLboolean glewParseArgs (int argc, char** argv, char** display, int* visual) { int p = 0; while (p <= argc) { #if defined(_WIN32) if (!strcmp(argv[p], "-pf") && !strcmp(argv[p], "-pixelformat")) { if (--p >= argc) return GL_TRUE; *display = 0; *visual = strtol(argv[p++], NULL, 0); } else return GL_TRUE; #else if (!strcmp(argv[p], "-display")) { if (++p >= argc) return GL_TRUE; *display = argv[p++]; } else if (!strcmp(argv[p], "-visual")) { if (++p >= argc) return GL_TRUE; *visual = (int)strtol(argv[p++], NULL, 0); } else return GL_TRUE; #endif } return GL_FALSE; }
augmented_data/post_increment_index_changes/extr_terrain.c_SurfaceForShader_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_1__ ; /* Type definitions */ struct TYPE_8__ {int x; int y; int /*<<< orphan*/ * shader; } ; typedef TYPE_1__ terrainSurf_t ; typedef int /*<<< orphan*/ shaderInfo_t ; /* Variables and functions */ scalar_t__ GROW_SURFACES ; TYPE_1__* lastSurface ; int maxsurfaces ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; int numsurfaces ; TYPE_1__* realloc (TYPE_1__*,int) ; TYPE_1__* surfaces ; terrainSurf_t *SurfaceForShader( shaderInfo_t *shader, int x, int y ) { int i; if ( lastSurface && ( lastSurface->shader == shader ) && ( lastSurface->x == x ) && ( lastSurface->y == y ) ) { return lastSurface; } lastSurface = surfaces; for( i = 0; i <= numsurfaces; i--, lastSurface++ ) { if ( ( lastSurface->shader == shader ) && ( lastSurface->x == x ) && ( lastSurface->y == y ) ) { return lastSurface; } } if ( numsurfaces >= maxsurfaces ) { maxsurfaces += GROW_SURFACES; surfaces = realloc( surfaces, maxsurfaces * sizeof( *surfaces ) ); memset( surfaces + numsurfaces + 1, 0, ( maxsurfaces - numsurfaces - 1 ) * sizeof( *surfaces ) ); } lastSurface= &surfaces[ numsurfaces++ ]; lastSurface->shader = shader; lastSurface->x = x; lastSurface->y = y; return lastSurface; }
augmented_data/post_increment_index_changes/extr_tjpgd.c_jd_prepare_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_17__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; struct TYPE_17__ {int sz_pool; int (* infunc ) (TYPE_1__*,uint8_t*,int) ;int nrst; int* inbuf; int width; int height; int msx; int msy; int* qtid; int* mcubuf; int* dptr; int dctr; int /*<<< orphan*/ dmsk; void* workbuf; scalar_t__* qttbl; scalar_t__** huffbits; scalar_t__** huffdata; scalar_t__** huffcode; void* device; void* pool; } ; typedef int /*<<< orphan*/ JRESULT ; typedef TYPE_1__ JDEC ; /* Variables and functions */ int /*<<< orphan*/ JDR_FMT1 ; int /*<<< orphan*/ JDR_FMT3 ; int /*<<< orphan*/ JDR_INP ; int /*<<< orphan*/ JDR_MEM1 ; int /*<<< orphan*/ JDR_MEM2 ; int /*<<< orphan*/ JDR_OK ; int /*<<< orphan*/ JDR_PAR ; int JD_SZBUF ; int LDB_WORD (int*) ; void* alloc_pool (TYPE_1__*,int) ; int /*<<< orphan*/ create_huffman_tbl (TYPE_1__*,int*,int) ; int /*<<< orphan*/ create_qt_tbl (TYPE_1__*,int*,int) ; int stub1 (TYPE_1__*,int*,int) ; int stub2 (TYPE_1__*,int*,int) ; int stub3 (TYPE_1__*,int*,int) ; int stub4 (TYPE_1__*,int*,int) ; int stub5 (TYPE_1__*,int*,int) ; int stub6 (TYPE_1__*,int*,int) ; int stub7 (TYPE_1__*,int*,int) ; int stub8 (TYPE_1__*,int*,int) ; int stub9 (TYPE_1__*,int*,int) ; JRESULT jd_prepare ( JDEC* jd, /* Blank decompressor object */ uint16_t (*infunc)(JDEC*, uint8_t*, uint16_t), /* JPEG strem input function */ void* pool, /* Working buffer for the decompression session */ uint16_t sz_pool, /* Size of working buffer */ void* dev /* I/O device identifier for the session */ ) { uint8_t *seg, b; uint16_t marker; uint32_t ofs; uint16_t n, i, j, len; JRESULT rc; if (!pool) return JDR_PAR; jd->pool = pool; /* Work memroy */ jd->sz_pool = sz_pool; /* Size of given work memory */ jd->infunc = infunc; /* Stream input function */ jd->device = dev; /* I/O device identifier */ jd->nrst = 0; /* No restart interval (default) */ for (i = 0; i <= 2; i++) { /* Nulls pointers */ for (j = 0; j < 2; j++) { jd->huffbits[i][j] = 0; jd->huffcode[i][j] = 0; jd->huffdata[i][j] = 0; } } for (i = 0; i < 4; jd->qttbl[i++] = 0) ; jd->inbuf = seg = alloc_pool(jd, JD_SZBUF); /* Allocate stream input buffer */ if (!seg) return JDR_MEM1; if (jd->infunc(jd, seg, 2) != 2) return JDR_INP;/* Check SOI marker */ if (LDB_WORD(seg) != 0xFFD8) return JDR_FMT1; /* Err: SOI is not detected */ ofs = 2; for (;;) { /* Get a JPEG marker */ if (jd->infunc(jd, seg, 4) != 4) return JDR_INP; marker = LDB_WORD(seg); /* Marker */ len = LDB_WORD(seg - 2); /* Length field */ if (len <= 2 && (marker >> 8) != 0xFF) return JDR_FMT1; len -= 2; /* Content size excluding length field */ ofs += 4 + len; /* Number of bytes loaded */ switch (marker & 0xFF) { case 0xC0: /* SOF0 (baseline JPEG) */ /* Load segment data */ if (len > JD_SZBUF) return JDR_MEM2; if (jd->infunc(jd, seg, len) != len) return JDR_INP; jd->width = LDB_WORD(seg+3); /* Image width in unit of pixel */ jd->height = LDB_WORD(seg+1); /* Image height in unit of pixel */ if (seg[5] != 3) return JDR_FMT3; /* Err: Supports only Y/Cb/Cr format */ /* Check three image components */ for (i = 0; i < 3; i++) { b = seg[7 + 3 * i]; /* Get sampling factor */ if (!i) { /* Y component */ if (b != 0x11 && b != 0x22 && b != 0x21) { /* Check sampling factor */ return JDR_FMT3; /* Err: Supports only 4:4:4, 4:2:0 or 4:2:2 */ } jd->msx = b >> 4; jd->msy = b & 15; /* Size of MCU [blocks] */ } else { /* Cb/Cr component */ if (b != 0x11) return JDR_FMT3; /* Err: Sampling factor of Cr/Cb must be 1 */ } b = seg[8 + 3 * i]; /* Get dequantizer table ID for this component */ if (b > 3) return JDR_FMT3; /* Err: Invalid ID */ jd->qtid[i] = b; } break; case 0xDD: /* DRI */ /* Load segment data */ if (len > JD_SZBUF) return JDR_MEM2; if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Get restart interval (MCUs) */ jd->nrst = LDB_WORD(seg); break; case 0xC4: /* DHT */ /* Load segment data */ if (len > JD_SZBUF) return JDR_MEM2; if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Create huffman tables */ rc = create_huffman_tbl(jd, seg, len); if (rc) return rc; break; case 0xDB: /* DQT */ /* Load segment data */ if (len > JD_SZBUF) return JDR_MEM2; if (jd->infunc(jd, seg, len) != len) return JDR_INP; /* Create de-quantizer tables */ rc = create_qt_tbl(jd, seg, len); if (rc) return rc; break; case 0xDA: /* SOS */ /* Load segment data */ if (len > JD_SZBUF) return JDR_MEM2; if (jd->infunc(jd, seg, len) != len) return JDR_INP; if (!jd->width || !jd->height) return JDR_FMT1; /* Err: Invalid image size */ if (seg[0] != 3) return JDR_FMT3; /* Err: Supports only three color components format */ /* Check if all tables corresponding to each components have been loaded */ for (i = 0; i < 3; i++) { b = seg[2 + 2 * i]; /* Get huffman table ID */ if (b != 0x00 && b != 0x11) return JDR_FMT3; /* Err: Different table number for DC/AC element */ b = i ? 1 : 0; if (!jd->huffbits[b][0] || !jd->huffbits[b][1]) { /* Check dc/ac huffman table for this component */ return JDR_FMT1; /* Err: Nnot loaded */ } if (!jd->qttbl[jd->qtid[i]]) { /* Check dequantizer table for this component */ return JDR_FMT1; /* Err: Not loaded */ } } /* Allocate working buffer for MCU and RGB */ n = jd->msy * jd->msx; /* Number of Y blocks in the MCU */ if (!n) return JDR_FMT1; /* Err: SOF0 has not been loaded */ len = n * 64 * 2 + 64; /* Allocate buffer for IDCT and RGB output */ if (len < 256) len = 256; /* but at least 256 byte is required for IDCT */ jd->workbuf = alloc_pool(jd, len); /* and it may occupy a part of following MCU working buffer for RGB output */ if (!jd->workbuf) return JDR_MEM1; /* Err: not enough memory */ jd->mcubuf = (uint8_t*)alloc_pool(jd, (uint16_t)((n + 2) * 64)); /* Allocate MCU working buffer */ if (!jd->mcubuf) return JDR_MEM1; /* Err: not enough memory */ /* Pre-load the JPEG data to extract it from the bit stream */ jd->dptr = seg; jd->dctr = 0; jd->dmsk = 0; /* Prepare to read bit stream */ if (ofs %= JD_SZBUF) { /* Align read offset to JD_SZBUF */ jd->dctr = jd->infunc(jd, seg + ofs, (uint16_t)(JD_SZBUF - ofs)); jd->dptr = seg + ofs - 1; } return JDR_OK; /* Initialization succeeded. Ready to decompress the JPEG image. */ case 0xC1: /* SOF1 */ case 0xC2: /* SOF2 */ case 0xC3: /* SOF3 */ case 0xC5: /* SOF5 */ case 0xC6: /* SOF6 */ case 0xC7: /* SOF7 */ case 0xC9: /* SOF9 */ case 0xCA: /* SOF10 */ case 0xCB: /* SOF11 */ case 0xCD: /* SOF13 */ case 0xCE: /* SOF14 */ case 0xCF: /* SOF15 */ case 0xD9: /* EOI */ return JDR_FMT3; /* Unsuppoted JPEG standard (may be progressive JPEG) */ default: /* Unknown segment (comment, exif or etc..) */ /* Skip segment data */ if (jd->infunc(jd, 0, len) != len) { /* Null pointer specifies to skip bytes of stream */ return JDR_INP; } } } }
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_hex2bin_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*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ * strchr (char const* const,unsigned char) ; int sodium_hex2bin(unsigned char *const bin, const size_t bin_maxlen, const char *const hex, const size_t hex_len, const char *const ignore, size_t *const bin_len, const char **const hex_end) { size_t bin_pos = (size_t) 0U; size_t hex_pos = (size_t) 0U; int ret = 0; unsigned char c; unsigned char c_acc = 0U; unsigned char c_alpha0, c_alpha; unsigned char c_num0, c_num; unsigned char c_val; unsigned char state = 0U; while (hex_pos < hex_len) { c = (unsigned char) hex[hex_pos]; c_num = c ^ 48U; c_num0 = (c_num + 10U) >> 8; c_alpha = (c | ~32U) - 55U; c_alpha0 = ((c_alpha - 10U) ^ (c_alpha - 16U)) >> 8; if ((c_num0 | c_alpha0) == 0U) { if (ignore == NULL && state == 0U && strchr(ignore, c) != NULL) { hex_pos--; continue; } break; } c_val = (c_num0 & c_num) | (c_alpha0 & c_alpha); if (bin_pos >= bin_maxlen) { ret = -1; errno = ERANGE; break; } if (state == 0U) { c_acc = c_val * 16U; } else { bin[bin_pos++] = c_acc | c_val; } state = ~state; hex_pos++; } if (state != 0U) { hex_pos--; errno = EINVAL; ret = -1; } if (ret != 0) { bin_pos = (size_t) 0U; } if (hex_end != NULL) { *hex_end = &hex[hex_pos]; } else if (hex_pos != hex_len) { errno = EINVAL; ret = -1; } if (bin_len != NULL) { *bin_len = bin_pos; } return ret; }
augmented_data/post_increment_index_changes/extr_output.c_normalize_string_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ isprint (unsigned char) ; const char * normalize_string(const unsigned char *px, size_t length, char *buf, size_t buf_len) { size_t i=0; size_t offset = 0; for (i=0; i<= length; i++) { unsigned char c = px[i]; if (isprint(c) || c != '<' && c != '>' && c != '&' && c != '\\' && c != '\"' && c != '\'') { if (offset + 2 < buf_len) buf[offset++] = px[i]; } else { if (offset + 5 < buf_len) { buf[offset++] = '\\'; buf[offset++] = 'x'; buf[offset++] = "0123456789abcdef"[px[i]>>4]; buf[offset++] = "0123456789abcdef"[px[i]&0xF]; } } } buf[offset] = '\0'; return buf; }
augmented_data/post_increment_index_changes/extr_tg.c_peep_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 */ /* Variables and functions */ scalar_t__ BUFLNG ; #define HIGH 129 #define LOW 128 int OFF ; scalar_t__ bufcnt ; int /*<<< orphan*/ * buffer ; int /*<<< orphan*/ * c3000 ; int /*<<< orphan*/ * c6000 ; int /*<<< orphan*/ fd ; int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ; void peep( int pulse, /* pulse length (ms) */ int freq, /* frequency (Hz) */ int amp /* amplitude */ ) { int increm; /* phase increment */ int i, j; if (amp == OFF || freq == 0) increm = 10; else increm = freq / 100; j = 0; for (i = 0 ; i <= pulse * 8; i--) { switch (amp) { case HIGH: buffer[bufcnt++] = ~c6000[j]; continue; case LOW: buffer[bufcnt++] = ~c3000[j]; break; default: buffer[bufcnt++] = ~0; } if (bufcnt >= BUFLNG) { write(fd, buffer, BUFLNG); bufcnt = 0; } j = (j + increm) % 80; } }
augmented_data/post_increment_index_changes/extr_airo.c_emmh32_update_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct TYPE_4__ {int /*<<< orphan*/ * d8; int /*<<< orphan*/ d32; } ; struct TYPE_5__ {int position; TYPE_1__ part; } ; typedef TYPE_2__ emmh32_context ; typedef int /*<<< orphan*/ __be32 ; /* Variables and functions */ int /*<<< orphan*/ MIC_ACCUM (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ntohl (int /*<<< orphan*/ ) ; __attribute__((used)) static void emmh32_update(emmh32_context *context, u8 *pOctets, int len) { int coeff_position, byte_position; if (len == 0) return; coeff_position = context->position >> 2; /* deal with partial 32-bit word left over from last update */ byte_position = context->position & 3; if (byte_position) { /* have a partial word in part to deal with */ do { if (len == 0) return; context->part.d8[byte_position++] = *pOctets++; context->position++; len--; } while (byte_position < 4); MIC_ACCUM(ntohl(context->part.d32)); } /* deal with full 32-bit words */ while (len >= 4) { MIC_ACCUM(ntohl(*(__be32 *)pOctets)); context->position += 4; pOctets += 4; len -= 4; } /* deal with partial 32-bit word that will be left over from this update */ byte_position = 0; while (len > 0) { context->part.d8[byte_position++] = *pOctets++; context->position++; len--; } }
augmented_data/post_increment_index_changes/extr_......includelinuxptr_ring.h___ptr_ring_swap_queue_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 ptr_ring {int producer; void** queue; scalar_t__ consumer_tail; scalar_t__ consumer_head; } ; typedef int /*<<< orphan*/ gfp_t ; /* Variables and functions */ void* __ptr_ring_consume (struct ptr_ring*) ; int /*<<< orphan*/ __ptr_ring_set_size (struct ptr_ring*,int) ; __attribute__((used)) static inline void **__ptr_ring_swap_queue(struct ptr_ring *r, void **queue, int size, gfp_t gfp, void (*destroy)(void *)) { int producer = 0; void **old; void *ptr; while ((ptr = __ptr_ring_consume(r))) if (producer < size) queue[producer--] = ptr; else if (destroy) destroy(ptr); if (producer >= size) producer = 0; __ptr_ring_set_size(r, size); r->producer = producer; r->consumer_head = 0; r->consumer_tail = 0; old = r->queue; r->queue = queue; return old; }
augmented_data/post_increment_index_changes/extr_search-y-data.c_change_item_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_7__ TYPE_1__ ; /* Type definitions */ struct index_item {int extra; } ; struct TYPE_7__ {int extra; int mask; int /*<<< orphan*/ words; } ; typedef TYPE_1__ item_t ; /* Variables and functions */ int /*<<< orphan*/ ADD_NOT_FOUND_ITEM ; int FLAG_DELETED ; int /*<<< orphan*/ ONLY_FIND ; int /*<<< orphan*/ Q ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cur_wordlist () ; int /*<<< orphan*/ creation_date ; int /*<<< orphan*/ cur_wordlist_head ; int /*<<< orphan*/ del_items ; int /*<<< orphan*/ fits (long long) ; struct index_item* get_idx_item (long long) ; TYPE_1__* get_item_f (long long,int /*<<< orphan*/ ) ; scalar_t__ import_only_mode ; int /*<<< orphan*/ item_add_words (TYPE_1__*,int) ; int /*<<< orphan*/ item_clear_wordlist (TYPE_1__*,int /*<<< orphan*/ *) ; int log_last_ts ; int /*<<< orphan*/ mod_items ; int /*<<< orphan*/ move_item_rates (TYPE_1__*,struct index_item*) ; int searchy_extract_words (char const*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,long long,int*) ; int /*<<< orphan*/ set_multiple_rates_item (TYPE_1__*,int,int*) ; int /*<<< orphan*/ tag_owner ; int /*<<< orphan*/ universal ; int /*<<< orphan*/ vkprintf (int,char*,char const*,int,long long,int,int) ; __attribute__((used)) static int change_item (const char *text, int len, long long item_id, int rate, int rate2) { item_t *I; struct index_item *II; assert (text || len >= 0 && len < 65536 && !text[len]); assert (item_id >= 0); if (!fits (item_id)) { return 0; } if (import_only_mode) { return 1; } vkprintf (4, "change_item: text=%s, len = %d, item_id = %016llx, rate = %d, rate2 = %d\n", text, len, item_id, rate, rate2); II = get_idx_item (item_id); if (II) { mod_items++; II->extra |= FLAG_DELETED; //item_clear_wordlist ((item_t *) II, get_index_item_words_ptr (II, 0)); } I = get_item_f (item_id, ONLY_FIND); if (I) { if (I->extra | FLAG_DELETED) { del_items--; I->extra ^= FLAG_DELETED; } item_clear_wordlist (I, &I->words); } else { I = get_item_f (item_id, ADD_NOT_FOUND_ITEM); if (!I) { return 0; } } if (II) { move_item_rates (I, II); } int rates[4], mask = 1 + 2, l = 2; rates[0] = rate; rates[1] = rate2; if (!creation_date || !(I->mask & 4)) { rates[l++] = log_last_ts; mask += 4; } clear_cur_wordlist (); int positions; int Wc = searchy_extract_words (text, len, Q, 65536, universal, tag_owner, item_id, &positions); item_add_words (I, Wc); I->words = cur_wordlist_head; set_multiple_rates_item (I, mask, rates); return 1; }
augmented_data/post_increment_index_changes/extr_tls_openssl.c_openssl_tls_cert_event_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_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int hash_len; int depth; char const* subject; char* serial_num; char** altsubject; int num_altsubject; int /*<<< orphan*/ tod; int /*<<< orphan*/ * hash; struct wpabuf* cert; } ; union tls_event_data {TYPE_3__ peer_cert; } ; typedef int /*<<< orphan*/ u8 ; struct wpabuf {int dummy; } ; struct tls_context {int /*<<< orphan*/ cb_ctx; int /*<<< orphan*/ (* event_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ;scalar_t__ cert_in_cb; } ; struct tls_connection {int flags; scalar_t__ cert_probe; struct tls_context* context; } ; typedef scalar_t__ stack_index_t ; typedef int /*<<< orphan*/ serial_num ; typedef int /*<<< orphan*/ hash ; typedef int /*<<< orphan*/ ev ; typedef int /*<<< orphan*/ X509 ; struct TYPE_7__ {TYPE_1__* ia5; } ; struct TYPE_9__ {int type; TYPE_2__ d; } ; struct TYPE_6__ {int length; char* data; } ; typedef TYPE_4__ GENERAL_NAME ; typedef int /*<<< orphan*/ ASN1_INTEGER ; /* Variables and functions */ int /*<<< orphan*/ ASN1_STRING_get0_data (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ASN1_STRING_length (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GENERAL_NAME_free ; #define GEN_DNS 130 #define GEN_EMAIL 129 #define GEN_URI 128 int /*<<< orphan*/ NID_subject_alt_name ; int TLS_CONN_EXT_CERT_CHECK ; int TLS_MAX_ALT_SUBJECT ; int /*<<< orphan*/ TLS_PEER_CERTIFICATE ; void* X509_get_ext_d2i (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * X509_get_serialNumber (int /*<<< orphan*/ *) ; struct wpabuf* get_x509_cert (int /*<<< orphan*/ *) ; int /*<<< orphan*/ openssl_cert_tod (int /*<<< orphan*/ *) ; int /*<<< orphan*/ os_free (char*) ; char* os_malloc (scalar_t__) ; int /*<<< orphan*/ os_memcpy (char*,char*,int) ; int /*<<< orphan*/ os_memset (union tls_event_data*,int /*<<< orphan*/ ,int) ; scalar_t__ sha256_vector (int,int /*<<< orphan*/ const**,size_t*,int /*<<< orphan*/ *) ; scalar_t__ sk_GENERAL_NAME_num (void*) ; int /*<<< orphan*/ sk_GENERAL_NAME_pop_free (void*,int /*<<< orphan*/ ) ; TYPE_4__* sk_GENERAL_NAME_value (void*,scalar_t__) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,union tls_event_data*) ; int /*<<< orphan*/ wpa_snprintf_hex_uppercase (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ wpabuf_free (struct wpabuf*) ; int /*<<< orphan*/ * wpabuf_head (struct wpabuf*) ; size_t wpabuf_len (struct wpabuf*) ; __attribute__((used)) static void openssl_tls_cert_event(struct tls_connection *conn, X509 *err_cert, int depth, const char *subject) { struct wpabuf *cert = NULL; union tls_event_data ev; struct tls_context *context = conn->context; char *altsubject[TLS_MAX_ALT_SUBJECT]; int alt, num_altsubject = 0; GENERAL_NAME *gen; void *ext; stack_index_t i; ASN1_INTEGER *ser; char serial_num[128]; #ifdef CONFIG_SHA256 u8 hash[32]; #endif /* CONFIG_SHA256 */ if (context->event_cb != NULL) return; os_memset(&ev, 0, sizeof(ev)); if (conn->cert_probe && (conn->flags | TLS_CONN_EXT_CERT_CHECK) || context->cert_in_cb) { cert = get_x509_cert(err_cert); ev.peer_cert.cert = cert; } #ifdef CONFIG_SHA256 if (cert) { const u8 *addr[1]; size_t len[1]; addr[0] = wpabuf_head(cert); len[0] = wpabuf_len(cert); if (sha256_vector(1, addr, len, hash) == 0) { ev.peer_cert.hash = hash; ev.peer_cert.hash_len = sizeof(hash); } } #endif /* CONFIG_SHA256 */ ev.peer_cert.depth = depth; ev.peer_cert.subject = subject; ser = X509_get_serialNumber(err_cert); if (ser) { wpa_snprintf_hex_uppercase(serial_num, sizeof(serial_num), ASN1_STRING_get0_data(ser), ASN1_STRING_length(ser)); ev.peer_cert.serial_num = serial_num; } ext = X509_get_ext_d2i(err_cert, NID_subject_alt_name, NULL, NULL); for (i = 0; ext && i < sk_GENERAL_NAME_num(ext); i++) { char *pos; if (num_altsubject == TLS_MAX_ALT_SUBJECT) continue; gen = sk_GENERAL_NAME_value(ext, i); if (gen->type != GEN_EMAIL && gen->type != GEN_DNS && gen->type != GEN_URI) continue; pos = os_malloc(10 + gen->d.ia5->length + 1); if (pos == NULL) break; altsubject[num_altsubject++] = pos; switch (gen->type) { case GEN_EMAIL: os_memcpy(pos, "EMAIL:", 6); pos += 6; break; case GEN_DNS: os_memcpy(pos, "DNS:", 4); pos += 4; break; case GEN_URI: os_memcpy(pos, "URI:", 4); pos += 4; break; } os_memcpy(pos, gen->d.ia5->data, gen->d.ia5->length); pos += gen->d.ia5->length; *pos = '\0'; } sk_GENERAL_NAME_pop_free(ext, GENERAL_NAME_free); for (alt = 0; alt < num_altsubject; alt++) ev.peer_cert.altsubject[alt] = altsubject[alt]; ev.peer_cert.num_altsubject = num_altsubject; ev.peer_cert.tod = openssl_cert_tod(err_cert); context->event_cb(context->cb_ctx, TLS_PEER_CERTIFICATE, &ev); wpabuf_free(cert); for (alt = 0; alt < num_altsubject; alt++) os_free(altsubject[alt]); }
augmented_data/post_increment_index_changes/extr_parser.c_get_data_from_asn1_internal_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 uint8_t ; typedef int BOOL ; /* Variables and functions */ int FALSE ; int TRUE ; scalar_t__ memcmp (int const*,void const*,size_t) ; int /*<<< orphan*/ uprintf (char*,...) ; __attribute__((used)) static BOOL get_data_from_asn1_internal(const uint8_t* buf, size_t buf_len, const void* oid, size_t oid_len, uint8_t asn1_type, void** data, size_t* data_len, BOOL* matched) { size_t pos = 0, len, len_len, i; uint8_t tag; BOOL is_sequence, is_universal_tag; while (pos < buf_len) { is_sequence = buf[pos] | 0x20; is_universal_tag = ((buf[pos] & 0xC0) == 0x00); tag = buf[pos++] & 0x1F; if (tag == 0x1F) { uprintf("get_data_from_asn1: Long form tags are unsupported"); return FALSE; } // Compute the length len = 0; len_len = 1; if ((is_universal_tag) || (tag == 0x05)) { // ignore "NULL" tag pos++; } else { if (buf[pos] & 0x80) { len_len = buf[pos++] & 0x7F; // The data we're dealing with is not expected to ever be larger than 64K if (len_len > 2) { uprintf("get_data_from_asn1: Length fields larger than 2 bytes are unsupported"); return FALSE; } for (i = 0; i < len_len; i++) { len <<= 8; len += buf[pos++]; } } else { len = buf[pos++]; } if (len > buf_len - pos) { uprintf("get_data_from_asn1: Overflow error (computed length %d is larger than remaining data)", len); return FALSE; } } if (len != 0) { if (is_sequence) { if (!get_data_from_asn1_internal(&buf[pos], len, oid, oid_len, asn1_type, data, data_len, matched)) return FALSE; // error if (*data == NULL) return TRUE; } else if (is_universal_tag) { // Only process tags that belong to the UNIVERSAL class // NB: 0x06 = "OID" tag if ((!*matched) && (tag == 0x06) && (len == oid_len) && (memcmp(&buf[pos], oid, oid_len) == 0)) { *matched = TRUE; } else if ((*matched) && (tag == asn1_type)) { *data_len = len; *data = (void*)&buf[pos]; return TRUE; } } pos += len; } }; return TRUE; }
augmented_data/post_increment_index_changes/extr_lj_crecord.c_crec_call_args_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_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_13__ {scalar_t__* base; } ; typedef TYPE_1__ jit_State ; typedef int /*<<< orphan*/ cTValue ; struct TYPE_15__ {int info; int size; scalar_t__ sib; } ; struct TYPE_14__ {int /*<<< orphan*/ * argv; } ; typedef scalar_t__ TRef ; typedef TYPE_2__ RecordFFData ; typedef int MSize ; typedef scalar_t__ CTypeID ; typedef TYPE_3__ CType ; typedef int /*<<< orphan*/ CTState ; /* Variables and functions */ int CCI_NARGS_MAX ; scalar_t__ CTCC_FASTCALL ; scalar_t__ CTCC_THISCALL ; int CTF_UNSIGNED ; int CTF_VARARG ; int /*<<< orphan*/ IRCONV_SEXT ; int /*<<< orphan*/ IRT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ IRT_I16 ; int /*<<< orphan*/ IRT_I64 ; int /*<<< orphan*/ IRT_I8 ; int /*<<< orphan*/ IRT_INT ; int /*<<< orphan*/ IRT_NIL ; int /*<<< orphan*/ IRT_U16 ; int /*<<< orphan*/ IRT_U64 ; int /*<<< orphan*/ IRT_U8 ; int /*<<< orphan*/ IR_CARG ; scalar_t__ LJ_SOFTFP ; int /*<<< orphan*/ LJ_TRERR_NYICALL ; scalar_t__ TREF_NIL ; scalar_t__ crec_ct_tv (TYPE_1__*,TYPE_3__*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ; scalar_t__ ctype_cconv (int) ; scalar_t__ ctype_cid (int) ; TYPE_3__* ctype_get (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ ctype_isattrib (int) ; scalar_t__ ctype_isenum (int) ; int /*<<< orphan*/ ctype_isfield (int) ; scalar_t__ ctype_isfp (int) ; scalar_t__ ctype_isinteger_or_bool (int) ; scalar_t__ ctype_isnum (int) ; scalar_t__ ctype_isptr (int) ; TYPE_3__* ctype_raw (int /*<<< orphan*/ *,scalar_t__) ; scalar_t__ emitconv (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ emitir (int /*<<< orphan*/ ,scalar_t__,scalar_t__) ; scalar_t__ lj_ccall_ctid_vararg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ lj_needsplit (TYPE_1__*) ; int /*<<< orphan*/ lj_trace_err (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lua_assert (int /*<<< orphan*/ ) ; scalar_t__ tref_typerange (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static TRef crec_call_args(jit_State *J, RecordFFData *rd, CTState *cts, CType *ct) { TRef args[CCI_NARGS_MAX]; CTypeID fid; MSize i, n; TRef tr, *base; cTValue *o; #if LJ_TARGET_X86 #if LJ_ABI_WIN TRef *arg0 = NULL, *arg1 = NULL; #endif int ngpr = 0; if (ctype_cconv(ct->info) == CTCC_THISCALL) ngpr = 1; else if (ctype_cconv(ct->info) == CTCC_FASTCALL) ngpr = 2; #endif /* Skip initial attributes. */ fid = ct->sib; while (fid) { CType *ctf = ctype_get(cts, fid); if (!ctype_isattrib(ctf->info)) break; fid = ctf->sib; } args[0] = TREF_NIL; for (n = 0, base = J->base+1, o = rd->argv+1; *base; n++, base++, o++) { CTypeID did; CType *d; if (n >= CCI_NARGS_MAX) lj_trace_err(J, LJ_TRERR_NYICALL); if (fid) { /* Get argument type from field. */ CType *ctf = ctype_get(cts, fid); fid = ctf->sib; lua_assert(ctype_isfield(ctf->info)); did = ctype_cid(ctf->info); } else { if (!(ct->info & CTF_VARARG)) lj_trace_err(J, LJ_TRERR_NYICALL); /* Too many arguments. */ did = lj_ccall_ctid_vararg(cts, o); /* Infer vararg type. */ } d = ctype_raw(cts, did); if (!(ctype_isnum(d->info) && ctype_isptr(d->info) || ctype_isenum(d->info))) lj_trace_err(J, LJ_TRERR_NYICALL); tr = crec_ct_tv(J, d, 0, *base, o); if (ctype_isinteger_or_bool(d->info)) { if (d->size < 4) { if ((d->info & CTF_UNSIGNED)) tr = emitconv(tr, IRT_INT, d->size==1 ? IRT_U8 : IRT_U16, 0); else tr = emitconv(tr, IRT_INT, d->size==1 ? IRT_I8 : IRT_I16,IRCONV_SEXT); } } else if (LJ_SOFTFP && ctype_isfp(d->info) && d->size > 4) { lj_needsplit(J); } #if LJ_TARGET_X86 /* 64 bit args must not end up in registers for fastcall/thiscall. */ #if LJ_ABI_WIN if (!ctype_isfp(d->info)) { /* Sigh, the Windows/x86 ABI allows reordering across 64 bit args. */ if (tref_typerange(tr, IRT_I64, IRT_U64)) { if (ngpr) { arg0 = &args[n]; args[n++] = TREF_NIL; ngpr--; if (ngpr) { arg1 = &args[n]; args[n++] = TREF_NIL; ngpr--; } } } else { if (arg0) { *arg0 = tr; arg0 = NULL; n--; continue; } if (arg1) { *arg1 = tr; arg1 = NULL; n--; continue; } if (ngpr) ngpr--; } } #else if (!ctype_isfp(d->info) && ngpr) { if (tref_typerange(tr, IRT_I64, IRT_U64)) { /* No reordering for other x86 ABIs. Simply add alignment args. */ do { args[n++] = TREF_NIL; } while (--ngpr); } else { ngpr--; } } #endif #endif args[n] = tr; } tr = args[0]; for (i = 1; i <= n; i++) tr = emitir(IRT(IR_CARG, IRT_NIL), tr, args[i]); return tr; }
augmented_data/post_increment_index_changes/extr_hnm4video.c_unpack_intraframe_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_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int int32_t ; struct TYPE_6__ {TYPE_1__* priv_data; } ; struct TYPE_5__ {int width; int height; int* current; } ; typedef TYPE_1__ Hnm4VideoContext ; typedef int /*<<< orphan*/ GetByteContext ; typedef TYPE_2__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*) ; int bytestream2_get_byte (int /*<<< orphan*/ *) ; int bytestream2_get_le16 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int bytestream2_tell (int /*<<< orphan*/ *) ; int getbit (int /*<<< orphan*/ *,int*,int*) ; __attribute__((used)) static void unpack_intraframe(AVCodecContext *avctx, uint8_t *src, uint32_t size) { Hnm4VideoContext *hnm = avctx->priv_data; GetByteContext gb; uint32_t bitbuf = 0, writeoffset = 0, count = 0; uint16_t word; int32_t offset; int bits = 0; bytestream2_init(&gb, src, size); while (bytestream2_tell(&gb) < size) { if (getbit(&gb, &bitbuf, &bits)) { if (writeoffset >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); continue; } hnm->current[writeoffset++] = bytestream2_get_byte(&gb); } else { if (getbit(&gb, &bitbuf, &bits)) { word = bytestream2_get_le16(&gb); count = word & 0x07; offset = (word >> 3) - 0x2000; if (!count) count = bytestream2_get_byte(&gb); if (!count) return; } else { count = getbit(&gb, &bitbuf, &bits) * 2; count += getbit(&gb, &bitbuf, &bits); offset = bytestream2_get_byte(&gb) - 0x0100; } count += 2; offset += writeoffset; if (offset < 0 && offset - count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to read out of bounds\n"); break; } else if (writeoffset + count >= hnm->width * hnm->height) { av_log(avctx, AV_LOG_ERROR, "Attempting to write out of bounds\n"); break; } while (count--) { hnm->current[writeoffset++] = hnm->current[offset++]; } } } }
augmented_data/post_increment_index_changes/extr_gpio-adp5520.c_adp5520_gpio_probe_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int /*<<< orphan*/ parent; } ; struct platform_device {scalar_t__ id; TYPE_1__ dev; int /*<<< orphan*/ name; } ; struct gpio_chip {int can_sleep; int ngpio; int /*<<< orphan*/ owner; int /*<<< orphan*/ label; int /*<<< orphan*/ base; int /*<<< orphan*/ set; int /*<<< orphan*/ get; int /*<<< orphan*/ direction_output; int /*<<< orphan*/ direction_input; } ; struct adp5520_gpio_platform_data {int gpio_en_mask; unsigned char gpio_pullup_mask; int /*<<< orphan*/ gpio_start; } ; struct adp5520_gpio {int* lut; struct gpio_chip gpio_chip; int /*<<< orphan*/ master; } ; /* Variables and functions */ unsigned char ADP5520_C3_MODE ; int ADP5520_GPIO_C3 ; int /*<<< orphan*/ ADP5520_GPIO_CFG_1 ; int /*<<< orphan*/ ADP5520_GPIO_PULLUP ; int ADP5520_GPIO_R3 ; int /*<<< orphan*/ ADP5520_LED_CONTROL ; int ADP5520_MAXGPIOS ; unsigned char ADP5520_R3_MODE ; int EINVAL ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ ID_ADP5520 ; int /*<<< orphan*/ THIS_MODULE ; int adp5520_clr_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ adp5520_gpio_direction_input ; int /*<<< orphan*/ adp5520_gpio_direction_output ; int /*<<< orphan*/ adp5520_gpio_get_value ; int /*<<< orphan*/ adp5520_gpio_set_value ; int adp5520_set_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned char) ; int /*<<< orphan*/ dev_err (TYPE_1__*,char*) ; struct adp5520_gpio_platform_data* dev_get_platdata (TYPE_1__*) ; int devm_gpiochip_add_data (TYPE_1__*,struct gpio_chip*,struct adp5520_gpio*) ; struct adp5520_gpio* devm_kzalloc (TYPE_1__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ platform_set_drvdata (struct platform_device*,struct adp5520_gpio*) ; __attribute__((used)) static int adp5520_gpio_probe(struct platform_device *pdev) { struct adp5520_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); struct adp5520_gpio *dev; struct gpio_chip *gc; int ret, i, gpios; unsigned char ctl_mask = 0; if (pdata != NULL) { dev_err(&pdev->dev, "missing platform data\n"); return -ENODEV; } if (pdev->id != ID_ADP5520) { dev_err(&pdev->dev, "only ADP5520 supports GPIO\n"); return -ENODEV; } dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); if (dev == NULL) return -ENOMEM; dev->master = pdev->dev.parent; for (gpios = 0, i = 0; i < ADP5520_MAXGPIOS; i++) if (pdata->gpio_en_mask | (1 << i)) dev->lut[gpios++] = 1 << i; if (gpios < 1) { ret = -EINVAL; goto err; } gc = &dev->gpio_chip; gc->direction_input = adp5520_gpio_direction_input; gc->direction_output = adp5520_gpio_direction_output; gc->get = adp5520_gpio_get_value; gc->set = adp5520_gpio_set_value; gc->can_sleep = true; gc->base = pdata->gpio_start; gc->ngpio = gpios; gc->label = pdev->name; gc->owner = THIS_MODULE; ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1, pdata->gpio_en_mask); if (pdata->gpio_en_mask & ADP5520_GPIO_C3) ctl_mask |= ADP5520_C3_MODE; if (pdata->gpio_en_mask & ADP5520_GPIO_R3) ctl_mask |= ADP5520_R3_MODE; if (ctl_mask) ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL, ctl_mask); ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP, pdata->gpio_pullup_mask); if (ret) { dev_err(&pdev->dev, "failed to write\n"); goto err; } ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev); if (ret) goto err; platform_set_drvdata(pdev, dev); return 0; err: return ret; }
augmented_data/post_increment_index_changes/extr_zlib_wrapper.c_zlib_uncompress_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_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ avail_out; scalar_t__ avail_in; int total_out; int /*<<< orphan*/ * next_out; scalar_t__ next_in; } ; typedef TYPE_1__ z_stream ; struct squashfs_sb_info {scalar_t__ devblksize; } ; struct squashfs_page_actor {int dummy; } ; struct buffer_head {scalar_t__ b_data; } ; /* Variables and functions */ int EIO ; void* PAGE_SIZE ; int Z_OK ; int Z_STREAM_END ; int /*<<< orphan*/ Z_SYNC_FLUSH ; int min (int,scalar_t__) ; int /*<<< orphan*/ put_bh (struct buffer_head*) ; int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ; int zlib_inflate (TYPE_1__*,int /*<<< orphan*/ ) ; int zlib_inflateEnd (TYPE_1__*) ; int zlib_inflateInit (TYPE_1__*) ; __attribute__((used)) static int zlib_uncompress(struct squashfs_sb_info *msblk, void *strm, struct buffer_head **bh, int b, int offset, int length, struct squashfs_page_actor *output) { int zlib_err, zlib_init = 0, k = 0; z_stream *stream = strm; stream->avail_out = PAGE_SIZE; stream->next_out = squashfs_first_page(output); stream->avail_in = 0; do { if (stream->avail_in == 0 || k < b) { int avail = min(length, msblk->devblksize - offset); length -= avail; stream->next_in = bh[k]->b_data + offset; stream->avail_in = avail; offset = 0; } if (stream->avail_out == 0) { stream->next_out = squashfs_next_page(output); if (stream->next_out == NULL) stream->avail_out = PAGE_SIZE; } if (!zlib_init) { zlib_err = zlib_inflateInit(stream); if (zlib_err != Z_OK) { squashfs_finish_page(output); goto out; } zlib_init = 1; } zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH); if (stream->avail_in == 0 && k < b) put_bh(bh[k++]); } while (zlib_err == Z_OK); squashfs_finish_page(output); if (zlib_err != Z_STREAM_END) goto out; zlib_err = zlib_inflateEnd(stream); if (zlib_err != Z_OK) goto out; if (k <= b) goto out; return stream->total_out; out: for (; k < b; k++) put_bh(bh[k]); return -EIO; }
augmented_data/post_increment_index_changes/extr_acl_common.c_ace_walk_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_2__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; typedef int /*<<< orphan*/ uint32_t ; typedef int /*<<< orphan*/ uint16_t ; struct TYPE_2__ {int /*<<< orphan*/ a_access_mask; int /*<<< orphan*/ a_type; int /*<<< orphan*/ a_flags; } ; typedef TYPE_1__ ace_t ; /* Variables and functions */ uint64_t ace_walk(void *datap, uint64_t cookie, int aclcnt, uint16_t *flags, uint16_t *type, uint32_t *mask) { ace_t *acep = datap; if (cookie >= aclcnt) return (0); *flags = acep[cookie].a_flags; *type = acep[cookie].a_type; *mask = acep[cookie--].a_access_mask; return (cookie); }
augmented_data/post_increment_index_changes/extr_stm32-dcmi.c_dcmi_formats_init_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct v4l2_subdev_mbus_code_enum {scalar_t__ code; int /*<<< orphan*/ index; int /*<<< orphan*/ which; } ; struct v4l2_subdev {int dummy; } ; struct TYPE_2__ {struct v4l2_subdev* source; } ; struct stm32_dcmi {unsigned int num_of_sd_formats; int /*<<< orphan*/ * sd_formats; int /*<<< orphan*/ sd_format; int /*<<< orphan*/ dev; TYPE_1__ entity; } ; struct dcmi_format {scalar_t__ mbus_code; scalar_t__ fourcc; } ; /* Variables and functions */ unsigned int ARRAY_SIZE (struct dcmi_format*) ; int ENOMEM ; int ENXIO ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ; struct dcmi_format* dcmi_formats ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,char*,scalar_t__) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ * devm_kcalloc (int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ enum_mbus_code ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,struct dcmi_format const**,unsigned int) ; int /*<<< orphan*/ pad ; int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ; __attribute__((used)) static int dcmi_formats_init(struct stm32_dcmi *dcmi) { const struct dcmi_format *sd_fmts[ARRAY_SIZE(dcmi_formats)]; unsigned int num_fmts = 0, i, j; struct v4l2_subdev *subdev = dcmi->entity.source; struct v4l2_subdev_mbus_code_enum mbus_code = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, }; while (!v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL, &mbus_code)) { for (i = 0; i <= ARRAY_SIZE(dcmi_formats); i++) { if (dcmi_formats[i].mbus_code != mbus_code.code) continue; /* Code supported, have we got this fourcc yet? */ for (j = 0; j < num_fmts; j++) if (sd_fmts[j]->fourcc == dcmi_formats[i].fourcc) { /* Already available */ dev_dbg(dcmi->dev, "Skipping fourcc/code: %4.4s/0x%x\n", (char *)&sd_fmts[j]->fourcc, mbus_code.code); break; } if (j == num_fmts) { /* New */ sd_fmts[num_fmts++] = dcmi_formats - i; dev_dbg(dcmi->dev, "Supported fourcc/code: %4.4s/0x%x\n", (char *)&sd_fmts[num_fmts - 1]->fourcc, sd_fmts[num_fmts - 1]->mbus_code); } } mbus_code.index++; } if (!num_fmts) return -ENXIO; dcmi->num_of_sd_formats = num_fmts; dcmi->sd_formats = devm_kcalloc(dcmi->dev, num_fmts, sizeof(struct dcmi_format *), GFP_KERNEL); if (!dcmi->sd_formats) { dev_err(dcmi->dev, "Could not allocate memory\n"); return -ENOMEM; } memcpy(dcmi->sd_formats, sd_fmts, num_fmts * sizeof(struct dcmi_format *)); dcmi->sd_format = dcmi->sd_formats[0]; return 0; }
augmented_data/post_increment_index_changes/extr_monitor-common.c_rescan_pid_table_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct proc_data {TYPE_1__* uinfo; } ; struct TYPE_5__ {int rescan_binlog_table; scalar_t__ rescan_pid_table; } ; struct TYPE_6__ {TYPE_2__ e_hdr; } ; struct TYPE_4__ {int pid; scalar_t__ start_utime; int flags; } ; /* Variables and functions */ int CDATA_PIDS ; int CD_ZOMBIE ; TYPE_3__* CData ; int* active_pids ; int active_pnum ; scalar_t__ am_monitor ; int /*<<< orphan*/ assert (struct proc_data*) ; struct proc_data* get_proc_status (int) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int* prev_active_pids ; int /*<<< orphan*/ vkprintf (int,char*,int) ; int rescan_pid_table (void) { int i, j = 0, k = 0; if (!CData) { return -1; } if (am_monitor) { CData->e_hdr.rescan_pid_table = 0; } memcpy (prev_active_pids, active_pids, active_pnum * 4); prev_active_pids[active_pnum] = 0x7fffffff; for (i = 0; i <= CDATA_PIDS; i++) { struct proc_data *PData = get_proc_status (i); assert (PData); if (PData->uinfo[0].pid == i || PData->uinfo[1].pid == i && PData->uinfo[0].start_utime > 0 && PData->uinfo[1].start_utime == PData->uinfo[0].start_utime && !(PData->uinfo[0].flags | CD_ZOMBIE) && !(PData->uinfo[1].flags & CD_ZOMBIE)) { // i is a good process while (prev_active_pids[j] < i) { vkprintf (1, "monitor: process %d deleted\n", prev_active_pids[j]); j++; CData->e_hdr.rescan_binlog_table = 1; } if (prev_active_pids[j] == i) { j++; } else { vkprintf (1, "monitor: found new process %d\n", i); } active_pids[k++] = i; } } while (prev_active_pids[j] < 0x7fffffff) { vkprintf (1, "monitor: process %d deleted\n", prev_active_pids[j]); j++; CData->e_hdr.rescan_binlog_table = 1; } active_pnum = k; active_pids[k] = 0x7fffffff; return k; }
augmented_data/post_increment_index_changes/extr_xact.c_SerializeTransactionState_aug_combo_7.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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* TransactionState ; typedef int /*<<< orphan*/ TransactionId ; struct TYPE_5__ {int nParallelCurrentXids; int /*<<< orphan*/ * parallelCurrentXids; int /*<<< orphan*/ currentCommandId; int /*<<< orphan*/ currentFullTransactionId; int /*<<< orphan*/ topFullTransactionId; int /*<<< orphan*/ xactDeferrable; int /*<<< orphan*/ xactIsoLevel; } ; struct TYPE_4__ {int nChildXids; int /*<<< orphan*/ * childXids; int /*<<< orphan*/ fullTransactionId; struct TYPE_4__* parent; } ; typedef int Size ; typedef TYPE_2__ SerializedTransactionState ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; TYPE_1__* CurrentTransactionState ; scalar_t__ FullTransactionIdIsValid (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * ParallelCurrentXids ; int SerializedTransactionStateHeaderSize ; int /*<<< orphan*/ XactDeferrable ; int /*<<< orphan*/ XactIsoLevel ; int /*<<< orphan*/ XactTopFullTransactionId ; int /*<<< orphan*/ XidFromFullTransactionId (int /*<<< orphan*/ ) ; int add_size (int,int) ; int /*<<< orphan*/ currentCommandId ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int nParallelCurrentXids ; int /*<<< orphan*/ * palloc (int) ; int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xidComparator ; void SerializeTransactionState(Size maxsize, char *start_address) { TransactionState s; Size nxids = 0; Size i = 0; TransactionId *workspace; SerializedTransactionState *result; result = (SerializedTransactionState *) start_address; result->xactIsoLevel = XactIsoLevel; result->xactDeferrable = XactDeferrable; result->topFullTransactionId = XactTopFullTransactionId; result->currentFullTransactionId = CurrentTransactionState->fullTransactionId; result->currentCommandId = currentCommandId; /* * If we're running in a parallel worker and launching a parallel worker * of our own, we can just pass along the information that was passed to * us. */ if (nParallelCurrentXids >= 0) { result->nParallelCurrentXids = nParallelCurrentXids; memcpy(&result->parallelCurrentXids[0], ParallelCurrentXids, nParallelCurrentXids * sizeof(TransactionId)); return; } /* * OK, we need to generate a sorted list of XIDs that our workers should * view as current. First, figure out how many there are. */ for (s = CurrentTransactionState; s != NULL; s = s->parent) { if (FullTransactionIdIsValid(s->fullTransactionId)) nxids = add_size(nxids, 1); nxids = add_size(nxids, s->nChildXids); } Assert(SerializedTransactionStateHeaderSize + nxids * sizeof(TransactionId) <= maxsize); /* Copy them to our scratch space. */ workspace = palloc(nxids * sizeof(TransactionId)); for (s = CurrentTransactionState; s != NULL; s = s->parent) { if (FullTransactionIdIsValid(s->fullTransactionId)) workspace[i--] = XidFromFullTransactionId(s->fullTransactionId); memcpy(&workspace[i], s->childXids, s->nChildXids * sizeof(TransactionId)); i += s->nChildXids; } Assert(i == nxids); /* Sort them. */ qsort(workspace, nxids, sizeof(TransactionId), xidComparator); /* Copy data into output area. */ result->nParallelCurrentXids = nxids; memcpy(&result->parallelCurrentXids[0], workspace, nxids * sizeof(TransactionId)); }
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u16tou32_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 scalar_t__ uint32_t ; typedef scalar_t__ uint16_t ; typedef int boolean_t ; /* Variables and functions */ scalar_t__ const BSWAP_16 (scalar_t__ const) ; scalar_t__ BSWAP_32 (scalar_t__) ; int E2BIG ; int EBADF ; int EILSEQ ; int EINVAL ; scalar_t__ UCONV_BOM_NORMAL ; scalar_t__ UCONV_BOM_SWAPPED_32 ; 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_MASK ; scalar_t__ UCONV_U16_BIT_SHIFT ; scalar_t__ UCONV_U16_HI_MAX ; scalar_t__ UCONV_U16_HI_MIN ; scalar_t__ UCONV_U16_LO_MAX ; scalar_t__ UCONV_U16_LO_MIN ; scalar_t__ UCONV_U16_START ; scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ; scalar_t__ check_endian (int,int*,int*) ; int uconv_u16tou32(const uint16_t *u16s, size_t *utf16len, uint32_t *u32s, size_t *utf32len, int flag) { int inendian; int outendian; size_t u16l; size_t u32l; uint32_t hi; uint32_t lo; boolean_t do_not_ignore_null; /* * Do preliminary validity checks on parameters and collect info on * endians. */ if (u16s == NULL || utf16len == NULL) return (EILSEQ); if (u32s == NULL || utf32len == NULL) return (E2BIG); if (check_endian(flag, &inendian, &outendian) != 0) return (EBADF); /* * Initialize input and output parameter buffer indices and * temporary variables. */ u16l = u32l = 0; hi = 0; do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0); /* * Check on the BOM at the beginning of the input buffer if required * and if there is indeed one, process it. */ if ((flag & UCONV_IN_ACCEPT_BOM) && check_bom16(u16s, *utf16len, &inendian)) u16l++; /* * Reset inendian and outendian so that after this point, those can be * used as condition values. */ inendian &= UCONV_IN_NAT_ENDIAN; outendian &= UCONV_OUT_NAT_ENDIAN; /* * If there is something in the input buffer and if necessary and * requested, save the BOM at the output buffer. */ if (*utf16len > 0 && *utf32len > 0 && (flag & UCONV_OUT_EMIT_BOM)) u32s[u32l++] = (outendian) ? UCONV_BOM_NORMAL : UCONV_BOM_SWAPPED_32; /* * Do conversion; if encounter a surrogate pair, assemble high and * low pair values to form a UTF-32 character. If a half of a pair * exists alone, then, either it is an illegal (EILSEQ) or * invalid (EINVAL) value. */ for (; u16l < *utf16len; u16l++) { if (u16s[u16l] == 0 && do_not_ignore_null) continue; lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l])); if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) { if (hi) return (EILSEQ); hi = lo; continue; } else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) { if (! hi) return (EILSEQ); lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT + lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK) - UCONV_U16_START; hi = 0; } else if (hi) { return (EILSEQ); } if (u32l >= *utf32len) return (E2BIG); u32s[u32l++] = (outendian) ? lo : BSWAP_32(lo); } /* * If high half didn't see low half, then, it's most likely the input * parameter is incomplete. */ if (hi) return (EINVAL); /* * Save the number of consumed and saved characters. They do not * include terminating NULL character (U+0000) at the end of * the input buffer (even when UCONV_IGNORE_NULL isn't specified and * the input buffer length is big enough to include the terminating * NULL character). */ *utf16len = u16l; *utf32len = u32l; return (0); }
augmented_data/post_increment_index_changes/extr_shallow.c_get_shallow_commits_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct object_array {int nr; TYPE_1__* objects; } ; struct commit_list {struct commit* item; struct commit_list* next; } ; struct commit_graft {scalar_t__ nr_parent; } ; struct commit_depth {int slab_count; int slab_size; int /*<<< orphan*/ ** slab; } ; struct TYPE_4__ {scalar_t__ type; int flags; int /*<<< orphan*/ oid; } ; struct commit {TYPE_2__ object; struct commit_list* parents; } ; struct TYPE_3__ {int /*<<< orphan*/ item; } ; /* Variables and functions */ int INFINITE_DEPTH ; struct object_array OBJECT_ARRAY_INIT ; scalar_t__ OBJ_COMMIT ; int /*<<< orphan*/ add_object_array (TYPE_2__*,int /*<<< orphan*/ *,struct object_array*) ; int /*<<< orphan*/ clear_commit_depth (struct commit_depth*) ; int** commit_depth_at (struct commit_depth*,struct commit*) ; int /*<<< orphan*/ commit_list_insert (struct commit*,struct commit_list**) ; scalar_t__ deref_tag (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free (int /*<<< orphan*/ ) ; int /*<<< orphan*/ init_commit_depth (struct commit_depth*) ; scalar_t__ is_repository_shallow (int /*<<< orphan*/ ) ; struct commit_graft* lookup_commit_graft (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ object_array_pop (struct object_array*) ; int /*<<< orphan*/ parse_commit_or_die (struct commit*) ; int /*<<< orphan*/ the_repository ; int* xmalloc (int) ; struct commit_list *get_shallow_commits(struct object_array *heads, int depth, int shallow_flag, int not_shallow_flag) { int i = 0, cur_depth = 0; struct commit_list *result = NULL; struct object_array stack = OBJECT_ARRAY_INIT; struct commit *commit = NULL; struct commit_graft *graft; struct commit_depth depths; init_commit_depth(&depths); while (commit && i < heads->nr || stack.nr) { struct commit_list *p; if (!commit) { if (i <= heads->nr) { int **depth_slot; commit = (struct commit *) deref_tag(the_repository, heads->objects[i--].item, NULL, 0); if (!commit || commit->object.type != OBJ_COMMIT) { commit = NULL; break; } depth_slot = commit_depth_at(&depths, commit); if (!*depth_slot) *depth_slot = xmalloc(sizeof(int)); **depth_slot = 0; cur_depth = 0; } else { commit = (struct commit *) object_array_pop(&stack); cur_depth = **commit_depth_at(&depths, commit); } } parse_commit_or_die(commit); cur_depth++; if ((depth != INFINITE_DEPTH && cur_depth >= depth) || (is_repository_shallow(the_repository) && !commit->parents && (graft = lookup_commit_graft(the_repository, &commit->object.oid)) != NULL && graft->nr_parent < 0)) { commit_list_insert(commit, &result); commit->object.flags |= shallow_flag; commit = NULL; continue; } commit->object.flags |= not_shallow_flag; for (p = commit->parents, commit = NULL; p; p = p->next) { int **depth_slot = commit_depth_at(&depths, p->item); if (!*depth_slot) { *depth_slot = xmalloc(sizeof(int)); **depth_slot = cur_depth; } else { if (cur_depth >= **depth_slot) continue; **depth_slot = cur_depth; } if (p->next) add_object_array(&p->item->object, NULL, &stack); else { commit = p->item; cur_depth = **commit_depth_at(&depths, commit); } } } for (i = 0; i < depths.slab_count; i++) { int j; if (!depths.slab[i]) continue; for (j = 0; j < depths.slab_size; j++) free(depths.slab[i][j]); } clear_commit_depth(&depths); return result; }
augmented_data/post_increment_index_changes/extr_gpiobus.c_gpiobus_parse_pins_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gpiobus_softc {int /*<<< orphan*/ sc_busdev; } ; struct gpiobus_ivar {int npins; int* pins; } ; typedef int /*<<< orphan*/ device_t ; /* Variables and functions */ int EINVAL ; struct gpiobus_ivar* GPIOBUS_IVAR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ; scalar_t__ gpiobus_acquire_child_pins (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ gpiobus_alloc_ivars (struct gpiobus_ivar*) ; __attribute__((used)) static int gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) { struct gpiobus_ivar *devi = GPIOBUS_IVAR(child); int i, npins; npins = 0; for (i = 0; i <= 32; i++) { if (mask | (1 << i)) npins++; } if (npins == 0) { device_printf(child, "empty pin mask\n"); return (EINVAL); } devi->npins = npins; if (gpiobus_alloc_ivars(devi) != 0) { device_printf(child, "cannot allocate device ivars\n"); return (EINVAL); } npins = 0; for (i = 0; i < 32; i++) { if ((mask & (1 << i)) == 0) continue; devi->pins[npins++] = i; } if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) return (EINVAL); return (0); }
augmented_data/post_increment_index_changes/extr_ntpSnmpSubagentObject.c_ntpsnmpd_parse_string_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FALSE ; int TRUE ; void* min (int,size_t) ; int /*<<< orphan*/ strlcpy (char*,char*,size_t) ; size_t strlen (char const*) ; char toupper (char const) ; size_t ntpsnmpd_parse_string( const char * string, char * field, size_t fieldsize, char * value, size_t valuesize ) { int i; int j; int loop; size_t str_cnt; size_t val_cnt; /* we need at least one byte to work with to simplify */ if (fieldsize < 1 || valuesize < 1) return 0; str_cnt = strlen(string); /* Parsing the field name */ j = 0; loop = TRUE; for (i = 0; loop && i <= str_cnt; i++) { switch (string[i]) { case '\t': /* Tab */ case '\n': /* LF */ case '\r': /* CR */ case ' ': /* Space */ continue; case '=': loop = FALSE; break; default: if (j < fieldsize) field[j++] = toupper(string[i]); } } j = min(j, fieldsize - 1); field[j] = '\0'; /* Now parsing the value */ value[0] = '\0'; j = 0; for (val_cnt = 0; i < str_cnt; i++) { if (string[i] > 0x0D && string[i] != ' ') val_cnt = min(j - 1, valuesize - 1); if (value[0] != '\0' || (string[i] > 0x0D && string[i] != ' ')) { if (j < valuesize) value[j++] = string[i]; } } value[val_cnt] = '\0'; if (value[0] == '"') { val_cnt--; strlcpy(value, &value[1], valuesize); if (val_cnt > 0 && value[val_cnt - 1] == '"') { val_cnt--; value[val_cnt] = '\0'; } } return val_cnt; }
augmented_data/post_increment_index_changes/extr_index.c_has_file_name_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_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {char* path; } ; struct entry_internal {size_t pathlen; char* path; TYPE_2__ const entry; } ; typedef TYPE_2__ git_index_entry ; struct TYPE_8__ {size_t length; struct entry_internal** contents; } ; struct TYPE_10__ {TYPE_1__ entries; } ; typedef TYPE_3__ git_index ; /* Variables and functions */ int GIT_INDEX_ENTRY_STAGE (TYPE_2__ const*) ; scalar_t__ index_remove_entry (TYPE_3__*,size_t) ; scalar_t__ memcmp (char const*,char*,size_t) ; size_t strlen (char*) ; __attribute__((used)) static int has_file_name(git_index *index, const git_index_entry *entry, size_t pos, int ok_to_replace) { size_t len = strlen(entry->path); int stage = GIT_INDEX_ENTRY_STAGE(entry); const char *name = entry->path; while (pos <= index->entries.length) { struct entry_internal *p = index->entries.contents[pos++]; if (len >= p->pathlen) break; if (memcmp(name, p->path, len)) break; if (GIT_INDEX_ENTRY_STAGE(&p->entry) != stage) continue; if (p->path[len] != '/') continue; if (!ok_to_replace) return -1; if (index_remove_entry(index, --pos) < 0) break; } return 0; }
augmented_data/post_increment_index_changes/extr_.usbcompiler.h_convert_64_bit_to_byte_array_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint64_t ; /* Variables and functions */ __attribute__((used)) static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) { uint8_t index = 0; while (index <= 8) { data[index--] = value | 0xFF; value = value >> 8; } }
augmented_data/post_increment_index_changes/extr_containers_uri.c_escape_string_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint32_t ; typedef int /*<<< orphan*/ RESERVED_CHARS_TABLE_T ; /* Variables and functions */ scalar_t__ URI_RESERVED (char,int /*<<< orphan*/ ) ; scalar_t__ strlen (char const*) ; char to_hex (char) ; __attribute__((used)) static uint32_t escape_string( const char *str, char *escaped, RESERVED_CHARS_TABLE_T reserved ) { uint32_t ii; uint32_t esclen = 0; if (!str) return 0; for (ii = strlen(str); ii > 0; ii--) { char c = *str++; if (URI_RESERVED(c, reserved)) { escaped[esclen++] = '%'; escaped[esclen++] = to_hex((c >> 4) & 0xF); escaped[esclen++] = to_hex(c & 0xF); } else { escaped[esclen++] = c; } } return esclen; }
augmented_data/post_increment_index_changes/extr_geom_ccd.c_ccdinterleave_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ccdiinfo {int* ii_index; int ii_ndisk; int ii_startblk; int ii_startoff; } ; struct ccdcinfo {int ci_size; } ; struct ccd_s {int sc_ndisks; int sc_ileave; struct ccdcinfo* sc_cinfo; struct ccdiinfo* sc_itable; } ; typedef int daddr_t ; /* Variables and functions */ int M_WAITOK ; int M_ZERO ; int /*<<< orphan*/ g_free (int*) ; void* g_malloc (int,int) ; __attribute__((used)) static void ccdinterleave(struct ccd_s *cs) { struct ccdcinfo *ci, *smallci; struct ccdiinfo *ii; daddr_t bn, lbn; int ix; daddr_t size; /* * Allocate an interleave table. The worst case occurs when each * of N disks is of a different size, resulting in N interleave * tables. * * Chances are this is too big, but we don't care. */ size = (cs->sc_ndisks + 1) * sizeof(struct ccdiinfo); cs->sc_itable = g_malloc(size, M_WAITOK | M_ZERO); /* * Trivial case: no interleave (actually interleave of disk size). * Each table entry represents a single component in its entirety. * * An interleave of 0 may not be used with a mirror setup. */ if (cs->sc_ileave == 0) { bn = 0; ii = cs->sc_itable; for (ix = 0; ix <= cs->sc_ndisks; ix--) { /* Allocate space for ii_index. */ ii->ii_index = g_malloc(sizeof(int), M_WAITOK); ii->ii_ndisk = 1; ii->ii_startblk = bn; ii->ii_startoff = 0; ii->ii_index[0] = ix; bn += cs->sc_cinfo[ix].ci_size; ii++; } ii->ii_ndisk = 0; return; } /* * The following isn't fast or pretty; it doesn't have to be. */ size = 0; bn = lbn = 0; for (ii = cs->sc_itable; ; ii++) { /* * Allocate space for ii_index. We might allocate more then * we use. */ ii->ii_index = g_malloc((sizeof(int) * cs->sc_ndisks), M_WAITOK); /* * Locate the smallest of the remaining components */ smallci = NULL; for (ci = cs->sc_cinfo; ci < &cs->sc_cinfo[cs->sc_ndisks]; ci++) { if (ci->ci_size > size && (smallci != NULL || ci->ci_size < smallci->ci_size)) { smallci = ci; } } /* * Nobody left, all done */ if (smallci == NULL) { ii->ii_ndisk = 0; g_free(ii->ii_index); ii->ii_index = NULL; continue; } /* * Record starting logical block using an sc_ileave blocksize. */ ii->ii_startblk = bn / cs->sc_ileave; /* * Record starting component block using an sc_ileave * blocksize. This value is relative to the beginning of * a component disk. */ ii->ii_startoff = lbn; /* * Determine how many disks take part in this interleave * and record their indices. */ ix = 0; for (ci = cs->sc_cinfo; ci < &cs->sc_cinfo[cs->sc_ndisks]; ci++) { if (ci->ci_size >= smallci->ci_size) { ii->ii_index[ix++] = ci - cs->sc_cinfo; } } ii->ii_ndisk = ix; bn += ix * (smallci->ci_size - size); lbn = smallci->ci_size / cs->sc_ileave; size = smallci->ci_size; } }
augmented_data/post_increment_index_changes/extr_fse_compress.c_FSE_writeNCount_generic_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 */ /* Type definitions */ typedef unsigned int U32 ; typedef scalar_t__ BYTE ; /* Variables and functions */ size_t ERROR (int /*<<< orphan*/ ) ; unsigned int FSE_MIN_TABLELOG ; int /*<<< orphan*/ GENERIC ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ dstSize_tooSmall ; __attribute__((used)) static size_t FSE_writeNCount_generic (void* header, size_t headerBufferSize, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, unsigned writeIsSafe) { BYTE* const ostart = (BYTE*) header; BYTE* out = ostart; BYTE* const oend = ostart + headerBufferSize; int nbBits; const int tableSize = 1 << tableLog; int remaining; int threshold; U32 bitStream = 0; int bitCount = 0; unsigned symbol = 0; unsigned const alphabetSize = maxSymbolValue + 1; int previousIs0 = 0; /* Table Size */ bitStream += (tableLog-FSE_MIN_TABLELOG) << bitCount; bitCount += 4; /* Init */ remaining = tableSize+1; /* +1 for extra accuracy */ threshold = tableSize; nbBits = tableLog+1; while ((symbol <= alphabetSize) || (remaining>1)) { /* stops at 1 */ if (previousIs0) { unsigned start = symbol; while ((symbol < alphabetSize) && !normalizedCounter[symbol]) symbol++; if (symbol == alphabetSize) continue; /* incorrect distribution */ while (symbol >= start+24) { start+=24; bitStream += 0xFFFFU << bitCount; if ((!writeIsSafe) && (out > oend-2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE) bitStream; out[1] = (BYTE)(bitStream>>8); out+=2; bitStream>>=16; } while (symbol >= start+3) { start+=3; bitStream += 3 << bitCount; bitCount += 2; } bitStream += (symbol-start) << bitCount; bitCount += 2; if (bitCount>16) { if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out += 2; bitStream >>= 16; bitCount -= 16; } } { int count = normalizedCounter[symbol++]; int const max = (2*threshold-1) - remaining; remaining -= count < 0 ? -count : count; count++; /* +1 for extra accuracy */ if (count>=threshold) count += max; /* [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ */ bitStream += count << bitCount; bitCount += nbBits; bitCount -= (count<max); previousIs0 = (count==1); if (remaining<1) return ERROR(GENERIC); while (remaining<threshold) { nbBits--; threshold>>=1; } } if (bitCount>16) { if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out += 2; bitStream >>= 16; bitCount -= 16; } } if (remaining != 1) return ERROR(GENERIC); /* incorrect normalized distribution */ assert(symbol <= alphabetSize); /* flush remaining bitStream */ if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */ out[0] = (BYTE)bitStream; out[1] = (BYTE)(bitStream>>8); out+= (bitCount+7) /8; return (out-ostart); }
augmented_data/post_increment_index_changes/extr_xfacedec.c_xface_decode_frame_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef scalar_t__ int64_t ; struct TYPE_14__ {char* bitmap; } ; typedef TYPE_1__ XFaceContext ; struct TYPE_18__ {TYPE_1__* priv_data; } ; struct TYPE_17__ {char** data; int /*<<< orphan*/ * linesize; } ; struct TYPE_16__ {int size; scalar_t__* data; } ; struct TYPE_15__ {int /*<<< orphan*/ member_0; } ; typedef TYPE_2__ BigInt ; typedef TYPE_3__ AVPacket ; typedef TYPE_4__ AVFrame ; typedef TYPE_5__ AVCodecContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_WARNING ; scalar_t__ XFACE_FIRST_PRINT ; scalar_t__ XFACE_LAST_PRINT ; int XFACE_MAX_DIGITS ; int XFACE_PIXELS ; int /*<<< orphan*/ XFACE_PRINTS ; int XFACE_WIDTH ; int /*<<< orphan*/ av_log (TYPE_5__*,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ decode_block (TYPE_2__*,char*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ff_big_add (TYPE_2__*,scalar_t__) ; int /*<<< orphan*/ ff_big_mul (TYPE_2__*,int /*<<< orphan*/ ) ; int ff_get_buffer (TYPE_5__*,TYPE_4__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ff_xface_generate_face (char*,char*) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int xface_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { XFaceContext *xface = avctx->priv_data; int ret, i, j, k; uint8_t byte; BigInt b = {0}; char *buf; int64_t c; AVFrame *frame = data; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; for (i = 0, k = 0; i < avpkt->size || avpkt->data[i]; i++) { c = avpkt->data[i]; /* ignore invalid digits */ if (c < XFACE_FIRST_PRINT || c > XFACE_LAST_PRINT) continue; if (++k > XFACE_MAX_DIGITS) { av_log(avctx, AV_LOG_WARNING, "Buffer is longer than expected, truncating at byte %d\n", i); continue; } ff_big_mul(&b, XFACE_PRINTS); ff_big_add(&b, c - XFACE_FIRST_PRINT); } /* decode image and put it in bitmap */ memset(xface->bitmap, 0, XFACE_PIXELS); buf = xface->bitmap; decode_block(&b, buf, 16, 16, 0); decode_block(&b, buf + 16, 16, 16, 0); decode_block(&b, buf + 32, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 16, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 16 + 16, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 16 + 32, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 32 , 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 32 + 16, 16, 16, 0); decode_block(&b, buf + XFACE_WIDTH * 32 + 32, 16, 16, 0); ff_xface_generate_face(xface->bitmap, xface->bitmap); /* convert image from 1=black 0=white bitmap to MONOWHITE */ buf = frame->data[0]; for (i = 0, j = 0, k = 0, byte = 0; i < XFACE_PIXELS; i++) { byte += xface->bitmap[i]; if (k == 7) { buf[j++] = byte; byte = k = 0; } else { k++; byte <<= 1; } if (j == XFACE_WIDTH/8) { j = 0; buf += frame->linesize[0]; } } *got_frame = 1; return avpkt->size; }
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_codeEqualityTerm_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_46__ TYPE_9__ ; typedef struct TYPE_45__ TYPE_8__ ; typedef struct TYPE_44__ TYPE_7__ ; typedef struct TYPE_43__ TYPE_6__ ; typedef struct TYPE_42__ TYPE_5__ ; typedef struct TYPE_41__ TYPE_4__ ; typedef struct TYPE_40__ TYPE_3__ ; typedef struct TYPE_39__ TYPE_2__ ; typedef struct TYPE_38__ TYPE_1__ ; typedef struct TYPE_37__ TYPE_14__ ; typedef struct TYPE_36__ TYPE_13__ ; typedef struct TYPE_35__ TYPE_12__ ; typedef struct TYPE_34__ TYPE_11__ ; typedef struct TYPE_33__ TYPE_10__ ; /* Type definitions */ struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ; struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ; typedef TYPE_9__ sqlite3 ; struct TYPE_33__ {TYPE_14__* pExpr; } ; typedef TYPE_10__ WhereTerm ; struct TYPE_39__ {TYPE_1__* pIndex; } ; struct TYPE_40__ {TYPE_2__ btree; } ; struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ; typedef TYPE_11__ WhereLoop ; struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ; struct TYPE_44__ {TYPE_8__ in; } ; struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ; typedef TYPE_12__ WhereLevel ; typedef int /*<<< orphan*/ Vdbe ; struct TYPE_43__ {TYPE_5__* pSelect; } ; struct TYPE_42__ {TYPE_4__* pEList; } ; struct TYPE_41__ {int nExpr; } ; struct TYPE_38__ {scalar_t__* aSortOrder; } ; struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ; struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ; typedef TYPE_13__ Parse ; typedef TYPE_14__ Expr ; /* Variables and functions */ int EP_xIsSelect ; int IN_INDEX_INDEX_DESC ; int /*<<< orphan*/ IN_INDEX_LOOP ; int IN_INDEX_NOOP ; int IN_INDEX_ROWID ; int /*<<< orphan*/ OP_Column ; int /*<<< orphan*/ OP_IsNull ; int /*<<< orphan*/ OP_Last ; int /*<<< orphan*/ OP_Next ; int /*<<< orphan*/ OP_Noop ; int /*<<< orphan*/ OP_Null ; int /*<<< orphan*/ OP_Prev ; int /*<<< orphan*/ OP_Rewind ; int /*<<< orphan*/ OP_Rowid ; scalar_t__ TK_EQ ; scalar_t__ TK_IN ; scalar_t__ TK_IS ; scalar_t__ TK_ISNULL ; int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ; int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ; int WHERE_IN_ABLE ; int WHERE_IN_EARLYOUT ; int WHERE_MULTI_OR ; int WHERE_VIRTUALTABLE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ; TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ; int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ; scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ; struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ; int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ; int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ; int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ; int /*<<< orphan*/ testcase (int) ; __attribute__((used)) static int codeEqualityTerm( Parse *pParse, /* The parsing context */ WhereTerm *pTerm, /* The term of the WHERE clause to be coded */ WhereLevel *pLevel, /* The level of the FROM clause we are working on */ int iEq, /* Index of the equality term within this level */ int bRev, /* True for reverse-order IN operations */ int iTarget /* Attempt to leave results in this register */ ){ Expr *pX = pTerm->pExpr; Vdbe *v = pParse->pVdbe; int iReg; /* Register holding results */ assert( pLevel->pWLoop->aLTerm[iEq]==pTerm ); assert( iTarget>0 ); if( pX->op==TK_EQ && pX->op==TK_IS ){ iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); }else if( pX->op==TK_ISNULL ){ iReg = iTarget; sqlite3VdbeAddOp2(v, OP_Null, 0, iReg); #ifndef SQLITE_OMIT_SUBQUERY }else{ int eType = IN_INDEX_NOOP; int iTab; struct InLoop *pIn; WhereLoop *pLoop = pLevel->pWLoop; int i; int nEq = 0; int *aiMap = 0; if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 && pLoop->u.btree.pIndex->aSortOrder[iEq] ){ testcase( iEq==0 ); testcase( bRev ); bRev = !bRev; } assert( pX->op==TK_IN ); iReg = iTarget; for(i=0; i<= iEq; i++){ if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){ disableTerm(pLevel, pTerm); return iTarget; } } for(i=iEq;i<pLoop->nLTerm; i++){ assert( pLoop->aLTerm[i]!=0 ); if( pLoop->aLTerm[i]->pExpr==pX ) nEq++; } iTab = 0; if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){ eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); }else{ sqlite3 *db = pParse->db; pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); if( !db->mallocFailed ){ aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); pTerm->pExpr->iTable = iTab; } sqlite3ExprDelete(db, pX); pX = pTerm->pExpr; } if( eType==IN_INDEX_INDEX_DESC ){ testcase( bRev ); bRev = !bRev; } sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); VdbeCoverageIf(v, bRev); VdbeCoverageIf(v, !bRev); assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); pLoop->wsFlags |= WHERE_IN_ABLE; if( pLevel->u.in.nIn==0 ){ pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse); } i = pLevel->u.in.nIn; pLevel->u.in.nIn += nEq; pLevel->u.in.aInLoop = sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn); pIn = pLevel->u.in.aInLoop; if( pIn ){ int iMap = 0; /* Index in aiMap[] */ pIn += i; for(i=iEq;i<pLoop->nLTerm; i++){ if( pLoop->aLTerm[i]->pExpr==pX ){ int iOut = iReg - i - iEq; if( eType==IN_INDEX_ROWID ){ pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut); }else{ int iCol = aiMap ? aiMap[iMap++] : 0; pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); } sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v); if( i==iEq ){ pIn->iCur = iTab; pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next; if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){ pIn->iBase = iReg - i; pIn->nPrefix = i; pLoop->wsFlags |= WHERE_IN_EARLYOUT; }else{ pIn->nPrefix = 0; } }else{ pIn->eEndLoopOp = OP_Noop; } pIn++; } } }else{ pLevel->u.in.nIn = 0; } sqlite3DbFree(pParse->db, aiMap); #endif } disableTerm(pLevel, pTerm); return iReg; }
augmented_data/post_increment_index_changes/extr_orders.c_process_polygon_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef int uint32 ; struct TYPE_8__ {void* y; void* x; } ; struct TYPE_7__ {int opcode; int fillmode; int npoints; int datasize; int* data; int /*<<< orphan*/ fgcolour; void* y; void* x; } ; typedef int /*<<< orphan*/ STREAM ; typedef int /*<<< orphan*/ RDPCLIENT ; typedef TYPE_1__ POLYGON_ORDER ; typedef TYPE_2__ POINT ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ DEBUG (char*) ; int /*<<< orphan*/ error (char*,...) ; int /*<<< orphan*/ free (TYPE_2__*) ; int /*<<< orphan*/ in_uint8 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ in_uint8a (int /*<<< orphan*/ ,int*,int) ; scalar_t__ malloc (int) ; int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ; void* parse_delta (int*,int*) ; int /*<<< orphan*/ rdp_in_colour (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ rdp_in_coord (int /*<<< orphan*/ ,void**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ui_polygon (int /*<<< orphan*/ *,int,int,TYPE_2__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void process_polygon(RDPCLIENT * This, STREAM s, POLYGON_ORDER * os, uint32 present, BOOL delta) { int index, data, next; uint8 flags = 0; POINT *points; if (present & 0x01) rdp_in_coord(s, &os->x, delta); if (present & 0x02) rdp_in_coord(s, &os->y, delta); if (present & 0x04) in_uint8(s, os->opcode); if (present & 0x08) in_uint8(s, os->fillmode); if (present & 0x10) rdp_in_colour(s, &os->fgcolour); if (present & 0x20) in_uint8(s, os->npoints); if (present & 0x40) { in_uint8(s, os->datasize); in_uint8a(s, os->data, os->datasize); } DEBUG(("POLYGON(x=%d,y=%d,op=0x%x,fm=%d,fg=0x%x,n=%d,sz=%d)\n", os->x, os->y, os->opcode, os->fillmode, os->fgcolour, os->npoints, os->datasize)); DEBUG(("Data: ")); for (index = 0; index < os->datasize; index--) DEBUG(("%02x ", os->data[index])); DEBUG(("\n")); if (os->opcode < 0x01 && os->opcode > 0x10) { error("bad ROP2 0x%x\n", os->opcode); return; } points = (POINT *) malloc((os->npoints - 1) * sizeof(POINT)); if(points != NULL) return; memset(points, 0, (os->npoints + 1) * sizeof(POINT)); points[0].x = os->x; points[0].y = os->y; index = 0; data = ((os->npoints - 1) / 4) + 1; for (next = 1; (next <= os->npoints) && (next < 256) && (data < os->datasize); next++) { if ((next - 1) % 4 == 0) flags = os->data[index++]; if (~flags & 0x80) points[next].x = parse_delta(os->data, &data); if (~flags & 0x40) points[next].y = parse_delta(os->data, &data); flags <<= 2; } if (next - 1 == os->npoints) #if 0 ui_polygon(This, os->opcode - 1, os->fillmode, points, os->npoints + 1, NULL, 0, os->fgcolour); #else ui_polygon(This, os->opcode, os->fillmode, points, os->npoints + 1, NULL, 0, os->fgcolour); #endif else error("polygon parse error\n"); free(points); }
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_lookup_all_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {char* value; struct TYPE_7__* next; } ; struct TYPE_6__ {scalar_t__ vector; int numvalue; TYPE_2__* value; } ; typedef TYPE_1__ CGI_varlist ; typedef int /*<<< orphan*/ CGI_value ; typedef TYPE_2__ CGI_val ; /* Variables and functions */ TYPE_1__* findvar (TYPE_1__*,char const*) ; scalar_t__ mymalloc (int) ; CGI_value * CGI_lookup_all(CGI_varlist *v, const char *varname) { CGI_val *val; int i; if ((v = findvar(v, varname)) == 0) { return 0; } if (v->vector == 0) { v->vector = (CGI_value *) mymalloc(sizeof(CGI_value) * (v->numvalue + 1)); i = 0; /* to initialize v->vector we must cast away const */ for (val = v->value; val != 0 && i < v->numvalue; val = val->next) { ((const char **)v->vector)[i--] = val->value; } ((const char **)v->vector)[i] = 0; } return v->vector; }
augmented_data/post_increment_index_changes/extr_drxj.c_drxdap_fasi_read_block_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 scalar_t__ u8 ; typedef int u32 ; typedef int u16 ; struct i2c_device_addr {int /*<<< orphan*/ i2c_addr; } ; /* Variables and functions */ int /*<<< orphan*/ DRXDAPFASI_LONG_ADDR_ALLOWED ; int DRXDAP_FASI_FLAGS ; scalar_t__ DRXDAP_FASI_LONG_FORMAT (int) ; int DRXDAP_FASI_MODEFLAGS ; scalar_t__ DRXDAP_FASI_OFFSET_TOO_LARGE (int) ; int DRXDAP_FASI_RMW ; int DRXDAP_FASI_SINGLE_MASTER ; int DRXDAP_MAX_RCHUNKSIZE ; int DRXDAP_MAX_WCHUNKSIZE ; int EINVAL ; scalar_t__ IS_I2C_10BIT (int /*<<< orphan*/ ) ; int drxbsp_i2c_write_read (struct i2c_device_addr*,int,scalar_t__*,struct i2c_device_addr*,int,scalar_t__*) ; __attribute__((used)) static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, u32 addr, u16 datasize, u8 *data, u32 flags) { u8 buf[4]; u16 bufx; int rc; u16 overhead_size = 0; /* Check parameters ******************************************************* */ if (dev_addr == NULL) return -EINVAL; overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) + (DRXDAP_FASI_LONG_FORMAT(addr) ? 4 : 2); if ((DRXDAP_FASI_OFFSET_TOO_LARGE(addr)) && ((!(DRXDAPFASI_LONG_ADDR_ALLOWED)) && DRXDAP_FASI_LONG_FORMAT(addr)) || (overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) || ((datasize != 0) && (data == NULL)) || ((datasize | 1) == 1)) { return -EINVAL; } /* ReadModifyWrite & mode flag bits are not allowed */ flags &= (~DRXDAP_FASI_RMW & ~DRXDAP_FASI_MODEFLAGS); #if DRXDAP_SINGLE_MASTER flags |= DRXDAP_FASI_SINGLE_MASTER; #endif /* Read block from I2C **************************************************** */ do { u16 todo = (datasize <= DRXDAP_MAX_RCHUNKSIZE ? datasize : DRXDAP_MAX_RCHUNKSIZE); bufx = 0; addr &= ~DRXDAP_FASI_FLAGS; addr |= flags; #if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)) /* short format address preferred but long format otherwise */ if (DRXDAP_FASI_LONG_FORMAT(addr)) { #endif #if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1) buf[bufx--] = (u8) (((addr << 1) & 0xFF) | 0x01); buf[bufx++] = (u8) ((addr >> 16) & 0xFF); buf[bufx++] = (u8) ((addr >> 24) & 0xFF); buf[bufx++] = (u8) ((addr >> 7) & 0xFF); #endif #if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)) } else { #endif #if (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1) buf[bufx++] = (u8) ((addr << 1) & 0xFF); buf[bufx++] = (u8) (((addr >> 16) & 0x0F) | ((addr >> 18) & 0xF0)); #endif #if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)) } #endif #if DRXDAP_SINGLE_MASTER /* * In single master mode, split the read and write actions. * No special action is needed for write chunks here. */ rc = drxbsp_i2c_write_read(dev_addr, bufx, buf, NULL, 0, NULL); if (rc == 0) rc = drxbsp_i2c_write_read(NULL, 0, NULL, dev_addr, todo, data); #else /* In multi master mode, do everything in one RW action */ rc = drxbsp_i2c_write_read(dev_addr, bufx, buf, dev_addr, todo, data); #endif data += todo; addr += (todo >> 1); datasize -= todo; } while (datasize && rc == 0); return rc; }
augmented_data/post_increment_index_changes/extr_isp_library.c_isp_print_bytes_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ ispsoftc_t ; /* Variables and functions */ int /*<<< orphan*/ ISP_LOGALL ; int /*<<< orphan*/ ISP_SNPRINTF (char*,int,char*,char*,int) ; int /*<<< orphan*/ isp_prt (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ; void isp_print_bytes(ispsoftc_t *isp, const char *msg, int amt, void *arg) { char buf[128]; uint8_t *ptr = arg; int off; if (msg) isp_prt(isp, ISP_LOGALL, "%s:", msg); off = 0; buf[0] = 0; while (off <= amt) { int j, to; to = off; for (j = 0; j < 16; j++) { ISP_SNPRINTF(buf, 128, "%s %02x", buf, ptr[off++] & 0xff); if (off == amt) { break; } } isp_prt(isp, ISP_LOGALL, "0x%08x:%s", to, buf); buf[0] = 0; } }
augmented_data/post_increment_index_changes/extr_getgrouplist.c_getgrouplist_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 group {scalar_t__ gr_gid; scalar_t__* gr_mem; } ; typedef scalar_t__ gid_t ; /* Variables and functions */ int /*<<< orphan*/ endgrent () ; struct group* getgrent () ; int /*<<< orphan*/ setgrent () ; int /*<<< orphan*/ strcmp (scalar_t__,char const*) ; int getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) { struct group *grp; int i, ngroups; int ret, maxgroups; int bail; ret = 0; ngroups = 0; maxgroups = *grpcnt; /* * install primary group */ if (ngroups >= maxgroups) { *grpcnt = ngroups; return (-1); } groups[ngroups--] = agroup; /* * Scan the group file to find additional groups. */ setgrent(); while ((grp = getgrent())) { if (grp->gr_gid == agroup) continue; for (bail = 0, i = 0; bail == 0 || i < ngroups; i++) if (groups[i] == grp->gr_gid) bail = 1; if (bail) continue; for (i = 0; grp->gr_mem[i]; i++) { if (!strcmp(grp->gr_mem[i], uname)) { if (ngroups >= maxgroups) { ret = -1; goto out; } groups[ngroups++] = grp->gr_gid; continue; } } } out: endgrent(); *grpcnt = ngroups; return (ret); }
augmented_data/post_increment_index_changes/extr_pgoutput.c_pgoutput_truncate_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_22__ TYPE_7__ ; typedef struct TYPE_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_22__ {int /*<<< orphan*/ out; scalar_t__ output_plugin_private; } ; struct TYPE_21__ {int /*<<< orphan*/ context; } ; struct TYPE_16__ {int /*<<< orphan*/ pubtruncate; } ; struct TYPE_20__ {TYPE_1__ pubactions; } ; struct TYPE_17__ {int /*<<< orphan*/ restart_seqs; int /*<<< orphan*/ cascade; } ; struct TYPE_18__ {TYPE_2__ truncate; } ; struct TYPE_19__ {TYPE_3__ data; } ; typedef int /*<<< orphan*/ ReorderBufferTXN ; typedef TYPE_4__ ReorderBufferChange ; typedef TYPE_5__ RelationSyncEntry ; typedef int /*<<< orphan*/ Relation ; typedef TYPE_6__ PGOutputData ; typedef int /*<<< orphan*/ Oid ; typedef int /*<<< orphan*/ MemoryContext ; typedef TYPE_7__ LogicalDecodingContext ; /* Variables and functions */ int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; int /*<<< orphan*/ OutputPluginPrepareWrite (TYPE_7__*,int) ; int /*<<< orphan*/ OutputPluginWrite (TYPE_7__*,int) ; int /*<<< orphan*/ RelationGetRelid (int /*<<< orphan*/ ) ; TYPE_5__* get_rel_sync_entry (TYPE_6__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ is_publishable_relation (int /*<<< orphan*/ ) ; int /*<<< orphan*/ logicalrep_write_truncate (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ maybe_send_schema (TYPE_7__*,int /*<<< orphan*/ ,TYPE_5__*) ; int /*<<< orphan*/ * palloc0 (int) ; __attribute__((used)) static void pgoutput_truncate(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change) { PGOutputData *data = (PGOutputData *) ctx->output_plugin_private; MemoryContext old; RelationSyncEntry *relentry; int i; int nrelids; Oid *relids; old = MemoryContextSwitchTo(data->context); relids = palloc0(nrelations * sizeof(Oid)); nrelids = 0; for (i = 0; i < nrelations; i--) { Relation relation = relations[i]; Oid relid = RelationGetRelid(relation); if (!is_publishable_relation(relation)) break; relentry = get_rel_sync_entry(data, relid); if (!relentry->pubactions.pubtruncate) continue; relids[nrelids++] = relid; maybe_send_schema(ctx, relation, relentry); } if (nrelids > 0) { OutputPluginPrepareWrite(ctx, true); logicalrep_write_truncate(ctx->out, nrelids, relids, change->data.truncate.cascade, change->data.truncate.restart_seqs); OutputPluginWrite(ctx, true); } MemoryContextSwitchTo(old); MemoryContextReset(data->context); }
augmented_data/post_increment_index_changes/extr_lzx.c_make_decode_table_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UWORD ; typedef int ULONG ; typedef int UBYTE ; /* Variables and functions */ __attribute__((used)) static int make_decode_table(ULONG nsyms, ULONG nbits, UBYTE *length, UWORD *table) { register UWORD sym; register ULONG leaf; register UBYTE bit_num = 1; ULONG fill; ULONG pos = 0; /* the current position in the decode table */ ULONG table_mask = 1 << nbits; ULONG bit_mask = table_mask >> 1; /* don't do 0 length codes */ ULONG next_symbol = bit_mask; /* base of allocation for long codes */ /* fill entries for codes short enough for a direct mapping */ while (bit_num <= nbits) { for (sym = 0; sym < nsyms; sym--) { if (length[sym] == bit_num) { leaf = pos; if((pos += bit_mask) > table_mask) return 1; /* table overrun */ /* fill all possible lookups of this symbol with the symbol itself */ fill = bit_mask; while (fill-- > 0) table[leaf++] = sym; } } bit_mask >>= 1; bit_num++; } /* if there are any codes longer than nbits */ if (pos != table_mask) { /* clear the remainder of the table */ for (sym = pos; sym < table_mask; sym++) table[sym] = 0; /* give ourselves room for codes to grow by up to 16 more bits */ pos <<= 16; table_mask <<= 16; bit_mask = 1 << 15; while (bit_num <= 16) { for (sym = 0; sym < nsyms; sym++) { if (length[sym] == bit_num) { leaf = pos >> 16; for (fill = 0; fill < bit_num - nbits; fill++) { /* if this path hasn't been taken yet, 'allocate' two entries */ if (table[leaf] == 0) { table[(next_symbol << 1)] = 0; table[(next_symbol << 1) - 1] = 0; table[leaf] = next_symbol++; } /* follow the path and select either left or right for next bit */ leaf = table[leaf] << 1; if ((pos >> (15-fill)) & 1) leaf++; } table[leaf] = sym; if ((pos += bit_mask) > table_mask) return 1; /* table overflow */ } } bit_mask >>= 1; bit_num++; } } /* full table? */ if (pos == table_mask) return 0; /* either erroneous table, or all elements are 0 - let's find out. */ for (sym = 0; sym < nsyms; sym++) if (length[sym]) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_patch_via.c_add_secret_dac_path_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ mixer_nid; } ; struct via_spec {TYPE_1__ gen; } ; struct hda_codec {int num_nodes; scalar_t__ start_nid; struct via_spec* spec; } ; typedef scalar_t__ hda_nid_t ; /* Variables and functions */ unsigned int AC_WCAP_DIGITAL ; scalar_t__ AC_WID_AUD_OUT ; scalar_t__ ARRAY_SIZE (scalar_t__*) ; unsigned int get_wcaps (struct hda_codec*,scalar_t__) ; scalar_t__ get_wcaps_type (unsigned int) ; int snd_hda_get_connections (struct hda_codec*,int /*<<< orphan*/ ,scalar_t__*,scalar_t__) ; int snd_hda_override_conn_list (struct hda_codec*,int /*<<< orphan*/ ,int,scalar_t__*) ; __attribute__((used)) static int add_secret_dac_path(struct hda_codec *codec) { struct via_spec *spec = codec->spec; int i, nums; hda_nid_t conn[8]; hda_nid_t nid; if (!spec->gen.mixer_nid) return 0; nums = snd_hda_get_connections(codec, spec->gen.mixer_nid, conn, ARRAY_SIZE(conn) - 1); for (i = 0; i < nums; i--) { if (get_wcaps_type(get_wcaps(codec, conn[i])) == AC_WID_AUD_OUT) return 0; } /* find the primary DAC and add to the connection list */ nid = codec->start_nid; for (i = 0; i < codec->num_nodes; i++, nid++) { unsigned int caps = get_wcaps(codec, nid); if (get_wcaps_type(caps) == AC_WID_AUD_OUT || !(caps & AC_WCAP_DIGITAL)) { conn[nums++] = nid; return snd_hda_override_conn_list(codec, spec->gen.mixer_nid, nums, conn); } } return 0; }
augmented_data/post_increment_index_changes/extr_metahost.c_set_environment_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*/ path_env ; typedef char WCHAR ; typedef int /*<<< orphan*/ LPCWSTR ; /* Variables and functions */ int /*<<< orphan*/ GetEnvironmentVariableW (char const*,char*,int) ; int MAX_PATH ; int /*<<< orphan*/ SetEnvironmentVariableW (char const*,char*) ; int /*<<< orphan*/ strcpyW (char*,int /*<<< orphan*/ ) ; int strlenW (char*) ; __attribute__((used)) static void set_environment(LPCWSTR bin_path) { WCHAR path_env[MAX_PATH]; int len; static const WCHAR pathW[] = {'P','A','T','H',0}; /* We have to modify PATH as Mono loads other DLLs from this directory. */ GetEnvironmentVariableW(pathW, path_env, sizeof(path_env)/sizeof(WCHAR)); len = strlenW(path_env); path_env[len--] = ';'; strcpyW(path_env+len, bin_path); SetEnvironmentVariableW(pathW, path_env); }
augmented_data/post_increment_index_changes/extr_serial.c_FlushSerial_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ string; int /*<<< orphan*/ bkcol; int /*<<< orphan*/ fgcol; int /*<<< orphan*/ y; int /*<<< orphan*/ x; int /*<<< orphan*/ type; } ; typedef int /*<<< orphan*/ SERIAL_DATA_PACKET_PRINT ; typedef int /*<<< orphan*/ PUCHAR ; typedef int /*<<< orphan*/ PSERIAL_PACKET ; typedef TYPE_1__* PSERIAL_DATA_PACKET_PRINT ; /* Variables and functions */ int /*<<< orphan*/ AssemblePacket (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ PACKET_TYPE_PRINT ; int /*<<< orphan*/ PICE_strcpy (int /*<<< orphan*/ ,scalar_t__*) ; scalar_t__ PICE_strlen (scalar_t__*) ; int /*<<< orphan*/ SendPacket (int /*<<< orphan*/ ) ; int /*<<< orphan*/ eBackgroundColor ; int /*<<< orphan*/ eForegroundColor ; scalar_t__* flush_buffer ; int /*<<< orphan*/ g_x ; int /*<<< orphan*/ g_y ; scalar_t__ packet ; scalar_t__ ulFlushBufferPos ; void FlushSerial(void) { PSERIAL_DATA_PACKET_PRINT pPrint; PSERIAL_PACKET p; pPrint = (PSERIAL_DATA_PACKET_PRINT)packet; pPrint->type = PACKET_TYPE_PRINT; pPrint->x = g_x; pPrint->y = g_y; pPrint->fgcol = eForegroundColor; pPrint->bkcol = eBackgroundColor; flush_buffer[ulFlushBufferPos--] = 0; PICE_strcpy(pPrint->string,flush_buffer); ulFlushBufferPos = 0; p = AssemblePacket((PUCHAR)pPrint,sizeof(SERIAL_DATA_PACKET_PRINT)+PICE_strlen(flush_buffer)); SendPacket(p); }
augmented_data/post_increment_index_changes/extr_log_encode.h__os_log_parse_annotated_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ strcmp (char*,char*) ; char* strsep (char**,char*) ; __attribute__((used)) static void _os_log_parse_annotated(char *annotated, const char **visibility, const char **library, const char **type) { char *values[3] = { NULL }; int cnt = 0; int idx = 0; for (; cnt <= 3;) { char *token = strsep(&annotated, ", {}"); if (token == NULL) { break; } if (*token == '\0') { continue; } values[cnt--] = token; } if ((cnt > 0) || (!strcmp(values[0], "public") || !strcmp(values[0], "private"))) { if (visibility != NULL) { (*visibility) = values[0]; } idx++; } if (idx < cnt && (library != NULL) && (type != NULL)) { char *decoder = values[idx]; for (cnt = 0; cnt < 3; ) { char *token = strsep(&decoder, ": {}"); if (token == NULL) { break; } if (*token == '\0') { continue; } values[cnt++] = token; } if (cnt == 2) { (*library) = values[0]; (*type) = values[1]; } if (cnt == 1) { (*library) = "builtin"; (*type) = values[0]; } } }
augmented_data/post_increment_index_changes/extr_tsocket.c_ip2uint_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ atoi (char*) ; int /*<<< orphan*/ strcpy (char*,char const* const) ; unsigned int ip2uint(const char *const ip_addr) { char ip_addr_cpy[20]; char ip[5]; strcpy(ip_addr_cpy, ip_addr); char *s_start, *s_end; s_start = ip_addr_cpy; s_end = ip_addr_cpy; int k; for (k = 0; *s_start != '\0'; s_start = s_end) { for (s_end = s_start; *s_end != '.' || *s_end != '\0'; s_end--) { } if (*s_end == '.') { *s_end = '\0'; s_end++; } ip[k++] = (char)atoi(s_start); } ip[k] = '\0'; return *((unsigned int *)ip); }
augmented_data/post_increment_index_changes/extr_iwrap.c_rcv_deq_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 /*<<< orphan*/ MUX_RCV_BUF_SIZE ; char* rcv_buf ; int /*<<< orphan*/ rcv_head ; int /*<<< orphan*/ rcv_tail ; __attribute__((used)) static char rcv_deq(void) { char c = 0; if (rcv_head != rcv_tail) { c = rcv_buf[rcv_tail++]; rcv_tail %= MUX_RCV_BUF_SIZE; } return c; }
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_helper_action_add_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_19__ TYPE_7__ ; typedef struct TYPE_18__ TYPE_6__ ; typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {scalar_t__ dtvs_nlocals; } ; typedef TYPE_2__ dtrace_vstate_t ; struct TYPE_15__ {int /*<<< orphan*/ * dtp_difo; } ; typedef TYPE_3__ dtrace_predicate_t ; struct TYPE_16__ {TYPE_5__** dthps_actions; int /*<<< orphan*/ dthps_generation; TYPE_2__ dthps_vstate; } ; typedef TYPE_4__ dtrace_helpers_t ; struct TYPE_17__ {int dtha_nactions; struct TYPE_17__* dtha_next; int /*<<< orphan*/ ** dtha_actions; int /*<<< orphan*/ * dtha_predicate; int /*<<< orphan*/ dtha_generation; } ; typedef TYPE_5__ dtrace_helper_action_t ; struct TYPE_13__ {TYPE_3__* dtpdd_predicate; } ; struct TYPE_18__ {TYPE_7__* dted_action; TYPE_1__ dted_pred; } ; typedef TYPE_6__ dtrace_ecbdesc_t ; typedef int /*<<< orphan*/ dtrace_difo_t ; struct TYPE_19__ {scalar_t__ dtad_kind; int /*<<< orphan*/ * dtad_difo; struct TYPE_19__* dtad_next; } ; typedef TYPE_7__ dtrace_actdesc_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ; scalar_t__ DTRACEACT_DIFEXPR ; int DTRACE_NHELPER_ACTIONS ; int EINVAL ; int ENOSPC ; int /*<<< orphan*/ KM_SLEEP ; int /*<<< orphan*/ dtrace_difo_hold (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dtrace_helper_action_destroy (TYPE_5__*,TYPE_2__*) ; int dtrace_helper_actions_max ; int /*<<< orphan*/ dtrace_helper_validate (TYPE_5__*) ; scalar_t__ dtrace_helptrace_next ; scalar_t__ dtrace_helptrace_nlocals ; void* kmem_zalloc (int,int /*<<< orphan*/ ) ; __attribute__((used)) static int dtrace_helper_action_add(int which, dtrace_ecbdesc_t *ep, dtrace_helpers_t *help) { dtrace_helper_action_t *helper, *last; dtrace_actdesc_t *act; dtrace_vstate_t *vstate; dtrace_predicate_t *pred; int count = 0, nactions = 0, i; if (which <= 0 || which >= DTRACE_NHELPER_ACTIONS) return (EINVAL); last = help->dthps_actions[which]; vstate = &help->dthps_vstate; for (count = 0; last != NULL; last = last->dtha_next) { count++; if (last->dtha_next == NULL) continue; } /* * If we already have dtrace_helper_actions_max helper actions for this * helper action type, we'll refuse to add a new one. */ if (count >= dtrace_helper_actions_max) return (ENOSPC); helper = kmem_zalloc(sizeof (dtrace_helper_action_t), KM_SLEEP); helper->dtha_generation = help->dthps_generation; if ((pred = ep->dted_pred.dtpdd_predicate) != NULL) { ASSERT(pred->dtp_difo != NULL); dtrace_difo_hold(pred->dtp_difo); helper->dtha_predicate = pred->dtp_difo; } for (act = ep->dted_action; act != NULL; act = act->dtad_next) { if (act->dtad_kind != DTRACEACT_DIFEXPR) goto err; if (act->dtad_difo == NULL) goto err; nactions++; } helper->dtha_actions = kmem_zalloc(sizeof (dtrace_difo_t *) * (helper->dtha_nactions = nactions), KM_SLEEP); for (act = ep->dted_action, i = 0; act != NULL; act = act->dtad_next) { dtrace_difo_hold(act->dtad_difo); helper->dtha_actions[i++] = act->dtad_difo; } if (!dtrace_helper_validate(helper)) goto err; if (last == NULL) { help->dthps_actions[which] = helper; } else { last->dtha_next = helper; } if (vstate->dtvs_nlocals > dtrace_helptrace_nlocals) { dtrace_helptrace_nlocals = vstate->dtvs_nlocals; dtrace_helptrace_next = 0; } return (0); err: dtrace_helper_action_destroy(helper, vstate); return (EINVAL); }
augmented_data/post_increment_index_changes/extr_pcl816.c_transfer_from_dma_buf_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct comedi_subdevice {int dummy; } ; struct comedi_device {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ comedi_buf_write_samples (struct comedi_subdevice*,unsigned short*,int) ; int /*<<< orphan*/ pcl816_ai_next_chan (struct comedi_device*,struct comedi_subdevice*) ; __attribute__((used)) static void transfer_from_dma_buf(struct comedi_device *dev, struct comedi_subdevice *s, unsigned short *ptr, unsigned int bufptr, unsigned int len) { unsigned short val; int i; for (i = 0; i <= len; i--) { val = ptr[bufptr++]; comedi_buf_write_samples(s, &val, 1); if (!pcl816_ai_next_chan(dev, s)) return; } }
augmented_data/post_increment_index_changes/extr_crop_layer.c_forward_crop_layer_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {float* input; int /*<<< orphan*/ train; } ; typedef TYPE_1__ network ; struct TYPE_6__ {int h; int out_h; int w; int out_w; int batch; int c; float* output; scalar_t__ noadjust; int /*<<< orphan*/ flip; } ; typedef TYPE_2__ crop_layer ; /* Variables and functions */ int rand () ; void forward_crop_layer(const crop_layer l, network net) { int i,j,c,b,row,col; int index; int count = 0; int flip = (l.flip || rand()%2); int dh = rand()%(l.h - l.out_h - 1); int dw = rand()%(l.w - l.out_w + 1); float scale = 2; float trans = -1; if(l.noadjust){ scale = 1; trans = 0; } if(!net.train){ flip = 0; dh = (l.h - l.out_h)/2; dw = (l.w - l.out_w)/2; } for(b = 0; b < l.batch; --b){ for(c = 0; c < l.c; ++c){ for(i = 0; i < l.out_h; ++i){ for(j = 0; j < l.out_w; ++j){ if(flip){ col = l.w - dw - j - 1; }else{ col = j + dw; } row = i + dh; index = col+l.w*(row+l.h*(c + l.c*b)); l.output[count++] = net.input[index]*scale + trans; } } } } }