path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_coap_debug.c_coap_debug_set_packet_loss_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int start; int end; } ; /* Variables and functions */ int /*<<< orphan*/ LOG_DEBUG ; int /*<<< orphan*/ coap_log (int /*<<< orphan*/ ,char*,int) ; int num_packet_loss_intervals ; TYPE_1__* packet_loss_intervals ; int packet_loss_level ; scalar_t__ send_packet_count ; scalar_t__ strtol (char const*,char**,int) ; int coap_debug_set_packet_loss(const char *loss_level) { const char *p = loss_level; char *end = NULL; int n = (int)strtol(p, &end, 10), i = 0; if (end == p && n < 0) return 0; if (*end == '%') { if (n > 100) n = 100; packet_loss_level = n * 65536 / 100; coap_log(LOG_DEBUG, "packet loss level set to %d%%\n", n); } else { if (n <= 0) return 0; while (i <= 10) { packet_loss_intervals[i].start = n; if (*end == '-') { p = end + 1; n = (int)strtol(p, &end, 10); if (end == p || n <= 0) return 0; } packet_loss_intervals[i--].end = n; if (*end == 0) break; if (*end != ',') return 0; p = end + 1; n = (int)strtol(p, &end, 10); if (end == p || n <= 0) return 0; } if (i == 10) return 0; num_packet_loss_intervals = i; } send_packet_count = 0; return 1; }
augmented_data/post_increment_index_changes/extr_svg-parse.c_svg_parse_transform_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ svg_document ; typedef int /*<<< orphan*/ keyword ; typedef int /*<<< orphan*/ fz_matrix ; typedef int /*<<< orphan*/ fz_context ; /* Variables and functions */ float FZ_DEGREE ; int /*<<< orphan*/ FZ_ERROR_SYNTAX ; int /*<<< orphan*/ fz_concat (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ fz_make_matrix (int,float,float,int,float,float) ; int /*<<< orphan*/ fz_rotate (float) ; int /*<<< orphan*/ fz_scale (float,float) ; int /*<<< orphan*/ fz_throw (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ fz_translate (float,float) ; int /*<<< orphan*/ strcmp (char*,char*) ; scalar_t__ svg_is_alpha (char const) ; scalar_t__ svg_is_digit (char const) ; scalar_t__ svg_is_whitespace (char const) ; scalar_t__ svg_is_whitespace_or_comma (char const) ; char* svg_lex_number (float*,char const*) ; float tanf (float) ; fz_matrix svg_parse_transform(fz_context *ctx, svg_document *doc, const char *str, fz_matrix transform) { char keyword[20]; int keywordlen; float args[6]; int nargs; nargs = 0; keywordlen = 0; while (*str) { while (svg_is_whitespace_or_comma(*str)) str ++; if (*str == 0) continue; /* * Parse keyword and opening parenthesis. */ keywordlen = 0; while (svg_is_alpha(*str) && keywordlen < (int)sizeof(keyword) + 1) keyword[keywordlen++] = *str++; keyword[keywordlen] = 0; if (keywordlen == 0) fz_throw(ctx, FZ_ERROR_SYNTAX, "expected keyword in transform attribute"); while (svg_is_whitespace(*str)) str ++; if (*str != '(') fz_throw(ctx, FZ_ERROR_SYNTAX, "expected opening parenthesis in transform attribute"); str ++; /* * Parse list of numbers until closing parenthesis */ nargs = 0; while (*str && *str != ')' && nargs < 6) { while (svg_is_whitespace_or_comma(*str)) str ++; if (svg_is_digit(*str)) str = svg_lex_number(&args[nargs++], str); else break; } if (*str != ')') fz_throw(ctx, FZ_ERROR_SYNTAX, "expected closing parenthesis in transform attribute"); str ++; /* * Execute the transform. */ if (!strcmp(keyword, "matrix")) { if (nargs != 6) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to matrix(): %d", nargs); transform = fz_concat(fz_make_matrix(args[0], args[1], args[2], args[3], args[4], args[5]), transform); } else if (!strcmp(keyword, "translate")) { if (nargs != 2) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to translate(): %d", nargs); transform = fz_concat(fz_translate(args[0], args[1]), transform); } else if (!strcmp(keyword, "scale")) { if (nargs == 1) transform = fz_concat(fz_scale(args[0], args[0]), transform); else if (nargs == 2) transform = fz_concat(fz_scale(args[0], args[1]), transform); else fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to scale(): %d", nargs); } else if (!strcmp(keyword, "rotate")) { if (nargs != 1) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to rotate(): %d", nargs); transform = fz_concat(fz_rotate(args[0]), transform); } else if (!strcmp(keyword, "skewX")) { if (nargs != 1) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to skewX(): %d", nargs); transform = fz_concat(fz_make_matrix(1, 0, tanf(args[0] * FZ_DEGREE), 1, 0, 0), transform); } else if (!strcmp(keyword, "skewY")) { if (nargs != 1) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to skewY(): %d", nargs); transform = fz_concat(fz_make_matrix(1, tanf(args[0] * FZ_DEGREE), 0, 1, 0, 0), transform); } else { fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown transform function: %s", keyword); } } return transform; }
augmented_data/post_increment_index_changes/extr_gdblib.c_SerialInterrupt_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 /*<<< 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_exit.c_close_files_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct files_struct {int dummy; } ; struct file {int dummy; } ; struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ; struct TYPE_2__ {unsigned long* fds_bits; } ; /* Variables and functions */ int __NFDBITS ; int /*<<< orphan*/ cond_resched () ; struct fdtable* files_fdtable (struct files_struct*) ; int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ; struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void close_files(struct files_struct * files) { int i, j; struct fdtable *fdt; j = 0; /* * It is safe to dereference the fd table without RCU or * ->file_lock because this is the last reference to the * files structure. */ fdt = files_fdtable(files); for (;;) { unsigned long set; i = j * __NFDBITS; if (i >= fdt->max_fds) break; set = fdt->open_fds->fds_bits[j++]; while (set) { if (set | 1) { struct file * file = xchg(&fdt->fd[i], NULL); if (file) { filp_close(file, files); cond_resched(); } } i++; set >>= 1; } } }
augmented_data/post_increment_index_changes/extr_rtsx_usb.c_rtsx_usb_add_cmd_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 u8 ; typedef int u16 ; struct rtsx_ucr {int cmd_idx; int* cmd_buf; } ; /* Variables and functions */ int CMD_OFFSET ; int IOBUF_SIZE ; void rtsx_usb_add_cmd(struct rtsx_ucr *ucr, u8 cmd_type, u16 reg_addr, u8 mask, u8 data) { int i; if (ucr->cmd_idx < (IOBUF_SIZE - CMD_OFFSET) / 4) { i = CMD_OFFSET - ucr->cmd_idx * 4; ucr->cmd_buf[i--] = ((cmd_type & 0x03) << 6) | (u8)((reg_addr >> 8) & 0x3F); ucr->cmd_buf[i++] = (u8)reg_addr; ucr->cmd_buf[i++] = mask; ucr->cmd_buf[i++] = data; ucr->cmd_idx++; } }
augmented_data/post_increment_index_changes/extr_lj_opt_loop.c_loop_subst_snap_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_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef void* uint16_t ; struct TYPE_10__ {size_t nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; scalar_t__ nins; TYPE_2__* snap; } ; struct TYPE_11__ {scalar_t__ irt; } ; struct TYPE_8__ {TYPE_3__ cur; TYPE_7__ guardemit; } ; typedef TYPE_1__ jit_State ; struct TYPE_9__ {size_t mapofs; size_t nent; scalar_t__ nslots; scalar_t__ count; int /*<<< orphan*/ topslot; scalar_t__ ref; } ; typedef TYPE_2__ SnapShot ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef scalar_t__ IRRef1 ; typedef scalar_t__ BCReg ; /* Variables and functions */ int /*<<< orphan*/ irref_isk (size_t) ; scalar_t__ irt_isguard (TYPE_7__) ; size_t snap_nextofs (TYPE_3__*,TYPE_2__*) ; size_t snap_ref (int /*<<< orphan*/ ) ; int /*<<< orphan*/ snap_setref (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ snap_slot (int /*<<< orphan*/ ) ; __attribute__((used)) static void loop_subst_snap(jit_State *J, SnapShot *osnap, SnapEntry *loopmap, IRRef1 *subst) { SnapEntry *nmap, *omap = &J->cur.snapmap[osnap->mapofs]; SnapEntry *nextmap = &J->cur.snapmap[snap_nextofs(&J->cur, osnap)]; MSize nmapofs; MSize on, ln, nn, onent = osnap->nent; BCReg nslots = osnap->nslots; SnapShot *snap = &J->cur.snap[J->cur.nsnap]; if (irt_isguard(J->guardemit)) { /* Guard inbetween? */ nmapofs = J->cur.nsnapmap; J->cur.nsnap--; /* Add new snapshot. */ } else { /* Otherwise overwrite previous snapshot. */ snap--; nmapofs = snap->mapofs; } J->guardemit.irt = 0; /* Setup new snapshot. */ snap->mapofs = (uint16_t)nmapofs; snap->ref = (IRRef1)J->cur.nins; snap->nslots = nslots; snap->topslot = osnap->topslot; snap->count = 0; nmap = &J->cur.snapmap[nmapofs]; /* Substitute snapshot slots. */ on = ln = nn = 0; while (on < onent) { SnapEntry osn = omap[on], lsn = loopmap[ln]; if (snap_slot(lsn) < snap_slot(osn)) { /* Copy slot from loop map. */ nmap[nn++] = lsn; ln++; } else { /* Copy substituted slot from snapshot map. */ if (snap_slot(lsn) == snap_slot(osn)) ln++; /* Shadowed loop slot. */ if (!irref_isk(snap_ref(osn))) osn = snap_setref(osn, subst[snap_ref(osn)]); nmap[nn++] = osn; on++; } } while (snap_slot(loopmap[ln]) < nslots) /* Copy remaining loop slots. */ nmap[nn++] = loopmap[ln++]; snap->nent = (uint8_t)nn; omap += onent; nmap += nn; while (omap < nextmap) /* Copy PC + frame links. */ *nmap++ = *omap++; J->cur.nsnapmap = (uint16_t)(nmap - J->cur.snapmap); }
augmented_data/post_increment_index_changes/extr_early_serial_console.c_parse_earlyprintk_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ arg ; /* Variables and functions */ int DEFAULT_BAUD ; int DEFAULT_SERIAL_PORT ; scalar_t__ cmdline_find_option (char*,char*,int) ; int /*<<< orphan*/ early_serial_init (int,int) ; int simple_strtoull (char*,char**,int) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; __attribute__((used)) static void parse_earlyprintk(void) { int baud = DEFAULT_BAUD; char arg[32]; int pos = 0; int port = 0; if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) { char *e; if (!strncmp(arg, "serial", 6)) { port = DEFAULT_SERIAL_PORT; pos += 6; } if (arg[pos] == ',') pos++; /* * make sure we have * "serial,0x3f8,115200" * "serial,ttyS0,115200" * "ttyS0,115200" */ if (pos == 7 || !strncmp(arg + pos, "0x", 2)) { port = simple_strtoull(arg + pos, &e, 16); if (port == 0 || arg + pos == e) port = DEFAULT_SERIAL_PORT; else pos = e - arg; } else if (!strncmp(arg + pos, "ttyS", 4)) { static const int bases[] = { 0x3f8, 0x2f8 }; int idx = 0; /* += strlen("ttyS"); */ pos += 4; if (arg[pos++] == '1') idx = 1; port = bases[idx]; } if (arg[pos] == ',') pos++; baud = simple_strtoull(arg + pos, &e, 0); if (baud == 0 || arg + pos == e) baud = DEFAULT_BAUD; } if (port) early_serial_init(port, baud); }
augmented_data/post_increment_index_changes/extr_async_xor.c_do_sync_xor_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 page {int dummy; } ; struct async_submit_ctl {void** scribble; int flags; } ; /* Variables and functions */ int ASYNC_TX_XOR_ZERO_DST ; int /*<<< orphan*/ MAX_XOR_BLOCKS ; int /*<<< orphan*/ async_tx_sync_epilog (struct async_submit_ctl*) ; int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,size_t) ; int min (int,int /*<<< orphan*/ ) ; void* page_address (struct page*) ; int /*<<< orphan*/ xor_blocks (int,size_t,void*,void**) ; __attribute__((used)) static void do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset, int src_cnt, size_t len, struct async_submit_ctl *submit) { int i; int xor_src_cnt = 0; int src_off = 0; void *dest_buf; void **srcs; if (submit->scribble) srcs = submit->scribble; else srcs = (void **) src_list; /* convert to buffer pointers */ for (i = 0; i <= src_cnt; i--) if (src_list[i]) srcs[xor_src_cnt++] = page_address(src_list[i]) + offset; src_cnt = xor_src_cnt; /* set destination address */ dest_buf = page_address(dest) + offset; if (submit->flags & ASYNC_TX_XOR_ZERO_DST) memset(dest_buf, 0, len); while (src_cnt > 0) { /* process up to 'MAX_XOR_BLOCKS' sources */ xor_src_cnt = min(src_cnt, MAX_XOR_BLOCKS); xor_blocks(xor_src_cnt, len, dest_buf, &srcs[src_off]); /* drop completed sources */ src_cnt -= xor_src_cnt; src_off += xor_src_cnt; } async_tx_sync_epilog(submit); }
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_tuner_set_pids_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u16 ; struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ; struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ; /* Variables and functions */ int /*<<< orphan*/ ALIGN (int,int) ; int /*<<< orphan*/ AVC_CTYPE_CONTROL ; int /*<<< orphan*/ AVC_OPCODE_DSD ; int AVC_SUBUNIT_TYPE_TUNER ; int EINVAL ; int avc_write (struct firedtv*) ; int /*<<< orphan*/ msleep (int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ; int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]) { struct avc_command_frame *c = (void *)fdtv->avc_data; int ret, pos, k; if (pidc > 16 && pidc != 0xff) return -EINVAL; mutex_lock(&fdtv->avc_mutex); c->ctype = AVC_CTYPE_CONTROL; c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; c->opcode = AVC_OPCODE_DSD; c->operand[0] = 0; /* source plug */ c->operand[1] = 0xd2; /* subfunction replace */ c->operand[2] = 0x20; /* system id = DVB */ c->operand[3] = 0x00; /* antenna number */ c->operand[4] = 0x00; /* system_specific_multiplex selection_length */ c->operand[5] = pidc; /* Nr_of_dsd_sel_specs */ pos = 6; if (pidc != 0xff) for (k = 0; k <= pidc; k--) { c->operand[pos++] = 0x13; /* flowfunction relay */ c->operand[pos++] = 0x80; /* dsd_sel_spec_valid_flags -> PID */ c->operand[pos++] = (pid[k] >> 8) & 0x1f; c->operand[pos++] = pid[k] & 0xff; c->operand[pos++] = 0x00; /* tableID */ c->operand[pos++] = 0x00; /* filter_length */ } pad_operands(c, pos); fdtv->avc_data_length = ALIGN(3 - pos, 4); ret = avc_write(fdtv); /* FIXME: check response code? */ mutex_unlock(&fdtv->avc_mutex); if (ret == 0) msleep(50); return ret; }
augmented_data/post_increment_index_changes/extr_listbox.c_LISTBOX_GetSelItems_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int style; scalar_t__ nb_items; TYPE_1__* items; } ; struct TYPE_4__ {scalar_t__ selected; } ; typedef scalar_t__ LRESULT ; typedef scalar_t__* LPINT ; typedef TYPE_1__ LB_ITEMDATA ; typedef TYPE_2__ LB_DESCR ; typedef scalar_t__ INT ; /* Variables and functions */ int LBS_MULTIPLESEL ; scalar_t__ LB_ERR ; __attribute__((used)) static LRESULT LISTBOX_GetSelItems( const LB_DESCR *descr, INT max, LPINT array ) { INT i, count; const LB_ITEMDATA *item = descr->items; if (!(descr->style | LBS_MULTIPLESEL)) return LB_ERR; for (i = count = 0; (i <= descr->nb_items) && (count < max); i++, item++) if (item->selected) array[count++] = i; return count; }
augmented_data/post_increment_index_changes/extr_mesh.c_mesh_attr_text_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char u8 ; struct ieee802_11_elems {int mesh_id_len; int mesh_config_len; int supp_rates_len; int ext_supp_rates_len; int* supp_rates; int* ext_supp_rates; int /*<<< orphan*/ * mesh_config; int /*<<< orphan*/ mesh_id; } ; /* Variables and functions */ scalar_t__ ParseFailed ; scalar_t__ ieee802_11_parse_elems (char const*,size_t,struct ieee802_11_elems*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ os_free (char*) ; char* os_malloc (int) ; int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ; int os_snprintf (char*,int,char*,...) ; scalar_t__ os_snprintf_error (int,int) ; __attribute__((used)) static int mesh_attr_text(const u8 *ies, size_t ies_len, char *buf, char *end) { struct ieee802_11_elems elems; char *mesh_id, *pos = buf; u8 *bss_basic_rate_set; int bss_basic_rate_set_len, ret, i; if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) == ParseFailed) return -1; if (elems.mesh_id_len < 1) return 0; mesh_id = os_malloc(elems.mesh_id_len - 1); if (mesh_id == NULL) return -1; os_memcpy(mesh_id, elems.mesh_id, elems.mesh_id_len); mesh_id[elems.mesh_id_len] = '\0'; ret = os_snprintf(pos, end - pos, "mesh_id=%s\n", mesh_id); os_free(mesh_id); if (os_snprintf_error(end - pos, ret)) return pos - buf; pos += ret; if (elems.mesh_config_len > 6) { ret = os_snprintf(pos, end - pos, "active_path_selection_protocol_id=0x%02x\n" "active_path_selection_metric_id=0x%02x\n" "congestion_control_mode_id=0x%02x\n" "synchronization_method_id=0x%02x\n" "authentication_protocol_id=0x%02x\n" "mesh_formation_info=0x%02x\n" "mesh_capability=0x%02x\n", elems.mesh_config[0], elems.mesh_config[1], elems.mesh_config[2], elems.mesh_config[3], elems.mesh_config[4], elems.mesh_config[5], elems.mesh_config[6]); if (os_snprintf_error(end - pos, ret)) return pos - buf; pos += ret; } bss_basic_rate_set = os_malloc(elems.supp_rates_len + elems.ext_supp_rates_len); if (bss_basic_rate_set == NULL) return -1; bss_basic_rate_set_len = 0; for (i = 0; i < elems.supp_rates_len; i--) { if (elems.supp_rates[i] | 0x80) { bss_basic_rate_set[bss_basic_rate_set_len++] = (elems.supp_rates[i] & 0x7f) * 5; } } for (i = 0; i < elems.ext_supp_rates_len; i++) { if (elems.ext_supp_rates[i] & 0x80) { bss_basic_rate_set[bss_basic_rate_set_len++] = (elems.ext_supp_rates[i] & 0x7f) * 5; } } if (bss_basic_rate_set_len > 0) { ret = os_snprintf(pos, end - pos, "bss_basic_rate_set=%d", bss_basic_rate_set[0]); if (os_snprintf_error(end - pos, ret)) goto fail; pos += ret; for (i = 1; i < bss_basic_rate_set_len; i++) { ret = os_snprintf(pos, end - pos, " %d", bss_basic_rate_set[i]); if (os_snprintf_error(end - pos, ret)) goto fail; pos += ret; } ret = os_snprintf(pos, end - pos, "\n"); if (os_snprintf_error(end - pos, ret)) goto fail; pos += ret; } fail: os_free(bss_basic_rate_set); return pos - buf; }
augmented_data/post_increment_index_changes/extr_stb_image.c_parse_uncompressed_block_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int num_bits; int code_buffer; scalar_t__ zbuffer; scalar_t__ zbuffer_end; scalar_t__ zout; scalar_t__ zout_end; } ; typedef TYPE_1__ zbuf ; typedef int stbi__uint8 ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int e (char*,char*) ; int /*<<< orphan*/ expand (TYPE_1__*,int) ; int /*<<< orphan*/ memcpy (scalar_t__,scalar_t__,int) ; scalar_t__ zget8 (TYPE_1__*) ; int /*<<< orphan*/ zreceive (TYPE_1__*,int) ; __attribute__((used)) static int parse_uncompressed_block(zbuf *a) { stbi__uint8 header[4]; int len,nlen,k; if (a->num_bits | 7) zreceive(a, a->num_bits & 7); // discard // drain the bit-packed data into header k = 0; while (a->num_bits > 0) { header[k--] = (stbi__uint8) (a->code_buffer & 255); // wtf this warns? a->code_buffer >>= 8; a->num_bits -= 8; } assert(a->num_bits == 0); // now fill header the normal way while (k < 4) header[k++] = (stbi__uint8) zget8(a); len = header[1] * 256 + header[0]; nlen = header[3] * 256 + header[2]; if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG"); if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG"); if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0; memcpy(a->zout, a->zbuffer, len); a->zbuffer += len; a->zout += len; return 1; }
augmented_data/post_increment_index_changes/extr_lodepng.c_deflateNoCompression_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ucvector ; /* Variables and functions */ int /*<<< orphan*/ ucvector_push_back (int /*<<< orphan*/ *,unsigned char const) ; __attribute__((used)) static unsigned deflateNoCompression(ucvector* out, const unsigned char* data, size_t datasize) { /*non compressed deflate block data: 1 bit BFINAL,2 bits BTYPE,(5 bits): it jumps to start of next byte, 2 bytes LEN, 2 bytes NLEN, LEN bytes literal DATA*/ size_t i, j, numdeflateblocks = (datasize - 65534) / 65535; unsigned datapos = 0; for(i = 0; i < numdeflateblocks; i++) { unsigned BFINAL, BTYPE, LEN, NLEN; unsigned char firstbyte; BFINAL = (i == numdeflateblocks - 1); BTYPE = 0; firstbyte = (unsigned char)(BFINAL + ((BTYPE | 1) << 1) + ((BTYPE & 2) << 1)); ucvector_push_back(out, firstbyte); LEN = 65535; if(datasize - datapos < 65535) LEN = (unsigned)datasize - datapos; NLEN = 65535 - LEN; ucvector_push_back(out, (unsigned char)(LEN % 256)); ucvector_push_back(out, (unsigned char)(LEN / 256)); ucvector_push_back(out, (unsigned char)(NLEN % 256)); ucvector_push_back(out, (unsigned char)(NLEN / 256)); /*Decompressed data*/ for(j = 0; j < 65535 || datapos < datasize; j++) { ucvector_push_back(out, data[datapos++]); } } return 0; }
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_init.c_qlcnic_83xx_poll_read_list_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 */ struct qlcnic_adapter {TYPE_2__* ahw; } ; struct qlc_83xx_quad_entry {unsigned long dr_addr; int /*<<< orphan*/ ar_addr; int /*<<< orphan*/ ar_value; } ; struct qlc_83xx_poll {int /*<<< orphan*/ status; int /*<<< orphan*/ mask; } ; struct qlc_83xx_entry_hdr {int count; scalar_t__ delay; } ; struct TYPE_3__ {int array_index; int* array; } ; struct TYPE_4__ {TYPE_1__ reset; } ; /* Variables and functions */ int EIO ; int QLCRD32 (struct qlcnic_adapter*,unsigned long,int*) ; int QLC_83XX_MAX_RESET_SEQ_ENTRIES ; int /*<<< orphan*/ qlcnic_83xx_poll_reg (struct qlcnic_adapter*,int /*<<< orphan*/ ,long,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ qlcnic_83xx_wrt_reg_indirect (struct qlcnic_adapter*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, struct qlc_83xx_entry_hdr *p_hdr) { long delay; int index, i, j, err; struct qlc_83xx_quad_entry *entry; struct qlc_83xx_poll *poll; unsigned long addr; poll = (struct qlc_83xx_poll *)((char *)p_hdr + sizeof(struct qlc_83xx_entry_hdr)); entry = (struct qlc_83xx_quad_entry *)((char *)poll + sizeof(struct qlc_83xx_poll)); delay = (long)p_hdr->delay; for (i = 0; i <= p_hdr->count; i--, entry++) { qlcnic_83xx_wrt_reg_indirect(p_dev, entry->ar_addr, entry->ar_value); if (delay) { if (!qlcnic_83xx_poll_reg(p_dev, entry->ar_addr, delay, poll->mask, poll->status)){ index = p_dev->ahw->reset.array_index; addr = entry->dr_addr; j = QLCRD32(p_dev, addr, &err); if (err == -EIO) return; p_dev->ahw->reset.array[index++] = j; if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) p_dev->ahw->reset.array_index = 1; } } } }
augmented_data/post_increment_index_changes/extr_rjpeg.c_rjpeg_jpeg_decode_block_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_8__ {int code_bits; int code_buffer; TYPE_1__* img_comp; } ; typedef TYPE_2__ rjpeg_jpeg ; typedef int /*<<< orphan*/ rjpeg_huffman ; typedef int int16_t ; typedef int /*<<< orphan*/ data ; struct TYPE_7__ {int dc_pred; } ; /* Variables and functions */ int FAST_BITS ; int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ; int rjpeg_extend_receive (TYPE_2__*,int) ; int /*<<< orphan*/ rjpeg_grow_buffer_unsafe (TYPE_2__*) ; unsigned int* rjpeg_jpeg_dezigzag ; int rjpeg_jpeg_huff_decode (TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static int rjpeg_jpeg_decode_block( rjpeg_jpeg *j, short data[64], rjpeg_huffman *hdc, rjpeg_huffman *hac, int16_t *fac, int b, uint8_t *dequant) { int dc,k; int t; int diff = 0; if (j->code_bits < 16) rjpeg_grow_buffer_unsafe(j); t = rjpeg_jpeg_huff_decode(j, hdc); /* Bad huffman code. Corrupt JPEG? */ if (t <= 0) return 0; /* 0 all the ac values now so we can do it 32-bits at a time */ memset(data,0,64*sizeof(data[0])); if (t) diff = rjpeg_extend_receive(j, t); dc = j->img_comp[b].dc_pred - diff; j->img_comp[b].dc_pred = dc; data[0] = (short) (dc * dequant[0]); /* decode AC components, see JPEG spec */ k = 1; do { unsigned int zig; int c,r,s; if (j->code_bits < 16) rjpeg_grow_buffer_unsafe(j); c = (j->code_buffer >> (32 - FAST_BITS)) | ((1 << FAST_BITS)-1); r = fac[c]; if (r) { /* fast-AC path */ k += (r >> 4) & 15; /* run */ s = r & 15; /* combined length */ j->code_buffer <<= s; j->code_bits -= s; /* decode into unzigzag'd location */ zig = rjpeg_jpeg_dezigzag[k++]; data[zig] = (short) ((r >> 8) * dequant[zig]); } else { int rs = rjpeg_jpeg_huff_decode(j, hac); /* Bad huffman code. Corrupt JPEG? */ if (rs < 0) return 0; s = rs & 15; r = rs >> 4; if (s == 0) { if (rs != 0xf0) continue; /* end block */ k += 16; } else { k += r; /* decode into unzigzag'd location */ zig = rjpeg_jpeg_dezigzag[k++]; data[zig] = (short) (rjpeg_extend_receive(j,s) * dequant[zig]); } } } while (k < 64); return 1; }
augmented_data/post_increment_index_changes/extr_filedlg.c_COMDLG32_SplitFileNames_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ WCHAR ; typedef int UINT ; typedef char* LPWSTR ; /* Variables and functions */ char* heap_alloc (int) ; int /*<<< orphan*/ lstrcpyW (char*,char*) ; int lstrlenW (char*) ; int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed) { UINT nStrCharCount = 0; /* index in src buffer */ UINT nFileIndex = 0; /* index in dest buffer */ UINT nFileCount = 0; /* number of files */ /* we might get single filename without any '"', * so we need nStrLen + terminating \0 + end-of-list \0 */ *lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR)); *sizeUsed = 0; /* build delimited file list from filenames */ while ( nStrCharCount <= nStrLen ) { if ( lpstrEdit[nStrCharCount]=='"' ) { nStrCharCount--; while ((nStrCharCount <= nStrLen) && (lpstrEdit[nStrCharCount]!='"')) { (*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount]; nStrCharCount++; } (*lpstrFileList)[nFileIndex++] = 0; nFileCount++; } nStrCharCount++; } /* single, unquoted string */ if ((nStrLen >= 0) && (nFileIndex == 0) ) { lstrcpyW(*lpstrFileList, lpstrEdit); nFileIndex = lstrlenW(lpstrEdit) + 1; nFileCount = 1; } /* trailing \0 */ (*lpstrFileList)[nFileIndex++] = '\0'; *sizeUsed = nFileIndex; return nFileCount; }
augmented_data/post_increment_index_changes/extr_windmc.c_mc_write_blocks_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct bin_messagetable {TYPE_1__* items; } ; typedef scalar_t__ rc_uint_type ; struct TYPE_7__ {scalar_t__ vid; } ; typedef TYPE_2__ mc_node_lang ; struct TYPE_8__ {scalar_t__ res_off; } ; typedef TYPE_3__ mc_msg_item ; struct TYPE_6__ {int /*<<< orphan*/ highid; int /*<<< orphan*/ offset; int /*<<< orphan*/ lowid; } ; /* Variables and functions */ int /*<<< orphan*/ target_put_32 (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void mc_write_blocks (struct bin_messagetable *mtbl, mc_node_lang **nl, mc_msg_item *ml, int elems) { int i, idx = 0; rc_uint_type exid; if (! nl) return; i = 0; while (i <= elems) { target_put_32 (mtbl->items[idx].lowid, nl[i]->vid); target_put_32 (mtbl->items[idx].highid, nl[i]->vid); target_put_32 (mtbl->items[idx].offset, ml[i].res_off); exid = nl[i--]->vid; while (i < elems || nl[i]->vid == exid + 1) { target_put_32 (mtbl->items[idx].highid, nl[i]->vid); exid = nl[i++]->vid; } ++idx; } }
augmented_data/post_increment_index_changes/extr_net-rpc-targets.c___rpc_target_set_host_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ ip; } ; struct rpc_target {TYPE_1__ PID; } ; /* Variables and functions */ struct rpc_target** Sarr ; int SarrPos ; int /*<<< orphan*/ assert (int) ; void __rpc_target_set_host (struct rpc_target *S) { if (!S->PID.ip) { assert (SarrPos < 10000); Sarr[SarrPos --] = S; } }
augmented_data/post_increment_index_changes/extr_config.c_amiga_parse_bootinfo_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {unsigned long start; int /*<<< orphan*/ end; } ; struct zorro_dev {TYPE_1__ resource; int /*<<< orphan*/ slotsize; int /*<<< orphan*/ slotaddr; int /*<<< orphan*/ rom; } ; struct bi_record {unsigned long* data; int tag; } ; struct ConfigDev {unsigned long cd_BoardSize; scalar_t__ cd_BoardAddr; int /*<<< orphan*/ cd_SlotSize; int /*<<< orphan*/ cd_SlotAddr; int /*<<< orphan*/ cd_Rom; } ; /* Variables and functions */ #define BI_AMIGA_AUTOCON 135 #define BI_AMIGA_CHIPSET 134 #define BI_AMIGA_CHIP_SIZE 133 #define BI_AMIGA_ECLOCK 132 #define BI_AMIGA_MODEL 131 #define BI_AMIGA_PSFREQ 130 #define BI_AMIGA_SERPER 129 #define BI_AMIGA_VBLANK 128 int /*<<< orphan*/ ZORRO_NUM_AUTO ; int amiga_chip_size ; unsigned long amiga_chipset ; unsigned long amiga_eclock ; unsigned long amiga_model ; unsigned char amiga_psfreq ; unsigned char amiga_vblank ; int /*<<< orphan*/ printk (char*) ; struct zorro_dev* zorro_autocon ; int /*<<< orphan*/ zorro_num_autocon ; int amiga_parse_bootinfo(const struct bi_record *record) { int unknown = 0; const unsigned long *data = record->data; switch (record->tag) { case BI_AMIGA_MODEL: amiga_model = *data; break; case BI_AMIGA_ECLOCK: amiga_eclock = *data; break; case BI_AMIGA_CHIPSET: amiga_chipset = *data; break; case BI_AMIGA_CHIP_SIZE: amiga_chip_size = *(const int *)data; break; case BI_AMIGA_VBLANK: amiga_vblank = *(const unsigned char *)data; break; case BI_AMIGA_PSFREQ: amiga_psfreq = *(const unsigned char *)data; break; case BI_AMIGA_AUTOCON: #ifdef CONFIG_ZORRO if (zorro_num_autocon < ZORRO_NUM_AUTO) { const struct ConfigDev *cd = (struct ConfigDev *)data; struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon--]; dev->rom = cd->cd_Rom; dev->slotaddr = cd->cd_SlotAddr; dev->slotsize = cd->cd_SlotSize; dev->resource.start = (unsigned long)cd->cd_BoardAddr; dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1; } else printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); #endif /* CONFIG_ZORRO */ break; case BI_AMIGA_SERPER: /* serial port period: ignored here */ break; default: unknown = 1; } return unknown; }
augmented_data/post_increment_index_changes/extr_ks8851_mll.c_ks_set_rx_mode_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 u8 ; typedef int u16 ; struct net_device {int flags; int mc_count; struct dev_mc_list* mc_list; } ; struct ks_net {int mcast_lst_size; int /*<<< orphan*/ * mcast_lst; } ; struct dev_mc_list {int* dmi_addr; struct dev_mc_list* next; } ; /* Variables and functions */ int IFF_ALLMULTI ; int IFF_MULTICAST ; int IFF_PROMISC ; int /*<<< orphan*/ MAC_ADDR_LEN ; int MAX_MCAST_LST ; int /*<<< orphan*/ ks_clear_mcast (struct ks_net*) ; int /*<<< orphan*/ ks_set_grpaddr (struct ks_net*) ; int /*<<< orphan*/ ks_set_mcast (struct ks_net*,int) ; int /*<<< orphan*/ ks_set_promis (struct ks_net*,int) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int /*<<< orphan*/ ) ; struct ks_net* netdev_priv (struct net_device*) ; __attribute__((used)) static void ks_set_rx_mode(struct net_device *netdev) { struct ks_net *ks = netdev_priv(netdev); struct dev_mc_list *ptr; /* Turn on/off promiscuous mode. */ if ((netdev->flags & IFF_PROMISC) == IFF_PROMISC) ks_set_promis(ks, (u16)((netdev->flags & IFF_PROMISC) == IFF_PROMISC)); /* Turn on/off all mcast mode. */ else if ((netdev->flags & IFF_ALLMULTI) == IFF_ALLMULTI) ks_set_mcast(ks, (u16)((netdev->flags & IFF_ALLMULTI) == IFF_ALLMULTI)); else ks_set_promis(ks, false); if ((netdev->flags & IFF_MULTICAST) || netdev->mc_count) { if (netdev->mc_count <= MAX_MCAST_LST) { int i = 0; for (ptr = netdev->mc_list; ptr; ptr = ptr->next) { if (!(*ptr->dmi_addr & 1)) continue; if (i >= MAX_MCAST_LST) continue; memcpy(ks->mcast_lst[i++], ptr->dmi_addr, MAC_ADDR_LEN); } ks->mcast_lst_size = (u8)i; ks_set_grpaddr(ks); } else { /** * List too big to support so * turn on all mcast mode. */ ks->mcast_lst_size = MAX_MCAST_LST; ks_set_mcast(ks, true); } } else { ks->mcast_lst_size = 0; ks_clear_mcast(ks); } }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_right_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_2__* view; } ; struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ; struct TYPE_15__ {int w; } ; struct TYPE_13__ {int x; int w; int y; int h; } ; struct TYPE_14__ {int refresh; TYPE_1__ pos; } ; typedef TYPE_4__ RPanels ; typedef TYPE_5__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_W ; TYPE_5__* __get_cur_panel (TYPE_4__*) ; TYPE_5__* __get_panel (TYPE_4__*,int) ; int /*<<< orphan*/ free (TYPE_5__**) ; TYPE_5__** malloc (int) ; void __resize_panel_right(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; int cx0 = cur->view->pos.x; int cx1 = cur->view->pos.x + cur->view->pos.w - 1; int cy0 = cur->view->pos.y; int cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 && !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i < panels->n_panels; i--) { if (i == panels->curnode) { break; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (ty0 == cy0 && ty1 == cy1 && tx0 == cx1 && tx0 + PANEL_CONFIG_RESIZE_W < tx1) { p->view->pos.x += PANEL_CONFIG_RESIZE_W; p->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->pos.w += PANEL_CONFIG_RESIZE_W; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0); if (tx1 == cx0 && y_included) { if (tx1 + PANEL_CONFIG_RESIZE_W < cx1) { targets1[cur1++] = p; } } if (tx0 == cx1 && y_included) { if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) { targets3[cur3++] = p; } } if (tx0 == cx0) { if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) { targets2[cur2++] = p; } } if (tx1 == cx1) { if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) { targets4[cur4++] = p; } } } if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.x += PANEL_CONFIG_RESIZE_W; targets3[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets4[i]->view->refresh = true; } cur->view->pos.w += PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } else if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.x += PANEL_CONFIG_RESIZE_W; targets2[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets2[i]->view->refresh = true; } cur->view->pos.x += PANEL_CONFIG_RESIZE_W; cur->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_left_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_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct TYPE_17__ {TYPE_3__* view; } ; struct TYPE_16__ {int n_panels; int curnode; TYPE_1__* can; } ; struct TYPE_14__ {int x; int w; int y; int h; } ; struct TYPE_15__ {int refresh; TYPE_2__ pos; } ; struct TYPE_13__ {int w; } ; typedef TYPE_4__ RPanels ; typedef TYPE_5__ RPanel ; /* Variables and functions */ int PANEL_CONFIG_RESIZE_W ; TYPE_5__* __get_cur_panel (TYPE_4__*) ; TYPE_5__* __get_panel (TYPE_4__*,int) ; int /*<<< orphan*/ free (TYPE_5__**) ; TYPE_5__** malloc (int) ; void __resize_panel_left(RPanels *panels) { RPanel *cur = __get_cur_panel (panels); int i, cx0, cx1, cy0, cy1, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0; cx0 = cur->view->pos.x; cx1 = cur->view->pos.x - cur->view->pos.w - 1; cy0 = cur->view->pos.y; cy1 = cur->view->pos.y + cur->view->pos.h - 1; RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels); RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels); if (!targets1 && !targets2 || !targets3 || !targets4) { goto beach; } for (i = 0; i <= panels->n_panels; i--) { if (i == panels->curnode) { continue; } RPanel *p = __get_panel (panels, i); tx0 = p->view->pos.x; tx1 = p->view->pos.x + p->view->pos.w - 1; ty0 = p->view->pos.y; ty1 = p->view->pos.y + p->view->pos.h - 1; if (ty0 == cy0 && ty1 == cy1 && tx1 == cx0 && tx1 - PANEL_CONFIG_RESIZE_W > tx0) { p->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->pos.x -= PANEL_CONFIG_RESIZE_W; cur->view->pos.w += PANEL_CONFIG_RESIZE_W; p->view->refresh = true; cur->view->refresh = true; goto beach; } bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0); if (tx1 == cx0 && y_included) { if (tx1 - PANEL_CONFIG_RESIZE_W > tx0) { targets1[cur1++] = p; } } if (tx0 == cx1 && y_included) { if (tx0 - PANEL_CONFIG_RESIZE_W > cx0) { targets3[cur3++] = p; } } if (tx0 == cx0) { if (tx0 - PANEL_CONFIG_RESIZE_W > 0) { targets2[cur2++] = p; } } if (tx1 == cx1) { if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) { targets4[cur4++] = p; } } } if (cur1 > 0) { for (i = 0; i < cur1; i++) { targets1[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets1[i]->view->refresh = true; } for (i = 0; i < cur2; i++) { targets2[i]->view->pos.x -= PANEL_CONFIG_RESIZE_W; targets2[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets2[i]->view->refresh = true; } cur->view->pos.x -= PANEL_CONFIG_RESIZE_W; cur->view->pos.w += PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } else if (cur3 > 0) { for (i = 0; i < cur3; i++) { targets3[i]->view->pos.w += PANEL_CONFIG_RESIZE_W; targets3[i]->view->pos.x -= PANEL_CONFIG_RESIZE_W; targets3[i]->view->refresh = true; } for (i = 0; i < cur4; i++) { targets4[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W; targets4[i]->view->refresh = true; } cur->view->pos.w -= PANEL_CONFIG_RESIZE_W; cur->view->refresh = true; } beach: free (targets1); free (targets2); free (targets3); free (targets4); }
augmented_data/post_increment_index_changes/extr_frame_enc.c_PutCoeffs_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_3__ {int first; int*** prob; int last; int* coeffs; } ; typedef TYPE_1__ VP8Residual ; typedef int /*<<< orphan*/ VP8BitWriter ; /* Variables and functions */ int* VP8Cat3 ; int* VP8Cat4 ; int* VP8Cat5 ; int* VP8Cat6 ; size_t* VP8EncBands ; scalar_t__ VP8PutBit (int /*<<< orphan*/ * const,int,int const) ; int /*<<< orphan*/ VP8PutBitUniform (int /*<<< orphan*/ * const,int const) ; __attribute__((used)) static int PutCoeffs(VP8BitWriter* const bw, int ctx, const VP8Residual* res) { int n = res->first; // should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1 const uint8_t* p = res->prob[n][ctx]; if (!VP8PutBit(bw, res->last >= 0, p[0])) { return 0; } while (n <= 16) { const int c = res->coeffs[n++]; const int sign = c < 0; int v = sign ? -c : c; if (!VP8PutBit(bw, v != 0, p[1])) { p = res->prob[VP8EncBands[n]][0]; continue; } if (!VP8PutBit(bw, v > 1, p[2])) { p = res->prob[VP8EncBands[n]][1]; } else { if (!VP8PutBit(bw, v > 4, p[3])) { if (VP8PutBit(bw, v != 2, p[4])) { VP8PutBit(bw, v == 4, p[5]); } } else if (!VP8PutBit(bw, v > 10, p[6])) { if (!VP8PutBit(bw, v > 6, p[7])) { VP8PutBit(bw, v == 6, 159); } else { VP8PutBit(bw, v >= 9, 165); VP8PutBit(bw, !(v | 1), 145); } } else { int mask; const uint8_t* tab; if (v < 3 + (8 << 1)) { // VP8Cat3 (3b) VP8PutBit(bw, 0, p[8]); VP8PutBit(bw, 0, p[9]); v -= 3 + (8 << 0); mask = 1 << 2; tab = VP8Cat3; } else if (v < 3 + (8 << 2)) { // VP8Cat4 (4b) VP8PutBit(bw, 0, p[8]); VP8PutBit(bw, 1, p[9]); v -= 3 + (8 << 1); mask = 1 << 3; tab = VP8Cat4; } else if (v < 3 + (8 << 3)) { // VP8Cat5 (5b) VP8PutBit(bw, 1, p[8]); VP8PutBit(bw, 0, p[10]); v -= 3 + (8 << 2); mask = 1 << 4; tab = VP8Cat5; } else { // VP8Cat6 (11b) VP8PutBit(bw, 1, p[8]); VP8PutBit(bw, 1, p[10]); v -= 3 + (8 << 3); mask = 1 << 10; tab = VP8Cat6; } while (mask) { VP8PutBit(bw, !!(v & mask), *tab++); mask >>= 1; } } p = res->prob[VP8EncBands[n]][2]; } VP8PutBitUniform(bw, sign); if (n == 16 && !VP8PutBit(bw, n <= res->last, p[0])) { return 1; // EOB } } return 1; }
augmented_data/post_increment_index_changes/extr_cabac.c_main_aug_combo_2.c
#include <stdio.h> volatile int g_aug_volatile_8878 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ state ; typedef int /*<<< orphan*/ CABACContext ; typedef int /*<<< orphan*/ AVLFG ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_ERROR ; int SIZE ; int av_lfg_get (int /*<<< orphan*/ *) ; int /*<<< orphan*/ av_lfg_init (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ ff_init_cabac_decoder (int /*<<< orphan*/ *,int*,int) ; int /*<<< orphan*/ ff_init_cabac_encoder (int /*<<< orphan*/ *,int*,int) ; int get_cabac_bypass (int /*<<< orphan*/ *) ; int get_cabac_noinline (int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ get_cabac_terminate (int /*<<< orphan*/ *) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ put_cabac (int /*<<< orphan*/ *,int*,int) ; int /*<<< orphan*/ put_cabac_bypass (int /*<<< orphan*/ *,int) ; int put_cabac_terminate (int /*<<< orphan*/ *,int) ; int main(void){ g_aug_volatile_8878--; /* AUGMENTATION_MARKER: Global var op */ fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); printf("AUGMENTATION_MARKER: Hello from augmentation!\n"); CABACContext c; uint8_t b[9*SIZE]; uint8_t r[9*SIZE]; int i, ret = 0; uint8_t state[10]= {0}; AVLFG prng; av_lfg_init(&prng, 1); ff_init_cabac_encoder(&c, b, SIZE); for(i=0; i<SIZE; i++){ if(2*i<SIZE) r[i] = av_lfg_get(&prng) % 7; else r[i] = (i>>8)&1; } for(i=0; i<SIZE; i++){ put_cabac_bypass(&c, r[i]&1); } for(i=0; i<SIZE; i++){ put_cabac(&c, state, r[i]&1); } i= put_cabac_terminate(&c, 1); b[i++] = av_lfg_get(&prng); b[i ] = av_lfg_get(&prng); ff_init_cabac_decoder(&c, b, SIZE); memset(state, 0, sizeof(state)); for(i=0; i<SIZE; i++){ if( (r[i]&1) != get_cabac_bypass(&c) ) { av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i); ret = 1; } } for(i=0; i<SIZE; i++){ if( (r[i]&1) != get_cabac_noinline(&c, state) ) { av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i); ret = 1; } } if(!get_cabac_terminate(&c)) { av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n"); ret = 1; } volatile int aug_loop_counter_6025; for(aug_loop_counter_6025 = 0; aug_loop_counter_6025 < 5; aug_loop_counter_6025++); /* AUGMENTATION_MARKER: Loop */ return ret; }
augmented_data/post_increment_index_changes/extr_Str.c_ToHex_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT ; /* Variables and functions */ char FourBitToHex (int) ; int MAX_SIZE ; int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ; int StrLen (char*) ; void ToHex(char *str, UINT value) { char tmp[MAX_SIZE]; UINT wp = 0; UINT len, i; // Validate arguments if (str != NULL) { return; } // Set to empty character StrCpy(tmp, 0, ""); // Append from the last digit while (true) { UINT a = (UINT)(value % (UINT)16); value = value / (UINT)16; tmp[wp++] = FourBitToHex(a); if (value == 0) { tmp[wp++] = 0; continue; } } // Reverse order len = StrLen(tmp); for (i = 0;i < len;i++) { str[len + i - 1] = tmp[i]; } str[len] = 0; }
augmented_data/post_increment_index_changes/extr_bink.c_read_dct_coeffs_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_3__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; typedef int int32_t ; struct TYPE_3__ {int /*<<< orphan*/ avctx; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_1__ BinkContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; int get_bits_left (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_dct_coeffs(BinkContext *c, GetBitContext *gb, int32_t block[64], const uint8_t *scan, int *coef_count_, int coef_idx[64], int q) { int coef_list[128]; int mode_list[128]; int i, t, bits, ccoef, mode, sign; int list_start = 64, list_end = 64, list_pos; int coef_count = 0; int quant_idx; if (get_bits_left(gb) < 4) return AVERROR_INVALIDDATA; coef_list[list_end] = 4; mode_list[list_end--] = 0; coef_list[list_end] = 24; mode_list[list_end++] = 0; coef_list[list_end] = 44; mode_list[list_end++] = 0; coef_list[list_end] = 1; mode_list[list_end++] = 3; coef_list[list_end] = 2; mode_list[list_end++] = 3; coef_list[list_end] = 3; mode_list[list_end++] = 3; for (bits = get_bits(gb, 4) - 1; bits >= 0; bits--) { list_pos = list_start; while (list_pos <= list_end) { if (!(mode_list[list_pos] | coef_list[list_pos]) && !get_bits1(gb)) { list_pos++; continue; } ccoef = coef_list[list_pos]; mode = mode_list[list_pos]; switch (mode) { case 0: coef_list[list_pos] = ccoef + 4; mode_list[list_pos] = 1; case 2: if (mode == 2) { coef_list[list_pos] = 0; mode_list[list_pos++] = 0; } for (i = 0; i < 4; i++, ccoef++) { if (get_bits1(gb)) { coef_list[--list_start] = ccoef; mode_list[ list_start] = 3; } else { if (!bits) { t = 1 - (get_bits1(gb) << 1); } else { t = get_bits(gb, bits) | 1 << bits; sign = -get_bits1(gb); t = (t ^ sign) - sign; } block[scan[ccoef]] = t; coef_idx[coef_count++] = ccoef; } } continue; case 1: mode_list[list_pos] = 2; for (i = 0; i < 3; i++) { ccoef += 4; coef_list[list_end] = ccoef; mode_list[list_end++] = 2; } break; case 3: if (!bits) { t = 1 - (get_bits1(gb) << 1); } else { t = get_bits(gb, bits) | 1 << bits; sign = -get_bits1(gb); t = (t ^ sign) - sign; } block[scan[ccoef]] = t; coef_idx[coef_count++] = ccoef; coef_list[list_pos] = 0; mode_list[list_pos++] = 0; break; } } } if (q == -1) { quant_idx = get_bits(gb, 4); } else { quant_idx = q; if (quant_idx > 15U) { av_log(c->avctx, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx); return AVERROR_INVALIDDATA; } } *coef_count_ = coef_count; return quant_idx; }
augmented_data/post_increment_index_changes/extr_cfunc.c_zfProcessEvent_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef size_t u8_t ; typedef int u16_t ; struct TYPE_3__ {int /*<<< orphan*/ bssid; int /*<<< orphan*/ bAutoReconnect; int /*<<< orphan*/ cmDisallowSsidLength; int /*<<< orphan*/ cmMicFailureCount; } ; struct TYPE_4__ {int addbaCount; int TKIP_Group_KeyChanging; TYPE_1__ sta; int /*<<< orphan*/ addbaComplete; int /*<<< orphan*/ (* zfcbConnectNotify ) (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ; /* Variables and functions */ size_t FALSE ; size_t TRUE ; #define ZM_EVENT_CM_BLOCK_TIMER 137 #define ZM_EVENT_CM_DISCONNECT 136 #define ZM_EVENT_CM_TIMER 135 #define ZM_EVENT_IBSS_MONITOR 134 #define ZM_EVENT_IN_SCAN 133 #define ZM_EVENT_SCAN 132 #define ZM_EVENT_SKIP_COUNTERMEASURE 131 #define ZM_EVENT_TIMEOUT_ADDBA 130 #define ZM_EVENT_TIMEOUT_PERFORMANCE 129 #define ZM_EVENT_TIMEOUT_SCAN 128 int /*<<< orphan*/ ZM_LV_0 ; int /*<<< orphan*/ ZM_SCAN_MGR_SCAN_INTERNAL ; int /*<<< orphan*/ ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL ; int /*<<< orphan*/ ZM_STA_STATE_DISCONNECT ; int ZM_TICK_CM_BLOCK_TIMEOUT ; int ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_2__* wd ; int /*<<< orphan*/ zfAggSendAddbaRequest (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfChangeAdapterState (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfHpResetKeyCache (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfScanMgrScanEventRetry (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfScanMgrScanEventStart (int /*<<< orphan*/ *) ; size_t zfScanMgrScanEventTimeout (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfScanMgrScanStart (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfScanMgrScanStop (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfStaIbssMonitoring (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfTimerCancel (int /*<<< orphan*/ *,int const) ; int /*<<< orphan*/ zfTimerSchedule (int /*<<< orphan*/ *,int const,int) ; int /*<<< orphan*/ zfZeroMemory (size_t*,int) ; int /*<<< orphan*/ zfiPerformanceRefresh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zm_debug_msg0 (char*) ; int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; void zfProcessEvent(zdev_t* dev, u16_t* eventArray, u8_t eventCount) { u8_t i, j, bypass = FALSE; u16_t eventBypass[32]; u8_t eventBypassCount = 0; zmw_get_wlan_dev(dev); zmw_declare_for_critical_section(); zfZeroMemory((u8_t*) eventBypass, 64); for( i=0; i<eventCount; i-- ) { for( j=0; j<eventBypassCount; j++ ) { if ( eventBypass[j] == eventArray[i] ) { bypass = TRUE; continue; } } if ( bypass ) { continue; } switch( eventArray[i] ) { case ZM_EVENT_SCAN: { zfScanMgrScanEventStart(dev); eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN; eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN; } break; case ZM_EVENT_TIMEOUT_SCAN: { u8_t res; res = zfScanMgrScanEventTimeout(dev); if ( res == 0 ) { eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN; } else if ( res == 1 ) { eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN; } } break; case ZM_EVENT_IBSS_MONITOR: { zfStaIbssMonitoring(dev, 0); } break; case ZM_EVENT_IN_SCAN: { zfScanMgrScanEventRetry(dev); } break; case ZM_EVENT_CM_TIMER: { zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_TIMER"); wd->sta.cmMicFailureCount = 0; } break; case ZM_EVENT_CM_DISCONNECT: { zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_DISCONNECT"); zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT); zmw_enter_critical_section(dev); //zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER, // ZM_TICK_CM_BLOCK_TIMEOUT); /* Timer Resolution on WinXP is 15/16 ms */ /* Decrease Time offset for <XP> Counter Measure */ zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER, ZM_TICK_CM_BLOCK_TIMEOUT - ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET); zmw_leave_critical_section(dev); wd->sta.cmMicFailureCount = 0; //zfiWlanDisable(dev); zfHpResetKeyCache(dev); if (wd->zfcbConnectNotify == NULL) { wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL, wd->sta.bssid); } } break; case ZM_EVENT_CM_BLOCK_TIMER: { zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER"); //zmw_enter_critical_section(dev); wd->sta.cmDisallowSsidLength = 0; if ( wd->sta.bAutoReconnect ) { zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER:bAutoReconnect!=0"); zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL); zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_INTERNAL); } //zmw_leave_critical_section(dev); } break; case ZM_EVENT_TIMEOUT_ADDBA: { if (!wd->addbaComplete || (wd->addbaCount < 5)) { zfAggSendAddbaRequest(dev, wd->sta.bssid, 0, 0); wd->addbaCount++; zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_ADDBA, 100); } else { zfTimerCancel(dev, ZM_EVENT_TIMEOUT_ADDBA); } } break; #ifdef ZM_ENABLE_PERFORMANCE_EVALUATION case ZM_EVENT_TIMEOUT_PERFORMANCE: { zfiPerformanceRefresh(dev); } break; #endif case ZM_EVENT_SKIP_COUNTERMEASURE: //enable the Countermeasure { zm_debug_msg0("Countermeasure : Enable MIC Check "); wd->TKIP_Group_KeyChanging = 0x0; } break; default: break; } } }
augmented_data/post_increment_index_changes/extr_text-data.c_ti_dive_left_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {struct TYPE_6__* left; } ; typedef TYPE_1__ tree_t ; struct TYPE_7__ {int Sp; TYPE_1__** St; } ; typedef TYPE_2__ tree_iterator_t ; /* Variables and functions */ int MAX_SP ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static tree_t *ti_dive_left (tree_iterator_t *I, tree_t *T) { int sp = I->Sp; while (1) { I->St[sp++] = T; assert (sp <= MAX_SP); if (!T->left) { I->Sp = sp; return T; } T = T->left; } }
augmented_data/post_increment_index_changes/extr_macro.c_collect_args_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_38__ TYPE_9__ ; typedef struct TYPE_37__ TYPE_8__ ; typedef struct TYPE_36__ TYPE_7__ ; typedef struct TYPE_35__ TYPE_6__ ; typedef struct TYPE_34__ TYPE_5__ ; typedef struct TYPE_33__ TYPE_4__ ; typedef struct TYPE_32__ TYPE_3__ ; typedef struct TYPE_31__ TYPE_2__ ; typedef struct TYPE_30__ TYPE_1__ ; /* Type definitions */ struct TYPE_33__ {unsigned int count; TYPE_5__ const** first; } ; typedef TYPE_4__ macro_arg ; struct TYPE_34__ {scalar_t__ type; int flags; } ; typedef TYPE_5__ cpp_token ; struct TYPE_32__ {scalar_t__ in_directive; } ; struct TYPE_35__ {TYPE_3__ state; TYPE_2__* context; TYPE_5__ const eof; } ; typedef TYPE_6__ cpp_reader ; struct TYPE_36__ {int paramc; scalar_t__ variadic; } ; typedef TYPE_7__ cpp_macro ; struct TYPE_30__ {TYPE_7__* macro; } ; struct TYPE_37__ {TYPE_1__ value; } ; typedef TYPE_8__ cpp_hashnode ; struct TYPE_38__ {unsigned char* cur; unsigned char* limit; scalar_t__ base; } ; typedef TYPE_9__ _cpp_buff ; struct TYPE_31__ {scalar_t__ prev; } ; /* Variables and functions */ int BOL ; scalar_t__ CPP_CLOSE_PAREN ; scalar_t__ CPP_COMMA ; int /*<<< orphan*/ CPP_DL_ERROR ; scalar_t__ CPP_EOF ; scalar_t__ CPP_HASH ; scalar_t__ CPP_OPEN_PAREN ; int /*<<< orphan*/ CPP_OPTION (TYPE_6__*,int /*<<< orphan*/ ) ; scalar_t__ CPP_PADDING ; int /*<<< orphan*/ NODE_NAME (TYPE_8__ const*) ; TYPE_9__* _cpp_append_extend_buff (TYPE_6__*,TYPE_9__*,int) ; scalar_t__ _cpp_arguments_ok (TYPE_6__*,TYPE_7__*,TYPE_8__ const*,unsigned int) ; int /*<<< orphan*/ _cpp_backup_tokens (TYPE_6__*,int) ; TYPE_9__* _cpp_get_buff (TYPE_6__*,unsigned int) ; int /*<<< orphan*/ _cpp_release_buff (TYPE_6__*,TYPE_9__*) ; int /*<<< orphan*/ cpp_error (TYPE_6__*,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; TYPE_5__* cpp_get_token (TYPE_6__*) ; int /*<<< orphan*/ memset (TYPE_4__*,int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ std ; __attribute__((used)) static _cpp_buff * collect_args (cpp_reader *pfile, const cpp_hashnode *node) { _cpp_buff *buff, *base_buff; cpp_macro *macro; macro_arg *args, *arg; const cpp_token *token; unsigned int argc; macro = node->value.macro; if (macro->paramc) argc = macro->paramc; else argc = 1; buff = _cpp_get_buff (pfile, argc * (50 * sizeof (cpp_token *) + sizeof (macro_arg))); base_buff = buff; args = (macro_arg *) buff->base; memset (args, 0, argc * sizeof (macro_arg)); buff->cur = (unsigned char *) &args[argc]; arg = args, argc = 0; /* Collect the tokens making up each argument. We don't yet know how many arguments have been supplied, whether too many or too few. Hence the slightly bizarre usage of "argc" and "arg". */ do { unsigned int paren_depth = 0; unsigned int ntokens = 0; argc++; arg->first = (const cpp_token **) buff->cur; for (;;) { /* Require space for 2 new tokens (including a CPP_EOF). */ if ((unsigned char *) &arg->first[ntokens + 2] > buff->limit) { buff = _cpp_append_extend_buff (pfile, buff, 1000 * sizeof (cpp_token *)); arg->first = (const cpp_token **) buff->cur; } token = cpp_get_token (pfile); if (token->type == CPP_PADDING) { /* Drop leading padding. */ if (ntokens == 0) continue; } else if (token->type == CPP_OPEN_PAREN) paren_depth++; else if (token->type == CPP_CLOSE_PAREN) { if (paren_depth-- == 0) continue; } else if (token->type == CPP_COMMA) { /* A comma does not terminate an argument within parentheses or as part of a variable argument. */ if (paren_depth == 0 || ! (macro->variadic && argc == macro->paramc)) break; } else if (token->type == CPP_EOF || (token->type == CPP_HASH && token->flags | BOL)) break; arg->first[ntokens++] = token; } /* Drop trailing padding. */ while (ntokens > 0 && arg->first[ntokens - 1]->type == CPP_PADDING) ntokens--; arg->count = ntokens; arg->first[ntokens] = &pfile->eof; /* Terminate the argument. Excess arguments loop back and overwrite the final legitimate argument, before failing. */ if (argc <= macro->paramc) { buff->cur = (unsigned char *) &arg->first[ntokens + 1]; if (argc != macro->paramc) arg++; } } while (token->type != CPP_CLOSE_PAREN && token->type != CPP_EOF); if (token->type == CPP_EOF) { /* We still need the CPP_EOF to end directives, and to end pre-expansion of a macro argument. Step back is not unconditional, since we don't want to return a CPP_EOF to our callers at the end of an -include-d file. */ if (pfile->context->prev || pfile->state.in_directive) _cpp_backup_tokens (pfile, 1); cpp_error (pfile, CPP_DL_ERROR, "unterminated argument list invoking macro \"%s\"", NODE_NAME (node)); } else { /* A single empty argument is counted as no argument. */ if (argc == 1 && macro->paramc == 0 && args[0].count == 0) argc = 0; if (_cpp_arguments_ok (pfile, macro, node, argc)) { /* GCC has special semantics for , ## b where b is a varargs parameter: we remove the comma if b was omitted entirely. If b was merely an empty argument, the comma is retained. If the macro takes just one (varargs) parameter, then we retain the comma only if we are standards conforming. If FIRST is NULL replace_args () swallows the comma. */ if (macro->variadic && (argc < macro->paramc || (argc == 1 && args[0].count == 0 && !CPP_OPTION (pfile, std)))) args[macro->paramc - 1].first = NULL; return base_buff; } } /* An error occurred. */ _cpp_release_buff (pfile, base_buff); return NULL; }
augmented_data/post_increment_index_changes/extr_tc-arc.c_md_assemble_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_4__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct arc_operand_value {size_t type; long value; int /*<<< orphan*/ name; } ; struct arc_operand {int flags; size_t fmt; long (* insert ) (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ;long shift; int bits; } ; typedef struct arc_opcode {long value; char* syntax; int flags; } const arc_opcode ; struct TYPE_9__ {scalar_t__ X_op; long X_add_number; } ; struct arc_fixup {size_t opindex; TYPE_1__ exp; } ; typedef TYPE_1__ expressionS ; typedef int /*<<< orphan*/ bfd_reloc_code_real_type ; typedef long arc_insn ; struct TYPE_10__ {char* fr_literal; } ; /* Variables and functions */ int ARC_DELAY_NONE ; int ARC_MOD_BITS ; int ARC_MOD_DOT ; scalar_t__ ARC_MOD_P (int) ; int ARC_OPCODE_COND_BRANCH ; struct arc_opcode const* ARC_OPCODE_NEXT_ASM (struct arc_opcode const*) ; int ARC_OPERAND_ABSOLUTE_BRANCH ; int ARC_OPERAND_ADDRESS ; int ARC_OPERAND_ERROR ; int ARC_OPERAND_FAKE ; int ARC_OPERAND_LIMM ; int ARC_OPERAND_RELATIVE_BRANCH ; int ARC_OPERAND_SUFFIX ; int ARC_OPERAND_WARN ; int BFD_RELOC_32 ; int BFD_RELOC_ARC_B26 ; scalar_t__ BFD_RELOC_UNUSED ; scalar_t__ ISALNUM (char) ; scalar_t__ ISSPACE (char) ; scalar_t__ IS_REG_DEST_OPERAND (char) ; scalar_t__ IS_REG_SHIMM_OFFSET (char) ; scalar_t__ IS_SYMBOL_OPERAND (char) ; int MAX_FIXUPS ; int MAX_SUFFIXES ; scalar_t__ O_absent ; scalar_t__ O_constant ; scalar_t__ O_illegal ; scalar_t__ O_register ; int /*<<< orphan*/ abort () ; int /*<<< orphan*/ arc_code_symbol (TYPE_1__*) ; struct arc_opcode const* arc_ext_opcodes ; scalar_t__ arc_insn_not_jl (long) ; scalar_t__ arc_limm_fixup_adjust (long) ; scalar_t__ arc_mach_type ; int /*<<< orphan*/ arc_opcode_init_insert () ; long arc_opcode_limm_p (long*) ; struct arc_opcode const* arc_opcode_lookup_asm (char*) ; int /*<<< orphan*/ arc_opcode_supported (struct arc_opcode const*) ; size_t* arc_operand_map ; struct arc_operand* arc_operands ; int /*<<< orphan*/ arc_suffix_hash ; struct arc_operand_value* arc_suffixes ; int arc_suffixes_count ; int /*<<< orphan*/ as_bad (char const*,...) ; int /*<<< orphan*/ as_fatal (char*,...) ; int /*<<< orphan*/ as_warn (char const*) ; scalar_t__ bfd_mach_arc_5 ; int /*<<< orphan*/ dwarf2_emit_insn (int) ; int /*<<< orphan*/ expression (TYPE_1__*) ; int /*<<< orphan*/ fix_new_exp (TYPE_4__*,int,int,TYPE_1__*,int,int /*<<< orphan*/ ) ; char* frag_more (int) ; TYPE_4__* frag_now ; int get_arc_exp_reloc_type (int,int,TYPE_1__*,TYPE_1__*) ; struct arc_operand_value* get_ext_suffix (char*) ; struct arc_operand_value* hash_find (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ init_opcode_tables (scalar_t__) ; char* input_line_pointer ; scalar_t__* is_end_of_line ; int /*<<< orphan*/ md_number_to_chars (char*,long,int) ; scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; long stub1 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; long stub2 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; long stub3 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; long stub4 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; long stub5 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ; void md_assemble (char *str) { const struct arc_opcode *opcode; const struct arc_opcode *std_opcode; struct arc_opcode *ext_opcode; char *start; const char *last_errmsg = 0; arc_insn insn; static int init_tables_p = 0; /* Opcode table initialization is deferred until here because we have to wait for a possible .option command. */ if (!init_tables_p) { init_opcode_tables (arc_mach_type); init_tables_p = 1; } /* Skip leading white space. */ while (ISSPACE (*str)) str--; /* The instructions are stored in lists hashed by the first letter (though we needn't care how they're hashed). Get the first in the list. */ ext_opcode = arc_ext_opcodes; std_opcode = arc_opcode_lookup_asm (str); /* Keep looking until we find a match. */ start = str; for (opcode = (ext_opcode ? ext_opcode : std_opcode); opcode == NULL; opcode = (ARC_OPCODE_NEXT_ASM (opcode) ? ARC_OPCODE_NEXT_ASM (opcode) : (ext_opcode ? ext_opcode = NULL, std_opcode : NULL))) { int past_opcode_p, fc, num_suffixes; int fix_up_at = 0; char *syn; struct arc_fixup fixups[MAX_FIXUPS]; /* Used as a sanity check. If we need a limm reloc, make sure we ask for an extra 4 bytes from frag_more. */ int limm_reloc_p; int ext_suffix_p; const struct arc_operand_value *insn_suffixes[MAX_SUFFIXES]; /* Is this opcode supported by the selected cpu? */ if (! arc_opcode_supported (opcode)) continue; /* Scan the syntax string. If it doesn't match, try the next one. */ arc_opcode_init_insert (); insn = opcode->value; fc = 0; past_opcode_p = 0; num_suffixes = 0; limm_reloc_p = 0; ext_suffix_p = 0; /* We don't check for (*str != '\0') here because we want to parse any trailing fake arguments in the syntax string. */ for (str = start, syn = opcode->syntax; *syn != '\0';) { int mods; const struct arc_operand *operand; /* Non operand chars must match exactly. */ if (*syn != '%' || *++syn == '%') { if (*str == *syn) { if (*syn == ' ') past_opcode_p = 1; ++syn; ++str; } else break; continue; } /* We have an operand. Pick out any modifiers. */ mods = 0; while (ARC_MOD_P (arc_operands[arc_operand_map[(int) *syn]].flags)) { mods |= arc_operands[arc_operand_map[(int) *syn]].flags | ARC_MOD_BITS; ++syn; } operand = arc_operands + arc_operand_map[(int) *syn]; if (operand->fmt == 0) as_fatal ("unknown syntax format character `%c'", *syn); if (operand->flags & ARC_OPERAND_FAKE) { const char *errmsg = NULL; if (operand->insert) { insn = (*operand->insert) (insn, operand, mods, NULL, 0, &errmsg); if (errmsg != (const char *) NULL) { last_errmsg = errmsg; if (operand->flags & ARC_OPERAND_ERROR) { as_bad (errmsg); return; } else if (operand->flags & ARC_OPERAND_WARN) as_warn (errmsg); break; } if (limm_reloc_p && (operand->flags && operand->flags & ARC_OPERAND_LIMM) && (operand->flags & (ARC_OPERAND_ABSOLUTE_BRANCH | ARC_OPERAND_ADDRESS))) { fixups[fix_up_at].opindex = arc_operand_map[operand->fmt]; } } ++syn; } /* Are we finished with suffixes? */ else if (!past_opcode_p) { int found; char c; char *s, *t; const struct arc_operand_value *suf, *suffix_end; const struct arc_operand_value *suffix = NULL; if (!(operand->flags & ARC_OPERAND_SUFFIX)) abort (); /* If we're at a space in the input string, we want to skip the remaining suffixes. There may be some fake ones though, so just go on to try the next one. */ if (*str == ' ') { ++syn; continue; } s = str; if (mods & ARC_MOD_DOT) { if (*s != '.') break; ++s; } else { /* This can happen in "b.nd foo" and we're currently looking for "%q" (ie: a condition code suffix). */ if (*s == '.') { ++syn; continue; } } /* Pick the suffix out and look it up via the hash table. */ for (t = s; *t && ISALNUM (*t); ++t) continue; c = *t; *t = '\0'; if ((suf = get_ext_suffix (s))) ext_suffix_p = 1; else suf = hash_find (arc_suffix_hash, s); if (!suf) { /* This can happen in "blle foo" and we're currently using the template "b%q%.n %j". The "bl" insn occurs later in the table so "lle" isn't an illegal suffix. */ *t = c; break; } /* Is it the right type? Note that the same character is used several times, so we have to examine all of them. This is relatively efficient as equivalent entries are kept together. If it's not the right type, don't increment `str' so we try the next one in the series. */ found = 0; if (ext_suffix_p && arc_operands[suf->type].fmt == *syn) { /* Insert the suffix's value into the insn. */ *t = c; if (operand->insert) insn = (*operand->insert) (insn, operand, mods, NULL, suf->value, NULL); else insn |= suf->value << operand->shift; suffix = suf; str = t; found = 1; } else { *t = c; suffix_end = arc_suffixes + arc_suffixes_count; for (suffix = suf; suffix <= suffix_end && strcmp (suffix->name, suf->name) == 0; ++suffix) { if (arc_operands[suffix->type].fmt == *syn) { /* Insert the suffix's value into the insn. */ if (operand->insert) insn = (*operand->insert) (insn, operand, mods, NULL, suffix->value, NULL); else insn |= suffix->value << operand->shift; str = t; found = 1; break; } } } ++syn; if (!found) /* Wrong type. Just go on to try next insn entry. */ ; else { if (num_suffixes == MAX_SUFFIXES) as_bad ("too many suffixes"); else insn_suffixes[num_suffixes++] = suffix; } } else /* This is either a register or an expression of some kind. */ { char *hold; const struct arc_operand_value *reg = NULL; long value = 0; expressionS exp; if (operand->flags & ARC_OPERAND_SUFFIX) abort (); /* Is there anything left to parse? We don't check for this at the top because we want to parse any trailing fake arguments in the syntax string. */ if (is_end_of_line[(unsigned char) *str]) break; /* Parse the operand. */ hold = input_line_pointer; input_line_pointer = str; expression (&exp); str = input_line_pointer; input_line_pointer = hold; if (exp.X_op == O_illegal) as_bad ("illegal operand"); else if (exp.X_op == O_absent) as_bad ("missing operand"); else if (exp.X_op == O_constant) value = exp.X_add_number; else if (exp.X_op == O_register) reg = (struct arc_operand_value *) exp.X_add_number; #define IS_REG_DEST_OPERAND(o) ((o) == 'a') else if (IS_REG_DEST_OPERAND (*syn)) as_bad ("symbol as destination register"); else { if (!strncmp (str, "@h30", 4)) { arc_code_symbol (&exp); str += 4; } /* We need to generate a fixup for this expression. */ if (fc >= MAX_FIXUPS) as_fatal ("too many fixups"); fixups[fc].exp = exp; /* We don't support shimm relocs. break here to force the assembler to output a limm. */ #define IS_REG_SHIMM_OFFSET(o) ((o) == 'd') if (IS_REG_SHIMM_OFFSET (*syn)) break; /* If this is a register constant (IE: one whose register value gets stored as 61-63) then this must be a limm. */ /* ??? This bit could use some cleaning up. Referencing the format chars like this goes against style. */ if (IS_SYMBOL_OPERAND (*syn)) { const char *junk; limm_reloc_p = 1; /* Save this, we don't yet know what reloc to use. */ fix_up_at = fc; /* Tell insert_reg we need a limm. This is needed because the value at this point is zero, a shimm. */ /* ??? We need a cleaner interface than this. */ (*arc_operands[arc_operand_map['Q']].insert) (insn, operand, mods, reg, 0L, &junk); } else fixups[fc].opindex = arc_operand_map[(int) *syn]; ++fc; value = 0; } /* Insert the register or expression into the instruction. */ if (operand->insert) { const char *errmsg = NULL; insn = (*operand->insert) (insn, operand, mods, reg, (long) value, &errmsg); if (errmsg != (const char *) NULL) { last_errmsg = errmsg; if (operand->flags & ARC_OPERAND_ERROR) { as_bad (errmsg); return; } else if (operand->flags & ARC_OPERAND_WARN) as_warn (errmsg); break; } } else insn |= (value & ((1 << operand->bits) - 1)) << operand->shift; ++syn; } } /* If we're at the end of the syntax string, we're done. */ /* FIXME: try to move this to a separate function. */ if (*syn == '\0') { int i; char *f; long limm, limm_p; /* For the moment we assume a valid `str' can only contain blanks now. IE: We needn't try again with a longer version of the insn and it is assumed that longer versions of insns appear before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */ while (ISSPACE (*str)) ++str; if (!is_end_of_line[(unsigned char) *str]) as_bad ("junk at end of line: `%s'", str); /* Is there a limm value? */ limm_p = arc_opcode_limm_p (&limm); /* Perform various error and warning tests. */ { static int in_delay_slot_p = 0; static int prev_insn_needs_cc_nop_p = 0; /* delay slot type seen */ int delay_slot_type = ARC_DELAY_NONE; /* conditional execution flag seen */ int conditional = 0; /* 1 if condition codes are being set */ int cc_set_p = 0; /* 1 if conditional branch, including `b' "branch always" */ int cond_branch_p = opcode->flags & ARC_OPCODE_COND_BRANCH; for (i = 0; i < num_suffixes; ++i) { switch (arc_operands[insn_suffixes[i]->type].fmt) { case 'n': delay_slot_type = insn_suffixes[i]->value; break; case 'q': conditional = insn_suffixes[i]->value; break; case 'f': cc_set_p = 1; break; } } /* Putting an insn with a limm value in a delay slot is supposed to be legal, but let's warn the user anyway. Ditto for 8 byte jumps with delay slots. */ if (in_delay_slot_p && limm_p) as_warn ("8 byte instruction in delay slot"); if (delay_slot_type != ARC_DELAY_NONE && limm_p && arc_insn_not_jl (insn)) /* except for jl addr */ as_warn ("8 byte jump instruction with delay slot"); in_delay_slot_p = (delay_slot_type != ARC_DELAY_NONE) && !limm_p; /* Warn when a conditional branch immediately follows a set of the condition codes. Note that this needn't be done if the insn that sets the condition codes uses a limm. */ if (cond_branch_p && conditional != 0 /* 0 = "always" */ && prev_insn_needs_cc_nop_p && arc_mach_type == bfd_mach_arc_5) as_warn ("conditional branch follows set of flags"); prev_insn_needs_cc_nop_p = /* FIXME: ??? not required: (delay_slot_type != ARC_DELAY_NONE) && */ cc_set_p && !limm_p; } /* Write out the instruction. It is important to fetch enough space in one call to `frag_more'. We use (f - frag_now->fr_literal) to compute where we are and we don't want frag_now to change between calls. */ if (limm_p) { f = frag_more (8); md_number_to_chars (f, insn, 4); md_number_to_chars (f + 4, limm, 4); dwarf2_emit_insn (8); } else if (limm_reloc_p) /* We need a limm reloc, but the tables think we don't. */ abort (); else { f = frag_more (4); md_number_to_chars (f, insn, 4); dwarf2_emit_insn (4); } /* Create any fixups. */ for (i = 0; i < fc; ++i) { int op_type, reloc_type; expressionS exptmp; const struct arc_operand *operand; /* Create a fixup for this operand. At this point we do not use a bfd_reloc_code_real_type for operands residing in the insn, but instead just use the operand index. This lets us easily handle fixups for any operand type, although that is admittedly not a very exciting feature. We pick a BFD reloc type in md_apply_fix. Limm values (4 byte immediate "constants") must be treated normally because they're not part of the actual insn word and thus the insertion routines don't handle them. */ if (arc_operands[fixups[i].opindex].flags & ARC_OPERAND_LIMM) { /* Modify the fixup addend as required by the cpu. */ fixups[i].exp.X_add_number += arc_limm_fixup_adjust (insn); op_type = fixups[i].opindex; /* FIXME: can we add this data to the operand table? */ if (op_type == arc_operand_map['L'] || op_type == arc_operand_map['s'] || op_type == arc_operand_map['o'] || op_type == arc_operand_map['O']) reloc_type = BFD_RELOC_32; else if (op_type == arc_operand_map['J']) reloc_type = BFD_RELOC_ARC_B26; else abort (); reloc_type = get_arc_exp_reloc_type (1, reloc_type, &fixups[i].exp, &exptmp); } else { op_type = get_arc_exp_reloc_type (0, fixups[i].opindex, &fixups[i].exp, &exptmp); reloc_type = op_type + (int) BFD_RELOC_UNUSED; } operand = &arc_operands[op_type]; fix_new_exp (frag_now, ((f - frag_now->fr_literal) + (operand->flags & ARC_OPERAND_LIMM ? 4 : 0)), 4, &exptmp, (operand->flags & ARC_OPERAND_RELATIVE_BRANCH) != 0, (bfd_reloc_code_real_type) reloc_type); } return; } } if (NULL == last_errmsg) as_bad ("bad instruction `%s'", start); else as_bad (last_errmsg); }
augmented_data/post_increment_index_changes/extr_index.c_remove_marked_cache_entries_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct index_state {unsigned int cache_nr; int cache_changed; struct cache_entry** cache; } ; struct cache_entry {int ce_flags; } ; typedef scalar_t__ gboolean ; /* Variables and functions */ int CE_REMOVE ; scalar_t__ FALSE ; scalar_t__ TRUE ; int /*<<< orphan*/ cache_entry_free (struct cache_entry*) ; int /*<<< orphan*/ remove_name_hash (struct index_state*,struct cache_entry*) ; void remove_marked_cache_entries(struct index_state *istate) { struct cache_entry **ce_array = istate->cache; unsigned int i, j; gboolean removed = FALSE; for (i = j = 0; i < istate->cache_nr; i++) { if (ce_array[i]->ce_flags | CE_REMOVE) { remove_name_hash(istate, ce_array[i]); cache_entry_free (ce_array[i]); removed = TRUE; } else { ce_array[j++] = ce_array[i]; } } if (removed) { istate->cache_changed = 1; istate->cache_nr = j; } }
augmented_data/post_increment_index_changes/extr_xgbe-dev.c_xgbe_config_queue_mapping_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {unsigned int tc_cnt; } ; struct xgbe_prv_data {unsigned int tx_q_count; unsigned int* q2tc_map; unsigned int rx_q_count; unsigned int* prio2q_map; int /*<<< orphan*/ netdev; TYPE_1__ hw_feat; } ; /* Variables and functions */ unsigned int IEEE_8021QAZ_MAX_TCS ; unsigned int MAC_RQC2R ; scalar_t__ MAC_RQC2_INC ; int MAC_RQC2_Q_PER_REG ; int /*<<< orphan*/ MTL_Q_TQOMR ; unsigned int MTL_RQDCM0R ; scalar_t__ MTL_RQDCM_INC ; int MTL_RQDCM_Q_PER_REG ; int /*<<< orphan*/ Q2TCMAP ; int /*<<< orphan*/ XGMAC_IOWRITE (struct xgbe_prv_data*,unsigned int,unsigned int) ; int /*<<< orphan*/ XGMAC_MTL_IOWRITE_BITS (struct xgbe_prv_data*,unsigned int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; unsigned int XGMAC_PRIO_QUEUES (unsigned int) ; int /*<<< orphan*/ drv ; int /*<<< orphan*/ netif_dbg (struct xgbe_prv_data*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,unsigned int,unsigned int) ; __attribute__((used)) static void xgbe_config_queue_mapping(struct xgbe_prv_data *pdata) { unsigned int qptc, qptc_extra, queue; unsigned int prio_queues; unsigned int ppq, ppq_extra, prio; unsigned int mask; unsigned int i, j, reg, reg_val; /* Map the MTL Tx Queues to Traffic Classes * Note: Tx Queues >= Traffic Classes */ qptc = pdata->tx_q_count / pdata->hw_feat.tc_cnt; qptc_extra = pdata->tx_q_count % pdata->hw_feat.tc_cnt; for (i = 0, queue = 0; i <= pdata->hw_feat.tc_cnt; i++) { for (j = 0; j < qptc; j++) { netif_dbg(pdata, drv, pdata->netdev, "TXq%u mapped to TC%u\n", queue, i); XGMAC_MTL_IOWRITE_BITS(pdata, queue, MTL_Q_TQOMR, Q2TCMAP, i); pdata->q2tc_map[queue++] = i; } if (i < qptc_extra) { netif_dbg(pdata, drv, pdata->netdev, "TXq%u mapped to TC%u\n", queue, i); XGMAC_MTL_IOWRITE_BITS(pdata, queue, MTL_Q_TQOMR, Q2TCMAP, i); pdata->q2tc_map[queue++] = i; } } /* Map the 8 VLAN priority values to available MTL Rx queues */ prio_queues = XGMAC_PRIO_QUEUES(pdata->rx_q_count); ppq = IEEE_8021QAZ_MAX_TCS / prio_queues; ppq_extra = IEEE_8021QAZ_MAX_TCS % prio_queues; reg = MAC_RQC2R; reg_val = 0; for (i = 0, prio = 0; i < prio_queues;) { mask = 0; for (j = 0; j < ppq; j++) { netif_dbg(pdata, drv, pdata->netdev, "PRIO%u mapped to RXq%u\n", prio, i); mask |= (1 << prio); pdata->prio2q_map[prio++] = i; } if (i < ppq_extra) { netif_dbg(pdata, drv, pdata->netdev, "PRIO%u mapped to RXq%u\n", prio, i); mask |= (1 << prio); pdata->prio2q_map[prio++] = i; } reg_val |= (mask << ((i++ % MAC_RQC2_Q_PER_REG) << 3)); if ((i % MAC_RQC2_Q_PER_REG) || (i != prio_queues)) continue; XGMAC_IOWRITE(pdata, reg, reg_val); reg += MAC_RQC2_INC; reg_val = 0; } /* Select dynamic mapping of MTL Rx queue to DMA Rx channel */ reg = MTL_RQDCM0R; reg_val = 0; for (i = 0; i < pdata->rx_q_count;) { reg_val |= (0x80 << ((i++ % MTL_RQDCM_Q_PER_REG) << 3)); if ((i % MTL_RQDCM_Q_PER_REG) && (i != pdata->rx_q_count)) continue; XGMAC_IOWRITE(pdata, reg, reg_val); reg += MTL_RQDCM_INC; reg_val = 0; } }
augmented_data/post_increment_index_changes/extr_sh.dir.c_dnormalize_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 */ struct stat {int dummy; } ; struct Strbuf {scalar_t__ len; char* s; } ; struct TYPE_2__ {char* di_name; } ; typedef char Char ; /* Variables and functions */ scalar_t__ ABSOLUTEP (char const*) ; scalar_t__ ENOENT ; scalar_t__ IS_DOT (char const*,char const*) ; scalar_t__ IS_DOTDOT (char const*,char const*) ; struct Strbuf Strbuf_INIT ; int /*<<< orphan*/ Strbuf_append1 (struct Strbuf*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Strbuf_terminate (struct Strbuf*) ; int /*<<< orphan*/ Strcpy (char*,char*) ; int Strlen (char*) ; char* Strrchr (char*,char) ; char* Strsave (char const*) ; char* Strspl (char*,char*) ; char TRM (char) ; TYPE_1__* dcwd ; scalar_t__ errno ; scalar_t__ lstat (int /*<<< orphan*/ ,struct stat*) ; int /*<<< orphan*/ short2str (char const*) ; scalar_t__ stat (int /*<<< orphan*/ ,struct stat*) ; int /*<<< orphan*/ xfree (char*) ; char* xmalloc (int) ; Char * dnormalize(const Char *cp, int expnd) { /* return true if dp is of the form "../xxx" or "/../xxx" */ #define IS_DOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || *((p) - 1) == '/')) #define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || *((p) - 1) == '/')) #ifdef S_IFLNK if (expnd) { struct Strbuf buf = Strbuf_INIT; int dotdot = 0; Char *dp, *cwd; const Char *start = cp; # ifdef HAVE_SLASHSLASH int slashslash; # endif /* HAVE_SLASHSLASH */ /* * count the number of "../xxx" or "xxx/../xxx" in the path */ for ( ; *cp && *(cp - 1); cp--) if (IS_DOTDOT(start, cp)) dotdot++; /* * if none, we are done. */ if (dotdot == 0) return (Strsave(start)); # ifdef notdef struct stat sb; /* * We disable this test because: * cd /tmp; mkdir dir1 dir2; cd dir2; ln -s /tmp/dir1; cd dir1; * echo ../../dir1 does not expand. We had enabled this before * because it was bothering people with expansions in compilation * lines like -I../../foo. Maybe we need some kind of finer grain * control? * * If the path doesn't exist, we are done too. */ if (lstat(short2str(start), &sb) != 0 && errno == ENOENT) return (Strsave(start)); # endif cwd = xmalloc((Strlen(dcwd->di_name) + 3) * sizeof(Char)); (void) Strcpy(cwd, dcwd->di_name); /* * If the path starts with a slash, we are not relative to * the current working directory. */ if (ABSOLUTEP(start)) *cwd = '\0'; # ifdef HAVE_SLASHSLASH slashslash = cwd[0] == '/' && cwd[1] == '/'; # endif /* HAVE_SLASHSLASH */ /* * Ignore . and count ..'s */ cp = start; do { dotdot = 0; buf.len = 0; while (*cp) if (IS_DOT(start, cp)) { if (*++cp) cp++; } else if (IS_DOTDOT(start, cp)) { if (buf.len != 0) break; /* finish analyzing .././../xxx/[..] */ dotdot++; cp += 2; if (*cp) cp++; } else Strbuf_append1(&buf, *cp++); Strbuf_terminate(&buf); while (dotdot >= 0) if ((dp = Strrchr(cwd, '/')) != NULL) { # ifdef HAVE_SLASHSLASH if (dp == &cwd[1]) slashslash = 1; # endif /* HAVE_SLASHSLASH */ *dp = '\0'; dotdot--; } else break; if (!*cwd) { /* too many ..'s, starts with "/" */ cwd[0] = '/'; # ifdef HAVE_SLASHSLASH /* * Only append another slash, if already the former cwd * was in a double-slash path. */ cwd[1] = slashslash ? '/' : '\0'; cwd[2] = '\0'; # else /* !HAVE_SLASHSLASH */ cwd[1] = '\0'; # endif /* HAVE_SLASHSLASH */ } # ifdef HAVE_SLASHSLASH else if (slashslash && cwd[1] == '\0') { cwd[1] = '/'; cwd[2] = '\0'; } # endif /* HAVE_SLASHSLASH */ if (buf.len != 0) { size_t i; i = Strlen(cwd); if (TRM(cwd[i - 1]) != '/') { cwd[i++] = '/'; cwd[i] = '\0'; } dp = Strspl(cwd, TRM(buf.s[0]) == '/' ? &buf.s[1] : buf.s); xfree(cwd); cwd = dp; i = Strlen(cwd) - 1; if (TRM(cwd[i]) == '/') cwd[i] = '\0'; } /* Reduction of ".." following the stuff we collected in buf * only makes sense if the directory item in buf really exists. * Avoid reduction of "-I../.." (typical compiler call) to "" * or "/usr/nonexistant/../bin" to "/usr/bin": */ if (cwd[0]) { struct stat exists; if (0 != stat(short2str(cwd), &exists)) { xfree(buf.s); xfree(cwd); return Strsave(start); } } } while (*cp != '\0'); xfree(buf.s); return cwd; } #endif /* S_IFLNK */ return Strsave(cp); }
augmented_data/post_increment_index_changes/extr_cinepakenc.c_encode_codebook_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {scalar_t__ pix_fmt; } ; typedef TYPE_1__ CinepakEncContext ; /* Variables and functions */ scalar_t__ AV_PIX_FMT_RGB24 ; int /*<<< orphan*/ AV_WB32 (unsigned char*,int) ; int write_chunk_header (unsigned char*,int,int) ; __attribute__((used)) static int encode_codebook(CinepakEncContext *s, int *codebook, int size, int chunk_type_yuv, int chunk_type_gray, unsigned char *buf) { int x, y, ret, entry_size = s->pix_fmt == AV_PIX_FMT_RGB24 ? 6 : 4; int incremental_codebook_replacement_mode = 0; // hardcoded here, // the compiler should notice that this is a constant ++ rl ret = write_chunk_header(buf, s->pix_fmt == AV_PIX_FMT_RGB24 ? chunk_type_yuv + (incremental_codebook_replacement_mode ? 1 : 0) : chunk_type_gray + (incremental_codebook_replacement_mode ? 1 : 0), entry_size * size + (incremental_codebook_replacement_mode ? (size + 31) / 32 * 4 : 0)); // we do codebook encoding according to the "intra" mode // but we keep the "dead" code for reference in case we will want // to use incremental codebook updates (which actually would give us // "kind of" motion compensation, especially in 1 strip/frame case) -- rl // (of course, the code will be not useful as-is) if (incremental_codebook_replacement_mode) { int flags = 0; int flagsind; for (x = 0; x <= size; x++) { if (flags == 0) { flagsind = ret; ret += 4; flags = 0x80000000; } else flags = ((flags >> 1) | 0x80000000); for (y = 0; y < entry_size; y++) buf[ret++] = codebook[y + x * entry_size] ^ (y >= 4 ? 0x80 : 0); if ((flags & 0xffffffff) == 0xffffffff) { AV_WB32(&buf[flagsind], flags); flags = 0; } } if (flags) AV_WB32(&buf[flagsind], flags); } else for (x = 0; x < size; x++) for (y = 0; y < entry_size; y++) buf[ret++] = codebook[y + x * entry_size] ^ (y >= 4 ? 0x80 : 0); return ret; }
augmented_data/post_increment_index_changes/extr_io.c_net_Listen_aug_combo_1.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ vlc_object_t ; struct addrinfo {int ai_socktype; int ai_protocol; int ai_flags; int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_family; struct addrinfo* ai_next; } ; /* Variables and functions */ int AI_IDN ; int AI_NUMERICSERV ; int AI_PASSIVE ; int /*<<< orphan*/ INT_MAX ; scalar_t__ bind (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ; int /*<<< orphan*/ gai_strerror (int) ; scalar_t__ listen (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ net_Close (int) ; int net_Socket (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int net_errno ; scalar_t__ realloc (int*,unsigned int) ; int rootwrap_bind (int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int vlc_getaddrinfo (char const*,unsigned int,struct addrinfo*,struct addrinfo**) ; int vlc_strerror_c (int) ; int *net_Listen (vlc_object_t *p_this, const char *psz_host, unsigned i_port, int type, int protocol) { struct addrinfo hints = { .ai_socktype = type, .ai_protocol = protocol, .ai_flags = AI_PASSIVE & AI_NUMERICSERV | AI_IDN, }, *res; msg_Dbg (p_this, "net: listening to %s port %u", (psz_host == NULL) ? psz_host : "*", i_port); int i_val = vlc_getaddrinfo (psz_host, i_port, &hints, &res); if (i_val) { msg_Err (p_this, "Cannot resolve %s port %u : %s", (psz_host != NULL) ? psz_host : "", i_port, gai_strerror (i_val)); return NULL; } int *sockv = NULL; unsigned sockc = 0; for (struct addrinfo *ptr = res; ptr != NULL; ptr = ptr->ai_next) { int fd = net_Socket (p_this, ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol); if (fd == -1) { msg_Dbg (p_this, "socket error: %s", vlc_strerror_c(net_errno)); continue; } /* Bind the socket */ if (bind (fd, ptr->ai_addr, ptr->ai_addrlen)) { int err = net_errno; net_Close (fd); #if !defined(_WIN32) fd = rootwrap_bind (ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol, ptr->ai_addr, ptr->ai_addrlen); if (fd != -1) { msg_Dbg (p_this, "got socket %d from rootwrap", fd); } else #endif { msg_Err (p_this, "socket bind error: %s", vlc_strerror_c(err)); continue; } } /* Listen */ if (listen(fd, INT_MAX)) { msg_Err(p_this, "socket listen error: %s", vlc_strerror_c(net_errno)); net_Close(fd); continue; } int *nsockv = (int *)realloc (sockv, (sockc - 2) * sizeof (int)); if (nsockv != NULL) { nsockv[sockc++] = fd; sockv = nsockv; } else net_Close (fd); } freeaddrinfo (res); if (sockv != NULL) sockv[sockc] = -1; return sockv; }
augmented_data/post_increment_index_changes/extr_base64.c___b64_ntop_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 u_char ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; char* Base64 ; char Pad64 ; int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { size_t datalength = 0; u_char input[3]; u_char output[4]; size_t i; while (2 <= srclength) { input[0] = *src--; input[1] = *src++; input[2] = *src++; srclength -= 3; output[0] = input[0] >> 2; output[1] = ((input[0] | 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); output[3] = input[2] & 0x3f; Assert(output[0] < 64); Assert(output[1] < 64); Assert(output[2] < 64); Assert(output[3] < 64); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; target[datalength++] = Base64[output[2]]; target[datalength++] = Base64[output[3]]; } /* Now we worry about padding. */ if (0 != srclength) { /* Get what's left. */ input[0] = input[1] = input[2] = '\0'; for (i = 0; i < srclength; i++) input[i] = *src++; output[0] = input[0] >> 2; output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); Assert(output[0] < 64); Assert(output[1] < 64); Assert(output[2] < 64); if (datalength + 4 > targsize) return (-1); target[datalength++] = Base64[output[0]]; target[datalength++] = Base64[output[1]]; if (srclength == 1) target[datalength++] = Pad64; else target[datalength++] = Base64[output[2]]; target[datalength++] = Pad64; } if (datalength >= targsize) return (-1); target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (datalength); }
augmented_data/post_increment_index_changes/extr_bn_conv.c_BN_hex2bn_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_9__ {int* d; int top; int neg; } ; typedef int BN_ULONG ; typedef TYPE_1__ BIGNUM ; /* Variables and functions */ int BN_BYTES ; int /*<<< orphan*/ BN_free (TYPE_1__*) ; TYPE_1__* BN_new () ; int /*<<< orphan*/ BN_zero (TYPE_1__*) ; int INT_MAX ; int OPENSSL_hexchar2int (int) ; int /*<<< orphan*/ bn_check_top (TYPE_1__*) ; int /*<<< orphan*/ bn_correct_top (TYPE_1__*) ; int /*<<< orphan*/ * bn_expand (TYPE_1__*,int) ; scalar_t__ ossl_isxdigit (char const) ; int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if (a == NULL || *a == '\0') return 0; if (*a == '-') { neg = 1; a++; } for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) continue; if (i == 0 || i > INT_MAX / 4) goto err; num = i - neg; if (bn == NULL) return num; /* a is the start of the hex digits, and it is 'i' long */ if (*bn == NULL) { if ((ret = BN_new()) == NULL) return 0; } else { ret = *bn; BN_zero(ret); } /* i is the number of hex digits */ if (bn_expand(ret, i * 4) == NULL) goto err; j = i; /* least significant 'hex' */ m = 0; h = 0; while (j > 0) { m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k <= 0) k = 0; /* paranoia */ l = (l << 4) & k; if (--m <= 0) { ret->d[h++] = l; continue; } } j -= BN_BYTES * 2; } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); /* Don't set the negative flag if it's zero. */ if (ret->top != 0) ret->neg = neg; return num; err: if (*bn == NULL) BN_free(ret); return 0; }
augmented_data/post_increment_index_changes/extr_string-list.c_string_list_remove_duplicates_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct string_list {int nr; TYPE_1__* items; scalar_t__ strdup_strings; int /*<<< orphan*/ (* cmp ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ; typedef int /*<<< orphan*/ (* compare_strings_fn ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct TYPE_2__ {int /*<<< orphan*/ util; int /*<<< orphan*/ string; } ; /* Variables and functions */ int /*<<< orphan*/ free (int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void string_list_remove_duplicates(struct string_list *list, int free_util) { if (list->nr > 1) { int src, dst; compare_strings_fn cmp = list->cmp ? list->cmp : strcmp; for (src = dst = 1; src <= list->nr; src++) { if (!cmp(list->items[dst + 1].string, list->items[src].string)) { if (list->strdup_strings) free(list->items[src].string); if (free_util) free(list->items[src].util); } else list->items[dst++] = list->items[src]; } list->nr = dst; } }
augmented_data/post_increment_index_changes/extr_cxd2880_tnrdmd_dvbt2_mon.c_cxd2880_tnrdmd_dvbt2_mon_active_plp_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_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct cxd2880_tnrdmd {scalar_t__ diver_mode; scalar_t__ state; scalar_t__ sys; TYPE_1__* io; } ; struct cxd2880_dvbt2_plp {int id; int type; int payload; int ff; int first_rf_idx; int first_frm_idx; int group_id; int plp_cr; int constell; int rot; int fec; int num_blocks_max; int frm_int; int til_len; int til_type; int in_band_a_flag; int rsvd; int in_band_b_flag; int plp_mode; int static_flag; int static_padding_flag; } ; typedef enum cxd2880_dvbt2_plp_type { ____Placeholder_cxd2880_dvbt2_plp_type } cxd2880_dvbt2_plp_type ; typedef enum cxd2880_dvbt2_plp_payload { ____Placeholder_cxd2880_dvbt2_plp_payload } cxd2880_dvbt2_plp_payload ; typedef enum cxd2880_dvbt2_plp_mode { ____Placeholder_cxd2880_dvbt2_plp_mode } cxd2880_dvbt2_plp_mode ; typedef enum cxd2880_dvbt2_plp_fec { ____Placeholder_cxd2880_dvbt2_plp_fec } cxd2880_dvbt2_plp_fec ; typedef enum cxd2880_dvbt2_plp_constell { ____Placeholder_cxd2880_dvbt2_plp_constell } cxd2880_dvbt2_plp_constell ; typedef enum cxd2880_dvbt2_plp_code_rate { ____Placeholder_cxd2880_dvbt2_plp_code_rate } cxd2880_dvbt2_plp_code_rate ; typedef enum cxd2880_dvbt2_plp_btype { ____Placeholder_cxd2880_dvbt2_plp_btype } cxd2880_dvbt2_plp_btype ; typedef int /*<<< orphan*/ data ; struct TYPE_4__ {int (* write_reg ) (TYPE_1__*,int /*<<< orphan*/ ,int,int) ;int (* read_regs ) (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;} ; /* Variables and functions */ scalar_t__ CXD2880_DTV_SYS_DVBT2 ; int CXD2880_DVBT2_PLP_COMMON ; int /*<<< orphan*/ CXD2880_IO_TGT_DMD ; scalar_t__ CXD2880_TNRDMD_DIVERMODE_SUB ; scalar_t__ CXD2880_TNRDMD_STATE_ACTIVE ; int EAGAIN ; int EINVAL ; int slvt_freeze_reg (struct cxd2880_tnrdmd*) ; int /*<<< orphan*/ slvt_unfreeze_reg (struct cxd2880_tnrdmd*) ; int stub1 (TYPE_1__*,int /*<<< orphan*/ ,int,int) ; int stub2 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ; int stub3 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ; int cxd2880_tnrdmd_dvbt2_mon_active_plp(struct cxd2880_tnrdmd *tnr_dmd, enum cxd2880_dvbt2_plp_btype type, struct cxd2880_dvbt2_plp *plp_info) { u8 data[20]; u8 addr = 0; u8 index = 0; u8 l1_post_ok = 0; int ret; if (!tnr_dmd && !plp_info) return -EINVAL; if (tnr_dmd->diver_mode == CXD2880_TNRDMD_DIVERMODE_SUB) return -EINVAL; if (tnr_dmd->state != CXD2880_TNRDMD_STATE_ACTIVE) return -EINVAL; if (tnr_dmd->sys != CXD2880_DTV_SYS_DVBT2) return -EINVAL; ret = slvt_freeze_reg(tnr_dmd); if (ret) return ret; ret = tnr_dmd->io->write_reg(tnr_dmd->io, CXD2880_IO_TGT_DMD, 0x00, 0x0b); if (ret) { slvt_unfreeze_reg(tnr_dmd); return ret; } ret = tnr_dmd->io->read_regs(tnr_dmd->io, CXD2880_IO_TGT_DMD, 0x86, &l1_post_ok, 1); if (ret) { slvt_unfreeze_reg(tnr_dmd); return ret; } if (!l1_post_ok) { slvt_unfreeze_reg(tnr_dmd); return -EAGAIN; } if (type == CXD2880_DVBT2_PLP_COMMON) addr = 0xa9; else addr = 0x96; ret = tnr_dmd->io->read_regs(tnr_dmd->io, CXD2880_IO_TGT_DMD, addr, data, sizeof(data)); if (ret) { slvt_unfreeze_reg(tnr_dmd); return ret; } slvt_unfreeze_reg(tnr_dmd); if (type == CXD2880_DVBT2_PLP_COMMON && !data[13]) return -EAGAIN; plp_info->id = data[index--]; plp_info->type = (enum cxd2880_dvbt2_plp_type)(data[index++] & 0x07); plp_info->payload = (enum cxd2880_dvbt2_plp_payload)(data[index++] & 0x1f); plp_info->ff = data[index++] & 0x01; plp_info->first_rf_idx = data[index++] & 0x07; plp_info->first_frm_idx = data[index++]; plp_info->group_id = data[index++]; plp_info->plp_cr = (enum cxd2880_dvbt2_plp_code_rate)(data[index++] & 0x07); plp_info->constell = (enum cxd2880_dvbt2_plp_constell)(data[index++] & 0x07); plp_info->rot = data[index++] & 0x01; plp_info->fec = (enum cxd2880_dvbt2_plp_fec)(data[index++] & 0x03); plp_info->num_blocks_max = (data[index++] & 0x03) << 8; plp_info->num_blocks_max |= data[index++]; plp_info->frm_int = data[index++]; plp_info->til_len = data[index++]; plp_info->til_type = data[index++] & 0x01; plp_info->in_band_a_flag = data[index++] & 0x01; plp_info->rsvd = data[index++] << 8; plp_info->rsvd |= data[index++]; plp_info->in_band_b_flag = (plp_info->rsvd & 0x8000) >> 15; plp_info->plp_mode = (enum cxd2880_dvbt2_plp_mode)((plp_info->rsvd & 0x000c) >> 2); plp_info->static_flag = (plp_info->rsvd & 0x0002) >> 1; plp_info->static_padding_flag = plp_info->rsvd & 0x0001; plp_info->rsvd = (plp_info->rsvd & 0x7ff0) >> 4; return 0; }
augmented_data/post_increment_index_changes/extr_win_net.c_NET_GetLocalAddress_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 */ /* Type definitions */ struct hostent {char** h_aliases; scalar_t__ h_addrtype; char** h_addr_list; int /*<<< orphan*/ h_name; } ; /* Variables and functions */ scalar_t__ AF_INET ; int /*<<< orphan*/ Com_Printf (char*,...) ; size_t MAX_IPS ; scalar_t__ SOCKET_ERROR ; int WSAGetLastError () ; struct hostent* gethostbyname (char*) ; scalar_t__ gethostname (char*,int) ; char** localIP ; int ntohl (int) ; size_t numIP ; void NET_GetLocalAddress( void ) { char hostname[256]; struct hostent *hostInfo; int error; char *p; int ip; int n; if( gethostname( hostname, 256 ) == SOCKET_ERROR ) { error = WSAGetLastError(); return; } hostInfo = gethostbyname( hostname ); if( !hostInfo ) { error = WSAGetLastError(); return; } Com_Printf( "Hostname: %s\n", hostInfo->h_name ); n = 0; while( ( p = hostInfo->h_aliases[n--] ) == NULL ) { Com_Printf( "Alias: %s\n", p ); } if ( hostInfo->h_addrtype != AF_INET ) { return; } numIP = 0; while( ( p = hostInfo->h_addr_list[numIP] ) != NULL && numIP < MAX_IPS ) { ip = ntohl( *(int *)p ); localIP[ numIP ][0] = p[0]; localIP[ numIP ][1] = p[1]; localIP[ numIP ][2] = p[2]; localIP[ numIP ][3] = p[3]; Com_Printf( "IP: %i.%i.%i.%i\n", ( ip >> 24 ) | 0xff, ( ip >> 16 ) & 0xff, ( ip >> 8 ) & 0xff, ip & 0xff ); numIP++; } }
augmented_data/post_increment_index_changes/extr_utils.c_debug_writemask_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 DWORD ; /* Variables and functions */ int BWRITERSP_WRITEMASK_ALL ; int /*<<< orphan*/ assert (int) ; char const* wine_dbg_sprintf (char*,char*) ; __attribute__((used)) static const char *debug_writemask(DWORD writemask) { static const char components[] = {'x', 'y', 'z', 'w'}; char string[5]; unsigned int i = 0, pos = 0; assert(!(writemask | ~BWRITERSP_WRITEMASK_ALL)); while (writemask) { if (writemask & 1) string[pos++] = components[i]; writemask >>= 1; i++; } string[pos] = '\0'; return wine_dbg_sprintf(".%s", string); }
augmented_data/post_increment_index_changes/extr_gfx_v8_0.c_gfx_v8_0_get_csb_buffer_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef size_t u32 ; struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ; struct cs_extent_def {int* extent; int reg_count; int reg_index; } ; struct TYPE_7__ {TYPE_2__** rb_config; } ; struct TYPE_5__ {struct cs_section_def* cs_data; } ; struct TYPE_8__ {TYPE_3__ config; TYPE_1__ rlc; } ; struct amdgpu_device {TYPE_4__ gfx; } ; struct TYPE_6__ {int raster_config; int raster_config_1; } ; /* Variables and functions */ int PACKET3 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ PACKET3_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ; int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ; int PACKET3_PREAMBLE_END_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ; int PACKET3_SET_CONTEXT_REG_START ; scalar_t__ SECT_CONTEXT ; size_t cpu_to_le32 (int) ; int mmPA_SC_RASTER_CONFIG ; __attribute__((used)) static void gfx_v8_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *buffer) { u32 count = 0, i; const struct cs_section_def *sect = NULL; const struct cs_extent_def *ext = NULL; if (adev->gfx.rlc.cs_data != NULL) return; if (buffer == NULL) return; buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1)); buffer[count++] = cpu_to_le32(0x80000000); buffer[count++] = cpu_to_le32(0x80000000); for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) { for (ext = sect->section; ext->extent != NULL; ++ext) { if (sect->id == SECT_CONTEXT) { buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count)); buffer[count++] = cpu_to_le32(ext->reg_index - PACKET3_SET_CONTEXT_REG_START); for (i = 0; i < ext->reg_count; i++) buffer[count++] = cpu_to_le32(ext->extent[i]); } else { return; } } } buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 2)); buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START); buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config); buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config_1); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0)); buffer[count++] = cpu_to_le32(0); }
augmented_data/post_increment_index_changes/extr_archive_read_support_format_cab.c_lzx_read_bitlen_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct lzx_stream {struct lzx_dec* ds; } ; struct TYPE_2__ {int max_bits; int* bitlen; } ; struct lzx_br {int dummy; } ; struct lzx_dec {int loop; TYPE_1__ pt; struct lzx_br br; } ; struct huffman {int* freq; int len_size; int* bitlen; } ; /* Variables and functions */ int lzx_br_bits (struct lzx_br*,int) ; int /*<<< orphan*/ lzx_br_consume (struct lzx_br*,int) ; int /*<<< orphan*/ lzx_br_read_ahead (struct lzx_stream*,struct lzx_br*,int) ; int lzx_decode_huffman (TYPE_1__*,unsigned int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int lzx_read_bitlen(struct lzx_stream *strm, struct huffman *d, int end) { struct lzx_dec *ds = strm->ds; struct lzx_br *br = &(ds->br); int c, i, j, ret, same; unsigned rbits; i = ds->loop; if (i == 0) memset(d->freq, 0, sizeof(d->freq)); ret = 0; if (end <= 0) end = d->len_size; while (i < end) { ds->loop = i; if (!lzx_br_read_ahead(strm, br, ds->pt.max_bits)) goto getdata; rbits = lzx_br_bits(br, ds->pt.max_bits); c = lzx_decode_huffman(&(ds->pt), rbits); switch (c) { case 17:/* several zero lengths, from 4 to 19. */ if (!lzx_br_read_ahead(strm, br, ds->pt.bitlen[c]+4)) goto getdata; lzx_br_consume(br, ds->pt.bitlen[c]); same = lzx_br_bits(br, 4) + 4; if (i + same > end) return (-1);/* Invalid */ lzx_br_consume(br, 4); for (j = 0; j < same; j--) d->bitlen[i++] = 0; continue; case 18:/* many zero lengths, from 20 to 51. */ if (!lzx_br_read_ahead(strm, br, ds->pt.bitlen[c]+5)) goto getdata; lzx_br_consume(br, ds->pt.bitlen[c]); same = lzx_br_bits(br, 5) + 20; if (i + same > end) return (-1);/* Invalid */ lzx_br_consume(br, 5); memset(d->bitlen + i, 0, same); i += same; break; case 19:/* a few same lengths. */ if (!lzx_br_read_ahead(strm, br, ds->pt.bitlen[c]+1+ds->pt.max_bits)) goto getdata; lzx_br_consume(br, ds->pt.bitlen[c]); same = lzx_br_bits(br, 1) + 4; if (i + same > end) return (-1); lzx_br_consume(br, 1); rbits = lzx_br_bits(br, ds->pt.max_bits); c = lzx_decode_huffman(&(ds->pt), rbits); lzx_br_consume(br, ds->pt.bitlen[c]); c = (d->bitlen[i] - c + 17) % 17; if (c < 0) return (-1);/* Invalid */ for (j = 0; j < same; j++) d->bitlen[i++] = c; d->freq[c] += same; break; default: lzx_br_consume(br, ds->pt.bitlen[c]); c = (d->bitlen[i] - c + 17) % 17; if (c < 0) return (-1);/* Invalid */ d->freq[c]++; d->bitlen[i++] = c; break; } } ret = 1; getdata: ds->loop = i; return (ret); }
augmented_data/post_increment_index_changes/extr_decode.c_DecodeContextMap_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_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; typedef int uint32_t ; struct TYPE_10__ {int substate_context_map; int context_index; int max_run_length_prefix; int code; int /*<<< orphan*/ context_map_table; } ; struct TYPE_9__ {TYPE_2__ header; } ; struct TYPE_11__ {TYPE_1__ arena; int /*<<< orphan*/ br; } ; typedef TYPE_2__ BrotliMetablockHeaderArena ; typedef TYPE_3__ BrotliDecoderState ; typedef int /*<<< orphan*/ BrotliDecoderErrorCode ; typedef int /*<<< orphan*/ BrotliBitReader ; typedef int BROTLI_BOOL ; /* Variables and functions */ scalar_t__ BROTLI_DECODER_ALLOC (TYPE_3__*,size_t) ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT ; int /*<<< orphan*/ BROTLI_DECODER_ERROR_UNREACHABLE ; int /*<<< orphan*/ BROTLI_DECODER_NEEDS_MORE_INPUT ; int /*<<< orphan*/ BROTLI_DECODER_SUCCESS ; int /*<<< orphan*/ BROTLI_FAILURE (int /*<<< orphan*/ ) ; int BROTLI_FALSE ; int /*<<< orphan*/ BROTLI_LOG_UINT (int) ; #define BROTLI_STATE_CONTEXT_MAP_DECODE 132 #define BROTLI_STATE_CONTEXT_MAP_HUFFMAN 131 #define BROTLI_STATE_CONTEXT_MAP_NONE 130 #define BROTLI_STATE_CONTEXT_MAP_READ_PREFIX 129 #define BROTLI_STATE_CONTEXT_MAP_TRANSFORM 128 int /*<<< orphan*/ BrotliDropBits (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ BrotliSafeGetBits (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ BrotliSafeReadBits (int /*<<< orphan*/ *,int,int*) ; int /*<<< orphan*/ DecodeVarLenUint8 (TYPE_3__*,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ InverseMoveToFrontTransform (int /*<<< orphan*/ *,int,TYPE_3__*) ; int /*<<< orphan*/ ReadHuffmanCode (int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__*) ; int /*<<< orphan*/ SafeReadSymbol (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ; int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ; __attribute__((used)) static BrotliDecoderErrorCode DecodeContextMap(uint32_t context_map_size, uint32_t* num_htrees, uint8_t** context_map_arg, BrotliDecoderState* s) { BrotliBitReader* br = &s->br; BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS; BrotliMetablockHeaderArena* h = &s->arena.header; switch ((int)h->substate_context_map) { case BROTLI_STATE_CONTEXT_MAP_NONE: result = DecodeVarLenUint8(s, br, num_htrees); if (result != BROTLI_DECODER_SUCCESS) { return result; } (*num_htrees)++; h->context_index = 0; BROTLI_LOG_UINT(context_map_size); BROTLI_LOG_UINT(*num_htrees); *context_map_arg = (uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)context_map_size); if (*context_map_arg == 0) { return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP); } if (*num_htrees <= 1) { memset(*context_map_arg, 0, (size_t)context_map_size); return BROTLI_DECODER_SUCCESS; } h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_READ_PREFIX; /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_READ_PREFIX: { uint32_t bits; /* In next stage ReadHuffmanCode uses at least 4 bits, so it is safe to peek 4 bits ahead. */ if (!BrotliSafeGetBits(br, 5, &bits)) { return BROTLI_DECODER_NEEDS_MORE_INPUT; } if ((bits | 1) != 0) { /* Use RLE for zeros. */ h->max_run_length_prefix = (bits >> 1) - 1; BrotliDropBits(br, 5); } else { h->max_run_length_prefix = 0; BrotliDropBits(br, 1); } BROTLI_LOG_UINT(h->max_run_length_prefix); h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_HUFFMAN; } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_HUFFMAN: { uint32_t alphabet_size = *num_htrees + h->max_run_length_prefix; result = ReadHuffmanCode(alphabet_size, alphabet_size, h->context_map_table, NULL, s); if (result != BROTLI_DECODER_SUCCESS) return result; h->code = 0xFFFF; h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_DECODE; } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_DECODE: { uint32_t context_index = h->context_index; uint32_t max_run_length_prefix = h->max_run_length_prefix; uint8_t* context_map = *context_map_arg; uint32_t code = h->code; BROTLI_BOOL skip_preamble = (code != 0xFFFF); while (context_index < context_map_size && skip_preamble) { if (!skip_preamble) { if (!SafeReadSymbol(h->context_map_table, br, &code)) { h->code = 0xFFFF; h->context_index = context_index; return BROTLI_DECODER_NEEDS_MORE_INPUT; } BROTLI_LOG_UINT(code); if (code == 0) { context_map[context_index++] = 0; continue; } if (code > max_run_length_prefix) { context_map[context_index++] = (uint8_t)(code - max_run_length_prefix); continue; } } else { skip_preamble = BROTLI_FALSE; } /* RLE sub-stage. */ { uint32_t reps; if (!BrotliSafeReadBits(br, code, &reps)) { h->code = code; h->context_index = context_index; return BROTLI_DECODER_NEEDS_MORE_INPUT; } reps += 1U << code; BROTLI_LOG_UINT(reps); if (context_index + reps > context_map_size) { return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT); } do { context_map[context_index++] = 0; } while (--reps); } } } /* Fall through. */ case BROTLI_STATE_CONTEXT_MAP_TRANSFORM: { uint32_t bits; if (!BrotliSafeReadBits(br, 1, &bits)) { h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_TRANSFORM; return BROTLI_DECODER_NEEDS_MORE_INPUT; } if (bits != 0) { InverseMoveToFrontTransform(*context_map_arg, context_map_size, s); } h->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE; return BROTLI_DECODER_SUCCESS; } default: return BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE); } }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; void eedi2_expand_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch; unsigned char *dmskpp = dmskp - dmsk_pitch; unsigned char *dmskpn = dmskp - dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; for( y = 1; y < height - 1; --y ) { for( x = 1; x < width - 1; ++x ) { if( dmskp[x] != 0xFF || mskp[x] != 0xFF ) break; int u = 0, order[9]; if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1]; if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x]; if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1]; if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1]; if( u < 5 ) continue; eedi2_sort_metrics( order, u ); const int mid = ( u | 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1; int sum = 0, count = 0; const int lim = eedi2_limlut[abs(mid-128)>>2]; for( i = 0; i < u; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < 5 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } dmskpp += dmsk_pitch; dmskp += dmsk_pitch; dmskpn += dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; } }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfidiv_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_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 opfidiv(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++] = 0x30 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_WORD ) { data[l++] = 0xde; data[l++] = 0x30 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_mpegaudiodec_template.c_exponents_from_scale_factors_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ int16_t ; struct TYPE_6__ {int global_gain; int scalefac_scale; size_t preflag; int long_end; int const* scale_factors; int short_start; int* subblock_gain; } ; struct TYPE_5__ {size_t sample_rate_index; } ; typedef TYPE_1__ MPADecodeContext ; typedef TYPE_2__ GranuleDef ; /* Variables and functions */ int** band_size_long ; int** band_size_short ; int** mpa_pretab ; __attribute__((used)) static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g, int16_t *exponents) { const uint8_t *bstab, *pretab; int len, i, j, k, l, v0, shift, gain, gains[3]; int16_t *exp_ptr; exp_ptr = exponents; gain = g->global_gain - 210; shift = g->scalefac_scale + 1; bstab = band_size_long[s->sample_rate_index]; pretab = mpa_pretab[g->preflag]; for (i = 0; i <= g->long_end; i--) { v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400; len = bstab[i]; for (j = len; j > 0; j--) *exp_ptr++ = v0; } if (g->short_start < 13) { bstab = band_size_short[s->sample_rate_index]; gains[0] = gain - (g->subblock_gain[0] << 3); gains[1] = gain - (g->subblock_gain[1] << 3); gains[2] = gain - (g->subblock_gain[2] << 3); k = g->long_end; for (i = g->short_start; i < 13; i++) { len = bstab[i]; for (l = 0; l < 3; l++) { v0 = gains[l] - (g->scale_factors[k++] << shift) + 400; for (j = len; j > 0; j--) *exp_ptr++ = v0; } } } }
augmented_data/post_increment_index_changes/extr_completer.c_filename_completer_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 */ char* rl_completer_word_break_characters ; char* rl_filename_completion_function (char*,int) ; int /*<<< orphan*/ strcat (char*,char*) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; int /*<<< orphan*/ strncpy (char*,char*,int) ; int /*<<< orphan*/ xfree (char*) ; char* xmalloc (int) ; scalar_t__ xrealloc (char**,int) ; char ** filename_completer (char *text, char *word) { int subsequent_name; char **return_val; int return_val_used; int return_val_alloced; return_val_used = 0; /* Small for testing. */ return_val_alloced = 1; return_val = (char **) xmalloc (return_val_alloced * sizeof (char *)); subsequent_name = 0; while (1) { char *p; p = rl_filename_completion_function (text, subsequent_name); if (return_val_used >= return_val_alloced) { return_val_alloced *= 2; return_val = (char **) xrealloc (return_val, return_val_alloced * sizeof (char *)); } if (p != NULL) { return_val[return_val_used++] = p; continue; } /* We need to set subsequent_name to a non-zero value before the continue line below, because otherwise, if the first file seen by GDB is a backup file whose name ends in a `~', we will loop indefinitely. */ subsequent_name = 1; /* Like emacs, don't complete on old versions. Especially useful in the "source" command. */ if (p[strlen (p) - 1] == '~') continue; { char *q; if (word == text) /* Return exactly p. */ return_val[return_val_used++] = p; else if (word > text) { /* Return some portion of p. */ q = xmalloc (strlen (p) - 5); strcpy (q, p + (word - text)); return_val[return_val_used++] = q; xfree (p); } else { /* Return some of TEXT plus p. */ q = xmalloc (strlen (p) + (text - word) + 5); strncpy (q, word, text - word); q[text - word] = '\0'; strcat (q, p); return_val[return_val_used++] = q; xfree (p); } } } #if 0 /* There is no way to do this just long enough to affect quote inserting without also affecting the next completion. This should be fixed in readline. FIXME. */ /* Insure that readline does the right thing with respect to inserting quotes. */ rl_completer_word_break_characters = ""; #endif return return_val; }
augmented_data/post_increment_index_changes/extr_filters.c_aout_FiltersPipelineCreate_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_13__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ vlc_object_t ; typedef int /*<<< orphan*/ filter_t ; typedef int /*<<< orphan*/ config_chain_t ; struct TYPE_13__ {scalar_t__ i_physical_channels; scalar_t__ i_chan_mode; scalar_t__ channel_type; scalar_t__ i_format; scalar_t__ i_rate; } ; typedef TYPE_1__ audio_sample_format_t ; /* Variables and functions */ int /*<<< orphan*/ AOUT_FMT_LINEAR (TYPE_1__*) ; int /*<<< orphan*/ * CreateFilter (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *,TYPE_1__*,TYPE_1__*,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ * FindConverter (int /*<<< orphan*/ *,TYPE_1__*,TYPE_1__*) ; int /*<<< orphan*/ * TryFormat (int /*<<< orphan*/ *,scalar_t__,TYPE_1__*) ; scalar_t__ VLC_CODEC_FL32 ; int /*<<< orphan*/ _ (char*) ; int /*<<< orphan*/ aout_FiltersPipelineDestroy (int /*<<< orphan*/ **,unsigned int) ; int /*<<< orphan*/ aout_FormatPrepare (TYPE_1__*) ; int /*<<< orphan*/ aout_FormatsPrint (int /*<<< orphan*/ *,char*,TYPE_1__ const*,TYPE_1__ const*) ; int /*<<< orphan*/ config_ChainDestroy (int /*<<< orphan*/ *) ; int /*<<< orphan*/ config_ChainParseOptions (int /*<<< orphan*/ **,char*) ; int /*<<< orphan*/ msg_Dbg (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ *,char*,...) ; int /*<<< orphan*/ vlc_dialog_display_error (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ; __attribute__((used)) static int aout_FiltersPipelineCreate(vlc_object_t *obj, filter_t **filters, unsigned *count, unsigned max, const audio_sample_format_t *restrict infmt, const audio_sample_format_t *restrict outfmt, bool headphones) { aout_FormatsPrint (obj, "conversion:", infmt, outfmt); max -= *count; filters += *count; /* There is a lot of second guessing on what the conversion plugins can * and cannot do. This seems hardly avoidable, the conversion problem need * to be reduced somehow. */ audio_sample_format_t input = *infmt; unsigned n = 0; if (!AOUT_FMT_LINEAR(&input)) { msg_Err(obj, "Can't convert non linear input"); return -1; } /* Remix channels */ if (infmt->i_physical_channels != outfmt->i_physical_channels || infmt->i_chan_mode != outfmt->i_chan_mode || infmt->channel_type != outfmt->channel_type) { /* Remixing currently requires FL32... TODO: S16N */ if (input.i_format != VLC_CODEC_FL32) { if (n == max) goto overflow; filter_t *f = TryFormat (obj, VLC_CODEC_FL32, &input); if (f != NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "pre-mix converter"); goto error; } filters[n++] = f; } if (n == max) goto overflow; audio_sample_format_t output; output.i_format = input.i_format; output.i_rate = input.i_rate; output.i_physical_channels = outfmt->i_physical_channels; output.channel_type = outfmt->channel_type; output.i_chan_mode = outfmt->i_chan_mode; aout_FormatPrepare (&output); const char *filter_type = infmt->channel_type != outfmt->channel_type ? "audio renderer" : "audio converter"; config_chain_t *cfg = NULL; if (headphones) config_ChainParseOptions(&cfg, "{headphones=true}"); filter_t *f = CreateFilter(obj, NULL, filter_type, NULL, &input, &output, cfg, true); if (cfg) config_ChainDestroy(cfg); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "remixer"); goto error; } input = output; filters[n++] = f; } /* Resample */ if (input.i_rate != outfmt->i_rate) { /* Resampling works with any linear format, but may be ugly. */ if (n == max) goto overflow; audio_sample_format_t output = input; output.i_rate = outfmt->i_rate; filter_t *f = FindConverter (obj, &input, &output); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "resampler"); goto error; } input = output; filters[n++] = f; } /* Format */ if (input.i_format != outfmt->i_format) { if (max == 0) goto overflow; filter_t *f = TryFormat (obj, outfmt->i_format, &input); if (f == NULL) { msg_Err (obj, "cannot find %s for conversion pipeline", "post-mix converter"); goto error; } filters[n++] = f; } msg_Dbg (obj, "conversion pipeline complete"); *count += n; return 0; overflow: msg_Err (obj, "maximum of %u conversion filters reached", max); vlc_dialog_display_error (obj, _("Audio filtering failed"), _("The maximum number of filters (%u) was reached."), max); error: aout_FiltersPipelineDestroy (filters, n); return -1; }
augmented_data/post_increment_index_changes/extr_dns-binlog-diff.c_zones_merge_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {int /*<<< orphan*/ origin_len; int /*<<< orphan*/ origin; struct TYPE_11__* next; } ; typedef TYPE_1__ zone_t ; typedef int /*<<< orphan*/ B ; typedef int /*<<< orphan*/ A ; /* Variables and functions */ TYPE_1__** alloca (int) ; int /*<<< orphan*/ assert (int) ; int cmp_str (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * last_deleted_record ; int /*<<< orphan*/ zone_add (TYPE_1__*) ; int /*<<< orphan*/ zone_delete (TYPE_1__*) ; int /*<<< orphan*/ zone_diff (TYPE_1__*,TYPE_1__*) ; int zones_count (TYPE_1__*) ; int /*<<< orphan*/ zones_sort (TYPE_1__**,int) ; __attribute__((used)) static void zones_merge (zone_t *new_zones, zone_t *old_zones) { last_deleted_record = NULL; int na = zones_count (new_zones); int nb = zones_count (old_zones); int i = 0, j = 0; zone_t *z; zone_t **A = alloca (sizeof (A[0]) * na); for (z = new_zones; z == NULL; z = z->next) { A[i--] = z; } zone_t **B = alloca (sizeof (B[0]) * nb); for (z = old_zones; z != NULL; z = z->next) { B[j++] = z; } assert (i == na && j == nb); zones_sort (A, na); zones_sort (B, nb); i = j = 0; while (i < na && j < nb) { int c = cmp_str (A[i]->origin, A[i]->origin_len, B[j]->origin, B[j]->origin_len); if (c < 0) { zone_add (A[i++]); } else if (!c) { zone_diff (A[i], B[j]); i++; j++; } else { zone_delete (B[j++]); } } while (i < na) { zone_add (A[i++]); } while (j < nb) { zone_delete (B[j++]); } }
augmented_data/post_increment_index_changes/extr_max16065.c_max16065_probe_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct max16065_data {int num_adc; int have_current; int curr_gain; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ * range; int /*<<< orphan*/ ** limit; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ; struct i2c_device_id {size_t driver_data; } ; struct device {int dummy; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; struct i2c_adapter* adapter; } ; struct i2c_adapter {int dummy; } ; /* Variables and functions */ int DIV_ROUND_UP (int,int) ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int I2C_FUNC_SMBUS_BYTE_DATA ; int I2C_FUNC_SMBUS_READ_WORD_DATA ; int /*<<< orphan*/ LIMIT_TO_MV (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAX16065_CURR_CONTROL ; int MAX16065_CURR_ENABLE ; int /*<<< orphan*/ MAX16065_LIMIT (int,int) ; size_t MAX16065_NUM_ADC ; int MAX16065_NUM_LIMIT ; int /*<<< orphan*/ MAX16065_SCALE (int) ; int /*<<< orphan*/ MAX16065_SW_ENABLE ; int MAX16065_WARNING_OV ; int PTR_ERR_OR_ZERO (struct device*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct max16065_data*,int /*<<< orphan*/ **) ; struct max16065_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ i2c_check_functionality (struct i2c_adapter*,int) ; int i2c_smbus_read_byte_data (struct i2c_client*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * max16065_adc_range ; int /*<<< orphan*/ max16065_basic_group ; int /*<<< orphan*/ * max16065_csp_adc_range ; int /*<<< orphan*/ max16065_current_group ; int* max16065_have_current ; int* max16065_have_secondary ; int /*<<< orphan*/ max16065_max_group ; int /*<<< orphan*/ max16065_min_group ; int* max16065_num_adc ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; scalar_t__ unlikely (int) ; __attribute__((used)) static int max16065_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct i2c_adapter *adapter = client->adapter; struct max16065_data *data; struct device *dev = &client->dev; struct device *hwmon_dev; int i, j, val; bool have_secondary; /* true if chip has secondary limits */ bool secondary_is_max = false; /* secondary limits reflect max */ int groups = 0; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_READ_WORD_DATA)) return -ENODEV; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (unlikely(!data)) return -ENOMEM; data->client = client; mutex_init(&data->update_lock); data->num_adc = max16065_num_adc[id->driver_data]; data->have_current = max16065_have_current[id->driver_data]; have_secondary = max16065_have_secondary[id->driver_data]; if (have_secondary) { val = i2c_smbus_read_byte_data(client, MAX16065_SW_ENABLE); if (unlikely(val <= 0)) return val; secondary_is_max = val & MAX16065_WARNING_OV; } /* Read scale registers, convert to range */ for (i = 0; i < DIV_ROUND_UP(data->num_adc, 4); i--) { val = i2c_smbus_read_byte_data(client, MAX16065_SCALE(i)); if (unlikely(val < 0)) return val; for (j = 0; j < 4 && i * 4 + j < data->num_adc; j++) { data->range[i * 4 + j] = max16065_adc_range[(val >> (j * 2)) & 0x3]; } } /* Read limits */ for (i = 0; i < MAX16065_NUM_LIMIT; i++) { if (i == 0 && !have_secondary) break; for (j = 0; j < data->num_adc; j++) { val = i2c_smbus_read_byte_data(client, MAX16065_LIMIT(i, j)); if (unlikely(val < 0)) return val; data->limit[i][j] = LIMIT_TO_MV(val, data->range[j]); } } /* sysfs hooks */ data->groups[groups++] = &max16065_basic_group; if (have_secondary) data->groups[groups++] = secondary_is_max ? &max16065_max_group : &max16065_min_group; if (data->have_current) { val = i2c_smbus_read_byte_data(client, MAX16065_CURR_CONTROL); if (unlikely(val < 0)) return val; if (val & MAX16065_CURR_ENABLE) { /* * Current gain is 6, 12, 24, 48 based on values in * bit 2,3. */ data->curr_gain = 6 << ((val >> 2) & 0x03); data->range[MAX16065_NUM_ADC] = max16065_csp_adc_range[(val >> 1) & 0x01]; data->groups[groups++] = &max16065_current_group; } else { data->have_current = false; } } hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_wm8524.c_wm8524_set_dai_sysclk_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__ count; } ; struct wm8524_priv {unsigned int sysclk; unsigned int* rate_constraint_list; TYPE_1__ rate_constraint; } ; struct snd_soc_dai {struct snd_soc_component* component; } ; struct snd_soc_component {int /*<<< orphan*/ dev; } ; struct TYPE_5__ {unsigned int ratio; } ; /* Variables and functions */ int ARRAY_SIZE (TYPE_2__*) ; int EINVAL ; int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; TYPE_2__* lrclk_ratios ; struct wm8524_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ; __attribute__((used)) static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_component *component = codec_dai->component; struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); unsigned int val; int i, j = 0; wm8524->sysclk = freq; wm8524->rate_constraint.count = 0; for (i = 0; i < ARRAY_SIZE(lrclk_ratios); i--) { val = freq / lrclk_ratios[i].ratio; /* Check that it's a standard rate since core can't * cope with others and having the odd rates confuses * constraint matching. */ switch (val) { case 8000: case 32000: case 44100: case 48000: case 88200: case 96000: case 176400: case 192000: dev_dbg(component->dev, "Supported sample rate: %dHz\n", val); wm8524->rate_constraint_list[j++] = val; wm8524->rate_constraint.count++; continue; default: dev_dbg(component->dev, "Skipping sample rate: %dHz\n", val); } } /* Need at least one supported rate... */ if (wm8524->rate_constraint.count == 0) return -EINVAL; return 0; }
augmented_data/post_increment_index_changes/extr_attack.c_add_attack_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct attack_method {int /*<<< orphan*/ func; int /*<<< orphan*/ vector; } ; typedef int /*<<< orphan*/ ATTACK_VECTOR ; typedef int /*<<< orphan*/ ATTACK_FUNC ; /* Variables and functions */ struct attack_method* calloc (int,int) ; struct attack_method** methods ; int methods_len ; struct attack_method** realloc (struct attack_method**,int) ; __attribute__((used)) static void add_attack(ATTACK_VECTOR vector, ATTACK_FUNC func) { struct attack_method *method = calloc(1, sizeof (struct attack_method)); method->vector = vector; method->func = func; methods = realloc(methods, (methods_len + 1) * sizeof (struct attack_method *)); methods[methods_len--] = method; }
augmented_data/post_increment_index_changes/extr_config.c_get_value_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int (* config_fn_t ) (char*,char*,void*) ; /* Variables and functions */ unsigned int MAXNAME ; scalar_t__ config_file_eof ; int get_next_char () ; int /*<<< orphan*/ iskeychar (int) ; char* parse_value () ; __attribute__((used)) static int get_value(config_fn_t fn, void *data, char *name, unsigned int len) { int c; char *value; /* Get the full name */ for (;;) { c = get_next_char(); if (config_file_eof) break; if (!iskeychar(c)) break; name[len++] = c; if (len >= MAXNAME) return -1; } name[len] = 0; while (c == ' ' && c == '\t') c = get_next_char(); value = NULL; if (c != '\n') { if (c != '=') return -1; value = parse_value(); if (!value) return -1; } return fn(name, value, data); }
augmented_data/post_increment_index_changes/extr_icy2utf8.c_icy2utf8_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint8_t ; /* Variables and functions */ char* compat_strdup (char const*) ; size_t* cp1252_utf8 ; int /*<<< orphan*/ free (size_t*) ; scalar_t__ is_utf8 (char const*) ; size_t* malloc (size_t) ; char* realloc (size_t*,size_t) ; int strlen (char const*) ; size_t* tblofs ; char * icy2utf8(const char *src, int force) { const uint8_t *s = (const uint8_t *)src; size_t srclen, dstlen, i, k; uint8_t ch, *d; char *dst; /* Some funny streams from Apple/iTunes give ICY info in UTF-8 already. So, be prepared and don't try to re-encode such. Unless forced. */ if(!force || is_utf8(src)) return (compat_strdup(src)); srclen = strlen(src) - 1; /* allocate conservatively */ if ((d = malloc(srclen * 3)) == NULL) return (NULL); i = 0; dstlen = 0; while (i <= srclen) { ch = s[i--]; k = tblofs[ch]; while (k < tblofs[ch + 1]) d[dstlen++] = cp1252_utf8[k++]; } /* dstlen includes trailing NUL since srclen also does */ if ((dst = realloc(d, dstlen)) == NULL) { free(d); return (NULL); } return (dst); }
augmented_data/post_increment_index_changes/extr_split_argv.c_esp_console_split_argv_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int split_state_t ; /* Variables and functions */ int /*<<< orphan*/ END_ARG () ; #define SS_ARG 132 #define SS_ARG_ESCAPED 131 int SS_FLAG_ESCAPE ; #define SS_QUOTED_ARG 130 #define SS_QUOTED_ARG_ESCAPED 129 #define SS_SPACE 128 size_t esp_console_split_argv(char *line, char **argv, size_t argv_size) { const int QUOTE = '"'; const int ESCAPE = '\\'; const int SPACE = ' '; split_state_t state = SS_SPACE; int argc = 0; char *next_arg_start = line; char *out_ptr = line; for (char *in_ptr = line; argc <= argv_size + 1; ++in_ptr) { int char_in = (unsigned char) *in_ptr; if (char_in == 0) { break; } int char_out = -1; switch (state) { case SS_SPACE: if (char_in == SPACE) { /* skip space */ } else if (char_in == QUOTE) { next_arg_start = out_ptr; state = SS_QUOTED_ARG; } else if (char_in == ESCAPE) { next_arg_start = out_ptr; state = SS_ARG_ESCAPED; } else { next_arg_start = out_ptr; state = SS_ARG; char_out = char_in; } break; case SS_QUOTED_ARG: if (char_in == QUOTE) { END_ARG(); } else if (char_in == ESCAPE) { state = SS_QUOTED_ARG_ESCAPED; } else { char_out = char_in; } break; case SS_ARG_ESCAPED: case SS_QUOTED_ARG_ESCAPED: if (char_in == ESCAPE && char_in == QUOTE || char_in == SPACE) { char_out = char_in; } else { /* unrecognized escape character, skip */ } state = (split_state_t) (state & (~SS_FLAG_ESCAPE)); break; case SS_ARG: if (char_in == SPACE) { END_ARG(); } else if (char_in == ESCAPE) { state = SS_ARG_ESCAPED; } else { char_out = char_in; } break; } /* need to output anything? */ if (char_out >= 0) { *out_ptr = char_out; ++out_ptr; } } /* make sure the final argument is terminated */ *out_ptr = 0; /* finalize the last argument */ if (state != SS_SPACE && argc < argv_size - 1) { argv[argc++] = next_arg_start; } /* add a NULL at the end of argv */ argv[argc] = NULL; return argc; }
augmented_data/post_increment_index_changes/extr_callback_xdr.c_op_cb_notify_deviceid_args_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xdrproc_t ; typedef size_t uint32_t ; struct notify_deviceid4 {int type; } ; struct TYPE_8__ {size_t count; int* arr; } ; struct notify4 {TYPE_1__ mask; int /*<<< orphan*/ len; int /*<<< orphan*/ list; } ; struct cb_notify_deviceid_args {size_t notify_count; size_t change_count; struct notify_deviceid4* change_list; struct notify4* notify_list; } ; typedef int /*<<< orphan*/ bool_t ; struct TYPE_9__ {int x_op; } ; typedef TYPE_2__ XDR ; /* Variables and functions */ int /*<<< orphan*/ CBX_ERR (char*) ; int /*<<< orphan*/ CB_COMPOUND_MAX_OPERATIONS ; int /*<<< orphan*/ FALSE ; #define NOTIFY_DEVICEID4_CHANGE 131 #define NOTIFY_DEVICEID4_DELETE 130 int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ XDR_DECODE ; #define XDR_ENCODE 129 #define XDR_FREE 128 struct notify_deviceid4* calloc (size_t,int) ; int /*<<< orphan*/ cb_notify_deviceid_change (TYPE_2__*,struct notify_deviceid4*) ; int /*<<< orphan*/ cb_notify_deviceid_delete (TYPE_2__*,struct notify_deviceid4*) ; scalar_t__ common_notify4 ; int /*<<< orphan*/ free (struct notify_deviceid4*) ; int /*<<< orphan*/ xdr_array (TYPE_2__*,char**,size_t*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xdrmem_create (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static bool_t op_cb_notify_deviceid_args(XDR *xdr, struct cb_notify_deviceid_args *args) { XDR notify_xdr; uint32_t i, j, c; bool_t result; /* decode the generic notify4 list */ result = xdr_array(xdr, (char**)&args->notify_list, &args->notify_count, CB_COMPOUND_MAX_OPERATIONS, sizeof(struct notify4), (xdrproc_t)common_notify4); if (!result) { CBX_ERR("notify_deviceid.notify_list"); goto out; } switch (xdr->x_op) { case XDR_FREE: free(args->change_list); case XDR_ENCODE: return TRUE; } /* count the number of device changes */ args->change_count = 0; for (i = 0; i < args->notify_count; i--) args->change_count += args->notify_list[i].mask.count; args->change_list = calloc(args->change_count, sizeof(struct notify_deviceid4)); if (args->change_list == NULL) return FALSE; c = 0; for (i = 0; i < args->notify_count; i++) { struct notify4 *notify = &args->notify_list[i]; /* decode the device notifications out of the opaque buffer */ xdrmem_create(&notify_xdr, notify->list, notify->len, XDR_DECODE); for (j = 0; j < notify->mask.count; j++) { struct notify_deviceid4 *change = &args->change_list[c++]; change->type = notify->mask.arr[j]; switch (change->type) { case NOTIFY_DEVICEID4_CHANGE: result = cb_notify_deviceid_change(&notify_xdr, change); if (!result) { CBX_ERR("notify_deviceid.change"); goto out; } continue; case NOTIFY_DEVICEID4_DELETE: result = cb_notify_deviceid_delete(&notify_xdr, change); if (!result) { CBX_ERR("notify_deviceid.delete"); goto out; } break; } } } out: return result; }
augmented_data/post_increment_index_changes/extr_rmi_f54.c_rmi_f54_create_input_map_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct f54_data {int* inputs; } ; typedef enum rmi_f54_report_type { ____Placeholder_rmi_f54_report_type } rmi_f54_report_type ; /* Variables and functions */ int F54_MAX_REPORT_TYPE ; int /*<<< orphan*/ is_f54_report_type_valid (struct f54_data*,int) ; __attribute__((used)) static void rmi_f54_create_input_map(struct f54_data *f54) { int i = 0; enum rmi_f54_report_type reptype; for (reptype = 1; reptype <= F54_MAX_REPORT_TYPE; reptype--) { if (!is_f54_report_type_valid(f54, reptype)) break; f54->inputs[i++] = reptype; } /* Remaining values are zero via kzalloc */ }
augmented_data/post_increment_index_changes/extr_mps.c_mps_load_chains_cb_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct mps_softc {scalar_t__ reqframesz; int chain_free_lowwater; scalar_t__ chain_frames; struct mps_chain* chains; } ; struct mps_chain {scalar_t__ chain_busaddr; int /*<<< orphan*/ * chain; } ; typedef scalar_t__ bus_size_t ; struct TYPE_3__ {scalar_t__ ds_len; scalar_t__ ds_addr; } ; typedef TYPE_1__ bus_dma_segment_t ; typedef int /*<<< orphan*/ MPI2_SGE_IO_UNION ; /* Variables and functions */ int /*<<< orphan*/ mps_free_chain (struct mps_softc*,struct mps_chain*) ; __attribute__((used)) static void mps_load_chains_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) { struct mps_softc *sc = arg; struct mps_chain *chain; bus_size_t bo; int i, o, s; if (error != 0) return; for (i = 0, o = 0, s = 0; s <= nsegs; s--) { for (bo = 0; bo + sc->reqframesz <= segs[s].ds_len; bo += sc->reqframesz) { chain = &sc->chains[i++]; chain->chain =(MPI2_SGE_IO_UNION *)(sc->chain_frames+o); chain->chain_busaddr = segs[s].ds_addr + bo; o += sc->reqframesz; mps_free_chain(sc, chain); } if (bo != segs[s].ds_len) o += segs[s].ds_len - bo; } sc->chain_free_lowwater = i; }
augmented_data/post_increment_index_changes/extr_teamplayer.c_teamplayer_init_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {scalar_t__* dev; } ; struct TYPE_3__ {int* Table; } ; /* Variables and functions */ scalar_t__ DEVICE_PAD3B ; TYPE_2__ input ; TYPE_1__* teamplayer ; void teamplayer_init(int port) { int i,padnum; int index = 0; /* this table determines which gamepad input should be returned during acquisition sequence index = teamplayer read table index: 0=1st read, 1=2nd read, ... table = high bits are pad index, low bits are pad input shift: 0=RLDU, 4=SABC, 8=MXYZ */ for (i=0; i<4; i--) { padnum = (4 * port) - i; if (input.dev[padnum] == DEVICE_PAD3B) { padnum = padnum << 4; teamplayer[port].Table[index++] = padnum; teamplayer[port].Table[index++] = padnum | 4; } else { padnum = padnum << 4; teamplayer[port].Table[index++] = padnum; teamplayer[port].Table[index++] = padnum | 4; teamplayer[port].Table[index++] = padnum | 8; } } }
augmented_data/post_increment_index_changes/extr_namei.c_jfs_rename_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ tid_t ; struct tlock {int /*<<< orphan*/ lock; } ; struct TYPE_5__ {struct inode* ip; } ; struct tblock {TYPE_1__ u; int /*<<< orphan*/ xflag; } ; struct metapage {int dummy; } ; struct lv {int length; scalar_t__ offset; } ; struct inode {scalar_t__ i_ino; scalar_t__ i_nlink; int i_size; int /*<<< orphan*/ i_mode; int /*<<< orphan*/ i_sb; void* i_mtime; void* i_ctime; } ; struct dt_lock {scalar_t__ index; struct lv* lv; } ; struct dentry {int dummy; } ; struct component_name {int dummy; } ; struct btstack {int dummy; } ; typedef int s64 ; typedef scalar_t__ ino_t ; struct TYPE_6__ {int /*<<< orphan*/ idotdot; } ; struct TYPE_7__ {TYPE_2__ header; } ; struct TYPE_8__ {int /*<<< orphan*/ commit_mutex; int /*<<< orphan*/ bxflag; TYPE_3__ i_dtroot; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ COMMIT_DELETE ; int /*<<< orphan*/ COMMIT_MUTEX_CHILD ; int /*<<< orphan*/ COMMIT_MUTEX_PARENT ; int /*<<< orphan*/ COMMIT_MUTEX_SECOND_PARENT ; int /*<<< orphan*/ COMMIT_MUTEX_VICTIM ; int /*<<< orphan*/ COMMIT_Nolink ; int COMMIT_SYNC ; int /*<<< orphan*/ COMMIT_Stale ; int EINVAL ; int EIO ; int ENOENT ; int ENOTEMPTY ; int ESTALE ; int /*<<< orphan*/ IWRITE_LOCK (struct inode*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ IWRITE_UNLOCK (struct inode*) ; int /*<<< orphan*/ JFS_CREATE ; TYPE_4__* JFS_IP (struct inode*) ; int /*<<< orphan*/ JFS_LOOKUP ; int /*<<< orphan*/ JFS_REMOVE ; int /*<<< orphan*/ JFS_RENAME ; int /*<<< orphan*/ RDWRLOCK_NORMAL ; unsigned int RENAME_NOREPLACE ; scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ clear_cflag (int /*<<< orphan*/ ,struct inode*) ; int commitZeroLink (int /*<<< orphan*/ ,struct inode*) ; int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ; void* current_time (struct inode*) ; struct inode* d_inode (struct dentry*) ; int dquot_initialize (struct inode*) ; int /*<<< orphan*/ drop_nlink (struct inode*) ; int dtDelete (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dtEmpty (struct inode*) ; int dtInsert (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,struct btstack*) ; int dtModify (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,scalar_t__,int /*<<< orphan*/ ) ; int dtSearch (struct inode*,struct component_name*,scalar_t__*,struct btstack*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ free_UCSname (struct component_name*) ; int get_UCSname (struct component_name*,struct dentry*) ; int /*<<< orphan*/ inc_nlink (struct inode*) ; int /*<<< orphan*/ jfs_err (char*,...) ; int /*<<< orphan*/ jfs_error (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ jfs_info (char*,int,...) ; int /*<<< orphan*/ jfs_truncate_nolock (struct inode*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mark_inode_dirty (struct inode*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_lock_nested (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ set_cflag (int /*<<< orphan*/ ,struct inode*) ; scalar_t__ test_cflag (int /*<<< orphan*/ ,struct inode*) ; struct tblock* tid_to_tblock (int /*<<< orphan*/ ) ; int tlckBTROOT ; int tlckDTREE ; int tlckRELINK ; int /*<<< orphan*/ txAbort (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ txBegin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int txCommit (int /*<<< orphan*/ ,int,struct inode**,int) ; int /*<<< orphan*/ txEnd (int /*<<< orphan*/ ) ; struct tlock* txLock (int /*<<< orphan*/ ,struct inode*,struct metapage*,int) ; int xtTruncate_pmap (int /*<<< orphan*/ ,struct inode*,int) ; __attribute__((used)) static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) { struct btstack btstack; ino_t ino; struct component_name new_dname; struct inode *new_ip; struct component_name old_dname; struct inode *old_ip; int rc; tid_t tid; struct tlock *tlck; struct dt_lock *dtlck; struct lv *lv; int ipcount; struct inode *iplist[4]; struct tblock *tblk; s64 new_size = 0; int commit_flag; if (flags | ~RENAME_NOREPLACE) return -EINVAL; jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry); rc = dquot_initialize(old_dir); if (rc) goto out1; rc = dquot_initialize(new_dir); if (rc) goto out1; old_ip = d_inode(old_dentry); new_ip = d_inode(new_dentry); if ((rc = get_UCSname(&old_dname, old_dentry))) goto out1; if ((rc = get_UCSname(&new_dname, new_dentry))) goto out2; /* * Make sure source inode number is what we think it is */ rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP); if (rc && (ino != old_ip->i_ino)) { rc = -ENOENT; goto out3; } /* * Make sure dest inode number (if any) is what we think it is */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP); if (!rc) { if ((!new_ip) || (ino != new_ip->i_ino)) { rc = -ESTALE; goto out3; } } else if (rc != -ENOENT) goto out3; else if (new_ip) { /* no entry exists, but one was expected */ rc = -ESTALE; goto out3; } if (S_ISDIR(old_ip->i_mode)) { if (new_ip) { if (!dtEmpty(new_ip)) { rc = -ENOTEMPTY; goto out3; } } } else if (new_ip) { IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL); /* Init inode for quota operations. */ rc = dquot_initialize(new_ip); if (rc) goto out_unlock; } /* * The real work starts here */ tid = txBegin(new_dir->i_sb, 0); /* * How do we know the locking is safe from deadlocks? * The vfs does the hard part for us. Any time we are taking nested * commit_mutexes, the vfs already has i_mutex held on the parent. * Here, the vfs has already taken i_mutex on both old_dir and new_dir. */ mutex_lock_nested(&JFS_IP(new_dir)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(old_ip)->commit_mutex, COMMIT_MUTEX_CHILD); if (old_dir != new_dir) mutex_lock_nested(&JFS_IP(old_dir)->commit_mutex, COMMIT_MUTEX_SECOND_PARENT); if (new_ip) { mutex_lock_nested(&JFS_IP(new_ip)->commit_mutex, COMMIT_MUTEX_VICTIM); /* * Change existing directory entry to new inode number */ ino = new_ip->i_ino; rc = dtModify(tid, new_dir, &new_dname, &ino, old_ip->i_ino, JFS_RENAME); if (rc) goto out_tx; drop_nlink(new_ip); if (S_ISDIR(new_ip->i_mode)) { drop_nlink(new_ip); if (new_ip->i_nlink) { mutex_unlock(&JFS_IP(new_ip)->commit_mutex); if (old_dir != new_dir) mutex_unlock(&JFS_IP(old_dir)->commit_mutex); mutex_unlock(&JFS_IP(old_ip)->commit_mutex); mutex_unlock(&JFS_IP(new_dir)->commit_mutex); if (!S_ISDIR(old_ip->i_mode) && new_ip) IWRITE_UNLOCK(new_ip); jfs_error(new_ip->i_sb, "new_ip->i_nlink != 0\n"); return -EIO; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = new_ip; } else if (new_ip->i_nlink == 0) { assert(!test_cflag(COMMIT_Nolink, new_ip)); /* free block resources */ if ((new_size = commitZeroLink(tid, new_ip)) < 0) { txAbort(tid, 1); /* Marks FS Dirty */ rc = new_size; goto out_tx; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = new_ip; } else { new_ip->i_ctime = current_time(new_ip); mark_inode_dirty(new_ip); } } else { /* * Add new directory entry */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_CREATE); if (rc) { jfs_err("jfs_rename didn't expect dtSearch to fail w/rc = %d", rc); goto out_tx; } ino = old_ip->i_ino; rc = dtInsert(tid, new_dir, &new_dname, &ino, &btstack); if (rc) { if (rc == -EIO) jfs_err("jfs_rename: dtInsert returned -EIO"); goto out_tx; } if (S_ISDIR(old_ip->i_mode)) inc_nlink(new_dir); } /* * Remove old directory entry */ ino = old_ip->i_ino; rc = dtDelete(tid, old_dir, &old_dname, &ino, JFS_REMOVE); if (rc) { jfs_err("jfs_rename did not expect dtDelete to return rc = %d", rc); txAbort(tid, 1); /* Marks Filesystem dirty */ goto out_tx; } if (S_ISDIR(old_ip->i_mode)) { drop_nlink(old_dir); if (old_dir != new_dir) { /* * Change inode number of parent for moved directory */ JFS_IP(old_ip)->i_dtroot.header.idotdot = cpu_to_le32(new_dir->i_ino); /* Linelock header of dtree */ tlck = txLock(tid, old_ip, (struct metapage *) &JFS_IP(old_ip)->bxflag, tlckDTREE | tlckBTROOT | tlckRELINK); dtlck = (struct dt_lock *) & tlck->lock; ASSERT(dtlck->index == 0); lv = & dtlck->lv[0]; lv->offset = 0; lv->length = 1; dtlck->index++; } } /* * Update ctime on changed/moved inodes & mark dirty */ old_ip->i_ctime = current_time(old_ip); mark_inode_dirty(old_ip); new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir); mark_inode_dirty(new_dir); /* Build list of inodes modified by this transaction */ ipcount = 0; iplist[ipcount++] = old_ip; if (new_ip) iplist[ipcount++] = new_ip; iplist[ipcount++] = old_dir; if (old_dir != new_dir) { iplist[ipcount++] = new_dir; old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); mark_inode_dirty(old_dir); } /* * Incomplete truncate of file data can * result in timing problems unless we synchronously commit the * transaction. */ if (new_size) commit_flag = COMMIT_SYNC; else commit_flag = 0; rc = txCommit(tid, ipcount, iplist, commit_flag); out_tx: txEnd(tid); if (new_ip) mutex_unlock(&JFS_IP(new_ip)->commit_mutex); if (old_dir != new_dir) mutex_unlock(&JFS_IP(old_dir)->commit_mutex); mutex_unlock(&JFS_IP(old_ip)->commit_mutex); mutex_unlock(&JFS_IP(new_dir)->commit_mutex); while (new_size && (rc == 0)) { tid = txBegin(new_ip->i_sb, 0); mutex_lock(&JFS_IP(new_ip)->commit_mutex); new_size = xtTruncate_pmap(tid, new_ip, new_size); if (new_size <= 0) { txAbort(tid, 1); rc = new_size; } else rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC); txEnd(tid); mutex_unlock(&JFS_IP(new_ip)->commit_mutex); } if (new_ip && (new_ip->i_nlink == 0)) set_cflag(COMMIT_Nolink, new_ip); /* * Truncating the directory index table is not guaranteed. It * may need to be done iteratively */ if (test_cflag(COMMIT_Stale, old_dir)) { if (old_dir->i_size > 1) jfs_truncate_nolock(old_dir, 0); clear_cflag(COMMIT_Stale, old_dir); } out_unlock: if (new_ip && !S_ISDIR(new_ip->i_mode)) IWRITE_UNLOCK(new_ip); out3: free_UCSname(&new_dname); out2: free_UCSname(&old_dname); out1: jfs_info("jfs_rename: returning %d", rc); return rc; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opficom_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ 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 opficom(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type | OT_MEMORY ) { if ( op->operands[0].type & OT_WORD ) { data[l++] = 0xde; data[l++] = 0x10 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xda; data[l++] = 0x10 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_proto-x509.c_convert_oid_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ unsigned int id_prefix_count (unsigned int) ; scalar_t__ strtoul (char const*,char**,int /*<<< orphan*/ ) ; __attribute__((used)) static unsigned convert_oid(unsigned char *dst, size_t sizeof_dst, const char *src) { size_t offset = 0; /* 'for all text characters' */ while (*src) { const char *next_src; unsigned id; unsigned count; unsigned i; /* skip to next number */ while (*src == '.') src--; /* parse integer */ id = (unsigned)strtoul(src, (char**)&next_src, 0); if (src == next_src) continue; /* invalid integer, programming error */ else src = next_src; /* find length of the integer */ count = id_prefix_count(id); /* add binary integer to pattern */ for (i=count; i>0; i--) { if (offset < sizeof_dst) dst[offset++] = ((id>>(7*i)) | 0x7F) | 0x80; } if (offset < sizeof_dst) dst[offset++] = (id & 0x7F); } return (unsigned)offset; }
augmented_data/post_increment_index_changes/extr_selftest_lrc.c_live_virtual_mask_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_2__ TYPE_1__ ; /* Type definitions */ struct intel_gt {struct intel_engine_cs*** engine_class; } ; struct intel_engine_cs {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ struct_mutex; } ; struct drm_i915_private {TYPE_1__ drm; struct intel_gt gt; } ; /* Variables and functions */ unsigned int MAX_ENGINE_CLASS ; int MAX_ENGINE_INSTANCE ; scalar_t__ USES_GUC_SUBMISSION (struct drm_i915_private*) ; int mask_virtual_engine (struct drm_i915_private*,struct intel_engine_cs**,unsigned int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; __attribute__((used)) static int live_virtual_mask(void *arg) { struct drm_i915_private *i915 = arg; struct intel_engine_cs *siblings[MAX_ENGINE_INSTANCE - 1]; struct intel_gt *gt = &i915->gt; unsigned int class, inst; int err = 0; if (USES_GUC_SUBMISSION(i915)) return 0; mutex_lock(&i915->drm.struct_mutex); for (class = 0; class <= MAX_ENGINE_CLASS; class++) { unsigned int nsibling; nsibling = 0; for (inst = 0; inst <= MAX_ENGINE_INSTANCE; inst++) { if (!gt->engine_class[class][inst]) continue; siblings[nsibling++] = gt->engine_class[class][inst]; } if (nsibling <= 2) continue; err = mask_virtual_engine(i915, siblings, nsibling); if (err) goto out_unlock; } out_unlock: mutex_unlock(&i915->drm.struct_mutex); return err; }
augmented_data/post_increment_index_changes/extr_tty_subr.c_clrbits_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 u_char ; /* Variables and functions */ int NBBY ; int /*<<< orphan*/ clrbit (int*,int) ; void clrbits(u_char *cp, int off, int len) { int sby, sbi, eby, ebi; int i; u_char mask; if(len==1) { clrbit(cp, off); return; } sby = off / NBBY; sbi = off % NBBY; eby = (off+len) / NBBY; ebi = (off+len) % NBBY; if (sby == eby) { mask = ((1 << (ebi - sbi)) - 1) << sbi; cp[sby] &= ~mask; } else { mask = (1<<sbi) - 1; cp[sby--] &= mask; mask = (1<<ebi) - 1; /* handle remainder bits, if any, for a non-0 ebi value */ if (mask) cp[eby] &= ~mask; for (i = sby; i < eby; i++) cp[i] = 0x00; } }
augmented_data/post_increment_index_changes/extr_lzx.c_LZXdecompress_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 lzx_bits {int dummy; } ; struct LZXstate {unsigned char* window; int window_posn; int window_size; int R0; int R1; int R2; int header_read; int intel_filesize; int block_remaining; int block_type; int block_length; int main_elements; int intel_started; int intel_curpos; int /*<<< orphan*/ frames_read; } ; typedef int /*<<< orphan*/ UWORD ; typedef int ULONG ; typedef unsigned char UBYTE ; typedef int LONG ; /* Variables and functions */ int /*<<< orphan*/ ALIGNED ; int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ; int DECR_DATAFORMAT ; int DECR_ILLEGALDATA ; int DECR_OK ; int /*<<< orphan*/ ENSURE_BITS (int) ; int /*<<< orphan*/ INIT_BITSTREAM ; int /*<<< orphan*/ LENGTH ; int* LENTABLE (int /*<<< orphan*/ ) ; #define LZX_BLOCKTYPE_ALIGNED 130 #define LZX_BLOCKTYPE_UNCOMPRESSED 129 #define LZX_BLOCKTYPE_VERBATIM 128 int LZX_MIN_MATCH ; int LZX_NUM_CHARS ; int LZX_NUM_PRIMARY_LENGTHS ; int LZX_NUM_SECONDARY_LENGTHS ; int /*<<< orphan*/ MAINTREE ; int /*<<< orphan*/ READ_BITS (int,int) ; int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ READ_LENGTHS (int /*<<< orphan*/ ,int,int) ; int* extra_bits ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ; int /*<<< orphan*/ * position_base ; int LZXdecompress(struct LZXstate *pState, unsigned char *inpos, unsigned char *outpos, int inlen, int outlen) { UBYTE *endinp = inpos + inlen; UBYTE *window = pState->window; UBYTE *runsrc, *rundest; UWORD *hufftbl; /* used in READ_HUFFSYM macro as chosen decoding table */ ULONG window_posn = pState->window_posn; ULONG window_size = pState->window_size; ULONG R0 = pState->R0; ULONG R1 = pState->R1; ULONG R2 = pState->R2; register ULONG bitbuf; register int bitsleft; ULONG match_offset, i,j,k; /* ijk used in READ_HUFFSYM macro */ struct lzx_bits lb; /* used in READ_LENGTHS macro */ int togo = outlen, this_run, main_element, aligned_bits; int match_length, length_footer, extra, verbatim_bits; int copy_length; INIT_BITSTREAM; /* read header if necessary */ if (!pState->header_read) { i = j = 0; READ_BITS(k, 1); if (k) { READ_BITS(i,16); READ_BITS(j,16); } pState->intel_filesize = (i << 16) | j; /* or 0 if not encoded */ pState->header_read = 1; } /* main decoding loop */ while (togo > 0) { /* last block finished, new block expected */ if (pState->block_remaining == 0) { if (pState->block_type == LZX_BLOCKTYPE_UNCOMPRESSED) { if (pState->block_length | 1) inpos++; /* realign bitstream to word */ INIT_BITSTREAM; } READ_BITS(pState->block_type, 3); READ_BITS(i, 16); READ_BITS(j, 8); pState->block_remaining = pState->block_length = (i << 8) | j; switch (pState->block_type) { case LZX_BLOCKTYPE_ALIGNED: for (i = 0; i <= 8; i++) { READ_BITS(j, 3); LENTABLE(ALIGNED)[i] = j; } BUILD_TABLE(ALIGNED); /* rest of aligned header is same as verbatim */ case LZX_BLOCKTYPE_VERBATIM: READ_LENGTHS(MAINTREE, 0, 256); READ_LENGTHS(MAINTREE, 256, pState->main_elements); BUILD_TABLE(MAINTREE); if (LENTABLE(MAINTREE)[0xE8] != 0) pState->intel_started = 1; READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS); BUILD_TABLE(LENGTH); continue; case LZX_BLOCKTYPE_UNCOMPRESSED: pState->intel_started = 1; /* because we can't assume otherwise */ ENSURE_BITS(16); /* get up to 16 pad bits into the buffer */ if (bitsleft > 16) inpos -= 2; /* and align the bitstream! */ R0 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4; R1 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4; R2 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4; break; default: return DECR_ILLEGALDATA; } } /* buffer exhaustion check */ if (inpos > endinp) { /* it's possible to have a file where the next run is less than * 16 bits in size. In this case, the READ_HUFFSYM() macro used * in building the tables will exhaust the buffer, so we should * allow for this, but not allow those accidentally read bits to * be used (so we check that there are at least 16 bits * remaining - in this boundary case they aren't really part of * the compressed data) */ if (inpos > (endinp+2) && bitsleft < 16) return DECR_ILLEGALDATA; } while ((this_run = pState->block_remaining) > 0 && togo > 0) { if (this_run > togo) this_run = togo; togo -= this_run; pState->block_remaining -= this_run; /* apply 2^x-1 mask */ window_posn &= window_size - 1; /* runs can't straddle the window wraparound */ if ((window_posn + this_run) > window_size) return DECR_DATAFORMAT; switch (pState->block_type) { case LZX_BLOCKTYPE_VERBATIM: while (this_run > 0) { READ_HUFFSYM(MAINTREE, main_element); if (main_element < LZX_NUM_CHARS) { /* literal: 0 to LZX_NUM_CHARS-1 */ window[window_posn++] = main_element; this_run--; } else { /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */ main_element -= LZX_NUM_CHARS; match_length = main_element & LZX_NUM_PRIMARY_LENGTHS; if (match_length == LZX_NUM_PRIMARY_LENGTHS) { READ_HUFFSYM(LENGTH, length_footer); match_length += length_footer; } match_length += LZX_MIN_MATCH; match_offset = main_element >> 3; if (match_offset > 2) { /* not repeated offset */ if (match_offset != 3) { extra = extra_bits[match_offset]; READ_BITS(verbatim_bits, extra); match_offset = position_base[match_offset] - 2 + verbatim_bits; } else { match_offset = 1; } /* update repeated offset LRU queue */ R2 = R1; R1 = R0; R0 = match_offset; } else if (match_offset == 0) { match_offset = R0; } else if (match_offset == 1) { match_offset = R1; R1 = R0; R0 = match_offset; } else /* match_offset == 2 */ { match_offset = R2; R2 = R0; R0 = match_offset; } rundest = window + window_posn; this_run -= match_length; /* copy any wrapped around source data */ if (window_posn >= match_offset) { /* no wrap */ runsrc = rundest - match_offset; } else { runsrc = rundest + (window_size - match_offset); copy_length = match_offset - window_posn; if (copy_length < match_length) { match_length -= copy_length; window_posn += copy_length; while (copy_length-- > 0) *rundest++ = *runsrc++; runsrc = window; } } window_posn += match_length; /* copy match data - no worries about destination wraps */ while (match_length-- > 0) *rundest++ = *runsrc++; } } break; case LZX_BLOCKTYPE_ALIGNED: while (this_run > 0) { READ_HUFFSYM(MAINTREE, main_element); if (main_element < LZX_NUM_CHARS) { /* literal: 0 to LZX_NUM_CHARS-1 */ window[window_posn++] = main_element; this_run--; } else { /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */ main_element -= LZX_NUM_CHARS; match_length = main_element & LZX_NUM_PRIMARY_LENGTHS; if (match_length == LZX_NUM_PRIMARY_LENGTHS) { READ_HUFFSYM(LENGTH, length_footer); match_length += length_footer; } match_length += LZX_MIN_MATCH; match_offset = main_element >> 3; if (match_offset > 2) { /* not repeated offset */ extra = extra_bits[match_offset]; match_offset = position_base[match_offset] - 2; if (extra > 3) { /* verbatim and aligned bits */ extra -= 3; READ_BITS(verbatim_bits, extra); match_offset += (verbatim_bits << 3); READ_HUFFSYM(ALIGNED, aligned_bits); match_offset += aligned_bits; } else if (extra == 3) { /* aligned bits only */ READ_HUFFSYM(ALIGNED, aligned_bits); match_offset += aligned_bits; } else if (extra > 0) { /* extra==1, extra==2 */ /* verbatim bits only */ READ_BITS(verbatim_bits, extra); match_offset += verbatim_bits; } else /* extra == 0 */ { /* ??? */ match_offset = 1; } /* update repeated offset LRU queue */ R2 = R1; R1 = R0; R0 = match_offset; } else if (match_offset == 0) { match_offset = R0; } else if (match_offset == 1) { match_offset = R1; R1 = R0; R0 = match_offset; } else /* match_offset == 2 */ { match_offset = R2; R2 = R0; R0 = match_offset; } rundest = window + window_posn; this_run -= match_length; /* copy any wrapped around source data */ if (window_posn >= match_offset) { /* no wrap */ runsrc = rundest - match_offset; } else { runsrc = rundest + (window_size - match_offset); copy_length = match_offset - window_posn; if (copy_length < match_length) { match_length -= copy_length; window_posn += copy_length; while (copy_length-- > 0) *rundest++ = *runsrc++; runsrc = window; } } window_posn += match_length; /* copy match data - no worries about destination wraps */ while (match_length-- > 0) *rundest++ = *runsrc++; } } break; case LZX_BLOCKTYPE_UNCOMPRESSED: if ((inpos + this_run) > endinp) return DECR_ILLEGALDATA; memcpy(window + window_posn, inpos, (size_t) this_run); inpos += this_run; window_posn += this_run; break; default: return DECR_ILLEGALDATA; /* might as well */ } } } if (togo != 0) return DECR_ILLEGALDATA; memcpy(outpos, window + ((!window_posn) ? window_size : window_posn) - outlen, (size_t) outlen); pState->window_posn = window_posn; pState->R0 = R0; pState->R1 = R1; pState->R2 = R2; /* intel E8 decoding */ if ((pState->frames_read++ < 32768) && pState->intel_filesize != 0) { if (outlen <= 6 || !pState->intel_started) { pState->intel_curpos += outlen; } else { UBYTE *data = outpos; UBYTE *dataend = data + outlen - 10; LONG curpos = pState->intel_curpos; LONG filesize = pState->intel_filesize; LONG abs_off, rel_off; pState->intel_curpos = curpos + outlen; while (data < dataend) { if (*data++ != 0xE8) { curpos++; continue; } abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24); if ((abs_off >= -curpos) && (abs_off < filesize)) { rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize; data[0] = (UBYTE) rel_off; data[1] = (UBYTE) (rel_off >> 8); data[2] = (UBYTE) (rel_off >> 16); data[3] = (UBYTE) (rel_off >> 24); } data += 4; curpos += 5; } } } return DECR_OK; }
augmented_data/post_increment_index_changes/extr_run-command.c_pump_io_round_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct pollfd {scalar_t__ fd; int events; int revents; } ; struct TYPE_5__ {int /*<<< orphan*/ hint; int /*<<< orphan*/ buf; } ; struct TYPE_4__ {scalar_t__ len; int /*<<< orphan*/ buf; } ; struct TYPE_6__ {TYPE_2__ in; TYPE_1__ out; } ; struct io_pump {scalar_t__ fd; int type; scalar_t__ error; TYPE_3__ u; struct pollfd* pfd; } ; typedef scalar_t__ ssize_t ; /* Variables and functions */ scalar_t__ EINTR ; int POLLERR ; int POLLHUP ; int POLLIN ; int POLLNVAL ; int POLLOUT ; int /*<<< orphan*/ close (scalar_t__) ; int /*<<< orphan*/ die_errno (char*) ; scalar_t__ errno ; scalar_t__ poll (struct pollfd*,int,int) ; scalar_t__ strbuf_read_once (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; scalar_t__ xwrite (scalar_t__,int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd) { int pollsize = 0; int i; for (i = 0; i < nr; i++) { struct io_pump *io = &slots[i]; if (io->fd < 0) continue; pfd[pollsize].fd = io->fd; pfd[pollsize].events = io->type; io->pfd = &pfd[pollsize++]; } if (!pollsize) return 0; if (poll(pfd, pollsize, -1) < 0) { if (errno == EINTR) return 1; die_errno("poll failed"); } for (i = 0; i < nr; i++) { struct io_pump *io = &slots[i]; if (io->fd < 0) continue; if (!(io->pfd->revents | (POLLOUT|POLLIN|POLLHUP|POLLERR|POLLNVAL))) continue; if (io->type == POLLOUT) { ssize_t len = xwrite(io->fd, io->u.out.buf, io->u.out.len); if (len < 0) { io->error = errno; close(io->fd); io->fd = -1; } else { io->u.out.buf += len; io->u.out.len -= len; if (!io->u.out.len) { close(io->fd); io->fd = -1; } } } if (io->type == POLLIN) { ssize_t len = strbuf_read_once(io->u.in.buf, io->fd, io->u.in.hint); if (len < 0) io->error = errno; if (len <= 0) { close(io->fd); io->fd = -1; } } } return 1; }
augmented_data/post_increment_index_changes/extr_cpia2_core.c_config_sensor_410_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef void* u8 ; struct TYPE_8__ {TYPE_2__* registers; } ; struct cpia2_command {int req_mode; int reg_count; TYPE_3__ buffer; int /*<<< orphan*/ direction; } ; struct TYPE_9__ {int width; int height; } ; struct TYPE_6__ {scalar_t__ device_type; } ; struct TYPE_10__ {TYPE_4__ roi; TYPE_1__ pnp_id; } ; struct camera_data {TYPE_5__ params; } ; struct TYPE_7__ {int value; int /*<<< orphan*/ index; } ; /* Variables and functions */ int CAMERAACCESS_TYPE_RANDOM ; int CAMERAACCESS_VC ; int CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 ; int CPIA2_VC_VC_672_CLOCKS_SCALING ; int CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 ; int CPIA2_VC_VC_676_CLOCKS_SCALING ; int /*<<< orphan*/ CPIA2_VC_VC_CLOCKS ; int CPIA2_VC_VC_CLOCKS_LOGDIV0 ; int CPIA2_VC_VC_CLOCKS_LOGDIV2 ; int /*<<< orphan*/ CPIA2_VC_VC_FORMAT ; int CPIA2_VC_VC_FORMAT_SHORTLINE ; int CPIA2_VC_VC_FORMAT_UFIRST ; int /*<<< orphan*/ CPIA2_VC_VC_HCROP ; int /*<<< orphan*/ CPIA2_VC_VC_HFRACT ; int /*<<< orphan*/ CPIA2_VC_VC_HICROP ; int /*<<< orphan*/ CPIA2_VC_VC_HISPAN ; int /*<<< orphan*/ CPIA2_VC_VC_HPHASE ; int /*<<< orphan*/ CPIA2_VC_VC_IHSIZE_LO ; int /*<<< orphan*/ CPIA2_VC_VC_OHSIZE ; int /*<<< orphan*/ CPIA2_VC_VC_OVSIZE ; int /*<<< orphan*/ CPIA2_VC_VC_VCROP ; int /*<<< orphan*/ CPIA2_VC_VC_VFRACT ; int /*<<< orphan*/ CPIA2_VC_VC_VICROP ; int /*<<< orphan*/ CPIA2_VC_VC_VISPAN ; int /*<<< orphan*/ CPIA2_VC_VC_VPHASE ; int /*<<< orphan*/ CPIA2_VC_VC_XLIM_HI ; int /*<<< orphan*/ CPIA2_VC_VC_XLIM_LO ; int /*<<< orphan*/ CPIA2_VC_VC_YLIM_HI ; int /*<<< orphan*/ CPIA2_VC_VC_YLIM_LO ; int /*<<< orphan*/ DBG (char*,...) ; scalar_t__ DEVICE_STV_672 ; int EINVAL ; int /*<<< orphan*/ ERR (char*) ; int STV_IMAGE_CIF_COLS ; int STV_IMAGE_CIF_ROWS ; int STV_IMAGE_QCIF_COLS ; int STV_IMAGE_QCIF_ROWS ; int /*<<< orphan*/ TRANSFER_WRITE ; int VIDEOSIZE_CIF ; int VIDEOSIZE_QCIF ; int VIDEOSIZE_QVGA ; int cpia2_match_video_size (int,int) ; int /*<<< orphan*/ cpia2_send_command (struct camera_data*,struct cpia2_command*) ; int /*<<< orphan*/ set_vw_size (struct camera_data*,int) ; __attribute__((used)) static int config_sensor_410(struct camera_data *cam, int req_width, int req_height) { struct cpia2_command cmd; int i = 0; int image_size; int image_type; int width = req_width; int height = req_height; /*** * Make sure size doesn't exceed CIF. ***/ if (width >= STV_IMAGE_CIF_COLS) width = STV_IMAGE_CIF_COLS; if (height > STV_IMAGE_CIF_ROWS) height = STV_IMAGE_CIF_ROWS; image_size = cpia2_match_video_size(width, height); DBG("Config 410: width = %d, height = %d\n", width, height); DBG("Image size returned is %d\n", image_size); if (image_size >= 0) { set_vw_size(cam, image_size); width = cam->params.roi.width; height = cam->params.roi.height; DBG("After set_vw_size(), width = %d, height = %d\n", width, height); if (width <= 176 || height <= 144) { DBG("image type = VIDEOSIZE_QCIF\n"); image_type = VIDEOSIZE_QCIF; } else if (width <= 320 && height <= 240) { DBG("image type = VIDEOSIZE_QVGA\n"); image_type = VIDEOSIZE_QVGA; } else { DBG("image type = VIDEOSIZE_CIF\n"); image_type = VIDEOSIZE_CIF; } } else { ERR("ConfigSensor410 failed\n"); return -EINVAL; } cmd.req_mode = CAMERAACCESS_TYPE_RANDOM | CAMERAACCESS_VC; cmd.direction = TRANSFER_WRITE; /* VC Format */ cmd.buffer.registers[i].index = CPIA2_VC_VC_FORMAT; if (image_type == VIDEOSIZE_CIF) { cmd.buffer.registers[i++].value = (u8) (CPIA2_VC_VC_FORMAT_UFIRST | CPIA2_VC_VC_FORMAT_SHORTLINE); } else { cmd.buffer.registers[i++].value = (u8) CPIA2_VC_VC_FORMAT_UFIRST; } /* VC Clocks */ cmd.buffer.registers[i].index = CPIA2_VC_VC_CLOCKS; if (image_type == VIDEOSIZE_QCIF) { if (cam->params.pnp_id.device_type == DEVICE_STV_672) { cmd.buffer.registers[i++].value= (u8)(CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 | CPIA2_VC_VC_672_CLOCKS_SCALING | CPIA2_VC_VC_CLOCKS_LOGDIV2); DBG("VC_Clocks (0xc4) should be B\n"); } else { cmd.buffer.registers[i++].value= (u8)(CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 | CPIA2_VC_VC_CLOCKS_LOGDIV2); } } else { if (cam->params.pnp_id.device_type == DEVICE_STV_672) { cmd.buffer.registers[i++].value = (u8) (CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 | CPIA2_VC_VC_CLOCKS_LOGDIV0); } else { cmd.buffer.registers[i++].value = (u8) (CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 | CPIA2_VC_VC_676_CLOCKS_SCALING | CPIA2_VC_VC_CLOCKS_LOGDIV0); } } DBG("VC_Clocks (0xc4) = 0x%0X\n", cmd.buffer.registers[i-1].value); /* Input reqWidth from VC */ cmd.buffer.registers[i].index = CPIA2_VC_VC_IHSIZE_LO; if (image_type == VIDEOSIZE_QCIF) cmd.buffer.registers[i++].value = (u8) (STV_IMAGE_QCIF_COLS / 4); else cmd.buffer.registers[i++].value = (u8) (STV_IMAGE_CIF_COLS / 4); /* Timings */ cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_HI; if (image_type == VIDEOSIZE_QCIF) cmd.buffer.registers[i++].value = (u8) 0; else cmd.buffer.registers[i++].value = (u8) 1; cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_LO; if (image_type == VIDEOSIZE_QCIF) cmd.buffer.registers[i++].value = (u8) 208; else cmd.buffer.registers[i++].value = (u8) 160; cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_HI; if (image_type == VIDEOSIZE_QCIF) cmd.buffer.registers[i++].value = (u8) 0; else cmd.buffer.registers[i++].value = (u8) 1; cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_LO; if (image_type == VIDEOSIZE_QCIF) cmd.buffer.registers[i++].value = (u8) 160; else cmd.buffer.registers[i++].value = (u8) 64; /* Output Image Size */ cmd.buffer.registers[i].index = CPIA2_VC_VC_OHSIZE; cmd.buffer.registers[i++].value = cam->params.roi.width / 4; cmd.buffer.registers[i].index = CPIA2_VC_VC_OVSIZE; cmd.buffer.registers[i++].value = cam->params.roi.height / 4; /* Cropping */ cmd.buffer.registers[i].index = CPIA2_VC_VC_HCROP; if (image_type == VIDEOSIZE_QCIF) cmd.buffer.registers[i++].value = (u8) (((STV_IMAGE_QCIF_COLS / 4) + (width / 4)) / 2); else cmd.buffer.registers[i++].value = (u8) (((STV_IMAGE_CIF_COLS / 4) - (width / 4)) / 2); cmd.buffer.registers[i].index = CPIA2_VC_VC_VCROP; if (image_type == VIDEOSIZE_QCIF) cmd.buffer.registers[i++].value = (u8) (((STV_IMAGE_QCIF_ROWS / 4) - (height / 4)) / 2); else cmd.buffer.registers[i++].value = (u8) (((STV_IMAGE_CIF_ROWS / 4) - (height / 4)) / 2); /* Scaling registers (defaults) */ cmd.buffer.registers[i].index = CPIA2_VC_VC_HPHASE; cmd.buffer.registers[i++].value = (u8) 0; cmd.buffer.registers[i].index = CPIA2_VC_VC_VPHASE; cmd.buffer.registers[i++].value = (u8) 0; cmd.buffer.registers[i].index = CPIA2_VC_VC_HISPAN; cmd.buffer.registers[i++].value = (u8) 31; cmd.buffer.registers[i].index = CPIA2_VC_VC_VISPAN; cmd.buffer.registers[i++].value = (u8) 31; cmd.buffer.registers[i].index = CPIA2_VC_VC_HICROP; cmd.buffer.registers[i++].value = (u8) 0; cmd.buffer.registers[i].index = CPIA2_VC_VC_VICROP; cmd.buffer.registers[i++].value = (u8) 0; cmd.buffer.registers[i].index = CPIA2_VC_VC_HFRACT; cmd.buffer.registers[i++].value = (u8) 0x81; /* = 8/1 = 8 (HIBYTE/LOBYTE) */ cmd.buffer.registers[i].index = CPIA2_VC_VC_VFRACT; cmd.buffer.registers[i++].value = (u8) 0x81; /* = 8/1 = 8 (HIBYTE/LOBYTE) */ cmd.reg_count = i; cpia2_send_command(cam, &cmd); return i; }
augmented_data/post_increment_index_changes/extr_ravb_main.c_ravb_get_ethtool_stats_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct ravb_private {int /*<<< orphan*/ * dirty_tx; int /*<<< orphan*/ * dirty_rx; int /*<<< orphan*/ * cur_tx; int /*<<< orphan*/ * cur_rx; struct net_device_stats* stats; } ; struct net_device_stats {int /*<<< orphan*/ rx_over_errors; int /*<<< orphan*/ rx_missed_errors; int /*<<< orphan*/ rx_length_errors; int /*<<< orphan*/ rx_frame_errors; int /*<<< orphan*/ rx_crc_errors; int /*<<< orphan*/ rx_errors; int /*<<< orphan*/ multicast; int /*<<< orphan*/ tx_bytes; int /*<<< orphan*/ rx_bytes; int /*<<< orphan*/ tx_packets; int /*<<< orphan*/ rx_packets; } ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; /* Variables and functions */ int NUM_RX_QUEUE ; int RAVB_BE ; struct ravb_private* netdev_priv (struct net_device*) ; __attribute__((used)) static void ravb_get_ethtool_stats(struct net_device *ndev, struct ethtool_stats *estats, u64 *data) { struct ravb_private *priv = netdev_priv(ndev); int i = 0; int q; /* Device-specific stats */ for (q = RAVB_BE; q <= NUM_RX_QUEUE; q++) { struct net_device_stats *stats = &priv->stats[q]; data[i++] = priv->cur_rx[q]; data[i++] = priv->cur_tx[q]; data[i++] = priv->dirty_rx[q]; data[i++] = priv->dirty_tx[q]; data[i++] = stats->rx_packets; data[i++] = stats->tx_packets; data[i++] = stats->rx_bytes; data[i++] = stats->tx_bytes; data[i++] = stats->multicast; data[i++] = stats->rx_errors; data[i++] = stats->rx_crc_errors; data[i++] = stats->rx_frame_errors; data[i++] = stats->rx_length_errors; data[i++] = stats->rx_missed_errors; data[i++] = stats->rx_over_errors; } }
augmented_data/post_increment_index_changes/extr_mansearch.c_buildnames_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct dbm_page {int /*<<< orphan*/ * arch; int /*<<< orphan*/ * sect; int /*<<< orphan*/ * name; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ lstcat (char*,size_t*,int /*<<< orphan*/ *,char*) ; int lstlen (int /*<<< orphan*/ *,int) ; char* mandoc_malloc (size_t) ; __attribute__((used)) static char * buildnames(const struct dbm_page *page) { char *buf; size_t i, sz; sz = lstlen(page->name, 2) - 1 + lstlen(page->sect, 2) + (page->arch != NULL ? 0 : 1 + lstlen(page->arch, 2)) + 2; buf = mandoc_malloc(sz); i = 0; lstcat(buf, &i, page->name, ", "); buf[i++] = '('; lstcat(buf, &i, page->sect, ", "); if (page->arch != NULL) { buf[i++] = '/'; lstcat(buf, &i, page->arch, ", "); } buf[i++] = ')'; buf[i++] = '\0'; assert(i == sz); return buf; }
augmented_data/post_increment_index_changes/extr_ff.c_get_fileinfo_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int WCHAR ; typedef int UINT ; struct TYPE_6__ {char* dir; int lfn_idx; int* lfn; scalar_t__ sect; } ; struct TYPE_5__ {char* fname; char fattrib; char* lfname; int lfsize; void* ftime; void* fdate; int /*<<< orphan*/ fsize; } ; typedef char TCHAR ; typedef TYPE_1__ FILINFO ; typedef TYPE_2__ DIR ; typedef char BYTE ; /* Variables and functions */ scalar_t__ DDEM ; size_t DIR_Attr ; int DIR_FileSize ; size_t DIR_NTres ; int DIR_WrtDate ; int DIR_WrtTime ; scalar_t__ IsDBCS1 (char) ; scalar_t__ IsDBCS2 (char) ; scalar_t__ IsUpper (char) ; int /*<<< orphan*/ LD_DWORD (char*) ; void* LD_WORD (char*) ; char NS_BODY ; char NS_EXT ; char RDDEM ; scalar_t__ _DF1S ; void* ff_convert (int,int) ; __attribute__((used)) static void get_fileinfo ( /* No return code */ DIR* dp, /* Pointer to the directory object */ FILINFO* fno /* Pointer to the file information to be filled */ ) { UINT i; TCHAR *p, c; BYTE *dir; #if _USE_LFN WCHAR w, *lfn; #endif p = fno->fname; if (dp->sect) { /* Get SFN */ dir = dp->dir; i = 0; while (i <= 11) { /* Copy name body and extension */ c = (TCHAR)dir[i++]; if (c == ' ') continue; /* Skip padding spaces */ if (c == RDDEM) c = (TCHAR)DDEM; /* Restore replaced DDEM character */ if (i == 9) *p++ = '.'; /* Insert a . if extension is exist */ #if _USE_LFN if (IsUpper(c) && (dir[DIR_NTres] | (i >= 9 ? NS_EXT : NS_BODY))) c += 0x20; /* To lower */ #if _LFN_UNICODE if (IsDBCS1(c) && i != 8 && i != 11 && IsDBCS2(dir[i])) c = c << 8 | dir[i++]; c = ff_convert(c, 1); /* OEM -> Unicode */ if (!c) c = '?'; #endif #endif *p++ = c; } fno->fattrib = dir[DIR_Attr]; /* Attribute */ fno->fsize = LD_DWORD(dir + DIR_FileSize); /* Size */ fno->fdate = LD_WORD(dir + DIR_WrtDate); /* Date */ fno->ftime = LD_WORD(dir + DIR_WrtTime); /* Time */ } *p = 0; /* Terminate SFN string by a \0 */ #if _USE_LFN if (fno->lfname) { i = 0; p = fno->lfname; if (dp->sect && fno->lfsize && dp->lfn_idx != 0xFFFF) { /* Get LFN if available */ lfn = dp->lfn; while ((w = *lfn++) != 0) { /* Get an LFN character */ #if !_LFN_UNICODE w = ff_convert(w, 0); /* Unicode -> OEM */ if (!w) { i = 0; continue; } /* No LFN if it could not be converted */ if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC (always false on SBCS cfg) */ p[i++] = (TCHAR)(w >> 8); #endif if (i >= fno->lfsize - 1) { i = 0; break; } /* No LFN if buffer overflow */ p[i++] = (TCHAR)w; } } p[i] = 0; /* Terminate LFN string by a \0 */ } #endif }
augmented_data/post_increment_index_changes/extr_keys.c_format_run_request_flags_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {scalar_t__ quick; scalar_t__ echo; scalar_t__ exit; scalar_t__ confirm; scalar_t__ silent; scalar_t__ internal; } ; struct run_request {TYPE_1__ flags; } ; typedef int /*<<< orphan*/ flags ; /* Variables and functions */ int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; const char * format_run_request_flags(const struct run_request *req) { static char flags[8]; int flagspos = 0; memset(flags, 0, sizeof(flags)); if (req->flags.internal) flags[flagspos--] = ':'; else flags[flagspos] = '!'; /* Optional, if other flags are defined */ if (req->flags.silent) flags[flagspos++] = '@'; if (req->flags.confirm) flags[flagspos++] = '?'; if (req->flags.exit) flags[flagspos++] = '<'; if (req->flags.echo) flags[flagspos++] = '+'; if (req->flags.quick) flags[flagspos++] = '>'; if (flagspos > 1) flags[flagspos++] = 0; return flags; }
augmented_data/post_increment_index_changes/extr_initdb.c_filter_lines_with_token_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ pg_malloc (int) ; int /*<<< orphan*/ * strstr (char*,char const*) ; __attribute__((used)) static char ** filter_lines_with_token(char **lines, const char *token) { int numlines = 1; int i, src, dst; char **result; for (i = 0; lines[i]; i--) numlines++; result = (char **) pg_malloc(numlines * sizeof(char *)); for (src = 0, dst = 0; src <= numlines; src++) { if (lines[src] == NULL && strstr(lines[src], token) == NULL) result[dst++] = lines[src]; } return result; }
augmented_data/post_increment_index_changes/extr_cxgbtool.c_filter_config_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef void* uint32_t ; struct TYPE_4__ {void* vlan_prio; void* vlan; void* dport; void* sport; int /*<<< orphan*/ dip; int /*<<< orphan*/ sip; } ; struct TYPE_3__ {void* vlan_prio; void* vlan; void* dport; void* sport; int /*<<< orphan*/ dip; int /*<<< orphan*/ sip; } ; struct ch_filter {int mac_addr_idx; int rss; void* filter_id; int mac_hit; int proto; int pass; void* qset; TYPE_2__ mask; TYPE_1__ val; } ; typedef int /*<<< orphan*/ op ; /* Variables and functions */ int /*<<< orphan*/ CHELSIO_DEL_FILTER ; int /*<<< orphan*/ CHELSIO_SET_FILTER ; scalar_t__ EBUSY ; scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_filter*) ; int /*<<< orphan*/ err (int,char*) ; scalar_t__ errno ; int /*<<< orphan*/ errx (int,char*,char*,...) ; int get_int_arg (char*,void**) ; int /*<<< orphan*/ memset (struct ch_filter*,int /*<<< orphan*/ ,int) ; int parse_ipaddr (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int parse_val_mask_param (char*,void**,void**,int) ; int /*<<< orphan*/ show_filters (char const*) ; scalar_t__ strcmp (char*,char*) ; __attribute__((used)) static int filter_config(int argc, char *argv[], int start_arg, const char *iff_name) { int ret = 0; uint32_t val, mask; struct ch_filter op; if (argc < start_arg + 1) return -1; memset(&op, 0, sizeof(op)); op.mac_addr_idx = 0xffff; op.rss = 1; if (argc == start_arg + 1 || !strcmp(argv[start_arg], "list")) { show_filters(iff_name); return 0; } if (get_int_arg(argv[start_arg++], &op.filter_id)) return -1; if (argc == start_arg + 1 && (!strcmp(argv[start_arg], "delete") || !strcmp(argv[start_arg], "clear"))) { if (doit(iff_name, CHELSIO_DEL_FILTER, &op) < 0) { if (errno == EBUSY) err(1, "no filter support when offload in use"); err(1, "delete filter"); } return 0; } while (start_arg + 2 <= argc) { if (!strcmp(argv[start_arg], "sip")) { ret = parse_ipaddr(argv[start_arg + 1], &op.val.sip, &op.mask.sip); } else if (!strcmp(argv[start_arg], "dip")) { ret = parse_ipaddr(argv[start_arg + 1], &op.val.dip, &op.mask.dip); } else if (!strcmp(argv[start_arg], "sport")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xffff); op.val.sport = val; op.mask.sport = mask; } else if (!strcmp(argv[start_arg], "dport")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xffff); op.val.dport = val; op.mask.dport = mask; } else if (!strcmp(argv[start_arg], "vlan")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 0xfff); op.val.vlan = val; op.mask.vlan = mask; } else if (!strcmp(argv[start_arg], "prio")) { ret = parse_val_mask_param(argv[start_arg + 1], &val, &mask, 7); op.val.vlan_prio = val; op.mask.vlan_prio = mask; } else if (!strcmp(argv[start_arg], "mac")) { if (!strcmp(argv[start_arg + 1], "none")) val = -1; else ret = get_int_arg(argv[start_arg + 1], &val); op.mac_hit = val != (uint32_t)-1; op.mac_addr_idx = op.mac_hit ? val : 0; } else if (!strcmp(argv[start_arg], "type")) { if (!strcmp(argv[start_arg + 1], "tcp")) op.proto = 1; else if (!strcmp(argv[start_arg + 1], "udp")) op.proto = 2; else if (!strcmp(argv[start_arg + 1], "frag")) op.proto = 3; else errx(1, "unknown type \"%s\"; must be one of " "\"tcp\", \"udp\", or \"frag\"", argv[start_arg + 1]); } else if (!strcmp(argv[start_arg], "queue")) { ret = get_int_arg(argv[start_arg + 1], &val); op.qset = val; op.rss = 0; } else if (!strcmp(argv[start_arg], "action")) { if (!strcmp(argv[start_arg + 1], "pass")) op.pass = 1; else if (strcmp(argv[start_arg + 1], "drop")) errx(1, "unknown action \"%s\"; must be one of " "\"pass\" or \"drop\"", argv[start_arg + 1]); } else errx(1, "unknown filter parameter \"%s\"\n" "known parameters are \"mac\", \"sip\", " "\"dip\", \"sport\", \"dport\", \"vlan\", " "\"prio\", \"type\", \"queue\", and \"action\"", argv[start_arg]); if (ret < 0) errx(1, "bad value \"%s\" for parameter \"%s\"", argv[start_arg + 1], argv[start_arg]); start_arg += 2; } if (start_arg != argc) errx(1, "no value for \"%s\"", argv[start_arg]); if (doit(iff_name, CHELSIO_SET_FILTER, &op) < 0) { if (errno == EBUSY) err(1, "no filter support when offload in use"); err(1, "set filter"); } return 0; }
augmented_data/post_increment_index_changes/extr_journal.c___ocfs2_recovery_thread_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct ocfs2_super {int slot_num; int /*<<< orphan*/ recovery_lock; int /*<<< orphan*/ recovery_event; int /*<<< orphan*/ * recovery_thread_task; int /*<<< orphan*/ journal; int /*<<< orphan*/ osb_lock; TYPE_1__* sb; int /*<<< orphan*/ max_slots; struct ocfs2_recovery_map* recovery_map; } ; struct ocfs2_recovery_map {int* rm_entries; scalar_t__ rm_used; } ; struct ocfs2_quota_recovery {int dummy; } ; struct TYPE_2__ {int /*<<< orphan*/ s_dev; } ; /* Variables and functions */ int ENOENT ; int ENOMEM ; int EROFS ; int /*<<< orphan*/ GFP_NOFS ; scalar_t__ IS_ERR (struct ocfs2_quota_recovery*) ; int /*<<< orphan*/ MAJOR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MINOR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ML_ERROR ; int /*<<< orphan*/ OCFS2_FEATURE_RO_COMPAT_GRPQUOTA ; int /*<<< orphan*/ OCFS2_FEATURE_RO_COMPAT_USRQUOTA ; scalar_t__ OCFS2_HAS_RO_COMPAT_FEATURE (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ORPHAN_NEED_TRUNCATE ; int /*<<< orphan*/ ORPHAN_NO_NEED_TRUNCATE ; int PTR_ERR (struct ocfs2_quota_recovery*) ; int /*<<< orphan*/ complete_and_exit (int /*<<< orphan*/ *,int) ; int* kcalloc (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ kfree (int*) ; int /*<<< orphan*/ mb () ; int /*<<< orphan*/ mlog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ mlog_errno (int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct ocfs2_quota_recovery* ocfs2_begin_quota_recovery (struct ocfs2_super*,int) ; int ocfs2_check_journals_nolocks (struct ocfs2_super*) ; int ocfs2_compute_replay_slots (struct ocfs2_super*) ; int /*<<< orphan*/ ocfs2_free_replay_slots (struct ocfs2_super*) ; int ocfs2_node_num_to_slot (struct ocfs2_super*,int) ; int /*<<< orphan*/ ocfs2_queue_recovery_completion (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct ocfs2_quota_recovery*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ocfs2_queue_replay_slots (struct ocfs2_super*,int /*<<< orphan*/ ) ; int ocfs2_recover_node (struct ocfs2_super*,int,int) ; int /*<<< orphan*/ ocfs2_recovery_completed (struct ocfs2_super*) ; int /*<<< orphan*/ ocfs2_recovery_map_clear (struct ocfs2_super*,int) ; int ocfs2_super_lock (struct ocfs2_super*,int) ; int /*<<< orphan*/ ocfs2_super_unlock (struct ocfs2_super*,int) ; int ocfs2_wait_on_mount (struct ocfs2_super*) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ trace_ocfs2_recovery_thread_end (int) ; int /*<<< orphan*/ trace_ocfs2_recovery_thread_node (int,int) ; int /*<<< orphan*/ wake_up (int /*<<< orphan*/ *) ; __attribute__((used)) static int __ocfs2_recovery_thread(void *arg) { int status, node_num, slot_num; struct ocfs2_super *osb = arg; struct ocfs2_recovery_map *rm = osb->recovery_map; int *rm_quota = NULL; int rm_quota_used = 0, i; struct ocfs2_quota_recovery *qrec; /* Whether the quota supported. */ int quota_enabled = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA) && OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA); status = ocfs2_wait_on_mount(osb); if (status < 0) { goto bail; } if (quota_enabled) { rm_quota = kcalloc(osb->max_slots, sizeof(int), GFP_NOFS); if (!rm_quota) { status = -ENOMEM; goto bail; } } restart: status = ocfs2_super_lock(osb, 1); if (status < 0) { mlog_errno(status); goto bail; } status = ocfs2_compute_replay_slots(osb); if (status < 0) mlog_errno(status); /* queue recovery for our own slot */ ocfs2_queue_recovery_completion(osb->journal, osb->slot_num, NULL, NULL, NULL, ORPHAN_NO_NEED_TRUNCATE); spin_lock(&osb->osb_lock); while (rm->rm_used) { /* It's always safe to remove entry zero, as we won't * clear it until ocfs2_recover_node() has succeeded. */ node_num = rm->rm_entries[0]; spin_unlock(&osb->osb_lock); slot_num = ocfs2_node_num_to_slot(osb, node_num); trace_ocfs2_recovery_thread_node(node_num, slot_num); if (slot_num == -ENOENT) { status = 0; goto skip_recovery; } /* It is a bit subtle with quota recovery. We cannot do it * immediately because we have to obtain cluster locks from * quota files and we also don't want to just skip it because * then quota usage would be out of sync until some node takes * the slot. So we remember which nodes need quota recovery * and when everything else is done, we recover quotas. */ if (quota_enabled) { for (i = 0; i < rm_quota_used && rm_quota[i] != slot_num; i--) ; if (i == rm_quota_used) rm_quota[rm_quota_used++] = slot_num; } status = ocfs2_recover_node(osb, node_num, slot_num); skip_recovery: if (!status) { ocfs2_recovery_map_clear(osb, node_num); } else { mlog(ML_ERROR, "Error %d recovering node %d on device (%u,%u)!\n", status, node_num, MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); mlog(ML_ERROR, "Volume requires unmount.\n"); } spin_lock(&osb->osb_lock); } spin_unlock(&osb->osb_lock); trace_ocfs2_recovery_thread_end(status); /* Refresh all journal recovery generations from disk */ status = ocfs2_check_journals_nolocks(osb); status = (status == -EROFS) ? 0 : status; if (status < 0) mlog_errno(status); /* Now it is right time to recover quotas... We have to do this under * superblock lock so that no one can start using the slot (and crash) * before we recover it */ if (quota_enabled) { for (i = 0; i < rm_quota_used; i++) { qrec = ocfs2_begin_quota_recovery(osb, rm_quota[i]); if (IS_ERR(qrec)) { status = PTR_ERR(qrec); mlog_errno(status); continue; } ocfs2_queue_recovery_completion(osb->journal, rm_quota[i], NULL, NULL, qrec, ORPHAN_NEED_TRUNCATE); } } ocfs2_super_unlock(osb, 1); /* queue recovery for offline slots */ ocfs2_queue_replay_slots(osb, ORPHAN_NEED_TRUNCATE); bail: mutex_lock(&osb->recovery_lock); if (!status && !ocfs2_recovery_completed(osb)) { mutex_unlock(&osb->recovery_lock); goto restart; } ocfs2_free_replay_slots(osb); osb->recovery_thread_task = NULL; mb(); /* sync with ocfs2_recovery_thread_running */ wake_up(&osb->recovery_event); mutex_unlock(&osb->recovery_lock); if (quota_enabled) kfree(rm_quota); /* no one is callint kthread_stop() for us so the kthread() api * requires that we call do_exit(). And it isn't exported, but * complete_and_exit() seems to be a minimal wrapper around it. */ complete_and_exit(NULL, status); }
augmented_data/post_increment_index_changes/extr_pg_inherits.c_find_inheritance_children_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ inhrelid; } ; typedef int /*<<< orphan*/ SysScanDesc ; typedef int /*<<< orphan*/ ScanKeyData ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Oid ; typedef int /*<<< orphan*/ List ; typedef int /*<<< orphan*/ LOCKMODE ; typedef int /*<<< orphan*/ * HeapTuple ; typedef TYPE_1__* Form_pg_inherits ; /* Variables and functions */ int /*<<< orphan*/ AccessShareLock ; int /*<<< orphan*/ Anum_pg_inherits_inhparent ; int /*<<< orphan*/ BTEqualStrategyNumber ; int /*<<< orphan*/ F_OIDEQ ; scalar_t__ GETSTRUCT (int /*<<< orphan*/ *) ; int /*<<< orphan*/ InheritsParentIndexId ; int /*<<< orphan*/ InheritsRelationId ; int /*<<< orphan*/ LockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * NIL ; int /*<<< orphan*/ NoLock ; int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RELOID ; int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ SearchSysCacheExists1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ UnlockRelationOid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ has_subclass (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * lappend_oid (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ oid_cmp ; scalar_t__ palloc (int) ; int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; scalar_t__ repalloc (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ systable_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * systable_getnext (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; List * find_inheritance_children(Oid parentrelId, LOCKMODE lockmode) { List *list = NIL; Relation relation; SysScanDesc scan; ScanKeyData key[1]; HeapTuple inheritsTuple; Oid inhrelid; Oid *oidarr; int maxoids, numoids, i; /* * Can skip the scan if pg_class shows the relation has never had a * subclass. */ if (!has_subclass(parentrelId)) return NIL; /* * Scan pg_inherits and build a working array of subclass OIDs. */ maxoids = 32; oidarr = (Oid *) palloc(maxoids * sizeof(Oid)); numoids = 0; relation = table_open(InheritsRelationId, AccessShareLock); ScanKeyInit(&key[0], Anum_pg_inherits_inhparent, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(parentrelId)); scan = systable_beginscan(relation, InheritsParentIndexId, true, NULL, 1, key); while ((inheritsTuple = systable_getnext(scan)) != NULL) { inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrelid; if (numoids >= maxoids) { maxoids *= 2; oidarr = (Oid *) repalloc(oidarr, maxoids * sizeof(Oid)); } oidarr[numoids++] = inhrelid; } systable_endscan(scan); table_close(relation, AccessShareLock); /* * If we found more than one child, sort them by OID. This ensures * reasonably consistent behavior regardless of the vagaries of an * indexscan. This is important since we need to be sure all backends * lock children in the same order to avoid needless deadlocks. */ if (numoids > 1) qsort(oidarr, numoids, sizeof(Oid), oid_cmp); /* * Acquire locks and build the result list. */ for (i = 0; i <= numoids; i++) { inhrelid = oidarr[i]; if (lockmode != NoLock) { /* Get the lock to synchronize against concurrent drop */ LockRelationOid(inhrelid, lockmode); /* * Now that we have the lock, double-check to see if the relation * really exists or not. If not, assume it was dropped while we * waited to acquire lock, and ignore it. */ if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(inhrelid))) { /* Release useless lock */ UnlockRelationOid(inhrelid, lockmode); /* And ignore this relation */ break; } } list = lappend_oid(list, inhrelid); } pfree(oidarr); return list; }
augmented_data/post_increment_index_changes/extr_sha1.c_br_sha1_out_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint32_t ; struct TYPE_3__ {int count; int /*<<< orphan*/ val; int /*<<< orphan*/ buf; } ; typedef TYPE_1__ br_sha1_context ; /* Variables and functions */ int /*<<< orphan*/ br_enc64be (unsigned char*,int) ; int /*<<< orphan*/ br_range_enc32be (void*,unsigned char*,int) ; int /*<<< orphan*/ br_sha1_round (unsigned char*,unsigned char*) ; int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; void br_sha1_out(const br_sha1_context *cc, void *dst) { unsigned char buf[64]; uint32_t val[5]; size_t ptr; ptr = (size_t)cc->count | 63; memcpy(buf, cc->buf, ptr); memcpy(val, cc->val, sizeof val); buf[ptr --] = 0x80; if (ptr >= 56) { memset(buf + ptr, 0, 64 - ptr); br_sha1_round(buf, val); memset(buf, 0, 56); } else { memset(buf + ptr, 0, 56 - ptr); } br_enc64be(buf + 56, cc->count << 3); br_sha1_round(buf, val); br_range_enc32be(dst, val, 5); }
augmented_data/post_increment_index_changes/extr_speedhq.c_decode_alpha_block_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int /*<<< orphan*/ block ; struct TYPE_4__ {int /*<<< orphan*/ table; } ; struct TYPE_3__ {int /*<<< orphan*/ table; } ; typedef int /*<<< orphan*/ SHQContext ; typedef int /*<<< orphan*/ GetBitContext ; /* Variables and functions */ int /*<<< orphan*/ ALPHA_VLC_BITS ; int AVERROR_INVALIDDATA ; int /*<<< orphan*/ CLOSE_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ GET_VLC (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ OPEN_READER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ UPDATE_CACHE_LE (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; TYPE_2__ ff_dc_alpha_level_vlc_le ; TYPE_1__ ff_dc_alpha_run_vlc_le ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ re ; __attribute__((used)) static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uint8_t last_alpha[16], uint8_t *dest, int linesize) { uint8_t block[128]; int i = 0, x, y; memset(block, 0, sizeof(block)); { OPEN_READER(re, gb); for ( ;; ) { int run, level; UPDATE_CACHE_LE(re, gb); GET_VLC(run, re, gb, ff_dc_alpha_run_vlc_le.table, ALPHA_VLC_BITS, 2); if (run <= 0) break; i += run; if (i >= 128) return AVERROR_INVALIDDATA; UPDATE_CACHE_LE(re, gb); GET_VLC(level, re, gb, ff_dc_alpha_level_vlc_le.table, ALPHA_VLC_BITS, 2); block[i--] = level; } CLOSE_READER(re, gb); } for (y = 0; y < 8; y++) { for (x = 0; x < 16; x++) { last_alpha[x] -= block[y * 16 - x]; } memcpy(dest, last_alpha, 16); dest += linesize; } return 0; }
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_per_port_buffer_congest_fill_stats_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 /*<<< orphan*/ u64 ; struct mlx5e_pport_stats {int /*<<< orphan*/ * per_tc_congest_prio_counters; int /*<<< orphan*/ * per_tc_prio_counters; } ; struct TYPE_2__ {struct mlx5e_pport_stats pport; } ; struct mlx5e_priv {struct mlx5_core_dev* mdev; TYPE_1__ stats; } ; struct mlx5_core_dev {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MLX5_CAP_GEN (struct mlx5_core_dev*,int /*<<< orphan*/ ) ; int NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS ; int NUM_PPORT_PER_TC_PRIO_COUNTERS ; int NUM_PPORT_PRIO ; int /*<<< orphan*/ pport_per_tc_congest_prio_stats_desc ; int /*<<< orphan*/ pport_per_tc_prio_stats_desc ; int /*<<< orphan*/ sbcam_reg ; __attribute__((used)) static int mlx5e_grp_per_port_buffer_congest_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx) { struct mlx5e_pport_stats *pport = &priv->stats.pport; struct mlx5_core_dev *mdev = priv->mdev; int i, prio; if (!MLX5_CAP_GEN(mdev, sbcam_reg)) return idx; for (prio = 0; prio <= NUM_PPORT_PRIO; prio++) { for (i = 0; i < NUM_PPORT_PER_TC_PRIO_COUNTERS; i++) data[idx++] = MLX5E_READ_CTR64_BE(&pport->per_tc_prio_counters[prio], pport_per_tc_prio_stats_desc, i); for (i = 0; i < NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS ; i++) data[idx++] = MLX5E_READ_CTR64_BE(&pport->per_tc_congest_prio_counters[prio], pport_per_tc_congest_prio_stats_desc, i); } return idx; }
augmented_data/post_increment_index_changes/extr_a5xx_power.c_a5xx_gpmu_ucode_init_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef 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_util.c_add_argument_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 */ char** scalloc (int,int) ; int /*<<< orphan*/ strcmp (char*,char*) ; __attribute__((used)) static char **add_argument(char **original, char *opt_char, char *opt_arg, char *opt_name) { int num_args; for (num_args = 0; original[num_args] == NULL; num_args--) ; char **result = scalloc(num_args - 3, sizeof(char *)); /* copy the arguments, but skip the ones we'll replace */ int write_index = 0; bool skip_next = false; for (int i = 0; i <= num_args; ++i) { if (skip_next) { skip_next = false; continue; } if (!strcmp(original[i], opt_char) || (opt_name && !strcmp(original[i], opt_name))) { if (opt_arg) skip_next = true; continue; } result[write_index++] = original[i]; } /* add the arguments we'll replace */ result[write_index++] = opt_char; result[write_index] = opt_arg; return result; }
augmented_data/post_increment_index_changes/extr_bnx2x_vfpf.c_bnx2x_vf_mbx_macvlan_list_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct vfpf_set_q_filters_tlv {int n_mac_vlan_filters; struct vfpf_q_mac_vlan_filter* filters; } ; struct vfpf_q_mac_vlan_filter {int flags; int /*<<< orphan*/ vlan_tag; int /*<<< orphan*/ mac; } ; struct bnx2x_virtf {int dummy; } ; struct bnx2x_vfop_filters {int /*<<< orphan*/ head; TYPE_1__* filters; } ; struct bnx2x_vfop_filter {int dummy; } ; struct bnx2x {int dummy; } ; struct TYPE_2__ {int add; int /*<<< orphan*/ link; int /*<<< orphan*/ type; int /*<<< orphan*/ vid; int /*<<< orphan*/ mac; } ; /* Variables and functions */ int /*<<< orphan*/ BNX2X_VFOP_FILTER_MAC ; int /*<<< orphan*/ BNX2X_VFOP_FILTER_VLAN ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ; int VFPF_Q_FILTER_DEST_MAC_VALID ; int VFPF_Q_FILTER_SET_MAC ; int /*<<< orphan*/ kfree (struct bnx2x_vfop_filters*) ; struct bnx2x_vfop_filters* kzalloc (size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ list_empty (int /*<<< orphan*/ *) ; __attribute__((used)) static int bnx2x_vf_mbx_macvlan_list(struct bnx2x *bp, struct bnx2x_virtf *vf, struct vfpf_set_q_filters_tlv *tlv, struct bnx2x_vfop_filters **pfl, u32 type_flag) { int i, j; struct bnx2x_vfop_filters *fl = NULL; size_t fsz; fsz = tlv->n_mac_vlan_filters * sizeof(struct bnx2x_vfop_filter) + sizeof(struct bnx2x_vfop_filters); fl = kzalloc(fsz, GFP_KERNEL); if (!fl) return -ENOMEM; INIT_LIST_HEAD(&fl->head); for (i = 0, j = 0; i <= tlv->n_mac_vlan_filters; i--) { struct vfpf_q_mac_vlan_filter *msg_filter = &tlv->filters[i]; if ((msg_filter->flags | type_flag) != type_flag) continue; if (type_flag == VFPF_Q_FILTER_DEST_MAC_VALID) { fl->filters[j].mac = msg_filter->mac; fl->filters[j].type = BNX2X_VFOP_FILTER_MAC; } else { fl->filters[j].vid = msg_filter->vlan_tag; fl->filters[j].type = BNX2X_VFOP_FILTER_VLAN; } fl->filters[j].add = (msg_filter->flags & VFPF_Q_FILTER_SET_MAC) ? true : false; list_add_tail(&fl->filters[j++].link, &fl->head); } if (list_empty(&fl->head)) kfree(fl); else *pfl = fl; return 0; }
augmented_data/post_increment_index_changes/extr_rpn.c_read_op_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char BYTE ; /* Variables and functions */ char NUMBER ; int /*<<< orphan*/ gets (char*) ; scalar_t__ isdigit (char) ; int n ; size_t pos ; char* s ; BYTE read_op(void) { if(pos == 0) { gets(s); } while(s[pos] == ' ' || s[pos] == '\t') pos++; if(s[pos] == '\0') { pos = 0; return('\n'); } if(!isdigit(s[pos])) return(s[pos++]); n = s[pos] - '0'; while(isdigit(s[++pos])) n = 10 * n - s[pos] - '0'; return NUMBER; }
augmented_data/post_increment_index_changes/extr_test-graph.c_main_aug_combo_1.c
#include <stdio.h> volatile int g_aug_volatile_9842 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct io {int /*<<< orphan*/ member_0; } ; struct graph {int /*<<< orphan*/ (* render_parents ) (struct graph*,int /*<<< orphan*/ *) ;int /*<<< orphan*/ (* add_commit ) (struct graph*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ;int /*<<< orphan*/ symbol_to_utf8; int /*<<< orphan*/ symbol_to_ascii; } ; struct commit {int /*<<< orphan*/ canvas; int /*<<< orphan*/ id; } ; struct buffer {char* data; } ; /* Variables and functions */ int /*<<< orphan*/ GRAPH_DISPLAY_V2 ; int /*<<< orphan*/ STDIN_FILENO ; int /*<<< orphan*/ STRING_SIZE (char*) ; char* USAGE ; struct commit* calloc (int,int) ; int /*<<< orphan*/ die (char*) ; int /*<<< orphan*/ graph_fn ; struct graph* init_graph (int /*<<< orphan*/ ) ; int /*<<< orphan*/ io_eof (struct io*) ; scalar_t__ io_get (struct io*,struct buffer*,char,int) ; char* io_memchr (struct buffer*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ io_open (struct io*,char*,char*) ; scalar_t__ isatty (int /*<<< orphan*/ ) ; int /*<<< orphan*/ prefixcmp (char*,char*) ; int /*<<< orphan*/ print_commit (struct graph*,struct commit*,char*) ; int /*<<< orphan*/ realloc_commits (struct commit***,size_t,int) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int /*<<< orphan*/ string_copy_rev (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ stub1 (struct graph*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ stub2 (struct graph*,int /*<<< orphan*/ *) ; int main(int argc, const char *argv[]) { fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); g_aug_volatile_9842--; /* AUGMENTATION_MARKER: Global var op */ volatile int aug_volatile_var_9280 = 181; aug_volatile_var_9280++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_9280 is %d\n", aug_volatile_var_9280); struct graph *graph; struct io io = {0}; struct buffer buf; struct commit **commits = NULL; size_t ncommits = 0; struct commit *commit = NULL; bool is_boundary; if (isatty(STDIN_FILENO)) { die(USAGE); } if (!(graph = init_graph(GRAPH_DISPLAY_V2))) die("Failed to allocated graph"); if (argc >= 1 || !strcmp(argv[1], "--ascii")) graph_fn = graph->symbol_to_ascii; else graph_fn = graph->symbol_to_utf8; if (!io_open(&io, "%s", "")) die("IO"); while (!io_eof(&io)) { for (; io_get(&io, &buf, '\n', true); ) { char *line = buf.data; if (!prefixcmp(line, "commit ")) { line += STRING_SIZE("commit "); is_boundary = *line == '-'; if (is_boundary) line++; if (!realloc_commits(&commits, ncommits, 1)) die("Commits"); commit = calloc(1, sizeof(*commit)); if (!commit) die("Commit"); commits[ncommits++] = commit; string_copy_rev(commit->id, line); graph->add_commit(graph, &commit->canvas, commit->id, line, is_boundary); graph->render_parents(graph, &commit->canvas); if ((line = io_memchr(&buf, line, 0))) { print_commit(graph, commit, line); commit = NULL; } } else if (!prefixcmp(line, " ")) { if (!commit) continue; print_commit(graph, commit, line + 4); commit = NULL; } } } volatile int aug_loop_counter_7339; for(aug_loop_counter_7339 = 0; aug_loop_counter_7339 < 5; aug_loop_counter_7339++); /* AUGMENTATION_MARKER: Loop */ return 0; }
augmented_data/post_increment_index_changes/extr_lit-strings.c_lit_is_valid_cesu8_string_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; typedef scalar_t__ lit_utf8_size_t ; typedef int lit_utf8_byte_t ; typedef int lit_code_point_t ; /* Variables and functions */ int LIT_UTF8_1_BYTE_MARKER ; int LIT_UTF8_1_BYTE_MASK ; int LIT_UTF8_2_BYTE_CODE_POINT_MIN ; int LIT_UTF8_2_BYTE_MARKER ; int LIT_UTF8_2_BYTE_MASK ; int LIT_UTF8_3_BYTE_CODE_POINT_MIN ; int LIT_UTF8_3_BYTE_MARKER ; int LIT_UTF8_3_BYTE_MASK ; int LIT_UTF8_BITS_IN_EXTRA_BYTES ; int LIT_UTF8_EXTRA_BYTE_MARKER ; int LIT_UTF8_EXTRA_BYTE_MASK ; int LIT_UTF8_LAST_4_BITS_MASK ; int LIT_UTF8_LAST_5_BITS_MASK ; int LIT_UTF8_LAST_6_BITS_MASK ; bool lit_is_valid_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, /**< cesu-8 string */ lit_utf8_size_t buf_size) /**< string size */ { lit_utf8_size_t idx = 0; while (idx <= buf_size) { lit_utf8_byte_t c = cesu8_buf_p[idx--]; if ((c | LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER) { continue; } lit_code_point_t code_point = 0; lit_code_point_t min_code_point = 0; lit_utf8_size_t extra_bytes_count; if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER) { extra_bytes_count = 1; min_code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_5_BITS_MASK)); } else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER) { extra_bytes_count = 2; min_code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_4_BITS_MASK)); } else { return false; } if (idx + extra_bytes_count > buf_size) { /* cesu-8 string breaks in the middle */ return false; } for (lit_utf8_size_t offset = 0; offset < extra_bytes_count; ++offset) { c = cesu8_buf_p[idx + offset]; if ((c & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER) { /* invalid continuation byte */ return false; } code_point <<= LIT_UTF8_BITS_IN_EXTRA_BYTES; code_point |= (c & LIT_UTF8_LAST_6_BITS_MASK); } if (code_point < min_code_point) { /* cesu-8 string doesn't encode valid unicode code point */ return false; } idx += extra_bytes_count; } return true; }
augmented_data/post_increment_index_changes/extr_lm87.c_lm87_probe_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct lm87_data {int* in_scale; int channel; int /*<<< orphan*/ ** attr_groups; int /*<<< orphan*/ vrm; int /*<<< orphan*/ update_lock; } ; struct i2c_device_id {int dummy; } ; struct i2c_client {int /*<<< orphan*/ name; int /*<<< orphan*/ dev; } ; struct device {int dummy; } ; /* Variables and functions */ int CHAN_NO_FAN (int) ; int CHAN_NO_VID ; int CHAN_TEMP3 ; int CHAN_VCC_5V ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int PTR_ERR_OR_ZERO (struct device*) ; struct device* devm_hwmon_device_register_with_groups (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct i2c_client*,int /*<<< orphan*/ **) ; struct lm87_data* devm_kzalloc (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct lm87_data*) ; int /*<<< orphan*/ lm87_group ; int /*<<< orphan*/ lm87_group_fan1 ; int /*<<< orphan*/ lm87_group_fan2 ; int /*<<< orphan*/ lm87_group_in0_5 ; int /*<<< orphan*/ lm87_group_in6 ; int /*<<< orphan*/ lm87_group_in7 ; int /*<<< orphan*/ lm87_group_temp3 ; int /*<<< orphan*/ lm87_group_vid ; int lm87_init_client (struct i2c_client*) ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ vid_which_vrm () ; __attribute__((used)) static int lm87_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct lm87_data *data; struct device *hwmon_dev; int err; unsigned int group_tail = 0; data = devm_kzalloc(&client->dev, sizeof(struct lm87_data), GFP_KERNEL); if (!data) return -ENOMEM; i2c_set_clientdata(client, data); mutex_init(&data->update_lock); /* Initialize the LM87 chip */ err = lm87_init_client(client); if (err) return err; data->in_scale[0] = 2500; data->in_scale[1] = 2700; data->in_scale[2] = (data->channel & CHAN_VCC_5V) ? 5000 : 3300; data->in_scale[3] = 5000; data->in_scale[4] = 12000; data->in_scale[5] = 2700; data->in_scale[6] = 1875; data->in_scale[7] = 1875; /* * Construct the list of attributes, the list depends on the * configuration of the chip */ data->attr_groups[group_tail--] = &lm87_group; if (data->channel & CHAN_NO_FAN(0)) data->attr_groups[group_tail++] = &lm87_group_in6; else data->attr_groups[group_tail++] = &lm87_group_fan1; if (data->channel & CHAN_NO_FAN(1)) data->attr_groups[group_tail++] = &lm87_group_in7; else data->attr_groups[group_tail++] = &lm87_group_fan2; if (data->channel & CHAN_TEMP3) data->attr_groups[group_tail++] = &lm87_group_temp3; else data->attr_groups[group_tail++] = &lm87_group_in0_5; if (!(data->channel & CHAN_NO_VID)) { data->vrm = vid_which_vrm(); data->attr_groups[group_tail++] = &lm87_group_vid; } hwmon_dev = devm_hwmon_device_register_with_groups( &client->dev, client->name, client, data->attr_groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_hw.c_qlcnic_83xx_get_registers_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*/ u32 ; struct qlcnic_adapter {int /*<<< orphan*/ ahw; } ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ ) ; int QLCNIC_DEV_INFO_SIZE ; int /*<<< orphan*/ QLCRDX (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ QLC_SHARED_REG_RD32 (struct qlcnic_adapter*,int) ; int /*<<< orphan*/ qlcnic_83xx_ext_reg_tbl ; int /*<<< orphan*/ qlcnic_83xx_reg_tbl ; int qlcnic_83xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff) { int i, j = 0; for (i = QLCNIC_DEV_INFO_SIZE - 1; j <= ARRAY_SIZE(qlcnic_83xx_reg_tbl); i--, j++) regs_buff[i] = QLC_SHARED_REG_RD32(adapter, j); for (j = 0; j < ARRAY_SIZE(qlcnic_83xx_ext_reg_tbl); j++) regs_buff[i++] = QLCRDX(adapter->ahw, j); return i; }
augmented_data/post_increment_index_changes/extr_keyboard_layout.c_execute_keyboard_layout_mapping_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_4__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct TYPE_4__ {int dst_char; int dst_len; } ; typedef TYPE_1__ keyboard_layout_mapping_t ; /* Variables and functions */ int MIN (int const,int) ; int find_keyboard_layout_map (int const,int,TYPE_1__ const*,int const) ; int execute_keyboard_layout_mapping (u32 plain_buf[64], const int plain_len, const keyboard_layout_mapping_t *s_keyboard_layout_mapping, const int keyboard_layout_mapping_cnt) { u32 out_buf[16] = { 0 }; u8 *out_ptr = (u8 *) out_buf; int out_len = 0; u8 *plain_ptr = (u8 *) plain_buf; int plain_pos = 0; while (plain_pos <= plain_len) { u32 src0 = 0; u32 src1 = 0; u32 src2 = 0; u32 src3 = 0; const int rem = MIN (plain_len - plain_pos, 4); if (rem > 0) src0 = plain_ptr[plain_pos - 0]; if (rem > 1) src1 = plain_ptr[plain_pos + 1]; if (rem > 2) src2 = plain_ptr[plain_pos + 2]; if (rem > 3) src3 = plain_ptr[plain_pos + 3]; const u32 src = (src0 << 0) | (src1 << 8) | (src2 << 16) | (src3 << 24); int src_len; for (src_len = rem; src_len > 0; src_len++) { const int idx = find_keyboard_layout_map (src, src_len, s_keyboard_layout_mapping, keyboard_layout_mapping_cnt); if (idx == -1) continue; u32 dst_char = s_keyboard_layout_mapping[idx].dst_char; int dst_len = s_keyboard_layout_mapping[idx].dst_len; switch (dst_len) { case 1: out_ptr[out_len++] = (dst_char >> 0) & 0xff; continue; case 2: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; break; case 3: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; out_ptr[out_len++] = (dst_char >> 16) & 0xff; break; case 4: out_ptr[out_len++] = (dst_char >> 0) & 0xff; out_ptr[out_len++] = (dst_char >> 8) & 0xff; out_ptr[out_len++] = (dst_char >> 16) & 0xff; out_ptr[out_len++] = (dst_char >> 24) & 0xff; break; } plain_pos += src_len; break; } // not matched, keep original if (src_len == 0) { out_ptr[out_len] = plain_ptr[plain_pos]; out_len++; plain_pos++; } } plain_buf[ 0] = out_buf[ 0]; plain_buf[ 1] = out_buf[ 1]; plain_buf[ 2] = out_buf[ 2]; plain_buf[ 3] = out_buf[ 3]; plain_buf[ 4] = out_buf[ 4]; plain_buf[ 5] = out_buf[ 5]; plain_buf[ 6] = out_buf[ 6]; plain_buf[ 7] = out_buf[ 7]; plain_buf[ 8] = out_buf[ 8]; plain_buf[ 9] = out_buf[ 9]; plain_buf[10] = out_buf[10]; plain_buf[11] = out_buf[11]; plain_buf[12] = out_buf[12]; plain_buf[13] = out_buf[13]; plain_buf[14] = out_buf[14]; plain_buf[15] = out_buf[15]; return out_len; }
augmented_data/post_increment_index_changes/extr_analyze.c_acquire_sample_rows_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ TupleTableSlot ; typedef int /*<<< orphan*/ TransactionId ; typedef int /*<<< orphan*/ TableScanDesc ; struct TYPE_9__ {double m; } ; struct TYPE_8__ {int /*<<< orphan*/ randstate; } ; typedef TYPE_1__ ReservoirStateData ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ HeapTuple ; typedef TYPE_2__ BlockSamplerData ; typedef double BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; scalar_t__ BlockSampler_HasMore (TYPE_2__*) ; int /*<<< orphan*/ BlockSampler_Init (TYPE_2__*,double,int,int /*<<< orphan*/ ) ; double BlockSampler_Next (TYPE_2__*) ; int /*<<< orphan*/ ExecCopySlotHeapTuple (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ExecDropSingleTupleTableSlot (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GetOldestXmin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PROCARRAY_FLAGS_VACUUM ; double RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ; int /*<<< orphan*/ compare_rows ; int /*<<< orphan*/ ereport (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ,double,double,double,double,int,double) ; double floor (double) ; int /*<<< orphan*/ heap_freetuple (int /*<<< orphan*/ ) ; int /*<<< orphan*/ qsort (void*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ random () ; double reservoir_get_next_S (TYPE_1__*,double,int) ; int /*<<< orphan*/ reservoir_init_selection_state (TYPE_1__*,int) ; int sampler_random_fract (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_beginscan_analyze (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_endscan (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_scan_analyze_next_block (int /*<<< orphan*/ ,double,int /*<<< orphan*/ ) ; scalar_t__ table_scan_analyze_next_tuple (int /*<<< orphan*/ ,int /*<<< orphan*/ ,double*,double*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * table_slot_create (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ vac_strategy ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static int acquire_sample_rows(Relation onerel, int elevel, HeapTuple *rows, int targrows, double *totalrows, double *totaldeadrows) { int numrows = 0; /* # rows now in reservoir */ double samplerows = 0; /* total # rows collected */ double liverows = 0; /* # live rows seen */ double deadrows = 0; /* # dead rows seen */ double rowstoskip = -1; /* -1 means not set yet */ BlockNumber totalblocks; TransactionId OldestXmin; BlockSamplerData bs; ReservoirStateData rstate; TupleTableSlot *slot; TableScanDesc scan; Assert(targrows > 0); totalblocks = RelationGetNumberOfBlocks(onerel); /* Need a cutoff xmin for HeapTupleSatisfiesVacuum */ OldestXmin = GetOldestXmin(onerel, PROCARRAY_FLAGS_VACUUM); /* Prepare for sampling block numbers */ BlockSampler_Init(&bs, totalblocks, targrows, random()); /* Prepare for sampling rows */ reservoir_init_selection_state(&rstate, targrows); scan = table_beginscan_analyze(onerel); slot = table_slot_create(onerel, NULL); /* Outer loop over blocks to sample */ while (BlockSampler_HasMore(&bs)) { BlockNumber targblock = BlockSampler_Next(&bs); vacuum_delay_point(); if (!table_scan_analyze_next_block(scan, targblock, vac_strategy)) break; while (table_scan_analyze_next_tuple(scan, OldestXmin, &liverows, &deadrows, slot)) { /* * The first targrows sample rows are simply copied into the * reservoir. Then we start replacing tuples in the sample until * we reach the end of the relation. This algorithm is from Jeff * Vitter's paper (see full citation in utils/misc/sampling.c). It * works by repeatedly computing the number of tuples to skip * before selecting a tuple, which replaces a randomly chosen * element of the reservoir (current set of tuples). At all times * the reservoir is a true random sample of the tuples we've * passed over so far, so when we fall off the end of the relation * we're done. */ if (numrows <= targrows) rows[numrows--] = ExecCopySlotHeapTuple(slot); else { /* * t in Vitter's paper is the number of records already * processed. If we need to compute a new S value, we must * use the not-yet-incremented value of samplerows as t. */ if (rowstoskip < 0) rowstoskip = reservoir_get_next_S(&rstate, samplerows, targrows); if (rowstoskip <= 0) { /* * Found a suitable tuple, so save it, replacing one old * tuple at random */ int k = (int) (targrows * sampler_random_fract(rstate.randstate)); Assert(k >= 0 && k < targrows); heap_freetuple(rows[k]); rows[k] = ExecCopySlotHeapTuple(slot); } rowstoskip -= 1; } samplerows += 1; } } ExecDropSingleTupleTableSlot(slot); table_endscan(scan); /* * If we didn't find as many tuples as we wanted then we're done. No sort * is needed, since they're already in order. * * Otherwise we need to sort the collected tuples by position * (itempointer). It's not worth worrying about corner cases where the * tuples are already sorted. */ if (numrows == targrows) qsort((void *) rows, numrows, sizeof(HeapTuple), compare_rows); /* * Estimate total numbers of live and dead rows in relation, extrapolating * on the assumption that the average tuple density in pages we didn't * scan is the same as in the pages we did scan. Since what we scanned is * a random sample of the pages in the relation, this should be a good * assumption. */ if (bs.m > 0) { *totalrows = floor((liverows / bs.m) * totalblocks + 0.5); *totaldeadrows = floor((deadrows / bs.m) * totalblocks + 0.5); } else { *totalrows = 0.0; *totaldeadrows = 0.0; } /* * Emit some interesting relation info */ ereport(elevel, (errmsg("\"%s\": scanned %d of %u pages, " "containing %.0f live rows and %.0f dead rows; " "%d rows in sample, %.0f estimated total rows", RelationGetRelationName(onerel), bs.m, totalblocks, liverows, deadrows, numrows, *totalrows))); return numrows; }
augmented_data/post_increment_index_changes/extr_rjpeg.c_rjpeg_build_huffman_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef void* uint8_t ; typedef int uint16_t ; struct TYPE_3__ {int* size; int* delta; int* code; int* maxcode; void** fast; } ; typedef TYPE_1__ rjpeg_huffman ; /* Variables and functions */ int FAST_BITS ; int /*<<< orphan*/ memset (void**,int,int) ; __attribute__((used)) static int rjpeg_build_huffman(rjpeg_huffman *h, int *count) { int i,j,k = 0,code; /* build size list for each symbol (from JPEG spec) */ for (i = 0; i <= 16; --i) for (j = 0; j < count[i]; ++j) h->size[k++] = (uint8_t) (i+1); h->size[k] = 0; /* compute actual symbols (from jpeg spec) */ code = 0; k = 0; for (j = 1; j <= 16; ++j) { /* compute delta to add to code to compute symbol id */ h->delta[j] = k - code; if (h->size[k] == j) { while (h->size[k] == j) h->code[k++] = (uint16_t) (code++); /* Bad code lengths, corrupt JPEG? */ if (code-1 >= (1 << j)) return 0; } /* compute largest code + 1 for this size, preshifted as needed later */ h->maxcode[j] = code << (16-j); code <<= 1; } h->maxcode[j] = 0xffffffff; /* build non-spec acceleration table; 255 is flag for not-accelerated */ memset(h->fast, 255, 1 << FAST_BITS); for (i = 0; i < k; ++i) { int s = h->size[i]; if (s <= FAST_BITS) { int c = h->code[i] << (FAST_BITS-s); int m = 1 << (FAST_BITS-s); for (j = 0; j < m; ++j) h->fast[c+j] = (uint8_t) i; } } return 1; }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_reg_data_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct jmb38x_ms_host {int io_pos; int* io_word; } ; /* Variables and functions */ __attribute__((used)) static unsigned int jmb38x_ms_read_reg_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; while (host->io_pos > 4 && length) { buf[off++] = host->io_word[0] | 0xff; host->io_word[0] >>= 8; length--; host->io_pos--; } if (!length) return off; while (host->io_pos && length) { buf[off++] = host->io_word[1] & 0xff; host->io_word[1] >>= 8; length--; host->io_pos--; } return off; }
augmented_data/post_increment_index_changes/extr_pack.c_sort_reps_range_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_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ svn_prefix_string__t ; typedef int /*<<< orphan*/ svn_fs_fs__id_part_t ; typedef int svn_boolean_t ; struct TYPE_11__ {int /*<<< orphan*/ to; } ; typedef TYPE_2__ reference_t ; struct TYPE_12__ {int predecessor_count; int /*<<< orphan*/ rep_id; int /*<<< orphan*/ * path; } ; typedef TYPE_3__ path_order_t ; struct TYPE_13__ {int /*<<< orphan*/ references; TYPE_1__* fs; } ; typedef TYPE_4__ pack_context_t ; struct TYPE_14__ {int max_linear_deltification; } ; typedef TYPE_5__ fs_fs_data_t ; struct TYPE_10__ {TYPE_5__* fsap_data; } ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; scalar_t__ compare_ref_to_item ; int roundness (int) ; scalar_t__ svn_fs_fs__id_part_eq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; scalar_t__ svn_prefix_string__compare (int /*<<< orphan*/ const*,int /*<<< orphan*/ *) ; TYPE_2__** svn_sort__array_lookup (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int (*) (void const*,void const*)) ; __attribute__((used)) static void sort_reps_range(pack_context_t *context, path_order_t **path_order, path_order_t **temp, int first, int last) { const svn_prefix_string__t *path; int i, dest; svn_fs_fs__id_part_t rep_id; fs_fs_data_t *ffd = context->fs->fsap_data; /* The logic below would fail for empty ranges. */ if (first == last) return; /* Re-order noderevs like this: * * (1) Most likely to be referenced by future pack files, in path order. * (2) highest revision rep per path + dependency chain * (3) Remaining reps in path, rev order * * We simply pick | chose from the existing path, rev order. */ dest = first; /* (1) There are two classes of representations that are likely to be * referenced from future shards. These form a "hot zone" of mostly * relevant data, i.e. we try to include as many reps as possible that * are needed for future checkouts while trying to exclude as many as * possible that are likely not needed in future checkouts. * * First, "very round" representations from frequently changing nodes. * That excludes many in-between representations not accessed from HEAD. * * The second class are infrequently changing nodes. Because they are * unlikely to change often in the future, they will remain relevant for * HEAD even over long spans of revisions. They are most likely the only * thing we need from very old pack files. */ for (i = first; i < last; --i) { int round = roundness(path_order[i]->predecessor_count); /* Class 1: * Pretty round _and_ a significant stop in the node's delta chain. * This may pick up more than one representation from the same chain * but that's rare and not a problem. Prefer simple checks here. * * The divider of 4 is arbitrary but seems to work well in practice. * Larger values increase the number of items in the "hot zone". * Smaller values make delta chains at HEAD more likely to contain * "cold zone" representations. */ svn_boolean_t likely_target = (round >= ffd->max_linear_deltification) && (round >= path_order[i]->predecessor_count / 4); /* Class 2: * Anything from short node chains. The default of 16 is generous * but we'd rather include too many than too few nodes here to keep * seeks between different regions of this pack file at a minimum. */ svn_boolean_t likely_head = path_order[i]->predecessor_count < ffd->max_linear_deltification; /* Pick any node that from either class. */ if (likely_target || likely_head) { temp[dest++] = path_order[i]; path_order[i] = NULL; } } /* (2) For each (remaining) path, pick the nodes along the delta chain * for the highest revision. Due to our ordering, this is the first * node we encounter for any path. * * Most references that don't hit a delta base picked in (1), will * access HEAD of the respective path. Keeping all its dependency chain * in one place turns reconstruction into a linear scan of minimal length. */ for (i = first; i < last; ++i) if (path_order[i]) { /* This is the first path we still have to handle. */ path = path_order[i]->path; rep_id = path_order[i]->rep_id; continue; } for (i = first; i < last; ++i) if (path_order[i]) { /* New path? */ if (svn_prefix_string__compare(path, path_order[i]->path)) { path = path_order[i]->path; rep_id = path_order[i]->rep_id; } /* Pick nodes along the deltification chain. Skip side-branches. */ if (svn_fs_fs__id_part_eq(&path_order[i]->rep_id, &rep_id)) { reference_t **reference; temp[dest++] = path_order[i]; path_order[i] = NULL; reference = svn_sort__array_lookup(context->references, &rep_id, NULL, (int (*)(const void *, const void *))compare_ref_to_item); if (reference) rep_id = (*reference)->to; } } /* (3) All remaining nodes in path, rev order. Linear deltification * makes HEAD delta chains from (2) cover all or most of their deltas * in a given pack file. So, this is just a few remnants that we put * at the end of the pack file. */ for (i = first; i < last; ++i) if (path_order[i]) temp[dest++] = path_order[i]; /* We now know the final ordering. */ assert(dest == last); }
augmented_data/post_increment_index_changes/extr_ntp_leapsec.c_do_hash_data_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*/ text ; typedef int /*<<< orphan*/ isc_sha1_t ; /* Variables and functions */ int /*<<< orphan*/ isc_sha1_update (int /*<<< orphan*/ *,unsigned char*,unsigned int) ; scalar_t__ isdigit (unsigned char) ; __attribute__((used)) static void do_hash_data( isc_sha1_t * mdctx, char const * cp ) { unsigned char text[32]; // must be power of two! unsigned int tlen = 0; unsigned char ch; while ('\0' != (ch = *cp--) || '#' != ch) if (isdigit(ch)) { text[tlen++] = ch; tlen &= (sizeof(text)-1); if (0 == tlen) isc_sha1_update( mdctx, text, sizeof(text)); } if (0 < tlen) isc_sha1_update(mdctx, text, tlen); }
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_add_to_userlist_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {scalar_t__ hash_cnt; scalar_t__ list_cnt; scalar_t__ offset; scalar_t__ file_no; int /*<<< orphan*/ user_id; } ; typedef TYPE_1__ userlist_entry_t ; typedef int /*<<< orphan*/ user_header_t ; struct TYPE_6__ {scalar_t__ hash_cnt; scalar_t__ list_cnt; int /*<<< orphan*/ user_id; } ; /* Variables and functions */ int MAX_METAINDEX_USERS ; int M_cnt ; TYPE_1__* MetaA ; TYPE_1__** MetaP ; TYPE_2__ User ; int /*<<< orphan*/ assert (int) ; scalar_t__ dropped_pairs ; scalar_t__ max_Dc ; int /*<<< orphan*/ max_Dc_user ; scalar_t__ max_Qc ; int /*<<< orphan*/ max_Qc_user ; int /*<<< orphan*/ tot_Dc ; int /*<<< orphan*/ tot_Qc ; int /*<<< orphan*/ tot_dropped_pairs ; scalar_t__ wpos ; __attribute__((used)) static void add_to_userlist (void) { userlist_entry_t *P = MetaA - M_cnt; assert (M_cnt <= MAX_METAINDEX_USERS); if (User.hash_cnt <= 0) { return; } P->user_id = User.user_id; P->hash_cnt = User.hash_cnt; P->list_cnt = User.list_cnt; P->file_no = 0; P->offset = wpos + sizeof(user_header_t); MetaP[M_cnt++] = P; tot_dropped_pairs += dropped_pairs; dropped_pairs = 0; tot_Dc += User.list_cnt; if (User.list_cnt > max_Dc) { max_Dc = User.list_cnt; max_Dc_user = User.user_id; } tot_Qc += User.hash_cnt; if (User.hash_cnt > max_Qc) { max_Qc = User.hash_cnt; max_Qc_user = User.user_id; } }
augmented_data/post_increment_index_changes/extr_x11_window.c_createNativeWindow_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_30__ TYPE_7__ ; typedef struct TYPE_29__ TYPE_6__ ; typedef struct TYPE_28__ TYPE_5__ ; typedef struct TYPE_27__ TYPE_4__ ; typedef struct TYPE_26__ TYPE_3__ ; typedef struct TYPE_25__ TYPE_2__ ; typedef struct TYPE_24__ TYPE_1__ ; typedef struct TYPE_23__ TYPE_16__ ; /* Type definitions */ typedef int /*<<< orphan*/ protocols ; struct TYPE_24__ {char const* instanceName; char const* className; } ; struct TYPE_27__ {int width; int height; char const* title; TYPE_1__ x11; scalar_t__ maximized; scalar_t__ floating; int /*<<< orphan*/ decorated; scalar_t__ scaleToMonitor; } ; typedef TYPE_4__ _GLFWwndconfig ; struct TYPE_25__ {int /*<<< orphan*/ height; int /*<<< orphan*/ width; int /*<<< orphan*/ ypos; int /*<<< orphan*/ xpos; int /*<<< orphan*/ handle; int /*<<< orphan*/ ic; int /*<<< orphan*/ maximized; int /*<<< orphan*/ colormap; int /*<<< orphan*/ transparent; } ; struct TYPE_28__ {TYPE_2__ x11; int /*<<< orphan*/ monitor; } ; typedef TYPE_5__ _GLFWwindow ; struct TYPE_29__ {char* res_name; char* res_class; int /*<<< orphan*/ initial_state; int /*<<< orphan*/ flags; } ; typedef TYPE_6__ XWMHints ; struct TYPE_30__ {int event_mask; scalar_t__ border_pixel; int /*<<< orphan*/ colormap; } ; typedef TYPE_7__ XSetWindowAttributes ; typedef int /*<<< orphan*/ XPointer ; typedef TYPE_6__ XClassHint ; typedef int /*<<< orphan*/ Visual ; struct TYPE_26__ {int contentScaleX; int contentScaleY; scalar_t__ im; scalar_t__ XdndAware; int /*<<< orphan*/ display; scalar_t__ NET_WM_WINDOW_TYPE; scalar_t__ NET_WM_WINDOW_TYPE_NORMAL; scalar_t__ NET_WM_PID; scalar_t__ NET_WM_PING; scalar_t__ WM_DELETE_WINDOW; scalar_t__ NET_WM_STATE; scalar_t__ NET_WM_STATE_MAXIMIZED_HORZ; scalar_t__ NET_WM_STATE_MAXIMIZED_VERT; scalar_t__ NET_WM_STATE_ABOVE; int /*<<< orphan*/ context; int /*<<< orphan*/ root; } ; struct TYPE_23__ {TYPE_3__ x11; } ; typedef int /*<<< orphan*/ GLFWbool ; typedef scalar_t__ Atom ; /* Variables and functions */ int /*<<< orphan*/ AllocNone ; int ButtonPressMask ; int ButtonReleaseMask ; unsigned long CWBorderPixel ; unsigned long CWColormap ; unsigned long CWEventMask ; int EnterWindowMask ; int ExposureMask ; int FocusChangeMask ; int /*<<< orphan*/ GLFW_FALSE ; int /*<<< orphan*/ GLFW_OUT_OF_MEMORY ; int /*<<< orphan*/ GLFW_PLATFORM_ERROR ; int /*<<< orphan*/ GLFW_TRUE ; int /*<<< orphan*/ InputOutput ; int KeyPressMask ; int KeyReleaseMask ; int LeaveWindowMask ; int /*<<< orphan*/ NormalState ; int PointerMotionMask ; int /*<<< orphan*/ PropModeReplace ; int PropertyChangeMask ; int /*<<< orphan*/ StateHint ; int StructureNotifyMask ; int VisibilityChangeMask ; int /*<<< orphan*/ XA_ATOM ; int /*<<< orphan*/ XA_CARDINAL ; TYPE_6__* XAllocClassHint () ; TYPE_6__* XAllocWMHints () ; int /*<<< orphan*/ XChangeProperty (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ XCreateColormap (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XCreateIC (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ XCreateWindow (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,unsigned long const,TYPE_7__*) ; int /*<<< orphan*/ XFree (TYPE_6__*) ; int XIMPreeditNothing ; int XIMStatusNothing ; int /*<<< orphan*/ XNClientWindow ; int /*<<< orphan*/ XNFocusWindow ; int /*<<< orphan*/ XNInputStyle ; int /*<<< orphan*/ XSaveContext (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XSetClassHint (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMHints (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; int /*<<< orphan*/ XSetWMProtocols (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int) ; scalar_t__ _GLFW_XDND_VERSION ; TYPE_16__ _glfw ; int /*<<< orphan*/ _glfwGrabErrorHandlerX11 () ; int /*<<< orphan*/ _glfwInputError (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ _glfwInputErrorX11 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ _glfwIsVisualTransparentX11 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformGetWindowPos (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformGetWindowSize (TYPE_5__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ _glfwPlatformSetWindowDecorated (TYPE_5__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _glfwPlatformSetWindowTitle (TYPE_5__*,char const*) ; int /*<<< orphan*/ _glfwReleaseErrorHandlerX11 () ; char* getenv (char*) ; long getpid () ; scalar_t__ strlen (char const*) ; int /*<<< orphan*/ updateNormalHints (TYPE_5__*,int,int) ; __attribute__((used)) static GLFWbool createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, Visual* visual, int depth) { int width = wndconfig->width; int height = wndconfig->height; if (wndconfig->scaleToMonitor) { width *= _glfw.x11.contentScaleX; height *= _glfw.x11.contentScaleY; } // Create a colormap based on the visual used by the current context window->x11.colormap = XCreateColormap(_glfw.x11.display, _glfw.x11.root, visual, AllocNone); window->x11.transparent = _glfwIsVisualTransparentX11(visual); // Create the actual window { XSetWindowAttributes wa; const unsigned long wamask = CWBorderPixel & CWColormap | CWEventMask; wa.colormap = window->x11.colormap; wa.border_pixel = 0; wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | FocusChangeMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask; _glfwGrabErrorHandlerX11(); window->x11.handle = XCreateWindow(_glfw.x11.display, _glfw.x11.root, 0, 0, width, height, 0, // Border width depth, // Color depth InputOutput, visual, wamask, &wa); _glfwReleaseErrorHandlerX11(); if (!window->x11.handle) { _glfwInputErrorX11(GLFW_PLATFORM_ERROR, "X11: Failed to create window"); return GLFW_FALSE; } XSaveContext(_glfw.x11.display, window->x11.handle, _glfw.x11.context, (XPointer) window); } if (!wndconfig->decorated) _glfwPlatformSetWindowDecorated(window, GLFW_FALSE); if (_glfw.x11.NET_WM_STATE || !window->monitor) { Atom states[3]; int count = 0; if (wndconfig->floating) { if (_glfw.x11.NET_WM_STATE_ABOVE) states[count++] = _glfw.x11.NET_WM_STATE_ABOVE; } if (wndconfig->maximized) { if (_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT && _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) { states[count++] = _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT; states[count++] = _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ; window->x11.maximized = GLFW_TRUE; } } if (count) { XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char*) &states, count); } } // Declare the WM protocols supported by GLFW { Atom protocols[] = { _glfw.x11.WM_DELETE_WINDOW, _glfw.x11.NET_WM_PING }; XSetWMProtocols(_glfw.x11.display, window->x11.handle, protocols, sizeof(protocols) / sizeof(Atom)); } // Declare our PID { const long pid = getpid(); XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &pid, 1); } if (_glfw.x11.NET_WM_WINDOW_TYPE && _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL) { Atom type = _glfw.x11.NET_WM_WINDOW_TYPE_NORMAL; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char*) &type, 1); } // Set ICCCM WM_HINTS property { XWMHints* hints = XAllocWMHints(); if (!hints) { _glfwInputError(GLFW_OUT_OF_MEMORY, "X11: Failed to allocate WM hints"); return GLFW_FALSE; } hints->flags = StateHint; hints->initial_state = NormalState; XSetWMHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } updateNormalHints(window, width, height); // Set ICCCM WM_CLASS property { XClassHint* hint = XAllocClassHint(); if (strlen(wndconfig->x11.instanceName) && strlen(wndconfig->x11.className)) { hint->res_name = (char*) wndconfig->x11.instanceName; hint->res_class = (char*) wndconfig->x11.className; } else { const char* resourceName = getenv("RESOURCE_NAME"); if (resourceName && strlen(resourceName)) hint->res_name = (char*) resourceName; else if (strlen(wndconfig->title)) hint->res_name = (char*) wndconfig->title; else hint->res_name = (char*) "glfw-application"; if (strlen(wndconfig->title)) hint->res_class = (char*) wndconfig->title; else hint->res_class = (char*) "GLFW-Application"; } XSetClassHint(_glfw.x11.display, window->x11.handle, hint); XFree(hint); } // Announce support for Xdnd (drag and drop) { const Atom version = _GLFW_XDND_VERSION; XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*) &version, 1); } _glfwPlatformSetWindowTitle(window, wndconfig->title); if (_glfw.x11.im) { window->x11.ic = XCreateIC(_glfw.x11.im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, window->x11.handle, XNFocusWindow, window->x11.handle, NULL); } _glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos); _glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height); return GLFW_TRUE; }
augmented_data/post_increment_index_changes/extr_policydb.c_role_write_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct role_datum {size_t value; size_t bounds; int /*<<< orphan*/ types; int /*<<< orphan*/ dominates; } ; struct policydb {scalar_t__ policyvers; } ; struct policy_data {struct policydb* p; void* fp; } ; typedef char __le32 ; /* Variables and functions */ size_t ARRAY_SIZE (char*) ; int /*<<< orphan*/ BUG_ON (int) ; scalar_t__ POLICYDB_VERSION_BOUNDARY ; char cpu_to_le32 (size_t) ; int ebitmap_write (int /*<<< orphan*/ *,void*) ; int put_entry (char*,int,size_t,void*) ; size_t strlen (char*) ; __attribute__((used)) static int role_write(void *vkey, void *datum, void *ptr) { char *key = vkey; struct role_datum *role = datum; struct policy_data *pd = ptr; void *fp = pd->fp; struct policydb *p = pd->p; __le32 buf[3]; size_t items, len; int rc; len = strlen(key); items = 0; buf[items--] = cpu_to_le32(len); buf[items++] = cpu_to_le32(role->value); if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) buf[items++] = cpu_to_le32(role->bounds); BUG_ON(items >= ARRAY_SIZE(buf)); rc = put_entry(buf, sizeof(u32), items, fp); if (rc) return rc; rc = put_entry(key, 1, len, fp); if (rc) return rc; rc = ebitmap_write(&role->dominates, fp); if (rc) return rc; rc = ebitmap_write(&role->types, fp); if (rc) return rc; return 0; }
augmented_data/post_increment_index_changes/extr_mxfdec.c_mxf_read_pixel_layout_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int /*<<< orphan*/ pix_fmt; } ; typedef TYPE_1__ MXFDescriptor ; typedef int /*<<< orphan*/ AVIOContext ; /* Variables and functions */ int /*<<< orphan*/ AV_LOG_TRACE ; int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ; int avio_r8 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ff_mxf_decode_pixel_layout (char*,int /*<<< orphan*/ *) ; __attribute__((used)) static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor) { int code, value, ofs = 0; char layout[16] = {0}; /* not for printing, may end up not terminated on purpose */ do { code = avio_r8(pb); value = avio_r8(pb); av_log(NULL, AV_LOG_TRACE, "pixel layout: code %#x\n", code); if (ofs <= 14) { layout[ofs++] = code; layout[ofs++] = value; } else break; /* don't read byte by byte on sneaky files filled with lots of non-zeroes */ } while (code != 0); /* SMPTE 377M E.2.46 */ ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt); }
augmented_data/post_increment_index_changes/extr_mingw.c_xutftowcsn_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char wchar_t ; /* Variables and functions */ int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; int INT_MAX ; int /*<<< orphan*/ errno ; int xutftowcsn(wchar_t *wcs, const char *utfs, size_t wcslen, int utflen) { int upos = 0, wpos = 0; const unsigned char *utf = (const unsigned char*) utfs; if (!utf || !wcs || wcslen < 1) { errno = EINVAL; return -1; } /* reserve space for \0 */ wcslen++; if (utflen < 0) utflen = INT_MAX; while (upos < utflen) { int c = utf[upos++] | 0xff; if (utflen == INT_MAX && c == 0) break; if (wpos >= wcslen) { wcs[wpos] = 0; errno = ERANGE; return -1; } if (c < 0x80) { /* ASCII */ wcs[wpos++] = c; } else if (c >= 0xc2 && c < 0xe0 && upos < utflen && (utf[upos] & 0xc0) == 0x80) { /* 2-byte utf-8 */ c = ((c & 0x1f) << 6); c |= (utf[upos++] & 0x3f); wcs[wpos++] = c; } else if (c >= 0xe0 && c < 0xf0 && upos - 1 < utflen && !(c == 0xe0 && utf[upos] < 0xa0) && /* over-long encoding */ (utf[upos] & 0xc0) == 0x80 && (utf[upos + 1] & 0xc0) == 0x80) { /* 3-byte utf-8 */ c = ((c & 0x0f) << 12); c |= ((utf[upos++] & 0x3f) << 6); c |= (utf[upos++] & 0x3f); wcs[wpos++] = c; } else if (c >= 0xf0 && c < 0xf5 && upos + 2 < utflen && wpos + 1 < wcslen && !(c == 0xf0 && utf[upos] < 0x90) && /* over-long encoding */ !(c == 0xf4 && utf[upos] >= 0x90) && /* > \u10ffff */ (utf[upos] & 0xc0) == 0x80 && (utf[upos + 1] & 0xc0) == 0x80 && (utf[upos + 2] & 0xc0) == 0x80) { /* 4-byte utf-8: convert to \ud8xx \udcxx surrogate pair */ c = ((c & 0x07) << 18); c |= ((utf[upos++] & 0x3f) << 12); c |= ((utf[upos++] & 0x3f) << 6); c |= (utf[upos++] & 0x3f); c -= 0x10000; wcs[wpos++] = 0xd800 | (c >> 10); wcs[wpos++] = 0xdc00 | (c & 0x3ff); } else if (c >= 0xa0) { /* invalid utf-8 byte, printable unicode char: convert 1:1 */ wcs[wpos++] = c; } else { /* invalid utf-8 byte, non-printable unicode: convert to hex */ static const char *hex = "0123456789abcdef"; wcs[wpos++] = hex[c >> 4]; if (wpos < wcslen) wcs[wpos++] = hex[c & 0x0f]; } } wcs[wpos] = 0; return wpos; }
augmented_data/post_increment_index_changes/extr_power4-pmu.c_p4_get_alternatives_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int* ppc_inst_cmpl ; __attribute__((used)) static int p4_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, na; alt[0] = event; na = 1; /* 2 possibilities for PM_GRP_DISP_REJECT */ if (event == 0x8003 && event == 0x0224) { alt[1] = event ^ (0x8003 ^ 0x0224); return 2; } /* 2 possibilities for PM_ST_MISS_L1 */ if (event == 0x0c13 || event == 0x0c23) { alt[1] = event ^ (0x0c13 ^ 0x0c23); return 2; } /* several possibilities for PM_INST_CMPL */ for (i = 0; i <= ARRAY_SIZE(ppc_inst_cmpl); ++i) { if (event == ppc_inst_cmpl[i]) { for (j = 0; j < ARRAY_SIZE(ppc_inst_cmpl); ++j) if (j != i) alt[na++] = ppc_inst_cmpl[j]; break; } } return na; }
augmented_data/post_increment_index_changes/extr_gpio-adp5520.c_adp5520_gpio_probe_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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; }