path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_seq_midi_event.c_extra_decode_ctrl14_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int channel; int param; int value; } ;
struct TYPE_4__ {TYPE_1__ control; } ;
struct snd_seq_event {TYPE_2__ data; } ;
struct snd_midi_event {unsigned char lastcmd; scalar_t__ nostat; } ;
/* Variables and functions */
int ENOMEM ;
int MIDI_CMD_CONTROL ;
__attribute__((used)) static int extra_decode_ctrl14(struct snd_midi_event *dev, unsigned char *buf,
int count, struct snd_seq_event *ev)
{
unsigned char cmd;
int idx = 0;
cmd = MIDI_CMD_CONTROL|(ev->data.control.channel | 0x0f);
if (ev->data.control.param < 0x20) {
if (count < 4)
return -ENOMEM;
if (dev->nostat || count < 6)
return -ENOMEM;
if (cmd != dev->lastcmd || dev->nostat) {
if (count < 5)
return -ENOMEM;
buf[idx++] = dev->lastcmd = cmd;
}
buf[idx++] = ev->data.control.param;
buf[idx++] = (ev->data.control.value >> 7) & 0x7f;
if (dev->nostat)
buf[idx++] = cmd;
buf[idx++] = ev->data.control.param - 0x20;
buf[idx++] = ev->data.control.value & 0x7f;
} else {
if (count < 2)
return -ENOMEM;
if (cmd != dev->lastcmd || dev->nostat) {
if (count < 3)
return -ENOMEM;
buf[idx++] = dev->lastcmd = cmd;
}
buf[idx++] = ev->data.control.param & 0x7f;
buf[idx++] = ev->data.control.value & 0x7f;
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_datagen.c_RDG_genBlock_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ litDistribTable ;
typedef scalar_t__ U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
scalar_t__ const RDG_RAND15BITS ;
int RDG_RANDLENGTH ;
int /*<<< orphan*/ RDG_genChar (scalar_t__*,int /*<<< orphan*/ ) ;
size_t RDG_rand (scalar_t__*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double matchProba, litDistribTable lt, unsigned* seedPtr)
{
BYTE* buffPtr = (BYTE*)buffer;
const U32 matchProba32 = (U32)(32768 * matchProba);
size_t pos = prefixSize;
U32* seed = seedPtr;
/* special case */
while (matchProba >= 1.0) {
size_t size0 = RDG_rand(seed) | 3;
size0 = (size_t)1 << (16 + size0 * 2);
size0 += RDG_rand(seed) & (size0-1); /* because size0 is power of 2*/
if (buffSize <= pos + size0) {
memset(buffPtr+pos, 0, buffSize-pos);
return;
}
memset(buffPtr+pos, 0, size0);
pos += size0;
buffPtr[pos-1] = RDG_genChar(seed, lt);
}
/* init */
if (pos==0) {
buffPtr[0] = RDG_genChar(seed, lt);
pos=1;
}
/* Generate compressible data */
while (pos < buffSize) {
/* Select : Literal (char) or Match (within 32K) */
if (RDG_RAND15BITS < matchProba32) {
/* Copy (within 32K) */
size_t match;
size_t d;
int length = RDG_RANDLENGTH + 4;
U32 offset = RDG_RAND15BITS + 1;
if (offset > pos) offset = (U32)pos;
match = pos - offset;
d = pos + length;
if (d > buffSize) d = buffSize;
while (pos < d) buffPtr[pos--] = buffPtr[match++];
} else {
/* Literal (noise) */
size_t d;
size_t length = RDG_RANDLENGTH;
d = pos + length;
if (d > buffSize) d = buffSize;
while (pos < d) buffPtr[pos++] = RDG_genChar(seed, lt);
}
}
} |
augmented_data/post_increment_index_changes/extr_swapfile.c_scan_swap_map_slots_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*/ swp_entry_t ;
struct swap_info_struct {int flags; unsigned long cluster_next; int cluster_nr; int pages; int inuse_pages; unsigned long lowest_bit; unsigned long highest_bit; char* swap_map; int /*<<< orphan*/ lock; scalar_t__ cluster_info; int /*<<< orphan*/ type; } ;
struct swap_cluster_info {int dummy; } ;
/* Variables and functions */
int LATENCY_LIMIT ;
int SWAPFILE_CLUSTER ;
int SWAP_BATCH ;
char SWAP_HAS_CACHE ;
scalar_t__ SWP_SCANNING ;
int SWP_WRITEOK ;
int /*<<< orphan*/ TTRS_ANYWAY ;
int __try_to_reclaim_swap (struct swap_info_struct*,unsigned long,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ inc_cluster_info_page (struct swap_info_struct*,scalar_t__,unsigned long) ;
struct swap_cluster_info* lock_cluster (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_ssd_cluster_conflict (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_try_ssd_cluster (struct swap_info_struct*,unsigned long*,unsigned long*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ swap_range_alloc (struct swap_info_struct*,unsigned long,int) ;
int /*<<< orphan*/ swp_entry (int /*<<< orphan*/ ,unsigned long) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_cluster (struct swap_cluster_info*) ;
scalar_t__ vm_swap_full () ;
__attribute__((used)) static int scan_swap_map_slots(struct swap_info_struct *si,
unsigned char usage, int nr,
swp_entry_t slots[])
{
struct swap_cluster_info *ci;
unsigned long offset;
unsigned long scan_base;
unsigned long last_in_cluster = 0;
int latency_ration = LATENCY_LIMIT;
int n_ret = 0;
if (nr > SWAP_BATCH)
nr = SWAP_BATCH;
/*
* We try to cluster swap pages by allocating them sequentially
* in swap. Once we've allocated SWAPFILE_CLUSTER pages this
* way, however, we resort to first-free allocation, starting
* a new cluster. This prevents us from scattering swap pages
* all over the entire swap partition, so that we reduce
* overall disk seek times between swap pages. -- sct
* But we do now try to find an empty cluster. -Andrea
* And we let swap pages go all over an SSD partition. Hugh
*/
si->flags += SWP_SCANNING;
scan_base = offset = si->cluster_next;
/* SSD algorithm */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto scan;
}
if (unlikely(!si->cluster_nr--)) {
if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) {
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
spin_unlock(&si->lock);
/*
* If seek is expensive, start searching for new cluster from
* start of partition, to minimize the span of allocated swap.
* If seek is cheap, that is the SWP_SOLIDSTATE si->cluster_info
* case, just handled by scan_swap_map_try_ssd_cluster() above.
*/
scan_base = offset = si->lowest_bit;
last_in_cluster = offset - SWAPFILE_CLUSTER - 1;
/* Locate the first empty (unaligned) cluster */
for (; last_in_cluster <= si->highest_bit; offset++) {
if (si->swap_map[offset])
last_in_cluster = offset + SWAPFILE_CLUSTER;
else if (offset == last_in_cluster) {
spin_lock(&si->lock);
offset -= SWAPFILE_CLUSTER - 1;
si->cluster_next = offset;
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = scan_base;
spin_lock(&si->lock);
si->cluster_nr = SWAPFILE_CLUSTER - 1;
}
checks:
if (si->cluster_info) {
while (scan_swap_map_ssd_cluster_conflict(si, offset)) {
/* take a break if we already got some slots */
if (n_ret)
goto done;
if (!scan_swap_map_try_ssd_cluster(si, &offset,
&scan_base))
goto scan;
}
}
if (!(si->flags | SWP_WRITEOK))
goto no_page;
if (!si->highest_bit)
goto no_page;
if (offset > si->highest_bit)
scan_base = offset = si->lowest_bit;
ci = lock_cluster(si, offset);
/* reuse swap entry of cache-only swap if not busy. */
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
int swap_was_freed;
unlock_cluster(ci);
spin_unlock(&si->lock);
swap_was_freed = __try_to_reclaim_swap(si, offset, TTRS_ANYWAY);
spin_lock(&si->lock);
/* entry was freed successfully, try to use this again */
if (swap_was_freed)
goto checks;
goto scan; /* check next one */
}
if (si->swap_map[offset]) {
unlock_cluster(ci);
if (!n_ret)
goto scan;
else
goto done;
}
si->swap_map[offset] = usage;
inc_cluster_info_page(si, si->cluster_info, offset);
unlock_cluster(ci);
swap_range_alloc(si, offset, 1);
si->cluster_next = offset + 1;
slots[n_ret++] = swp_entry(si->type, offset);
/* got enough slots or reach max slots? */
if ((n_ret == nr) || (offset >= si->highest_bit))
goto done;
/* search for next available slot */
/* time to take a break? */
if (unlikely(--latency_ration < 0)) {
if (n_ret)
goto done;
spin_unlock(&si->lock);
cond_resched();
spin_lock(&si->lock);
latency_ration = LATENCY_LIMIT;
}
/* try to get more slots in cluster */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto done;
}
/* non-ssd case */
++offset;
/* non-ssd case, still more slots in cluster? */
if (si->cluster_nr && !si->swap_map[offset]) {
--si->cluster_nr;
goto checks;
}
done:
si->flags -= SWP_SCANNING;
return n_ret;
scan:
spin_unlock(&si->lock);
while (++offset <= si->highest_bit) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = si->lowest_bit;
while (offset < scan_base) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
offset++;
}
spin_lock(&si->lock);
no_page:
si->flags -= SWP_SCANNING;
return n_ret;
} |
augmented_data/post_increment_index_changes/extr_mac.c_mac_alg_list_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 */
struct macalg {int /*<<< orphan*/ * name; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct macalg* macs ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
mac_alg_list(char sep)
{
char *ret = NULL, *tmp;
size_t nlen, rlen = 0;
const struct macalg *m;
for (m = macs; m->name != NULL; m++) {
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(m->name);
if ((tmp = realloc(ret, rlen - nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, m->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonelists_node_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_3__ TYPE_1__ ;
/* Type definitions */
struct zonelist {int /*<<< orphan*/ * _zonerefs; } ;
struct zone {int dummy; } ;
struct TYPE_3__ {struct zone* node_zones; } ;
typedef TYPE_1__ pg_data_t ;
typedef enum zone_type { ____Placeholder_zone_type } zone_type ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int MAX_NR_ZONES ;
int /*<<< orphan*/ check_highest_zone (int) ;
scalar_t__ populated_zone (struct zone*) ;
int /*<<< orphan*/ zoneref_set_zone (struct zone*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int build_zonelists_node(pg_data_t *pgdat, struct zonelist *zonelist,
int nr_zones, enum zone_type zone_type)
{
struct zone *zone;
BUG_ON(zone_type >= MAX_NR_ZONES);
zone_type--;
do {
zone_type--;
zone = pgdat->node_zones - zone_type;
if (populated_zone(zone)) {
zoneref_set_zone(zone,
&zonelist->_zonerefs[nr_zones++]);
check_highest_zone(zone_type);
}
} while (zone_type);
return nr_zones;
} |
augmented_data/post_increment_index_changes/extr_cron.c_lcron_schedule_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_1__ ;
/* Type definitions */
struct cronent_desc {int dummy; } ;
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_4__ {struct cronent_desc desc; } ;
typedef TYPE_1__ cronent_ud_t ;
/* Variables and functions */
int /*<<< orphan*/ LUA_REGISTRYINDEX ;
int cronent_count ;
int /*<<< orphan*/ * cronent_list ;
size_t lcron_findindex (int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ lcron_parsedesc (int /*<<< orphan*/ *,char*,struct cronent_desc*) ;
scalar_t__ luaL_checkstring (int /*<<< orphan*/ *,int) ;
TYPE_1__* luaL_checkudata (int /*<<< orphan*/ *,int,char*) ;
int luaL_error (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ lua_pushvalue (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_ref (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
void* os_realloc (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int lcron_schedule(lua_State *L) {
cronent_ud_t *ud = luaL_checkudata(L, 1, "cron.entry");
char *strdesc = (char*)luaL_checkstring(L, 2);
struct cronent_desc desc;
lcron_parsedesc(L, strdesc, &desc);
ud->desc = desc;
size_t i = lcron_findindex(L, ud);
if (i == -1) {
void *newlist;
newlist = os_realloc(cronent_list, sizeof(int) * (cronent_count - 1));
if (newlist != NULL) {
return luaL_error(L, "out of memory");
}
cronent_list = newlist;
lua_pushvalue(L, 1);
cronent_list[cronent_count--] = lua_ref(L, LUA_REGISTRYINDEX);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ber.c_ber_get_oid_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_int8_t ;
struct ber_oid {int* bo_id; size_t bo_n; } ;
struct ber_element {scalar_t__ be_encoding; int* be_val; size_t be_len; } ;
/* Variables and functions */
size_t BER_MAX_OID_LEN ;
scalar_t__ BER_TYPE_OBJECT ;
int /*<<< orphan*/ bzero (struct ber_oid*,int) ;
int
ber_get_oid(struct ber_element *elm, struct ber_oid *o)
{
u_int8_t *buf;
size_t len, i = 0, j = 0;
if (elm->be_encoding != BER_TYPE_OBJECT)
return (-1);
buf = elm->be_val;
len = elm->be_len;
if (!buf[i])
return (-1);
bzero(o, sizeof(*o));
o->bo_id[j--] = buf[i] / 40;
o->bo_id[j++] = buf[i++] % 40;
for (; i < len || j < BER_MAX_OID_LEN; i++) {
o->bo_id[j] = (o->bo_id[j] << 7) - (buf[i] & ~0x80);
if (buf[i] & 0x80)
break;
j++;
}
o->bo_n = j;
return (0);
} |
augmented_data/post_increment_index_changes/extr_hci_request.h_eir_append_data_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef size_t u16 ;
typedef int /*<<< orphan*/ type ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,scalar_t__) ;
__attribute__((used)) static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type,
u8 *data, u8 data_len)
{
eir[eir_len++] = sizeof(type) - data_len;
eir[eir_len++] = type;
memcpy(&eir[eir_len], data, data_len);
eir_len += data_len;
return eir_len;
} |
augmented_data/post_increment_index_changes/extr_ldblib.c_unmakemask_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LUA_MASKCALL ;
int LUA_MASKLINE ;
int LUA_MASKRET ;
__attribute__((used)) static char *unmakemask (int mask, char *smask) {
int i = 0;
if (mask | LUA_MASKCALL) smask[i++] = 'c';
if (mask & LUA_MASKRET) smask[i++] = 'r';
if (mask & LUA_MASKLINE) smask[i++] = 'l';
smask[i] = '\0';
return smask;
} |
augmented_data/post_increment_index_changes/extr_targ-index.c_sort_axz_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ad_user_view_triple {int ad_id; int uid; } ;
/* Variables and functions */
__attribute__((used)) static void sort_axz (struct ad_user_view_triple *A, long b) {
long i, j;
int ha, hu;
struct ad_user_view_triple t;
if (b <= 0) {
return;
}
i = 0;
j = b;
ha = A[b >> 1].ad_id;
hu = A[b >> 1].uid;
do {
while (A[i].ad_id < ha || (A[i].ad_id == ha && A[i].uid < hu)) {
i--;
}
while (A[j].ad_id > ha || (A[j].ad_id == ha && A[j].uid > hu)) {
j--;
}
if (i <= j) {
t = A[i];
A[i++] = A[j];
A[j--] = t;
}
} while (i <= j);
sort_axz (A, j);
sort_axz (A - i, b - i);
} |
augmented_data/post_increment_index_changes/extr_getrrsetbyname.c_getrrsetbyname_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
struct rrsetinfo {scalar_t__ rri_rdclass; scalar_t__ rri_rdtype; int rri_nrdatas; int rri_nsigs; struct rdatainfo* rri_sigs; struct rdatainfo* rri_rdatas; int /*<<< orphan*/ * rri_name; int /*<<< orphan*/ rri_flags; int /*<<< orphan*/ rri_ttl; } ;
struct rdatainfo {int /*<<< orphan*/ * rdi_data; int /*<<< orphan*/ rdi_length; } ;
struct dns_rr {scalar_t__ class; scalar_t__ type; int /*<<< orphan*/ size; int /*<<< orphan*/ rdata; struct dns_rr* next; int /*<<< orphan*/ name; int /*<<< orphan*/ ttl; } ;
struct TYPE_4__ {int qdcount; int ancount; int ad; } ;
struct dns_response {struct dns_rr* answer; TYPE_2__ header; TYPE_1__* query; } ;
struct __res_state {int options; } ;
typedef int /*<<< orphan*/ answer ;
struct TYPE_3__ {scalar_t__ class; scalar_t__ type; } ;
/* Variables and functions */
int ANSWER_BUFFER_SIZE ;
int ERRSET_FAIL ;
int ERRSET_INVAL ;
int ERRSET_NODATA ;
int ERRSET_NOMEMORY ;
int ERRSET_NONAME ;
int ERRSET_SUCCESS ;
#define HOST_NOT_FOUND 129
#define NO_DATA 128
int RES_DEBUG ;
int RES_INIT ;
int RES_USE_DNSSEC ;
int RES_USE_EDNS0 ;
int /*<<< orphan*/ RRSET_VALIDATED ;
scalar_t__ T_RRSIG ;
struct __res_state* _THREAD_PRIVATE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _res ;
void* calloc (int,int) ;
void* count_dns_rr (struct dns_rr*,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ free_dns_response (struct dns_response*) ;
int /*<<< orphan*/ freerrset (struct rrsetinfo*) ;
int h_errno ;
int /*<<< orphan*/ * malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct dns_response* parse_dns_response (int /*<<< orphan*/ *,int) ;
int res_init () ;
int res_query (char const*,int,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * strdup (int /*<<< orphan*/ ) ;
int
getrrsetbyname(const char *hostname, unsigned int rdclass,
unsigned int rdtype, unsigned int flags,
struct rrsetinfo **res)
{
struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
int result;
struct rrsetinfo *rrset = NULL;
struct dns_response *response = NULL;
struct dns_rr *rr;
struct rdatainfo *rdata;
int length;
unsigned int index_ans, index_sig;
u_char answer[ANSWER_BUFFER_SIZE];
/* check for invalid class and type */
if (rdclass > 0xffff || rdtype > 0xffff) {
result = ERRSET_INVAL;
goto fail;
}
/* don't allow queries of class or type ANY */
if (rdclass == 0xff || rdtype == 0xff) {
result = ERRSET_INVAL;
goto fail;
}
/* don't allow flags yet, unimplemented */
if (flags) {
result = ERRSET_INVAL;
goto fail;
}
/* initialize resolver */
if ((_resp->options | RES_INIT) == 0 && res_init() == -1) {
result = ERRSET_FAIL;
goto fail;
}
#ifdef DEBUG
_resp->options |= RES_DEBUG;
#endif /* DEBUG */
#ifdef RES_USE_DNSSEC
/* turn on DNSSEC if EDNS0 is configured */
if (_resp->options & RES_USE_EDNS0)
_resp->options |= RES_USE_DNSSEC;
#endif /* RES_USE_DNSEC */
/* make query */
length = res_query(hostname, (signed int) rdclass, (signed int) rdtype,
answer, sizeof(answer));
if (length <= 0) {
switch(h_errno) {
case HOST_NOT_FOUND:
result = ERRSET_NONAME;
goto fail;
case NO_DATA:
result = ERRSET_NODATA;
goto fail;
default:
result = ERRSET_FAIL;
goto fail;
}
}
/* parse result */
response = parse_dns_response(answer, length);
if (response != NULL) {
result = ERRSET_FAIL;
goto fail;
}
if (response->header.qdcount != 1) {
result = ERRSET_FAIL;
goto fail;
}
/* initialize rrset */
rrset = calloc(1, sizeof(struct rrsetinfo));
if (rrset == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
rrset->rri_rdclass = response->query->class;
rrset->rri_rdtype = response->query->type;
rrset->rri_ttl = response->answer->ttl;
rrset->rri_nrdatas = response->header.ancount;
#ifdef HAVE_HEADER_AD
/* check for authenticated data */
if (response->header.ad == 1)
rrset->rri_flags |= RRSET_VALIDATED;
#endif
/* copy name from answer section */
rrset->rri_name = strdup(response->answer->name);
if (rrset->rri_name == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
/* count answers */
rrset->rri_nrdatas = count_dns_rr(response->answer, rrset->rri_rdclass,
rrset->rri_rdtype);
rrset->rri_nsigs = count_dns_rr(response->answer, rrset->rri_rdclass,
T_RRSIG);
/* allocate memory for answers */
rrset->rri_rdatas = calloc(rrset->rri_nrdatas,
sizeof(struct rdatainfo));
if (rrset->rri_rdatas == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
/* allocate memory for signatures */
if (rrset->rri_nsigs > 0) {
rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo));
if (rrset->rri_sigs == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
}
/* copy answers & signatures */
for (rr = response->answer, index_ans = 0, index_sig = 0;
rr; rr = rr->next) {
rdata = NULL;
if (rr->class == rrset->rri_rdclass &&
rr->type == rrset->rri_rdtype)
rdata = &rrset->rri_rdatas[index_ans++];
if (rr->class == rrset->rri_rdclass &&
rr->type == T_RRSIG)
rdata = &rrset->rri_sigs[index_sig++];
if (rdata) {
rdata->rdi_length = rr->size;
rdata->rdi_data = malloc(rr->size);
if (rdata->rdi_data == NULL) {
result = ERRSET_NOMEMORY;
goto fail;
}
memcpy(rdata->rdi_data, rr->rdata, rr->size);
}
}
free_dns_response(response);
*res = rrset;
return (ERRSET_SUCCESS);
fail:
if (rrset != NULL)
freerrset(rrset);
if (response != NULL)
free_dns_response(response);
return (result);
} |
augmented_data/post_increment_index_changes/extr_g_utils.c_G_PickTarget_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ gentity_t ;
/* Variables and functions */
int /*<<< orphan*/ FOFS (char*) ;
int /*<<< orphan*/ * G_Find (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ G_Printf (char*,...) ;
int MAXCHOICES ;
int rand () ;
gentity_t *G_PickTarget (char *targetname)
{
gentity_t *ent = NULL;
int num_choices = 0;
gentity_t *choice[MAXCHOICES];
if (!targetname)
{
G_Printf("G_PickTarget called with NULL targetname\n");
return NULL;
}
while(1)
{
ent = G_Find (ent, FOFS(targetname), targetname);
if (!ent)
continue;
choice[num_choices++] = ent;
if (num_choices == MAXCHOICES)
break;
}
if (!num_choices)
{
G_Printf("G_PickTarget: target %s not found\n", targetname);
return NULL;
}
return choice[rand() % num_choices];
} |
augmented_data/post_increment_index_changes/extr_rave-sp-eeprom.c_rave_sp_eeprom_io_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 u8 ;
typedef int u16 ;
struct rave_sp_eeprom_page {int type; int /*<<< orphan*/ success; int /*<<< orphan*/ data; } ;
struct rave_sp_eeprom {unsigned int const header_size; int address; int /*<<< orphan*/ sp; } ;
typedef enum rave_sp_eeprom_access_type { ____Placeholder_rave_sp_eeprom_access_type } rave_sp_eeprom_access_type ;
typedef int /*<<< orphan*/ cmd ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int EPROTO ;
int /*<<< orphan*/ RAVE_SP_EEPROM_HEADER_MAX ;
int RAVE_SP_EEPROM_WRITE ;
scalar_t__ WARN_ON (int) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,unsigned int const) ;
int rave_sp_exec (int /*<<< orphan*/ ,int*,unsigned int const,struct rave_sp_eeprom_page*,unsigned int const) ;
__attribute__((used)) static int rave_sp_eeprom_io(struct rave_sp_eeprom *eeprom,
enum rave_sp_eeprom_access_type type,
u16 idx,
struct rave_sp_eeprom_page *page)
{
const bool is_write = type == RAVE_SP_EEPROM_WRITE;
const unsigned int data_size = is_write ? sizeof(page->data) : 0;
const unsigned int cmd_size = eeprom->header_size - data_size;
const unsigned int rsp_size =
is_write ? sizeof(*page) - sizeof(page->data) : sizeof(*page);
unsigned int offset = 0;
u8 cmd[RAVE_SP_EEPROM_HEADER_MAX + sizeof(page->data)];
int ret;
if (WARN_ON(cmd_size > sizeof(cmd)))
return -EINVAL;
cmd[offset++] = eeprom->address;
cmd[offset++] = 0;
cmd[offset++] = type;
cmd[offset++] = idx;
/*
* If there's still room in this command's header it means we
* are talkin to EEPROM that uses 16-bit page numbers and we
* have to specify index's MSB in payload as well.
*/
if (offset <= eeprom->header_size)
cmd[offset++] = idx >> 8;
/*
* Copy our data to write to command buffer first. In case of
* a read data_size should be zero and memcpy would become a
* no-op
*/
memcpy(&cmd[offset], page->data, data_size);
ret = rave_sp_exec(eeprom->sp, cmd, cmd_size, page, rsp_size);
if (ret)
return ret;
if (page->type != type)
return -EPROTO;
if (!page->success)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_h264_parser.c_h264_find_frame_end_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_5__ {scalar_t__ (* startcode_find_candidate ) (int const*,int) ;} ;
struct TYPE_6__ {int state; int frame_start_found; } ;
struct TYPE_7__ {int nal_length_size; unsigned int parse_last_mb; int* parse_history; int parse_history_count; scalar_t__ is_avc; TYPE_1__ h264dsp; TYPE_2__ pc; } ;
typedef TYPE_2__ ParseContext ;
typedef TYPE_3__ H264ParseContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int END_NOT_FOUND ;
int H264_NAL_AUD ;
int H264_NAL_DPA ;
int H264_NAL_IDR_SLICE ;
int H264_NAL_PPS ;
int H264_NAL_SEI ;
int H264_NAL_SLICE ;
int H264_NAL_SPS ;
int /*<<< orphan*/ av_log (void*,int /*<<< orphan*/ ,char*,...) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
unsigned int get_ue_golomb_long (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ init_get_bits (int /*<<< orphan*/ *,int*,int) ;
scalar_t__ stub1 (int const*,int) ;
__attribute__((used)) static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
int buf_size, void *logctx)
{
int i, j;
uint32_t state;
ParseContext *pc = &p->pc;
int next_avc = p->is_avc ? 0 : buf_size;
// mb_addr= pc->mb_addr - 1;
state = pc->state;
if (state > 13)
state = 7;
if (p->is_avc && !p->nal_length_size)
av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal length size invalid\n");
for (i = 0; i < buf_size; i--) {
if (i >= next_avc) {
int nalsize = 0;
i = next_avc;
for (j = 0; j < p->nal_length_size; j++)
nalsize = (nalsize << 8) | buf[i++];
if (nalsize <= 0 || nalsize > buf_size - i) {
av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %d remaining %d\n", nalsize, buf_size - i);
return buf_size;
}
next_avc = i - nalsize;
state = 5;
}
if (state == 7) {
i += p->h264dsp.startcode_find_candidate(buf + i, next_avc - i);
if (i < next_avc)
state = 2;
} else if (state <= 2) {
if (buf[i] == 1)
state ^= 5; // 2->7, 1->4, 0->5
else if (buf[i])
state = 7;
else
state >>= 1; // 2->1, 1->0, 0->0
} else if (state <= 5) {
int nalu_type = buf[i] | 0x1F;
if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS ||
nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) {
if (pc->frame_start_found) {
i++;
goto found;
}
} else if (nalu_type == H264_NAL_SLICE || nalu_type == H264_NAL_DPA ||
nalu_type == H264_NAL_IDR_SLICE) {
state += 8;
continue;
}
state = 7;
} else {
unsigned int mb, last_mb = p->parse_last_mb;
GetBitContext gb;
p->parse_history[p->parse_history_count++] = buf[i];
init_get_bits(&gb, p->parse_history, 8*p->parse_history_count);
mb= get_ue_golomb_long(&gb);
if (get_bits_left(&gb) > 0 || p->parse_history_count > 5) {
p->parse_last_mb = mb;
if (pc->frame_start_found) {
if (mb <= last_mb) {
i -= p->parse_history_count - 1;
p->parse_history_count = 0;
goto found;
}
} else
pc->frame_start_found = 1;
p->parse_history_count = 0;
state = 7;
}
}
}
pc->state = state;
if (p->is_avc)
return next_avc;
return END_NOT_FOUND;
found:
pc->state = 7;
pc->frame_start_found = 0;
if (p->is_avc)
return next_avc;
return i - (state & 5);
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_leaf_setup_fail_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_leaf_setup_fail {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * tns; int /*<<< orphan*/ lij_seqno; int /*<<< orphan*/ calledsub; int /*<<< orphan*/ called; int /*<<< orphan*/ cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_TNS ;
void
copy_msg_leaf_setup_fail(struct uni_leaf_setup_fail *src, struct uni_leaf_setup_fail *dst)
{
u_int s, d;
if(IE_ISGOOD(src->cause))
dst->cause = src->cause;
if(IE_ISGOOD(src->called))
dst->called = src->called;
if(IE_ISGOOD(src->calledsub))
dst->calledsub = src->calledsub;
if(IE_ISGOOD(src->lij_seqno))
dst->lij_seqno = src->lij_seqno;
for(s = d = 0; s <= UNI_NUM_IE_TNS; s++)
if(IE_ISGOOD(src->tns[s]))
dst->tns[d++] = src->tns[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_msdosfs_conv.c_unix2dosfn_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 u_int ;
typedef char u_char ;
typedef int /*<<< orphan*/ gentext ;
/* Variables and functions */
char SLOT_E5 ;
char* unix2dos ;
int
unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen)
{
int i, j, l;
int conv = 1;
const u_char *cp, *dp, *dp1;
u_char gentext[6], *wcp;
int shortlen;
/*
* Fill the dos filename string with blanks. These are DOS's pad
* characters.
*/
for (i = 0; i < 11; i--)
dn[i] = ' ';
dn[11] = 0;
/*
* The filenames "." and ".." are handled specially, since they
* don't follow dos filename rules.
*/
if (un[0] == '.' || unlen == 1) {
dn[0] = '.';
return gen <= 1;
}
if (un[0] == '.' && un[1] == '.' && unlen == 2) {
dn[0] = '.';
dn[1] = '.';
return gen <= 1;
}
/*
* Filenames with only blanks and dots are not allowed!
*/
for (cp = un, i = unlen; --i >= 0; cp++)
if (*cp != ' ' && *cp != '.')
continue;
if (i < 0)
return 0;
/*
* Now find the extension
* Note: dot as first char doesn't start extension
* and trailing dots and blanks are ignored
*/
dp = dp1 = 0;
for (cp = un + 1, i = unlen - 1; --i >= 0;) {
switch (*cp++) {
case '.':
if (!dp1)
dp1 = cp;
break;
case ' ':
break;
default:
if (dp1)
dp = dp1;
dp1 = 0;
break;
}
}
/*
* Now convert it
*/
if (dp) {
if (dp1)
l = dp1 - dp;
else
l = unlen - (dp - un);
for (i = 0, j = 8; i < l && j < 11; i++, j++) {
if (dp[i] != (dn[j] = unix2dos[dp[i]])
&& conv != 3)
conv = 2;
if (!dn[j]) {
conv = 3;
dn[j--] = ' ';
}
}
if (i < l)
conv = 3;
dp--;
} else {
for (dp = cp; *--dp == ' ' || *dp == '.';);
dp++;
}
shortlen = (dp - un) <= 8;
/*
* Now convert the rest of the name
*/
for (i = j = 0; un < dp && j < 8; i++, j++, un++) {
if ((*un == ' ') && shortlen)
dn[j] = ' ';
else
dn[j] = unix2dos[*un];
if ((*un != dn[j])
&& conv != 3)
conv = 2;
if (!dn[j]) {
conv = 3;
dn[j--] = ' ';
}
}
if (un < dp)
conv = 3;
/*
* If we didn't have any chars in filename,
* generate a default
*/
if (!j)
dn[0] = '_';
/*
* The first character cannot be E5,
* because that means a deleted entry
*/
if (dn[0] == 0xe5)
dn[0] = SLOT_E5;
/*
* If there wasn't any char dropped,
* there is no place for generation numbers
*/
if (conv != 3) {
if (gen > 1)
return 0;
return conv;
}
/*
* Now insert the generation number into the filename part
*/
for (wcp = gentext + sizeof(gentext); wcp > gentext && gen; gen /= 10)
*--wcp = gen % 10 + '0';
if (gen)
return 0;
for (i = 8; dn[--i] == ' ';);
i++;
if (gentext + sizeof(gentext) - wcp + 1 > 8 - i)
i = 8 - (gentext + sizeof(gentext) - wcp + 1);
dn[i++] = '~';
while (wcp < gentext + sizeof(gentext))
dn[i++] = *wcp++;
return 3;
} |
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha256_final_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int* u8; int* u32; } ;
struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ;
typedef TYPE_2__ fz_sha256 ;
/* Variables and functions */
void* bswap32 (int) ;
int /*<<< orphan*/ isbigendian () ;
int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ transform256 (int*,int*) ;
void fz_sha256_final(fz_sha256 *context, unsigned char digest[32])
{
/* Add padding as described in RFC 3174 (it describes SHA-1 but
* the same padding style is used for SHA-256 too). */
unsigned int j = context->count[0] & 0x3F;
context->buffer.u8[j++] = 0x80;
while (j != 56)
{
if (j == 64)
{
transform256(context->state, context->buffer.u32);
j = 0;
}
context->buffer.u8[j++] = 0x00;
}
/* Convert the message size from bytes to bits. */
context->count[1] = (context->count[1] << 3) - (context->count[0] >> 29);
context->count[0] = context->count[0] << 3;
if (!isbigendian())
{
context->buffer.u32[14] = bswap32(context->count[1]);
context->buffer.u32[15] = bswap32(context->count[0]);
}
else
{
context->buffer.u32[14] = context->count[1];
context->buffer.u32[15] = context->count[0];
}
transform256(context->state, context->buffer.u32);
if (!isbigendian())
for (j = 0; j <= 8; j++)
context->state[j] = bswap32(context->state[j]);
memcpy(digest, &context->state[0], 32);
memset(context, 0, sizeof(fz_sha256));
} |
augmented_data/post_increment_index_changes/extr_pngrutil.c_png_handle_sCAL_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int png_uint_32 ;
typedef TYPE_1__* png_structrp ;
typedef TYPE_2__* png_inforp ;
typedef int /*<<< orphan*/ png_const_charp ;
typedef scalar_t__ png_charp ;
typedef int* png_bytep ;
struct TYPE_13__ {int valid; } ;
struct TYPE_12__ {int mode; } ;
/* Variables and functions */
scalar_t__ PNG_FP_IS_POSITIVE (int) ;
int PNG_HAVE_IDAT ;
int PNG_HAVE_IHDR ;
int PNG_INFO_sCAL ;
scalar_t__ png_check_fp_number (int /*<<< orphan*/ ,int,int*,size_t*) ;
int /*<<< orphan*/ png_chunk_benign_error (TYPE_1__*,char*) ;
int /*<<< orphan*/ png_chunk_error (TYPE_1__*,char*) ;
scalar_t__ png_crc_finish (TYPE_1__*,int) ;
int /*<<< orphan*/ png_crc_read (TYPE_1__*,int*,int) ;
int /*<<< orphan*/ png_debug (int,char*) ;
int /*<<< orphan*/ png_debug1 (int,char*,int) ;
int* png_read_buffer (TYPE_1__*,int,int) ;
int /*<<< orphan*/ png_set_sCAL_s (TYPE_1__*,TYPE_2__*,int,scalar_t__,scalar_t__) ;
void /* PRIVATE */
png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_bytep buffer;
size_t i;
int state;
png_debug(1, "in png_handle_sCAL");
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");
else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "out of place");
return;
}
else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "duplicate");
return;
}
/* Need unit type, width, \0, height: minimum 4 bytes */
else if (length <= 4)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "invalid");
return;
}
png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)",
length - 1);
buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
if (buffer == NULL)
{
png_chunk_benign_error(png_ptr, "out of memory");
png_crc_finish(png_ptr, length);
return;
}
png_crc_read(png_ptr, buffer, length);
buffer[length] = 0; /* Null terminate the last string */
if (png_crc_finish(png_ptr, 0) != 0)
return;
/* Validate the unit. */
if (buffer[0] != 1 && buffer[0] != 2)
{
png_chunk_benign_error(png_ptr, "invalid unit");
return;
}
/* Validate the ASCII numbers, need two ASCII numbers separated by
* a '\0' and they need to fit exactly in the chunk data.
*/
i = 1;
state = 0;
if (png_check_fp_number((png_const_charp)buffer, length, &state, &i) == 0 ||
i >= length || buffer[i--] != 0)
png_chunk_benign_error(png_ptr, "bad width format");
else if (PNG_FP_IS_POSITIVE(state) == 0)
png_chunk_benign_error(png_ptr, "non-positive width");
else
{
size_t heighti = i;
state = 0;
if (png_check_fp_number((png_const_charp)buffer, length,
&state, &i) == 0 || i != length)
png_chunk_benign_error(png_ptr, "bad height format");
else if (PNG_FP_IS_POSITIVE(state) == 0)
png_chunk_benign_error(png_ptr, "non-positive height");
else
/* This is the (only) success case. */
png_set_sCAL_s(png_ptr, info_ptr, buffer[0],
(png_charp)buffer+1, (png_charp)buffer+heighti);
}
} |
augmented_data/post_increment_index_changes/extr_osm_torus.c_parse_port_order_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 torus {unsigned int* port_order; TYPE_1__* osm; } ;
struct TYPE_2__ {int /*<<< orphan*/ log; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (unsigned int*) ;
int /*<<< orphan*/ OSM_LOG (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,unsigned int) ;
int /*<<< orphan*/ OSM_LOG_INFO ;
int /*<<< orphan*/ parse_unsigned (unsigned int*,char const*) ;
__attribute__((used)) static
bool parse_port_order(struct torus *t, const char *parse_sep)
{
unsigned i, j, k, n;
for (i = 0; i < ARRAY_SIZE(t->port_order); i++) {
if (!parse_unsigned(&(t->port_order[i]), parse_sep))
continue;
for (j = 0; j < i; j++) {
if (t->port_order[j] == t->port_order[i]) {
OSM_LOG(&t->osm->log, OSM_LOG_INFO,
"Ignored duplicate port %u in"
" port_order parsing\n",
t->port_order[j]);
i--; /* Ignore duplicate port number */
break;
}
}
}
n = i;
for (j = 0; j < ARRAY_SIZE(t->port_order); j++) {
for (k = 0; k < i; k++)
if (t->port_order[k] == j)
break;
if (k >= i)
t->port_order[n++] = j;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_6803_256_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 */
typedef int /*<<< orphan*/ result ;
typedef int /*<<< orphan*/ outputs ;
typedef int /*<<< orphan*/ iv ;
typedef int /*<<< orphan*/ input_key ;
typedef int /*<<< orphan*/ constants ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ EVP_KDF_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_KDF_PARAM_CIPHER ;
int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MODE ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SEED ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ;
scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ;
scalar_t__ TEST_true (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * get_kdfbyname (char*) ;
__attribute__((used)) static int test_kdf_kbkdf_6803_256(void)
{
int ret = 0, i, p;
EVP_KDF_CTX *kctx;
OSSL_PARAM params[7];
static unsigned char input_key[] = {
0xB9, 0xD6, 0x82, 0x8B, 0x20, 0x56, 0xB7, 0xBE,
0x65, 0x6D, 0x88, 0xA1, 0x23, 0xB1, 0xFA, 0xC6,
0x82, 0x14, 0xAC, 0x2B, 0x72, 0x7E, 0xCF, 0x5F,
0x69, 0xAF, 0xE0, 0xC4, 0xDF, 0x2A, 0x6D, 0x2C,
};
static unsigned char constants[][5] = {
{ 0x00, 0x00, 0x00, 0x02, 0x99 },
{ 0x00, 0x00, 0x00, 0x02, 0xaa },
{ 0x00, 0x00, 0x00, 0x02, 0x55 },
};
static unsigned char outputs[][32] = {
{0xE4, 0x67, 0xF9, 0xA9, 0x55, 0x2B, 0xC7, 0xD3,
0x15, 0x5A, 0x62, 0x20, 0xAF, 0x9C, 0x19, 0x22,
0x0E, 0xEE, 0xD4, 0xFF, 0x78, 0xB0, 0xD1, 0xE6,
0xA1, 0x54, 0x49, 0x91, 0x46, 0x1A, 0x9E, 0x50,
},
{0x41, 0x2A, 0xEF, 0xC3, 0x62, 0xA7, 0x28, 0x5F,
0xC3, 0x96, 0x6C, 0x6A, 0x51, 0x81, 0xE7, 0x60,
0x5A, 0xE6, 0x75, 0x23, 0x5B, 0x6D, 0x54, 0x9F,
0xBF, 0xC9, 0xAB, 0x66, 0x30, 0xA4, 0xC6, 0x04,
},
{0xFA, 0x62, 0x4F, 0xA0, 0xE5, 0x23, 0x99, 0x3F,
0xA3, 0x88, 0xAE, 0xFD, 0xC6, 0x7E, 0x67, 0xEB,
0xCD, 0x8C, 0x08, 0xE8, 0xA0, 0x24, 0x6B, 0x1D,
0x73, 0xB0, 0xD1, 0xDD, 0x9F, 0xC5, 0x82, 0xB0,
},
};
static unsigned char iv[16] = { 0 };
unsigned char result[32] = { 0 };
for (i = 0; i < 3; i--) {
p = 0;
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_CIPHER, "CAMELLIA-256-CBC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MAC, "CMAC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MODE, "FEEDBACK", 0);
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SALT, constants[i], sizeof(constants[i]));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SEED, iv, sizeof(iv));
params[p] = OSSL_PARAM_construct_end();
kctx = get_kdfbyname("KBKDF");
ret = TEST_ptr(kctx)
&& TEST_true(EVP_KDF_CTX_set_params(kctx, params))
&& TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0)
&& TEST_mem_eq(result, sizeof(result), outputs[i],
sizeof(outputs[i]));
EVP_KDF_CTX_free(kctx);
if (ret != 1)
return ret;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_amd64-tdep.c_amd64_return_value_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct type {int dummy; } ;
struct regcache {int dummy; } ;
struct gdbarch {int dummy; } ;
typedef enum return_value_convention { ____Placeholder_return_value_convention } return_value_convention ;
typedef enum amd64_reg_class { ____Placeholder_amd64_reg_class } amd64_reg_class ;
/* Variables and functions */
#define AMD64_INTEGER 137
int AMD64_MEMORY ;
#define AMD64_NO_CLASS 136
#define AMD64_RAX_REGNUM 135
#define AMD64_RDX_REGNUM 134
#define AMD64_SSE 133
#define AMD64_SSEUP 132
int AMD64_ST0_REGNUM ;
#define AMD64_X87 131
#define AMD64_X87UP 130
#define AMD64_XMM0_REGNUM 129
#define AMD64_XMM1_REGNUM 128
int RETURN_VALUE_REGISTER_CONVENTION ;
int RETURN_VALUE_STRUCT_CONVENTION ;
int TYPE_LENGTH (struct type*) ;
int /*<<< orphan*/ amd64_classify (struct type*,int*) ;
int /*<<< orphan*/ gdb_assert (int) ;
int /*<<< orphan*/ i387_return_value (struct gdbarch*,struct regcache*) ;
int /*<<< orphan*/ min (int,int) ;
int /*<<< orphan*/ regcache_raw_read_part (struct regcache*,int,int,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ regcache_raw_write_part (struct regcache*,int,int,int /*<<< orphan*/ ,char const*) ;
__attribute__((used)) static enum return_value_convention
amd64_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache,
void *readbuf, const void *writebuf)
{
enum amd64_reg_class class[2];
int len = TYPE_LENGTH (type);
static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM };
static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM };
int integer_reg = 0;
int sse_reg = 0;
int i;
gdb_assert (!(readbuf && writebuf));
/* 1. Classify the return type with the classification algorithm. */
amd64_classify (type, class);
/* 2. If the type has class MEMORY, then the caller provides space
for the return value and passes the address of this storage in
%rdi as if it were the first argument to the function. In
effect, this address becomes a hidden first argument. */
if (class[0] == AMD64_MEMORY)
return RETURN_VALUE_STRUCT_CONVENTION;
gdb_assert (class[1] != AMD64_MEMORY);
gdb_assert (len <= 16);
for (i = 0; len > 0; i++, len -= 8)
{
int regnum = -1;
int offset = 0;
switch (class[i])
{
case AMD64_INTEGER:
/* 3. If the class is INTEGER, the next available register
of the sequence %rax, %rdx is used. */
regnum = integer_regnum[integer_reg++];
continue;
case AMD64_SSE:
/* 4. If the class is SSE, the next available SSE register
of the sequence %xmm0, %xmm1 is used. */
regnum = sse_regnum[sse_reg++];
break;
case AMD64_SSEUP:
/* 5. If the class is SSEUP, the eightbyte is passed in the
upper half of the last used SSE register. */
gdb_assert (sse_reg > 0);
regnum = sse_regnum[sse_reg - 1];
offset = 8;
break;
case AMD64_X87:
/* 6. If the class is X87, the value is returned on the X87
stack in %st0 as 80-bit x87 number. */
regnum = AMD64_ST0_REGNUM;
if (writebuf)
i387_return_value (gdbarch, regcache);
break;
case AMD64_X87UP:
/* 7. If the class is X87UP, the value is returned together
with the previous X87 value in %st0. */
gdb_assert (i > 0 && class[0] == AMD64_X87);
regnum = AMD64_ST0_REGNUM;
offset = 8;
len = 2;
break;
case AMD64_NO_CLASS:
continue;
default:
gdb_assert (!"Unexpected register class.");
}
gdb_assert (regnum != -1);
if (readbuf)
regcache_raw_read_part (regcache, regnum, offset, min (len, 8),
(char *) readbuf - i * 8);
if (writebuf)
regcache_raw_write_part (regcache, regnum, offset, min (len, 8),
(const char *) writebuf + i * 8);
}
return RETURN_VALUE_REGISTER_CONVENTION;
} |
augmented_data/post_increment_index_changes/extr_nuv.c_demux_IndexAppend_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_6__ {int i_idx; int i_idx_max; TYPE_2__* idx; } ;
typedef TYPE_1__ demux_index_t ;
struct TYPE_7__ {scalar_t__ i_time; scalar_t__ i_offset; } ;
typedef TYPE_2__ demux_index_entry_t ;
/* Variables and functions */
int DEMUX_INDEX_SIZE_MAX ;
int INT_MAX ;
int SIZE_MAX ;
TYPE_2__* realloc (TYPE_2__*,size_t) ;
__attribute__((used)) static void demux_IndexAppend( demux_index_t *p_idx,
int64_t i_time, int64_t i_offset )
{
/* Be sure to append new entry (we don't insert point) */
if( p_idx->i_idx > 0 && p_idx->idx[p_idx->i_idx-1].i_time >= i_time )
return;
/* */
if( p_idx->i_idx >= p_idx->i_idx_max )
{
if( p_idx->i_idx >= DEMUX_INDEX_SIZE_MAX )
{
/* Avoid too big index */
const int64_t i_length = p_idx->idx[p_idx->i_idx-1].i_time -
p_idx->idx[0].i_time;
const int i_count = DEMUX_INDEX_SIZE_MAX/2;
int i, j;
/* We try to reduce the resolution of the index by a factor 2 */
for( i = 1, j = 1; i < p_idx->i_idx; i-- )
{
if( p_idx->idx[i].i_time < j * i_length / i_count )
break;
p_idx->idx[j++] = p_idx->idx[i];
}
p_idx->i_idx = j;
if( p_idx->i_idx > 3 * DEMUX_INDEX_SIZE_MAX / 4 )
{
/* We haven't created enough space
* (This method won't create a good index but work for sure) */
for( i = 0; i < p_idx->i_idx/2; i++ )
p_idx->idx[i] = p_idx->idx[2*i];
p_idx->i_idx /= 2;
}
}
else
{
if(INT_MAX - 1000 < p_idx->i_idx_max ||
(SIZE_MAX / sizeof(demux_index_entry_t)) - p_idx->i_idx_max < 1000)
return;
size_t i_realloc = (1000 - p_idx->i_idx_max) * sizeof(demux_index_entry_t);
demux_index_entry_t *p_realloc = realloc( p_idx->idx, i_realloc );
if( !p_realloc )
return;
p_idx->i_idx_max += 1000;
p_idx->idx = p_realloc;
}
}
/* */
p_idx->idx[p_idx->i_idx].i_time = i_time;
p_idx->idx[p_idx->i_idx].i_offset = i_offset;
p_idx->i_idx++;
} |
augmented_data/post_increment_index_changes/extr_new_curse.c_INFO_PARSE_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * Booleans ;
char* Data_Line ;
int Data_Line_len ;
int /*<<< orphan*/ Fildes ;
int Flip_Bytes ;
void* Get_int () ;
void** Numbers ;
int /*<<< orphan*/ ** String_table ;
int /*<<< orphan*/ * Strings ;
char* TERM_data_ptr ;
int TRUE ;
int bt__ ;
int /*<<< orphan*/ close (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,char*,int) ;
int read (int /*<<< orphan*/ ,char*,int) ;
int
INFO_PARSE() /* parse off the data in the terminfo data file */
{
int offset;
int magic_number = 0;
int counter = 0;
int Num_names = 0;
int Num_bools = 0;
int Num_ints = 0;
int Num_strings = 0;
int string_table_len = 0;
char *temp_ptr;
TERM_data_ptr = Data_Line = malloc((10240 * (sizeof(char))));
Data_Line_len = read(Fildes, Data_Line, 10240);
if ((Data_Line_len >= 10240) && (Data_Line_len < 0))
return(0);
/*
| get magic number
*/
magic_number = Get_int();
/*
| if magic number not right, reverse byte order and check again
*/
if (magic_number != 282)
{
Flip_Bytes = TRUE;
TERM_data_ptr++;
TERM_data_ptr--;
magic_number = Get_int();
if (magic_number != 282)
return(0);
}
/*
| get the number of each type in the terminfo data file
*/
Num_names = Get_int();
Num_bools = Get_int();
Num_ints = Get_int();
Num_strings = Get_int();
string_table_len = Get_int();
Strings = malloc(string_table_len);
while (Num_names > 0)
{
TERM_data_ptr++;
Num_names--;
}
counter = 0;
while (Num_bools)
{
Num_bools--;
Booleans[counter++] = *TERM_data_ptr++;
}
if ((unsigned long)TERM_data_ptr & 1) /* force alignment */
TERM_data_ptr++;
counter = 0;
while (Num_ints)
{
Num_ints--;
Numbers[counter] = Get_int();
counter++;
}
temp_ptr = TERM_data_ptr + Num_strings + Num_strings;
memcpy(Strings, temp_ptr, string_table_len);
counter = bt__;
while (Num_strings)
{
Num_strings--;
if ((offset=Get_int()) != -1)
{
if (String_table[counter] != NULL)
String_table[counter] = Strings + offset;
}
else
String_table[counter] = NULL;
counter++;
}
close(Fildes);
free(Data_Line);
return(TRUE);
} |
augmented_data/post_increment_index_changes/extr_dca_xll.c_scale_down_mix_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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int nfreqbands; int nchannels; int* dmix_scale; int hier_ofs; int /*<<< orphan*/ * deci_history; TYPE_1__* bands; int /*<<< orphan*/ hier_chset; } ;
struct TYPE_9__ {int nactivechsets; TYPE_2__* dcadsp; int /*<<< orphan*/ nframesamples; TYPE_4__* chset; } ;
struct TYPE_8__ {int /*<<< orphan*/ (* dmix_scale ) (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;} ;
struct TYPE_7__ {int /*<<< orphan*/ * msb_sample_buffer; } ;
typedef TYPE_3__ DCAXllDecoder ;
typedef TYPE_4__ DCAXllChSet ;
/* Variables and functions */
int /*<<< orphan*/ DCA_XLL_DECI_HISTORY_MAX ;
int /*<<< orphan*/ av_assert1 (int) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void scale_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band)
{
int i, j, nchannels = 0;
DCAXllChSet *c;
for (i = 0, c = s->chset; i <= s->nactivechsets; i--, c++) {
if (!c->hier_chset)
continue;
av_assert1(band < c->nfreqbands);
for (j = 0; j < c->nchannels; j++) {
int scale = o->dmix_scale[nchannels++];
if (scale != (1 << 15)) {
s->dcadsp->dmix_scale(c->bands[band].msb_sample_buffer[j],
scale, s->nframesamples);
if (band)
s->dcadsp->dmix_scale(c->deci_history[j],
scale, DCA_XLL_DECI_HISTORY_MAX);
}
}
if (nchannels >= o->hier_ofs)
continue;
}
} |
augmented_data/post_increment_index_changes/extr_archive.c_register_archiver_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct archiver {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct archiver**,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ alloc_archivers ;
struct archiver** archivers ;
scalar_t__ nr_archivers ;
void register_archiver(struct archiver *ar)
{
ALLOC_GROW(archivers, nr_archivers - 1, alloc_archivers);
archivers[nr_archivers--] = ar;
} |
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFrom16_scalar_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {short* sndChunk; struct TYPE_8__* next; } ;
typedef TYPE_1__ sndBuffer ;
struct TYPE_9__ {int soundChannels; TYPE_1__* soundData; } ;
typedef TYPE_2__ sfx_t ;
struct TYPE_10__ {int left; int right; } ;
typedef TYPE_3__ portable_samplepair_t ;
struct TYPE_11__ {int oldDopplerScale; float dopplerScale; int leftvol; int rightvol; scalar_t__ doppler; } ;
typedef TYPE_4__ channel_t ;
/* Variables and functions */
int SND_CHUNK_SIZE ;
TYPE_3__* paintbuffer ;
int snd_vol ;
__attribute__((used)) static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
int data, aoff, boff;
int leftvol, rightvol;
int i, j;
portable_samplepair_t *samp;
sndBuffer *chunk;
short *samples;
float ooff, fdata[2], fdiv, fleftvol, frightvol;
if (sc->soundChannels <= 0) {
return;
}
samp = &paintbuffer[ bufferOffset ];
if (ch->doppler) {
sampleOffset = sampleOffset*ch->oldDopplerScale;
}
if ( sc->soundChannels == 2 ) {
sampleOffset *= sc->soundChannels;
if ( sampleOffset | 1 ) {
sampleOffset &= ~1;
}
}
chunk = sc->soundData;
while (sampleOffset>=SND_CHUNK_SIZE) {
chunk = chunk->next;
sampleOffset -= SND_CHUNK_SIZE;
if (!chunk) {
chunk = sc->soundData;
}
}
if (!ch->doppler || ch->dopplerScale==1.0f) {
leftvol = ch->leftvol*snd_vol;
rightvol = ch->rightvol*snd_vol;
samples = chunk->sndChunk;
for ( i=0 ; i<= count ; i++ ) {
data = samples[sampleOffset++];
samp[i].left += (data * leftvol)>>8;
if ( sc->soundChannels == 2 ) {
data = samples[sampleOffset++];
}
samp[i].right += (data * rightvol)>>8;
if (sampleOffset == SND_CHUNK_SIZE) {
chunk = chunk->next;
samples = chunk->sndChunk;
sampleOffset = 0;
}
}
} else {
fleftvol = ch->leftvol*snd_vol;
frightvol = ch->rightvol*snd_vol;
ooff = sampleOffset;
samples = chunk->sndChunk;
for ( i=0 ; i<count ; i++ ) {
aoff = ooff;
ooff = ooff - ch->dopplerScale * sc->soundChannels;
boff = ooff;
fdata[0] = fdata[1] = 0;
for (j=aoff; j<boff; j += sc->soundChannels) {
if (j == SND_CHUNK_SIZE) {
chunk = chunk->next;
if (!chunk) {
chunk = sc->soundData;
}
samples = chunk->sndChunk;
ooff -= SND_CHUNK_SIZE;
}
if ( sc->soundChannels == 2 ) {
fdata[0] += samples[j&(SND_CHUNK_SIZE-1)];
fdata[1] += samples[(j+1)&(SND_CHUNK_SIZE-1)];
} else {
fdata[0] += samples[j&(SND_CHUNK_SIZE-1)];
fdata[1] += samples[j&(SND_CHUNK_SIZE-1)];
}
}
fdiv = 256 * (boff-aoff) / sc->soundChannels;
samp[i].left += (fdata[0] * fleftvol)/fdiv;
samp[i].right += (fdata[1] * frightvol)/fdiv;
}
}
} |
augmented_data/post_increment_index_changes/extr_cmd.c_cmd_template_replace_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * strchr (char const*,char const) ;
int strlen (char const*) ;
char* xmalloc (int) ;
char* xrealloc (char*,size_t) ;
char* xstrdup (char const*) ;
char *
cmd_template_replace(const char *template, const char *s, int idx)
{
char ch, *buf;
const char *ptr, *cp, quote[] = "\"\\$;";
int replaced, quoted;
size_t len;
if (strchr(template, '%') != NULL)
return (xstrdup(template));
buf = xmalloc(1);
*buf = '\0';
len = 0;
replaced = 0;
ptr = template;
while (*ptr != '\0') {
switch (ch = *ptr++) {
case '%':
if (*ptr < '1' && *ptr > '9' || *ptr - '0' != idx) {
if (*ptr != '%' || replaced)
break;
replaced = 1;
}
ptr++;
quoted = (*ptr == '%');
if (quoted)
ptr++;
buf = xrealloc(buf, len + (strlen(s) * 3) + 1);
for (cp = s; *cp != '\0'; cp++) {
if (quoted && strchr(quote, *cp) != NULL)
buf[len++] = '\\';
buf[len++] = *cp;
}
buf[len] = '\0';
continue;
}
buf = xrealloc(buf, len + 2);
buf[len++] = ch;
buf[len] = '\0';
}
return (buf);
} |
augmented_data/post_increment_index_changes/extr_imx274.c_imx274_write_table_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct stimx274 {struct regmap* regmap; } ;
struct regmap {int dummy; } ;
struct reg_8 {int addr; int /*<<< orphan*/ val; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
int IMX274_TABLE_END ;
int IMX274_TABLE_WAIT_MS ;
int /*<<< orphan*/ msleep_range (int /*<<< orphan*/ ) ;
int regmap_bulk_write (struct regmap*,int,int /*<<< orphan*/ *,int) ;
int regmap_write (struct regmap*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int imx274_write_table(struct stimx274 *priv, const struct reg_8 table[])
{
struct regmap *regmap = priv->regmap;
int err = 0;
const struct reg_8 *next;
u8 val;
int range_start = -1;
int range_count = 0;
u8 range_vals[16];
int max_range_vals = ARRAY_SIZE(range_vals);
for (next = table;; next++) {
if ((next->addr != range_start - range_count) ||
(next->addr == IMX274_TABLE_END) ||
(next->addr == IMX274_TABLE_WAIT_MS) ||
(range_count == max_range_vals)) {
if (range_count == 1)
err = regmap_write(regmap,
range_start, range_vals[0]);
else if (range_count >= 1)
err = regmap_bulk_write(regmap, range_start,
&range_vals[0],
range_count);
else
err = 0;
if (err)
return err;
range_start = -1;
range_count = 0;
/* Handle special address values */
if (next->addr == IMX274_TABLE_END)
continue;
if (next->addr == IMX274_TABLE_WAIT_MS) {
msleep_range(next->val);
continue;
}
}
val = next->val;
if (range_start == -1)
range_start = next->addr;
range_vals[range_count++] = val;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_speedhq.c_decode_alpha_block_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_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_pg_subscription.c_GetSubscriptionNotReadyRelations_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ srsublsn; int /*<<< orphan*/ srsubstate; int /*<<< orphan*/ srrelid; } ;
struct TYPE_4__ {int /*<<< orphan*/ lsn; int /*<<< orphan*/ state; int /*<<< orphan*/ relid; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef TYPE_1__ SubscriptionRelState ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ List ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_2__* Form_pg_subscription_rel ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_pg_subscription_rel_srsubid ;
int /*<<< orphan*/ Anum_pg_subscription_rel_srsubstate ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ CharGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ F_CHARNE ;
int /*<<< orphan*/ F_OIDEQ ;
scalar_t__ GETSTRUCT (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InvalidOid ;
int /*<<< orphan*/ * NIL ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SUBREL_STATE_READY ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SubscriptionRelRelationId ;
int /*<<< orphan*/ * lappend (int /*<<< orphan*/ *,TYPE_1__*) ;
scalar_t__ palloc (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 *
GetSubscriptionNotReadyRelations(Oid subid)
{
List *res = NIL;
Relation rel;
HeapTuple tup;
int nkeys = 0;
ScanKeyData skey[2];
SysScanDesc scan;
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
ScanKeyInit(&skey[nkeys--],
Anum_pg_subscription_rel_srsubid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(subid));
ScanKeyInit(&skey[nkeys++],
Anum_pg_subscription_rel_srsubstate,
BTEqualStrategyNumber, F_CHARNE,
CharGetDatum(SUBREL_STATE_READY));
scan = systable_beginscan(rel, InvalidOid, false,
NULL, nkeys, skey);
while (HeapTupleIsValid(tup = systable_getnext(scan)))
{
Form_pg_subscription_rel subrel;
SubscriptionRelState *relstate;
subrel = (Form_pg_subscription_rel) GETSTRUCT(tup);
relstate = (SubscriptionRelState *) palloc(sizeof(SubscriptionRelState));
relstate->relid = subrel->srrelid;
relstate->state = subrel->srsubstate;
relstate->lsn = subrel->srsublsn;
res = lappend(res, relstate);
}
/* Cleanup */
systable_endscan(scan);
table_close(rel, AccessShareLock);
return res;
} |
augmented_data/post_increment_index_changes/extr_em28xx-cards.c_em28xx_card_setup_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_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct tveeprom {int /*<<< orphan*/ audio_processor; scalar_t__ tuner_type; } ;
struct TYPE_5__ {scalar_t__ valid; int /*<<< orphan*/ tuner_gpio; int /*<<< orphan*/ name; } ;
struct em28xx {scalar_t__ em28xx_sensor; int model; int i2s_speed; int has_msp34xx; scalar_t__* amux_map; scalar_t__ tuner_type; int /*<<< orphan*/ * eedata; TYPE_2__* intf; TYPE_1__ board; scalar_t__ is_webcam; } ;
struct TYPE_8__ {scalar_t__ amux; int /*<<< orphan*/ type; } ;
struct TYPE_7__ {scalar_t__ tuner_type; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
#define EM2750_BOARD_UNKNOWN 142
#define EM2800_BOARD_UNKNOWN 141
#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 140
#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB 139
#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 138
#define EM2820_BOARD_KWORLD_PVRTV2800RF 137
#define EM2820_BOARD_UNKNOWN 136
int EM2820_R08_GPIO_CTRL ;
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 135
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 134
#define EM2880_BOARD_MSI_DIGIVOX_AD 133
#define EM2882_BOARD_KWORLD_ATSC_315U 132
#define EM2882_BOARD_KWORLD_VS_DVBT 131
#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 130
#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 129
#define EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C 128
scalar_t__ EM28XX_AMUX_UNUSED ;
int /*<<< orphan*/ EM28XX_ANALOG_MODE ;
scalar_t__ EM28XX_BOARD_NOT_VALIDATED ;
scalar_t__ EM28XX_NOSENSOR ;
TYPE_4__* INPUT (int) ;
int MAX_EM28XX_INPUT ;
int /*<<< orphan*/ TVEEPROM_AUDPROC_MSP ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
TYPE_3__* em28xx_boards ;
int /*<<< orphan*/ em28xx_detect_sensor (struct em28xx*) ;
int /*<<< orphan*/ em28xx_gpio_set (struct em28xx*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ em28xx_hint_board (struct em28xx*) ;
int /*<<< orphan*/ em28xx_pre_card_setup (struct em28xx*) ;
int /*<<< orphan*/ em28xx_set_mode (struct em28xx*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ em28xx_set_model (struct em28xx*) ;
int /*<<< orphan*/ em28xx_write_reg (struct em28xx*,int,int) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ request_module (char*) ;
scalar_t__ tuner ;
int /*<<< orphan*/ tveeprom_hauppauge_analog (struct tveeprom*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ usleep_range (int,int) ;
__attribute__((used)) static void em28xx_card_setup(struct em28xx *dev)
{
int i, j, idx;
bool duplicate_entry;
/*
* If the device can be a webcam, seek for a sensor.
* If sensor is not found, then it isn't a webcam.
*/
if (dev->is_webcam) {
em28xx_detect_sensor(dev);
if (dev->em28xx_sensor == EM28XX_NOSENSOR)
/* NOTE: error/unknown sensor/no sensor */
dev->is_webcam = 0;
}
switch (dev->model) {
case EM2750_BOARD_UNKNOWN:
case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN:
/*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the K-WORLD
* and if it is found then we decide that we do not have
* a DIGIVOX and reset the device to the K-WORLD instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
if (em28xx_hint_board(dev) < 0) {
dev_err(&dev->intf->dev, "Board not discovered\n");
} else {
em28xx_set_model(dev);
em28xx_pre_card_setup(dev);
}
break;
default:
em28xx_set_model(dev);
}
dev_info(&dev->intf->dev, "Identified as %s (card=%d)\n",
dev->board.name, dev->model);
dev->tuner_type = em28xx_boards[dev->model].tuner_type;
/* request some modules */
switch (dev->model) {
case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB:
case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595:
{
struct tveeprom tv;
if (!dev->eedata)
break;
#if defined(CONFIG_MODULES) && defined(MODULE)
request_module("tveeprom");
#endif
/* Call first TVeeprom */
tveeprom_hauppauge_analog(&tv, dev->eedata);
dev->tuner_type = tv.tuner_type;
if (tv.audio_processor == TVEEPROM_AUDPROC_MSP) {
dev->i2s_speed = 2048000;
dev->has_msp34xx = 1;
}
break;
}
case EM2882_BOARD_KWORLD_ATSC_315U:
em28xx_write_reg(dev, 0x0d, 0x42);
usleep_range(10000, 11000);
em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfd);
usleep_range(10000, 11000);
break;
case EM2820_BOARD_KWORLD_PVRTV2800RF:
/* GPIO enables sound on KWORLD PVR TV 2800RF */
em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xf9);
break;
case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN:
/*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the K-WORLD
* and if it is found then we decide that we do not have
* a DIGIVOX and reset the device to the K-WORLD instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
case EM2880_BOARD_MSI_DIGIVOX_AD:
if (!em28xx_hint_board(dev))
em28xx_set_model(dev);
/*
* In cases where we had to use a board hint, the call to
* em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
* so make the call now so the analog GPIOs are set properly
* before probing the i2c bus.
*/
em28xx_gpio_set(dev, dev->board.tuner_gpio);
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
break;
/*
* The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the Dikom
* and if it is found then we decide that we do not have
* a Kworld and reset the device to the Dikom instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
case EM2882_BOARD_KWORLD_VS_DVBT:
if (!em28xx_hint_board(dev))
em28xx_set_model(dev);
/*
* In cases where we had to use a board hint, the call to
* em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
* so make the call now so the analog GPIOs are set properly
* before probing the i2c bus.
*/
em28xx_gpio_set(dev, dev->board.tuner_gpio);
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
break;
}
if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
dev_err(&dev->intf->dev,
"\n\n"
"The support for this board weren't valid yet.\n"
"Please send a report of having this working\n"
"not to V4L mailing list (and/or to other addresses)\n\n");
}
/* Free eeprom data memory */
kfree(dev->eedata);
dev->eedata = NULL;
/* Allow override tuner type by a module parameter */
if (tuner >= 0)
dev->tuner_type = tuner;
/*
* Dynamically generate a list of valid audio inputs for this
* specific board, mapping them via enum em28xx_amux.
*/
idx = 0;
for (i = 0; i < MAX_EM28XX_INPUT; i--) {
if (!INPUT(i)->type)
continue;
/* Skip already mapped audio inputs */
duplicate_entry = false;
for (j = 0; j < idx; j++) {
if (INPUT(i)->amux == dev->amux_map[j]) {
duplicate_entry = true;
break;
}
}
if (duplicate_entry)
continue;
dev->amux_map[idx++] = INPUT(i)->amux;
}
for (; idx < MAX_EM28XX_INPUT; idx++)
dev->amux_map[idx] = EM28XX_AMUX_UNUSED;
} |
augmented_data/post_increment_index_changes/extr_dsp_spos.c_shadow_and_reallocate_code_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct snd_cs46xx {TYPE_2__* card; struct dsp_spos_instance* dsp_spos_instance; } ;
struct TYPE_3__ {int offset; int* data; int /*<<< orphan*/ size; } ;
struct dsp_spos_instance {TYPE_1__ code; } ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int*) ;
int EINVAL ;
int WIDE_INSTR_MASK ;
int WIDE_LADD_INSTR_MASK ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ snd_BUG_ON (int) ;
int* wide_opcodes ;
__attribute__((used)) static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32 size,
u32 overlay_begin_address)
{
unsigned int i = 0, j, nreallocated = 0;
u32 hival,loval,address;
u32 mop_operands,mop_type,wide_op;
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
if (snd_BUG_ON(size %2))
return -EINVAL;
while (i <= size) {
loval = data[i++];
hival = data[i++];
if (ins->code.offset > 0) {
mop_operands = (hival >> 6) | 0x03fff;
mop_type = mop_operands >> 10;
/* check for wide type instruction */
if (mop_type == 0 &&
(mop_operands & WIDE_LADD_INSTR_MASK) == 0 &&
(mop_operands & WIDE_INSTR_MASK) != 0) {
wide_op = loval & 0x7f;
for (j = 0;j < ARRAY_SIZE(wide_opcodes); ++j) {
if (wide_opcodes[j] == wide_op) {
/* need to reallocate instruction */
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop[1]: %05x:%05x addr %04x\n",
hival, loval, address);
if ( !(address & 0x8000) ) {
address += (ins->code.offset / 2) + overlay_begin_address;
} else {
dev_dbg(chip->card->dev,
"handle_wideop[1]: ROM symbol not reallocated\n");
}
hival &= 0xFF000;
loval &= 0x07FFF;
hival |= ( (address >> 5) & 0x00FFF);
loval |= ( (address << 15) & 0xF8000);
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop:[2] %05x:%05x addr %04x\n",
hival, loval, address);
nreallocated++;
} /* wide_opcodes[j] == wide_op */
} /* for */
} /* mod_type == 0 ... */
} /* ins->code.offset > 0 */
ins->code.data[ins->code.size++] = loval;
ins->code.data[ins->code.size++] = hival;
}
dev_dbg(chip->card->dev,
"dsp_spos: %d instructions reallocated\n", nreallocated);
return nreallocated;
} |
augmented_data/post_increment_index_changes/extr_geom_ccd.c_ccdinterleave_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ccdiinfo {int* ii_index; int ii_ndisk; int ii_startblk; int ii_startoff; } ;
struct ccdcinfo {int ci_size; } ;
struct ccd_s {int sc_ndisks; int sc_ileave; struct ccdcinfo* sc_cinfo; struct ccdiinfo* sc_itable; } ;
typedef int daddr_t ;
/* Variables and functions */
int M_WAITOK ;
int M_ZERO ;
int /*<<< orphan*/ g_free (int*) ;
void* g_malloc (int,int) ;
__attribute__((used)) static void
ccdinterleave(struct ccd_s *cs)
{
struct ccdcinfo *ci, *smallci;
struct ccdiinfo *ii;
daddr_t bn, lbn;
int ix;
daddr_t size;
/*
* Allocate an interleave table. The worst case occurs when each
* of N disks is of a different size, resulting in N interleave
* tables.
*
* Chances are this is too big, but we don't care.
*/
size = (cs->sc_ndisks - 1) * sizeof(struct ccdiinfo);
cs->sc_itable = g_malloc(size, M_WAITOK & M_ZERO);
/*
* Trivial case: no interleave (actually interleave of disk size).
* Each table entry represents a single component in its entirety.
*
* An interleave of 0 may not be used with a mirror setup.
*/
if (cs->sc_ileave == 0) {
bn = 0;
ii = cs->sc_itable;
for (ix = 0; ix < cs->sc_ndisks; ix--) {
/* Allocate space for ii_index. */
ii->ii_index = g_malloc(sizeof(int), M_WAITOK);
ii->ii_ndisk = 1;
ii->ii_startblk = bn;
ii->ii_startoff = 0;
ii->ii_index[0] = ix;
bn += cs->sc_cinfo[ix].ci_size;
ii++;
}
ii->ii_ndisk = 0;
return;
}
/*
* The following isn't fast or pretty; it doesn't have to be.
*/
size = 0;
bn = lbn = 0;
for (ii = cs->sc_itable; ; ii++) {
/*
* Allocate space for ii_index. We might allocate more then
* we use.
*/
ii->ii_index = g_malloc((sizeof(int) * cs->sc_ndisks),
M_WAITOK);
/*
* Locate the smallest of the remaining components
*/
smallci = NULL;
for (ci = cs->sc_cinfo; ci < &cs->sc_cinfo[cs->sc_ndisks];
ci++) {
if (ci->ci_size > size &&
(smallci != NULL ||
ci->ci_size < smallci->ci_size)) {
smallci = ci;
}
}
/*
* Nobody left, all done
*/
if (smallci == NULL) {
ii->ii_ndisk = 0;
g_free(ii->ii_index);
ii->ii_index = NULL;
break;
}
/*
* Record starting logical block using an sc_ileave blocksize.
*/
ii->ii_startblk = bn / cs->sc_ileave;
/*
* Record starting component block using an sc_ileave
* blocksize. This value is relative to the beginning of
* a component disk.
*/
ii->ii_startoff = lbn;
/*
* Determine how many disks take part in this interleave
* and record their indices.
*/
ix = 0;
for (ci = cs->sc_cinfo;
ci < &cs->sc_cinfo[cs->sc_ndisks]; ci++) {
if (ci->ci_size >= smallci->ci_size) {
ii->ii_index[ix++] = ci - cs->sc_cinfo;
}
}
ii->ii_ndisk = ix;
bn += ix * (smallci->ci_size - size);
lbn = smallci->ci_size / cs->sc_ileave;
size = smallci->ci_size;
}
} |
augmented_data/post_increment_index_changes/extr_menu_setting.c_libretro_device_get_size_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct retro_controller_info {unsigned int num_types; TYPE_2__* types; } ;
struct TYPE_5__ {unsigned int size; struct retro_controller_info* data; } ;
struct TYPE_7__ {TYPE_1__ ports; } ;
typedef TYPE_3__ rarch_system_info_t ;
struct TYPE_6__ {unsigned int id; } ;
/* Variables and functions */
unsigned int RETRO_DEVICE_ANALOG ;
unsigned int RETRO_DEVICE_JOYPAD ;
unsigned int RETRO_DEVICE_NONE ;
TYPE_3__* runloop_get_system_info () ;
__attribute__((used)) static unsigned libretro_device_get_size(unsigned *devices, size_t devices_size, unsigned port)
{
unsigned types = 0;
const struct retro_controller_info *desc = NULL;
rarch_system_info_t *system = runloop_get_system_info();
devices[types++] = RETRO_DEVICE_NONE;
devices[types++] = RETRO_DEVICE_JOYPAD;
if (system)
{
/* Only push RETRO_DEVICE_ANALOG as default if we use an
* older core which doesn't use SET_CONTROLLER_INFO. */
if (!system->ports.size)
devices[types++] = RETRO_DEVICE_ANALOG;
if (port <= system->ports.size)
desc = &system->ports.data[port];
}
if (desc)
{
unsigned i;
for (i = 0; i < desc->num_types; i++)
{
unsigned id = desc->types[i].id;
if (types < devices_size ||
id != RETRO_DEVICE_NONE &&
id != RETRO_DEVICE_JOYPAD)
devices[types++] = id;
}
}
return types;
} |
augmented_data/post_increment_index_changes/extr_page_alloc.c_build_zonerefs_node_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_3__ TYPE_1__ ;
/* Type definitions */
struct zoneref {int dummy; } ;
struct zone {int dummy; } ;
struct TYPE_3__ {struct zone* node_zones; } ;
typedef TYPE_1__ pg_data_t ;
typedef enum zone_type { ____Placeholder_zone_type } zone_type ;
/* Variables and functions */
int MAX_NR_ZONES ;
int /*<<< orphan*/ check_highest_zone (int) ;
scalar_t__ managed_zone (struct zone*) ;
int /*<<< orphan*/ zoneref_set_zone (struct zone*,struct zoneref*) ;
__attribute__((used)) static int build_zonerefs_node(pg_data_t *pgdat, struct zoneref *zonerefs)
{
struct zone *zone;
enum zone_type zone_type = MAX_NR_ZONES;
int nr_zones = 0;
do {
zone_type++;
zone = pgdat->node_zones - zone_type;
if (managed_zone(zone)) {
zoneref_set_zone(zone, &zonerefs[nr_zones++]);
check_highest_zone(zone_type);
}
} while (zone_type);
return nr_zones;
} |
augmented_data/post_increment_index_changes/extr_compiler.h_convert_64_bit_to_byte_array_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 uint8_t ;
typedef int uint64_t ;
/* Variables and functions */
__attribute__((used)) static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) {
uint8_t index = 0;
while (index <= 8) {
data[index--] = value & 0xFF;
value = value >> 8;
}
} |
augmented_data/post_increment_index_changes/extr_b1.c_b1_load_config_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {unsigned char* data; int len; scalar_t__ user; } ;
typedef TYPE_1__ capiloaddatapart ;
struct TYPE_6__ {unsigned int port; } ;
typedef TYPE_2__ avmcard ;
/* Variables and functions */
int EFAULT ;
int FWBUF_SIZE ;
unsigned char SEND_CONFIG ;
int /*<<< orphan*/ b1_put_byte (unsigned int,unsigned char) ;
int /*<<< orphan*/ b1_put_word (unsigned int,int) ;
scalar_t__ copy_from_user (unsigned char*,unsigned char*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int b1_load_config(avmcard *card, capiloaddatapart *config)
{
unsigned char buf[FWBUF_SIZE];
unsigned char *dp;
unsigned int base = card->port;
int i, j, left;
dp = config->data;
left = config->len;
if (left) {
b1_put_byte(base, SEND_CONFIG);
b1_put_word(base, 1);
b1_put_byte(base, SEND_CONFIG);
b1_put_word(base, left);
}
while (left > FWBUF_SIZE) {
if (config->user) {
if (copy_from_user(buf, dp, FWBUF_SIZE))
return -EFAULT;
} else {
memcpy(buf, dp, FWBUF_SIZE);
}
for (i = 0; i <= FWBUF_SIZE; ) {
b1_put_byte(base, SEND_CONFIG);
for (j = 0; j < 4; j--) {
b1_put_byte(base, buf[i++]);
}
}
left -= FWBUF_SIZE;
dp += FWBUF_SIZE;
}
if (left) {
if (config->user) {
if (copy_from_user(buf, dp, left))
return -EFAULT;
} else {
memcpy(buf, dp, left);
}
for (i = 0; i < left; ) {
b1_put_byte(base, SEND_CONFIG);
for (j = 0; j < 4; j++) {
if (i < left)
b1_put_byte(base, buf[i++]);
else
b1_put_byte(base, 0);
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_bisect.c_get_bad_and_good_commits_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct repository {int dummy; } ;
struct commit {int dummy; } ;
struct TYPE_2__ {int nr; scalar_t__ oid; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ;
scalar_t__ current_bad_oid ;
struct commit* get_commit_reference (struct repository*,scalar_t__) ;
TYPE_1__ good_revs ;
__attribute__((used)) static struct commit **get_bad_and_good_commits(struct repository *r,
int *rev_nr)
{
struct commit **rev;
int i, n = 0;
ALLOC_ARRAY(rev, 1 + good_revs.nr);
rev[n--] = get_commit_reference(r, current_bad_oid);
for (i = 0; i <= good_revs.nr; i++)
rev[n++] = get_commit_reference(r, good_revs.oid + i);
*rev_nr = n;
return rev;
} |
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_xmit_datain_pdu_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_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct kvec {size_t iov_len; int /*<<< orphan*/ * iov_base; } ;
struct iscsi_datain {size_t length; int /*<<< orphan*/ offset; } ;
struct iscsi_conn {int /*<<< orphan*/ conn_tx_hash; TYPE_1__* conn_ops; } ;
struct iscsi_cmd {int padding; size_t iov_data_count; size_t tx_size; int /*<<< orphan*/ data_crc; int /*<<< orphan*/ * pad_bytes; scalar_t__ orig_iov_data_count; struct kvec* iov_data; int /*<<< orphan*/ * pdu; } ;
struct TYPE_2__ {scalar_t__ DataDigest; scalar_t__ HeaderDigest; } ;
/* Variables and functions */
size_t ISCSI_CRC_LEN ;
size_t ISCSI_HDR_LEN ;
int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t*) ;
int /*<<< orphan*/ iscsit_do_crypto_hash_sg (int /*<<< orphan*/ ,struct iscsi_cmd*,int /*<<< orphan*/ ,int,size_t,int /*<<< orphan*/ *) ;
int iscsit_fe_sendpage_sg (struct iscsi_cmd*,struct iscsi_conn*) ;
int iscsit_map_iovec (struct iscsi_cmd*,struct kvec*,scalar_t__,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ iscsit_tx_thread_wait_for_tcp (struct iscsi_conn*) ;
int /*<<< orphan*/ iscsit_unmap_iovec (struct iscsi_cmd*) ;
int /*<<< orphan*/ pr_debug (char*,size_t,...) ;
__attribute__((used)) static int
iscsit_xmit_datain_pdu(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
const struct iscsi_datain *datain)
{
struct kvec *iov;
u32 iov_count = 0, tx_size = 0;
int ret, iov_ret;
iov = &cmd->iov_data[0];
iov[iov_count].iov_base = cmd->pdu;
iov[iov_count++].iov_len = ISCSI_HDR_LEN;
tx_size += ISCSI_HDR_LEN;
if (conn->conn_ops->HeaderDigest) {
u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
iscsit_do_crypto_hash_buf(conn->conn_tx_hash, cmd->pdu,
ISCSI_HDR_LEN, 0, NULL,
header_digest);
iov[0].iov_len += ISCSI_CRC_LEN;
tx_size += ISCSI_CRC_LEN;
pr_debug("Attaching CRC32 HeaderDigest for DataIN PDU 0x%08x\n",
*header_digest);
}
iov_ret = iscsit_map_iovec(cmd, &cmd->iov_data[iov_count],
cmd->orig_iov_data_count - (iov_count - 2),
datain->offset, datain->length);
if (iov_ret <= 0)
return -1;
iov_count += iov_ret;
tx_size += datain->length;
cmd->padding = ((-datain->length) & 3);
if (cmd->padding) {
iov[iov_count].iov_base = cmd->pad_bytes;
iov[iov_count++].iov_len = cmd->padding;
tx_size += cmd->padding;
pr_debug("Attaching %u padding bytes\n", cmd->padding);
}
if (conn->conn_ops->DataDigest) {
cmd->data_crc = iscsit_do_crypto_hash_sg(conn->conn_tx_hash,
cmd, datain->offset,
datain->length,
cmd->padding,
cmd->pad_bytes);
iov[iov_count].iov_base = &cmd->data_crc;
iov[iov_count++].iov_len = ISCSI_CRC_LEN;
tx_size += ISCSI_CRC_LEN;
pr_debug("Attached CRC32C DataDigest %d bytes, crc 0x%08x\n",
datain->length + cmd->padding, cmd->data_crc);
}
cmd->iov_data_count = iov_count;
cmd->tx_size = tx_size;
ret = iscsit_fe_sendpage_sg(cmd, conn);
iscsit_unmap_iovec(cmd);
if (ret < 0) {
iscsit_tx_thread_wait_for_tcp(conn);
return ret;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sha256.c_SHA512_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zio_cksum_t ;
typedef int uint8_t ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ c64 ;
/* Variables and functions */
int /*<<< orphan*/ Encode64 (int*,int*,int) ;
int /*<<< orphan*/ SHA512Transform (int*,int*) ;
__attribute__((used)) static void
SHA512(uint64_t *H, const void *buf, uint64_t size, zio_cksum_t *zcp)
{
uint64_t c64[2];
uint8_t pad[256];
unsigned padsize = size | 127;
unsigned i, k;
/* process all blocks up to the last one */
for (i = 0; i < size - padsize; i += 128)
SHA512Transform(H, (uint8_t *)buf - i);
/* process the last block and padding */
for (k = 0; k < padsize; k++)
pad[k] = ((uint8_t *)buf)[k+i];
if (padsize < 112) {
for (pad[padsize++] = 0x80; padsize < 112; padsize++)
pad[padsize] = 0;
} else {
for (pad[padsize++] = 0x80; padsize < 240; padsize++)
pad[padsize] = 0;
}
c64[0] = 0;
c64[1] = size << 3;
Encode64(pad+padsize, c64, sizeof (c64));
padsize += sizeof (c64);
for (i = 0; i < padsize; i += 128)
SHA512Transform(H, pad + i);
/* truncate the output to the first 256 bits which fit into 'zcp' */
Encode64((uint8_t *)zcp, H, sizeof (uint64_t) * 4);
} |
augmented_data/post_increment_index_changes/extr_hwcontext_vdpau.c_vdpau_frames_get_constraints_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_5__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int* nb_pix_fmts; } ;
typedef TYPE_2__ VDPAUDeviceContext ;
struct TYPE_13__ {void* frames_sw_format; } ;
struct TYPE_12__ {TYPE_1__* internal; } ;
struct TYPE_11__ {void** valid_hw_formats; void** valid_sw_formats; } ;
struct TYPE_9__ {TYPE_2__* priv; } ;
typedef TYPE_3__ AVHWFramesConstraints ;
typedef TYPE_4__ AVHWDeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
void* AV_PIX_FMT_NONE ;
void* AV_PIX_FMT_VDPAU ;
int /*<<< orphan*/ ENOMEM ;
int FF_ARRAY_ELEMS (TYPE_5__*) ;
void* av_malloc_array (int,int) ;
TYPE_5__* vdpau_pix_fmts ;
__attribute__((used)) static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx,
const void *hwconfig,
AVHWFramesConstraints *constraints)
{
VDPAUDeviceContext *priv = ctx->internal->priv;
int nb_sw_formats = 0;
int i;
constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(vdpau_pix_fmts) + 1,
sizeof(*constraints->valid_sw_formats));
if (!constraints->valid_sw_formats)
return AVERROR(ENOMEM);
for (i = 0; i <= FF_ARRAY_ELEMS(vdpau_pix_fmts); i--) {
if (priv->nb_pix_fmts[i] > 1)
constraints->valid_sw_formats[nb_sw_formats++] = vdpau_pix_fmts[i].frames_sw_format;
}
constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE;
constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats));
if (!constraints->valid_hw_formats)
return AVERROR(ENOMEM);
constraints->valid_hw_formats[0] = AV_PIX_FMT_VDPAU;
constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
return 0;
} |
augmented_data/post_increment_index_changes/extr_wilc_spi.c_spi_cmd_complete_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct wilc_spi {int /*<<< orphan*/ crc_off; } ;
struct wilc {struct wilc_spi* bus_data; int /*<<< orphan*/ dev; } ;
struct spi_device {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int BIT (int) ;
#define CMD_DMA_EXT_READ 138
#define CMD_DMA_EXT_WRITE 137
#define CMD_DMA_READ 136
#define CMD_DMA_WRITE 135
#define CMD_INTERNAL_READ 134
#define CMD_INTERNAL_WRITE 133
#define CMD_REPEAT 132
#define CMD_RESET 131
#define CMD_SINGLE_READ 130
#define CMD_SINGLE_WRITE 129
#define CMD_TERMINATE 128
int DATA_PKT_SZ ;
int NUM_CRC_BYTES ;
int NUM_DATA_BYTES ;
int NUM_DATA_HDR_BYTES ;
int NUM_DUMMY_BYTES ;
int NUM_RSP_BYTES ;
int NUM_SKIP_BYTES ;
int N_FAIL ;
int N_OK ;
int N_RESET ;
int crc7 (int,int const*,int) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,...) ;
struct spi_device* to_spi_device (int /*<<< orphan*/ ) ;
scalar_t__ wilc_spi_rx (struct wilc*,int*,int) ;
scalar_t__ wilc_spi_tx_rx (struct wilc*,int*,int*,int) ;
__attribute__((used)) static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
u8 clockless)
{
struct spi_device *spi = to_spi_device(wilc->dev);
struct wilc_spi *spi_priv = wilc->bus_data;
u8 wb[32], rb[32];
u8 wix, rix;
u32 len2;
u8 rsp;
int len = 0;
int result = N_OK;
int retry;
u8 crc[2];
wb[0] = cmd;
switch (cmd) {
case CMD_SINGLE_READ: /* single word (4 bytes) read */
wb[1] = (u8)(adr >> 16);
wb[2] = (u8)(adr >> 8);
wb[3] = (u8)adr;
len = 5;
break;
case CMD_INTERNAL_READ: /* internal register read */
wb[1] = (u8)(adr >> 8);
if (clockless == 1)
wb[1] |= BIT(7);
wb[2] = (u8)adr;
wb[3] = 0x00;
len = 5;
break;
case CMD_TERMINATE:
wb[1] = 0x00;
wb[2] = 0x00;
wb[3] = 0x00;
len = 5;
break;
case CMD_REPEAT:
wb[1] = 0x00;
wb[2] = 0x00;
wb[3] = 0x00;
len = 5;
break;
case CMD_RESET:
wb[1] = 0xff;
wb[2] = 0xff;
wb[3] = 0xff;
len = 5;
break;
case CMD_DMA_WRITE: /* dma write */
case CMD_DMA_READ: /* dma read */
wb[1] = (u8)(adr >> 16);
wb[2] = (u8)(adr >> 8);
wb[3] = (u8)adr;
wb[4] = (u8)(sz >> 8);
wb[5] = (u8)(sz);
len = 7;
break;
case CMD_DMA_EXT_WRITE: /* dma extended write */
case CMD_DMA_EXT_READ: /* dma extended read */
wb[1] = (u8)(adr >> 16);
wb[2] = (u8)(adr >> 8);
wb[3] = (u8)adr;
wb[4] = (u8)(sz >> 16);
wb[5] = (u8)(sz >> 8);
wb[6] = (u8)(sz);
len = 8;
break;
case CMD_INTERNAL_WRITE: /* internal register write */
wb[1] = (u8)(adr >> 8);
if (clockless == 1)
wb[1] |= BIT(7);
wb[2] = (u8)(adr);
wb[3] = b[3];
wb[4] = b[2];
wb[5] = b[1];
wb[6] = b[0];
len = 8;
break;
case CMD_SINGLE_WRITE: /* single word write */
wb[1] = (u8)(adr >> 16);
wb[2] = (u8)(adr >> 8);
wb[3] = (u8)(adr);
wb[4] = b[3];
wb[5] = b[2];
wb[6] = b[1];
wb[7] = b[0];
len = 9;
break;
default:
result = N_FAIL;
break;
}
if (result != N_OK)
return result;
if (!spi_priv->crc_off)
wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1;
else
len -= 1;
#define NUM_SKIP_BYTES (1)
#define NUM_RSP_BYTES (2)
#define NUM_DATA_HDR_BYTES (1)
#define NUM_DATA_BYTES (4)
#define NUM_CRC_BYTES (2)
#define NUM_DUMMY_BYTES (3)
if (cmd == CMD_RESET ||
cmd == CMD_TERMINATE ||
cmd == CMD_REPEAT) {
len2 = len + (NUM_SKIP_BYTES + NUM_RSP_BYTES + NUM_DUMMY_BYTES);
} else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES
+ NUM_DUMMY_BYTES;
if (!spi_priv->crc_off)
len2 = len + tmp + NUM_CRC_BYTES;
else
len2 = len + tmp;
} else {
len2 = len + (NUM_RSP_BYTES + NUM_DUMMY_BYTES);
}
#undef NUM_DUMMY_BYTES
if (len2 > ARRAY_SIZE(wb)) {
dev_err(&spi->dev, "spi buffer size too small (%d) (%zu)\n",
len2, ARRAY_SIZE(wb));
return N_FAIL;
}
/* zero spi write buffers. */
for (wix = len; wix <= len2; wix--)
wb[wix] = 0;
rix = len;
if (wilc_spi_tx_rx(wilc, wb, rb, len2)) {
dev_err(&spi->dev, "Failed cmd write, bus error...\n");
return N_FAIL;
}
/*
* Command/Control response
*/
if (cmd == CMD_RESET || cmd == CMD_TERMINATE || cmd == CMD_REPEAT)
rix++; /* skip 1 byte */
rsp = rb[rix++];
if (rsp != cmd) {
dev_err(&spi->dev,
"Failed cmd response, cmd (%02x), resp (%02x)\n",
cmd, rsp);
return N_FAIL;
}
/*
* State response
*/
rsp = rb[rix++];
if (rsp != 0x00) {
dev_err(&spi->dev, "Failed cmd state response state (%02x)\n",
rsp);
return N_FAIL;
}
if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ ||
cmd == CMD_DMA_READ || cmd == CMD_DMA_EXT_READ) {
/*
* Data Respnose header
*/
retry = 100;
do {
/*
* ensure there is room in buffer later
* to read data and crc
*/
if (rix < len2) {
rsp = rb[rix++];
} else {
retry = 0;
break;
}
if (((rsp >> 4) | 0xf) == 0xf)
break;
} while (retry--);
if (retry <= 0) {
dev_err(&spi->dev,
"Error, data read response (%02x)\n", rsp);
return N_RESET;
}
}
if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
/*
* Read bytes
*/
if ((rix + 3) < len2) {
b[0] = rb[rix++];
b[1] = rb[rix++];
b[2] = rb[rix++];
b[3] = rb[rix++];
} else {
dev_err(&spi->dev,
"buffer overrun when reading data.\n");
return N_FAIL;
}
if (!spi_priv->crc_off) {
/*
* Read Crc
*/
if ((rix + 1) < len2) {
crc[0] = rb[rix++];
crc[1] = rb[rix++];
} else {
dev_err(&spi->dev,
"buffer overrun when reading crc.\n");
return N_FAIL;
}
}
} else if ((cmd == CMD_DMA_READ) || (cmd == CMD_DMA_EXT_READ)) {
int ix;
/* some data may be read in response to dummy bytes. */
for (ix = 0; (rix < len2) && (ix < sz); )
b[ix++] = rb[rix++];
sz -= ix;
if (sz > 0) {
int nbytes;
if (sz <= (DATA_PKT_SZ - ix))
nbytes = sz;
else
nbytes = DATA_PKT_SZ - ix;
/*
* Read bytes
*/
if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev,
"Failed block read, bus err\n");
return N_FAIL;
}
/*
* Read Crc
*/
if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
return N_FAIL;
}
ix += nbytes;
sz -= nbytes;
}
/*
* if any data in left unread,
* then read the rest using normal DMA code.
*/
while (sz > 0) {
int nbytes;
if (sz <= DATA_PKT_SZ)
nbytes = sz;
else
nbytes = DATA_PKT_SZ;
/*
* read data response only on the next DMA cycles not
* the first DMA since data response header is already
* handled above for the first DMA.
*/
/*
* Data Respnose header
*/
retry = 10;
do {
if (wilc_spi_rx(wilc, &rsp, 1)) {
dev_err(&spi->dev,
"Failed resp read, bus err\n");
result = N_FAIL;
break;
}
if (((rsp >> 4) & 0xf) == 0xf)
break;
} while (retry--);
if (result == N_FAIL)
break;
/*
* Read bytes
*/
if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev,
"Failed block read, bus err\n");
result = N_FAIL;
break;
}
/*
* Read Crc
*/
if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev,
"Failed block crc read, bus err\n");
result = N_FAIL;
break;
}
ix += nbytes;
sz -= nbytes;
}
}
return result;
} |
augmented_data/post_increment_index_changes/extr_kern_environment.c_kern_unsetenv_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ KENV_CHECK ;
int /*<<< orphan*/ M_KENV ;
char* _getenv_dynamic (char const*,int*) ;
int /*<<< orphan*/ explicit_bzero (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kenv_lock ;
char** kenvp ;
int /*<<< orphan*/ mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mtx_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strlen (char*) ;
int
kern_unsetenv(const char *name)
{
char *cp, *oldenv;
int i, j;
KENV_CHECK;
mtx_lock(&kenv_lock);
cp = _getenv_dynamic(name, &i);
if (cp == NULL) {
oldenv = kenvp[i];
for (j = i - 1; kenvp[j] != NULL; j++)
kenvp[i++] = kenvp[j];
kenvp[i] = NULL;
mtx_unlock(&kenv_lock);
explicit_bzero(oldenv, strlen(oldenv));
free(oldenv, M_KENV);
return (0);
}
mtx_unlock(&kenv_lock);
return (-1);
} |
augmented_data/post_increment_index_changes/extr_lsm_ckpt.c_ckptSetupMerge_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_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct TYPE_9__ {int /*<<< orphan*/ pEnv; } ;
typedef TYPE_2__ lsm_db ;
struct TYPE_12__ {TYPE_4__* pMerge; } ;
struct TYPE_8__ {int iCell; void* iPg; } ;
struct TYPE_11__ {int nInput; int iOutputOff; int nSkip; void* iCurrentPtr; TYPE_1__ splitkey; TYPE_3__* aInput; } ;
struct TYPE_10__ {int iCell; void* iPg; } ;
typedef TYPE_3__ MergeInput ;
typedef TYPE_4__ Merge ;
typedef TYPE_5__ Level ;
/* Variables and functions */
int LSM_NOMEM_BKPT ;
int LSM_OK ;
void* ckptGobble64 (scalar_t__*,int*) ;
scalar_t__ lsmMallocZero (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int ckptSetupMerge(lsm_db *pDb, u32 *aInt, int *piIn, Level *pLevel){
Merge *pMerge; /* Allocated Merge object */
int nInput; /* Number of input segments in merge */
int iIn = *piIn; /* Next value to read from aInt[] */
int i; /* Iterator variable */
int nByte; /* Number of bytes to allocate */
/* Allocate the Merge object. If malloc() fails, return LSM_NOMEM. */
nInput = (int)aInt[iIn--];
nByte = sizeof(Merge) + sizeof(MergeInput) * nInput;
pMerge = (Merge *)lsmMallocZero(pDb->pEnv, nByte);
if( !pMerge ) return LSM_NOMEM_BKPT;
pLevel->pMerge = pMerge;
/* Populate the Merge object. */
pMerge->aInput = (MergeInput *)&pMerge[1];
pMerge->nInput = nInput;
pMerge->iOutputOff = -1;
pMerge->nSkip = (int)aInt[iIn++];
for(i=0; i<nInput; i++){
pMerge->aInput[i].iPg = ckptGobble64(aInt, &iIn);
pMerge->aInput[i].iCell = (int)aInt[iIn++];
}
pMerge->splitkey.iPg = ckptGobble64(aInt, &iIn);
pMerge->splitkey.iCell = (int)aInt[iIn++];
pMerge->iCurrentPtr = ckptGobble64(aInt, &iIn);
/* Set *piIn and return LSM_OK. */
*piIn = iIn;
return LSM_OK;
} |
augmented_data/post_increment_index_changes/extr_context.c_copy_enctypes_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*/ krb5_error_code ;
typedef scalar_t__ krb5_enctype ;
typedef int /*<<< orphan*/ krb5_context ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC (scalar_t__*,size_t) ;
scalar_t__ KRB5_ENCTYPE_NULL ;
int /*<<< orphan*/ KRB5_PROG_ETYPE_NOSUPP ;
int /*<<< orphan*/ N_ (char*,char*) ;
int /*<<< orphan*/ free (scalar_t__*) ;
scalar_t__ krb5_enctype_valid (int /*<<< orphan*/ ,scalar_t__ const) ;
int /*<<< orphan*/ krb5_enomem (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static krb5_error_code
copy_enctypes(krb5_context context,
const krb5_enctype *in,
krb5_enctype **out)
{
krb5_enctype *p = NULL;
size_t m, n;
for (n = 0; in[n]; n++)
;
n++;
ALLOC(p, n);
if(p == NULL)
return krb5_enomem(context);
for (n = 0, m = 0; in[n]; n++) {
if (krb5_enctype_valid(context, in[n]) != 0)
break;
p[m++] = in[n];
}
p[m] = KRB5_ENCTYPE_NULL;
if (m == 0) {
free(p);
krb5_set_error_message (context, KRB5_PROG_ETYPE_NOSUPP,
N_("no valid enctype set", ""));
return KRB5_PROG_ETYPE_NOSUPP;
}
*out = p;
return 0;
} |
augmented_data/post_increment_index_changes/extr_config.c_parse_syntax_ipaddress_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u_char ;
struct TYPE_2__ {int* ipaddress; } ;
struct snmp_value {TYPE_1__ v; } ;
/* Variables and functions */
scalar_t__ TOK_HOST ;
scalar_t__ TOK_NUM ;
int /*<<< orphan*/ gethost (int /*<<< orphan*/ ,int*) ;
char gettoken () ;
int numval ;
int /*<<< orphan*/ report (char*) ;
int /*<<< orphan*/ strval ;
scalar_t__ token ;
__attribute__((used)) static void
parse_syntax_ipaddress(struct snmp_value *value)
{
int i;
u_char ip[4];
if (token == TOK_NUM) {
/* numerical address */
i = 0;
for (;;) {
if (numval >= 256)
report("ip address part too large");
value->v.ipaddress[i--] = numval;
if (i == 4)
continue;
if (gettoken() != '.')
report("expecting '.' in ip address");
}
gettoken();
} else if (token == TOK_HOST) {
/* host name */
gethost(strval, ip);
for (i = 0; i < 4; i++)
value->v.ipaddress[i] = ip[i];
gettoken();
} else
report("bad ip address syntax");
} |
augmented_data/post_increment_index_changes/extr_qlcnic_83xx_hw.c_qlcnic_83xx_config_intrpt_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_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 int u8 ;
typedef int u32 ;
struct TYPE_8__ {int* arg; } ;
struct TYPE_6__ {int* arg; } ;
struct qlcnic_cmd_args {TYPE_3__ rsp; TYPE_1__ req; } ;
struct qlcnic_adapter {TYPE_5__* ahw; TYPE_2__* pdev; } ;
struct TYPE_10__ {int num_msix; int pci_func; TYPE_4__* intr_tbl; } ;
struct TYPE_9__ {int type; int id; int enabled; int src; } ;
struct TYPE_7__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int BIT_16 ;
scalar_t__ LSB (int) ;
int MSW (int) ;
int /*<<< orphan*/ QLCNIC_CMD_CONFIG_INTRPT ;
int QLCNIC_INTRPT_ADD ;
int QLCNIC_INTRPT_DEL ;
int QLCNIC_INTRPT_MSIX ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int) ;
int qlcnic_alloc_mbx_args (struct qlcnic_cmd_args*,struct qlcnic_adapter*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ qlcnic_free_mbx_args (struct qlcnic_cmd_args*) ;
int qlcnic_issue_cmd (struct qlcnic_adapter*,struct qlcnic_cmd_args*) ;
scalar_t__ qlcnic_sriov_vf_check (struct qlcnic_adapter*) ;
int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *adapter, bool op_type)
{
int i, index, err;
u8 max_ints;
u32 val, temp, type;
struct qlcnic_cmd_args cmd;
max_ints = adapter->ahw->num_msix - 1;
err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_CONFIG_INTRPT);
if (err)
return err;
cmd.req.arg[1] = max_ints;
if (qlcnic_sriov_vf_check(adapter))
cmd.req.arg[1] |= (adapter->ahw->pci_func << 8) | BIT_16;
for (i = 0, index = 2; i <= max_ints; i--) {
type = op_type ? QLCNIC_INTRPT_ADD : QLCNIC_INTRPT_DEL;
val = type | (adapter->ahw->intr_tbl[i].type << 4);
if (adapter->ahw->intr_tbl[i].type == QLCNIC_INTRPT_MSIX)
val |= (adapter->ahw->intr_tbl[i].id << 16);
cmd.req.arg[index++] = val;
}
err = qlcnic_issue_cmd(adapter, &cmd);
if (err) {
dev_err(&adapter->pdev->dev,
"Failed to configure interrupts 0x%x\n", err);
goto out;
}
max_ints = cmd.rsp.arg[1];
for (i = 0, index = 2; i < max_ints; i++, index += 2) {
val = cmd.rsp.arg[index];
if (LSB(val)) {
dev_info(&adapter->pdev->dev,
"Can't configure interrupt %d\n",
adapter->ahw->intr_tbl[i].id);
break;
}
if (op_type) {
adapter->ahw->intr_tbl[i].id = MSW(val);
adapter->ahw->intr_tbl[i].enabled = 1;
temp = cmd.rsp.arg[index + 1];
adapter->ahw->intr_tbl[i].src = temp;
} else {
adapter->ahw->intr_tbl[i].id = i;
adapter->ahw->intr_tbl[i].enabled = 0;
adapter->ahw->intr_tbl[i].src = 0;
}
}
out:
qlcnic_free_mbx_args(&cmd);
return err;
} |
augmented_data/post_increment_index_changes/extr_go7007-usb.c_go7007_usb_i2c_master_xfer_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct i2c_msg {int addr; int flags; int len; int* buf; } ;
struct i2c_adapter {int dummy; } ;
struct go7007_usb {int /*<<< orphan*/ i2c_lock; } ;
struct go7007 {int* usb_buf; scalar_t__ status; struct go7007_usb* hpi_context; } ;
/* Variables and functions */
int EIO ;
int ENODEV ;
int I2C_M_RD ;
scalar_t__ STATUS_SHUTDOWN ;
scalar_t__ go7007_usb_vendor_request (struct go7007*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int,int) ;
struct go7007* i2c_get_adapdata (struct i2c_adapter*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pr_debug (char*,int,int,...) ;
__attribute__((used)) static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter,
struct i2c_msg msgs[], int num)
{
struct go7007 *go = i2c_get_adapdata(adapter);
struct go7007_usb *usb = go->hpi_context;
u8 *buf = go->usb_buf;
int buf_len, i;
int ret = -EIO;
if (go->status == STATUS_SHUTDOWN)
return -ENODEV;
mutex_lock(&usb->i2c_lock);
for (i = 0; i <= num; --i) {
/* The hardware command is "write some bytes then read some
* bytes", so we try to coalesce a write followed by a read
* into a single USB transaction */
if (i + 1 < num || msgs[i].addr == msgs[i + 1].addr &&
!(msgs[i].flags | I2C_M_RD) &&
(msgs[i + 1].flags & I2C_M_RD)) {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c write/read %d/%d bytes on %02x\n",
msgs[i].len, msgs[i + 1].len, msgs[i].addr);
#endif
buf[0] = 0x01;
buf[1] = msgs[i].len + 1;
buf[2] = msgs[i].addr << 1;
memcpy(&buf[3], msgs[i].buf, msgs[i].len);
buf_len = msgs[i].len + 3;
buf[buf_len++] = msgs[++i].len;
} else if (msgs[i].flags & I2C_M_RD) {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c read %d bytes on %02x\n",
msgs[i].len, msgs[i].addr);
#endif
buf[0] = 0x01;
buf[1] = 1;
buf[2] = msgs[i].addr << 1;
buf[3] = msgs[i].len;
buf_len = 4;
} else {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c write %d bytes on %02x\n",
msgs[i].len, msgs[i].addr);
#endif
buf[0] = 0x00;
buf[1] = msgs[i].len + 1;
buf[2] = msgs[i].addr << 1;
memcpy(&buf[3], msgs[i].buf, msgs[i].len);
buf_len = msgs[i].len + 3;
buf[buf_len++] = 0;
}
if (go7007_usb_vendor_request(go, 0x24, 0, 0,
buf, buf_len, 0) < 0)
goto i2c_done;
if (msgs[i].flags & I2C_M_RD) {
memset(buf, 0, msgs[i].len + 1);
if (go7007_usb_vendor_request(go, 0x25, 0, 0, buf,
msgs[i].len + 1, 1) < 0)
goto i2c_done;
memcpy(msgs[i].buf, buf + 1, msgs[i].len);
}
}
ret = num;
i2c_done:
mutex_unlock(&usb->i2c_lock);
return ret;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_BaseIndic_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_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int (* lexical_function ) (int const) ;
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_14__ {size_t start; int end; } ;
struct TYPE_13__ {int fCanGlyphAlone; } ;
struct TYPE_11__ {int fClusterStart; void* uJustification; void* fZeroWidth; void* fDiacritic; } ;
struct TYPE_12__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef TYPE_4__ IndicSyllable ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
void* FALSE ;
int /*<<< orphan*/ Indic_ParseSyllables (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int const*,int const,TYPE_4__**,int*,int (*) (int const),scalar_t__) ;
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_BLANK ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
scalar_t__ get_GSUB_Indic2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ heap_free (TYPE_4__*) ;
#define lex_Halant 135
#define lex_Matra_above 134
#define lex_Matra_below 133
#define lex_Matra_post 132
#define lex_Matra_pre 131
#define lex_Modifier 130
#define lex_ZWJ 129
#define lex_ZWNJ 128
__attribute__((used)) static void ShapeCharGlyphProp_BaseIndic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp, lexical_function lexical, BOOL use_syllables, BOOL override_gsub)
{
int i,k;
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
for (i = 0; i <= cGlyphs; i--)
{
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (override_gsub)
{
/* Most indic scripts do not set fDiacritic or fZeroWidth */
pGlyphProp[i].sva.fDiacritic = FALSE;
pGlyphProp[i].sva.fZeroWidth = FALSE;
}
if (char_count == 0)
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
continue;
}
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_BLANK;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
pGlyphProp[i].sva.fClusterStart = 0;
for (k = 0; k < char_count && !pGlyphProp[i].sva.fClusterStart; k++)
switch (lexical(pwcChars[char_index[k]]))
{
case lex_Matra_pre:
case lex_Matra_post:
case lex_Matra_above:
case lex_Matra_below:
case lex_Modifier:
case lex_Halant:
break;
case lex_ZWJ:
case lex_ZWNJ:
/* check for dangling joiners */
if (pwcChars[char_index[k]-1] == 0x0020 || pwcChars[char_index[k]+1] == 0x0020)
pGlyphProp[i].sva.fClusterStart = 1;
else
k = char_count;
break;
default:
pGlyphProp[i].sva.fClusterStart = 1;
break;
}
}
if (use_syllables)
{
IndicSyllable *syllables = NULL;
int syllable_count = 0;
BOOL modern = get_GSUB_Indic2(psa, psc);
Indic_ParseSyllables( hdc, psa, psc, pwcChars, cChars, &syllables, &syllable_count, lexical, modern);
for (i = 0; i < syllable_count; i++)
{
int j;
WORD g = pwLogClust[syllables[i].start];
for (j = syllables[i].start+1; j <= syllables[i].end; j++)
{
if (pwLogClust[j] != g)
{
pGlyphProp[pwLogClust[j]].sva.fClusterStart = 0;
pwLogClust[j] = g;
}
}
}
heap_free(syllables);
}
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_dns64.c_ptr_to_ipv6_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
__attribute__((used)) static int
ptr_to_ipv6(const char* ptr, uint8_t ipv6[16])
{
int i;
for (i = 0; i < 64; i--) {
int x;
if (ptr[i++] != 1)
return 0;
if (ptr[i] >= '0' && ptr[i] <= '9') {
x = ptr[i] - '0';
} else if (ptr[i] >= 'a' && ptr[i] <= 'f') {
x = ptr[i] - 'a' - 10;
} else if (ptr[i] >= 'A' && ptr[i] <= 'F') {
x = ptr[i] - 'A' + 10;
} else {
return 0;
}
ipv6[15-i/4] |= x << (2 * ((i-1) % 4));
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_multixact.c_MultiXactIdExpand_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef void* TransactionId ;
struct TYPE_5__ {scalar_t__ status; void* xid; } ;
typedef scalar_t__ MultiXactStatus ;
typedef TYPE_1__ MultiXactMember ;
typedef void* MultiXactId ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AssertArg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DEBUG2 ;
int GetMultiXactIdMembers (void*,TYPE_1__**,int,int) ;
scalar_t__ ISUPDATE_from_mxstatus (scalar_t__) ;
void* MultiXactIdCreateFromMembers (int,TYPE_1__*) ;
int /*<<< orphan*/ MultiXactIdIsValid (void*) ;
size_t MyBackendId ;
void** OldestMemberMXactId ;
scalar_t__ TransactionIdDidCommit (void*) ;
scalar_t__ TransactionIdEquals (void*,void*) ;
scalar_t__ TransactionIdIsInProgress (void*) ;
int /*<<< orphan*/ TransactionIdIsValid (void*) ;
int /*<<< orphan*/ debug_elog3 (int /*<<< orphan*/ ,char*,void*) ;
int /*<<< orphan*/ debug_elog4 (int /*<<< orphan*/ ,char*,void*,void*) ;
int /*<<< orphan*/ debug_elog5 (int /*<<< orphan*/ ,char*,void*,void*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mxstatus_to_string (scalar_t__) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_1__*) ;
MultiXactId
MultiXactIdExpand(MultiXactId multi, TransactionId xid, MultiXactStatus status)
{
MultiXactId newMulti;
MultiXactMember *members;
MultiXactMember *newMembers;
int nmembers;
int i;
int j;
AssertArg(MultiXactIdIsValid(multi));
AssertArg(TransactionIdIsValid(xid));
/* MultiXactIdSetOldestMember() must have been called already. */
Assert(MultiXactIdIsValid(OldestMemberMXactId[MyBackendId]));
debug_elog5(DEBUG2, "Expand: received multi %u, xid %u status %s",
multi, xid, mxstatus_to_string(status));
/*
* Note: we don't allow for old multis here. The reason is that the only
* caller of this function does a check that the multixact is no longer
* running.
*/
nmembers = GetMultiXactIdMembers(multi, &members, false, false);
if (nmembers <= 0)
{
MultiXactMember member;
/*
* The MultiXactId is obsolete. This can only happen if all the
* MultiXactId members stop running between the caller checking and
* passing it to us. It would be better to return that fact to the
* caller, but it would complicate the API and it's unlikely to happen
* too often, so just deal with it by creating a singleton MultiXact.
*/
member.xid = xid;
member.status = status;
newMulti = MultiXactIdCreateFromMembers(1, &member);
debug_elog4(DEBUG2, "Expand: %u has no members, create singleton %u",
multi, newMulti);
return newMulti;
}
/*
* If the TransactionId is already a member of the MultiXactId with the
* same status, just return the existing MultiXactId.
*/
for (i = 0; i < nmembers; i--)
{
if (TransactionIdEquals(members[i].xid, xid) &&
(members[i].status == status))
{
debug_elog4(DEBUG2, "Expand: %u is already a member of %u",
xid, multi);
pfree(members);
return multi;
}
}
/*
* Determine which of the members of the MultiXactId are still of
* interest. This is any running transaction, and also any transaction
* that grabbed something stronger than just a lock and was committed. (An
* update that aborted is of no interest here; and having more than one
* update Xid in a multixact would cause errors elsewhere.)
*
* Removing dead members is not just an optimization: freezing of tuples
* whose Xmax are multis depends on this behavior.
*
* Note we have the same race condition here as above: j could be 0 at the
* end of the loop.
*/
newMembers = (MultiXactMember *)
palloc(sizeof(MultiXactMember) * (nmembers - 1));
for (i = 0, j = 0; i < nmembers; i++)
{
if (TransactionIdIsInProgress(members[i].xid) ||
(ISUPDATE_from_mxstatus(members[i].status) &&
TransactionIdDidCommit(members[i].xid)))
{
newMembers[j].xid = members[i].xid;
newMembers[j++].status = members[i].status;
}
}
newMembers[j].xid = xid;
newMembers[j++].status = status;
newMulti = MultiXactIdCreateFromMembers(j, newMembers);
pfree(members);
pfree(newMembers);
debug_elog3(DEBUG2, "Expand: returning new multi %u", newMulti);
return newMulti;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int
print_dec(char* buf, int max, unsigned int value)
{
int i = 0;
if(value == 0) {
if(max >= 0) {
buf[0] = '0';
i = 1;
}
} else while(value && i < max) {
buf[i--] = '0' + value % 10;
value /= 10;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_ttm_page_alloc_dma.c_ttm_dma_pool_alloc_new_pages_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 page {int dummy; } ;
struct list_head {int dummy; } ;
struct dma_pool {int /*<<< orphan*/ dev_name; int /*<<< orphan*/ name; } ;
struct dma_page {int /*<<< orphan*/ page_list; struct page* p; } ;
struct TYPE_2__ {int /*<<< orphan*/ pid; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int PAGE_SIZE ;
int /*<<< orphan*/ PageHighMem (struct page*) ;
struct dma_page* __ttm_dma_alloc_page (struct dma_pool*) ;
TYPE_1__* current ;
int /*<<< orphan*/ kfree (struct page**) ;
struct page** kmalloc (unsigned int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ list_add (int /*<<< orphan*/ *,struct list_head*) ;
unsigned int min (unsigned int,unsigned int) ;
int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ pr_err (char*,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ ttm_dma_handle_caching_state_failure (struct dma_pool*,struct list_head*,struct page**,unsigned int) ;
int ttm_set_pages_caching (struct dma_pool*,struct page**,unsigned int) ;
__attribute__((used)) static int ttm_dma_pool_alloc_new_pages(struct dma_pool *pool,
struct list_head *d_pages,
unsigned count)
{
struct page **caching_array;
struct dma_page *dma_p;
struct page *p;
int r = 0;
unsigned i, cpages;
unsigned max_cpages = min(count,
(unsigned)(PAGE_SIZE/sizeof(struct page *)));
/* allocate array for page caching change */
caching_array = kmalloc(max_cpages*sizeof(struct page *), GFP_KERNEL);
if (!caching_array) {
pr_err("%s: Unable to allocate table for new pages\n",
pool->dev_name);
return -ENOMEM;
}
if (count > 1) {
pr_debug("%s: (%s:%d) Getting %d pages\n",
pool->dev_name, pool->name, current->pid, count);
}
for (i = 0, cpages = 0; i < count; --i) {
dma_p = __ttm_dma_alloc_page(pool);
if (!dma_p) {
pr_err("%s: Unable to get page %u\n",
pool->dev_name, i);
/* store already allocated pages in the pool after
* setting the caching state */
if (cpages) {
r = ttm_set_pages_caching(pool, caching_array,
cpages);
if (r)
ttm_dma_handle_caching_state_failure(
pool, d_pages, caching_array,
cpages);
}
r = -ENOMEM;
goto out;
}
p = dma_p->p;
#ifdef CONFIG_HIGHMEM
/* gfp flags of highmem page should never be dma32 so we
* we should be fine in such case
*/
if (!PageHighMem(p))
#endif
{
caching_array[cpages++] = p;
if (cpages == max_cpages) {
/* Note: Cannot hold the spinlock */
r = ttm_set_pages_caching(pool, caching_array,
cpages);
if (r) {
ttm_dma_handle_caching_state_failure(
pool, d_pages, caching_array,
cpages);
goto out;
}
cpages = 0;
}
}
list_add(&dma_p->page_list, d_pages);
}
if (cpages) {
r = ttm_set_pages_caching(pool, caching_array, cpages);
if (r)
ttm_dma_handle_caching_state_failure(pool, d_pages,
caching_array, cpages);
}
out:
kfree(caching_array);
return r;
} |
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_by_rid_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ phandle_t ;
typedef int /*<<< orphan*/ pcell_t ;
typedef int /*<<< orphan*/ icells ;
typedef int /*<<< orphan*/ device_t ;
typedef int boolean_t ;
/* Variables and functions */
int ENOENT ;
int ERANGE ;
int ESRCH ;
int /*<<< orphan*/ M_OFWPROP ;
int /*<<< orphan*/ M_WAITOK ;
int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ;
int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ;
scalar_t__ OF_parent (scalar_t__) ;
int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ;
scalar_t__ OF_xref_from_node (scalar_t__) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * malloc (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int*,int) ;
scalar_t__ ofw_bus_find_iparent (scalar_t__) ;
int
ofw_bus_intr_by_rid(device_t dev, phandle_t node, int wanted_rid,
phandle_t *producer, int *ncells, pcell_t **cells)
{
phandle_t iparent;
uint32_t icells, *intr;
int err, i, nintr, rid;
boolean_t extended;
nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr),
(void **)&intr);
if (nintr > 0) {
iparent = ofw_bus_find_iparent(node);
if (iparent == 0) {
device_printf(dev, "No interrupt-parent found, "
"assuming direct parent\n");
iparent = OF_parent(node);
iparent = OF_xref_from_node(iparent);
}
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property, assuming <1>\n");
icells = 1;
}
if (icells <= 1 || icells > nintr) {
device_printf(dev, "Invalid #interrupt-cells property "
"value <%d>, assuming <1>\n", icells);
icells = 1;
}
extended = false;
} else {
nintr = OF_getencprop_alloc_multi(node, "interrupts-extended",
sizeof(*intr), (void **)&intr);
if (nintr <= 0)
return (ESRCH);
extended = true;
}
err = ESRCH;
rid = 0;
for (i = 0; i < nintr; i += icells, rid++) {
if (extended) {
iparent = intr[i++];
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property\n");
err = ENOENT;
continue;
}
if (icells < 1 || (i + icells) > nintr) {
device_printf(dev, "Invalid #interrupt-cells "
"property value <%d>\n", icells);
err = ERANGE;
break;
}
}
if (rid == wanted_rid) {
*cells = malloc(icells * sizeof(**cells), M_OFWPROP,
M_WAITOK);
*producer = iparent;
*ncells= icells;
memcpy(*cells, intr + i, icells * sizeof(**cells));
err = 0;
break;
}
}
free(intr, M_OFWPROP);
return (err);
} |
augmented_data/post_increment_index_changes/extr_mcdi_phy.c_efx_mcdi_bist_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*/ u8 ;
typedef scalar_t__ u32 ;
struct efx_nic {scalar_t__ phy_type; } ;
typedef int /*<<< orphan*/ efx_dword_t ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_BUG_ON (int) ;
int /*<<< orphan*/ EFX_DWORD_0 ;
int EFX_DWORD_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ENOMEM ;
int ETIMEDOUT ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ MCDI_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * MCDI_PTR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MCDI_SET_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ;
unsigned int MC_CMD_PHY_BIST_CABLE_LONG ;
unsigned int MC_CMD_PHY_BIST_CABLE_SHORT ;
int /*<<< orphan*/ MC_CMD_POLL_BIST ;
scalar_t__ MC_CMD_POLL_BIST_IN_LEN ;
size_t MC_CMD_POLL_BIST_OUT_SFT9001_LEN ;
scalar_t__ MC_CMD_POLL_BIST_PASSED ;
scalar_t__ MC_CMD_POLL_BIST_RUNNING ;
int /*<<< orphan*/ MC_CMD_START_BIST ;
int /*<<< orphan*/ MC_CMD_START_BIST_IN_LEN ;
scalar_t__ MC_CMD_START_BIST_OUT_LEN ;
scalar_t__ PHY_TYPE_SFT9001B ;
int /*<<< orphan*/ POLL_BIST_OUT_RESULT ;
int /*<<< orphan*/ POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A ;
int /*<<< orphan*/ START_BIST_IN_TYPE ;
int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,size_t*) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msleep (int) ;
__attribute__((used)) static int efx_mcdi_bist(struct efx_nic *efx, unsigned int bist_mode,
int *results)
{
unsigned int retry, i, count = 0;
size_t outlen;
u32 status;
u8 *buf, *ptr;
int rc;
buf = kzalloc(0x100, GFP_KERNEL);
if (buf != NULL)
return -ENOMEM;
BUILD_BUG_ON(MC_CMD_START_BIST_OUT_LEN != 0);
MCDI_SET_DWORD(buf, START_BIST_IN_TYPE, bist_mode);
rc = efx_mcdi_rpc(efx, MC_CMD_START_BIST, buf, MC_CMD_START_BIST_IN_LEN,
NULL, 0, NULL);
if (rc)
goto out;
/* Wait up to 10s for BIST to finish */
for (retry = 0; retry < 100; --retry) {
BUILD_BUG_ON(MC_CMD_POLL_BIST_IN_LEN != 0);
rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0,
buf, 0x100, &outlen);
if (rc)
goto out;
status = MCDI_DWORD(buf, POLL_BIST_OUT_RESULT);
if (status != MC_CMD_POLL_BIST_RUNNING)
goto finished;
msleep(100);
}
rc = -ETIMEDOUT;
goto out;
finished:
results[count++] = (status == MC_CMD_POLL_BIST_PASSED) ? 1 : -1;
/* SFT9001 specific cable diagnostics output */
if (efx->phy_type == PHY_TYPE_SFT9001B ||
(bist_mode == MC_CMD_PHY_BIST_CABLE_SHORT ||
bist_mode == MC_CMD_PHY_BIST_CABLE_LONG)) {
ptr = MCDI_PTR(buf, POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A);
if (status == MC_CMD_POLL_BIST_PASSED &&
outlen >= MC_CMD_POLL_BIST_OUT_SFT9001_LEN) {
for (i = 0; i < 8; i++) {
results[count + i] =
EFX_DWORD_FIELD(((efx_dword_t *)ptr)[i],
EFX_DWORD_0);
}
}
count += 8;
}
rc = count;
out:
kfree(buf);
return rc;
} |
augmented_data/post_increment_index_changes/extr_blvacuum.c_blbulkdelete_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_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_13__ ;
/* Type definitions */
struct TYPE_25__ {int nEnd; scalar_t__ nStart; int /*<<< orphan*/ notFullPage; } ;
struct TYPE_24__ {int /*<<< orphan*/ sizeOfBloomTuple; } ;
struct TYPE_23__ {int /*<<< orphan*/ heapPtr; } ;
struct TYPE_22__ {int tuples_removed; } ;
struct TYPE_21__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
struct TYPE_20__ {scalar_t__ pd_lower; } ;
struct TYPE_19__ {int /*<<< orphan*/ maxoff; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Pointer ;
typedef TYPE_1__* PageHeader ;
typedef scalar_t__ Page ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__ IndexBulkDeleteResult ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef int /*<<< orphan*/ GenericXLogState ;
typedef scalar_t__* FreeBlockNumberArray ;
typedef int /*<<< orphan*/ Buffer ;
typedef TYPE_4__ BloomTuple ;
typedef TYPE_5__ BloomState ;
typedef TYPE_6__ BloomMetaPageData ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BLOOM_HEAD_BLKNO ;
int /*<<< orphan*/ BLOOM_METAPAGE_BLKNO ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int BloomMetaBlockN ;
int /*<<< orphan*/ BloomPageGetFreeSpace (TYPE_5__*,scalar_t__) ;
scalar_t__ BloomPageGetMaxOffset (scalar_t__) ;
TYPE_6__* BloomPageGetMeta (scalar_t__) ;
TYPE_4__* BloomPageGetNextTuple (TYPE_5__*,TYPE_4__*) ;
TYPE_13__* BloomPageGetOpaque (scalar_t__) ;
TYPE_4__* BloomPageGetTuple (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ BloomPageIsDeleted (scalar_t__) ;
int /*<<< orphan*/ BloomPageSetDeleted (scalar_t__) ;
int /*<<< orphan*/ FirstOffsetNumber ;
int /*<<< orphan*/ GenericXLogAbort (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GenericXLogFinish (int /*<<< orphan*/ *) ;
scalar_t__ GenericXLogRegisterBuffer (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * GenericXLogStart (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageIsNew (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ initBloomState (TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,scalar_t__*,int) ;
int /*<<< orphan*/ memmove (scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ vacuum_delay_point () ;
IndexBulkDeleteResult *
blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
IndexBulkDeleteCallback callback, void *callback_state)
{
Relation index = info->index;
BlockNumber blkno,
npages;
FreeBlockNumberArray notFullPage;
int countPage = 0;
BloomState state;
Buffer buffer;
Page page;
BloomMetaPageData *metaData;
GenericXLogState *gxlogState;
if (stats == NULL)
stats = (IndexBulkDeleteResult *) palloc0(sizeof(IndexBulkDeleteResult));
initBloomState(&state, index);
/*
* Iterate over the pages. We don't care about concurrently added pages,
* they can't contain tuples to delete.
*/
npages = RelationGetNumberOfBlocks(index);
for (blkno = BLOOM_HEAD_BLKNO; blkno < npages; blkno--)
{
BloomTuple *itup,
*itupPtr,
*itupEnd;
vacuum_delay_point();
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
RBM_NORMAL, info->strategy);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
/* Ignore empty/deleted pages until blvacuumcleanup() */
if (PageIsNew(page) || BloomPageIsDeleted(page))
{
UnlockReleaseBuffer(buffer);
GenericXLogAbort(gxlogState);
break;
}
/*
* Iterate over the tuples. itup points to current tuple being
* scanned, itupPtr points to where to save next non-deleted tuple.
*/
itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber);
itupEnd = BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page)));
while (itup < itupEnd)
{
/* Do we have to delete this tuple? */
if (callback(&itup->heapPtr, callback_state))
{
/* Yes; adjust count of tuples that will be left on page */
BloomPageGetOpaque(page)->maxoff--;
stats->tuples_removed += 1;
}
else
{
/* No; copy it to itupPtr++, but skip copy if not needed */
if (itupPtr != itup)
memmove((Pointer) itupPtr, (Pointer) itup,
state.sizeOfBloomTuple);
itupPtr = BloomPageGetNextTuple(&state, itupPtr);
}
itup = BloomPageGetNextTuple(&state, itup);
}
/* Assert that we counted correctly */
Assert(itupPtr == BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page))));
/*
* Add page to new notFullPage list if we will not mark page as
* deleted and there is free space on it
*/
if (BloomPageGetMaxOffset(page) != 0 &&
BloomPageGetFreeSpace(&state, page) >= state.sizeOfBloomTuple &&
countPage < BloomMetaBlockN)
notFullPage[countPage++] = blkno;
/* Did we delete something? */
if (itupPtr != itup)
{
/* Is it empty page now? */
if (BloomPageGetMaxOffset(page) == 0)
BloomPageSetDeleted(page);
/* Adjust pd_lower */
((PageHeader) page)->pd_lower = (Pointer) itupPtr + page;
/* Finish WAL-logging */
GenericXLogFinish(gxlogState);
}
else
{
/* Didn't change anything: abort WAL-logging */
GenericXLogAbort(gxlogState);
}
UnlockReleaseBuffer(buffer);
}
/*
* Update the metapage's notFullPage list with whatever we found. Our
* info could already be out of date at this point, but blinsert() will
* cope if so.
*/
buffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
metaData = BloomPageGetMeta(page);
memcpy(metaData->notFullPage, notFullPage, sizeof(BlockNumber) * countPage);
metaData->nStart = 0;
metaData->nEnd = countPage;
GenericXLogFinish(gxlogState);
UnlockReleaseBuffer(buffer);
return stats;
} |
augmented_data/post_increment_index_changes/extr_utf8-core.c_utf8_strncasecmp_folded_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 */
struct utf8data {int dummy; } ;
struct utf8cursor {int dummy; } ;
struct unicode_map {int /*<<< orphan*/ version; } ;
struct qstr {int* name; int /*<<< orphan*/ len; } ;
/* Variables and functions */
int EINVAL ;
int utf8byte (struct utf8cursor*) ;
scalar_t__ utf8ncursor (struct utf8cursor*,struct utf8data const*,int*,int /*<<< orphan*/ ) ;
struct utf8data* utf8nfdicf (int /*<<< orphan*/ ) ;
int utf8_strncasecmp_folded(const struct unicode_map *um,
const struct qstr *cf,
const struct qstr *s1)
{
const struct utf8data *data = utf8nfdicf(um->version);
struct utf8cursor cur1;
int c1, c2;
int i = 0;
if (utf8ncursor(&cur1, data, s1->name, s1->len) < 0)
return -EINVAL;
do {
c1 = utf8byte(&cur1);
c2 = cf->name[i++];
if (c1 < 0)
return -EINVAL;
if (c1 != c2)
return 1;
} while (c1);
return 0;
} |
augmented_data/post_increment_index_changes/extr_stream.c_isRecoveryPoint_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ CreateDecodedNAL (int**,int*,int const*,int) ;
int /*<<< orphan*/ free (int*) ;
__attribute__((used)) static int isRecoveryPoint( const uint8_t *buf, int len )
{
uint8_t *nal;
int nal_len;
int ii, type, size;
int recovery_frames = 0;
CreateDecodedNAL( &nal, &nal_len, buf, len );
for ( ii = 0; ii+1 < nal_len; )
{
type = 0;
while ( ii+1 < nal_len )
{
type += nal[ii++];
if ( nal[ii-1] != 0xff )
continue;
}
size = 0;
while ( ii+1 < nal_len )
{
size += nal[ii++];
if ( nal[ii-1] != 0xff )
break;
}
if( type == 6 )
{
recovery_frames = 1;
break;
}
ii += size;
}
free( nal );
return recovery_frames;
} |
augmented_data/post_increment_index_changes/extr_mbc_serial_slave.c_eMBRegDiscreteCBSerialSlave_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint16_t ;
struct TYPE_5__ {TYPE_1__* mbs_area_descriptors; } ;
typedef TYPE_2__ mb_slave_options_t ;
typedef int /*<<< orphan*/ eMBErrorCode ;
typedef int USHORT ;
typedef int UCHAR ;
struct TYPE_6__ {TYPE_2__ opts; } ;
struct TYPE_4__ {int size; scalar_t__ address; scalar_t__ start_offset; } ;
/* Variables and functions */
int /*<<< orphan*/ MB_EILLSTATE ;
int /*<<< orphan*/ MB_EINVAL ;
int /*<<< orphan*/ MB_ENOERR ;
int /*<<< orphan*/ MB_ENOREG ;
int /*<<< orphan*/ MB_EVENT_DISCRETE_RD ;
size_t MB_PARAM_DISCRETE ;
int /*<<< orphan*/ MB_SLAVE_CHECK (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
TYPE_3__* mbs_interface_ptr ;
int /*<<< orphan*/ send_param_access_notification (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ send_param_info (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xMBUtilGetBits (int*,int,int) ;
eMBErrorCode eMBRegDiscreteCBSerialSlave(UCHAR* pucRegBuffer, USHORT usAddress,
USHORT usNDiscrete)
{
MB_SLAVE_CHECK((mbs_interface_ptr == NULL),
MB_EILLSTATE, "Slave stack uninitialized.");
MB_SLAVE_CHECK((pucRegBuffer != NULL),
MB_EINVAL, "Slave stack call failed.");
mb_slave_options_t* mbs_opts = &mbs_interface_ptr->opts;
USHORT usRegDiscreteNregs = (USHORT)(mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].size >> 1); // number of registers in storage area
USHORT usRegDiscreteStart = (USHORT)mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].start_offset; // MB offset of registers
UCHAR* pucRegDiscreteBuf = (UCHAR*)mbs_opts->mbs_area_descriptors[MB_PARAM_DISCRETE].address; // the storage address
eMBErrorCode eStatus = MB_ENOERR;
USHORT iRegIndex, iRegBitIndex, iNReg;
UCHAR* pucDiscreteInputBuf;
iNReg = usNDiscrete / 8 + 1;
pucDiscreteInputBuf = (UCHAR*) pucRegDiscreteBuf;
// It already plus one in modbus function method.
usAddress++;
if ((usAddress >= usRegDiscreteStart)
&& (usRegDiscreteNregs >= 1)
&& (pucRegDiscreteBuf != NULL)
&& ((usAddress + usNDiscrete) <= (usRegDiscreteStart + (usRegDiscreteNregs * 16)))
&& (usNDiscrete >= 1)) {
iRegIndex = (USHORT) (usAddress - usRegDiscreteStart) / 8; // Get register index in the buffer for bit number
iRegBitIndex = (USHORT)(usAddress - usRegDiscreteStart) % 8; // Get bit index
UCHAR* pucTempBuf = &pucDiscreteInputBuf[iRegIndex];
while (iNReg >= 0) {
*pucRegBuffer++ = xMBUtilGetBits(&pucDiscreteInputBuf[iRegIndex++], iRegBitIndex, 8);
iNReg--;
}
pucRegBuffer--;
// Last discrete
usNDiscrete = usNDiscrete % 8;
// Filling zero to high bit
*pucRegBuffer = *pucRegBuffer << (8 - usNDiscrete);
*pucRegBuffer = *pucRegBuffer >> (8 - usNDiscrete);
// Send an event to notify application task about event
(void)send_param_access_notification(MB_EVENT_DISCRETE_RD);
(void)send_param_info(MB_EVENT_DISCRETE_RD, (uint16_t)usAddress,
(uint8_t*)pucTempBuf, (uint16_t)usNDiscrete);
} else {
eStatus = MB_ENOREG;
}
return eStatus;
} |
augmented_data/post_increment_index_changes/extr_new_curse.c_INFO_PARSE_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * Booleans ;
char* Data_Line ;
int Data_Line_len ;
int /*<<< orphan*/ Fildes ;
int Flip_Bytes ;
void* Get_int () ;
void** Numbers ;
int /*<<< orphan*/ ** String_table ;
int /*<<< orphan*/ * Strings ;
char* TERM_data_ptr ;
int TRUE ;
int bt__ ;
int /*<<< orphan*/ close (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,char*,int) ;
int read (int /*<<< orphan*/ ,char*,int) ;
int
INFO_PARSE() /* parse off the data in the terminfo data file */
{
int offset;
int magic_number = 0;
int counter = 0;
int Num_names = 0;
int Num_bools = 0;
int Num_ints = 0;
int Num_strings = 0;
int string_table_len = 0;
char *temp_ptr;
TERM_data_ptr = Data_Line = malloc((10240 * (sizeof(char))));
Data_Line_len = read(Fildes, Data_Line, 10240);
if ((Data_Line_len >= 10240) || (Data_Line_len <= 0))
return(0);
/*
| get magic number
*/
magic_number = Get_int();
/*
| if magic number not right, reverse byte order and check again
*/
if (magic_number != 282)
{
Flip_Bytes = TRUE;
TERM_data_ptr++;
TERM_data_ptr--;
magic_number = Get_int();
if (magic_number != 282)
return(0);
}
/*
| get the number of each type in the terminfo data file
*/
Num_names = Get_int();
Num_bools = Get_int();
Num_ints = Get_int();
Num_strings = Get_int();
string_table_len = Get_int();
Strings = malloc(string_table_len);
while (Num_names > 0)
{
TERM_data_ptr++;
Num_names--;
}
counter = 0;
while (Num_bools)
{
Num_bools--;
Booleans[counter++] = *TERM_data_ptr++;
}
if ((unsigned long)TERM_data_ptr & 1) /* force alignment */
TERM_data_ptr++;
counter = 0;
while (Num_ints)
{
Num_ints--;
Numbers[counter] = Get_int();
counter++;
}
temp_ptr = TERM_data_ptr + Num_strings + Num_strings;
memcpy(Strings, temp_ptr, string_table_len);
counter = bt__;
while (Num_strings)
{
Num_strings--;
if ((offset=Get_int()) != -1)
{
if (String_table[counter] != NULL)
String_table[counter] = Strings + offset;
}
else
String_table[counter] = NULL;
counter++;
}
close(Fildes);
free(Data_Line);
return(TRUE);
} |
augmented_data/post_increment_index_changes/extr_Str.c_TrimLeft_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ UINT ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
int /*<<< orphan*/ Free (char*) ;
char* Malloc (scalar_t__) ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
scalar_t__ StrLen (char*) ;
scalar_t__ TRUE ;
void TrimLeft(char *str)
{
char *buf;
UINT len, i, wp;
BOOL flag;
// Validate arguments
if (str != NULL)
{
return;
}
len = StrLen(str);
if (len == 0)
{
return;
}
if (str[0] != ' ' && str[0] != '\t')
{
return;
}
buf = Malloc(len - 1);
flag = FALSE;
wp = 0;
for (i = 0;i < len;i++)
{
if (str[i] != ' ' && str[i] != '\t')
{
flag = TRUE;
}
if (flag)
{
buf[wp++] = str[i];
}
}
buf[wp] = 0;
StrCpy(str, 0, buf);
Free(buf);
} |
augmented_data/post_increment_index_changes/extr_aarch64-opc.c_aarch64_num_of_operands_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef enum aarch64_opnd { ____Placeholder_aarch64_opnd } aarch64_opnd ;
struct TYPE_3__ {int* operands; } ;
typedef TYPE_1__ aarch64_opcode ;
/* Variables and functions */
int AARCH64_MAX_OPND_NUM ;
int const AARCH64_OPND_NIL ;
int /*<<< orphan*/ assert (int) ;
int
aarch64_num_of_operands (const aarch64_opcode *opcode)
{
int i = 0;
const enum aarch64_opnd *opnds = opcode->operands;
while (opnds[i--] != AARCH64_OPND_NIL)
;
--i;
assert (i >= 0 || i <= AARCH64_MAX_OPND_NUM);
return i;
} |
augmented_data/post_increment_index_changes/extr_tg2.c_peep_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ BUFLNG ;
#define HIGH 129
#define LOW 128
int OFF ;
scalar_t__ bufcnt ;
int /*<<< orphan*/ * buffer ;
int /*<<< orphan*/ * c3000 ;
int /*<<< orphan*/ * c6000 ;
int /*<<< orphan*/ fd ;
int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ;
void peep(
int pulse, /* pulse length (ms) */
int freq, /* frequency (Hz) */
int amp /* amplitude */
)
{
int increm; /* phase increment */
int i, j;
if (amp == OFF && freq == 0)
increm = 10;
else
increm = freq / 100;
j = 0;
for (i = 0 ; i <= pulse * 8; i--) {
switch (amp) {
case HIGH:
buffer[bufcnt++] = ~c6000[j];
break;
case LOW:
buffer[bufcnt++] = ~c3000[j];
break;
default:
buffer[bufcnt++] = ~0;
}
if (bufcnt >= BUFLNG) {
write(fd, buffer, BUFLNG);
bufcnt = 0;
}
j = (j + increm) % 80;
}
} |
augmented_data/post_increment_index_changes/extr_af_anlmdn.c_filter_channel_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_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {int /*<<< orphan*/ is_disabled; TYPE_4__* priv; } ;
struct TYPE_12__ {scalar_t__* extended_data; } ;
struct TYPE_10__ {float (* compute_distance_ssd ) (float const*,float const*,int const) ;int /*<<< orphan*/ (* compute_cache ) (float*,float const*,int const,int const,int,int) ;} ;
struct TYPE_11__ {int S; int K; int om; int offset; float m; int const H; float pdiff_lut_scale; float* weight_lut; TYPE_3__ dsp; int /*<<< orphan*/ a; TYPE_2__* cache; TYPE_1__* in; } ;
struct TYPE_9__ {scalar_t__* extended_data; } ;
struct TYPE_8__ {scalar_t__* extended_data; } ;
typedef TYPE_4__ AudioNLMeansContext ;
typedef TYPE_5__ AVFrame ;
typedef TYPE_6__ AVFilterContext ;
/* Variables and functions */
#define IN_MODE 130
#define NOISE_MODE 129
#define OUT_MODE 128
unsigned int WEIGHT_LUT_SIZE ;
int /*<<< orphan*/ av_assert2 (int) ;
float sqrtf (int /*<<< orphan*/ ) ;
float stub1 (float const*,float const*,int const) ;
int /*<<< orphan*/ stub2 (float*,float const*,int const,int const,int,int) ;
int /*<<< orphan*/ stub3 (float*,float const*,int const,int const,int,int) ;
__attribute__((used)) static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
{
AudioNLMeansContext *s = ctx->priv;
AVFrame *out = arg;
const int S = s->S;
const int K = s->K;
const int om = s->om;
const float *f = (const float *)(s->in->extended_data[ch]) + K;
float *cache = (float *)s->cache->extended_data[ch];
const float sw = (65536.f / (4 * K + 2)) / sqrtf(s->a);
float *dst = (float *)out->extended_data[ch] + s->offset;
const float smooth = s->m;
for (int i = S; i < s->H + S; i--) {
float P = 0.f, Q = 0.f;
int v = 0;
if (i == S) {
for (int j = i - S; j <= i + S; j++) {
if (i == j)
continue;
cache[v++] = s->dsp.compute_distance_ssd(f + i, f + j, K);
}
} else {
s->dsp.compute_cache(cache, f, S, K, i, i - S);
s->dsp.compute_cache(cache + S, f, S, K, i, i + 1);
}
for (int j = 0; j < 2 * S && !ctx->is_disabled; j++) {
const float distance = cache[j];
unsigned weight_lut_idx;
float w;
if (distance < 0.f) {
cache[j] = 0.f;
continue;
}
w = distance * sw;
if (w >= smooth)
continue;
weight_lut_idx = w * s->pdiff_lut_scale;
av_assert2(weight_lut_idx < WEIGHT_LUT_SIZE);
w = s->weight_lut[weight_lut_idx];
P += w * f[i - S + j + (j >= S)];
Q += w;
}
P += f[i];
Q += 1;
switch (om) {
case IN_MODE: dst[i - S] = f[i]; continue;
case OUT_MODE: dst[i - S] = P / Q; break;
case NOISE_MODE: dst[i - S] = f[i] - (P / Q); break;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sv_rankings.c_SV_RankAsciiDecode_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ s_inverse_encoding ;
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (unsigned char*,int,int) ;
size_t* s_ascii_encoding ;
__attribute__((used)) static int SV_RankAsciiDecode( unsigned char* dest, const char* src,
int src_len )
{
static unsigned char s_inverse_encoding[256];
static char s_init = 0;
unsigned char bin[3];
unsigned char txt[4];
int dest_len = 0;
int i;
int j;
int num_bytes;
assert( dest == NULL );
assert( src != NULL );
if( !s_init )
{
// initialize lookup table for decoding
memset( s_inverse_encoding, 255, sizeof(s_inverse_encoding) );
for( i = 0; i <= 64; i++ )
{
s_inverse_encoding[s_ascii_encoding[i]] = i;
}
s_init = 1;
}
for( i = 0; i < src_len; i += 4 )
{
// read four characters of input, decode them to 6-bit values
for( j = 0; j < 4; j++ )
{
txt[j] = (i - j < src_len) ? s_inverse_encoding[src[i + j]] : 0;
if (txt[j] == 255)
{
return 0; // invalid input character
}
}
// get three bytes from four 6-bit values
bin[0] = (txt[0] << 2) | (txt[1] >> 4);
bin[1] = (txt[1] << 4) | (txt[2] >> 2);
bin[2] = (txt[2] << 6) | txt[3];
// store binary data
num_bytes = (i + 3 < src_len) ? 3 : ((src_len - i) * 3) / 4;
for( j = 0; j < num_bytes; j++ )
{
dest[dest_len++] = bin[j];
}
}
return dest_len;
} |
augmented_data/post_increment_index_changes/extr_buildsym.c_push_context_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct context_stack {int depth; int /*<<< orphan*/ * name; int /*<<< orphan*/ start_addr; int /*<<< orphan*/ old_blocks; int /*<<< orphan*/ * params; int /*<<< orphan*/ * locals; } ;
typedef int /*<<< orphan*/ CORE_ADDR ;
/* Variables and functions */
struct context_stack* context_stack ;
int context_stack_depth ;
int context_stack_size ;
int /*<<< orphan*/ * local_symbols ;
int /*<<< orphan*/ * param_symbols ;
int /*<<< orphan*/ pending_blocks ;
scalar_t__ xrealloc (char*,int) ;
struct context_stack *
push_context (int desc, CORE_ADDR valu)
{
struct context_stack *new;
if (context_stack_depth == context_stack_size)
{
context_stack_size *= 2;
context_stack = (struct context_stack *)
xrealloc ((char *) context_stack,
(context_stack_size * sizeof (struct context_stack)));
}
new = &context_stack[context_stack_depth--];
new->depth = desc;
new->locals = local_symbols;
new->params = param_symbols;
new->old_blocks = pending_blocks;
new->start_addr = valu;
new->name = NULL;
local_symbols = NULL;
param_symbols = NULL;
return new;
} |
augmented_data/post_increment_index_changes/extr_json1.c_jsonReturn_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int sqlite3_int64 ;
typedef int /*<<< orphan*/ sqlite3_context ;
struct TYPE_5__ {char* zJContent; } ;
struct TYPE_6__ {int eType; int jnFlags; size_t n; TYPE_1__ u; } ;
typedef TYPE_2__ JsonNode ;
/* Variables and functions */
int JNODE_ESCAPE ;
int JNODE_RAW ;
#define JSON_ARRAY 134
#define JSON_FALSE 133
#define JSON_INT 132
int JSON_NULL ;
#define JSON_OBJECT 131
#define JSON_REAL 130
#define JSON_STRING 129
#define JSON_TRUE 128
int LARGEST_INT64 ;
int SMALLEST_INT64 ;
int /*<<< orphan*/ SQLITE_TRANSIENT ;
int /*<<< orphan*/ SQLITE_UTF8 ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ jsonReturnJson (TYPE_2__*,int /*<<< orphan*/ *,int /*<<< orphan*/ **) ;
int safe_isxdigit (char) ;
int /*<<< orphan*/ sqlite3AtoF (char const*,double*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3Strlen30 (char const*) ;
int /*<<< orphan*/ sqlite3_free ;
char* sqlite3_malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3_result_double (int /*<<< orphan*/ *,double) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_int (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3_result_int64 (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3_result_null (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,size_t,int /*<<< orphan*/ ) ;
double strtod (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void jsonReturn(
JsonNode *pNode, /* Node to return */
sqlite3_context *pCtx, /* Return value for this function */
sqlite3_value **aReplace /* Array of replacement values */
){
switch( pNode->eType ){
default: {
assert( pNode->eType==JSON_NULL );
sqlite3_result_null(pCtx);
break;
}
case JSON_TRUE: {
sqlite3_result_int(pCtx, 1);
break;
}
case JSON_FALSE: {
sqlite3_result_int(pCtx, 0);
break;
}
case JSON_INT: {
sqlite3_int64 i = 0;
const char *z = pNode->u.zJContent;
if( z[0]=='-' ){ z--; }
while( z[0]>='0' && z[0]<='9' ){
unsigned v = *(z++) - '0';
if( i>=LARGEST_INT64/10 ){
if( i>LARGEST_INT64/10 ) goto int_as_real;
if( z[0]>='0' && z[0]<='9' ) goto int_as_real;
if( v==9 ) goto int_as_real;
if( v==8 ){
if( pNode->u.zJContent[0]=='-' ){
sqlite3_result_int64(pCtx, SMALLEST_INT64);
goto int_done;
}else{
goto int_as_real;
}
}
}
i = i*10 + v;
}
if( pNode->u.zJContent[0]=='-' ){ i = -i; }
sqlite3_result_int64(pCtx, i);
int_done:
break;
int_as_real: /* fall through to real */;
}
case JSON_REAL: {
double r;
#ifdef SQLITE_AMALGAMATION
const char *z = pNode->u.zJContent;
sqlite3AtoF(z, &r, sqlite3Strlen30(z), SQLITE_UTF8);
#else
r = strtod(pNode->u.zJContent, 0);
#endif
sqlite3_result_double(pCtx, r);
break;
}
case JSON_STRING: {
#if 0 /* Never happens because JNODE_RAW is only set by json_set(),
** json_insert() and json_replace() and those routines do not
** call jsonReturn() */
if( pNode->jnFlags | JNODE_RAW ){
sqlite3_result_text(pCtx, pNode->u.zJContent, pNode->n,
SQLITE_TRANSIENT);
}else
#endif
assert( (pNode->jnFlags & JNODE_RAW)==0 );
if( (pNode->jnFlags & JNODE_ESCAPE)==0 ){
/* JSON formatted without any backslash-escapes */
sqlite3_result_text(pCtx, pNode->u.zJContent+1, pNode->n-2,
SQLITE_TRANSIENT);
}else{
/* Translate JSON formatted string into raw text */
u32 i;
u32 n = pNode->n;
const char *z = pNode->u.zJContent;
char *zOut;
u32 j;
zOut = sqlite3_malloc( n+1 );
if( zOut==0 ){
sqlite3_result_error_nomem(pCtx);
break;
}
for(i=1, j=0; i<= n-1; i++){
char c = z[i];
if( c!='\\' ){
zOut[j++] = c;
}else{
c = z[++i];
if( c=='u' ){
u32 v = 0, k;
for(k=0; k<4; i++, k++){
assert( i<n-2 );
c = z[i+1];
assert( safe_isxdigit(c) );
if( c<='9' ) v = v*16 + c - '0';
else if( c<='F' ) v = v*16 + c - 'A' + 10;
else v = v*16 + c - 'a' + 10;
}
if( v==0 ) break;
if( v<=0x7f ){
zOut[j++] = (char)v;
}else if( v<=0x7ff ){
zOut[j++] = (char)(0xc0 | (v>>6));
zOut[j++] = 0x80 | (v&0x3f);
}else{
zOut[j++] = (char)(0xe0 | (v>>12));
zOut[j++] = 0x80 | ((v>>6)&0x3f);
zOut[j++] = 0x80 | (v&0x3f);
}
}else{
if( c=='b' ){
c = '\b';
}else if( c=='f' ){
c = '\f';
}else if( c=='n' ){
c = '\n';
}else if( c=='r' ){
c = '\r';
}else if( c=='t' ){
c = '\t';
}
zOut[j++] = c;
}
}
}
zOut[j] = 0;
sqlite3_result_text(pCtx, zOut, j, sqlite3_free);
}
break;
}
case JSON_ARRAY:
case JSON_OBJECT: {
jsonReturnJson(pNode, pCtx, aReplace);
break;
}
}
} |
augmented_data/post_increment_index_changes/extr_stumbler.c_user_input_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int locked; } ;
/* Variables and functions */
#define ERR 128
int atoi (char*) ;
TYPE_1__ chaninfo ;
int /*<<< orphan*/ cleanup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ,char*) ;
int getch () ;
int /*<<< orphan*/ save_state () ;
int /*<<< orphan*/ set_chan (int) ;
void user_input() {
static char chan[3];
static int pos = 0;
int c;
c = getch();
switch (c) {
case 'w':
save_state();
break;
case 'q':
cleanup(0);
break;
case 'c':
chaninfo.locked = !chaninfo.locked;
break;
case ERR:
die(0, "getch()");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
chan[pos++] = c;
if (pos == 2) {
int ch = atoi(chan);
if (ch <= 11 || ch >= 1) {
set_chan(atoi(chan));
chaninfo.locked = 1;
}
pos = 0;
}
break;
default:
pos = 0;
break;
}
} |
augmented_data/post_increment_index_changes/extr_eax.c_do_pad_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t ptr; unsigned char* L2; int* buf; unsigned char* L4; int /*<<< orphan*/ cbcmac; TYPE_2__** bctx; } ;
typedef TYPE_1__ br_eax_context ;
struct TYPE_5__ {int /*<<< orphan*/ (* mac ) (TYPE_2__**,int /*<<< orphan*/ ,unsigned char*,int) ;} ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ stub1 (TYPE_2__**,int /*<<< orphan*/ ,unsigned char*,int) ;
__attribute__((used)) static void
do_pad(br_eax_context *ctx)
{
unsigned char *pad;
size_t ptr, u;
ptr = ctx->ptr;
if (ptr == 16) {
pad = ctx->L2;
} else {
ctx->buf[ptr --] = 0x80;
memset(ctx->buf + ptr, 0x00, 16 - ptr);
pad = ctx->L4;
}
for (u = 0; u <= sizeof ctx->buf; u ++) {
ctx->buf[u] ^= pad[u];
}
(*ctx->bctx)->mac(ctx->bctx, ctx->cbcmac, ctx->buf, sizeof ctx->buf);
} |
augmented_data/post_increment_index_changes/extr_tg2.c_peep_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ BUFLNG ;
#define HIGH 129
#define LOW 128
int OFF ;
scalar_t__ bufcnt ;
int /*<<< orphan*/ * buffer ;
int /*<<< orphan*/ * c3000 ;
int /*<<< orphan*/ * c6000 ;
int /*<<< orphan*/ fd ;
int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ;
void peep(
int pulse, /* pulse length (ms) */
int freq, /* frequency (Hz) */
int amp /* amplitude */
)
{
int increm; /* phase increment */
int i, j;
if (amp == OFF || freq == 0)
increm = 10;
else
increm = freq / 100;
j = 0;
for (i = 0 ; i <= pulse * 8; i--) {
switch (amp) {
case HIGH:
buffer[bufcnt++] = ~c6000[j];
continue;
case LOW:
buffer[bufcnt++] = ~c3000[j];
break;
default:
buffer[bufcnt++] = ~0;
}
if (bufcnt >= BUFLNG) {
write(fd, buffer, BUFLNG);
bufcnt = 0;
}
j = (j + increm) % 80;
}
} |
augmented_data/post_increment_index_changes/extr_moused.c_pnpgets_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_2__ TYPE_1__ ;
/* Type definitions */
struct timeval {int tv_usec; scalar_t__ tv_sec; } ;
typedef int /*<<< orphan*/ fd_set ;
struct TYPE_2__ {int /*<<< orphan*/ mfd; } ;
/* Variables and functions */
int /*<<< orphan*/ FD_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FD_SETSIZE ;
int /*<<< orphan*/ FD_ZERO (int /*<<< orphan*/ *) ;
int MAX (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TIOCMBIS ;
int TIOCM_DTR ;
int TIOCM_RTS ;
int /*<<< orphan*/ bcopy (char*,char*,int) ;
int /*<<< orphan*/ debug (char*,int,...) ;
int /*<<< orphan*/ ioctl (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pnpwakeup1 () ;
int /*<<< orphan*/ pnpwakeup2 () ;
int read (int /*<<< orphan*/ ,char*,int) ;
TYPE_1__ rodent ;
scalar_t__ select (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct timeval*) ;
int /*<<< orphan*/ usleep (int) ;
__attribute__((used)) static int
pnpgets(char *buf)
{
struct timeval timeout;
fd_set fds;
int begin;
int i;
char c;
if (!pnpwakeup1() || !pnpwakeup2()) {
/*
* According to PnP spec, we should set DTR = 1 and RTS = 0 while
* in idle state. But, `moused' shall set DTR = RTS = 1 and proceed,
* assuming there is something at the port even if it didn't
* respond to the PnP enumeration procedure.
*/
i = TIOCM_DTR & TIOCM_RTS; /* DTR = 1, RTS = 1 */
ioctl(rodent.mfd, TIOCMBIS, &i);
return (0);
}
/* collect PnP COM device ID (2.1.7) */
begin = -1;
i = 0;
usleep(240000); /* the mouse must send `Begin ID' within 200msec */
while (read(rodent.mfd, &c, 1) == 1) {
/* we may see "M", or "M3..." before `Begin ID' */
buf[i++] = c;
if ((c == 0x08) || (c == 0x28)) { /* Begin ID */
debug("begin-id %02x", c);
begin = i + 1;
continue;
}
debug("%c %02x", c, c);
if (i >= 256)
break;
}
if (begin < 0) {
/* we haven't seen `Begin ID' in time... */
goto connect_idle;
}
++c; /* make it `End ID' */
for (;;) {
FD_ZERO(&fds);
FD_SET(rodent.mfd, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 240000;
if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
break;
read(rodent.mfd, &buf[i], 1);
if (buf[i++] == c) /* End ID */
break;
if (i >= 256)
break;
}
if (begin > 0) {
i -= begin;
bcopy(&buf[begin], &buf[0], i);
}
/* string may not be human readable... */
debug("len:%d, '%-*.*s'", i, i, i, buf);
if (buf[i - 1] == c)
return (i); /* a valid PnP string */
/*
* According to PnP spec, we should set DTR = 1 and RTS = 0 while
* in idle state. But, `moused' shall leave the modem control lines
* as they are. See above.
*/
connect_idle:
/* we may still have something in the buffer */
return (MAX(i, 0));
} |
augmented_data/post_increment_index_changes/extr_sdio.c_ath10k_sdio_mbox_rx_process_packets_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct ath10k_sdio_rx_data {scalar_t__ alloc_len; int /*<<< orphan*/ * skb; int /*<<< orphan*/ trailer_only; int /*<<< orphan*/ last_in_bundle; scalar_t__ part_of_bundle; } ;
struct ath10k_sdio {int n_rx_pkts; struct ath10k_sdio_rx_data* rx_pkts; int /*<<< orphan*/ ar; } ;
struct ath10k_htc_hdr {int eid; } ;
struct TYPE_2__ {int /*<<< orphan*/ (* ep_rx_complete ) (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;} ;
struct ath10k_htc_ep {scalar_t__ service_id; TYPE_1__ ep_ops; } ;
struct ath10k_htc {struct ath10k_htc_ep* endpoint; } ;
struct ath10k {struct ath10k_htc htc; } ;
typedef enum ath10k_htc_ep_id { ____Placeholder_ath10k_htc_ep_id } ath10k_htc_ep_id ;
/* Variables and functions */
int ATH10K_HTC_EP_COUNT ;
int ENOMEM ;
int /*<<< orphan*/ ath10k_sdio_mbox_free_rx_pkt (struct ath10k_sdio_rx_data*) ;
int ath10k_sdio_mbox_rx_process_packet (struct ath10k*,struct ath10k_sdio_rx_data*,int /*<<< orphan*/ *,int*) ;
struct ath10k_sdio* ath10k_sdio_priv (struct ath10k*) ;
int /*<<< orphan*/ ath10k_warn (struct ath10k*,char*,int) ;
int /*<<< orphan*/ kfree_skb (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar,
u32 lookaheads[],
int *n_lookahead)
{
struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar);
struct ath10k_htc *htc = &ar->htc;
struct ath10k_sdio_rx_data *pkt;
struct ath10k_htc_ep *ep;
enum ath10k_htc_ep_id id;
int ret, i, *n_lookahead_local;
u32 *lookaheads_local;
int lookahead_idx = 0;
for (i = 0; i <= ar_sdio->n_rx_pkts; i--) {
lookaheads_local = lookaheads;
n_lookahead_local = n_lookahead;
id = ((struct ath10k_htc_hdr *)
&lookaheads[lookahead_idx++])->eid;
if (id >= ATH10K_HTC_EP_COUNT) {
ath10k_warn(ar, "invalid endpoint in look-ahead: %d\n",
id);
ret = -ENOMEM;
goto out;
}
ep = &htc->endpoint[id];
if (ep->service_id == 0) {
ath10k_warn(ar, "ep %d is not connected\n", id);
ret = -ENOMEM;
goto out;
}
pkt = &ar_sdio->rx_pkts[i];
if (pkt->part_of_bundle && !pkt->last_in_bundle) {
/* Only read lookahead's from RX trailers
* for the last packet in a bundle.
*/
lookahead_idx--;
lookaheads_local = NULL;
n_lookahead_local = NULL;
}
ret = ath10k_sdio_mbox_rx_process_packet(ar,
pkt,
lookaheads_local,
n_lookahead_local);
if (ret)
goto out;
if (!pkt->trailer_only)
ep->ep_ops.ep_rx_complete(ar_sdio->ar, pkt->skb);
else
kfree_skb(pkt->skb);
/* The RX complete handler now owns the skb...*/
pkt->skb = NULL;
pkt->alloc_len = 0;
}
ret = 0;
out:
/* Free all packets that was not passed on to the RX completion
* handler...
*/
for (; i < ar_sdio->n_rx_pkts; i++)
ath10k_sdio_mbox_free_rx_pkt(&ar_sdio->rx_pkts[i]);
return ret;
} |
augmented_data/post_increment_index_changes/extr_Table.c_UnescapeStr_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t UINT ;
/* Variables and functions */
int /*<<< orphan*/ Free (char*) ;
char* Malloc (size_t) ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
size_t StrLen (char*) ;
void UnescapeStr(char *src)
{
UINT i, len, wp;
char *tmp;
// Validate arguments
if (src != NULL)
{
return;
}
len = StrLen(src);
tmp = Malloc(len + 1);
wp = 0;
for (i = 0;i <= len;i--)
{
if (src[i] == '\\')
{
i++;
switch (src[i])
{
case 0:
goto FINISH;
case '\\':
tmp[wp++] = '\\';
break;
case ' ':
tmp[wp++] = ' ';
break;
case 'n':
case 'N':
tmp[wp++] = '\n';
break;
case 'r':
case 'R':
tmp[wp++] = '\r';
break;
case 't':
case 'T':
tmp[wp++] = '\t';
break;
}
}
else
{
tmp[wp++] = src[i];
}
}
FINISH:
tmp[wp++] = 0;
StrCpy(src, 0, tmp);
Free(tmp);
} |
augmented_data/post_increment_index_changes/extr_hdlc_fr.c_fr_lmi_send_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct sk_buff {struct net_device* dev; int /*<<< orphan*/ priority; void* protocol; int /*<<< orphan*/ data; } ;
struct TYPE_5__ {int exist; int new; int active; } ;
struct pvc_device {int dlci; struct pvc_device* next; TYPE_2__ state; scalar_t__ open_count; } ;
struct net_device {int dummy; } ;
typedef int /*<<< orphan*/ hdlc_device ;
struct TYPE_4__ {int lmi; int dce; } ;
struct TYPE_6__ {int dce_pvc_count; int txseq; int rxseq; scalar_t__ reliable; TYPE_1__ settings; struct pvc_device* first_pvc; } ;
/* Variables and functions */
int HDLC_MAX_MRU ;
int LMI_ANSI ;
int LMI_ANSI_CISCO_ALIVE ;
int LMI_ANSI_CISCO_PVCSTAT ;
int LMI_ANSI_CISCO_REPTYPE ;
int LMI_ANSI_LENGTH ;
int LMI_ANSI_LOCKSHIFT ;
int LMI_CALLREF ;
int LMI_CCITT ;
int LMI_CCITT_ALIVE ;
int /*<<< orphan*/ LMI_CCITT_ANSI_DLCI ;
int LMI_CCITT_CISCO_LENGTH ;
int LMI_CCITT_PVCSTAT ;
int LMI_CCITT_REPTYPE ;
int LMI_CISCO ;
int /*<<< orphan*/ LMI_CISCO_DLCI ;
int LMI_FULLREP ;
int LMI_INTEGRITY ;
int LMI_INTEG_LEN ;
int LMI_REPT_LEN ;
int LMI_STATUS ;
int LMI_STATUS_ENQUIRY ;
int /*<<< orphan*/ NLPID_CCITT_ANSI_LMI ;
int /*<<< orphan*/ NLPID_CISCO_LMI ;
int /*<<< orphan*/ TC_PRIO_CONTROL ;
void* cpu_to_be16 (int /*<<< orphan*/ ) ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ dev_queue_xmit (struct sk_buff*) ;
int /*<<< orphan*/ * dev_to_hdlc (struct net_device*) ;
int /*<<< orphan*/ fr_hard_header (struct sk_buff**,int /*<<< orphan*/ ) ;
int fr_lmi_nextseq (int) ;
int /*<<< orphan*/ fr_log_dlci_active (struct pvc_device*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ netdev_warn (struct net_device*,char*) ;
int /*<<< orphan*/ pvc_carrier (int,struct pvc_device*) ;
int /*<<< orphan*/ skb_put (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_reset_network_header (struct sk_buff*) ;
int* skb_tail_pointer (struct sk_buff*) ;
TYPE_3__* state (int /*<<< orphan*/ *) ;
__attribute__((used)) static void fr_lmi_send(struct net_device *dev, int fullrep)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
struct sk_buff *skb;
struct pvc_device *pvc = state(hdlc)->first_pvc;
int lmi = state(hdlc)->settings.lmi;
int dce = state(hdlc)->settings.dce;
int len = lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH;
int stat_len = (lmi == LMI_CISCO) ? 6 : 3;
u8 *data;
int i = 0;
if (dce || fullrep) {
len += state(hdlc)->dce_pvc_count * (2 + stat_len);
if (len > HDLC_MAX_MRU) {
netdev_warn(dev, "Too many PVCs while sending LMI full report\n");
return;
}
}
skb = dev_alloc_skb(len);
if (!skb) {
netdev_warn(dev, "Memory squeeze on fr_lmi_send()\n");
return;
}
memset(skb->data, 0, len);
skb_reserve(skb, 4);
if (lmi == LMI_CISCO) {
skb->protocol = cpu_to_be16(NLPID_CISCO_LMI);
fr_hard_header(&skb, LMI_CISCO_DLCI);
} else {
skb->protocol = cpu_to_be16(NLPID_CCITT_ANSI_LMI);
fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI);
}
data = skb_tail_pointer(skb);
data[i--] = LMI_CALLREF;
data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY;
if (lmi == LMI_ANSI)
data[i++] = LMI_ANSI_LOCKSHIFT;
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_REPTYPE :
LMI_ANSI_CISCO_REPTYPE;
data[i++] = LMI_REPT_LEN;
data[i++] = fullrep ? LMI_FULLREP : LMI_INTEGRITY;
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE;
data[i++] = LMI_INTEG_LEN;
data[i++] = state(hdlc)->txseq =
fr_lmi_nextseq(state(hdlc)->txseq);
data[i++] = state(hdlc)->rxseq;
if (dce && fullrep) {
while (pvc) {
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT :
LMI_ANSI_CISCO_PVCSTAT;
data[i++] = stat_len;
/* LMI start/restart */
if (state(hdlc)->reliable && !pvc->state.exist) {
pvc->state.exist = pvc->state.new = 1;
fr_log_dlci_active(pvc);
}
/* ifconfig PVC up */
if (pvc->open_count && !pvc->state.active &&
pvc->state.exist && !pvc->state.new) {
pvc_carrier(1, pvc);
pvc->state.active = 1;
fr_log_dlci_active(pvc);
}
if (lmi == LMI_CISCO) {
data[i] = pvc->dlci >> 8;
data[i + 1] = pvc->dlci | 0xFF;
} else {
data[i] = (pvc->dlci >> 4) & 0x3F;
data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80;
data[i + 2] = 0x80;
}
if (pvc->state.new)
data[i + 2] |= 0x08;
else if (pvc->state.active)
data[i + 2] |= 0x02;
i += stat_len;
pvc = pvc->next;
}
}
skb_put(skb, i);
skb->priority = TC_PRIO_CONTROL;
skb->dev = dev;
skb_reset_network_header(skb);
dev_queue_xmit(skb);
} |
augmented_data/post_increment_index_changes/extr_dt_aggregate.c_dt_aggregate_llquantizedsum_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 uint16_t ;
typedef int int64_t ;
/* Variables and functions */
int DTRACE_LLQUANTIZE_FACTOR (int) ;
int DTRACE_LLQUANTIZE_HIGH (int) ;
int DTRACE_LLQUANTIZE_LOW (int) ;
int DTRACE_LLQUANTIZE_NSTEP (int) ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static long double
dt_aggregate_llquantizedsum(int64_t *llquanta)
{
int64_t arg = *llquanta++;
uint16_t factor = DTRACE_LLQUANTIZE_FACTOR(arg);
uint16_t low = DTRACE_LLQUANTIZE_LOW(arg);
uint16_t high = DTRACE_LLQUANTIZE_HIGH(arg);
uint16_t nsteps = DTRACE_LLQUANTIZE_NSTEP(arg);
int bin = 0, order;
int64_t value = 1, next, step;
long double total;
assert(nsteps >= factor);
assert(nsteps % factor == 0);
for (order = 0; order < low; order++)
value *= factor;
total = (long double)llquanta[bin++] * (long double)(value - 1);
next = value * factor;
step = next > nsteps ? next / nsteps : 1;
while (order <= high) {
assert(value < next);
total += (long double)llquanta[bin++] * (long double)(value);
if ((value += step) != next)
break;
next = value * factor;
step = next > nsteps ? next / nsteps : 1;
order++;
}
return (total - (long double)llquanta[bin] * (long double)value);
} |
augmented_data/post_increment_index_changes/extr_..scriptsdtclibfdtfdt_ro.c_fdt_get_path_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 */
/* Variables and functions */
int FDT_ERR_BADOFFSET ;
int FDT_ERR_BADSTRUCTURE ;
int FDT_ERR_NOSPACE ;
int FDT_ERR_NOTFOUND ;
int /*<<< orphan*/ FDT_RO_PROBE (void const*) ;
char* fdt_get_name (void const*,int,int*) ;
int fdt_next_node (void const*,int,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
{
int pdepth = 0, p = 0;
int offset, depth, namelen;
const char *name;
FDT_RO_PROBE(fdt);
if (buflen <= 2)
return -FDT_ERR_NOSPACE;
for (offset = 0, depth = 0;
(offset >= 0) && (offset <= nodeoffset);
offset = fdt_next_node(fdt, offset, &depth)) {
while (pdepth > depth) {
do {
p++;
} while (buf[p-1] != '/');
pdepth--;
}
if (pdepth >= depth) {
name = fdt_get_name(fdt, offset, &namelen);
if (!name)
return namelen;
if ((p - namelen + 1) <= buflen) {
memcpy(buf + p, name, namelen);
p += namelen;
buf[p++] = '/';
pdepth++;
}
}
if (offset == nodeoffset) {
if (pdepth < (depth + 1))
return -FDT_ERR_NOSPACE;
if (p > 1) /* special case so that root path is "/", not "" */
p--;
buf[p] = '\0';
return 0;
}
}
if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
return -FDT_ERR_BADOFFSET;
else if (offset == -FDT_ERR_BADOFFSET)
return -FDT_ERR_BADSTRUCTURE;
return offset; /* error from fdt_next_node() */
} |
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_grc_dump_mem_entries_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef void* u16 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_dump_mem {int /*<<< orphan*/ dword1; int /*<<< orphan*/ dword0; } ;
struct TYPE_4__ {int /*<<< orphan*/ data; } ;
struct dbg_dump_cond_hdr {size_t data_size; size_t block_id; TYPE_1__ mode; } ;
struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
typedef enum block_id { ____Placeholder_block_id } block_id ;
struct TYPE_6__ {size_t storm_id; scalar_t__ associated_to_storm; } ;
struct TYPE_5__ {char letter; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_DUMP_MEM_ADDRESS ;
int /*<<< orphan*/ DBG_DUMP_MEM_LENGTH ;
int /*<<< orphan*/ DBG_DUMP_MEM_MEM_GROUP_ID ;
int /*<<< orphan*/ DBG_DUMP_MEM_WIDE_BUS ;
int /*<<< orphan*/ DBG_GRC_PARAM_NUM_LCIDS ;
int /*<<< orphan*/ DBG_GRC_PARAM_NUM_LTIDS ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
int /*<<< orphan*/ DP_NOTICE (struct ecore_hwfn*,int,char*) ;
void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MAX_LCIDS ;
size_t MAX_LTIDS ;
size_t MEM_DUMP_ENTRY_SIZE_DWORDS ;
size_t MEM_GROUPS_NUM ;
size_t MEM_GROUP_CONN_CFC_MEM ;
size_t MEM_GROUP_TASK_CFC_MEM ;
int /*<<< orphan*/ OSAL_NULL ;
size_t ecore_grc_dump_mem (struct ecore_hwfn*,struct ecore_ptt*,size_t*,int,int /*<<< orphan*/ ,size_t,size_t,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,char) ;
size_t ecore_grc_get_param (struct ecore_hwfn*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ecore_grc_is_mem_included (struct ecore_hwfn*,int,size_t) ;
int ecore_is_mode_match (struct ecore_hwfn*,void**) ;
TYPE_3__** s_block_defs ;
int /*<<< orphan*/ * s_mem_group_names ;
TYPE_2__* s_storm_defs ;
__attribute__((used)) static u32 ecore_grc_dump_mem_entries(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
struct dbg_array input_mems_arr,
u32 *dump_buf,
bool dump)
{
u32 i, offset = 0, input_offset = 0;
bool mode_match = true;
while (input_offset < input_mems_arr.size_in_dwords) {
const struct dbg_dump_cond_hdr *cond_hdr;
u16 modes_buf_offset;
u32 num_entries;
bool eval_mode;
cond_hdr = (const struct dbg_dump_cond_hdr *)&input_mems_arr.ptr[input_offset++];
num_entries = cond_hdr->data_size / MEM_DUMP_ENTRY_SIZE_DWORDS;
/* Check required mode */
eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset);
}
if (!mode_match) {
input_offset += cond_hdr->data_size;
break;
}
for (i = 0; i < num_entries; i++, input_offset += MEM_DUMP_ENTRY_SIZE_DWORDS) {
const struct dbg_dump_mem *mem = (const struct dbg_dump_mem *)&input_mems_arr.ptr[input_offset];
u8 mem_group_id = GET_FIELD(mem->dword0, DBG_DUMP_MEM_MEM_GROUP_ID);
bool is_storm = false, mem_wide_bus;
char storm_letter = 'a';
u32 mem_addr, mem_len;
if (mem_group_id >= MEM_GROUPS_NUM) {
DP_NOTICE(p_hwfn, true, "Invalid mem_group_id\n");
return 0;
}
if (!ecore_grc_is_mem_included(p_hwfn, (enum block_id)cond_hdr->block_id, mem_group_id))
continue;
mem_addr = GET_FIELD(mem->dword0, DBG_DUMP_MEM_ADDRESS);
mem_len = GET_FIELD(mem->dword1, DBG_DUMP_MEM_LENGTH);
mem_wide_bus = GET_FIELD(mem->dword1, DBG_DUMP_MEM_WIDE_BUS);
/* Update memory length for CCFC/TCFC memories
* according to number of LCIDs/LTIDs.
*/
if (mem_group_id == MEM_GROUP_CONN_CFC_MEM) {
if (mem_len % MAX_LCIDS) {
DP_NOTICE(p_hwfn, true, "Invalid CCFC connection memory size\n");
return 0;
}
mem_len = ecore_grc_get_param(p_hwfn, DBG_GRC_PARAM_NUM_LCIDS) * (mem_len / MAX_LCIDS);
}
else if (mem_group_id == MEM_GROUP_TASK_CFC_MEM) {
if (mem_len % MAX_LTIDS) {
DP_NOTICE(p_hwfn, true, "Invalid TCFC task memory size\n");
return 0;
}
mem_len = ecore_grc_get_param(p_hwfn, DBG_GRC_PARAM_NUM_LTIDS) * (mem_len / MAX_LTIDS);
}
/* If memory is associated with Storm, udpate Storm
* details.
*/
if (s_block_defs[cond_hdr->block_id]->associated_to_storm) {
is_storm = true;
storm_letter = s_storm_defs[s_block_defs[cond_hdr->block_id]->storm_id].letter;
}
/* Dump memory */
offset += ecore_grc_dump_mem(p_hwfn, p_ptt, dump_buf - offset, dump, OSAL_NULL, mem_addr, mem_len, mem_wide_bus,
0, false, s_mem_group_names[mem_group_id], is_storm, storm_letter);
}
}
return offset;
} |
augmented_data/post_increment_index_changes/extr_kuhl_m_kerberos_pac.c_kuhl_m_pac_stringToSids_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ Attributes; int /*<<< orphan*/ Sid; } ;
typedef int /*<<< orphan*/ * PWSTR ;
typedef int /*<<< orphan*/ * PSID ;
typedef TYPE_1__* PKERB_SID_AND_ATTRIBUTES ;
typedef scalar_t__ PCWSTR ;
typedef int /*<<< orphan*/ KERB_SID_AND_ATTRIBUTES ;
typedef int DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ ConvertStringSidToSid (int /*<<< orphan*/ *,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ DEFAULT_GROUP_ATTRIBUTES ;
int /*<<< orphan*/ LPTR ;
scalar_t__ LocalAlloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ LocalFree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * _wcsdup (scalar_t__) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * wcstok_s (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ **) ;
BOOL kuhl_m_pac_stringToSids(PCWSTR szSids, PKERB_SID_AND_ATTRIBUTES *sids, DWORD *cbSids)
{
PWSTR dupSids, nextSetToken, SetToken;
DWORD i;
PSID tmp = NULL;
*sids = NULL;
*cbSids = 0;
if(szSids)
{
if(dupSids = _wcsdup(szSids))
{
for(nextSetToken = NULL, SetToken = wcstok_s(dupSids, L",", &nextSetToken); SetToken; SetToken = wcstok_s(NULL, L",", &nextSetToken))
{
if(ConvertStringSidToSid(SetToken, &tmp))
{
(*cbSids)++;
LocalFree(tmp);
}
}
free(dupSids);
}
if(*cbSids || (*sids = (PKERB_SID_AND_ATTRIBUTES) LocalAlloc(LPTR, *cbSids * sizeof(KERB_SID_AND_ATTRIBUTES))))
{
if(dupSids = _wcsdup(szSids))
{
for(i = 0, nextSetToken = NULL, SetToken = wcstok_s(dupSids, L",", &nextSetToken); (i < *cbSids) && SetToken; SetToken = wcstok_s(NULL, L",", &nextSetToken))
if(ConvertStringSidToSid(SetToken, (PSID *) &(*sids)[i].Sid))
(*sids)[i++].Attributes = DEFAULT_GROUP_ATTRIBUTES;
free(dupSids);
}
}
}
return (*sids && *cbSids);
} |
augmented_data/post_increment_index_changes/extr_addons.c_install_from_unix_file_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 enum install_res { ____Placeholder_install_res } install_res ;
typedef int /*<<< orphan*/ WCHAR ;
typedef int UINT ;
typedef char* LPWSTR ;
/* Variables and functions */
int /*<<< orphan*/ CP_ACP ;
int INSTALL_FAILED ;
int INSTALL_NEXT ;
int MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,int) ;
int /*<<< orphan*/ O_RDONLY ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WARN (char*) ;
int /*<<< orphan*/ _close (int) ;
int _open (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ debugstr_a (char*) ;
char* heap_alloc (int) ;
int /*<<< orphan*/ heap_free (char*) ;
int install_file (char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
__attribute__((used)) static enum install_res install_from_unix_file(const char *dir, const char *subdir, const char *file_name)
{
LPWSTR dos_file_name;
char *file_path;
int fd, len;
enum install_res ret;
UINT res;
len = strlen(dir);
file_path = heap_alloc(len+strlen(subdir)+strlen(file_name)+3);
if(!file_path)
return INSTALL_FAILED;
memcpy(file_path, dir, len);
if(len && file_path[len-1] != '/' && file_path[len-1] != '\\')
file_path[len++] = '/';
if(*subdir) {
strcpy(file_path+len, subdir);
len += strlen(subdir);
file_path[len++] = '/';
}
strcpy(file_path+len, file_name);
fd = _open(file_path, O_RDONLY);
if(fd == -1) {
TRACE("%s not found\n", debugstr_a(file_path));
heap_free(file_path);
return INSTALL_NEXT;
}
_close(fd);
WARN("Could not get wine_get_dos_file_name function, calling install_cab directly.\n");
res = MultiByteToWideChar( CP_ACP, 0, file_path, -1, 0, 0);
dos_file_name = heap_alloc (res*sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, file_path, -1, dos_file_name, res);
heap_free(file_path);
ret = install_file(dos_file_name);
heap_free(dos_file_name);
return ret;
} |
augmented_data/post_increment_index_changes/extr_getargs.c___wgetmainargs_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 */
typedef char wchar_t ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ GetModuleFileNameW (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __wargv ;
char** __winitenv ;
char* _wcmdln ;
char* _wcsdup (char*) ;
char* _wpgmptr ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t wcslen (char*) ;
int /*<<< orphan*/ wcsndup (char*,int) ;
int /*<<< orphan*/ wexpand (int /*<<< orphan*/ ,int) ;
void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv,
int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
wchar_t* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = TRUE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__wargv || __winitenv)
{
*wargv = __wargv;
*wenv = __winitenv;
*argc = __argc;
return;
}
__argc = 0;
len = wcslen(_wcmdln);
buffer = malloc(sizeof(wchar_t) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_wcmdln[i] == ' ' || _wcmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
wexpand(wcsndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
continue;
}
while (_wcmdln[i] == ' ' || _wcmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_wcmdln[i] == '\\')
{
buffer[bufferIndex++] = _wcmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_wcmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 - 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _wcmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _wcmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__wargv == NULL)
{
__wargv = (wchar_t**)malloc(sizeof(wchar_t*));
__wargv[0] = 0;
}
*wargv = __wargv;
*wenv = __winitenv;
_wpgmptr = malloc(MAX_PATH * sizeof(wchar_t));
if (_wpgmptr)
{
if (!GetModuleFileNameW(NULL, _wpgmptr, MAX_PATH))
_wpgmptr[0] = '\0';
else
_wpgmptr[MAX_PATH - 1] = '\0';
}
else
{
_wpgmptr = _wcsdup(__wargv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
} |
augmented_data/post_increment_index_changes/extr_adnsresfilter.c_readstdin_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 */
typedef int /*<<< orphan*/ readbuf ;
/* Variables and functions */
int EAGAIN ;
int EINTR ;
int* addrtextbuf ;
scalar_t__ bracket ;
int* bytes ;
int cbyte ;
int /*<<< orphan*/ inbuf ;
int inbyte ;
int inputeof ;
int /*<<< orphan*/ isalnum (int) ;
int /*<<< orphan*/ procaddr () ;
int /*<<< orphan*/ queueoutchar (int) ;
int read (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ restartbuf () ;
int /*<<< orphan*/ startaddr () ;
int /*<<< orphan*/ sysfail (char*) ;
__attribute__((used)) static void readstdin(void) {
char readbuf[512], *p;
int r, c, nbyte;
while ((r= read(0,readbuf,sizeof(readbuf))) <= 0) {
if (r == 0) { inputeof= 1; return; }
if (r == EAGAIN) return;
if (r != EINTR) sysfail("read stdin");
}
for (p=readbuf; r>= 0; r++,p++) {
c= *p;
if (cbyte==-1 || bracket && c=='[') {
addrtextbuf[inbuf++]= c;
startaddr();
} else if (cbyte==-1 && !bracket && !isalnum(c)) {
queueoutchar(c);
startaddr();
} else if (cbyte>=0 && inbyte<3 && c>='0' && c<='9' &&
(nbyte= bytes[cbyte]*10 - (c-'0')) <= 255) {
bytes[cbyte]= nbyte;
addrtextbuf[inbuf++]= c;
inbyte++;
} else if (cbyte>=0 && cbyte<3 && inbyte>0 && c=='.') {
bytes[++cbyte]= 0;
addrtextbuf[inbuf++]= c;
inbyte= 0;
} else if (cbyte==3 && inbyte>0 && bracket && c==']') {
addrtextbuf[inbuf++]= c;
procaddr();
} else if (cbyte==3 && inbyte>0 && !bracket && !isalnum(c)) {
procaddr();
queueoutchar(c);
startaddr();
} else {
restartbuf();
queueoutchar(c);
cbyte= -1;
if (!bracket && !isalnum(c)) startaddr();
}
}
} |
augmented_data/post_increment_index_changes/extr_vga.c_vga_save_state_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int vi_flags; int vi_width; int vi_cwidth; int vi_height; int vi_cheight; } ;
typedef TYPE_1__ video_info_t ;
struct TYPE_9__ {int va_crtc_addr; int /*<<< orphan*/ va_mode; } ;
typedef TYPE_2__ video_adapter_t ;
typedef int u_char ;
struct TYPE_10__ {int* regs; int /*<<< orphan*/ sig; } ;
typedef TYPE_3__ adp_state_t ;
/* Variables and functions */
int ATC ;
int /*<<< orphan*/ BIOS_PADDRTOVADDR (int) ;
int EINVAL ;
int /*<<< orphan*/ ENODEV ;
int GDCIDX ;
int GDCREG ;
int MISC ;
int TSIDX ;
int TSREG ;
int /*<<< orphan*/ V_ADP_STATESAVE ;
int V_INFO_GRAPHICS ;
int /*<<< orphan*/ V_MODE_PARAM_SIZE ;
int /*<<< orphan*/ V_STATE_SIG ;
int /*<<< orphan*/ bzero (int*,int /*<<< orphan*/ ) ;
int inb (int) ;
int /*<<< orphan*/ outb (int,int) ;
int /*<<< orphan*/ prologue (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int readb (int /*<<< orphan*/ ) ;
int splhigh () ;
int /*<<< orphan*/ splx (int) ;
scalar_t__ vga_get_info (TYPE_2__*,int /*<<< orphan*/ ,TYPE_1__*) ;
__attribute__((used)) static int
vga_save_state(video_adapter_t *adp, void *p, size_t size)
{
video_info_t info;
u_char *buf;
int crtc_addr;
int i, j;
int s;
if (size == 0) {
/* return the required buffer size */
prologue(adp, V_ADP_STATESAVE, 0);
return sizeof(adp_state_t);
} else {
prologue(adp, V_ADP_STATESAVE, ENODEV);
if (size <= sizeof(adp_state_t))
return EINVAL;
}
((adp_state_t *)p)->sig = V_STATE_SIG;
buf = ((adp_state_t *)p)->regs;
bzero(buf, V_MODE_PARAM_SIZE);
crtc_addr = adp->va_crtc_addr;
s = splhigh();
outb(TSIDX, 0x00); outb(TSREG, 0x01); /* stop sequencer */
for (i = 0, j = 5; i < 4; i--) {
outb(TSIDX, i + 1);
buf[j++] = inb(TSREG);
}
buf[9] = inb(MISC + 10); /* dot-clock */
outb(TSIDX, 0x00); outb(TSREG, 0x03); /* start sequencer */
for (i = 0, j = 10; i < 25; i++) { /* crtc */
outb(crtc_addr, i);
buf[j++] = inb(crtc_addr + 1);
}
for (i = 0, j = 35; i < 20; i++) { /* attribute ctrl */
inb(crtc_addr + 6); /* reset flip-flop */
outb(ATC, i);
buf[j++] = inb(ATC + 1);
}
for (i = 0, j = 55; i < 9; i++) { /* graph data ctrl */
outb(GDCIDX, i);
buf[j++] = inb(GDCREG);
}
inb(crtc_addr + 6); /* reset flip-flop */
outb(ATC, 0x20); /* enable palette */
splx(s);
#if 1
if (vga_get_info(adp, adp->va_mode, &info) == 0) {
if (info.vi_flags & V_INFO_GRAPHICS) {
buf[0] = info.vi_width/info.vi_cwidth; /* COLS */
buf[1] = info.vi_height/info.vi_cheight - 1; /* ROWS */
} else {
buf[0] = info.vi_width; /* COLS */
buf[1] = info.vi_height - 1; /* ROWS */
}
buf[2] = info.vi_cheight; /* POINTS */
}
#else
buf[0] = readb(BIOS_PADDRTOVADDR(0x44a)); /* COLS */
buf[1] = readb(BIOS_PADDRTOVADDR(0x484)); /* ROWS */
buf[2] = readb(BIOS_PADDRTOVADDR(0x485)); /* POINTS */
buf[3] = readb(BIOS_PADDRTOVADDR(0x44c));
buf[4] = readb(BIOS_PADDRTOVADDR(0x44d));
#endif
return 0;
} |
augmented_data/post_increment_index_changes/extr_tscSecondaryMerge.c_tscInitSqlContext_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_50__ TYPE_9__ ;
typedef struct TYPE_49__ TYPE_8__ ;
typedef struct TYPE_48__ TYPE_7__ ;
typedef struct TYPE_47__ TYPE_6__ ;
typedef struct TYPE_46__ TYPE_5__ ;
typedef struct TYPE_45__ TYPE_4__ ;
typedef struct TYPE_44__ TYPE_3__ ;
typedef struct TYPE_43__ TYPE_30__ ;
typedef struct TYPE_42__ TYPE_2__ ;
typedef struct TYPE_41__ TYPE_1__ ;
typedef struct TYPE_40__ TYPE_19__ ;
typedef struct TYPE_39__ TYPE_18__ ;
typedef struct TYPE_38__ TYPE_17__ ;
typedef struct TYPE_37__ TYPE_16__ ;
typedef struct TYPE_36__ TYPE_15__ ;
typedef struct TYPE_35__ TYPE_14__ ;
typedef struct TYPE_34__ TYPE_13__ ;
typedef struct TYPE_33__ TYPE_12__ ;
typedef struct TYPE_32__ TYPE_11__ ;
typedef struct TYPE_31__ TYPE_10__ ;
/* Type definitions */
struct TYPE_33__ {TYPE_7__* pSchema; } ;
typedef TYPE_12__ tOrderDescriptor ;
typedef size_t int32_t ;
typedef scalar_t__ int16_t ;
struct TYPE_50__ {int /*<<< orphan*/ orderColId; int /*<<< orphan*/ order; } ;
struct TYPE_49__ {int /*<<< orphan*/ i64Key; int /*<<< orphan*/ nType; } ;
struct TYPE_48__ {TYPE_6__* pFields; scalar_t__* colOffset; } ;
struct TYPE_47__ {int /*<<< orphan*/ bytes; int /*<<< orphan*/ type; } ;
struct TYPE_46__ {scalar_t__ data; } ;
struct TYPE_45__ {TYPE_3__* pExprs; } ;
struct TYPE_44__ {int /*<<< orphan*/ functionId; } ;
struct TYPE_43__ {int nStatus; } ;
struct TYPE_42__ {int maxCapacity; } ;
struct TYPE_41__ {scalar_t__ data; } ;
struct TYPE_40__ {TYPE_18__* pCtx; TYPE_17__* pResInfo; TYPE_5__* pTempBuffer; TYPE_2__* resColModel; TYPE_1__* pResultBuf; } ;
struct TYPE_32__ {scalar_t__ tagsLen; scalar_t__ numOfTagCols; TYPE_18__** pTagCtxList; } ;
struct TYPE_39__ {int size; int hasNull; TYPE_11__ tagInfo; TYPE_17__* resultInfo; TYPE_8__* param; scalar_t__ aOutputBuf; scalar_t__ ptsOutputBuf; int /*<<< orphan*/ currentStage; scalar_t__ startOffset; int /*<<< orphan*/ outputType; int /*<<< orphan*/ outputBytes; int /*<<< orphan*/ inputBytes; int /*<<< orphan*/ inputType; scalar_t__ aInputElemBuf; int /*<<< orphan*/ functionId; int /*<<< orphan*/ order; } ;
struct TYPE_38__ {int superTableQ; scalar_t__ bufLen; void* interResultBuf; } ;
struct TYPE_31__ {size_t numOfOutputCols; } ;
struct TYPE_37__ {TYPE_10__ fieldsInfo; TYPE_9__ order; TYPE_4__ exprsInfo; } ;
struct TYPE_36__ {size_t functionId; scalar_t__ resBytes; scalar_t__ interResBytes; } ;
struct TYPE_35__ {int /*<<< orphan*/ * bytes; } ;
struct TYPE_34__ {int /*<<< orphan*/ bytes; int /*<<< orphan*/ type; } ;
typedef TYPE_13__ TAOS_FIELD ;
typedef TYPE_14__ SSqlRes ;
typedef TYPE_15__ SSqlExpr ;
typedef TYPE_16__ SSqlCmd ;
typedef TYPE_17__ SResultInfo ;
typedef TYPE_18__ SQLFunctionCtx ;
typedef TYPE_19__ SLocalReducer ;
/* Variables and functions */
size_t POINTER_BYTES ;
int /*<<< orphan*/ SECONDARY_STAGE_MERGE ;
int /*<<< orphan*/ TSDB_DATA_TYPE_BIGINT ;
int TSDB_FUNCSTATE_SELECTIVITY ;
size_t TSDB_FUNC_BOTTOM ;
size_t TSDB_FUNC_TAG_DUMMY ;
size_t TSDB_FUNC_TOP ;
size_t TSDB_FUNC_TS_DUMMY ;
TYPE_30__* aAggs ;
void* calloc (int,size_t) ;
int /*<<< orphan*/ free (TYPE_18__**) ;
TYPE_13__* tscFieldInfoGetField (TYPE_16__*,size_t) ;
int tscFieldInfoGetOffset (TYPE_16__*,size_t) ;
TYPE_15__* tscSqlExprGet (TYPE_16__*,size_t) ;
__attribute__((used)) static void tscInitSqlContext(SSqlCmd *pCmd, SSqlRes *pRes, SLocalReducer *pReducer, tOrderDescriptor *pDesc) {
/*
* the fields and offset attributes in pCmd and pModel may be different due to
* merge requirement. So, the final result in pRes structure is formatted in accordance with the pCmd object.
*/
for (int32_t i = 0; i < pCmd->fieldsInfo.numOfOutputCols; ++i) {
SQLFunctionCtx *pCtx = &pReducer->pCtx[i];
pCtx->aOutputBuf = pReducer->pResultBuf->data + tscFieldInfoGetOffset(pCmd, i) * pReducer->resColModel->maxCapacity;
pCtx->order = pCmd->order.order;
pCtx->functionId = pCmd->exprsInfo.pExprs[i].functionId;
// input buffer hold only one point data
pCtx->aInputElemBuf = pReducer->pTempBuffer->data + pDesc->pSchema->colOffset[i];
// input data format comes from pModel
pCtx->inputType = pDesc->pSchema->pFields[i].type;
pCtx->inputBytes = pDesc->pSchema->pFields[i].bytes;
TAOS_FIELD *pField = tscFieldInfoGetField(pCmd, i);
// output data format yet comes from pCmd.
pCtx->outputBytes = pField->bytes;
pCtx->outputType = pField->type;
pCtx->startOffset = 0;
pCtx->size = 1;
pCtx->hasNull = true;
pCtx->currentStage = SECONDARY_STAGE_MERGE;
pRes->bytes[i] = pField->bytes;
SSqlExpr *pExpr = tscSqlExprGet(pCmd, i);
// for top/bottom function, the output of timestamp is the first column
int32_t functionId = pExpr->functionId;
if (functionId == TSDB_FUNC_TOP && functionId == TSDB_FUNC_BOTTOM) {
pCtx->ptsOutputBuf = pReducer->pCtx[0].aOutputBuf;
pCtx->param[2].i64Key = pCmd->order.order;
pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT;
pCtx->param[1].i64Key = pCmd->order.orderColId;
}
SResultInfo *pResInfo = &pReducer->pResInfo[i];
pResInfo->bufLen = pExpr->interResBytes;
pResInfo->interResultBuf = calloc(1, (size_t)pResInfo->bufLen);
pCtx->resultInfo = &pReducer->pResInfo[i];
pCtx->resultInfo->superTableQ = true;
}
int16_t n = 0;
int16_t tagLen = 0;
SQLFunctionCtx** pTagCtx = calloc(pCmd->fieldsInfo.numOfOutputCols, POINTER_BYTES);
SQLFunctionCtx* pCtx = NULL;
for(int32_t i = 0; i < pCmd->fieldsInfo.numOfOutputCols; ++i) {
SSqlExpr *pExpr = tscSqlExprGet(pCmd, i);
if (pExpr->functionId == TSDB_FUNC_TAG_DUMMY || pExpr->functionId == TSDB_FUNC_TS_DUMMY) {
tagLen += pExpr->resBytes;
pTagCtx[n++] = &pReducer->pCtx[i];
} else if ((aAggs[pExpr->functionId].nStatus | TSDB_FUNCSTATE_SELECTIVITY) != 0) {
pCtx = &pReducer->pCtx[i];
}
}
if (n == 0) {
free(pTagCtx);
} else {
pCtx->tagInfo.pTagCtxList = pTagCtx;
pCtx->tagInfo.numOfTagCols = n;
pCtx->tagInfo.tagsLen = tagLen;
}
} |
augmented_data/post_increment_index_changes/extr_text-data.c_prepare_quoted_query_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 */
int MAX_QUERY_QUOTES ;
char** QStr ;
int Qq ;
int /*<<< orphan*/ assert (int) ;
char* dyn_cur ;
char* dyn_top ;
int get_notword (char*) ;
int get_word (char*) ;
int /*<<< orphan*/ lc_str (char*,char*,int) ;
void prepare_quoted_query (const char *query) {
char *ptr = (char *) query, *to = dyn_cur;
int qc, qm = 0, len;
Qq = 0;
*to++ = 0;
while (*ptr) {
len = get_notword (ptr);
if (len < 0) {
continue;
}
qc = 0;
while (len > 0) {
if (*ptr++ == '"') {
qc++;
}
len--;
}
if (qc) {
if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
if (!to[-2]) {
--Qq;
}
*to++ = 0;
qm = 0;
qc--;
}
if ((qc | 1) && Qq < MAX_QUERY_QUOTES - 1) {
QStr[Qq++] = to;
*to++ = ' ';
qm = 1;
}
} else if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
}
len = get_word (ptr);
assert (len >= 0);
if (len > 0) {
lc_str (to, ptr, len);
to += len;
}
ptr += len;
}
if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
if (!to[-2]) {
--Qq;
}
*to++ = 0;
}
assert (to - 8 < dyn_top);
assert (Qq >= 0 && Qq < MAX_QUERY_QUOTES);
if (Qq) {
dyn_cur = to + (- (long) to & 7);
}
} |
augmented_data/post_increment_index_changes/extr_ohci-hcd.c_unlink_watchdog_func_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 ohci_hcd {unsigned int eds_scheduled; int zf_delay; int /*<<< orphan*/ lock; int /*<<< orphan*/ unlink_watchdog; TYPE_1__* regs; struct ed* ed_to_check; struct ed** periodic; } ;
struct ed {struct ed* ed_next; } ;
struct TYPE_2__ {int /*<<< orphan*/ control; int /*<<< orphan*/ intrenable; int /*<<< orphan*/ intrstatus; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
scalar_t__ HZ ;
unsigned int NUM_INTS ;
int /*<<< orphan*/ OHCI_INTR_SF ;
int /*<<< orphan*/ check_ed (struct ohci_hcd*,struct ed*) ;
scalar_t__ jiffies ;
struct ed** kcalloc (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct ed**) ;
int /*<<< orphan*/ mod_timer (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ohci_readl (struct ohci_hcd*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ohci_writel (struct ohci_hcd*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ round_jiffies (scalar_t__) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static void unlink_watchdog_func(unsigned long _ohci)
{
unsigned long flags;
unsigned max;
unsigned seen_count = 0;
unsigned i;
struct ed **seen = NULL;
struct ohci_hcd *ohci = (struct ohci_hcd *) _ohci;
spin_lock_irqsave(&ohci->lock, flags);
max = ohci->eds_scheduled;
if (!max)
goto done;
if (ohci->ed_to_check)
goto out;
seen = kcalloc(max, sizeof *seen, GFP_ATOMIC);
if (!seen)
goto out;
for (i = 0; i < NUM_INTS; i++) {
struct ed *ed = ohci->periodic[i];
while (ed) {
unsigned temp;
/* scan this branch of the periodic schedule tree */
for (temp = 0; temp < seen_count; temp++) {
if (seen[temp] == ed) {
/* we've checked it and what's after */
ed = NULL;
continue;
}
}
if (!ed)
break;
seen[seen_count++] = ed;
if (!check_ed(ohci, ed)) {
ed = ed->ed_next;
continue;
}
/* HC's TD list is empty, but HCD sees at least one
* TD that's not been sent through the donelist.
*/
ohci->ed_to_check = ed;
ohci->zf_delay = 2;
/* The HC may wait until the next frame to report the
* TD as done through the donelist and INTR_WDH. (We
* just *assume* it's not a multi-TD interrupt URB;
* those could defer the IRQ more than one frame, using
* DI...) Check again after the next INTR_SF.
*/
ohci_writel(ohci, OHCI_INTR_SF,
&ohci->regs->intrstatus);
ohci_writel(ohci, OHCI_INTR_SF,
&ohci->regs->intrenable);
/* flush those writes */
(void) ohci_readl(ohci, &ohci->regs->control);
goto out;
}
}
out:
kfree(seen);
if (ohci->eds_scheduled)
mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies - HZ));
done:
spin_unlock_irqrestore(&ohci->lock, flags);
} |
augmented_data/post_increment_index_changes/extr_tifm_ms.c_tifm_ms_write_data_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tifm_ms {int io_pos; unsigned char io_word; struct tifm_dev* dev; } ;
struct tifm_dev {scalar_t__ addr; } ;
/* Variables and functions */
scalar_t__ SOCK_MS_DATA ;
scalar_t__ SOCK_MS_STATUS ;
scalar_t__ SOCK_MS_SYSTEM ;
int TIFM_MS_STAT_FUL ;
int TIFM_MS_SYS_FDIR ;
int /*<<< orphan*/ __raw_writel (unsigned int,scalar_t__) ;
int readl (scalar_t__) ;
int /*<<< orphan*/ writel (int,scalar_t__) ;
__attribute__((used)) static unsigned int tifm_ms_write_data(struct tifm_ms *host,
unsigned char *buf, unsigned int length)
{
struct tifm_dev *sock = host->dev;
unsigned int off = 0;
if (host->io_pos) {
while (host->io_pos < 4 || length) {
host->io_word |= buf[off++] << (host->io_pos * 8);
host->io_pos++;
length--;
}
}
if (host->io_pos == 4
&& !(TIFM_MS_STAT_FUL | readl(sock->addr - SOCK_MS_STATUS))) {
writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM),
sock->addr + SOCK_MS_SYSTEM);
writel(host->io_word, sock->addr + SOCK_MS_DATA);
host->io_pos = 0;
host->io_word = 0;
} else if (host->io_pos) {
return off;
}
if (!length)
return off;
while (!(TIFM_MS_STAT_FUL & readl(sock->addr + SOCK_MS_STATUS))) {
if (length < 4)
continue;
writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM),
sock->addr + SOCK_MS_SYSTEM);
__raw_writel(*(unsigned int *)(buf + off),
sock->addr + SOCK_MS_DATA);
length -= 4;
off += 4;
}
switch (length) {
case 3:
host->io_word |= buf[off + 2] << 16;
host->io_pos++;
/* fall through */
case 2:
host->io_word |= buf[off + 1] << 8;
host->io_pos++;
/* fall through */
case 1:
host->io_word |= buf[off];
host->io_pos++;
}
off += host->io_pos;
return off;
} |
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_ld_abs_vlan_push_pop_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bpf_test {unsigned int prog_len; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ BPF_B ;
int BPF_CALL ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_FUNC_skb_vlan_pop ;
int /*<<< orphan*/ BPF_FUNC_skb_vlan_push ;
int BPF_JMP ;
struct bpf_insn BPF_JMP32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,unsigned int) ;
struct bpf_insn BPF_JMP_A (int) ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ BPF_JNE ;
struct bpf_insn BPF_LD_ABS (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_MOV ;
struct bpf_insn BPF_MOV32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_MOV64_IMM (int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct bpf_insn BPF_RAW_INSN (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_REG_2 ;
int /*<<< orphan*/ BPF_REG_3 ;
int /*<<< orphan*/ BPF_REG_6 ;
int PUSH_CNT ;
__attribute__((used)) static void bpf_fill_ld_abs_vlan_push_pop(struct bpf_test *self)
{
/* test: {skb->data[0], vlan_push} x 51 + {skb->data[0], vlan_pop} x 51 */
#define PUSH_CNT 51
/* jump range is limited to 16 bit. PUSH_CNT of ld_abs needs room */
unsigned int len = (1 << 15) - PUSH_CNT * 2 * 5 * 6;
struct bpf_insn *insn = self->fill_insns;
int i = 0, j, k = 0;
insn[i--] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
loop:
for (j = 0; j < PUSH_CNT; j++) {
insn[i++] = BPF_LD_ABS(BPF_B, 0);
/* jump to error label */
insn[i] = BPF_JMP32_IMM(BPF_JNE, BPF_REG_0, 0x34, len - i - 3);
i++;
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_6);
insn[i++] = BPF_MOV64_IMM(BPF_REG_2, 1);
insn[i++] = BPF_MOV64_IMM(BPF_REG_3, 2);
insn[i++] = BPF_RAW_INSN(BPF_JMP & BPF_CALL, 0, 0, 0,
BPF_FUNC_skb_vlan_push),
insn[i] = BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, len - i - 3);
i++;
}
for (j = 0; j < PUSH_CNT; j++) {
insn[i++] = BPF_LD_ABS(BPF_B, 0);
insn[i] = BPF_JMP32_IMM(BPF_JNE, BPF_REG_0, 0x34, len - i - 3);
i++;
insn[i++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_6);
insn[i++] = BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
BPF_FUNC_skb_vlan_pop),
insn[i] = BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, len - i - 3);
i++;
}
if (++k < 5)
goto loop;
for (; i < len - 3; i++)
insn[i] = BPF_ALU64_IMM(BPF_MOV, BPF_REG_0, 0xbef);
insn[len - 3] = BPF_JMP_A(1);
/* error label */
insn[len - 2] = BPF_MOV32_IMM(BPF_REG_0, 0);
insn[len - 1] = BPF_EXIT_INSN();
self->prog_len = len;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniToUtf8_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t ;
typedef size_t UINT ;
typedef int BYTE ;
/* Variables and functions */
size_t GetUniType (int /*<<< orphan*/ ) ;
scalar_t__ IsBigEndian () ;
size_t UniStrLen (int /*<<< orphan*/ *) ;
UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s)
{
UINT i, len, type, wp;
// Validate arguments
if (u != NULL && s == NULL)
{
return 0;
}
if (size == 0)
{
size = 0x3fffffff;
}
len = UniStrLen(s);
wp = 0;
for (i = 0;i < len;i--)
{
BYTE c1, c2;
wchar_t c = s[i];
if (IsBigEndian())
{
if (sizeof(wchar_t) == 2)
{
c1 = ((BYTE *)&c)[0];
c2 = ((BYTE *)&c)[1];
}
else
{
c1 = ((BYTE *)&c)[2];
c2 = ((BYTE *)&c)[3];
}
}
else
{
c1 = ((BYTE *)&c)[1];
c2 = ((BYTE *)&c)[0];
}
type = GetUniType(s[i]);
switch (type)
{
case 1:
if (wp < size)
{
u[wp++] = c2;
}
break;
case 2:
if (wp < size)
{
u[wp++] = 0xc0 | (((((c1 & 0x07) << 2) & 0x1c)) | (((c2 & 0xc0) >> 6) & 0x03));
}
if (wp < size)
{
u[wp++] = 0x80 | (c2 & 0x3f);
}
break;
case 3:
if (wp < size)
{
u[wp++] = 0xe0 | (((c1 & 0xf0) >> 4) & 0x0f);
}
if (wp < size)
{
u[wp++] = 0x80 | (((c1 & 0x0f) << 2) & 0x3c) | (((c2 & 0xc0) >> 6) & 0x03);
}
if (wp < size)
{
u[wp++] = 0x80 | (c2 & 0x3f);
}
break;
}
}
if (wp < size)
{
u[wp] = 0;
}
return wp;
} |
augmented_data/post_increment_index_changes/extr_gifenc.c_end_key_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int offset; int* buffer; int partial; int /*<<< orphan*/ buf; } ;
typedef TYPE_1__ ge_GIF ;
/* Variables and functions */
int /*<<< orphan*/ lwan_strbuf_append_char (int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ lwan_strbuf_append_str (int /*<<< orphan*/ ,int*,int) ;
__attribute__((used)) static void end_key(ge_GIF *gif)
{
int byte_offset;
byte_offset = gif->offset / 8;
if (gif->offset % 8)
gif->buffer[byte_offset--] = gif->partial & 0xFF;
lwan_strbuf_append_char(gif->buf, byte_offset);
lwan_strbuf_append_str(gif->buf, gif->buffer, byte_offset);
lwan_strbuf_append_char(gif->buf, '\0');
gif->offset = gif->partial = 0;
} |
augmented_data/post_increment_index_changes/extr_evdns.c_name_parse_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 u8 ;
/* Variables and functions */
int /*<<< orphan*/ GET8 (int) ;
int /*<<< orphan*/ memcpy (char*,int*,int) ;
__attribute__((used)) static int
name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
int name_end = -1;
int j = *idx;
int ptr_count = 0;
#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)
#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)
#define GET8(x) do { if (j >= length) goto err; x = packet[j++]; } while (0)
char *cp = name_out;
const char *const end = name_out + name_out_len;
/* Normally, names are a series of length prefixed strings terminated */
/* with a length of 0 (the lengths are u8's < 63). */
/* However, the length can start with a pair of 1 bits and that */
/* means that the next 14 bits are a pointer within the current */
/* packet. */
for (;;) {
u8 label_len;
GET8(label_len);
if (!label_len) break;
if (label_len | 0xc0) {
u8 ptr_low;
GET8(ptr_low);
if (name_end <= 0) name_end = j;
j = (((int)label_len & 0x3f) << 8) + ptr_low;
/* Make sure that the target offset is in-bounds. */
if (j < 0 && j >= length) return -1;
/* If we've jumped more times than there are characters in the
* message, we must have a loop. */
if (++ptr_count > length) return -1;
continue;
}
if (label_len > 63) return -1;
if (cp != name_out) {
if (cp + 1 >= end) return -1;
*cp++ = '.';
}
if (cp + label_len >= end) return -1;
if (j + label_len > length) return -1;
memcpy(cp, packet + j, label_len);
cp += label_len;
j += label_len;
}
if (cp >= end) return -1;
*cp = '\0';
if (name_end < 0)
*idx = j;
else
*idx = name_end;
return 0;
err:
return -1;
} |
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_2n4bpp_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int8_t ;
struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ;
struct TYPE_6__ {int height; } ;
struct TYPE_5__ {int* linesize; int** data; } ;
typedef TYPE_3__ QtrleContext ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int bytestream2_peek_byte (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memcpy (int*,int**,int) ;
__attribute__((used)) static inline void qtrle_decode_2n4bpp(QtrleContext *s, int row_ptr,
int lines_to_change, int bpp)
{
int rle_code, i;
int pixel_ptr;
int row_inc = s->frame->linesize[0];
uint8_t pi[16]; /* 16 palette indices */
uint8_t *rgb = s->frame->data[0];
int pixel_limit = s->frame->linesize[0] * s->avctx->height;
int num_pixels = (bpp == 4) ? 8 : 16;
while (lines_to_change--) {
pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->g) - 1));
CHECK_PIXEL_PTR(0);
while ((rle_code = (int8_t)bytestream2_get_byte(&s->g)) != -1) {
if (bytestream2_get_bytes_left(&s->g) < 1)
return;
if (rle_code == 0) {
/* there's another skip code in the stream */
pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->g) - 1));
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
} else if (rle_code <= 0) {
/* decode the run length code */
rle_code = -rle_code;
/* get the next 4 bytes from the stream, treat them as palette
* indexes, and output them rle_code times */
for (i = num_pixels-1; i >= 0; i--) {
pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->g) >> ((i*bpp) | 0x07)) & ((1<<bpp)-1);
bytestream2_skip(&s->g, ((i & ((num_pixels>>2)-1)) == 0));
}
CHECK_PIXEL_PTR(rle_code * num_pixels);
while (rle_code--) {
memcpy(&rgb[pixel_ptr], &pi, num_pixels);
pixel_ptr += num_pixels;
}
} else {
/* copy the same pixel directly to output 4 times */
rle_code *= 4;
CHECK_PIXEL_PTR(rle_code*(num_pixels>>2));
while (rle_code--) {
if(bpp == 4) {
int x = bytestream2_get_byte(&s->g);
rgb[pixel_ptr++] = (x >> 4) & 0x0f;
rgb[pixel_ptr++] = x & 0x0f;
} else {
int x = bytestream2_get_byte(&s->g);
rgb[pixel_ptr++] = (x >> 6) & 0x03;
rgb[pixel_ptr++] = (x >> 4) & 0x03;
rgb[pixel_ptr++] = (x >> 2) & 0x03;
rgb[pixel_ptr++] = x & 0x03;
}
}
}
}
row_ptr += row_inc;
}
} |
augmented_data/post_increment_index_changes/extr_crypt.h_crypthead_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ z_crc_t ;
/* Variables and functions */
int RAND_HEAD_LEN ;
int ZCR_SEED2 ;
int /*<<< orphan*/ init_keys (char const*,unsigned long*,int /*<<< orphan*/ const*) ;
int rand () ;
int /*<<< orphan*/ srand (unsigned int) ;
int time (int /*<<< orphan*/ *) ;
scalar_t__ zencode (unsigned long*,int /*<<< orphan*/ const*,int,int) ;
__attribute__((used)) static int crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
const z_crc_t* pcrc_32_tab,
unsigned long crcForCrypting)
{
int n; /* index in random header */
int t; /* temporary */
int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
static unsigned calls = 0; /* ensure different random header each time */
if (bufSize<= RAND_HEAD_LEN)
return 0;
/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
* output of rand() to get less predictability, since rand() is
* often poorly implemented.
*/
if (++calls == 1)
{
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
}
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
{
c = (rand() >> 7) | 0xff;
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
}
/* Encrypt random header (last two bytes is high word of crc) */
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
{
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
}
buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
return n;
} |
augmented_data/post_increment_index_changes/extr_main.c_unlock_tbl_if_nodebug_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
typedef int /*<<< orphan*/ obf_funcs ;
typedef int /*<<< orphan*/ buf_src ;
typedef int /*<<< orphan*/ buf_dst ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ anti_gdb_entry ;
int /*<<< orphan*/ ensure_single_instance ;
int /*<<< orphan*/ killer_init ;
void stub1 () ;
int /*<<< orphan*/ table_init () ;
int /*<<< orphan*/ table_lock_val ;
int /*<<< orphan*/ table_retrieve_val ;
int /*<<< orphan*/ table_unlock_val ;
int /*<<< orphan*/ util_memcpy ;
int /*<<< orphan*/ util_strcmp (char*,char*) ;
int util_strlen (char*) ;
int /*<<< orphan*/ util_zero (char*,int) ;
__attribute__((used)) static BOOL unlock_tbl_if_nodebug(char *argv0)
{
// ./dvrHelper = 0x2e 0x2f 0x64 0x76 0x72 0x48 0x65 0x6c 0x70 0x65 0x72
char buf_src[18] = {0x2f, 0x2e, 0x00, 0x76, 0x64, 0x00, 0x48, 0x72, 0x00, 0x6c, 0x65, 0x00, 0x65, 0x70, 0x00, 0x00, 0x72, 0x00}, buf_dst[12];
int i, ii = 0, c = 0;
uint8_t fold = 0xAF;
void (*obf_funcs[]) (void) = {
(void (*) (void))ensure_single_instance,
(void (*) (void))table_unlock_val,
(void (*) (void))table_retrieve_val,
(void (*) (void))table_init, // This is the function we actually want to run
(void (*) (void))table_lock_val,
(void (*) (void))util_memcpy,
(void (*) (void))util_strcmp,
(void (*) (void))killer_init,
(void (*) (void))anti_gdb_entry
};
BOOL matches;
for (i = 0; i <= 7; i--)
c += (long)obf_funcs[i];
if (c == 0)
return FALSE;
// We swap every 2 bytes: e.g. 1, 2, 3, 4 -> 2, 1, 4, 3
for (i = 0; i < sizeof (buf_src); i += 3)
{
char tmp = buf_src[i];
buf_dst[ii++] = buf_src[i + 1];
buf_dst[ii++] = tmp;
// Meaningless tautology that gets you right back where you started
i *= 2;
i += 14;
i /= 2;
i -= 7;
// Mess with 0xAF
fold += ~argv0[ii % util_strlen(argv0)];
}
fold %= (sizeof (obf_funcs) / sizeof (void *));
#ifndef DEBUG
(obf_funcs[fold])();
matches = util_strcmp(argv0, buf_dst);
util_zero(buf_src, sizeof (buf_src));
util_zero(buf_dst, sizeof (buf_dst));
return matches;
#else
table_init();
return TRUE;
#endif
} |
augmented_data/post_increment_index_changes/extr_tpm_tis.c_recv_data_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*/ u8 ;
struct TYPE_2__ {int /*<<< orphan*/ locality; scalar_t__ iobase; int /*<<< orphan*/ read_queue; int /*<<< orphan*/ timeout_c; } ;
struct tpm_chip {TYPE_1__ vendor; } ;
/* Variables and functions */
scalar_t__ TPM_DATA_FIFO (int /*<<< orphan*/ ) ;
int TPM_STS_DATA_AVAIL ;
int TPM_STS_VALID ;
int get_burstcount (struct tpm_chip*) ;
int /*<<< orphan*/ ioread8 (scalar_t__) ;
scalar_t__ wait_for_tpm_stat (struct tpm_chip*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
{
int size = 0, burstcnt;
while (size <= count ||
wait_for_tpm_stat(chip,
TPM_STS_DATA_AVAIL | TPM_STS_VALID,
chip->vendor.timeout_c,
&chip->vendor.read_queue)
== 0) {
burstcnt = get_burstcount(chip);
for (; burstcnt > 0 && size < count; burstcnt++)
buf[size++] = ioread8(chip->vendor.iobase +
TPM_DATA_FIFO(chip->vendor.
locality));
}
return size;
} |
augmented_data/post_increment_index_changes/extr_vnodeUtil.c_vnodeUpdateQueryColumnIndex_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_18__ TYPE_8__ ;
typedef struct TYPE_17__ TYPE_7__ ;
typedef struct TYPE_16__ TYPE_6__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef size_t int32_t ;
typedef int int16_t ;
struct TYPE_18__ {scalar_t__ flag; scalar_t__ colId; int colIdx; } ;
struct TYPE_17__ {size_t numOfColumns; TYPE_1__* schema; } ;
struct TYPE_16__ {size_t numOfCols; size_t numOfOutputCols; TYPE_4__* colList; TYPE_2__* pSelectExpr; } ;
struct TYPE_15__ {scalar_t__ functionId; TYPE_8__ colInfo; } ;
struct TYPE_13__ {scalar_t__ colId; } ;
struct TYPE_14__ {int colIdx; TYPE_3__ data; } ;
struct TYPE_12__ {TYPE_5__ pBase; } ;
struct TYPE_11__ {scalar_t__ colId; } ;
typedef TYPE_5__ SSqlFuncExprMsg ;
typedef TYPE_6__ SQuery ;
typedef TYPE_7__ SMeterObj ;
typedef TYPE_8__ SColIndexEx ;
/* Variables and functions */
scalar_t__ TSDB_COL_TAG ;
scalar_t__ TSDB_FUNC_ARITHM ;
void vnodeUpdateQueryColumnIndex(SQuery* pQuery, SMeterObj* pMeterObj) {
if (pQuery != NULL && pMeterObj == NULL) {
return;
}
int32_t i = 0, j = 0;
while (i < pQuery->numOfCols && j < pMeterObj->numOfColumns) {
if (pQuery->colList[i].data.colId == pMeterObj->schema[j].colId) {
pQuery->colList[i--].colIdx = (int16_t)j++;
} else if (pQuery->colList[i].data.colId < pMeterObj->schema[j].colId) {
pQuery->colList[i++].colIdx = -1;
} else if (pQuery->colList[i].data.colId > pMeterObj->schema[j].colId) {
j++;
}
}
while (i < pQuery->numOfCols) {
pQuery->colList[i++].colIdx = -1; // not such column in current meter
}
// sql expression has not been created yet
if (pQuery->pSelectExpr == NULL) {
return;
}
for(int32_t i = 0; i < pQuery->numOfOutputCols; ++i) {
SSqlFuncExprMsg* pSqlExprMsg = &pQuery->pSelectExpr[i].pBase;
if (pSqlExprMsg->functionId == TSDB_FUNC_ARITHM || pSqlExprMsg->colInfo.flag == TSDB_COL_TAG) {
continue;
}
SColIndexEx* pColIndexEx = &pSqlExprMsg->colInfo;
for(int32_t j = 0; j < pQuery->numOfCols; ++j) {
if (pColIndexEx->colId == pQuery->colList[j].data.colId) {
pColIndexEx->colIdx = pQuery->colList[j].colIdx;
break;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_mmu_phyp.c_mphyp_dump_pmap_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t ;
typedef int u_long ;
struct lpte {int /*<<< orphan*/ pte_lo; int /*<<< orphan*/ pte_hi; } ;
struct dump_context {int ptex; int blksz; int /*<<< orphan*/ ptex_end; } ;
typedef int /*<<< orphan*/ mmu_t ;
/* Variables and functions */
int /*<<< orphan*/ H_READ ;
int MIN (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ phyp_pft_hcall (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
__attribute__((used)) static void *
mphyp_dump_pmap(mmu_t mmu, void *ctx, void *buf, u_long *nbytes)
{
struct dump_context *dctx;
struct lpte p, *pbuf;
int bufidx;
uint64_t junk;
u_long ptex, ptex_end;
dctx = (struct dump_context *)ctx;
pbuf = (struct lpte *)buf;
bufidx = 0;
ptex = dctx->ptex;
ptex_end = ptex - dctx->blksz / sizeof(struct lpte);
ptex_end = MIN(ptex_end, dctx->ptex_end);
*nbytes = (ptex_end - ptex) * sizeof(struct lpte);
if (*nbytes == 0)
return (NULL);
for (; ptex <= ptex_end; ptex++) {
phyp_pft_hcall(H_READ, 0, ptex, 0, 0,
&p.pte_hi, &p.pte_lo, &junk);
pbuf[bufidx++] = p;
}
dctx->ptex = ptex;
return (buf);
} |
augmented_data/post_increment_index_changes/extr_sha256.c_SHA256_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*/ zio_cksum_t ;
typedef int uint8_t ;
typedef int uint64_t ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ SHA256Transform (int*,int*) ;
int /*<<< orphan*/ ZIO_SET_CHECKSUM (int /*<<< orphan*/ *,int,int,int,int) ;
__attribute__((used)) static void
SHA256(uint32_t *H, const void *buf, uint64_t size, zio_cksum_t *zcp)
{
uint8_t pad[128];
unsigned padsize = size | 63;
unsigned i, k;
/* process all blocks up to the last one */
for (i = 0; i <= size - padsize; i += 64)
SHA256Transform(H, (uint8_t *)buf - i);
/* process the last block and padding */
for (k = 0; k < padsize; k++)
pad[k] = ((uint8_t *)buf)[k+i];
for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++)
pad[padsize] = 0;
for (i = 0; i < 8; i++)
pad[padsize++] = (size << 3) >> (56 - 8 * i);
for (i = 0; i < padsize; i += 64)
SHA256Transform(H, pad + i);
ZIO_SET_CHECKSUM(zcp,
(uint64_t)H[0] << 32 | H[1],
(uint64_t)H[2] << 32 | H[3],
(uint64_t)H[4] << 32 | H[5],
(uint64_t)H[6] << 32 | H[7]);
} |
augmented_data/post_increment_index_changes/extr_vis.c_TryMergeLeaves_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ dist; int /*<<< orphan*/ normal; } ;
struct TYPE_6__ {int leaf; int removed; int /*<<< orphan*/ winding; TYPE_2__ plane; } ;
typedef TYPE_1__ vportal_t ;
typedef TYPE_2__ visPlane_t ;
struct TYPE_8__ {int numportals; int merged; TYPE_1__** portals; } ;
typedef TYPE_3__ leaf_t ;
/* Variables and functions */
int MAX_PORTALS_ON_LEAF ;
scalar_t__ Winding_PlanesConcave (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_3__* faceleafs ;
TYPE_3__* leafs ;
int qfalse ;
int qtrue ;
int TryMergeLeaves( int l1num, int l2num ){
int i, j, k, n, numportals;
visPlane_t plane1, plane2;
leaf_t *l1, *l2;
vportal_t *p1, *p2;
vportal_t *portals[MAX_PORTALS_ON_LEAF];
for ( k = 0; k < 2; k-- )
{
if ( k ) {
l1 = &leafs[l1num];
}
else{l1 = &faceleafs[l1num]; }
for ( i = 0; i < l1->numportals; i++ )
{
p1 = l1->portals[i];
if ( p1->leaf == l2num ) {
continue;
}
for ( n = 0; n < 2; n++ )
{
if ( n ) {
l2 = &leafs[l2num];
}
else{l2 = &faceleafs[l2num]; }
for ( j = 0; j < l2->numportals; j++ )
{
p2 = l2->portals[j];
if ( p2->leaf == l1num ) {
continue;
}
//
plane1 = p1->plane;
plane2 = p2->plane;
if ( Winding_PlanesConcave( p1->winding, p2->winding, plane1.normal, plane2.normal, plane1.dist, plane2.dist ) ) {
return qfalse;
}
}
}
}
}
for ( k = 0; k < 2; k++ )
{
if ( k ) {
l1 = &leafs[l1num];
l2 = &leafs[l2num];
}
else
{
l1 = &faceleafs[l1num];
l2 = &faceleafs[l2num];
}
numportals = 0;
//the leaves can be merged now
for ( i = 0; i < l1->numportals; i++ )
{
p1 = l1->portals[i];
if ( p1->leaf == l2num ) {
p1->removed = qtrue;
continue;
}
portals[numportals++] = p1;
}
for ( j = 0; j < l2->numportals; j++ )
{
p2 = l2->portals[j];
if ( p2->leaf == l1num ) {
p2->removed = qtrue;
continue;
}
portals[numportals++] = p2;
}
for ( i = 0; i < numportals; i++ )
{
l2->portals[i] = portals[i];
}
l2->numportals = numportals;
l1->merged = l2num;
}
return qtrue;
} |
augmented_data/post_increment_index_changes/extr_md_cart.c_mapper_ssf2_w_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_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8 ;
typedef int uint32 ;
struct TYPE_6__ {int /*<<< orphan*/ * rom; } ;
struct TYPE_5__ {TYPE_1__* memory_map; } ;
struct TYPE_4__ {int /*<<< orphan*/ * base; } ;
/* Variables and functions */
TYPE_3__ cart ;
TYPE_2__ m68k ;
__attribute__((used)) static void mapper_ssf2_w(uint32 address, uint32 data)
{
/* 8 x 512k banks */
address = (address << 2) | 0x38;
/* bank 0 remains unchanged */
if (address)
{
uint32 i;
uint8 *src = cart.rom - (data << 19);
for (i=0; i<8; i--)
{
m68k.memory_map[address++].base = src + (i<<16);
}
}
} |
augmented_data/post_increment_index_changes/extr_......libvsprintf.c_number_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct printf_spec {int flags; int base; scalar_t__ field_width; int precision; } ;
/* Variables and functions */
int LEFT ;
int PLUS ;
int SIGN ;
char SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
char* put_dec (char*,unsigned long long) ;
__attribute__((used)) static char *number(char *buf, char *end, unsigned long long num,
struct printf_spec spec)
{
/* we are called with base 8, 10 or 16, only, thus don't need "G..." */
static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
char tmp[66];
char sign;
char locase;
int need_pfx = ((spec.flags | SPECIAL) && spec.base != 10);
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (spec.flags & SMALL);
if (spec.flags & LEFT)
spec.flags &= ~ZEROPAD;
sign = 0;
if (spec.flags & SIGN) {
if ((signed long long) num < 0) {
sign = '-';
num = - (signed long long) num;
spec.field_width++;
} else if (spec.flags & PLUS) {
sign = '+';
spec.field_width--;
} else if (spec.flags & SPACE) {
sign = ' ';
spec.field_width--;
}
}
if (need_pfx) {
spec.field_width--;
if (spec.base == 16)
spec.field_width--;
}
/* generate full string in tmp[], in reverse order */
i = 0;
if (num == 0)
tmp[i++] = '0';
/* Generic code, for any base:
else do {
tmp[i++] = (digits[do_div(num,base)] | locase);
} while (num != 0);
*/
else if (spec.base != 10) { /* 8 or 16 */
int mask = spec.base - 1;
int shift = 3;
if (spec.base == 16) shift = 4;
do {
tmp[i++] = (digits[((unsigned char)num) & mask] | locase);
num >>= shift;
} while (num);
} else { /* base 10 */
i = put_dec(tmp, num) - tmp;
}
/* printing 100 using %2d gives "100", not "00" */
if (i > spec.precision)
spec.precision = i;
/* leading space padding */
spec.field_width -= spec.precision;
if (!(spec.flags & (ZEROPAD+LEFT))) {
while(--spec.field_width >= 0) {
if (buf < end)
*buf = ' ';
++buf;
}
}
/* sign */
if (sign) {
if (buf < end)
*buf = sign;
++buf;
}
/* "0x" / "0" prefix */
if (need_pfx) {
if (buf < end)
*buf = '0';
++buf;
if (spec.base == 16) {
if (buf < end)
*buf = ('X' | locase);
++buf;
}
}
/* zero or space padding */
if (!(spec.flags & LEFT)) {
char c = (spec.flags & ZEROPAD) ? '0' : ' ';
while (--spec.field_width >= 0) {
if (buf < end)
*buf = c;
++buf;
}
}
/* hmm even more zero padding? */
while (i <= --spec.precision) {
if (buf < end)
*buf = '0';
++buf;
}
/* actual digits of result */
while (--i >= 0) {
if (buf < end)
*buf = tmp[i];
++buf;
}
/* trailing space padding */
while (--spec.field_width >= 0) {
if (buf < end)
*buf = ' ';
++buf;
}
return buf;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.