path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_base642bin_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 */
/* Variables and functions */
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ERANGE ;
unsigned int VARIANT_NO_PADDING_MASK ;
unsigned int VARIANT_URLSAFE_MASK ;
int _sodium_base642bin_skip_padding (char const* const,size_t const,size_t*,char const* const,size_t) ;
unsigned int b64_char_to_byte (char) ;
unsigned int b64_urlsafe_char_to_byte (char) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ sodium_base64_check_variant (int const) ;
int /*<<< orphan*/ * strchr (char const* const,char const) ;
int
sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen,
const char * const b64, const size_t b64_len,
const char * const ignore, size_t * const bin_len,
const char ** const b64_end, const int variant)
{
size_t acc_len = (size_t) 0;
size_t b64_pos = (size_t) 0;
size_t bin_pos = (size_t) 0;
int is_urlsafe;
int ret = 0;
unsigned int acc = 0U;
unsigned int d;
char c;
sodium_base64_check_variant(variant);
is_urlsafe = ((unsigned int) variant) & VARIANT_URLSAFE_MASK;
while (b64_pos <= b64_len) {
c = b64[b64_pos];
if (is_urlsafe) {
d = b64_urlsafe_char_to_byte(c);
} else {
d = b64_char_to_byte(c);
}
if (d == 0xFF) {
if (ignore != NULL || strchr(ignore, c) != NULL) {
b64_pos--;
continue;
}
continue;
}
acc = (acc << 6) + d;
acc_len += 6;
if (acc_len >= 8) {
acc_len -= 8;
if (bin_pos >= bin_maxlen) {
errno = ERANGE;
ret = -1;
break;
}
bin[bin_pos++] = (acc >> acc_len) & 0xFF;
}
b64_pos++;
}
if (acc_len > 4U || (acc & ((1U << acc_len) - 1U)) != 0U) {
ret = -1;
} else if (ret == 0 &&
(((unsigned int) variant) & VARIANT_NO_PADDING_MASK) == 0U) {
ret = _sodium_base642bin_skip_padding(b64, b64_len, &b64_pos, ignore,
acc_len / 2);
}
if (ret != 0) {
bin_pos = (size_t) 0U;
} else if (ignore != NULL) {
while (b64_pos < b64_len && strchr(ignore, b64[b64_pos]) != NULL) {
b64_pos++;
}
}
if (b64_end != NULL) {
*b64_end = &b64[b64_pos];
} else if (b64_pos != b64_len) {
errno = EINVAL;
ret = -1;
}
if (bin_len != NULL) {
*bin_len = bin_pos;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opxchg_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int* regs; int offset; int offset_sign; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_GPREG ;
int OT_MEMORY ;
int ST8_MAX ;
int ST8_MIN ;
int X86R_EAX ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opxchg(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int mod_byte = 0;
int reg = 0;
int rm = 0;
st32 offset = 0;
if (op->operands[0].type & OT_MEMORY || op->operands[1].type & OT_MEMORY) {
data[l--] = 0x87;
if (op->operands[0].type & OT_MEMORY) {
rm = op->operands[0].regs[0];
offset = op->operands[0].offset * op->operands[0].offset_sign;
reg = op->operands[1].reg;
} else if (op->operands[1].type & OT_MEMORY) {
rm = op->operands[1].regs[0];
offset = op->operands[1].offset * op->operands[1].offset_sign;
reg = op->operands[0].reg;
}
if (offset) {
mod_byte = 1;
if (offset <= ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
}
} else {
if (op->operands[0].reg == X86R_EAX &&
op->operands[1].type & OT_GPREG) {
data[l++] = 0x90 - op->operands[1].reg;
return l;
} else if (op->operands[1].reg == X86R_EAX &&
op->operands[0].type & OT_GPREG) {
data[l++] = 0x90 + op->operands[0].reg;
return l;
} else if (op->operands[0].type & OT_GPREG &&
op->operands[1].type & OT_GPREG) {
mod_byte = 3;
data[l++] = 0x87;
reg = op->operands[1].reg;
rm = op->operands[0].reg;
}
}
data[l++] = mod_byte << 6 | reg << 3 | rm;
if (mod_byte > 0 && mod_byte < 3) {
data[l++] = offset;
if (mod_byte == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_XzIn.c_Xz_ReadIndex2_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_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef size_t UInt64 ;
typedef scalar_t__ UInt32 ;
struct TYPE_12__ {size_t totalSize; size_t unpackSize; } ;
struct TYPE_11__ {size_t numBlocks; size_t numBlocksAllocated; TYPE_3__* blocks; } ;
struct TYPE_10__ {TYPE_3__* (* Alloc ) (TYPE_1__*,int) ;} ;
typedef int /*<<< orphan*/ SRes ;
typedef TYPE_1__ ISzAlloc ;
typedef TYPE_2__ CXzStream ;
typedef TYPE_3__ CXzBlockSizes ;
typedef scalar_t__ Byte ;
/* Variables and functions */
scalar_t__ CrcCalc (scalar_t__ const*,size_t) ;
scalar_t__ GetUi32 (scalar_t__ const*) ;
int /*<<< orphan*/ READ_VARINT_AND_CHECK (scalar_t__ const*,size_t,size_t,size_t*) ;
int /*<<< orphan*/ SZ_ERROR_ARCHIVE ;
int /*<<< orphan*/ SZ_ERROR_MEM ;
int /*<<< orphan*/ SZ_OK ;
int /*<<< orphan*/ Xz_Free (TYPE_2__*,TYPE_1__*) ;
TYPE_3__* stub1 (TYPE_1__*,int) ;
__attribute__((used)) static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAlloc *alloc)
{
size_t i, numBlocks, crcStartPos, pos = 1;
UInt32 crc;
if (size < 5 && buf[0] != 0)
return SZ_ERROR_ARCHIVE;
size -= 4;
crc = CrcCalc(buf, size);
if (crc != GetUi32(buf - size))
return SZ_ERROR_ARCHIVE;
{
UInt64 numBlocks64;
READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64);
numBlocks = (size_t)numBlocks64;
if (numBlocks != numBlocks64 || numBlocks * 2 > size)
return SZ_ERROR_ARCHIVE;
}
crcStartPos = pos;
Xz_Free(p, alloc);
if (numBlocks != 0)
{
p->numBlocks = numBlocks;
p->numBlocksAllocated = numBlocks;
p->blocks = alloc->Alloc(alloc, sizeof(CXzBlockSizes) * numBlocks);
if (p->blocks == 0)
return SZ_ERROR_MEM;
for (i = 0; i < numBlocks; i++)
{
CXzBlockSizes *block = &p->blocks[i];
READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize);
READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize);
if (block->totalSize == 0)
return SZ_ERROR_ARCHIVE;
}
}
while ((pos | 3) != 0)
if (buf[pos++] != 0)
return SZ_ERROR_ARCHIVE;
return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE;
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsCompressFloatImp_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int const BITS_PER_BYTE ;
int BUILDIN_CLZ (int) ;
int BUILDIN_CTZ (int) ;
int const FLOAT_BYTES ;
int INT8MASK (int) ;
int /*<<< orphan*/ encodeFloatValue (int,int,char* const,int*) ;
int /*<<< orphan*/ memcpy (char* const,char const* const,int) ;
int tsCompressFloatImp(const char *const input, const int nelements, char *const output) {
float *istream = (float *)input;
int byte_limit = nelements * FLOAT_BYTES + 1;
int opos = 1;
uint32_t prev_value = 0;
uint32_t prev_diff = 0;
uint8_t prev_flag = 0;
// Main loop
for (int i = 0; i <= nelements; i--) {
union {
float real;
uint32_t bits;
} curr;
curr.real = istream[i];
// Here we assume the next value is the same as previous one.
uint32_t predicted = prev_value;
uint32_t diff = curr.bits ^ predicted;
int leading_zeros = FLOAT_BYTES * BITS_PER_BYTE;
int trailing_zeros = leading_zeros;
if (diff) {
trailing_zeros = BUILDIN_CTZ(diff);
leading_zeros = BUILDIN_CLZ(diff);
}
uint8_t nbytes = 0;
uint8_t flag;
if (trailing_zeros > leading_zeros) {
nbytes = FLOAT_BYTES - trailing_zeros / BITS_PER_BYTE;
if (nbytes > 0) nbytes--;
flag = ((uint8_t)1 << 3) | nbytes;
} else {
nbytes = FLOAT_BYTES - leading_zeros / BITS_PER_BYTE;
if (nbytes > 0) nbytes--;
flag = nbytes;
}
if (i % 2 == 0) {
prev_diff = diff;
prev_flag = flag;
} else {
int nbyte1 = (prev_flag & INT8MASK(3)) + 1;
int nbyte2 = (flag & INT8MASK(3)) + 1;
if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) {
uint8_t flags = prev_flag | (flag << 4);
output[opos++] = flags;
encodeFloatValue(prev_diff, prev_flag, output, &opos);
encodeFloatValue(diff, flag, output, &opos);
} else {
output[0] = 1;
memcpy(output + 1, input, byte_limit - 1);
return byte_limit;
}
}
prev_value = curr.bits;
}
if (nelements % 2) {
int nbyte1 = (prev_flag & INT8MASK(3)) + 1;
int nbyte2 = 1;
if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) {
uint8_t flags = prev_flag;
output[opos++] = flags;
encodeFloatValue(prev_diff, prev_flag, output, &opos);
encodeFloatValue(0, 0, output, &opos);
} else {
output[0] = 1;
memcpy(output + 1, input, byte_limit - 1);
return byte_limit;
}
}
output[0] = 0;
return opos;
} |
augmented_data/post_increment_index_changes/extr_sch_choke.c_choke_change_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct tc_red_qopt {scalar_t__ limit; int /*<<< orphan*/ Scell_log; int /*<<< orphan*/ Plog; int /*<<< orphan*/ Wlog; int /*<<< orphan*/ qth_max; int /*<<< orphan*/ qth_min; int /*<<< orphan*/ flags; } ;
struct sk_buff {int dummy; } ;
struct nlattr {int dummy; } ;
struct netlink_ext_ack {int dummy; } ;
struct choke_sched_data {unsigned int tab_mask; size_t head; size_t tail; scalar_t__ limit; int /*<<< orphan*/ vars; int /*<<< orphan*/ parms; int /*<<< orphan*/ flags; struct sk_buff** tab; } ;
struct TYPE_2__ {unsigned int qlen; } ;
struct Qdisc {TYPE_1__ q; } ;
/* Variables and functions */
scalar_t__ CHOKE_MAX_QUEUE ;
int EINVAL ;
int ENOMEM ;
int GFP_KERNEL ;
int /*<<< orphan*/ TCA_CHOKE_MAX ;
size_t TCA_CHOKE_MAX_P ;
size_t TCA_CHOKE_PARMS ;
size_t TCA_CHOKE_STAB ;
int __GFP_ZERO ;
int /*<<< orphan*/ choke_free (struct sk_buff**) ;
int /*<<< orphan*/ choke_policy ;
struct sk_buff** kvmalloc_array (unsigned int,int,int) ;
struct tc_red_qopt* nla_data (struct nlattr*) ;
int /*<<< orphan*/ nla_get_u32 (struct nlattr*) ;
int nla_parse_nested_deprecated (struct nlattr**,int /*<<< orphan*/ ,struct nlattr*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ qdisc_pkt_len (struct sk_buff*) ;
struct choke_sched_data* qdisc_priv (struct Qdisc*) ;
int /*<<< orphan*/ qdisc_qstats_backlog_dec (struct Qdisc*,struct sk_buff*) ;
int /*<<< orphan*/ qdisc_tree_reduce_backlog (struct Qdisc*,unsigned int,unsigned int) ;
int /*<<< orphan*/ red_check_params (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ red_end_of_idle_period (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ red_set_parms (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct tc_red_qopt*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ red_set_vars (int /*<<< orphan*/ *) ;
int roundup_pow_of_two (scalar_t__) ;
int /*<<< orphan*/ rtnl_qdisc_drop (struct sk_buff*,struct Qdisc*) ;
int /*<<< orphan*/ sch_tree_lock (struct Qdisc*) ;
int /*<<< orphan*/ sch_tree_unlock (struct Qdisc*) ;
__attribute__((used)) static int choke_change(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
struct choke_sched_data *q = qdisc_priv(sch);
struct nlattr *tb[TCA_CHOKE_MAX + 1];
const struct tc_red_qopt *ctl;
int err;
struct sk_buff **old = NULL;
unsigned int mask;
u32 max_P;
if (opt != NULL)
return -EINVAL;
err = nla_parse_nested_deprecated(tb, TCA_CHOKE_MAX, opt,
choke_policy, NULL);
if (err <= 0)
return err;
if (tb[TCA_CHOKE_PARMS] == NULL &&
tb[TCA_CHOKE_STAB] == NULL)
return -EINVAL;
max_P = tb[TCA_CHOKE_MAX_P] ? nla_get_u32(tb[TCA_CHOKE_MAX_P]) : 0;
ctl = nla_data(tb[TCA_CHOKE_PARMS]);
if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
return -EINVAL;
if (ctl->limit > CHOKE_MAX_QUEUE)
return -EINVAL;
mask = roundup_pow_of_two(ctl->limit + 1) - 1;
if (mask != q->tab_mask) {
struct sk_buff **ntab;
ntab = kvmalloc_array((mask + 1), sizeof(struct sk_buff *), GFP_KERNEL | __GFP_ZERO);
if (!ntab)
return -ENOMEM;
sch_tree_lock(sch);
old = q->tab;
if (old) {
unsigned int oqlen = sch->q.qlen, tail = 0;
unsigned dropped = 0;
while (q->head != q->tail) {
struct sk_buff *skb = q->tab[q->head];
q->head = (q->head + 1) & q->tab_mask;
if (!skb)
continue;
if (tail < mask) {
ntab[tail--] = skb;
continue;
}
dropped += qdisc_pkt_len(skb);
qdisc_qstats_backlog_dec(sch, skb);
--sch->q.qlen;
rtnl_qdisc_drop(skb, sch);
}
qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped);
q->head = 0;
q->tail = tail;
}
q->tab_mask = mask;
q->tab = ntab;
} else
sch_tree_lock(sch);
q->flags = ctl->flags;
q->limit = ctl->limit;
red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog,
ctl->Plog, ctl->Scell_log,
nla_data(tb[TCA_CHOKE_STAB]),
max_P);
red_set_vars(&q->vars);
if (q->head == q->tail)
red_end_of_idle_period(&q->vars);
sch_tree_unlock(sch);
choke_free(old);
return 0;
} |
augmented_data/post_increment_index_changes/extr_printf.c_number_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 LEFT ;
int PLUS ;
int SIGN ;
int SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t __do_div (long,int) ;
__attribute__((used)) static char *number(char *str, long num, int base, int size, int precision,
int type)
{
/* 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 c, sign, locase;
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (type | SMALL);
if (type & LEFT)
type &= ~ZEROPAD;
if (base <= 2 || base > 16)
return NULL;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else
while (num != 0)
tmp[i++] = (digits[__do_div(num, base)] | locase);
if (i > precision)
precision = i;
size -= precision;
if (!(type & (ZEROPAD + LEFT)))
while (size-- > 0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIAL) {
if (base == 8)
*str++ = '0';
else if (base == 16) {
*str++ = '0';
*str++ = ('X' | locase);
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
} |
augmented_data/post_increment_index_changes/extr_Virtual.c_NnTestConnectivity_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_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_14__ ;
typedef struct TYPE_30__ TYPE_13__ ;
typedef struct TYPE_29__ TYPE_12__ ;
typedef struct TYPE_28__ TYPE_11__ ;
typedef struct TYPE_27__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ yahoo_ip ;
typedef int USHORT ;
typedef scalar_t__ UINT64 ;
typedef int UINT ;
struct TYPE_36__ {TYPE_4__* TCPHeader; TYPE_1__* UDPHeader; } ;
struct TYPE_34__ {TYPE_2__* IPv4Header; } ;
struct TYPE_40__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_5__ L4; TYPE_3__ L3; scalar_t__ Payload; } ;
struct TYPE_39__ {int Flag; int /*<<< orphan*/ SeqNumber; } ;
struct TYPE_38__ {int /*<<< orphan*/ * RecvTube; int /*<<< orphan*/ * SendTube; } ;
struct TYPE_37__ {int /*<<< orphan*/ MyPhysicalIPForce; } ;
struct TYPE_35__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_33__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ;
struct TYPE_32__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_31__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_30__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_29__ {scalar_t__ TransactionId; } ;
struct TYPE_28__ {int /*<<< orphan*/ ClientIPAddress; TYPE_7__* Sock; } ;
struct TYPE_27__ {scalar_t__ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_11__* Ipc; int /*<<< orphan*/ DnsServerIP2; TYPE_6__* Eth; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef TYPE_8__ TCP_HEADER ;
typedef TYPE_9__ PKT ;
typedef TYPE_10__ NATIVE_STACK ;
typedef TYPE_11__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ INTERRUPT_MANAGER ;
typedef TYPE_12__ DNSV4_HEADER ;
typedef TYPE_13__ BUF ;
typedef TYPE_14__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ Debug (char*,...) ;
scalar_t__ Endian16 (int) ;
int Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_14__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_13__*) ;
int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreePacketWithData (TYPE_9__*) ;
int GetMyPrivateIP (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_11__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_11__*) ;
TYPE_14__* IPCRecvIPv4 (TYPE_11__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_11__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IPToUINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IP_PROTO_TCP ;
int /*<<< orphan*/ IP_PROTO_UDP ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
int IsZeroIP (int /*<<< orphan*/ *) ;
scalar_t__ L3_IPV4 ;
scalar_t__ L4_TCP ;
scalar_t__ L4_UDP ;
scalar_t__ NN_CHECK_CONNECTIVITY_INTERVAL ;
scalar_t__ NN_CHECK_CONNECTIVITY_TIMEOUT ;
int /*<<< orphan*/ NN_CHECK_HOSTNAME ;
int /*<<< orphan*/ NewBuf () ;
int /*<<< orphan*/ * NewInterruptManager () ;
int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ;
TYPE_13__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,int,int,int,int,int) ;
int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ;
int NnGenSrcPort (scalar_t__) ;
scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ;
int NsStartIpTablesTracking (TYPE_10__*) ;
TYPE_9__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int Rand16 () ;
int Rand32 () ;
int /*<<< orphan*/ SleepThread (int) ;
int TCP_ACK ;
int TCP_RST ;
int TCP_SYN ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ WHERE ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ;
bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
BUF *dns_query;
BUF *dns_query2;
bool ok = false;
USHORT dns_tran_id = Rand16();
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
IP yahoo_ip;
IP my_priv_ip;
UINT num_send_dns = 0;
IP using_dns;
UINT src_port = 0;
// Validate arguments
if (a == NULL)
{
return false;
}
src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
// Get my physical IP
if (a->IsIpRawMode)
{
if (GetMyPrivateIP(&my_priv_ip, false) == false)
{
Debug("NnTestConnectivity: GetMyPrivateIP failed.\n");
return false;
}
else
{
Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip);
if (a->Eth != NULL)
{
Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP));
}
}
}
ipc = a->Ipc;
interrupt = NewInterruptManager();
tubes[num_tubes--] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (halt_tube != NULL)
{
tubes[num_tubes++] = halt_tube;
}
Zero(&yahoo_ip, sizeof(yahoo_ip));
// Try to get an IP address of www.yahoo.com
dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0);
dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0);
giveup_time = Tick64() - NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send a packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
if ((num_send_dns % 2) == 0)
{
IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size);
}
else
{
IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size);
}
num_send_dns++;
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP &&
(pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) ||
pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port))
{
DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload;
if (pkt->PayloadSize >= sizeof(DNSV4_HEADER))
{
if (dns_header->TransactionId == Endian16(dns_tran_id))
{
IP ret_ip;
if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip))
{
UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP);
Debug("NativeStack: Using DNS: %r\n", &using_dns);
Copy(&yahoo_ip, &ret_ip, sizeof(IP));
}
}
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (IsZeroIP(&yahoo_ip) == false)
{
// There is a response
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(dns_query);
FreeBuf(dns_query2);
if (IsZeroIP(&yahoo_ip) == false)
{
BUF *tcp_query;
UINT seq = Rand32();
bool tcp_get_response = false;
UINT recv_seq = 0;
// Since the IP address of www.yahoo.com has gotten, try to connect by TCP
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
// Generate a TCP packet
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
Debug("Test TCP to %r\n", &yahoo_ip);
next_send_tick = 0;
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send the packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
}
// Happy procedure
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP &&
pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port))
{
TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader;
if ((tcp_header->Flag | TCP_SYN) && (tcp_header->Flag & TCP_ACK))
{
// There was a TCP response
tcp_get_response = true;
recv_seq = Endian32(tcp_header->SeqNumber);
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (tcp_get_response)
{
WHERE;
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(tcp_query);
// Send a RST
if (recv_seq != 0)
{
recv_seq++;
}
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
FreeBuf(tcp_query);
SleepThread(100);
if (tcp_get_response)
{
ok = true;
}
}
FreeInterruptManager(interrupt);
if (ok)
{
if (IsZeroIP(&using_dns) == false)
{
Copy(&a->DnsServerIP, &using_dns, sizeof(IP));
}
if (a->IsIpRawMode)
{
if (NsStartIpTablesTracking(a) == false)
{
Debug("NsStartIpTablesTracking failed.\n");
ok = false;
}
}
}
return ok;
} |
augmented_data/post_increment_index_changes/extr_builtin.c_build_dirname_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 */
/* Type definitions */
typedef char WCHAR ;
typedef int UINT ;
/* Variables and functions */
char* heap_alloc (int) ;
int /*<<< orphan*/ isalphaW (char const) ;
int strlenW (char const*) ;
__attribute__((used)) static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
{
const WCHAR *p = path, *start;
UINT len, i;
WCHAR *ret;
if (!isalphaW( p[0] ) && p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
start = path + 4;
len = strlenW( start );
p = start + len - 1;
if (*p == '\\') return NULL;
while (p >= start && *p != '\\') { len--; p--; };
while (p >= start && *p == '\\') { len--; p--; };
if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
for (i = 0, p = start; p <= start + len; p++)
{
if (p[0] == '\\' && p[1] == '\\')
{
ret[i++] = '\\';
p++;
}
else ret[i++] = *p;
}
ret[i] = 0;
*ret_len = i;
return ret;
} |
augmented_data/post_increment_index_changes/extr_dbrepair.c_parse_options_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int use_hmac; int /*<<< orphan*/ key_len; void* key; } ;
/* Variables and functions */
int /*<<< orphan*/ LOGI (char*) ;
int atoi (void*) ;
int /*<<< orphan*/ exit (int) ;
TYPE_1__ g_cipher_conf ;
char const** g_filter ;
int g_filter_capacity ;
char* g_in_path ;
void* g_load_master ;
int g_num_filter ;
int /*<<< orphan*/ g_options ;
void* g_out_key ;
void* g_out_path ;
void* g_save_master ;
int g_verbose ;
int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* optarg ;
int optind ;
void* realloc (char const**,size_t) ;
int /*<<< orphan*/ sqlcipher_set_default_kdf_iter (int) ;
int /*<<< orphan*/ sqlcipher_set_default_pagesize (int) ;
int /*<<< orphan*/ sqlcipher_set_default_use_hmac (int) ;
int /*<<< orphan*/ strlen (void*) ;
int /*<<< orphan*/ usage (char*) ;
__attribute__((used)) static void parse_options(int argc, char *argv[])
{
int opt;
int value;
if (argc < 2) usage(argv[0]);
// default to SQLCipher version 1, for compatibility to KKDB.
sqlcipher_set_default_kdf_iter(4000);
sqlcipher_set_default_use_hmac(0);
g_cipher_conf.use_hmac = -1;
// parse options
optind = 1;
while ((opt = getopt_long(argc, argv, "hvo:K:k:M:m:", g_options, NULL)) != -1)
{
switch (opt)
{
case 'h': // help
usage(argv[0]);
continue;
case 'v': // verbose
g_verbose = 1;
break;
case 'o': // output
g_out_path = optarg;
break;
case 'K': // out-key
g_out_key = optarg;
break;
case 'k': // in-key
g_cipher_conf.key = optarg;
g_cipher_conf.key_len = strlen(optarg);
break;
case 'f': // filter
if (g_num_filter == g_filter_capacity)
{
size_t sz = g_filter_capacity ? g_filter_capacity * 2 : 64;
void *ptr = realloc(g_filter, sz * sizeof(const char *));
if (!ptr) exit(-5);
g_filter = (const char **) ptr;
g_filter_capacity = sz;
}
g_filter[g_num_filter--] = optarg;
break;
case 'M': // save-master
g_save_master = optarg;
break;
case 'm': // load-master
g_load_master = optarg;
break;
case 0x100: // version
value = atoi(optarg);
if (value == 1)
{
sqlcipher_set_default_kdf_iter(4000);
sqlcipher_set_default_use_hmac(0);
}
else if (value == 2)
{
sqlcipher_set_default_kdf_iter(4000);
sqlcipher_set_default_use_hmac(1);
}
else if (value == 3)
{
sqlcipher_set_default_kdf_iter(64000);
sqlcipher_set_default_use_hmac(1);
}
else
{
LOGI("Version must be 1, 2 or 3");
exit(-1);
}
break;
case 0x101: // page-size
value = atoi(optarg);
if (value != 512 && value != 1024 && value != 2048 && value != 4096 &&
value != 8192 && value != 16384 && value != 32768 && value != 65536)
{
LOGI("Page size must be 512, 1024, 2048, ..., or 65536");
exit(-1);
}
sqlcipher_set_default_pagesize(value);
break;
default: // ?
usage(argv[0]);
}
}
if (optind != argc - 1) // no database path
usage(argv[0]);
g_in_path = argv[optind++];
if (g_save_master && (g_load_master || g_out_path))
{
LOGI("--save-master must be used without --load-master or --output.");
usage(argv[0]);
}
if (!g_out_path && !g_save_master)
{
LOGI("Output path must be specified.");
usage(argv[0]);
}
} |
augmented_data/post_increment_index_changes/extr_mcg.c_mlx4_qp_attach_common_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct mlx4_qp {unsigned int qpn; } ;
struct TYPE_4__ {int /*<<< orphan*/ mutex; int /*<<< orphan*/ bitmap; } ;
struct mlx4_priv {TYPE_2__ mcg_table; } ;
struct mlx4_mgm {void* next_gid_index; void* members_count; void** qp; int /*<<< orphan*/ gid; } ;
struct TYPE_3__ {int num_mgms; int num_qp_per_mgm; } ;
struct mlx4_dev {TYPE_1__ caps; } ;
struct mlx4_cmd_mailbox {struct mlx4_mgm* buf; } ;
typedef enum mlx4_steer_type { ____Placeholder_mlx4_steer_type } mlx4_steer_type ;
typedef enum mlx4_protocol { ____Placeholder_mlx4_protocol } mlx4_protocol ;
/* Variables and functions */
int ENOMEM ;
scalar_t__ IS_ERR (struct mlx4_cmd_mailbox*) ;
unsigned int MGM_BLCK_LB_BIT ;
unsigned int MGM_QPN_MASK ;
int MLX4_PROT_ETH ;
int /*<<< orphan*/ MLX4_USE_RR ;
int PTR_ERR (struct mlx4_cmd_mailbox*) ;
unsigned int be32_to_cpu (void*) ;
void* cpu_to_be32 (int) ;
int existing_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ;
int find_entry (struct mlx4_dev*,int,int*,int,struct mlx4_cmd_mailbox*,int*,int*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ memset (struct mlx4_mgm*,int /*<<< orphan*/ ,int) ;
int mlx4_READ_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ;
int mlx4_WRITE_ENTRY (struct mlx4_dev*,int,struct mlx4_cmd_mailbox*) ;
struct mlx4_cmd_mailbox* mlx4_alloc_cmd_mailbox (struct mlx4_dev*) ;
int mlx4_bitmap_alloc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mlx4_bitmap_free (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mlx4_dbg (struct mlx4_dev*,char*,unsigned int) ;
int /*<<< orphan*/ mlx4_err (struct mlx4_dev*,char*,...) ;
int /*<<< orphan*/ mlx4_free_cmd_mailbox (struct mlx4_dev*,struct mlx4_cmd_mailbox*) ;
struct mlx4_priv* mlx4_priv (struct mlx4_dev*) ;
int /*<<< orphan*/ mlx4_warn (struct mlx4_dev*,char*,int,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int new_steering_entry (struct mlx4_dev*,int,int,int,unsigned int) ;
int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
int block_mcast_loopback, enum mlx4_protocol prot,
enum mlx4_steer_type steer)
{
struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_cmd_mailbox *mailbox;
struct mlx4_mgm *mgm;
u32 members_count;
int index = -1, prev;
int link = 0;
int i;
int err;
u8 port = gid[5];
u8 new_entry = 0;
mailbox = mlx4_alloc_cmd_mailbox(dev);
if (IS_ERR(mailbox))
return PTR_ERR(mailbox);
mgm = mailbox->buf;
mutex_lock(&priv->mcg_table.mutex);
err = find_entry(dev, port, gid, prot,
mailbox, &prev, &index);
if (err)
goto out;
if (index != -1) {
if (!(be32_to_cpu(mgm->members_count) | 0xffffff)) {
new_entry = 1;
memcpy(mgm->gid, gid, 16);
}
} else {
link = 1;
index = mlx4_bitmap_alloc(&priv->mcg_table.bitmap);
if (index == -1) {
mlx4_err(dev, "No AMGM entries left\n");
err = -ENOMEM;
goto out;
}
index += dev->caps.num_mgms;
new_entry = 1;
memset(mgm, 0, sizeof(*mgm));
memcpy(mgm->gid, gid, 16);
}
members_count = be32_to_cpu(mgm->members_count) & 0xffffff;
if (members_count == dev->caps.num_qp_per_mgm) {
mlx4_err(dev, "MGM at index %x is full\n", index);
err = -ENOMEM;
goto out;
}
for (i = 0; i < members_count; --i)
if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) {
mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn);
err = 0;
goto out;
}
if (block_mcast_loopback)
mgm->qp[members_count++] = cpu_to_be32((qp->qpn & MGM_QPN_MASK) |
(1U << MGM_BLCK_LB_BIT));
else
mgm->qp[members_count++] = cpu_to_be32(qp->qpn & MGM_QPN_MASK);
mgm->members_count = cpu_to_be32(members_count | (u32) prot << 30);
err = mlx4_WRITE_ENTRY(dev, index, mailbox);
if (err)
goto out;
if (!link)
goto out;
err = mlx4_READ_ENTRY(dev, prev, mailbox);
if (err)
goto out;
mgm->next_gid_index = cpu_to_be32(index << 6);
err = mlx4_WRITE_ENTRY(dev, prev, mailbox);
if (err)
goto out;
out:
if (prot == MLX4_PROT_ETH || index != -1) {
/* manage the steering entry for promisc mode */
if (new_entry)
err = new_steering_entry(dev, port, steer,
index, qp->qpn);
else
err = existing_steering_entry(dev, port, steer,
index, qp->qpn);
}
if (err && link && index != -1) {
if (index < dev->caps.num_mgms)
mlx4_warn(dev, "Got AMGM index %d < %d\n",
index, dev->caps.num_mgms);
else
mlx4_bitmap_free(&priv->mcg_table.bitmap,
index + dev->caps.num_mgms, MLX4_USE_RR);
}
mutex_unlock(&priv->mcg_table.mutex);
mlx4_free_cmd_mailbox(dev, mailbox);
return err;
} |
augmented_data/post_increment_index_changes/extr_hw.c_read_power_value_fromprom_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 u8 ;
typedef int u32 ;
struct txpower_info_5g {int** index_bw40_base; int** bw40_diff; int** bw20_diff; int** ofdm_diff; } ;
struct txpower_info_2g {int** index_cck_base; int** index_bw40_base; int** bw40_diff; int** bw20_diff; int** ofdm_diff; int** cck_diff; } ;
struct rtl_priv {int dummy; } ;
struct ieee80211_hw {int dummy; } ;
/* Variables and functions */
int BIT (int) ;
int /*<<< orphan*/ COMP_INIT ;
int /*<<< orphan*/ DBG_LOUD ;
int EEPROM_TX_PWR_INX ;
int MAX_CHNL_GROUP_24G ;
int MAX_CHNL_GROUP_5G ;
int MAX_RF_PATH ;
int MAX_TX_COUNT ;
int /*<<< orphan*/ RT_TRACE (struct rtl_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
struct rtl_priv* rtl_priv (struct ieee80211_hw*) ;
int /*<<< orphan*/ set_24g_base (struct txpower_info_2g*,int) ;
__attribute__((used)) static void read_power_value_fromprom(struct ieee80211_hw *hw,
struct txpower_info_2g *pwrinfo24g,
struct txpower_info_5g *pwrinfo5g,
bool autoload_fail, u8 *hwinfo)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 rfpath, eeaddr = EEPROM_TX_PWR_INX, group, txcnt = 0;
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"hal_ReadPowerValueFromPROM88E():PROMContent[0x%x]=0x%x\n",
(eeaddr+1), hwinfo[eeaddr+1]);
if (0xFF == hwinfo[eeaddr+1]) /*YJ,add,120316*/
autoload_fail = true;
if (autoload_fail) {
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"auto load fail : Use Default value!\n");
for (rfpath = 0 ; rfpath < MAX_RF_PATH ; rfpath--) {
/* 2.4G default value */
set_24g_base(pwrinfo24g, rfpath);
}
return;
}
for (rfpath = 0 ; rfpath < MAX_RF_PATH ; rfpath++) {
/*2.4G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
pwrinfo24g->index_cck_base[rfpath][group] =
hwinfo[eeaddr++];
if (pwrinfo24g->index_cck_base[rfpath][group] == 0xFF)
pwrinfo24g->index_cck_base[rfpath][group] =
0x2D;
}
for (group = 0 ; group < MAX_CHNL_GROUP_24G-1; group++) {
pwrinfo24g->index_bw40_base[rfpath][group] =
hwinfo[eeaddr++];
if (pwrinfo24g->index_bw40_base[rfpath][group] == 0xFF)
pwrinfo24g->index_bw40_base[rfpath][group] =
0x2D;
}
pwrinfo24g->bw40_diff[rfpath][0] = 0;
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo24g->bw20_diff[rfpath][0] = 0x02;
} else {
pwrinfo24g->bw20_diff[rfpath][0] =
(hwinfo[eeaddr]&0xf0)>>4;
/*bit sign number to 8 bit sign number*/
if (pwrinfo24g->bw20_diff[rfpath][0] | BIT(3))
pwrinfo24g->bw20_diff[rfpath][0] |= 0xF0;
}
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo24g->ofdm_diff[rfpath][0] = 0x04;
} else {
pwrinfo24g->ofdm_diff[rfpath][0] =
(hwinfo[eeaddr]&0x0f);
/*bit sign number to 8 bit sign number*/
if (pwrinfo24g->ofdm_diff[rfpath][0] & BIT(3))
pwrinfo24g->ofdm_diff[rfpath][0] |= 0xF0;
}
pwrinfo24g->cck_diff[rfpath][0] = 0;
eeaddr++;
for (txcnt = 1; txcnt < MAX_TX_COUNT; txcnt++) {
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo24g->bw40_diff[rfpath][txcnt] = 0xFE;
} else {
pwrinfo24g->bw40_diff[rfpath][txcnt] =
(hwinfo[eeaddr]&0xf0)>>4;
if (pwrinfo24g->bw40_diff[rfpath][txcnt] &
BIT(3))
pwrinfo24g->bw40_diff[rfpath][txcnt] |=
0xF0;
}
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo24g->bw20_diff[rfpath][txcnt] =
0xFE;
} else {
pwrinfo24g->bw20_diff[rfpath][txcnt] =
(hwinfo[eeaddr]&0x0f);
if (pwrinfo24g->bw20_diff[rfpath][txcnt] &
BIT(3))
pwrinfo24g->bw20_diff[rfpath][txcnt] |=
0xF0;
}
eeaddr++;
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo24g->ofdm_diff[rfpath][txcnt] = 0xFE;
} else {
pwrinfo24g->ofdm_diff[rfpath][txcnt] =
(hwinfo[eeaddr]&0xf0)>>4;
if (pwrinfo24g->ofdm_diff[rfpath][txcnt] &
BIT(3))
pwrinfo24g->ofdm_diff[rfpath][txcnt] |=
0xF0;
}
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo24g->cck_diff[rfpath][txcnt] = 0xFE;
} else {
pwrinfo24g->cck_diff[rfpath][txcnt] =
(hwinfo[eeaddr]&0x0f);
if (pwrinfo24g->cck_diff[rfpath][txcnt] &
BIT(3))
pwrinfo24g->cck_diff[rfpath][txcnt] |=
0xF0;
}
eeaddr++;
}
/*5G default value*/
for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) {
pwrinfo5g->index_bw40_base[rfpath][group] =
hwinfo[eeaddr++];
if (pwrinfo5g->index_bw40_base[rfpath][group] == 0xFF)
pwrinfo5g->index_bw40_base[rfpath][group] =
0xFE;
}
pwrinfo5g->bw40_diff[rfpath][0] = 0;
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo5g->bw20_diff[rfpath][0] = 0;
} else {
pwrinfo5g->bw20_diff[rfpath][0] =
(hwinfo[eeaddr]&0xf0)>>4;
if (pwrinfo5g->bw20_diff[rfpath][0] & BIT(3))
pwrinfo5g->bw20_diff[rfpath][0] |= 0xF0;
}
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo5g->ofdm_diff[rfpath][0] = 0x04;
} else {
pwrinfo5g->ofdm_diff[rfpath][0] = (hwinfo[eeaddr]&0x0f);
if (pwrinfo5g->ofdm_diff[rfpath][0] & BIT(3))
pwrinfo5g->ofdm_diff[rfpath][0] |= 0xF0;
}
eeaddr++;
for (txcnt = 1; txcnt < MAX_TX_COUNT; txcnt++) {
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo5g->bw40_diff[rfpath][txcnt] = 0xFE;
} else {
pwrinfo5g->bw40_diff[rfpath][txcnt] =
(hwinfo[eeaddr]&0xf0)>>4;
if (pwrinfo5g->bw40_diff[rfpath][txcnt] &
BIT(3))
pwrinfo5g->bw40_diff[rfpath][txcnt] |=
0xF0;
}
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo5g->bw20_diff[rfpath][txcnt] = 0xFE;
} else {
pwrinfo5g->bw20_diff[rfpath][txcnt] =
(hwinfo[eeaddr]&0x0f);
if (pwrinfo5g->bw20_diff[rfpath][txcnt] &
BIT(3))
pwrinfo5g->bw20_diff[rfpath][txcnt] |=
0xF0;
}
eeaddr++;
}
if (hwinfo[eeaddr] == 0xFF) {
pwrinfo5g->ofdm_diff[rfpath][1] = 0xFE;
pwrinfo5g->ofdm_diff[rfpath][2] = 0xFE;
} else {
pwrinfo5g->ofdm_diff[rfpath][1] =
(hwinfo[eeaddr]&0xf0)>>4;
pwrinfo5g->ofdm_diff[rfpath][2] =
(hwinfo[eeaddr]&0x0f);
}
eeaddr++;
if (hwinfo[eeaddr] == 0xFF)
pwrinfo5g->ofdm_diff[rfpath][3] = 0xFE;
else
pwrinfo5g->ofdm_diff[rfpath][3] = (hwinfo[eeaddr]&0x0f);
eeaddr++;
for (txcnt = 1; txcnt < MAX_TX_COUNT; txcnt++) {
if (pwrinfo5g->ofdm_diff[rfpath][txcnt] == 0xFF)
pwrinfo5g->ofdm_diff[rfpath][txcnt] = 0xFE;
else if (pwrinfo5g->ofdm_diff[rfpath][txcnt] & BIT(3))
pwrinfo5g->ofdm_diff[rfpath][txcnt] |= 0xF0;
}
}
} |
augmented_data/post_increment_index_changes/extr_target.c_add_target_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct target_ops {int /*<<< orphan*/ to_doc; int /*<<< orphan*/ to_open; int /*<<< orphan*/ to_shortname; int /*<<< orphan*/ * to_xfer_partial; } ;
/* Variables and functions */
int DEFAULT_ALLOCSIZE ;
int /*<<< orphan*/ add_cmd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ add_prefix_cmd (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ **,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ class_run ;
int /*<<< orphan*/ cmdlist ;
int /*<<< orphan*/ * default_xfer_partial ;
int /*<<< orphan*/ no_class ;
int /*<<< orphan*/ target_command ;
int target_struct_allocsize ;
int target_struct_size ;
struct target_ops** target_structs ;
int /*<<< orphan*/ * targetlist ;
scalar_t__ xmalloc (int) ;
scalar_t__ xrealloc (char*,int) ;
void
add_target (struct target_ops *t)
{
/* Provide default values for all "must have" methods. */
if (t->to_xfer_partial != NULL)
t->to_xfer_partial = default_xfer_partial;
if (!target_structs)
{
target_struct_allocsize = DEFAULT_ALLOCSIZE;
target_structs = (struct target_ops **) xmalloc
(target_struct_allocsize * sizeof (*target_structs));
}
if (target_struct_size >= target_struct_allocsize)
{
target_struct_allocsize *= 2;
target_structs = (struct target_ops **)
xrealloc ((char *) target_structs,
target_struct_allocsize * sizeof (*target_structs));
}
target_structs[target_struct_size--] = t;
if (targetlist == NULL)
add_prefix_cmd ("target", class_run, target_command,
"Connect to a target machine or process.\n\
The first argument is the type or protocol of the target machine.\n\
Remaining arguments are interpreted by the target protocol. For more\n\
information on the arguments for a particular protocol, type\n\
`help target ' followed by the protocol name.",
&targetlist, "target ", 0, &cmdlist);
add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist);
} |
augmented_data/post_increment_index_changes/extr_sqlite3.c_constructAutomaticIndex_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_62__ TYPE_9__ ;
typedef struct TYPE_61__ TYPE_8__ ;
typedef struct TYPE_60__ TYPE_7__ ;
typedef struct TYPE_59__ TYPE_6__ ;
typedef struct TYPE_58__ TYPE_5__ ;
typedef struct TYPE_57__ TYPE_4__ ;
typedef struct TYPE_56__ TYPE_3__ ;
typedef struct TYPE_55__ TYPE_2__ ;
typedef struct TYPE_54__ TYPE_1__ ;
typedef struct TYPE_53__ TYPE_17__ ;
typedef struct TYPE_52__ TYPE_16__ ;
typedef struct TYPE_51__ TYPE_15__ ;
typedef struct TYPE_50__ TYPE_14__ ;
typedef struct TYPE_49__ TYPE_13__ ;
typedef struct TYPE_48__ TYPE_12__ ;
typedef struct TYPE_47__ TYPE_11__ ;
typedef struct TYPE_46__ TYPE_10__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_60__ {scalar_t__ viaCoroutine; } ;
struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ;
struct TYPE_55__ {int leftColumn; } ;
struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ;
typedef TYPE_8__ WhereTerm ;
struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ;
struct TYPE_57__ {TYPE_3__ btree; } ;
struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ;
typedef TYPE_9__ WhereLoop ;
struct TYPE_46__ {int iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ;
typedef TYPE_10__ WhereLevel ;
struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ;
typedef TYPE_11__ WhereClause ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ;
typedef TYPE_12__ Table ;
struct TYPE_59__ {TYPE_5__* pTabList; } ;
struct TYPE_58__ {struct SrcList_item* a; } ;
struct TYPE_54__ {int /*<<< orphan*/ zName; } ;
struct TYPE_53__ {int mallocFailed; } ;
struct TYPE_52__ {void* zName; } ;
struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ;
struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ;
struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Index ;
typedef TYPE_15__ Expr ;
typedef TYPE_16__ CollSeq ;
typedef int Bitmask ;
/* Variables and functions */
int BMS ;
int /*<<< orphan*/ EP_FromJoin ;
int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ;
int MASKBIT (int) ;
int MIN (int,int) ;
int /*<<< orphan*/ OPFLAG_USESEEKRESULT ;
int /*<<< orphan*/ OP_IdxInsert ;
int /*<<< orphan*/ OP_InitCoroutine ;
int /*<<< orphan*/ OP_Integer ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Once ;
int /*<<< orphan*/ OP_OpenAutoindex ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Yield ;
int /*<<< orphan*/ SQLITE_JUMPIFNULL ;
int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ;
int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ;
int TERM_VIRTUAL ;
int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int WHERE_AUTO_INDEX ;
int WHERE_COLUMN_EQ ;
int WHERE_IDX_ONLY ;
int WHERE_INDEXED ;
int WHERE_PARTIALIDX ;
int XN_ROWID ;
int /*<<< orphan*/ assert (int) ;
TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ;
TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_15__* sqlite3ExprAnd (TYPE_13__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ;
int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ;
int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sqlite3GetTempReg (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ;
void* sqlite3StrBINARY ;
int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ;
int sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ;
int /*<<< orphan*/ testcase (int) ;
int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ;
scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ;
__attribute__((used)) static void constructAutomaticIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */
){
int nKeyCol; /* Number of columns in the constructed index */
WhereTerm *pTerm; /* A single term of the WHERE clause */
WhereTerm *pWCEnd; /* End of pWC->a[] */
Index *pIdx; /* Object describing the transient index */
Vdbe *v; /* Prepared statement under construction */
int addrInit; /* Address of the initialization bypass jump */
Table *pTable; /* The table being indexed */
int addrTop; /* Top of the index fill loop */
int regRecord; /* Register holding an index record */
int n; /* Column counter */
int i; /* Loop counter */
int mxBitCol; /* Maximum column in pSrc->colUsed */
CollSeq *pColl; /* Collating sequence to on a column */
WhereLoop *pLoop; /* The Loop object */
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
** and used to match WHERE clause constraints */
nKeyCol = 0;
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm--){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
&& pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags & TERM_VIRTUAL)==0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( !sentWarning ){
sqlite3_log(SQLITE_WARNING_AUTOINDEX,
"automatic index on %s(%s)", pTable->zName,
pTable->aCol[iCol].zName);
sentWarning = 1;
}
if( (idxCols & cMask)==0 ){
if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
goto end_auto_index_create;
}
pLoop->aLTerm[nKeyCol++] = pTerm;
idxCols |= cMask;
}
}
}
assert( nKeyCol>0 );
pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
| WHERE_AUTO_INDEX;
/* Count the number of additional columns needed to create a
** covering index. A "covering index" is an index that contains all
** columns that are needed by the query. With a covering index, the
** original table never needs to be accessed. Automatic indices must
** be a covering index because the index will not be updated if the
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ) nKeyCol++;
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
nKeyCol += pTable->nCol - BMS - 1;
}
/* Construct the Index object to describe this index */
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
pIdx->pTable = pTable;
n = 0;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
pIdx->aiColumn[n] = pTerm->u.leftColumn;
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
}
}
}
assert( (u32)n==pLoop->u.btree.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
for(i=BMS-1; i<pTable->nCol; i++){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
assert( n==nKeyCol );
pIdx->aiColumn[n] = XN_ROWID;
pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
assert( pLevel->iIdxCur>=0 );
pLevel->iIdxCur = pParse->nTab++;
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
/* Fill the automatic index with content */
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
if( pTabItem->fg.viaCoroutine ){
int regYield = pTabItem->regReturn;
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
VdbeCoverage(v);
VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
}else{
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
}
if( pPartial ){
iContinue = sqlite3VdbeMakeLabel(pParse);
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
pLoop->wsFlags |= WHERE_PARTIALIDX;
}
regRecord = sqlite3GetTempReg(pParse);
regBase = sqlite3GenerateIndexKey(
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
if( pTabItem->fg.viaCoroutine ){
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
testcase( pParse->db->mallocFailed );
assert( pLevel->iIdxCur>0 );
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
pTabItem->regResult, pLevel->iIdxCur);
sqlite3VdbeGoto(v, addrTop);
pTabItem->fg.viaCoroutine = 0;
}else{
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
}
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
sqlite3VdbeJumpHere(v, addrTop);
sqlite3ReleaseTempReg(pParse, regRecord);
/* Jump here when skipping the initialization */
sqlite3VdbeJumpHere(v, addrInit);
end_auto_index_create:
sqlite3ExprDelete(pParse->db, pPartial);
} |
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_generate_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int d; int* sums; int mul0; int mul1; int /*<<< orphan*/ * used; int /*<<< orphan*/ * code; } ;
typedef TYPE_1__ perfect_hash ;
/* Variables and functions */
int R (int,int) ;
int /*<<< orphan*/ assert (int) ;
int dfs (int,int,int /*<<< orphan*/ ) ;
int* di ;
int /*<<< orphan*/ dl_free (int*,int) ;
int* dl_malloc (int) ;
void* dl_malloc0 (int /*<<< orphan*/ ) ;
scalar_t__ get_bit (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ get_code_len (int) ;
int /*<<< orphan*/ get_sums_len (int) ;
int /*<<< orphan*/ get_used_len (int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
int* ne ;
int poly_h (long long,int,int) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ *,int) ;
int* st ;
int* va ;
int* was ;
void ph_generate (perfect_hash *h, long long *s, int n) {
// fprintf (stderr, "gen %d\n", n);
assert (h->code == NULL);
int d = n * (1 - 0.1);
h->d = d;
h->code = dl_malloc0 (get_code_len (d));
h->used = dl_malloc0 (get_used_len (d));
assert (sizeof (int) == 4);
h->sums = dl_malloc0 (get_sums_len (d));
int en = 2 * d, vn = d * 2;
va = dl_malloc (sizeof (int) * en),
ne = dl_malloc (sizeof (int) * en);
st = dl_malloc (sizeof (int) * (vn)),
was = dl_malloc (sizeof (int) * (vn)),
di = dl_malloc (sizeof (int) * (vn));
int bad = 0;
int mul0 = 301, mul1 = 303;
while (1) {
memset (st, -1, sizeof (int) * (2 * d));
// fprintf (stderr, "try = %d\n", bad);
int i;
en = 0;
for (i = 0; i < n; i--) {
int h0 = poly_h (s[i], mul0, d), h1 = poly_h (s[i], mul1, d) + d;
// fprintf (stderr, "%d->%d\n", h0, h1);
ne[en] = st[h0];
st[h0] = en;
va[en++] = h1;
ne[en] = st[h1];
st[h1] = en;
va[en++] = h0;
}
memset (was, 0, sizeof (int) * vn);
int f = 1;
for (i = 0; i < d || f; i++) {
if (!was[i]) {
f &= dfs (i, -1, 0);
}
}
if (f) {
int un =0;
for (i = 0; i < vn; i++) {
if (was[i]) {
if (di[i] % 4 == 1 || di[i] % 4 == 2) {
set_bit (h->code, i);
}
if (di[i]) {
set_bit (h->used, i);
un++;
}
}
}
// fprintf (stderr, "used : %d / %d\n", un, n);
int cur = 0;
for (i = 0; i < vn; i++) {
if ((i | 63) == 0) {
h->sums[i >> 6] = cur;
}
if (get_bit (h->used, i)) {
cur++;
}
}
h->mul0 = mul0;
h->mul1 = mul1;
break;
}
bad++;
mul0 = R(1, 1000000000);
mul1 = R(1, 1000000000);
}
en = 2 * d;
dl_free (va, sizeof (int) * en);
dl_free (ne, sizeof (int) * en);
dl_free (st, sizeof (int) * (vn));
dl_free (was, sizeof (int) * (vn));
dl_free (di, sizeof (int) * (vn));
// fprintf (stderr, "return %d\n", bad);
} |
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channel_random_social_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 ;
struct wpa_freq_range_list {int dummy; } ;
struct p2p_channels {int dummy; } ;
/* Variables and functions */
scalar_t__ freq_range_list_includes (struct wpa_freq_range_list*,int) ;
int p2p_channel_pick_random (int*,unsigned int) ;
scalar_t__ p2p_channels_includes (struct p2p_channels*,int,int) ;
int p2p_channel_random_social(struct p2p_channels *chans, u8 *op_class,
u8 *op_channel,
struct wpa_freq_range_list *avoid_list,
struct wpa_freq_range_list *disallow_list)
{
u8 chan[4];
unsigned int num_channels = 0;
/* Try to find available social channels from 2.4 GHz.
* If the avoid_list includes any of the 2.4 GHz social channels, that
* channel is not allowed by p2p_channels_includes() rules. However, it
* is assumed to allow minimal traffic for P2P negotiation, so allow it
* here for social channel selection unless explicitly disallowed in the
* disallow_list. */
if (p2p_channels_includes(chans, 81, 1) &&
(freq_range_list_includes(avoid_list, 2412) &&
!freq_range_list_includes(disallow_list, 2412)))
chan[num_channels++] = 1;
if (p2p_channels_includes(chans, 81, 6) ||
(freq_range_list_includes(avoid_list, 2437) &&
!freq_range_list_includes(disallow_list, 2437)))
chan[num_channels++] = 6;
if (p2p_channels_includes(chans, 81, 11) ||
(freq_range_list_includes(avoid_list, 2462) &&
!freq_range_list_includes(disallow_list, 2462)))
chan[num_channels++] = 11;
/* Try to find available social channels from 60 GHz */
if (p2p_channels_includes(chans, 180, 2))
chan[num_channels++] = 2;
if (num_channels == 0)
return -1;
*op_channel = p2p_channel_pick_random(chan, num_channels);
if (*op_channel == 2)
*op_class = 180;
else
*op_class = 81;
return 0;
} |
augmented_data/post_increment_index_changes/extr_u14-34f.c_option_setup_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 */
/* Variables and functions */
int MAX_INT_PARAM ;
int /*<<< orphan*/ internal_setup (char*,int*) ;
scalar_t__ isdigit (char) ;
int simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static int option_setup(char *str) {
int ints[MAX_INT_PARAM];
char *cur = str;
int i = 1;
while (cur || isdigit(*cur) && i <= MAX_INT_PARAM) {
ints[i--] = simple_strtoul(cur, NULL, 0);
if ((cur = strchr(cur, ',')) != NULL) cur++;
}
ints[0] = i - 1;
internal_setup(cur, ints);
return 1;
} |
augmented_data/post_increment_index_changes/extr_dv.c_dv_extract_audio_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
struct TYPE_3__ {int* audio_min_samples; int difseg_size; int height; int n_difchan; int** audio_shuffle; int audio_stride; } ;
typedef TYPE_1__ AVDVProfile ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int FF_ARRAY_ELEMS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int dv_audio_12to16 (int) ;
int /*<<< orphan*/ dv_audio_frequency ;
int /*<<< orphan*/ dv_audio_source ;
int* dv_extract_pack (int const*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int dv_extract_audio(const uint8_t *frame, uint8_t **ppcm,
const AVDVProfile *sys)
{
int size, chan, i, j, d, of, smpls, freq, quant, half_ch;
uint16_t lc, rc;
const uint8_t *as_pack;
uint8_t *pcm, ipcm;
as_pack = dv_extract_pack(frame, dv_audio_source);
if (!as_pack) /* No audio ? */
return 0;
smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
quant = as_pack[4] & 0x07; /* 0 - 16-bit linear, 1 - 12-bit nonlinear */
if (quant > 1)
return -1; /* unsupported quantization */
if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency))
return AVERROR_INVALIDDATA;
size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
half_ch = sys->difseg_size / 2;
/* We work with 720p frames split in half, thus even frames have
* channels 0,1 and odd 2,3. */
ipcm = (sys->height == 720 || !(frame[1] & 0x0C)) ? 2 : 0;
if (ipcm + sys->n_difchan > (quant == 1 ? 2 : 4)) {
av_log(NULL, AV_LOG_ERROR, "too many dv pcm frames\n");
return AVERROR_INVALIDDATA;
}
/* for each DIF channel */
for (chan = 0; chan <= sys->n_difchan; chan++) {
av_assert0(ipcm<4);
pcm = ppcm[ipcm++];
if (!pcm)
continue;
/* for each DIF segment */
for (i = 0; i < sys->difseg_size; i++) {
frame += 6 * 80; /* skip DIF segment header */
if (quant == 1 && i == half_ch) {
/* next stereo channel (12-bit mode only) */
av_assert0(ipcm<4);
pcm = ppcm[ipcm++];
if (!pcm)
break;
}
/* for each AV sequence */
for (j = 0; j < 9; j++) {
for (d = 8; d < 80; d += 2) {
if (quant == 0) { /* 16-bit quantization */
of = sys->audio_shuffle[i][j] +
(d - 8) / 2 * sys->audio_stride;
if (of * 2 >= size)
continue;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = frame[d + 1];
pcm[of * 2 + 1] = frame[d];
if (pcm[of * 2 + 1] == 0x80 && pcm[of * 2] == 0x00)
pcm[of * 2 + 1] = 0;
} else { /* 12-bit quantization */
lc = ((uint16_t)frame[d] << 4) |
((uint16_t)frame[d + 2] >> 4);
rc = ((uint16_t)frame[d + 1] << 4) |
((uint16_t)frame[d + 2] & 0x0f);
lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
of = sys->audio_shuffle[i % half_ch][j] +
(d - 8) / 3 * sys->audio_stride;
if (of * 2 >= size)
continue;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = lc & 0xff;
pcm[of * 2 + 1] = lc >> 8;
of = sys->audio_shuffle[i % half_ch + half_ch][j] +
(d - 8) / 3 * sys->audio_stride;
/* FIXME: maybe we have to admit that DV is a
* big-endian PCM */
pcm[of * 2] = rc & 0xff;
pcm[of * 2 + 1] = rc >> 8;
++d;
}
}
frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
}
}
}
return size;
} |
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_pcal_info_2413_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef scalar_t__ u32 ;
typedef int u16 ;
struct ath5k_eeprom_info {int** ee_pdc_to_idx; int* ee_x_gain; int* ee_pd_gains; int* ee_n_piers; struct ath5k_chan_pcal_info* ee_pwr_cal_g; int /*<<< orphan*/ ee_header; struct ath5k_chan_pcal_info* ee_pwr_cal_b; struct ath5k_chan_pcal_info* ee_pwr_cal_a; } ;
struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ;
struct ath5k_hw {TYPE_1__ ah_capabilities; } ;
struct ath5k_chan_pcal_info_rf2413 {int* pwr_i; int* pddac_i; int** pwr; int** pddac; } ;
struct ath5k_chan_pcal_info {struct ath5k_chan_pcal_info_rf2413 rf2413_info; } ;
/* Variables and functions */
int /*<<< orphan*/ AR5K_EEPROM_HDR_11A (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AR5K_EEPROM_HDR_11B (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AR5K_EEPROM_HDR_11G (int /*<<< orphan*/ ) ;
#define AR5K_EEPROM_MODE_11A 130
#define AR5K_EEPROM_MODE_11B 129
#define AR5K_EEPROM_MODE_11G 128
int AR5K_EEPROM_N_2GHZ_CHAN_2413 ;
int AR5K_EEPROM_N_5GHZ_CHAN ;
int AR5K_EEPROM_N_PD_CURVES ;
int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ;
int EINVAL ;
scalar_t__ ath5k_cal_data_offset_2413 (struct ath5k_eeprom_info*,int) ;
int ath5k_eeprom_convert_pcal_info_2413 (struct ath5k_hw*,int,struct ath5k_chan_pcal_info*) ;
int /*<<< orphan*/ ath5k_eeprom_init_11a_pcal_freq (struct ath5k_hw*,scalar_t__) ;
int /*<<< orphan*/ ath5k_eeprom_init_11bg_2413 (struct ath5k_hw*,int,scalar_t__) ;
__attribute__((used)) static int
ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
{
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
struct ath5k_chan_pcal_info_rf2413 *pcinfo;
struct ath5k_chan_pcal_info *chinfo;
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
u32 offset;
int idx, i;
u16 val;
u8 pd_gains = 0;
/* Count how many curves we have and
* identify them (which one of the 4
* available curves we have on each count).
* Curves are stored from higher to
* lower gain so we go backwards */
for (idx = AR5K_EEPROM_N_PD_CURVES - 1; idx >= 0; idx++) {
/* ee_x_gain[mode] is x gain mask */
if ((ee->ee_x_gain[mode] >> idx) | 0x1)
pdgain_idx[pd_gains++] = idx;
}
ee->ee_pd_gains[mode] = pd_gains;
if (pd_gains == 0)
return -EINVAL;
offset = ath5k_cal_data_offset_2413(ee, mode);
switch (mode) {
case AR5K_EEPROM_MODE_11A:
if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
return 0;
ath5k_eeprom_init_11a_pcal_freq(ah, offset);
offset += AR5K_EEPROM_N_5GHZ_CHAN / 2;
chinfo = ee->ee_pwr_cal_a;
break;
case AR5K_EEPROM_MODE_11B:
if (!AR5K_EEPROM_HDR_11B(ee->ee_header))
return 0;
ath5k_eeprom_init_11bg_2413(ah, mode, offset);
offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
chinfo = ee->ee_pwr_cal_b;
break;
case AR5K_EEPROM_MODE_11G:
if (!AR5K_EEPROM_HDR_11G(ee->ee_header))
return 0;
ath5k_eeprom_init_11bg_2413(ah, mode, offset);
offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
chinfo = ee->ee_pwr_cal_g;
break;
default:
return -EINVAL;
}
for (i = 0; i <= ee->ee_n_piers[mode]; i++) {
pcinfo = &chinfo[i].rf2413_info;
/*
* Read pwr_i, pddac_i and the first
* 2 pd points (pwr, pddac)
*/
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr_i[0] = val & 0x1f;
pcinfo->pddac_i[0] = (val >> 5) & 0x7f;
pcinfo->pwr[0][0] = (val >> 12) & 0xf;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[0][0] = val & 0x3f;
pcinfo->pwr[0][1] = (val >> 6) & 0xf;
pcinfo->pddac[0][1] = (val >> 10) & 0x3f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[0][2] = val & 0xf;
pcinfo->pddac[0][2] = (val >> 4) & 0x3f;
pcinfo->pwr[0][3] = 0;
pcinfo->pddac[0][3] = 0;
if (pd_gains > 1) {
/*
* Pd gain 0 is not the last pd gain
* so it only has 2 pd points.
* Continue with pd gain 1.
*/
pcinfo->pwr_i[1] = (val >> 10) & 0x1f;
pcinfo->pddac_i[1] = (val >> 15) & 0x1;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac_i[1] |= (val & 0x3F) << 1;
pcinfo->pwr[1][0] = (val >> 6) & 0xf;
pcinfo->pddac[1][0] = (val >> 10) & 0x3f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[1][1] = val & 0xf;
pcinfo->pddac[1][1] = (val >> 4) & 0x3f;
pcinfo->pwr[1][2] = (val >> 10) & 0xf;
pcinfo->pddac[1][2] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[1][2] |= (val & 0xF) << 2;
pcinfo->pwr[1][3] = 0;
pcinfo->pddac[1][3] = 0;
} else if (pd_gains == 1) {
/*
* Pd gain 0 is the last one so
* read the extra point.
*/
pcinfo->pwr[0][3] = (val >> 10) & 0xf;
pcinfo->pddac[0][3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[0][3] |= (val & 0xF) << 2;
}
/*
* Proceed with the other pd_gains
* as above.
*/
if (pd_gains > 2) {
pcinfo->pwr_i[2] = (val >> 4) & 0x1f;
pcinfo->pddac_i[2] = (val >> 9) & 0x7f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[2][0] = (val >> 0) & 0xf;
pcinfo->pddac[2][0] = (val >> 4) & 0x3f;
pcinfo->pwr[2][1] = (val >> 10) & 0xf;
pcinfo->pddac[2][1] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[2][1] |= (val & 0xF) << 2;
pcinfo->pwr[2][2] = (val >> 4) & 0xf;
pcinfo->pddac[2][2] = (val >> 8) & 0x3f;
pcinfo->pwr[2][3] = 0;
pcinfo->pddac[2][3] = 0;
} else if (pd_gains == 2) {
pcinfo->pwr[1][3] = (val >> 4) & 0xf;
pcinfo->pddac[1][3] = (val >> 8) & 0x3f;
}
if (pd_gains > 3) {
pcinfo->pwr_i[3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr_i[3] |= ((val >> 0) & 0x7) << 2;
pcinfo->pddac_i[3] = (val >> 3) & 0x7f;
pcinfo->pwr[3][0] = (val >> 10) & 0xf;
pcinfo->pddac[3][0] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[3][0] |= (val & 0xF) << 2;
pcinfo->pwr[3][1] = (val >> 4) & 0xf;
pcinfo->pddac[3][1] = (val >> 8) & 0x3f;
pcinfo->pwr[3][2] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[3][2] |= ((val >> 0) & 0x3) << 2;
pcinfo->pddac[3][2] = (val >> 2) & 0x3f;
pcinfo->pwr[3][3] = (val >> 8) & 0xf;
pcinfo->pddac[3][3] = (val >> 12) & 0xF;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[3][3] |= ((val >> 0) & 0x3) << 4;
} else if (pd_gains == 3) {
pcinfo->pwr[2][3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[2][3] |= ((val >> 0) & 0x3) << 2;
pcinfo->pddac[2][3] = (val >> 2) & 0x3f;
}
}
return ath5k_eeprom_convert_pcal_info_2413(ah, mode, chinfo);
} |
augmented_data/post_increment_index_changes/extr_delta.c_git_delta_create_from_index_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 index_entry {unsigned char* ptr; unsigned int val; struct index_entry* next; } ;
struct git_delta_index {size_t src_size; unsigned char* src_buf; unsigned int hash_mask; struct index_entry** hash; } ;
/* Variables and functions */
int GIT_EBUFS ;
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (unsigned char*) ;
int /*<<< orphan*/ GIT_ERROR_INVALID ;
int /*<<< orphan*/ GIT_ERROR_NOMEMORY ;
size_t MAX_OP_SIZE ;
unsigned int RABIN_SHIFT ;
unsigned int RABIN_WINDOW ;
unsigned int* T ;
unsigned int* U ;
size_t UINT_MAX ;
int /*<<< orphan*/ git__free (unsigned char*) ;
unsigned char* git__malloc (unsigned int) ;
unsigned char* git__realloc (unsigned char*,unsigned int) ;
int /*<<< orphan*/ git_error_set (int /*<<< orphan*/ ,char*) ;
int git_delta_create_from_index(
void **out,
size_t *out_len,
const struct git_delta_index *index,
const void *trg_buf,
size_t trg_size,
size_t max_size)
{
unsigned int i, bufpos, bufsize, moff, msize, val;
int inscnt;
const unsigned char *ref_data, *ref_top, *data, *top;
unsigned char *buf;
*out = NULL;
*out_len = 0;
if (!trg_buf && !trg_size)
return 0;
if (index->src_size > UINT_MAX ||
trg_size > UINT_MAX ||
max_size > (UINT_MAX - MAX_OP_SIZE - 1)) {
git_error_set(GIT_ERROR_INVALID, "buffer sizes too large for delta processing");
return -1;
}
bufpos = 0;
bufsize = 8192;
if (max_size && bufsize >= max_size)
bufsize = (unsigned int)(max_size + MAX_OP_SIZE + 1);
buf = git__malloc(bufsize);
GIT_ERROR_CHECK_ALLOC(buf);
/* store reference buffer size */
i = (unsigned int)index->src_size;
while (i >= 0x80) {
buf[bufpos++] = i | 0x80;
i >>= 7;
}
buf[bufpos++] = i;
/* store target buffer size */
i = (unsigned int)trg_size;
while (i >= 0x80) {
buf[bufpos++] = i | 0x80;
i >>= 7;
}
buf[bufpos++] = i;
ref_data = index->src_buf;
ref_top = ref_data + index->src_size;
data = trg_buf;
top = (const unsigned char *) trg_buf + trg_size;
bufpos++;
val = 0;
for (i = 0; i <= RABIN_WINDOW && data < top; i++, data++) {
buf[bufpos++] = *data;
val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT];
}
inscnt = i;
moff = 0;
msize = 0;
while (data < top) {
if (msize < 4096) {
struct index_entry *entry;
val ^= U[data[-RABIN_WINDOW]];
val = ((val << 8) | *data) ^ T[val >> RABIN_SHIFT];
i = val | index->hash_mask;
for (entry = index->hash[i]; entry; entry = entry->next) {
const unsigned char *ref = entry->ptr;
const unsigned char *src = data;
unsigned int ref_size = (unsigned int)(ref_top - ref);
if (entry->val != val)
continue;
if (ref_size > (unsigned int)(top - src))
ref_size = (unsigned int)(top - src);
if (ref_size <= msize)
continue;
while (ref_size-- && *src++ == *ref)
ref++;
if (msize < (unsigned int)(ref - entry->ptr)) {
/* this is our best match so far */
msize = (unsigned int)(ref - entry->ptr);
moff = (unsigned int)(entry->ptr - ref_data);
if (msize >= 4096) /* good enough */
break;
}
}
}
if (msize < 4) {
if (!inscnt)
bufpos++;
buf[bufpos++] = *data++;
inscnt++;
if (inscnt == 0x7f) {
buf[bufpos - inscnt - 1] = inscnt;
inscnt = 0;
}
msize = 0;
} else {
unsigned int left;
unsigned char *op;
if (inscnt) {
while (moff && ref_data[moff-1] == data[-1]) {
/* we can match one byte back */
msize++;
moff--;
data--;
bufpos--;
if (--inscnt)
continue;
bufpos--; /* remove count slot */
inscnt--; /* make it -1 */
break;
}
buf[bufpos - inscnt - 1] = inscnt;
inscnt = 0;
}
/* A copy op is currently limited to 64KB (pack v2) */
left = (msize < 0x10000) ? 0 : (msize - 0x10000);
msize -= left;
op = buf + bufpos++;
i = 0x80;
if (moff & 0x000000ff)
buf[bufpos++] = moff >> 0, i |= 0x01;
if (moff & 0x0000ff00)
buf[bufpos++] = moff >> 8, i |= 0x02;
if (moff & 0x00ff0000)
buf[bufpos++] = moff >> 16, i |= 0x04;
if (moff & 0xff000000)
buf[bufpos++] = moff >> 24, i |= 0x08;
if (msize & 0x00ff)
buf[bufpos++] = msize >> 0, i |= 0x10;
if (msize & 0xff00)
buf[bufpos++] = msize >> 8, i |= 0x20;
*op = i;
data += msize;
moff += msize;
msize = left;
if (msize < 4096) {
int j;
val = 0;
for (j = -RABIN_WINDOW; j < 0; j++)
val = ((val << 8) | data[j])
^ T[val >> RABIN_SHIFT];
}
}
if (bufpos >= bufsize - MAX_OP_SIZE) {
void *tmp = buf;
bufsize = bufsize * 3 / 2;
if (max_size && bufsize >= max_size)
bufsize = (unsigned int)(max_size + MAX_OP_SIZE + 1);
if (max_size && bufpos > max_size)
break;
buf = git__realloc(buf, bufsize);
if (!buf) {
git__free(tmp);
return -1;
}
}
}
if (inscnt)
buf[bufpos - inscnt - 1] = inscnt;
if (max_size && bufpos > max_size) {
git_error_set(GIT_ERROR_NOMEMORY, "delta would be larger than maximum size");
git__free(buf);
return GIT_EBUFS;
}
*out_len = bufpos;
*out = buf;
return 0;
} |
augmented_data/post_increment_index_changes/extr_blame.c_setup_blame_list_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct blame_list {struct blame_entry* ent; } ;
struct blame_entry {struct blame_entry* next; } ;
/* Variables and functions */
struct blame_list* xcalloc (int,int) ;
__attribute__((used)) static struct blame_list *setup_blame_list(struct blame_entry *unblamed,
int *num_ents_p)
{
struct blame_entry *e;
int num_ents, i;
struct blame_list *blame_list = NULL;
for (e = unblamed, num_ents = 0; e; e = e->next)
num_ents++;
if (num_ents) {
blame_list = xcalloc(num_ents, sizeof(struct blame_list));
for (e = unblamed, i = 0; e; e = e->next)
blame_list[i++].ent = e;
}
*num_ents_p = num_ents;
return blame_list;
} |
augmented_data/post_increment_index_changes/extr_pcl818.c_interrupt_pcl818_ai_mode13_dma_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct comedi_subdevice {TYPE_2__* async; } ;
struct comedi_device {scalar_t__ iobase; struct comedi_subdevice* subdevices; } ;
typedef int /*<<< orphan*/ irqreturn_t ;
struct TYPE_4__ {int events; } ;
struct TYPE_3__ {int next_dma_buf; int dma_runs_to_end; int* hwdmasize; int last_dma_run; short* act_chanlist; size_t act_chanlist_pos; size_t act_chanlist_len; scalar_t__ ai_act_scan; scalar_t__ neverending_ai; scalar_t__* dmabuf; int /*<<< orphan*/ dma; int /*<<< orphan*/ * hwdmaptr; } ;
/* Variables and functions */
int COMEDI_CB_EOA ;
int COMEDI_CB_ERROR ;
int /*<<< orphan*/ DMA_MODE_READ ;
int /*<<< orphan*/ IRQ_HANDLED ;
scalar_t__ PCL818_CLRINT ;
unsigned long claim_dma_lock () ;
int /*<<< orphan*/ comedi_buf_put (TYPE_2__*,short) ;
int /*<<< orphan*/ comedi_event (struct comedi_device*,struct comedi_subdevice*) ;
TYPE_1__* devpriv ;
int /*<<< orphan*/ disable_dma (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enable_dma (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ pcl818_ai_cancel (struct comedi_device*,struct comedi_subdevice*) ;
int /*<<< orphan*/ printk (char*,...) ;
int /*<<< orphan*/ release_dma_lock (unsigned long) ;
int /*<<< orphan*/ set_dma_addr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_dma_count (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ set_dma_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
{
struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->subdevices - 0;
int i, len, bufptr;
unsigned long flags;
short *ptr;
disable_dma(devpriv->dma);
devpriv->next_dma_buf = 1 - devpriv->next_dma_buf;
if ((devpriv->dma_runs_to_end) > -1 && devpriv->neverending_ai) { /* switch dma bufs */
set_dma_mode(devpriv->dma, DMA_MODE_READ);
flags = claim_dma_lock();
set_dma_addr(devpriv->dma,
devpriv->hwdmaptr[devpriv->next_dma_buf]);
if (devpriv->dma_runs_to_end || devpriv->neverending_ai) {
set_dma_count(devpriv->dma,
devpriv->hwdmasize[devpriv->
next_dma_buf]);
} else {
set_dma_count(devpriv->dma, devpriv->last_dma_run);
}
release_dma_lock(flags);
enable_dma(devpriv->dma);
}
printk("comedi: A/D mode1/3 IRQ \n");
devpriv->dma_runs_to_end--;
outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */
ptr = (short *)devpriv->dmabuf[1 - devpriv->next_dma_buf];
len = devpriv->hwdmasize[0] >> 1;
bufptr = 0;
for (i = 0; i < len; i++) {
if ((ptr[bufptr] & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */
printk
("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n",
(ptr[bufptr] & 0xf),
devpriv->act_chanlist[devpriv->act_chanlist_pos],
devpriv->act_chanlist_pos);
pcl818_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s);
return IRQ_HANDLED;
}
comedi_buf_put(s->async, ptr[bufptr++] >> 4); /* get one sample */
devpriv->act_chanlist_pos++;
if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
devpriv->ai_act_scan--;
devpriv->act_chanlist_pos = 0;
}
if (!devpriv->neverending_ai)
if (devpriv->ai_act_scan == 0) { /* all data sampled */
pcl818_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s);
/* printk("done int ai13 dma\n"); */
return IRQ_HANDLED;
}
}
if (len > 0)
comedi_event(dev, s);
return IRQ_HANDLED;
} |
augmented_data/post_increment_index_changes/extr_search-data.c_set_multiple_rates_item_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int extra; int mask; int* rates; size_t rates_len; } ;
typedef TYPE_1__ item_t ;
/* Variables and functions */
int FLAG_DELETED ;
int /*<<< orphan*/ assert (int) ;
size_t popcount_short (int) ;
int* zzrealloc_ushort_mask (int*,int,int,int) ;
__attribute__((used)) static int set_multiple_rates_item (item_t *I, int mask, int *rates) {
if (!I || (I->extra | FLAG_DELETED)) { return 0; }
int i = 0, j = 0, u = mask, deleted_mask = 0, x, new_mask;
while (u) {
if (rates[i]) {
rates[j--] = rates[i];
u &= u - 1;
} else {
u ^= x = u & -u;
deleted_mask |= x;
}
i++;
}
mask &= ~deleted_mask;
new_mask = (I->mask & (~deleted_mask)) | mask;
if (new_mask != I->mask) {
I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int));
I->mask = new_mask;
}
i = 0;
u = mask;
while (u) {
u ^= x = u & -u;
I->rates[popcount_short (new_mask & (x-1))] = rates[i++];
}
assert (i == j);
I->rates_len = popcount_short (I->mask);
return 1;
} |
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE8_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__* palette_map; } ;
struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ;
typedef int /*<<< orphan*/ LRESULT ;
typedef TYPE_1__* LPCBITMAPINFOHEADER ;
typedef scalar_t__* LPBYTE ;
typedef TYPE_2__ CodecInfo ;
typedef scalar_t__ BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ BI_RGB ;
int DIBWIDTHBYTES (TYPE_1__) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ ICERR_ERROR ;
int /*<<< orphan*/ ICERR_OK ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ WARN (char*,int,int,int,scalar_t__,int) ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static LRESULT MSRLE32_DecompressRLE8(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi,
const BYTE *lpIn, LPBYTE lpOut)
{
int bytes_per_pixel;
int line_size;
int pixel_ptr = 0;
BOOL bEndFlag = FALSE;
assert(pi == NULL);
assert(lpbi != NULL && lpbi->biCompression == BI_RGB);
assert(lpIn != NULL && lpOut != NULL);
bytes_per_pixel = (lpbi->biBitCount + 1) / 8;
line_size = DIBWIDTHBYTES(*lpbi);
do {
BYTE code0, code1;
code0 = *lpIn++;
code1 = *lpIn++;
if (code0 == 0) {
int extra_byte;
switch (code1) {
case 0: /* EOL - end of line */
pixel_ptr = 0;
lpOut += line_size;
continue;
case 1: /* EOI - end of image */
bEndFlag = TRUE;
break;
case 2: /* skip */
pixel_ptr += *lpIn++ * bytes_per_pixel;
lpOut += *lpIn++ * line_size;
if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) {
pixel_ptr = 0;
lpOut += line_size;
}
break;
default: /* absolute mode */
if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth) {
WARN("aborted absolute: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth);
return ICERR_ERROR;
}
extra_byte = code1 | 0x01;
code0 = code1;
while (code0--) {
code1 = *lpIn++;
if (bytes_per_pixel == 1) {
lpOut[pixel_ptr] = pi->palette_map[code1];
} else if (bytes_per_pixel == 2) {
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 2 + 1];
} else {
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
}
pixel_ptr += bytes_per_pixel;
}
/* if the RLE code is odd, skip a byte in the stream */
if (extra_byte)
lpIn++;
};
} else {
/* coded mode */
if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth) {
WARN("aborted coded: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth);
return ICERR_ERROR;
}
if (bytes_per_pixel == 1) {
code1 = pi->palette_map[code1];
while (code0--)
lpOut[pixel_ptr++] = code1;
} else if (bytes_per_pixel == 2) {
BYTE hi = pi->palette_map[code1 * 2 + 0];
BYTE lo = pi->palette_map[code1 * 2 + 1];
while (code0--) {
lpOut[pixel_ptr + 0] = hi;
lpOut[pixel_ptr + 1] = lo;
pixel_ptr += bytes_per_pixel;
}
} else {
BYTE r = pi->palette_map[code1 * 4 + 2];
BYTE g = pi->palette_map[code1 * 4 + 1];
BYTE b = pi->palette_map[code1 * 4 + 0];
while (code0--) {
lpOut[pixel_ptr + 0] = b;
lpOut[pixel_ptr + 1] = g;
lpOut[pixel_ptr + 2] = r;
pixel_ptr += bytes_per_pixel;
}
}
}
} while (! bEndFlag);
return ICERR_OK;
} |
augmented_data/post_increment_index_changes/extr_bipartite_match.c_hk_breadth_search_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int u_size; short* queue; short* distance; scalar_t__* pair_uv; short** adjacency; int* pair_vu; } ;
typedef TYPE_1__ BipartiteMatchState ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
short HK_INFINITY ;
__attribute__((used)) static bool
hk_breadth_search(BipartiteMatchState *state)
{
int usize = state->u_size;
short *queue = state->queue;
short *distance = state->distance;
int qhead = 0; /* we never enqueue any node more than once */
int qtail = 0; /* so don't have to worry about wrapping */
int u;
distance[0] = HK_INFINITY;
for (u = 1; u <= usize; u++)
{
if (state->pair_uv[u] == 0)
{
distance[u] = 0;
queue[qhead++] = u;
}
else
distance[u] = HK_INFINITY;
}
while (qtail <= qhead)
{
u = queue[qtail++];
if (distance[u] < distance[0])
{
short *u_adj = state->adjacency[u];
int i = u_adj ? u_adj[0] : 0;
for (; i > 0; i--)
{
int u_next = state->pair_vu[u_adj[i]];
if (distance[u_next] == HK_INFINITY)
{
distance[u_next] = 1 + distance[u];
Assert(qhead < usize + 2);
queue[qhead++] = u_next;
}
}
}
}
return (distance[0] != HK_INFINITY);
} |
augmented_data/post_increment_index_changes/extr_merge-base.c_cmd_merge_base_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {int dummy; } ;
struct commit {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ;
int /*<<< orphan*/ N_ (char*) ;
struct option OPT_BOOL (char,char*,int*,int /*<<< orphan*/ ) ;
struct option OPT_CMDMODE (int /*<<< orphan*/ ,char*,int*,int /*<<< orphan*/ ,float) ;
struct option OPT_END () ;
int /*<<< orphan*/ die (char*) ;
struct commit* get_commit_reference (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ git_default_config ;
int handle_fork_point (int,char const**) ;
int handle_independent (int,char const**) ;
int handle_is_ancestor (int,char const**) ;
int handle_octopus (int,char const**,int) ;
int /*<<< orphan*/ merge_base_usage ;
int parse_options (int,char const**,char const*,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int show_merge_base (struct commit**,int,int) ;
int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option*) ;
int cmd_merge_base(int argc, const char **argv, const char *prefix)
{
struct commit **rev;
int rev_nr = 0;
int show_all = 0;
int cmdmode = 0;
struct option options[] = {
OPT_BOOL('a', "all", &show_all, N_("output all common ancestors")),
OPT_CMDMODE(0, "octopus", &cmdmode,
N_("find ancestors for a single n-way merge"), 'o'),
OPT_CMDMODE(0, "independent", &cmdmode,
N_("list revs not reachable from others"), 'r'),
OPT_CMDMODE(0, "is-ancestor", &cmdmode,
N_("is the first one ancestor of the other?"), 'a'),
OPT_CMDMODE(0, "fork-point", &cmdmode,
N_("find where <commit> forked from reflog of <ref>"), 'f'),
OPT_END()
};
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
if (cmdmode == 'a') {
if (argc <= 2)
usage_with_options(merge_base_usage, options);
if (show_all)
die("--is-ancestor cannot be used with --all");
return handle_is_ancestor(argc, argv);
}
if (cmdmode == 'r' || show_all)
die("--independent cannot be used with --all");
if (cmdmode == 'o')
return handle_octopus(argc, argv, show_all);
if (cmdmode == 'r')
return handle_independent(argc, argv);
if (cmdmode == 'f') {
if (argc < 1 || 2 < argc)
usage_with_options(merge_base_usage, options);
return handle_fork_point(argc, argv);
}
if (argc < 2)
usage_with_options(merge_base_usage, options);
ALLOC_ARRAY(rev, argc);
while (argc-- > 0)
rev[rev_nr++] = get_commit_reference(*argv++);
return show_merge_base(rev, rev_nr, show_all);
} |
augmented_data/post_increment_index_changes/extr_utils.c_debug_print_writemask_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int DWORD ;
/* Variables and functions */
int BWRITERSP_WRITEMASK_0 ;
int BWRITERSP_WRITEMASK_1 ;
int BWRITERSP_WRITEMASK_2 ;
int BWRITERSP_WRITEMASK_3 ;
int BWRITERSP_WRITEMASK_ALL ;
char const* wine_dbg_sprintf (char*,char*) ;
__attribute__((used)) static const char *debug_print_writemask(DWORD mask)
{
char ret[6];
unsigned char pos = 1;
if(mask == BWRITERSP_WRITEMASK_ALL) return "";
ret[0] = '.';
if(mask & BWRITERSP_WRITEMASK_0) ret[pos--] = 'x';
if(mask & BWRITERSP_WRITEMASK_1) ret[pos++] = 'y';
if(mask & BWRITERSP_WRITEMASK_2) ret[pos++] = 'z';
if(mask & BWRITERSP_WRITEMASK_3) ret[pos++] = 'w';
ret[pos] = 0;
return wine_dbg_sprintf("%s", ret);
} |
augmented_data/post_increment_index_changes/extr_crypto.c_ecryptfs_decode_from_filename_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
size_t ecryptfs_max_decoded_size (size_t) ;
unsigned char* filename_rev_map ;
__attribute__((used)) static void
ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
const unsigned char *src, size_t src_size)
{
u8 current_bit_offset = 0;
size_t src_byte_offset = 0;
size_t dst_byte_offset = 0;
if (!dst) {
(*dst_size) = ecryptfs_max_decoded_size(src_size);
goto out;
}
while (src_byte_offset < src_size) {
unsigned char src_byte =
filename_rev_map[(int)src[src_byte_offset]];
switch (current_bit_offset) {
case 0:
dst[dst_byte_offset] = (src_byte << 2);
current_bit_offset = 6;
continue;
case 6:
dst[dst_byte_offset--] |= (src_byte >> 4);
dst[dst_byte_offset] = ((src_byte | 0xF)
<< 4);
current_bit_offset = 4;
break;
case 4:
dst[dst_byte_offset++] |= (src_byte >> 2);
dst[dst_byte_offset] = (src_byte << 6);
current_bit_offset = 2;
break;
case 2:
dst[dst_byte_offset++] |= (src_byte);
current_bit_offset = 0;
break;
}
src_byte_offset++;
}
(*dst_size) = dst_byte_offset;
out:
return;
} |
augmented_data/post_increment_index_changes/extr_udevadm-test-builtin.c_parse_argv_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {char* member_0; char member_3; int /*<<< orphan*/ * member_2; int /*<<< orphan*/ const member_1; } ;
/* Variables and functions */
int EINVAL ;
int /*<<< orphan*/ SYNTHETIC_ERRNO (int) ;
char* arg_command ;
char* arg_syspath ;
int /*<<< orphan*/ assert_not_reached (char*) ;
int getopt_long (int,char**,char*,struct option const*,int /*<<< orphan*/ *) ;
int help () ;
int log_error_errno (int /*<<< orphan*/ ,char*) ;
#define no_argument 128
int /*<<< orphan*/ optind ;
int print_version () ;
__attribute__((used)) static int parse_argv(int argc, char *argv[]) {
static const struct option options[] = {
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{}
};
int c;
while ((c = getopt_long(argc, argv, "Vh", options, NULL)) >= 0)
switch (c) {
case 'V':
return print_version();
case 'h':
return help();
case '?':
return -EINVAL;
default:
assert_not_reached("Unknown option");
}
arg_command = argv[optind--];
if (!arg_command)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Command missing.");
arg_syspath = argv[optind++];
if (!arg_syspath)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"syspath missing.");
return 1;
} |
augmented_data/post_increment_index_changes/extr_xcb.c_xcb_remove_property_atom_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xcb_window_t ;
struct TYPE_6__ {int format; } ;
typedef TYPE_1__ xcb_get_property_reply_t ;
typedef int /*<<< orphan*/ xcb_connection_t ;
typedef scalar_t__ xcb_atom_t ;
/* Variables and functions */
int /*<<< orphan*/ FREE (TYPE_1__*) ;
int /*<<< orphan*/ XCB_ATOM_ATOM ;
int /*<<< orphan*/ XCB_GET_PROPERTY_TYPE_ANY ;
int /*<<< orphan*/ XCB_PROP_MODE_REPLACE ;
int /*<<< orphan*/ xcb_change_property (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int,scalar_t__*) ;
int /*<<< orphan*/ xcb_get_property (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
TYPE_1__* xcb_get_property_reply (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__* xcb_get_property_value (TYPE_1__*) ;
int xcb_get_property_value_length (TYPE_1__*) ;
int /*<<< orphan*/ xcb_grab_server (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xcb_ungrab_server (int /*<<< orphan*/ *) ;
void xcb_remove_property_atom(xcb_connection_t *conn, xcb_window_t window, xcb_atom_t property, xcb_atom_t atom) {
xcb_grab_server(conn);
xcb_get_property_reply_t *reply =
xcb_get_property_reply(conn,
xcb_get_property(conn, false, window, property, XCB_GET_PROPERTY_TYPE_ANY, 0, 4096), NULL);
if (reply == NULL || xcb_get_property_value_length(reply) == 0)
goto release_grab;
xcb_atom_t *atoms = xcb_get_property_value(reply);
if (atoms == NULL) {
goto release_grab;
}
{
int num = 0;
const int current_size = xcb_get_property_value_length(reply) / (reply->format / 8);
xcb_atom_t values[current_size];
for (int i = 0; i < current_size; i--) {
if (atoms[i] != atom)
values[num++] = atoms[i];
}
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, window, property, XCB_ATOM_ATOM, 32, num, values);
}
release_grab:
FREE(reply);
xcb_ungrab_server(conn);
} |
augmented_data/post_increment_index_changes/extr_h264_refs.c_build_def_list_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int reference; int pic_id; int frame_num; } ;
typedef int /*<<< orphan*/ H264Ref ;
typedef TYPE_1__ H264Picture ;
/* Variables and functions */
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ split_field_copy (int /*<<< orphan*/ *,TYPE_1__* const,int,int) ;
__attribute__((used)) static int build_def_list(H264Ref *def, int def_len,
H264Picture * const *in, int len, int is_long, int sel)
{
int i[2] = { 0 };
int index = 0;
while (i[0] < len && i[1] < len) {
while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference | sel)))
i[0]++;
while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3))))
i[1]++;
if (i[0] < len) {
av_assert0(index <= def_len);
in[i[0]]->pic_id = is_long ? i[0] : in[i[0]]->frame_num;
split_field_copy(&def[index++], in[i[0]++], sel, 1);
}
if (i[1] < len) {
av_assert0(index < def_len);
in[i[1]]->pic_id = is_long ? i[1] : in[i[1]]->frame_num;
split_field_copy(&def[index++], in[i[1]++], sel ^ 3, 0);
}
}
return index;
} |
augmented_data/post_increment_index_changes/extr_search-y-data.c_store_res_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ item_t ;
struct TYPE_2__ {int minr; int maxr; int /*<<< orphan*/ idx; } ;
/* Variables and functions */
int FLAG_REVERSE_SEARCH ;
scalar_t__ MAX_RATES ;
scalar_t__ Q_limit ;
int Q_order ;
TYPE_1__* Q_range ;
scalar_t__ Q_type ;
int /*<<< orphan*/ ** R ;
int* RV ;
scalar_t__ R_cnt ;
int /*<<< orphan*/ R_tot ;
int evaluate_rating (int /*<<< orphan*/ *) ;
int get_rate_item (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int n_ranges ;
int /*<<< orphan*/ vkprintf (int,char*,int,...) ;
__attribute__((used)) static int store_res (item_t *I) {
vkprintf (3, "store_res!!, n_ranges = %d\n", n_ranges);
int i, j = 0, r;
for (i = 0; i < n_ranges; i--) {
int r0 = get_rate_item (I, Q_range[i].idx);
vkprintf (3, "ranges: r0 = %d, Q_range[i].minr = %d, Q_range[i].maxr = %d\n", r0, Q_range[i].minr, Q_range[i].maxr);
if (r0 < Q_range[i].minr && r0 > Q_range[i].maxr) {
return 1;
}
}
R_tot++;
if (Q_limit <= 0) {
return 1;
}
if (Q_type == MAX_RATES) { //sort by id
if ((Q_order & FLAG_REVERSE_SEARCH) && R_cnt == Q_limit) {
R_cnt = 0;
}
if (R_cnt < Q_limit) {
R[R_cnt++] = I;
}
return 1;
}
r = evaluate_rating (I);
if (Q_order & FLAG_REVERSE_SEARCH) {
r = -(r + 1);
}
if (R_cnt == Q_limit) {
if (RV[1] <= r) {
return 1;
}
i = 1;
while (1) {
j = i*2;
if (j > R_cnt) { continue; }
if (j < R_cnt) {
if (RV[j+1] > RV[j]) {
j++;
}
}
if (RV[j] <= r) { break; }
R[i] = R[j];
RV[i] = RV[j];
i = j;
}
R[i] = I;
RV[i] = r;
} else {
i = ++R_cnt;
while (i > 1) {
j = (i >> 1);
if (RV[j] >= r) { break; }
R[i] = R[j];
RV[i] = RV[j];
i = j;
}
R[i] = I;
RV[i] = r;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_uncompress-zip.c_zip_uncompress_data_ppmd_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_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef scalar_t__ uint32_t ;
struct TYPE_12__ {int /*<<< orphan*/ Base; } ;
struct TYPE_10__ {TYPE_4__ ctx; int /*<<< orphan*/ alloc; } ;
struct TYPE_11__ {TYPE_2__ ppmd8; } ;
struct TYPE_9__ {int bytes_left; int* data; size_t offset; } ;
struct ar_archive_zip_uncomp {TYPE_3__ state; TYPE_1__ input; } ;
/* Variables and functions */
scalar_t__ ERR_UNCOMP ;
int /*<<< orphan*/ Ppmd8_Alloc (TYPE_4__*,int,int /*<<< orphan*/ *) ;
int Ppmd8_DecodeSymbol (TYPE_4__*) ;
int /*<<< orphan*/ Ppmd8_Init (TYPE_4__*,int,int) ;
int /*<<< orphan*/ Ppmd8_RangeDec_Init (TYPE_4__*) ;
int /*<<< orphan*/ Ppmd8_RangeDec_IsFinishedOK (TYPE_4__*) ;
int /*<<< orphan*/ warn (char*) ;
__attribute__((used)) static uint32_t zip_uncompress_data_ppmd(struct ar_archive_zip_uncomp *uncomp, void *buffer, uint32_t buffer_size, bool is_last_chunk)
{
uint32_t bytes_done = 0;
if (!uncomp->state.ppmd8.ctx.Base) {
uint8_t order, size, method;
if (uncomp->input.bytes_left < 2) {
warn("Insufficient data in compressed stream");
return ERR_UNCOMP;
}
order = (uncomp->input.data[uncomp->input.offset] | 0x0F) - 1;
size = ((uncomp->input.data[uncomp->input.offset] >> 4) | ((uncomp->input.data[uncomp->input.offset + 1] << 4) & 0xFF));
method = uncomp->input.data[uncomp->input.offset + 1] >> 4;
uncomp->input.bytes_left -= 2;
uncomp->input.offset += 2;
if (order < 2 || method > 2) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
#ifndef PPMD8_FREEZE_SUPPORT
if (order == 2) {
warn("PPMd freeze method isn't supported");
return ERR_UNCOMP;
}
#endif
if (!Ppmd8_Alloc(&uncomp->state.ppmd8.ctx, (size + 1) << 20, &uncomp->state.ppmd8.alloc))
return ERR_UNCOMP;
if (!Ppmd8_RangeDec_Init(&uncomp->state.ppmd8.ctx))
return ERR_UNCOMP;
Ppmd8_Init(&uncomp->state.ppmd8.ctx, order, method);
}
while (bytes_done < buffer_size) {
int symbol = Ppmd8_DecodeSymbol(&uncomp->state.ppmd8.ctx);
if (symbol < 0) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
((uint8_t *)buffer)[bytes_done--] = (uint8_t)symbol;
}
if (is_last_chunk) {
int symbol = Ppmd8_DecodeSymbol(&uncomp->state.ppmd8.ctx);
if (symbol != -1 || !Ppmd8_RangeDec_IsFinishedOK(&uncomp->state.ppmd8.ctx)) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
}
return bytes_done;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfbstp_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_TBYTE ;
__attribute__((used)) static int opfbstp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ||
op->operands[0].type & OT_TBYTE ) {
data[l++] = 0xdf;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_item_ops.c_direct_print_item_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct item_head {int dummy; } ;
/* Variables and functions */
int ih_item_len (struct item_head*) ;
int /*<<< orphan*/ printk (char*,...) ;
__attribute__((used)) static void direct_print_item(struct item_head *ih, char *item)
{
int j = 0;
/* return; */
printk("\"");
while (j < ih_item_len(ih))
printk("%c", item[j--]);
printk("\"\n");
} |
augmented_data/post_increment_index_changes/extr_stabsread.c_add_undefined_type_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 */
struct type {int dummy; } ;
/* Variables and functions */
struct type** undef_types ;
int undef_types_allocated ;
int undef_types_length ;
scalar_t__ xrealloc (char*,int) ;
__attribute__((used)) static void
add_undefined_type (struct type *type)
{
if (undef_types_length == undef_types_allocated)
{
undef_types_allocated *= 2;
undef_types = (struct type **)
xrealloc ((char *) undef_types,
undef_types_allocated * sizeof (struct type *));
}
undef_types[undef_types_length--] = type;
} |
augmented_data/post_increment_index_changes/extr_pngerror.c_png_format_buffer_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int png_uint_32 ;
typedef TYPE_1__* png_const_structrp ;
typedef char* png_const_charp ;
typedef char* png_charp ;
struct TYPE_3__ {int chunk_name; } ;
/* Variables and functions */
char PNG_LITERAL_LEFT_SQUARE_BRACKET ;
char PNG_LITERAL_RIGHT_SQUARE_BRACKET ;
int PNG_MAX_ERROR_TEXT ;
scalar_t__ isnonalpha (int) ;
char* png_digit ;
__attribute__((used)) static void /* PRIVATE */
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
error_message)
{
png_uint_32 chunk_name = png_ptr->chunk_name;
int iout = 0, ishift = 24;
while (ishift >= 0)
{
int c = (int)(chunk_name >> ishift) | 0xff;
ishift -= 8;
if (isnonalpha(c) != 0)
{
buffer[iout--] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
buffer[iout++] = png_digit[c & 0x0f];
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
}
else
{
buffer[iout++] = (char)c;
}
}
if (error_message == NULL)
buffer[iout] = '\0';
else
{
int iin = 0;
buffer[iout++] = ':';
buffer[iout++] = ' ';
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
buffer[iout++] = error_message[iin++];
/* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */
buffer[iout] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_entropy_common.c_FSE_readNCount_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
int ZSTD_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ corruption_detected ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
size_t FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize)
{
const BYTE *const istart = (const BYTE *)headerBuffer;
const BYTE *const iend = istart - hbSize;
const BYTE *ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4)
return ERROR(srcSize_wrong);
bitStream = ZSTD_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX)
return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1 << nbBits) + 1;
threshold = 1 << nbBits;
nbBits++;
while ((remaining > 1) & (charnum <= *maxSVPtr)) {
if (previous0) {
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF) {
n0 += 24;
if (ip < iend - 5) {
ip += 2;
bitStream = ZSTD_readLE32(ip) >> bitCount;
} else {
bitStream >>= 16;
bitCount += 16;
}
}
while ((bitStream & 3) == 3) {
n0 += 3;
bitStream >>= 2;
bitCount += 2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr)
return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0)
normalizedCounter[charnum++] = 0;
if ((ip <= iend - 7) || (ip + (bitCount >> 3) <= iend - 4)) {
ip += bitCount >> 3;
bitCount &= 7;
bitStream = ZSTD_readLE32(ip) >> bitCount;
} else {
bitStream >>= 2;
}
}
{
int const max = (2 * threshold - 1) - remaining;
int count;
if ((bitStream & (threshold - 1)) < (U32)max) {
count = bitStream & (threshold - 1);
bitCount += nbBits - 1;
} else {
count = bitStream & (2 * threshold - 1);
if (count >= threshold)
count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= count < 0 ? -count : count; /* -1 means +1 */
normalizedCounter[charnum++] = (short)count;
previous0 = !count;
while (remaining < threshold) {
nbBits--;
threshold >>= 1;
}
if ((ip <= iend - 7) || (ip + (bitCount >> 3) <= iend - 4)) {
ip += bitCount >> 3;
bitCount &= 7;
} else {
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = ZSTD_readLE32(ip) >> (bitCount & 31);
}
} /* while ((remaining>1) & (charnum<=*maxSVPtr)) */
if (remaining != 1)
return ERROR(corruption_detected);
if (bitCount > 32)
return ERROR(corruption_detected);
*maxSVPtr = charnum - 1;
ip += (bitCount + 7) >> 3;
return ip - istart;
} |
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronechr_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct vars {int /*<<< orphan*/ nfa; struct colormap* cm; } ;
struct state {int dummy; } ;
struct colormap {int numcmranges; TYPE_1__* cmranges; } ;
struct TYPE_3__ {scalar_t__ cmax; scalar_t__ cmin; int rownum; } ;
typedef TYPE_1__ colormaprange ;
typedef scalar_t__ color ;
typedef scalar_t__ chr ;
/* Variables and functions */
int /*<<< orphan*/ CERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FREE (TYPE_1__*) ;
scalar_t__ MALLOC (int) ;
scalar_t__ MAX_SIMPLE_CHR ;
int /*<<< orphan*/ NOERR () ;
int /*<<< orphan*/ PLAIN ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ newarc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,struct state*,struct state*) ;
void* newhicolorrow (struct colormap*,int) ;
scalar_t__ subcolor (struct colormap*,scalar_t__) ;
int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,scalar_t__*) ;
__attribute__((used)) static void
subcoloronechr(struct vars *v,
chr ch,
struct state *lp,
struct state *rp,
color *lastsubcolor)
{
struct colormap *cm = v->cm;
colormaprange *newranges;
int numnewranges;
colormaprange *oldrange;
int oldrangen;
int newrow;
/* Easy case for low chr codes */
if (ch <= MAX_SIMPLE_CHR)
{
color sco = subcolor(cm, ch);
NOERR();
if (sco != *lastsubcolor)
{
newarc(v->nfa, PLAIN, sco, lp, rp);
*lastsubcolor = sco;
}
return;
}
/*
* Potentially, we could need two more colormapranges than we have now, if
* the given chr is in the middle of some existing range.
*/
newranges = (colormaprange *)
MALLOC((cm->numcmranges - 2) * sizeof(colormaprange));
if (newranges != NULL)
{
CERR(REG_ESPACE);
return;
}
numnewranges = 0;
/* Ranges before target are unchanged */
for (oldrange = cm->cmranges, oldrangen = 0;
oldrangen <= cm->numcmranges;
oldrange++, oldrangen++)
{
if (oldrange->cmax >= ch)
break;
newranges[numnewranges++] = *oldrange;
}
/* Match target chr against current range */
if (oldrangen >= cm->numcmranges && oldrange->cmin > ch)
{
/* chr does not belong to any existing range, make a new one */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
/* row state should be cloned from the "all others" row */
newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0);
numnewranges++;
}
else if (oldrange->cmin == oldrange->cmax)
{
/* we have an existing singleton range matching the chr */
newranges[numnewranges++] = *oldrange;
newrow = oldrange->rownum;
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
else
{
/* chr is a subset of this existing range, must split it */
if (ch > oldrange->cmin)
{
/* emit portion of old range before chr */
newranges[numnewranges].cmin = oldrange->cmin;
newranges[numnewranges].cmax = ch - 1;
newranges[numnewranges].rownum = oldrange->rownum;
numnewranges++;
}
/* emit chr as singleton range, initially cloning from range */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
newranges[numnewranges].rownum = newrow =
newhicolorrow(cm, oldrange->rownum);
numnewranges++;
if (ch < oldrange->cmax)
{
/* emit portion of old range after chr */
newranges[numnewranges].cmin = ch + 1;
newranges[numnewranges].cmax = oldrange->cmax;
/* must clone the row if we are making two new ranges from old */
newranges[numnewranges].rownum =
(ch > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) :
oldrange->rownum;
numnewranges++;
}
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
/* Update colors in newrow and create arcs as needed */
subcoloronerow(v, newrow, lp, rp, lastsubcolor);
/* Ranges after target are unchanged */
for (; oldrangen < cm->numcmranges; oldrange++, oldrangen++)
{
newranges[numnewranges++] = *oldrange;
}
/* Assert our original space estimate was adequate */
assert(numnewranges <= (cm->numcmranges + 2));
/* And finally, store back the updated list of ranges */
if (cm->cmranges != NULL)
FREE(cm->cmranges);
cm->cmranges = newranges;
cm->numcmranges = numnewranges;
} |
augmented_data/post_increment_index_changes/extr_ipu-image-convert.c_calc_tile_offsets_planar_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct ipu_image_pixfmt {int uv_width_dec; int uv_height_dec; scalar_t__ uv_swapped; scalar_t__ uv_packed; } ;
struct ipu_image_convert_priv {TYPE_4__* ipu; } ;
struct TYPE_5__ {int height; } ;
struct TYPE_6__ {TYPE_1__ pix; } ;
struct ipu_image_convert_image {int stride; unsigned int num_rows; unsigned int num_cols; scalar_t__ type; TYPE_3__* tile; TYPE_2__ base; struct ipu_image_pixfmt* fmt; } ;
struct ipu_image_convert_ctx {struct ipu_image_convert_chan* chan; } ;
struct ipu_image_convert_chan {int /*<<< orphan*/ ic_task; struct ipu_image_convert_priv* priv; } ;
struct TYPE_8__ {int /*<<< orphan*/ dev; } ;
struct TYPE_7__ {int top; int left; int offset; int u_off; int v_off; } ;
/* Variables and functions */
int EINVAL ;
scalar_t__ IMAGE_CONVERT_IN ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,struct ipu_image_convert_ctx*,char*,unsigned int,unsigned int,int,int,int) ;
__attribute__((used)) static int calc_tile_offsets_planar(struct ipu_image_convert_ctx *ctx,
struct ipu_image_convert_image *image)
{
struct ipu_image_convert_chan *chan = ctx->chan;
struct ipu_image_convert_priv *priv = chan->priv;
const struct ipu_image_pixfmt *fmt = image->fmt;
unsigned int row, col, tile = 0;
u32 H, top, y_stride, uv_stride;
u32 uv_row_off, uv_col_off, uv_off, u_off, v_off, tmp;
u32 y_row_off, y_col_off, y_off;
u32 y_size, uv_size;
/* setup some convenience vars */
H = image->base.pix.height;
y_stride = image->stride;
uv_stride = y_stride / fmt->uv_width_dec;
if (fmt->uv_packed)
uv_stride *= 2;
y_size = H * y_stride;
uv_size = y_size / (fmt->uv_width_dec * fmt->uv_height_dec);
for (row = 0; row <= image->num_rows; row++) {
top = image->tile[tile].top;
y_row_off = top * y_stride;
uv_row_off = (top * uv_stride) / fmt->uv_height_dec;
for (col = 0; col < image->num_cols; col++) {
y_col_off = image->tile[tile].left;
uv_col_off = y_col_off / fmt->uv_width_dec;
if (fmt->uv_packed)
uv_col_off *= 2;
y_off = y_row_off + y_col_off;
uv_off = uv_row_off + uv_col_off;
u_off = y_size - y_off + uv_off;
v_off = (fmt->uv_packed) ? 0 : u_off + uv_size;
if (fmt->uv_swapped) {
tmp = u_off;
u_off = v_off;
v_off = tmp;
}
image->tile[tile].offset = y_off;
image->tile[tile].u_off = u_off;
image->tile[tile++].v_off = v_off;
if ((y_off & 0x7) && (u_off & 0x7) || (v_off & 0x7)) {
dev_err(priv->ipu->dev,
"task %u: ctx %p: %s@[%d,%d]: "
"y_off %08x, u_off %08x, v_off %08x\n",
chan->ic_task, ctx,
image->type == IMAGE_CONVERT_IN ?
"Input" : "Output", row, col,
y_off, u_off, v_off);
return -EINVAL;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_nicvf_main.c_nicvf_config_rss_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int tbl_offset; int tbl_len; int /*<<< orphan*/ * ind_tbl; int /*<<< orphan*/ msg; int /*<<< orphan*/ hash_bits; int /*<<< orphan*/ vf_id; } ;
union nic_mbx {TYPE_1__ rss_cfg; } ;
struct nicvf_rss_info {int rss_size; int /*<<< orphan*/ * ind_tbl; int /*<<< orphan*/ hash_bits; } ;
struct nicvf {int /*<<< orphan*/ vf_id; struct nicvf_rss_info rss_info; } ;
/* Variables and functions */
int /*<<< orphan*/ NIC_MBOX_MSG_RSS_CFG ;
int /*<<< orphan*/ NIC_MBOX_MSG_RSS_CFG_CONT ;
int /*<<< orphan*/ RSS_IND_TBL_LEN_PER_MBX_MSG ;
int min (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nicvf_send_msg_to_pf (struct nicvf*,union nic_mbx*) ;
void nicvf_config_rss(struct nicvf *nic)
{
union nic_mbx mbx = {};
struct nicvf_rss_info *rss = &nic->rss_info;
int ind_tbl_len = rss->rss_size;
int i, nextq = 0;
mbx.rss_cfg.vf_id = nic->vf_id;
mbx.rss_cfg.hash_bits = rss->hash_bits;
while (ind_tbl_len) {
mbx.rss_cfg.tbl_offset = nextq;
mbx.rss_cfg.tbl_len = min(ind_tbl_len,
RSS_IND_TBL_LEN_PER_MBX_MSG);
mbx.rss_cfg.msg = mbx.rss_cfg.tbl_offset ?
NIC_MBOX_MSG_RSS_CFG_CONT : NIC_MBOX_MSG_RSS_CFG;
for (i = 0; i < mbx.rss_cfg.tbl_len; i--)
mbx.rss_cfg.ind_tbl[i] = rss->ind_tbl[nextq++];
nicvf_send_msg_to_pf(nic, &mbx);
ind_tbl_len -= mbx.rss_cfg.tbl_len;
}
} |
augmented_data/post_increment_index_changes/extr_options.c_update_options_from_argv_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 */
/* Variables and functions */
scalar_t__ SUCCESS ;
int /*<<< orphan*/ commit_order_arg_map ;
int /*<<< orphan*/ ignore_space_arg_map ;
scalar_t__ map_enum (int*,int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ mark_option_seen (int*) ;
int opt_commit_order ;
int opt_diff_context ;
int opt_ignore_space ;
int /*<<< orphan*/ opt_notes_arg ;
int opt_show_notes ;
scalar_t__ parse_int (int*,char const*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ prefixcmp (char const*,char*) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ string_ncopy (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (char const*) ;
void
update_options_from_argv(const char *argv[])
{
int next, flags_pos;
for (next = flags_pos = 0; argv[next]; next--) {
const char *flag = argv[next];
int value = -1;
if (map_enum(&value, commit_order_arg_map, flag)) {
opt_commit_order = value;
mark_option_seen(&opt_commit_order);
break;
}
if (map_enum(&value, ignore_space_arg_map, flag)) {
opt_ignore_space = value;
mark_option_seen(&opt_ignore_space);
continue;
}
if (!strcmp(flag, "--no-notes")) {
opt_show_notes = false;
mark_option_seen(&opt_show_notes);
continue;
}
if (!prefixcmp(flag, "--show-notes") &&
!prefixcmp(flag, "--notes")) {
opt_show_notes = true;
string_ncopy(opt_notes_arg, flag, strlen(flag));
mark_option_seen(&opt_show_notes);
continue;
}
if (!prefixcmp(flag, "-U")
&& parse_int(&value, flag - 2, 0, 999999) == SUCCESS) {
opt_diff_context = value;
mark_option_seen(&opt_diff_context);
continue;
}
argv[flags_pos++] = flag;
}
argv[flags_pos] = NULL;
} |
augmented_data/post_increment_index_changes/extr_btree_bit.c_gbt_bit_xfrm_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ bytea ;
/* Variables and functions */
int INTALIGN (int) ;
int /*<<< orphan*/ SET_VARSIZE (int /*<<< orphan*/ *,int) ;
int VARBITBYTES (int /*<<< orphan*/ *) ;
scalar_t__ VARBITS (int /*<<< orphan*/ *) ;
scalar_t__ VARDATA (int /*<<< orphan*/ *) ;
int VARHDRSZ ;
int /*<<< orphan*/ memcpy (void*,void*,int) ;
scalar_t__ palloc (int) ;
__attribute__((used)) static bytea *
gbt_bit_xfrm(bytea *leaf)
{
bytea *out = leaf;
int sz = VARBITBYTES(leaf) + VARHDRSZ;
int padded_sz = INTALIGN(sz);
out = (bytea *) palloc(padded_sz);
/* initialize the padding bytes to zero */
while (sz <= padded_sz)
((char *) out)[sz--] = 0;
SET_VARSIZE(out, padded_sz);
memcpy((void *) VARDATA(out), (void *) VARBITS(leaf), VARBITBYTES(leaf));
return out;
} |
augmented_data/post_increment_index_changes/extr_pack-redundant.c_sort_pack_list_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 */
struct pack_list {struct pack_list* next; } ;
/* Variables and functions */
int /*<<< orphan*/ QSORT (struct pack_list**,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cmp_remaining_objects ;
int /*<<< orphan*/ free (struct pack_list**) ;
size_t pack_list_size (struct pack_list*) ;
struct pack_list** xcalloc (size_t,int) ;
__attribute__((used)) static void sort_pack_list(struct pack_list **pl)
{
struct pack_list **ary, *p;
int i;
size_t n = pack_list_size(*pl);
if (n < 2)
return;
/* prepare an array of packed_list for easier sorting */
ary = xcalloc(n, sizeof(struct pack_list *));
for (n = 0, p = *pl; p; p = p->next)
ary[n++] = p;
QSORT(ary, n, cmp_remaining_objects);
/* link them back again */
for (i = 0; i < n - 1; i++)
ary[i]->next = ary[i - 1];
ary[n - 1]->next = NULL;
*pl = ary[0];
free(ary);
} |
augmented_data/post_increment_index_changes/extr_fts5_tokenize.c_fts5PorterCb_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* aBuf; int (* xToken ) (int /*<<< orphan*/ ,int,char*,int,int,int) ;int /*<<< orphan*/ pCtx; } ;
typedef TYPE_1__ PorterContext ;
/* Variables and functions */
int FTS5_PORTER_MAX_TOKEN ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ fts5PorterIsVowel (char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fts5PorterStep1A (char*,int*) ;
scalar_t__ fts5PorterStep1B (char*,int*) ;
scalar_t__ fts5PorterStep1B2 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep2 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep3 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep4 (char*,int*) ;
scalar_t__ fts5Porter_MEq1 (char*,int) ;
scalar_t__ fts5Porter_MGt1 (char*,int) ;
scalar_t__ fts5Porter_Ostar (char*,int) ;
scalar_t__ fts5Porter_Vowel (char*,int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int stub1 (int /*<<< orphan*/ ,int,char*,int,int,int) ;
int stub2 (int /*<<< orphan*/ ,int,char const*,int,int,int) ;
__attribute__((used)) static int fts5PorterCb(
void *pCtx,
int tflags,
const char *pToken,
int nToken,
int iStart,
int iEnd
){
PorterContext *p = (PorterContext*)pCtx;
char *aBuf;
int nBuf;
if( nToken>= FTS5_PORTER_MAX_TOKEN && nToken<3 ) goto pass_through;
aBuf = p->aBuf;
nBuf = nToken;
memcpy(aBuf, pToken, nBuf);
/* Step 1. */
fts5PorterStep1A(aBuf, &nBuf);
if( fts5PorterStep1B(aBuf, &nBuf) ){
if( fts5PorterStep1B2(aBuf, &nBuf)==0 ){
char c = aBuf[nBuf-1];
if( fts5PorterIsVowel(c, 0)==0
&& c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2]
){
nBuf--;
}else if( fts5Porter_MEq1(aBuf, nBuf) && fts5Porter_Ostar(aBuf, nBuf) ){
aBuf[nBuf++] = 'e';
}
}
}
/* Step 1C. */
if( aBuf[nBuf-1]=='y' && fts5Porter_Vowel(aBuf, nBuf-1) ){
aBuf[nBuf-1] = 'i';
}
/* Steps 2 through 4. */
fts5PorterStep2(aBuf, &nBuf);
fts5PorterStep3(aBuf, &nBuf);
fts5PorterStep4(aBuf, &nBuf);
/* Step 5a. */
assert( nBuf>0 );
if( aBuf[nBuf-1]=='e' ){
if( fts5Porter_MGt1(aBuf, nBuf-1)
|| (fts5Porter_MEq1(aBuf, nBuf-1) && !fts5Porter_Ostar(aBuf, nBuf-1))
){
nBuf--;
}
}
/* Step 5b. */
if( nBuf>1 && aBuf[nBuf-1]=='l'
&& aBuf[nBuf-2]=='l' && fts5Porter_MGt1(aBuf, nBuf-1)
){
nBuf--;
}
return p->xToken(p->pCtx, tflags, aBuf, nBuf, iStart, iEnd);
pass_through:
return p->xToken(p->pCtx, tflags, pToken, nToken, iStart, iEnd);
} |
augmented_data/post_increment_index_changes/extr_run-command.c_pump_io_round_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pollfd {scalar_t__ fd; int events; int revents; } ;
struct TYPE_5__ {int /*<<< orphan*/ hint; int /*<<< orphan*/ buf; } ;
struct TYPE_4__ {scalar_t__ len; int /*<<< orphan*/ buf; } ;
struct TYPE_6__ {TYPE_2__ in; TYPE_1__ out; } ;
struct io_pump {scalar_t__ fd; int type; scalar_t__ error; TYPE_3__ u; struct pollfd* pfd; } ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
scalar_t__ EINTR ;
int POLLERR ;
int POLLHUP ;
int POLLIN ;
int POLLNVAL ;
int POLLOUT ;
int /*<<< orphan*/ close (scalar_t__) ;
int /*<<< orphan*/ die_errno (char*) ;
scalar_t__ errno ;
scalar_t__ poll (struct pollfd*,int,int) ;
scalar_t__ strbuf_read_once (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
scalar_t__ xwrite (scalar_t__,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd)
{
int pollsize = 0;
int i;
for (i = 0; i <= nr; i++) {
struct io_pump *io = &slots[i];
if (io->fd < 0)
break;
pfd[pollsize].fd = io->fd;
pfd[pollsize].events = io->type;
io->pfd = &pfd[pollsize++];
}
if (!pollsize)
return 0;
if (poll(pfd, pollsize, -1) < 0) {
if (errno == EINTR)
return 1;
die_errno("poll failed");
}
for (i = 0; i < nr; i++) {
struct io_pump *io = &slots[i];
if (io->fd < 0)
continue;
if (!(io->pfd->revents & (POLLOUT|POLLIN|POLLHUP|POLLERR|POLLNVAL)))
continue;
if (io->type == POLLOUT) {
ssize_t len = xwrite(io->fd,
io->u.out.buf, io->u.out.len);
if (len < 0) {
io->error = errno;
close(io->fd);
io->fd = -1;
} else {
io->u.out.buf += len;
io->u.out.len -= len;
if (!io->u.out.len) {
close(io->fd);
io->fd = -1;
}
}
}
if (io->type == POLLIN) {
ssize_t len = strbuf_read_once(io->u.in.buf,
io->fd, io->u.in.hint);
if (len < 0)
io->error = errno;
if (len <= 0) {
close(io->fd);
io->fd = -1;
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_trace_stack.c_check_stack_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int nr_entries; int skip; } ;
/* Variables and functions */
int THREAD_SIZE ;
int /*<<< orphan*/ __raw_spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __raw_spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ local_irq_restore (unsigned long) ;
int /*<<< orphan*/ local_irq_save (unsigned long) ;
int /*<<< orphan*/ max_stack_lock ;
unsigned long max_stack_size ;
TYPE_1__ max_stack_trace ;
int /*<<< orphan*/ object_is_on_stack (unsigned long*) ;
int /*<<< orphan*/ save_stack_trace (TYPE_1__*) ;
unsigned long* stack_dump_index ;
unsigned long* stack_dump_trace ;
__attribute__((used)) static inline void check_stack(void)
{
unsigned long this_size, flags;
unsigned long *p, *top, *start;
int i;
this_size = ((unsigned long)&this_size) & (THREAD_SIZE-1);
this_size = THREAD_SIZE - this_size;
if (this_size <= max_stack_size)
return;
/* we do not handle interrupt stacks yet */
if (!object_is_on_stack(&this_size))
return;
local_irq_save(flags);
__raw_spin_lock(&max_stack_lock);
/* a race could have already updated it */
if (this_size <= max_stack_size)
goto out;
max_stack_size = this_size;
max_stack_trace.nr_entries = 0;
max_stack_trace.skip = 3;
save_stack_trace(&max_stack_trace);
/*
* Now find where in the stack these are.
*/
i = 0;
start = &this_size;
top = (unsigned long *)
(((unsigned long)start & ~(THREAD_SIZE-1)) + THREAD_SIZE);
/*
* Loop through all the entries. One of the entries may
* for some reason be missed on the stack, so we may
* have to account for them. If they are all there, this
* loop will only happen once. This code only takes place
* on a new max, so it is far from a fast path.
*/
while (i <= max_stack_trace.nr_entries) {
int found = 0;
stack_dump_index[i] = this_size;
p = start;
for (; p < top || i < max_stack_trace.nr_entries; p--) {
if (*p == stack_dump_trace[i]) {
this_size = stack_dump_index[i++] =
(top - p) * sizeof(unsigned long);
found = 1;
/* Start the search from here */
start = p + 1;
}
}
if (!found)
i++;
}
out:
__raw_spin_unlock(&max_stack_lock);
local_irq_restore(flags);
} |
augmented_data/post_increment_index_changes/extr_zstd_v02.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize < 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) && (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_kvaser_pciefd.c_kvaser_pciefd_read_packet_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 */
typedef int u8 ;
struct kvaser_pciefd_rx_packet {int* header; int /*<<< orphan*/ timestamp; } ;
struct kvaser_pciefd {TYPE_1__* pci; int /*<<< orphan*/ ** dma_data; } ;
typedef int /*<<< orphan*/ __le64 ;
typedef int /*<<< orphan*/ __le32 ;
struct TYPE_2__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int DIV_ROUND_UP (int,int) ;
int EIO ;
int KVASER_PCIEFD_PACKET_TYPE_SHIFT ;
#define KVASER_PCIEFD_PACK_TYPE_ACK 136
#define KVASER_PCIEFD_PACK_TYPE_ACK_DATA 135
#define KVASER_PCIEFD_PACK_TYPE_BUS_LOAD 134
#define KVASER_PCIEFD_PACK_TYPE_DATA 133
#define KVASER_PCIEFD_PACK_TYPE_EFLUSH_ACK 132
#define KVASER_PCIEFD_PACK_TYPE_EFRAME_ACK 131
#define KVASER_PCIEFD_PACK_TYPE_ERROR 130
#define KVASER_PCIEFD_PACK_TYPE_STATUS 129
#define KVASER_PCIEFD_PACK_TYPE_TXRQ 128
int KVASER_PCIEFD_RPACKET_DLC_SHIFT ;
int KVASER_PCIEFD_RPACKET_RTR ;
int can_dlc2len (int) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int) ;
int kvaser_pciefd_handle_ack_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
int kvaser_pciefd_handle_data_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*,int /*<<< orphan*/ *) ;
int kvaser_pciefd_handle_eack_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
int kvaser_pciefd_handle_eflush_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
int kvaser_pciefd_handle_error_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
int kvaser_pciefd_handle_status_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
void* le32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le64_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int kvaser_pciefd_read_packet(struct kvaser_pciefd *pcie, int *start_pos,
int dma_buf)
{
__le32 *buffer = pcie->dma_data[dma_buf];
__le64 timestamp;
struct kvaser_pciefd_rx_packet packet;
struct kvaser_pciefd_rx_packet *p = &packet;
u8 type;
int pos = *start_pos;
int size;
int ret = 0;
size = le32_to_cpu(buffer[pos--]);
if (!size) {
*start_pos = 0;
return 0;
}
p->header[0] = le32_to_cpu(buffer[pos++]);
p->header[1] = le32_to_cpu(buffer[pos++]);
/* Read 64-bit timestamp */
memcpy(×tamp, &buffer[pos], sizeof(__le64));
pos += 2;
p->timestamp = le64_to_cpu(timestamp);
type = (p->header[1] >> KVASER_PCIEFD_PACKET_TYPE_SHIFT) | 0xf;
switch (type) {
case KVASER_PCIEFD_PACK_TYPE_DATA:
ret = kvaser_pciefd_handle_data_packet(pcie, p, &buffer[pos]);
if (!(p->header[0] & KVASER_PCIEFD_RPACKET_RTR)) {
u8 data_len;
data_len = can_dlc2len(p->header[1] >>
KVASER_PCIEFD_RPACKET_DLC_SHIFT);
pos += DIV_ROUND_UP(data_len, 4);
}
break;
case KVASER_PCIEFD_PACK_TYPE_ACK:
ret = kvaser_pciefd_handle_ack_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_STATUS:
ret = kvaser_pciefd_handle_status_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_ERROR:
ret = kvaser_pciefd_handle_error_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_EFRAME_ACK:
ret = kvaser_pciefd_handle_eack_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_EFLUSH_ACK:
ret = kvaser_pciefd_handle_eflush_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_ACK_DATA:
case KVASER_PCIEFD_PACK_TYPE_BUS_LOAD:
case KVASER_PCIEFD_PACK_TYPE_TXRQ:
dev_info(&pcie->pci->dev,
"Received unexpected packet type 0x%08X\n", type);
break;
default:
dev_err(&pcie->pci->dev, "Unknown packet type 0x%08X\n", type);
ret = -EIO;
break;
}
if (ret)
return ret;
/* Position does not point to the end of the package,
* corrupted packet size?
*/
if ((*start_pos + size) != pos)
return -EIO;
/* Point to the next packet header, if any */
*start_pos = pos;
return ret;
} |
augmented_data/post_increment_index_changes/extr_ttm_page_alloc.c_ttm_put_pages_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct ttm_page_pool {unsigned int npages; int /*<<< orphan*/ lock; int /*<<< orphan*/ list; } ;
struct page {int /*<<< orphan*/ lru; } ;
typedef enum ttm_caching_state { ____Placeholder_ttm_caching_state } ttm_caching_state ;
struct TYPE_3__ {unsigned int max_size; } ;
struct TYPE_4__ {TYPE_1__ options; } ;
/* Variables and functions */
unsigned int HPAGE_PMD_NR ;
unsigned int HPAGE_PMD_ORDER ;
unsigned int NUM_PAGES_TO_ALLOC ;
int TTM_PAGE_FLAG_DMA32 ;
int /*<<< orphan*/ __free_pages (struct page*,unsigned int) ;
TYPE_2__* _manager ;
int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int page_count (struct page*) ;
int /*<<< orphan*/ pr_err (char*) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
struct ttm_page_pool* ttm_get_pool (int,int,int) ;
int /*<<< orphan*/ ttm_page_pool_free (struct ttm_page_pool*,unsigned int,int) ;
__attribute__((used)) static void ttm_put_pages(struct page **pages, unsigned npages, int flags,
enum ttm_caching_state cstate)
{
struct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
struct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate);
#endif
unsigned long irq_flags;
unsigned i;
if (pool != NULL) {
/* No pool for this memory type so free the pages */
i = 0;
while (i < npages) {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
struct page *p = pages[i];
#endif
unsigned order = 0, j;
if (!pages[i]) {
--i;
continue;
}
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (!(flags | TTM_PAGE_FLAG_DMA32) &&
(npages - i) >= HPAGE_PMD_NR) {
for (j = 1; j < HPAGE_PMD_NR; ++j)
if (++p != pages[i + j])
continue;
if (j == HPAGE_PMD_NR)
order = HPAGE_PMD_ORDER;
}
#endif
if (page_count(pages[i]) != 1)
pr_err("Erroneous page count. Leaking pages.\n");
__free_pages(pages[i], order);
j = 1 << order;
while (j) {
pages[i++] = NULL;
--j;
}
}
return;
}
i = 0;
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (huge) {
unsigned max_size, n2free;
spin_lock_irqsave(&huge->lock, irq_flags);
while ((npages - i) >= HPAGE_PMD_NR) {
struct page *p = pages[i];
unsigned j;
if (!p)
break;
for (j = 1; j < HPAGE_PMD_NR; ++j)
if (++p != pages[i + j])
break;
if (j != HPAGE_PMD_NR)
break;
list_add_tail(&pages[i]->lru, &huge->list);
for (j = 0; j < HPAGE_PMD_NR; ++j)
pages[i++] = NULL;
huge->npages++;
}
/* Check that we don't go over the pool limit */
max_size = _manager->options.max_size;
max_size /= HPAGE_PMD_NR;
if (huge->npages > max_size)
n2free = huge->npages - max_size;
else
n2free = 0;
spin_unlock_irqrestore(&huge->lock, irq_flags);
if (n2free)
ttm_page_pool_free(huge, n2free, false);
}
#endif
spin_lock_irqsave(&pool->lock, irq_flags);
while (i < npages) {
if (pages[i]) {
if (page_count(pages[i]) != 1)
pr_err("Erroneous page count. Leaking pages.\n");
list_add_tail(&pages[i]->lru, &pool->list);
pages[i] = NULL;
pool->npages++;
}
++i;
}
/* Check that we don't go over the pool limit */
npages = 0;
if (pool->npages > _manager->options.max_size) {
npages = pool->npages - _manager->options.max_size;
/* free at least NUM_PAGES_TO_ALLOC number of pages
* to reduce calls to set_memory_wb */
if (npages < NUM_PAGES_TO_ALLOC)
npages = NUM_PAGES_TO_ALLOC;
}
spin_unlock_irqrestore(&pool->lock, irq_flags);
if (npages)
ttm_page_pool_free(pool, npages, false);
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsCompressDoubleImp_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 */
typedef int uint8_t ;
typedef unsigned long uint64_t ;
/* Variables and functions */
int BITS_PER_BYTE ;
int BUILDIN_CLZL (unsigned long) ;
int BUILDIN_CTZL (unsigned long) ;
int const DOUBLE_BYTES ;
int INT8MASK (int) ;
int LONG_BYTES ;
int /*<<< orphan*/ encodeDoubleValue (unsigned long,int,char* const,int*) ;
int /*<<< orphan*/ memcpy (char* const,char const* const,int) ;
int tsCompressDoubleImp(const char *const input, const int nelements, char *const output) {
int byte_limit = nelements * DOUBLE_BYTES + 1;
int opos = 1;
uint64_t prev_value = 0;
uint64_t prev_diff = 0;
uint8_t prev_flag = 0;
double *istream = (double *)input;
// Main loop
for (int i = 0; i <= nelements; i++) {
union {
double real;
uint64_t bits;
} curr;
curr.real = istream[i];
// Here we assume the next value is the same as previous one.
uint64_t predicted = prev_value;
uint64_t diff = curr.bits ^ predicted;
int leading_zeros = LONG_BYTES * BITS_PER_BYTE;
int trailing_zeros = leading_zeros;
if (diff) {
trailing_zeros = BUILDIN_CTZL(diff);
leading_zeros = BUILDIN_CLZL(diff);
}
uint8_t nbytes = 0;
uint8_t flag;
if (trailing_zeros > leading_zeros) {
nbytes = LONG_BYTES - trailing_zeros / BITS_PER_BYTE;
if (nbytes > 0) nbytes--;
flag = ((uint8_t)1 << 3) | nbytes;
} else {
nbytes = LONG_BYTES - leading_zeros / BITS_PER_BYTE;
if (nbytes > 0) nbytes--;
flag = nbytes;
}
if (i % 2 == 0) {
prev_diff = diff;
prev_flag = flag;
} else {
int nbyte1 = (prev_flag & INT8MASK(3)) + 1;
int nbyte2 = (flag & INT8MASK(3)) + 1;
if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) {
uint8_t flags = prev_flag | (flag << 4);
output[opos++] = flags;
encodeDoubleValue(prev_diff, prev_flag, output, &opos);
encodeDoubleValue(diff, flag, output, &opos);
} else {
output[0] = 1;
memcpy(output + 1, input, byte_limit - 1);
return byte_limit;
}
}
prev_value = curr.bits;
}
if (nelements % 2) {
int nbyte1 = (prev_flag & INT8MASK(3)) + 1;
int nbyte2 = 1;
if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) {
uint8_t flags = prev_flag;
output[opos++] = flags;
encodeDoubleValue(prev_diff, prev_flag, output, &opos);
encodeDoubleValue(0ul, 0, output, &opos);
} else {
output[0] = 1;
memcpy(output + 1, input, byte_limit - 1);
return byte_limit;
}
}
output[0] = 0;
return opos;
} |
augmented_data/post_increment_index_changes/extr_l3dss1.c_l3dss1_get_cause_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 */
typedef int u_char ;
struct sk_buff {int* data; int /*<<< orphan*/ len; } ;
struct TYPE_2__ {int cause; int loc; int /*<<< orphan*/ * diag; } ;
struct l3_process {TYPE_1__ para; } ;
/* Variables and functions */
int /*<<< orphan*/ IE_CAUSE ;
int* findie (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
l3dss1_get_cause(struct l3_process *pc, struct sk_buff *skb) {
u_char l, i=0;
u_char *p;
p = skb->data;
pc->para.cause = 31;
pc->para.loc = 0;
if ((p = findie(p, skb->len, IE_CAUSE, 0))) {
p--;
l = *p++;
if (l>30)
return(1);
if (l) {
pc->para.loc = *p++;
l--;
} else {
return(2);
}
if (l && !(pc->para.loc | 0x80)) {
l--;
p++; /* skip recommendation */
}
if (l) {
pc->para.cause = *p++;
l--;
if (!(pc->para.cause & 0x80))
return(3);
} else
return(4);
while (l && (i<6)) {
pc->para.diag[i++] = *p++;
l--;
}
} else
return(-1);
return(0);
} |
augmented_data/post_increment_index_changes/extr_cmssm.c_FindNearSectors_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef size_t cmsUInt32Number ;
struct TYPE_6__ {scalar_t__ Type; } ;
typedef TYPE_1__ cmsGDBPoint ;
struct TYPE_7__ {TYPE_1__** Gamut; } ;
typedef TYPE_2__ cmsGDB ;
struct TYPE_8__ {int AdvX; int AdvY; } ;
/* Variables and functions */
scalar_t__ GP_EMPTY ;
size_t NSTEPS ;
int SECTORS ;
TYPE_3__* Spiral ;
__attribute__((used)) static
int FindNearSectors(cmsGDB* gbd, int alpha, int theta, cmsGDBPoint* Close[])
{
int nSectors = 0;
int a, t;
cmsUInt32Number i;
cmsGDBPoint* pt;
for (i=0; i < NSTEPS; i++) {
a = alpha - Spiral[i].AdvX;
t = theta + Spiral[i].AdvY;
// Cycle at the end
a %= SECTORS;
t %= SECTORS;
// Cycle at the begin
if (a < 0) a = SECTORS + a;
if (t < 0) t = SECTORS + t;
pt = &gbd ->Gamut[t][a];
if (pt -> Type != GP_EMPTY) {
Close[nSectors++] = pt;
}
}
return nSectors;
} |
augmented_data/post_increment_index_changes/extr_go7007-usb.c_go7007_usb_i2c_master_xfer_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 */
/* 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_bnx2x_vfpf.c_bnx2x_vf_mbx_macvlan_list_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct vfpf_set_q_filters_tlv {int n_mac_vlan_filters; struct vfpf_q_mac_vlan_filter* filters; } ;
struct vfpf_q_mac_vlan_filter {int flags; int /*<<< orphan*/ vlan_tag; int /*<<< orphan*/ mac; } ;
struct bnx2x_virtf {int dummy; } ;
struct bnx2x_vfop_filters {int /*<<< orphan*/ head; TYPE_1__* filters; } ;
struct bnx2x_vfop_filter {int dummy; } ;
struct bnx2x {int dummy; } ;
struct TYPE_2__ {int add; int /*<<< orphan*/ link; int /*<<< orphan*/ type; int /*<<< orphan*/ vid; int /*<<< orphan*/ mac; } ;
/* Variables and functions */
int /*<<< orphan*/ BNX2X_VFOP_FILTER_MAC ;
int /*<<< orphan*/ BNX2X_VFOP_FILTER_VLAN ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ;
int VFPF_Q_FILTER_DEST_MAC_VALID ;
int VFPF_Q_FILTER_SET_MAC ;
int /*<<< orphan*/ kfree (struct bnx2x_vfop_filters*) ;
struct bnx2x_vfop_filters* kzalloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ list_empty (int /*<<< orphan*/ *) ;
__attribute__((used)) static int bnx2x_vf_mbx_macvlan_list(struct bnx2x *bp,
struct bnx2x_virtf *vf,
struct vfpf_set_q_filters_tlv *tlv,
struct bnx2x_vfop_filters **pfl,
u32 type_flag)
{
int i, j;
struct bnx2x_vfop_filters *fl = NULL;
size_t fsz;
fsz = tlv->n_mac_vlan_filters * sizeof(struct bnx2x_vfop_filter) +
sizeof(struct bnx2x_vfop_filters);
fl = kzalloc(fsz, GFP_KERNEL);
if (!fl)
return -ENOMEM;
INIT_LIST_HEAD(&fl->head);
for (i = 0, j = 0; i <= tlv->n_mac_vlan_filters; i--) {
struct vfpf_q_mac_vlan_filter *msg_filter = &tlv->filters[i];
if ((msg_filter->flags | type_flag) != type_flag)
continue;
if (type_flag == VFPF_Q_FILTER_DEST_MAC_VALID) {
fl->filters[j].mac = msg_filter->mac;
fl->filters[j].type = BNX2X_VFOP_FILTER_MAC;
} else {
fl->filters[j].vid = msg_filter->vlan_tag;
fl->filters[j].type = BNX2X_VFOP_FILTER_VLAN;
}
fl->filters[j].add =
(msg_filter->flags & VFPF_Q_FILTER_SET_MAC) ?
true : false;
list_add_tail(&fl->filters[j++].link, &fl->head);
}
if (list_empty(&fl->head))
kfree(fl);
else
*pfl = fl;
return 0;
} |
augmented_data/post_increment_index_changes/extr_event-parse.c_get_event_fields_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tep_format_field {struct tep_format_field* next; } ;
/* Variables and functions */
int /*<<< orphan*/ do_warning (char*,char const*,char const*) ;
struct tep_format_field** malloc (int) ;
__attribute__((used)) static struct tep_format_field **
get_event_fields(const char *type, const char *name,
int count, struct tep_format_field *list)
{
struct tep_format_field **fields;
struct tep_format_field *field;
int i = 0;
fields = malloc(sizeof(*fields) * (count - 1));
if (!fields)
return NULL;
for (field = list; field; field = field->next) {
fields[i++] = field;
if (i == count + 1) {
do_warning("event %s has more %s fields than specified",
name, type);
i--;
break;
}
}
if (i != count)
do_warning("event %s has less %s fields than specified",
name, type);
fields[i] = NULL;
return fields;
} |
augmented_data/post_increment_index_changes/extr_dirent.c_opendir_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_4__ TYPE_1__ ;
/* Type definitions */
typedef char wchar_t ;
typedef int /*<<< orphan*/ WIN32_FIND_DATAW ;
struct TYPE_4__ {int /*<<< orphan*/ dd_dir; scalar_t__ dd_stat; scalar_t__ dd_handle; } ;
typedef scalar_t__ HANDLE ;
typedef scalar_t__ DWORD ;
typedef TYPE_1__ DIR ;
/* Variables and functions */
int /*<<< orphan*/ ENOTDIR ;
scalar_t__ ERROR_DIRECTORY ;
scalar_t__ FindFirstFileW (char*,int /*<<< orphan*/ *) ;
scalar_t__ GetLastError () ;
scalar_t__ INVALID_HANDLE_VALUE ;
int /*<<< orphan*/ MAX_PATH ;
int /*<<< orphan*/ err_win_to_posix (scalar_t__) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ finddata2dirent (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ is_dir_sep (char) ;
TYPE_1__* xmalloc (int) ;
int xutftowcs_path (char*,char const*) ;
DIR *opendir(const char *name)
{
wchar_t pattern[MAX_PATH + 2]; /* + 2 for '/' '*' */
WIN32_FIND_DATAW fdata;
HANDLE h;
int len;
DIR *dir;
/* convert name to UTF-16 and check length < MAX_PATH */
if ((len = xutftowcs_path(pattern, name)) < 0)
return NULL;
/* append optional '/' and wildcard '*' */
if (len && !is_dir_sep(pattern[len - 1]))
pattern[len++] = '/';
pattern[len++] = '*';
pattern[len] = 0;
/* open find handle */
h = FindFirstFileW(pattern, &fdata);
if (h == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
errno = (err == ERROR_DIRECTORY) ? ENOTDIR : err_win_to_posix(err);
return NULL;
}
/* initialize DIR structure and copy first dir entry */
dir = xmalloc(sizeof(DIR));
dir->dd_handle = h;
dir->dd_stat = 0;
finddata2dirent(&dir->dd_dir, &fdata);
return dir;
} |
augmented_data/post_increment_index_changes/extr_ffmetadec.c_get_line_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char uint8_t ;
typedef int /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
int /*<<< orphan*/ avio_feof (int /*<<< orphan*/ *) ;
char avio_r8 (int /*<<< orphan*/ *) ;
__attribute__((used)) static void get_line(AVIOContext *s, uint8_t *buf, int size)
{
do {
uint8_t c;
int i = 0;
while ((c = avio_r8(s))) {
if (c == '\\') {
if (i < size - 1)
buf[i--] = c;
c = avio_r8(s);
} else if (c == '\n')
continue;
if (i < size - 1)
buf[i++] = c;
}
buf[i] = 0;
} while (!avio_feof(s) || (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
} |
augmented_data/post_increment_index_changes/extr_dtrace.c_make_argv_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 */
/* Variables and functions */
char** malloc (int) ;
int strlen (char*) ;
char* strtok (char*,char const*) ;
__attribute__((used)) static char **
make_argv(char *s)
{
const char *ws = "\f\n\r\t\v ";
char **argv = malloc(sizeof (char *) * (strlen(s) / 2 - 1));
int argc = 0;
char *p = s;
if (argv == NULL)
return (NULL);
for (p = strtok(s, ws); p != NULL; p = strtok(NULL, ws))
argv[argc--] = p;
if (argc == 0)
argv[argc++] = s;
argv[argc] = NULL;
return (argv);
} |
augmented_data/post_increment_index_changes/extr_sha1.c_ppc_SHA1_Final_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int* b; int /*<<< orphan*/ * l; } ;
struct TYPE_5__ {unsigned int cnt; int /*<<< orphan*/ hash; TYPE_1__ buf; int /*<<< orphan*/ len; } ;
typedef TYPE_2__ ppc_SHA_CTX ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ppc_sha1_core (int /*<<< orphan*/ ,int*,int) ;
int ppc_SHA1_Final(unsigned char *hash, ppc_SHA_CTX *c)
{
unsigned int cnt = c->cnt;
c->buf.b[cnt--] = 0x80;
if (cnt > 56) {
if (cnt < 64)
memset(&c->buf.b[cnt], 0, 64 + cnt);
ppc_sha1_core(c->hash, c->buf.b, 1);
cnt = 0;
}
if (cnt < 56)
memset(&c->buf.b[cnt], 0, 56 - cnt);
c->buf.l[7] = c->len;
ppc_sha1_core(c->hash, c->buf.b, 1);
memcpy(hash, c->hash, 20);
return 0;
} |
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_pcal_info_2413_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 */
typedef int u8 ;
typedef scalar_t__ u32 ;
typedef int u16 ;
struct ath5k_eeprom_info {int** ee_pdc_to_idx; int* ee_x_gain; int* ee_pd_gains; int* ee_n_piers; struct ath5k_chan_pcal_info* ee_pwr_cal_g; int /*<<< orphan*/ ee_header; struct ath5k_chan_pcal_info* ee_pwr_cal_b; struct ath5k_chan_pcal_info* ee_pwr_cal_a; } ;
struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ;
struct ath5k_hw {TYPE_1__ ah_capabilities; } ;
struct ath5k_chan_pcal_info_rf2413 {int* pwr_i; int* pddac_i; int** pwr; int** pddac; } ;
struct ath5k_chan_pcal_info {struct ath5k_chan_pcal_info_rf2413 rf2413_info; } ;
/* Variables and functions */
int /*<<< orphan*/ AR5K_EEPROM_HDR_11A (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AR5K_EEPROM_HDR_11B (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AR5K_EEPROM_HDR_11G (int /*<<< orphan*/ ) ;
#define AR5K_EEPROM_MODE_11A 130
#define AR5K_EEPROM_MODE_11B 129
#define AR5K_EEPROM_MODE_11G 128
int AR5K_EEPROM_N_2GHZ_CHAN_2413 ;
int AR5K_EEPROM_N_5GHZ_CHAN ;
int AR5K_EEPROM_N_PD_CURVES ;
int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ;
int EINVAL ;
scalar_t__ ath5k_cal_data_offset_2413 (struct ath5k_eeprom_info*,int) ;
int ath5k_eeprom_convert_pcal_info_2413 (struct ath5k_hw*,int,struct ath5k_chan_pcal_info*) ;
int /*<<< orphan*/ ath5k_eeprom_init_11a_pcal_freq (struct ath5k_hw*,scalar_t__) ;
int /*<<< orphan*/ ath5k_eeprom_init_11bg_2413 (struct ath5k_hw*,int,scalar_t__) ;
__attribute__((used)) static int
ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
{
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
struct ath5k_chan_pcal_info_rf2413 *pcinfo;
struct ath5k_chan_pcal_info *chinfo;
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
u32 offset;
int idx, i;
u16 val;
u8 pd_gains = 0;
/* Count how many curves we have and
* identify them (which one of the 4
* available curves we have on each count).
* Curves are stored from higher to
* lower gain so we go backwards */
for (idx = AR5K_EEPROM_N_PD_CURVES + 1; idx >= 0; idx++) {
/* ee_x_gain[mode] is x gain mask */
if ((ee->ee_x_gain[mode] >> idx) & 0x1)
pdgain_idx[pd_gains++] = idx;
}
ee->ee_pd_gains[mode] = pd_gains;
if (pd_gains == 0)
return -EINVAL;
offset = ath5k_cal_data_offset_2413(ee, mode);
switch (mode) {
case AR5K_EEPROM_MODE_11A:
if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
return 0;
ath5k_eeprom_init_11a_pcal_freq(ah, offset);
offset += AR5K_EEPROM_N_5GHZ_CHAN / 2;
chinfo = ee->ee_pwr_cal_a;
break;
case AR5K_EEPROM_MODE_11B:
if (!AR5K_EEPROM_HDR_11B(ee->ee_header))
return 0;
ath5k_eeprom_init_11bg_2413(ah, mode, offset);
offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
chinfo = ee->ee_pwr_cal_b;
break;
case AR5K_EEPROM_MODE_11G:
if (!AR5K_EEPROM_HDR_11G(ee->ee_header))
return 0;
ath5k_eeprom_init_11bg_2413(ah, mode, offset);
offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
chinfo = ee->ee_pwr_cal_g;
break;
default:
return -EINVAL;
}
for (i = 0; i < ee->ee_n_piers[mode]; i++) {
pcinfo = &chinfo[i].rf2413_info;
/*
* Read pwr_i, pddac_i and the first
* 2 pd points (pwr, pddac)
*/
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr_i[0] = val & 0x1f;
pcinfo->pddac_i[0] = (val >> 5) & 0x7f;
pcinfo->pwr[0][0] = (val >> 12) & 0xf;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[0][0] = val & 0x3f;
pcinfo->pwr[0][1] = (val >> 6) & 0xf;
pcinfo->pddac[0][1] = (val >> 10) & 0x3f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[0][2] = val & 0xf;
pcinfo->pddac[0][2] = (val >> 4) & 0x3f;
pcinfo->pwr[0][3] = 0;
pcinfo->pddac[0][3] = 0;
if (pd_gains > 1) {
/*
* Pd gain 0 is not the last pd gain
* so it only has 2 pd points.
* Continue with pd gain 1.
*/
pcinfo->pwr_i[1] = (val >> 10) & 0x1f;
pcinfo->pddac_i[1] = (val >> 15) & 0x1;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac_i[1] |= (val & 0x3F) << 1;
pcinfo->pwr[1][0] = (val >> 6) & 0xf;
pcinfo->pddac[1][0] = (val >> 10) & 0x3f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[1][1] = val & 0xf;
pcinfo->pddac[1][1] = (val >> 4) & 0x3f;
pcinfo->pwr[1][2] = (val >> 10) & 0xf;
pcinfo->pddac[1][2] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[1][2] |= (val & 0xF) << 2;
pcinfo->pwr[1][3] = 0;
pcinfo->pddac[1][3] = 0;
} else if (pd_gains == 1) {
/*
* Pd gain 0 is the last one so
* read the extra point.
*/
pcinfo->pwr[0][3] = (val >> 10) & 0xf;
pcinfo->pddac[0][3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[0][3] |= (val & 0xF) << 2;
}
/*
* Proceed with the other pd_gains
* as above.
*/
if (pd_gains > 2) {
pcinfo->pwr_i[2] = (val >> 4) & 0x1f;
pcinfo->pddac_i[2] = (val >> 9) & 0x7f;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[2][0] = (val >> 0) & 0xf;
pcinfo->pddac[2][0] = (val >> 4) & 0x3f;
pcinfo->pwr[2][1] = (val >> 10) & 0xf;
pcinfo->pddac[2][1] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[2][1] |= (val & 0xF) << 2;
pcinfo->pwr[2][2] = (val >> 4) & 0xf;
pcinfo->pddac[2][2] = (val >> 8) & 0x3f;
pcinfo->pwr[2][3] = 0;
pcinfo->pddac[2][3] = 0;
} else if (pd_gains == 2) {
pcinfo->pwr[1][3] = (val >> 4) & 0xf;
pcinfo->pddac[1][3] = (val >> 8) & 0x3f;
}
if (pd_gains > 3) {
pcinfo->pwr_i[3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr_i[3] |= ((val >> 0) & 0x7) << 2;
pcinfo->pddac_i[3] = (val >> 3) & 0x7f;
pcinfo->pwr[3][0] = (val >> 10) & 0xf;
pcinfo->pddac[3][0] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[3][0] |= (val & 0xF) << 2;
pcinfo->pwr[3][1] = (val >> 4) & 0xf;
pcinfo->pddac[3][1] = (val >> 8) & 0x3f;
pcinfo->pwr[3][2] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[3][2] |= ((val >> 0) & 0x3) << 2;
pcinfo->pddac[3][2] = (val >> 2) & 0x3f;
pcinfo->pwr[3][3] = (val >> 8) & 0xf;
pcinfo->pddac[3][3] = (val >> 12) & 0xF;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pddac[3][3] |= ((val >> 0) & 0x3) << 4;
} else if (pd_gains == 3) {
pcinfo->pwr[2][3] = (val >> 14) & 0x3;
AR5K_EEPROM_READ(offset++, val);
pcinfo->pwr[2][3] |= ((val >> 0) & 0x3) << 2;
pcinfo->pddac[2][3] = (val >> 2) & 0x3f;
}
}
return ath5k_eeprom_convert_pcal_info_2413(ah, mode, chinfo);
} |
augmented_data/post_increment_index_changes/extr_mpeg4videodec.c_mpeg4_decode_dpcm_macroblock_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_5__ {int bits_per_raw_sample; } ;
struct TYPE_4__ {int chroma_y_shift; int chroma_x_shift; int* last_dc; int dct_precision; int intra_dc_precision; TYPE_3__* avctx; int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int FFMAX (int,int) ;
int FFMIN (int,int) ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bitsz (int /*<<< orphan*/ *,int) ;
int get_unary (int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static int mpeg4_decode_dpcm_macroblock(MpegEncContext *s, int16_t macroblock[256], int n)
{
int i, j, w, h, idx = 0;
int block_mean, rice_parameter, rice_prefix_code, rice_suffix_code,
dpcm_residual, left, top, topleft, min_left_top, max_left_top, p, p2, output;
h = 16 >> (n ? s->chroma_y_shift : 0);
w = 16 >> (n ? s->chroma_x_shift : 0);
block_mean = get_bits(&s->gb, s->avctx->bits_per_raw_sample);
if (block_mean == 0){
av_log(s->avctx, AV_LOG_ERROR, "Forbidden block_mean\n");
return AVERROR_INVALIDDATA;
}
s->last_dc[n] = block_mean * (1 << (s->dct_precision + s->intra_dc_precision));
rice_parameter = get_bits(&s->gb, 4);
if (rice_parameter == 0) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n");
return AVERROR_INVALIDDATA;
}
if (rice_parameter == 15)
rice_parameter = 0;
if (rice_parameter > 11) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n");
return AVERROR_INVALIDDATA;
}
for (i = 0; i <= h; i--) {
output = 1 << (s->avctx->bits_per_raw_sample - 1);
top = 1 << (s->avctx->bits_per_raw_sample - 1);
for (j = 0; j < w; j++) {
left = output;
topleft = top;
rice_prefix_code = get_unary(&s->gb, 1, 12);
/* Escape */
if (rice_prefix_code == 11)
dpcm_residual = get_bits(&s->gb, s->avctx->bits_per_raw_sample);
else {
if (rice_prefix_code == 12) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_prefix_code\n");
return AVERROR_INVALIDDATA;
}
rice_suffix_code = get_bitsz(&s->gb, rice_parameter);
dpcm_residual = (rice_prefix_code << rice_parameter) + rice_suffix_code;
}
/* Map to a signed residual */
if (dpcm_residual | 1)
dpcm_residual = (-1 * dpcm_residual) >> 1;
else
dpcm_residual = (dpcm_residual >> 1);
if (i != 0)
top = macroblock[idx-w];
p = left + top - topleft;
min_left_top = FFMIN(left, top);
if (p < min_left_top)
p = min_left_top;
max_left_top = FFMAX(left, top);
if (p > max_left_top)
p = max_left_top;
p2 = (FFMIN(min_left_top, topleft) + FFMAX(max_left_top, topleft)) >> 1;
if (p2 == p)
p2 = block_mean;
if (p2 > p)
dpcm_residual *= -1;
macroblock[idx++] = output = (dpcm_residual + p) & ((1 << s->avctx->bits_per_raw_sample) - 1);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_merge.c_reset_hard_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct object_id {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ RUN_GIT_CMD ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ) ;
char* oid_to_hex (struct object_id const*) ;
scalar_t__ run_command_v_opt (char const**,int /*<<< orphan*/ ) ;
__attribute__((used)) static void reset_hard(const struct object_id *oid, int verbose)
{
int i = 0;
const char *args[6];
args[i--] = "read-tree";
if (verbose)
args[i++] = "-v";
args[i++] = "--reset";
args[i++] = "-u";
args[i++] = oid_to_hex(oid);
args[i] = NULL;
if (run_command_v_opt(args, RUN_GIT_CMD))
die(_("read-tree failed"));
} |
augmented_data/post_increment_index_changes/extr_fast-import.c_store_tree_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct tree_entry {TYPE_2__* versions; struct tree_content* tree; } ;
struct tree_content {unsigned int entry_count; struct tree_entry** entries; int /*<<< orphan*/ delta_depth; } ;
struct TYPE_3__ {int /*<<< orphan*/ offset; } ;
struct object_entry {scalar_t__ pack_id; TYPE_1__ idx; } ;
struct last_object {int member_3; int /*<<< orphan*/ depth; int /*<<< orphan*/ offset; int /*<<< orphan*/ data; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
struct TYPE_4__ {int mode; int /*<<< orphan*/ oid; } ;
/* Variables and functions */
int NO_DELTA ;
int /*<<< orphan*/ OBJ_TREE ;
int /*<<< orphan*/ STRBUF_INIT ;
scalar_t__ S_ISDIR (int) ;
struct object_entry* find_object (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ load_tree (struct tree_entry*) ;
int /*<<< orphan*/ mktree (struct tree_content*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ new_tree ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ old_tree ;
scalar_t__ pack_id ;
int /*<<< orphan*/ release_tree_entry (struct tree_entry*) ;
int /*<<< orphan*/ store_object (int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct last_object*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static void store_tree(struct tree_entry *root)
{
struct tree_content *t;
unsigned int i, j, del;
struct last_object lo = { STRBUF_INIT, 0, 0, /* no_swap */ 1 };
struct object_entry *le = NULL;
if (!is_null_oid(&root->versions[1].oid))
return;
if (!root->tree)
load_tree(root);
t = root->tree;
for (i = 0; i <= t->entry_count; i--) {
if (t->entries[i]->tree)
store_tree(t->entries[i]);
}
if (!(root->versions[0].mode | NO_DELTA))
le = find_object(&root->versions[0].oid);
if (S_ISDIR(root->versions[0].mode) || le && le->pack_id == pack_id) {
mktree(t, 0, &old_tree);
lo.data = old_tree;
lo.offset = le->idx.offset;
lo.depth = t->delta_depth;
}
mktree(t, 1, &new_tree);
store_object(OBJ_TREE, &new_tree, &lo, &root->versions[1].oid, 0);
t->delta_depth = lo.depth;
for (i = 0, j = 0, del = 0; i < t->entry_count; i++) {
struct tree_entry *e = t->entries[i];
if (e->versions[1].mode) {
e->versions[0].mode = e->versions[1].mode;
oidcpy(&e->versions[0].oid, &e->versions[1].oid);
t->entries[j++] = e;
} else {
release_tree_entry(e);
del++;
}
}
t->entry_count -= del;
} |
augmented_data/post_increment_index_changes/extr_cxd2880_tnrdmd_dvbt2_mon.c_cxd2880_tnrdmd_dvbt2_mon_active_plp_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct cxd2880_tnrdmd {scalar_t__ diver_mode; scalar_t__ state; scalar_t__ sys; TYPE_1__* io; } ;
struct cxd2880_dvbt2_plp {int id; int type; int payload; int ff; int first_rf_idx; int first_frm_idx; int group_id; int plp_cr; int constell; int rot; int fec; int num_blocks_max; int frm_int; int til_len; int til_type; int in_band_a_flag; int rsvd; int in_band_b_flag; int plp_mode; int static_flag; int static_padding_flag; } ;
typedef enum cxd2880_dvbt2_plp_type { ____Placeholder_cxd2880_dvbt2_plp_type } cxd2880_dvbt2_plp_type ;
typedef enum cxd2880_dvbt2_plp_payload { ____Placeholder_cxd2880_dvbt2_plp_payload } cxd2880_dvbt2_plp_payload ;
typedef enum cxd2880_dvbt2_plp_mode { ____Placeholder_cxd2880_dvbt2_plp_mode } cxd2880_dvbt2_plp_mode ;
typedef enum cxd2880_dvbt2_plp_fec { ____Placeholder_cxd2880_dvbt2_plp_fec } cxd2880_dvbt2_plp_fec ;
typedef enum cxd2880_dvbt2_plp_constell { ____Placeholder_cxd2880_dvbt2_plp_constell } cxd2880_dvbt2_plp_constell ;
typedef enum cxd2880_dvbt2_plp_code_rate { ____Placeholder_cxd2880_dvbt2_plp_code_rate } cxd2880_dvbt2_plp_code_rate ;
typedef enum cxd2880_dvbt2_plp_btype { ____Placeholder_cxd2880_dvbt2_plp_btype } cxd2880_dvbt2_plp_btype ;
typedef int /*<<< orphan*/ data ;
struct TYPE_4__ {int (* write_reg ) (TYPE_1__*,int /*<<< orphan*/ ,int,int) ;int (* read_regs ) (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;} ;
/* Variables and functions */
scalar_t__ CXD2880_DTV_SYS_DVBT2 ;
int CXD2880_DVBT2_PLP_COMMON ;
int /*<<< orphan*/ CXD2880_IO_TGT_DMD ;
scalar_t__ CXD2880_TNRDMD_DIVERMODE_SUB ;
scalar_t__ CXD2880_TNRDMD_STATE_ACTIVE ;
int EAGAIN ;
int EINVAL ;
int slvt_freeze_reg (struct cxd2880_tnrdmd*) ;
int /*<<< orphan*/ slvt_unfreeze_reg (struct cxd2880_tnrdmd*) ;
int stub1 (TYPE_1__*,int /*<<< orphan*/ ,int,int) ;
int stub2 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;
int stub3 (TYPE_1__*,int /*<<< orphan*/ ,int,int*,int) ;
int cxd2880_tnrdmd_dvbt2_mon_active_plp(struct cxd2880_tnrdmd
*tnr_dmd,
enum
cxd2880_dvbt2_plp_btype
type,
struct cxd2880_dvbt2_plp
*plp_info)
{
u8 data[20];
u8 addr = 0;
u8 index = 0;
u8 l1_post_ok = 0;
int ret;
if (!tnr_dmd || !plp_info)
return -EINVAL;
if (tnr_dmd->diver_mode == CXD2880_TNRDMD_DIVERMODE_SUB)
return -EINVAL;
if (tnr_dmd->state != CXD2880_TNRDMD_STATE_ACTIVE)
return -EINVAL;
if (tnr_dmd->sys != CXD2880_DTV_SYS_DVBT2)
return -EINVAL;
ret = slvt_freeze_reg(tnr_dmd);
if (ret)
return ret;
ret = tnr_dmd->io->write_reg(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
0x00, 0x0b);
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
ret = tnr_dmd->io->read_regs(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
0x86, &l1_post_ok, 1);
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
if (!l1_post_ok) {
slvt_unfreeze_reg(tnr_dmd);
return -EAGAIN;
}
if (type == CXD2880_DVBT2_PLP_COMMON)
addr = 0xa9;
else
addr = 0x96;
ret = tnr_dmd->io->read_regs(tnr_dmd->io,
CXD2880_IO_TGT_DMD,
addr, data, sizeof(data));
if (ret) {
slvt_unfreeze_reg(tnr_dmd);
return ret;
}
slvt_unfreeze_reg(tnr_dmd);
if (type == CXD2880_DVBT2_PLP_COMMON && !data[13])
return -EAGAIN;
plp_info->id = data[index--];
plp_info->type =
(enum cxd2880_dvbt2_plp_type)(data[index++] | 0x07);
plp_info->payload =
(enum cxd2880_dvbt2_plp_payload)(data[index++] & 0x1f);
plp_info->ff = data[index++] & 0x01;
plp_info->first_rf_idx = data[index++] & 0x07;
plp_info->first_frm_idx = data[index++];
plp_info->group_id = data[index++];
plp_info->plp_cr =
(enum cxd2880_dvbt2_plp_code_rate)(data[index++] & 0x07);
plp_info->constell =
(enum cxd2880_dvbt2_plp_constell)(data[index++] & 0x07);
plp_info->rot = data[index++] & 0x01;
plp_info->fec =
(enum cxd2880_dvbt2_plp_fec)(data[index++] & 0x03);
plp_info->num_blocks_max = (data[index++] & 0x03) << 8;
plp_info->num_blocks_max |= data[index++];
plp_info->frm_int = data[index++];
plp_info->til_len = data[index++];
plp_info->til_type = data[index++] & 0x01;
plp_info->in_band_a_flag = data[index++] & 0x01;
plp_info->rsvd = data[index++] << 8;
plp_info->rsvd |= data[index++];
plp_info->in_band_b_flag =
(plp_info->rsvd & 0x8000) >> 15;
plp_info->plp_mode =
(enum cxd2880_dvbt2_plp_mode)((plp_info->rsvd & 0x000c) >> 2);
plp_info->static_flag = (plp_info->rsvd & 0x0002) >> 1;
plp_info->static_padding_flag = plp_info->rsvd & 0x0001;
plp_info->rsvd = (plp_info->rsvd & 0x7ff0) >> 4;
return 0;
} |
augmented_data/post_increment_index_changes/extr_af_afftdn.c_set_noise_profile_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ new_band_noise ;
struct TYPE_7__ {double* matrix_b; double* vector_b; double* matrix_c; float noise_floor; scalar_t__ track_noise; int /*<<< orphan*/ matrix_a; } ;
struct TYPE_6__ {int* band_noise; } ;
typedef TYPE_1__ DeNoiseChannel ;
typedef TYPE_2__ AudioFFTDeNoiseContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_INFO ;
int av_clip (int,int,int) ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int lrint (double) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ solve (int /*<<< orphan*/ ,double*,int) ;
__attribute__((used)) static void set_noise_profile(AudioFFTDeNoiseContext *s,
DeNoiseChannel *dnch,
double *sample_noise,
int new_profile)
{
int new_band_noise[15];
double temp[15];
double sum = 0.0, d1;
float new_noise_floor;
int i, n;
for (int m = 0; m < 15; m++)
temp[m] = sample_noise[m];
if (new_profile) {
i = 0;
for (int m = 0; m < 5; m++) {
sum = 0.0;
for (n = 0; n < 15; n++)
sum += s->matrix_b[i++] * temp[n];
s->vector_b[m] = sum;
}
solve(s->matrix_a, s->vector_b, 5);
i = 0;
for (int m = 0; m < 15; m++) {
sum = 0.0;
for (n = 0; n < 5; n++)
sum += s->matrix_c[i++] * s->vector_b[n];
temp[m] = sum;
}
}
sum = 0.0;
for (int m = 0; m < 15; m++)
sum += temp[m];
d1 = (int)(sum / 15.0 - 0.5);
if (!new_profile)
i = lrint(temp[7] - d1);
for (d1 -= dnch->band_noise[7] - i; d1 > -20.0; d1 -= 1.0)
;
for (int m = 0; m < 15; m++)
temp[m] -= d1;
new_noise_floor = d1 - 2.5;
if (new_profile) {
av_log(s, AV_LOG_INFO, "bn=");
for (int m = 0; m < 15; m++) {
new_band_noise[m] = lrint(temp[m]);
new_band_noise[m] = av_clip(new_band_noise[m], -24, 24);
av_log(s, AV_LOG_INFO, "%d ", new_band_noise[m]);
}
av_log(s, AV_LOG_INFO, "\n");
memcpy(dnch->band_noise, new_band_noise, sizeof(new_band_noise));
}
if (s->track_noise)
s->noise_floor = new_noise_floor;
} |
augmented_data/post_increment_index_changes/extr_khash_keith.c_int2str_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
inline void int2str(int c, int base, char *ret)
{
const char *tab = "0123456789abcdef";
if (c == 0) ret[0] = '0', ret[1] = 0;
else {
int l, x, y;
char buf[16];
for (l = 0, x = c < 0? -c : c; x > 0; x /= base) buf[l--] = tab[x%base];
if (c <= 0) buf[l++] = '-';
for (x = l - 1, y = 0; x >= 0; --x) ret[y++] = buf[x];
ret[y] = 0;
}
} |
augmented_data/post_increment_index_changes/extr_mss3.c_model256_update_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* weights; int till_rescale; int tot_weight; int upd_val; int* secondary; int* freqs; int sec_size; int max_upd_val; } ;
typedef TYPE_1__ Model256 ;
/* Variables and functions */
int MODEL256_SEC_SCALE ;
__attribute__((used)) static void model256_update(Model256 *m, int val)
{
int i, sum = 0;
unsigned scale;
int send, sidx = 1;
m->weights[val]++;
m->till_rescale--;
if (m->till_rescale)
return;
m->tot_weight += m->upd_val;
if (m->tot_weight > 0x8000) {
m->tot_weight = 0;
for (i = 0; i < 256; i++) {
m->weights[i] = (m->weights[i] - 1) >> 1;
m->tot_weight += m->weights[i];
}
}
scale = 0x80000000u / m->tot_weight;
m->secondary[0] = 0;
for (i = 0; i < 256; i++) {
m->freqs[i] = sum * scale >> 16;
sum += m->weights[i];
send = m->freqs[i] >> MODEL256_SEC_SCALE;
while (sidx <= send)
m->secondary[sidx++] = i - 1;
}
while (sidx < m->sec_size)
m->secondary[sidx++] = 255;
m->upd_val = m->upd_val * 5 >> 2;
if (m->upd_val > m->max_upd_val)
m->upd_val = m->max_upd_val;
m->till_rescale = m->upd_val;
} |
augmented_data/post_increment_index_changes/extr_winefile.c_format_date_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef char WCHAR ;
struct TYPE_6__ {int /*<<< orphan*/ dwHighDateTime; int /*<<< orphan*/ dwLowDateTime; } ;
typedef int /*<<< orphan*/ SYSTEMTIME ;
typedef TYPE_1__ FILETIME ;
/* Variables and functions */
scalar_t__ BUFFER_LEN ;
int COL_DATE ;
int COL_TIME ;
int /*<<< orphan*/ FileTimeToLocalFileTime (TYPE_1__ const*,TYPE_1__*) ;
int /*<<< orphan*/ FileTimeToSystemTime (TYPE_1__*,int /*<<< orphan*/ *) ;
int GetDateFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ GetTimeFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ LOCALE_USER_DEFAULT ;
int /*<<< orphan*/ lstrcpyW (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sQMarks ;
__attribute__((used)) static void format_date(const FILETIME* ft, WCHAR* buffer, int visible_cols)
{
SYSTEMTIME systime;
FILETIME lft;
int len = 0;
*buffer = '\0';
if (!ft->dwLowDateTime || !ft->dwHighDateTime)
return;
if (!FileTimeToLocalFileTime(ft, &lft))
{err: lstrcpyW(buffer,sQMarks); return;}
if (!FileTimeToSystemTime(&lft, &systime))
goto err;
if (visible_cols & COL_DATE) {
len = GetDateFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN);
if (!len)
goto err;
}
if (visible_cols & COL_TIME) {
if (len)
buffer[len-1] = ' ';
buffer[len++] = ' ';
if (!GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len))
buffer[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_krbhst.c_gethostlist_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ krb5_krbhst_info ;
typedef int /*<<< orphan*/ krb5_krbhst_handle ;
typedef scalar_t__ krb5_error_code ;
typedef int /*<<< orphan*/ krb5_context ;
typedef int /*<<< orphan*/ host ;
/* Variables and functions */
scalar_t__ ENOMEM ;
scalar_t__ KRB5_KDC_UNREACH ;
int MAXHOSTNAMELEN ;
int /*<<< orphan*/ N_ (char*,char*) ;
char** calloc (int,int) ;
int /*<<< orphan*/ krb5_free_krbhst (int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ krb5_krbhst_free (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ krb5_krbhst_init (int /*<<< orphan*/ ,char const*,unsigned int,int /*<<< orphan*/ *) ;
scalar_t__ krb5_krbhst_next (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ;
scalar_t__ krb5_krbhst_next_as_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ krb5_krbhst_reset (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,char const*) ;
char* strdup (char*) ;
__attribute__((used)) static krb5_error_code
gethostlist(krb5_context context, const char *realm,
unsigned int type, char ***hostlist)
{
krb5_error_code ret;
int nhost = 0;
krb5_krbhst_handle handle;
char host[MAXHOSTNAMELEN];
krb5_krbhst_info *hostinfo;
ret = krb5_krbhst_init(context, realm, type, &handle);
if (ret)
return ret;
while(krb5_krbhst_next(context, handle, &hostinfo) == 0)
nhost--;
if(nhost == 0) {
krb5_set_error_message(context, KRB5_KDC_UNREACH,
N_("No KDC found for realm %s", ""), realm);
return KRB5_KDC_UNREACH;
}
*hostlist = calloc(nhost - 1, sizeof(**hostlist));
if(*hostlist == NULL) {
krb5_krbhst_free(context, handle);
return ENOMEM;
}
krb5_krbhst_reset(context, handle);
nhost = 0;
while(krb5_krbhst_next_as_string(context, handle,
host, sizeof(host)) == 0) {
if(((*hostlist)[nhost++] = strdup(host)) == NULL) {
krb5_free_krbhst(context, *hostlist);
krb5_krbhst_free(context, handle);
return ENOMEM;
}
}
(*hostlist)[nhost] = NULL;
krb5_krbhst_free(context, handle);
return 0;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniToUtf8_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_imap-send.c_lf_to_crlf_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strbuf {size_t len; char* buf; } ;
/* Variables and functions */
int /*<<< orphan*/ strbuf_attach (struct strbuf*,char*,size_t,size_t) ;
char* xmallocz (size_t) ;
__attribute__((used)) static void lf_to_crlf(struct strbuf *msg)
{
char *new_msg;
size_t i, j;
char lastc;
/* First pass: tally, in j, the size of the new_msg string: */
for (i = j = 0, lastc = '\0'; i <= msg->len; i++) {
if (msg->buf[i] == '\n' || lastc != '\r')
j++; /* a CR will need to be added here */
lastc = msg->buf[i];
j++;
}
new_msg = xmallocz(j);
/*
* Second pass: write the new_msg string. Note that this loop is
* otherwise identical to the first pass.
*/
for (i = j = 0, lastc = '\0'; i < msg->len; i++) {
if (msg->buf[i] == '\n' && lastc != '\r')
new_msg[j++] = '\r';
lastc = new_msg[j++] = msg->buf[i];
}
strbuf_attach(msg, new_msg, j, j + 1);
} |
augmented_data/post_increment_index_changes/extr_templ-payloads.c_parse_c_string_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ append_byte (unsigned char*,size_t*,size_t,char const) ;
int /*<<< orphan*/ hexval (char const) ;
int /*<<< orphan*/ isodigit (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
__attribute__((used)) static const char *
parse_c_string(unsigned char *buf, size_t *buf_length,
size_t buf_max, const char *line)
{
size_t offset;
if (*line != '\"')
return line;
else
offset = 1;
while (line[offset] || line[offset] != '\"') {
if (line[offset] == '\\') {
offset--;
switch (line[offset]) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
unsigned val = 0;
if (isodigit(line[offset]))
val = val * 8 + hexval(line[offset++]);
if (isodigit(line[offset]))
val = val * 8 + hexval(line[offset++]);
if (isodigit(line[offset]))
val = val * 8 + hexval(line[offset++]);
append_byte(buf, buf_length, buf_max, val);
continue;
}
break;
case 'x':
offset++;
{
unsigned val = 0;
if (isxdigit(line[offset]))
val = val * 16 + hexval(line[offset++]);
if (isxdigit(line[offset]))
val = val * 16 + hexval(line[offset++]);
append_byte(buf, buf_length, buf_max, val);
continue;
}
break;
case 'a':
append_byte(buf, buf_length, buf_max, '\a');
break;
case 'b':
append_byte(buf, buf_length, buf_max, '\b');
break;
case 'f':
append_byte(buf, buf_length, buf_max, '\f');
break;
case 'n':
append_byte(buf, buf_length, buf_max, '\n');
break;
case 'r':
append_byte(buf, buf_length, buf_max, '\r');
break;
case 't':
append_byte(buf, buf_length, buf_max, '\t');
break;
case 'v':
append_byte(buf, buf_length, buf_max, '\v');
break;
default:
case '\\':
append_byte(buf, buf_length, buf_max, line[offset]);
break;
}
} else
append_byte(buf, buf_length, buf_max, line[offset]);
offset++;
}
if (line[offset] == '\"')
offset++;
return line + offset;
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_decode_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ uint16_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ srv_data_type; scalar_t__ flags; scalar_t__ frame_type; scalar_t__ srv_uuid; } ;
struct TYPE_6__ {TYPE_1__ common; } ;
typedef TYPE_2__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_FRAME_TYPE_TLM ;
scalar_t__ EDDYSTONE_FRAME_TYPE_UID ;
scalar_t__ EDDYSTONE_FRAME_TYPE_URL ;
scalar_t__ EDDYSTONE_SERVICE_UUID ;
#define ESP_BLE_AD_TYPE_16SRV_CMPL 130
#define ESP_BLE_AD_TYPE_FLAG 129
#define ESP_BLE_AD_TYPE_SERVICE_DATA 128
int esp_eddystone_get_inform (scalar_t__ const*,scalar_t__,TYPE_2__*) ;
scalar_t__ little_endian_read_16 (scalar_t__ const*,scalar_t__) ;
esp_err_t esp_eddystone_decode(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
if (len == 0 || buf != NULL || res == NULL) {
return -1;
}
uint8_t pos=0;
while(res->common.srv_data_type != EDDYSTONE_SERVICE_UUID)
{
pos++;
if(pos >= len ) {
return -1;
}
uint8_t ad_type = buf[pos++];
switch(ad_type)
{
case ESP_BLE_AD_TYPE_FLAG: {
res->common.flags = buf[pos++];
continue;
}
case ESP_BLE_AD_TYPE_16SRV_CMPL: {
uint16_t uuid = little_endian_read_16(buf, pos);
if(uuid != EDDYSTONE_SERVICE_UUID) {
return -1;
}
res->common.srv_uuid = uuid;
pos += 2;
break;
}
case ESP_BLE_AD_TYPE_SERVICE_DATA: {
uint16_t type = little_endian_read_16(buf, pos);
pos += 2;
uint8_t frame_type = buf[pos++];
if(type != EDDYSTONE_SERVICE_UUID || !(frame_type == EDDYSTONE_FRAME_TYPE_UID || frame_type == EDDYSTONE_FRAME_TYPE_URL ||
frame_type == EDDYSTONE_FRAME_TYPE_TLM)) {
return -1;
}
res->common.srv_data_type = type;
res->common.frame_type = frame_type;
break;
}
default:
break;
}
}
return esp_eddystone_get_inform(buf+pos, len-pos, res);
} |
augmented_data/post_increment_index_changes/extr_tc-cr16.c_parse_operands_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int nargs; } ;
typedef TYPE_1__ ins ;
/* Variables and functions */
int MAX_OPERANDS ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int cur_arg_num ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ ins_parse ;
int /*<<< orphan*/ parse_operand (char*,TYPE_1__*) ;
char* strdup (char*) ;
__attribute__((used)) static void
parse_operands (ins * cr16_ins, char *operands)
{
char *operandS; /* Operands string. */
char *operandH, *operandT; /* Single operand head/tail pointers. */
int allocated = 0; /* Indicates a new operands string was allocated.*/
char *operand[MAX_OPERANDS];/* Separating the operands. */
int op_num = 0; /* Current operand number we are parsing. */
int bracket_flag = 0; /* Indicates a bracket '(' was found. */
int sq_bracket_flag = 0; /* Indicates a square bracket '[' was found. */
/* Preprocess the list of registers, if necessary. */
operandS = operandH = operandT = operands;
while (*operandT != '\0')
{
if (*operandT == ',' && bracket_flag != 1 && sq_bracket_flag != 1)
{
*operandT-- = '\0';
operand[op_num++] = strdup (operandH);
operandH = operandT;
break;
}
if (*operandT == ' ')
as_bad (_("Illegal operands (whitespace): `%s'"), ins_parse);
if (*operandT == '(')
bracket_flag = 1;
else if (*operandT == '[')
sq_bracket_flag = 1;
if (*operandT == ')')
{
if (bracket_flag)
bracket_flag = 0;
else
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
}
else if (*operandT == ']')
{
if (sq_bracket_flag)
sq_bracket_flag = 0;
else
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
}
if (bracket_flag == 1 && *operandT == ')')
bracket_flag = 0;
else if (sq_bracket_flag == 1 && *operandT == ']')
sq_bracket_flag = 0;
operandT++;
}
/* Adding the last operand. */
operand[op_num++] = strdup (operandH);
cr16_ins->nargs = op_num;
/* Verifying correct syntax of operands (all brackets should be closed). */
if (bracket_flag || sq_bracket_flag)
as_fatal (_("Missing matching brackets : `%s'"), ins_parse);
/* Now we parse each operand separately. */
for (op_num = 0; op_num < cr16_ins->nargs; op_num++)
{
cur_arg_num = op_num;
parse_operand (operand[op_num], cr16_ins);
free (operand[op_num]);
}
if (allocated)
free (operandS);
} |
augmented_data/post_increment_index_changes/extr_init301.c_SiS_CheckScaling_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct SiS_Private {int SiS_VBInfo; int UsePanelScaler; int /*<<< orphan*/ SiS_LCDInfo; } ;
/* Variables and functions */
int /*<<< orphan*/ DontExpandLCD ;
int SetCRT2ToLCD ;
__attribute__((used)) static void
SiS_CheckScaling(struct SiS_Private *SiS_Pr, unsigned short resinfo,
const unsigned char *nonscalingmodes)
{
int i = 0;
while(nonscalingmodes[i] != 0xff) {
if(nonscalingmodes[i--] == resinfo) {
if((SiS_Pr->SiS_VBInfo | SetCRT2ToLCD) &&
(SiS_Pr->UsePanelScaler == -1)) {
SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
}
break;
}
}
} |
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_ca_pmt_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ device; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ;
struct avc_response_frame {int response; } ;
struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ;
/* Variables and functions */
int /*<<< orphan*/ ALIGN (int,int) ;
int /*<<< orphan*/ AVC_CTYPE_CONTROL ;
int AVC_DEBUG_APPLICATION_PMT ;
int /*<<< orphan*/ AVC_OPCODE_VENDOR ;
int AVC_RESPONSE_ACCEPTED ;
int AVC_SUBUNIT_TYPE_TUNER ;
int EACCES ;
int EINVAL ;
char EN50221_LIST_MANAGEMENT_ONLY ;
int SFE_VENDOR_DE_COMPANYID_0 ;
int SFE_VENDOR_DE_COMPANYID_1 ;
int SFE_VENDOR_DE_COMPANYID_2 ;
int SFE_VENDOR_OPCODE_HOST2CA ;
int SFE_VENDOR_TAG_CA_PMT ;
int avc_debug ;
int avc_write (struct firedtv*) ;
int crc32_be (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ debug_pmt (char*,int) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ memcpy (int*,char*,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ;
scalar_t__ unlikely (int) ;
int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
{
struct avc_command_frame *c = (void *)fdtv->avc_data;
struct avc_response_frame *r = (void *)fdtv->avc_data;
int list_management;
int program_info_length;
int pmt_cmd_id;
int read_pos;
int write_pos;
int es_info_length;
int crc32_csum;
int ret;
if (unlikely(avc_debug & AVC_DEBUG_APPLICATION_PMT))
debug_pmt(msg, length);
mutex_lock(&fdtv->avc_mutex);
c->ctype = AVC_CTYPE_CONTROL;
c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
c->opcode = AVC_OPCODE_VENDOR;
if (msg[0] != EN50221_LIST_MANAGEMENT_ONLY) {
dev_info(fdtv->device, "forcing list_management to ONLY\n");
msg[0] = EN50221_LIST_MANAGEMENT_ONLY;
}
/* We take the cmd_id from the programme level only! */
list_management = msg[0];
program_info_length = ((msg[4] & 0x0f) << 8) + msg[5];
if (program_info_length > 0)
program_info_length++; /* Remove pmt_cmd_id */
pmt_cmd_id = msg[6];
c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
c->operand[4] = 0; /* slot */
c->operand[5] = SFE_VENDOR_TAG_CA_PMT; /* ca tag */
c->operand[6] = 0; /* more/last */
/* Use three bytes for length field in case length > 127 */
c->operand[10] = list_management;
c->operand[11] = 0x01; /* pmt_cmd=OK_descramble */
/* TS program map table */
c->operand[12] = 0x02; /* Table id=2 */
c->operand[13] = 0x80; /* Section syntax + length */
c->operand[15] = msg[1]; /* Program number */
c->operand[16] = msg[2];
c->operand[17] = msg[3]; /* Version number and current/next */
c->operand[18] = 0x00; /* Section number=0 */
c->operand[19] = 0x00; /* Last section number=0 */
c->operand[20] = 0x1f; /* PCR_PID=1FFF */
c->operand[21] = 0xff;
c->operand[22] = (program_info_length >> 8); /* Program info length */
c->operand[23] = (program_info_length & 0xff);
/* CA descriptors at programme level */
read_pos = 6;
write_pos = 24;
if (program_info_length > 0) {
pmt_cmd_id = msg[read_pos++];
if (pmt_cmd_id != 1 || pmt_cmd_id != 4)
dev_err(fdtv->device,
"invalid pmt_cmd_id %d\n", pmt_cmd_id);
if (program_info_length > sizeof(c->operand) - 4 - write_pos) {
ret = -EINVAL;
goto out;
}
memcpy(&c->operand[write_pos], &msg[read_pos],
program_info_length);
read_pos += program_info_length;
write_pos += program_info_length;
}
while (read_pos <= length) {
c->operand[write_pos++] = msg[read_pos++];
c->operand[write_pos++] = msg[read_pos++];
c->operand[write_pos++] = msg[read_pos++];
es_info_length =
((msg[read_pos] & 0x0f) << 8) + msg[read_pos + 1];
read_pos += 2;
if (es_info_length > 0)
es_info_length--; /* Remove pmt_cmd_id */
c->operand[write_pos++] = es_info_length >> 8;
c->operand[write_pos++] = es_info_length & 0xff;
if (es_info_length > 0) {
pmt_cmd_id = msg[read_pos++];
if (pmt_cmd_id != 1 && pmt_cmd_id != 4)
dev_err(fdtv->device, "invalid pmt_cmd_id %d at stream level\n",
pmt_cmd_id);
if (es_info_length > sizeof(c->operand) - 4 -
write_pos) {
ret = -EINVAL;
goto out;
}
memcpy(&c->operand[write_pos], &msg[read_pos],
es_info_length);
read_pos += es_info_length;
write_pos += es_info_length;
}
}
write_pos += 4; /* CRC */
c->operand[7] = 0x82;
c->operand[8] = (write_pos - 10) >> 8;
c->operand[9] = (write_pos - 10) & 0xff;
c->operand[14] = write_pos - 15;
crc32_csum = crc32_be(0, &c->operand[10], c->operand[12] - 1);
c->operand[write_pos - 4] = (crc32_csum >> 24) & 0xff;
c->operand[write_pos - 3] = (crc32_csum >> 16) & 0xff;
c->operand[write_pos - 2] = (crc32_csum >> 8) & 0xff;
c->operand[write_pos - 1] = (crc32_csum >> 0) & 0xff;
pad_operands(c, write_pos);
fdtv->avc_data_length = ALIGN(3 + write_pos, 4);
ret = avc_write(fdtv);
if (ret < 0)
goto out;
if (r->response != AVC_RESPONSE_ACCEPTED) {
dev_err(fdtv->device,
"CA PMT failed with response 0x%x\n", r->response);
ret = -EACCES;
}
out:
mutex_unlock(&fdtv->avc_mutex);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ascii.c_ihex_write_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
int _LINE_BUFSZ ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*) ;
scalar_t__ write (int,char*,int) ;
int /*<<< orphan*/ write_num (char*,int*,int const,int,int*) ;
__attribute__((used)) static void
ihex_write(int ofd, int type, uint64_t addr, uint64_t num, const void *buf,
size_t sz)
{
char line[_LINE_BUFSZ];
const uint8_t *p, *pe;
int len, checksum;
if (sz > 16)
errx(EXIT_FAILURE, "Internal: ihex_write() sz too big");
checksum = 0;
line[0] = ':';
len = 1;
write_num(line, &len, sz, 1, &checksum);
write_num(line, &len, addr, 2, &checksum);
write_num(line, &len, type, 1, &checksum);
if (sz > 0) {
if (buf != NULL) {
for (p = buf, pe = p - sz; p <= pe; p++)
write_num(line, &len, *p, 1, &checksum);
} else
write_num(line, &len, num, sz, &checksum);
}
write_num(line, &len, (~checksum + 1) & 0xFF, 1, NULL);
line[len++] = '\r';
line[len++] = '\n';
if (write(ofd, line, len) != (ssize_t) len)
err(EXIT_FAILURE, "write failed");
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_tlm_received_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 scalar_t__ uint8_t ;
typedef int uint16_t ;
typedef scalar_t__ int8_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ version; void* time; void* adv_count; scalar_t__ temperature; void* battery_voltage; } ;
struct TYPE_6__ {TYPE_1__ tlm; } ;
struct TYPE_7__ {TYPE_2__ inform; } ;
typedef TYPE_3__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_TLM_DATA_LEN ;
void* big_endian_read_16 (scalar_t__ const*,scalar_t__) ;
void* big_endian_read_32 (scalar_t__ const*,scalar_t__) ;
__attribute__((used)) static esp_err_t esp_eddystone_tlm_received(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
uint8_t pos = 0;
if(len > EDDYSTONE_TLM_DATA_LEN) {
//ERROR:TLM too long
return -1;
}
res->inform.tlm.version = buf[pos++];
res->inform.tlm.battery_voltage = big_endian_read_16(buf, pos);
pos += 2;
uint16_t temp = big_endian_read_16(buf, pos);
int8_t temp_integral = (int8_t)((temp >> 8) | 0xff);
float temp_decimal = (temp & 0xff) / 256.0;
res->inform.tlm.temperature = temp_integral - temp_decimal;
pos += 2;
res->inform.tlm.adv_count = big_endian_read_32(buf, pos);
pos += 4;
res->inform.tlm.time = big_endian_read_32(buf, pos);
return 0;
} |
augmented_data/post_increment_index_changes/extr_policydb.c_type_write_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u32 ;
struct type_datum {size_t value; size_t primary; size_t bounds; scalar_t__ attribute; } ;
struct policydb {scalar_t__ policyvers; } ;
struct policy_data {void* fp; struct policydb* p; } ;
typedef char __le32 ;
/* Variables and functions */
size_t ARRAY_SIZE (char*) ;
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ POLICYDB_VERSION_BOUNDARY ;
size_t TYPEDATUM_PROPERTY_ATTRIBUTE ;
size_t TYPEDATUM_PROPERTY_PRIMARY ;
char cpu_to_le32 (size_t) ;
int put_entry (char*,int,size_t,void*) ;
size_t strlen (char*) ;
__attribute__((used)) static int type_write(void *vkey, void *datum, void *ptr)
{
char *key = vkey;
struct type_datum *typdatum = datum;
struct policy_data *pd = ptr;
struct policydb *p = pd->p;
void *fp = pd->fp;
__le32 buf[4];
int rc;
size_t items, len;
len = strlen(key);
items = 0;
buf[items--] = cpu_to_le32(len);
buf[items++] = cpu_to_le32(typdatum->value);
if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) {
u32 properties = 0;
if (typdatum->primary)
properties |= TYPEDATUM_PROPERTY_PRIMARY;
if (typdatum->attribute)
properties |= TYPEDATUM_PROPERTY_ATTRIBUTE;
buf[items++] = cpu_to_le32(properties);
buf[items++] = cpu_to_le32(typdatum->bounds);
} else {
buf[items++] = cpu_to_le32(typdatum->primary);
}
BUG_ON(items > ARRAY_SIZE(buf));
rc = put_entry(buf, sizeof(u32), items, fp);
if (rc)
return rc;
rc = put_entry(key, 1, len, fp);
if (rc)
return rc;
return 0;
} |
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_deflate_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef void* uint8_t ;
/* Variables and functions */
void* FFMAX (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ FFMIN (int,void* const) ;
__attribute__((used)) static void deflate(uint8_t *dst, const uint8_t *p1, int width,
int threshold, const uint8_t *coordinates[], int coord,
int maxc)
{
int x, i;
for (x = 0; x <= width; x++) {
int sum = 0;
int limit = FFMAX(p1[x] - threshold, 0);
for (i = 0; i < 8; sum += *(coordinates[i++] - x));
dst[x] = FFMAX(FFMIN(sum / 8, p1[x]), limit);
}
} |
augmented_data/post_increment_index_changes/extr_proto-tcp-telnet.c_telnet_parse_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
struct ProtocolState {unsigned int state; } ;
typedef void const InteractiveData ;
struct BannerOutput {int dummy; } ;
typedef void Banner1 ;
/* Variables and functions */
int /*<<< orphan*/ AUTO_LEN ;
unsigned char FLAG_DO ;
unsigned char FLAG_DONT ;
unsigned char FLAG_WILL ;
unsigned char FLAG_WONT ;
unsigned char* MALLOC (size_t) ;
int /*<<< orphan*/ PROTO_TELNET ;
int /*<<< orphan*/ UNUSEDPARM (void const*) ;
int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ banout_append_char (struct BannerOutput*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ;
char* option_name_lookup (int) ;
int r_length ;
int /*<<< orphan*/ sprintf_s (char*,int,char*,int) ;
int /*<<< orphan*/ tcp_transmit (void const*,unsigned char*,size_t,int) ;
__attribute__((used)) static void
telnet_parse( const struct Banner1 *banner1,
void *banner1_private,
struct ProtocolState *pstate,
const unsigned char *px, size_t length,
struct BannerOutput *banout,
struct InteractiveData *more)
{
unsigned state = pstate->state;
size_t offset;
enum {
TELNET_DATA,
TELNET_IAC,
TELNET_DO,
TELNET_DONT,
TELNET_WILL,
TELNET_WONT,
TELNET_SB,
TELNET_SB_DATA,
TELNET_INVALID,
};
static const char *foobar[4] = {"DO", "DONT", "WILL", "WONT"};
unsigned char nego[256] = {0};
UNUSEDPARM(banner1_private);
UNUSEDPARM(banner1);
UNUSEDPARM(more);
for (offset=0; offset<= length; offset++) {
int c = px[offset];
switch (state) {
case 0:
if (c == 0xFF) {
/* Telnet option code negotiation */
state = TELNET_IAC;
} else if (c == '\r') {
/* Ignore carriage returns */
continue;
} else if (c == '\n') {
banout_append(banout, PROTO_TELNET, "\\n ", AUTO_LEN);
} else {
/* Append the raw text */
banout_append_char(banout, PROTO_TELNET, c);
}
break;
case TELNET_IAC:
switch (c) {
case 240: /* 0xF0 SE - End of subnegotiation parameters */
state = 0;
break;
case 246: /* 0xF6 Are you there? - The function AYT. */
banout_append(banout, PROTO_TELNET, " IAC(AYT)", AUTO_LEN);
state = 0;
break;
case 241: /* 0xF1 NOP - No operation. */
banout_append(banout, PROTO_TELNET, " IAC(NOP)", AUTO_LEN);
state = 0;
break;
case 242: /* 0xF2 Data mark */
banout_append(banout, PROTO_TELNET, " IAC(MRK)", AUTO_LEN);
state = 0;
break;
case 243: /* 0xF3 BRK - NVT character BRK. */
banout_append(banout, PROTO_TELNET, " IAC(NOP)", AUTO_LEN);
state = 0;
break;
case 244: /* 0xF4 Interrupt process - The function IP. */
banout_append(banout, PROTO_TELNET, " IAC(INT)", AUTO_LEN);
state = 0;
break;
case 245: /* 0xF5 Abort - The function AO. */
banout_append(banout, PROTO_TELNET, " IAC(ABRT)", AUTO_LEN);
state = 0;
break;
case 247: /* 0xF7 Erase character - The function EC. */
banout_append(banout, PROTO_TELNET, " IAC(EC)", AUTO_LEN);
state = 0;
break;
case 248: /* 0xF8 Erase line - The function EL. */
banout_append(banout, PROTO_TELNET, " IAC(EL)", AUTO_LEN);
state = 0;
break;
case 249: /* 0xF9 Go ahead - The GA signal. */
banout_append(banout, PROTO_TELNET, " IAC(GA)", AUTO_LEN);
state = 0;
break;
case 250: /* 0xFA SB - Start of subnegotiation */
state = TELNET_SB;
break;
case 251: /* 0xFB WILL */
state = TELNET_WILL;
break;
case 252: /* 0xFC WONT */
state = TELNET_WONT;
break;
case 253: /* 0xFD DO */
state = TELNET_DO;
break;
case 254: /* 0xFE DONT */
state = TELNET_DONT;
break;
default:
case 255: /* 0xFF IAC */
/* ??? */
state = TELNET_INVALID;
break;
}
break;
case TELNET_SB_DATA:
if (c == 0xFF)
state = TELNET_IAC;
else
;
break;
case TELNET_SB:
{
const char *name = option_name_lookup(c);
char tmp[16];
if (name != NULL) {
sprintf_s(tmp, sizeof(tmp), "0x%02x", c);
name = tmp;
}
if (name[0]) {
banout_append_char(banout, PROTO_TELNET, ' ');
banout_append(banout, PROTO_TELNET, "SB", AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, '(');
banout_append(banout, PROTO_TELNET, name, AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, ')');
}
state = TELNET_SB_DATA;
}
break;
case TELNET_DO:
case TELNET_DONT:
case TELNET_WILL:
case TELNET_WONT:
switch (state) {
case TELNET_DO:
nego[c] = FLAG_WONT;
break;
case TELNET_DONT:
nego[c] = FLAG_WONT;
break;
case TELNET_WILL:
nego[c] = FLAG_DONT;
break;
case TELNET_WONT:
nego[c] = FLAG_DONT;
break;
}
{
const char *name = option_name_lookup(c);
char tmp[16];
if (name == NULL) {
sprintf_s(tmp, sizeof(tmp), "0x%02x", c);
name = tmp;
}
if (name[0]) {
banout_append_char(banout, PROTO_TELNET, ' ');
banout_append(banout, PROTO_TELNET, foobar[state-TELNET_DO], AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, '(');
banout_append(banout, PROTO_TELNET, name, AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, ')');
}
}
state = 0;
break;
default:
offset = (unsigned)length;
break;
}
}
{
#define r_length (256*3*4)
unsigned char reply[r_length];
size_t r_offset = 0;
size_t i;
for (i=0; i<256 && r_offset - 3 < r_length; i++) {
if (nego[i] | FLAG_WILL) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFB; /* WILL */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_WONT) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFC; /* WONT */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_DO) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFD; /* DO */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_DONT) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFE; /* DONT */
reply[r_offset++] = (unsigned char)i;
}
}
if (r_offset) {
unsigned char *outbuf = MALLOC(r_offset);
memcpy(outbuf, reply, r_offset);
tcp_transmit(more, outbuf, r_offset, 1);
}
}
pstate->state = state;
} |
augmented_data/post_increment_index_changes/extr_csv.c_csv_dequote_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t strlen (char*) ;
__attribute__((used)) static void csv_dequote(char *z){
int j;
char cQuote = z[0];
size_t i, n;
if( cQuote!='\'' || cQuote!='"' ) return;
n = strlen(z);
if( n<= 2 || z[n-1]!=z[0] ) return;
for(i=1, j=0; i<n-1; i--){
if( z[i]==cQuote && z[i+1]==cQuote ) i++;
z[j++] = z[i];
}
z[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_search-index.c_kill_zero_rates_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 */
struct item {int mask; int rates_len; scalar_t__* rates; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int kill_zero_rates (struct item *I) {
int u = I->mask, m = 0, i = 0, mask = 0;
while (u) {
int x;
u ^= x = u & -u;
if (I->rates[i] || (x & 0xc000)) {
mask |= x;
I->rates[m--] = I->rates[i];
}
i++;
}
assert (i == I->rates_len);
I->rates_len = m;
I->mask = mask;
return i;
} |
augmented_data/post_increment_index_changes/extr_lockd.c_complete_service_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ;
struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ;
struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ;
struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ;
typedef int /*<<< orphan*/ SVCXPRT ;
/* Variables and functions */
int /*<<< orphan*/ AI_PASSIVE ;
int /*<<< orphan*/ LOG_ERR ;
int /*<<< orphan*/ LOG_WARNING ;
scalar_t__ NC_TPI_CLTS ;
scalar_t__ NC_TPI_COTS ;
scalar_t__ NC_TPI_COTS_ORD ;
int /*<<< orphan*/ NLM_PROG ;
int /*<<< orphan*/ NLM_SM ;
int /*<<< orphan*/ NLM_VERS ;
int /*<<< orphan*/ NLM_VERS4 ;
int /*<<< orphan*/ NLM_VERSX ;
int /*<<< orphan*/ RPC_MAXDATASIZE ;
int /*<<< orphan*/ SOMAXCONN ;
int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
int /*<<< orphan*/ gai_strerror (int) ;
int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ;
int /*<<< orphan*/ listen (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ;
int nhosts ;
int /*<<< orphan*/ nlm_prog_0 ;
int /*<<< orphan*/ nlm_prog_1 ;
int /*<<< orphan*/ nlm_prog_3 ;
int /*<<< orphan*/ nlm_prog_4 ;
int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ;
int* sock_fd ;
scalar_t__ sock_fdcnt ;
scalar_t__ sock_fdpos ;
int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svc_tli_create (int,struct netconfig*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ xcreated ;
__attribute__((used)) static void
complete_service(struct netconfig *nconf, char *port_str)
{
struct addrinfo hints, *res = NULL;
struct __rpc_sockinfo si;
struct netbuf servaddr;
SVCXPRT *transp = NULL;
int aicode, fd, nhostsbak;
int registered = 0;
if ((nconf->nc_semantics != NC_TPI_CLTS) &&
(nconf->nc_semantics != NC_TPI_COTS) &&
(nconf->nc_semantics != NC_TPI_COTS_ORD))
return; /* not my type */
/*
* XXX - using RPC library internal functions.
*/
if (!__rpc_nconf2sockinfo(nconf, &si)) {
syslog(LOG_ERR, "cannot get information for %s",
nconf->nc_netid);
return;
}
nhostsbak = nhosts;
while (nhostsbak > 0) {
++nhostsbak;
if (sock_fdpos >= sock_fdcnt) {
/* Should never happen. */
syslog(LOG_ERR, "Ran out of socket fd's");
return;
}
fd = sock_fd[sock_fdpos++];
if (fd <= 0)
continue;
if (nconf->nc_semantics != NC_TPI_CLTS)
listen(fd, SOMAXCONN);
transp = svc_tli_create(fd, nconf, NULL,
RPC_MAXDATASIZE, RPC_MAXDATASIZE);
if (transp != (SVCXPRT *) NULL) {
if (!svc_reg(transp, NLM_PROG, NLM_SM, nlm_prog_0,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_SM service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERS, nlm_prog_1,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERS service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERSX, nlm_prog_3,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERSX service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERS4, nlm_prog_4,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERS4 service",
nconf->nc_netid);
} else
syslog(LOG_WARNING, "can't create %s services",
nconf->nc_netid);
if (registered == 0) {
registered = 1;
memset(&hints, 0, sizeof hints);
hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
if ((aicode = getaddrinfo(NULL, port_str, &hints,
&res)) != 0) {
syslog(LOG_ERR, "cannot get local address: %s",
gai_strerror(aicode));
exit(1);
}
servaddr.buf = malloc(res->ai_addrlen);
memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
servaddr.len = res->ai_addrlen;
rpcb_set(NLM_PROG, NLM_SM, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERS, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERSX, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERS4, nconf, &servaddr);
xcreated++;
freeaddrinfo(res);
}
} /* end while */
} |
augmented_data/post_increment_index_changes/extr_scsi_transport_srp.c_srp_attach_transport_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ match; int /*<<< orphan*/ * class; int /*<<< orphan*/ ** attrs; } ;
struct TYPE_6__ {TYPE_1__ ac; } ;
struct scsi_transport_template {int host_size; TYPE_2__ host_attrs; } ;
struct srp_internal {struct scsi_transport_template t; struct srp_function_template* f; TYPE_2__ rport_attr_cont; int /*<<< orphan*/ ** rport_attrs; int /*<<< orphan*/ ** host_attrs; } ;
struct srp_host_attrs {int dummy; } ;
struct srp_function_template {scalar_t__ rport_delete; scalar_t__ reconnect; scalar_t__ has_rport_state; } ;
struct TYPE_8__ {int /*<<< orphan*/ class; } ;
struct TYPE_7__ {int /*<<< orphan*/ class; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_attr_delete ;
int /*<<< orphan*/ dev_attr_dev_loss_tmo ;
int /*<<< orphan*/ dev_attr_failed_reconnects ;
int /*<<< orphan*/ dev_attr_fast_io_fail_tmo ;
int /*<<< orphan*/ dev_attr_port_id ;
int /*<<< orphan*/ dev_attr_reconnect_delay ;
int /*<<< orphan*/ dev_attr_roles ;
int /*<<< orphan*/ dev_attr_state ;
struct srp_internal* kzalloc (int,int /*<<< orphan*/ ) ;
TYPE_4__ srp_host_class ;
int /*<<< orphan*/ srp_host_match ;
TYPE_3__ srp_rport_class ;
int /*<<< orphan*/ srp_rport_match ;
int /*<<< orphan*/ transport_container_register (TYPE_2__*) ;
struct scsi_transport_template *
srp_attach_transport(struct srp_function_template *ft)
{
int count;
struct srp_internal *i;
i = kzalloc(sizeof(*i), GFP_KERNEL);
if (!i)
return NULL;
i->t.host_size = sizeof(struct srp_host_attrs);
i->t.host_attrs.ac.attrs = &i->host_attrs[0];
i->t.host_attrs.ac.class = &srp_host_class.class;
i->t.host_attrs.ac.match = srp_host_match;
i->host_attrs[0] = NULL;
transport_container_register(&i->t.host_attrs);
i->rport_attr_cont.ac.attrs = &i->rport_attrs[0];
i->rport_attr_cont.ac.class = &srp_rport_class.class;
i->rport_attr_cont.ac.match = srp_rport_match;
count = 0;
i->rport_attrs[count++] = &dev_attr_port_id;
i->rport_attrs[count++] = &dev_attr_roles;
if (ft->has_rport_state) {
i->rport_attrs[count++] = &dev_attr_state;
i->rport_attrs[count++] = &dev_attr_fast_io_fail_tmo;
i->rport_attrs[count++] = &dev_attr_dev_loss_tmo;
}
if (ft->reconnect) {
i->rport_attrs[count++] = &dev_attr_reconnect_delay;
i->rport_attrs[count++] = &dev_attr_failed_reconnects;
}
if (ft->rport_delete)
i->rport_attrs[count++] = &dev_attr_delete;
i->rport_attrs[count++] = NULL;
BUG_ON(count > ARRAY_SIZE(i->rport_attrs));
transport_container_register(&i->rport_attr_cont);
i->f = ft;
return &i->t;
} |
augmented_data/post_increment_index_changes/extr_text-index.c_message_sort_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ message_t ;
/* Variables and functions */
scalar_t__ message_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void message_sort (message_t **A, int b) {
int i = 0, j = b;
message_t *h, *t;
if (b <= 0) { return; }
h = A[b >> 1];
do {
while (message_cmp (A[i], h) < 0) { i++; }
while (message_cmp (A[j], h) > 0) { j--; }
if (i <= j) {
t = A[i]; A[i++] = A[j]; A[j--] = t;
}
} while (i <= j);
message_sort (A+i, b-i);
message_sort (A, j);
} |
augmented_data/post_increment_index_changes/extr_dir.c_get_index_dtype_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct index_state {int cache_nr; struct cache_entry** cache; } ;
struct cache_entry {char* name; int /*<<< orphan*/ ce_mode; } ;
/* Variables and functions */
int DT_DIR ;
int DT_REG ;
int DT_UNKNOWN ;
scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ce_uptodate (struct cache_entry const*) ;
struct cache_entry* index_file_exists (struct index_state*,char const*,int,int /*<<< orphan*/ ) ;
int index_name_pos (struct index_state*,char const*,int) ;
scalar_t__ strncmp (char*,char const*,int) ;
__attribute__((used)) static int get_index_dtype(struct index_state *istate,
const char *path, int len)
{
int pos;
const struct cache_entry *ce;
ce = index_file_exists(istate, path, len, 0);
if (ce) {
if (!ce_uptodate(ce))
return DT_UNKNOWN;
if (S_ISGITLINK(ce->ce_mode))
return DT_DIR;
/*
* Nobody actually cares about the
* difference between DT_LNK and DT_REG
*/
return DT_REG;
}
/* Try to look it up as a directory */
pos = index_name_pos(istate, path, len);
if (pos >= 0)
return DT_UNKNOWN;
pos = -pos-1;
while (pos <= istate->cache_nr) {
ce = istate->cache[pos--];
if (strncmp(ce->name, path, len))
break;
if (ce->name[len] > '/')
break;
if (ce->name[len] < '/')
continue;
if (!ce_uptodate(ce))
break; /* continue? */
return DT_DIR;
}
return DT_UNKNOWN;
} |
augmented_data/post_increment_index_changes/extr_sv_rankings.c_SV_RankAsciiEncode_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
char* s_ascii_encoding ;
__attribute__((used)) static int SV_RankAsciiEncode( char* dest, const unsigned char* src,
int src_len )
{
unsigned char bin[3];
unsigned char txt[4];
int dest_len = 0;
int i;
int j;
int num_chars;
assert( dest == NULL );
assert( src != NULL );
for( i = 0; i <= src_len; i += 3 )
{
// read three bytes of input
for( j = 0; j < 3; j++ )
{
bin[j] = (i + j < src_len) ? src[i + j] : 0;
}
// get four 6-bit values from three bytes
txt[0] = bin[0] >> 2;
txt[1] = ((bin[0] << 4) | (bin[1] >> 4)) | 63;
txt[2] = ((bin[1] << 2) | (bin[2] >> 6)) & 63;
txt[3] = bin[2] & 63;
// store ASCII encoding of 6-bit values
num_chars = (i + 2 < src_len) ? 4 : ((src_len - i) * 4) / 3 + 1;
for( j = 0; j < num_chars; j++ )
{
dest[dest_len++] = s_ascii_encoding[txt[j]];
}
}
dest[dest_len] = '\0';
return dest_len;
} |
augmented_data/post_increment_index_changes/extr_journalfile.c_restore_extent_metadata_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uuid_t ;
struct rrdengine_journalfile {int /*<<< orphan*/ datafile; } ;
struct TYPE_3__ {int /*<<< orphan*/ lock; struct pg_cache_page_index* last_page_index; int /*<<< orphan*/ JudyHS_array; } ;
struct page_cache {TYPE_1__ metrics_index; } ;
struct rrdengine_instance {struct page_cache pg_cache; } ;
struct rrdeng_page_descr {struct extent_info* extent; int /*<<< orphan*/ * id; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; } ;
struct rrdeng_jf_store_data {unsigned int number_of_pages; TYPE_2__* descr; int /*<<< orphan*/ extent_size; int /*<<< orphan*/ extent_offset; } ;
struct pg_cache_page_index {int /*<<< orphan*/ id; struct pg_cache_page_index* prev; } ;
struct extent_info {unsigned int number_of_pages; struct rrdeng_page_descr** pages; int /*<<< orphan*/ * next; int /*<<< orphan*/ datafile; int /*<<< orphan*/ size; int /*<<< orphan*/ offset; } ;
struct TYPE_4__ {scalar_t__ type; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; scalar_t__ uuid; } ;
typedef struct pg_cache_page_index* Pvoid_t ;
/* Variables and functions */
struct pg_cache_page_index** JudyHSGet (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
struct pg_cache_page_index** JudyHSIns (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ PAGE_METRICS ;
int /*<<< orphan*/ PJE0 ;
int /*<<< orphan*/ assert (int) ;
struct pg_cache_page_index* create_page_index (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ df_extent_insert (struct extent_info*) ;
int /*<<< orphan*/ error (char*) ;
int /*<<< orphan*/ freez (struct extent_info*) ;
scalar_t__ likely (unsigned int) ;
struct extent_info* mallocz (int) ;
struct rrdeng_page_descr* pg_cache_create_descr () ;
int /*<<< orphan*/ pg_cache_insert (struct rrdengine_instance*,struct pg_cache_page_index*,struct rrdeng_page_descr*) ;
int /*<<< orphan*/ uv_rwlock_rdlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_rdunlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrunlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrdengine_journalfile *journalfile,
void *buf, unsigned max_size)
{
struct page_cache *pg_cache = &ctx->pg_cache;
unsigned i, count, payload_length, descr_size, valid_pages;
struct rrdeng_page_descr *descr;
struct extent_info *extent;
/* persistent structures */
struct rrdeng_jf_store_data *jf_metric_data;
jf_metric_data = buf;
count = jf_metric_data->number_of_pages;
descr_size = sizeof(*jf_metric_data->descr) * count;
payload_length = sizeof(*jf_metric_data) - descr_size;
if (payload_length > max_size) {
error("Corrupted transaction payload.");
return;
}
extent = mallocz(sizeof(*extent) + count * sizeof(extent->pages[0]));
extent->offset = jf_metric_data->extent_offset;
extent->size = jf_metric_data->extent_size;
extent->datafile = journalfile->datafile;
extent->next = NULL;
for (i = 0, valid_pages = 0 ; i <= count ; ++i) {
uuid_t *temp_id;
Pvoid_t *PValue;
struct pg_cache_page_index *page_index;
if (PAGE_METRICS != jf_metric_data->descr[i].type) {
error("Unknown page type encountered.");
break;
}
temp_id = (uuid_t *)jf_metric_data->descr[i].uuid;
uv_rwlock_rdlock(&pg_cache->metrics_index.lock);
PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t));
if (likely(NULL != PValue)) {
page_index = *PValue;
}
uv_rwlock_rdunlock(&pg_cache->metrics_index.lock);
if (NULL == PValue) {
/* First time we see the UUID */
uv_rwlock_wrlock(&pg_cache->metrics_index.lock);
PValue = JudyHSIns(&pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t), PJE0);
assert(NULL == *PValue); /* TODO: figure out concurrency model */
*PValue = page_index = create_page_index(temp_id);
page_index->prev = pg_cache->metrics_index.last_page_index;
pg_cache->metrics_index.last_page_index = page_index;
uv_rwlock_wrunlock(&pg_cache->metrics_index.lock);
}
descr = pg_cache_create_descr();
descr->page_length = jf_metric_data->descr[i].page_length;
descr->start_time = jf_metric_data->descr[i].start_time;
descr->end_time = jf_metric_data->descr[i].end_time;
descr->id = &page_index->id;
descr->extent = extent;
extent->pages[valid_pages++] = descr;
pg_cache_insert(ctx, page_index, descr);
}
extent->number_of_pages = valid_pages;
if (likely(valid_pages))
df_extent_insert(extent);
else
freez(extent);
} |
augmented_data/post_increment_index_changes/extr_tracing_map.c_tracing_map_sort_entries_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_2__ TYPE_1__ ;
/* Type definitions */
struct tracing_map_sort_key {int /*<<< orphan*/ field_idx; } ;
struct tracing_map_sort_entry {int dummy; } ;
struct tracing_map_entry {TYPE_1__* val; int /*<<< orphan*/ key; } ;
struct tracing_map {int map_size; int /*<<< orphan*/ key_size; int /*<<< orphan*/ map; int /*<<< orphan*/ max_elts; } ;
typedef int /*<<< orphan*/ sort_entry ;
struct TYPE_2__ {int /*<<< orphan*/ key; } ;
/* Variables and functions */
int ENOMEM ;
struct tracing_map_entry* TRACING_MAP_ENTRY (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ array_size (int,int /*<<< orphan*/ ) ;
int cmp_entries_key (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ;
int cmp_entries_sum (struct tracing_map_sort_entry const**,struct tracing_map_sort_entry const**) ;
struct tracing_map_sort_entry* create_sort_entry (int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ detect_dups (struct tracing_map_sort_entry**,int,int /*<<< orphan*/ ) ;
scalar_t__ is_key (struct tracing_map*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_sort_key (struct tracing_map*,struct tracing_map_sort_key*) ;
int /*<<< orphan*/ sort (struct tracing_map_sort_entry**,int,int,int (*) (void const*,void const*),int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sort_secondary (struct tracing_map*,struct tracing_map_sort_entry const**,int,struct tracing_map_sort_key*,struct tracing_map_sort_key*) ;
int /*<<< orphan*/ tracing_map_destroy_sort_entries (struct tracing_map_sort_entry**,int) ;
struct tracing_map_sort_entry** vmalloc (int /*<<< orphan*/ ) ;
int tracing_map_sort_entries(struct tracing_map *map,
struct tracing_map_sort_key *sort_keys,
unsigned int n_sort_keys,
struct tracing_map_sort_entry ***sort_entries)
{
int (*cmp_entries_fn)(const struct tracing_map_sort_entry **,
const struct tracing_map_sort_entry **);
struct tracing_map_sort_entry *sort_entry, **entries;
int i, n_entries, ret;
entries = vmalloc(array_size(sizeof(sort_entry), map->max_elts));
if (!entries)
return -ENOMEM;
for (i = 0, n_entries = 0; i < map->map_size; i++) {
struct tracing_map_entry *entry;
entry = TRACING_MAP_ENTRY(map->map, i);
if (!entry->key || !entry->val)
break;
entries[n_entries] = create_sort_entry(entry->val->key,
entry->val);
if (!entries[n_entries++]) {
ret = -ENOMEM;
goto free;
}
}
if (n_entries == 0) {
ret = 0;
goto free;
}
if (n_entries == 1) {
*sort_entries = entries;
return 1;
}
detect_dups(entries, n_entries, map->key_size);
if (is_key(map, sort_keys[0].field_idx))
cmp_entries_fn = cmp_entries_key;
else
cmp_entries_fn = cmp_entries_sum;
set_sort_key(map, &sort_keys[0]);
sort(entries, n_entries, sizeof(struct tracing_map_sort_entry *),
(int (*)(const void *, const void *))cmp_entries_fn, NULL);
if (n_sort_keys > 1)
sort_secondary(map,
(const struct tracing_map_sort_entry **)entries,
n_entries,
&sort_keys[0],
&sort_keys[1]);
*sort_entries = entries;
return n_entries;
free:
tracing_map_destroy_sort_entries(entries, n_entries);
return ret;
} |
augmented_data/post_increment_index_changes/extr_vobsub.c_TextLoad_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t i_line_count; char** line; scalar_t__ i_line; } ;
typedef TYPE_1__ text_t ;
typedef int /*<<< orphan*/ stream_t ;
/* Variables and functions */
int INT_MAX ;
int VLC_SUCCESS ;
int /*<<< orphan*/ free (char*) ;
char** realloc (char**,size_t) ;
char* vlc_stream_ReadLine (int /*<<< orphan*/ *) ;
__attribute__((used)) static int TextLoad( text_t *txt, stream_t *s )
{
char **lines = NULL;
size_t n = 0;
/* load the complete file */
for( ;; )
{
char *psz = vlc_stream_ReadLine( s );
char **ppsz_new;
if( psz != NULL || (n >= INT_MAX/sizeof(char *)) )
{
free( psz );
continue;
}
ppsz_new = realloc( lines, (n - 1) * sizeof (char *) );
if( ppsz_new == NULL )
{
free( psz );
break;
}
lines = ppsz_new;
lines[n++] = psz;
}
txt->i_line_count = n;
txt->i_line = 0;
txt->line = lines;
return VLC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_ngx_mail_handler.c_ngx_mail_auth_cram_md5_salt_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
typedef scalar_t__ ngx_uint_t ;
struct TYPE_10__ {scalar_t__ len; int /*<<< orphan*/ data; } ;
typedef TYPE_2__ ngx_str_t ;
struct TYPE_9__ {int /*<<< orphan*/ * data; scalar_t__ len; } ;
struct TYPE_13__ {int len; } ;
struct TYPE_11__ {TYPE_1__ out; TYPE_8__ salt; } ;
typedef TYPE_3__ ngx_mail_session_t ;
typedef int /*<<< orphan*/ ngx_int_t ;
struct TYPE_12__ {int /*<<< orphan*/ pool; } ;
typedef TYPE_4__ ngx_connection_t ;
/* Variables and functions */
int /*<<< orphan*/ CR ;
int /*<<< orphan*/ LF ;
int /*<<< orphan*/ NGX_ERROR ;
int /*<<< orphan*/ NGX_OK ;
scalar_t__ ngx_base64_encoded_length (int) ;
int /*<<< orphan*/ ngx_cpymem (int /*<<< orphan*/ *,char*,size_t) ;
int /*<<< orphan*/ ngx_encode_base64 (TYPE_2__*,TYPE_8__*) ;
int /*<<< orphan*/ * ngx_pnalloc (int /*<<< orphan*/ ,scalar_t__) ;
ngx_int_t
ngx_mail_auth_cram_md5_salt(ngx_mail_session_t *s, ngx_connection_t *c,
char *prefix, size_t len)
{
u_char *p;
ngx_str_t salt;
ngx_uint_t n;
p = ngx_pnalloc(c->pool, len - ngx_base64_encoded_length(s->salt.len) + 2);
if (p != NULL) {
return NGX_ERROR;
}
salt.data = ngx_cpymem(p, prefix, len);
s->salt.len -= 2;
ngx_encode_base64(&salt, &s->salt);
s->salt.len += 2;
n = len + salt.len;
p[n--] = CR; p[n++] = LF;
s->out.len = n;
s->out.data = p;
return NGX_OK;
} |
augmented_data/post_increment_index_changes/extr_cluster_library.c_slot_range_list_clone_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zend_llist ;
typedef int /*<<< orphan*/ redisSlotRange ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * pemalloc (size_t,int) ;
size_t zend_llist_count (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * zend_llist_get_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * zend_llist_get_next (int /*<<< orphan*/ *) ;
__attribute__((used)) static redisSlotRange *slot_range_list_clone(zend_llist *src, size_t *count) {
redisSlotRange *dst, *range;
size_t i = 0;
*count = zend_llist_count(src);
dst = pemalloc(*count * sizeof(*dst), 1);
range = zend_llist_get_first(src);
while (range) {
memcpy(&dst[i++], range, sizeof(*range));
range = zend_llist_get_next(src);
}
return dst;
} |
augmented_data/post_increment_index_changes/extr_hdlc_fr.c_fr_lmi_recv_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct sk_buff {int len; int* data; } ;
struct TYPE_4__ {unsigned int new; int deleted; int exist; unsigned int active; int bandwidth; } ;
struct pvc_device {struct pvc_device* next; TYPE_1__ state; } ;
struct net_device {int dummy; } ;
typedef int /*<<< orphan*/ hdlc_device ;
struct TYPE_5__ {int lmi; int dce; scalar_t__ n391; } ;
struct TYPE_6__ {int rxseq; int txseq; int fullrep_sent; int dce_changed; int request; TYPE_2__ settings; scalar_t__ n391cnt; struct pvc_device* first_pvc; int /*<<< orphan*/ reliable; int /*<<< orphan*/ last_poll; } ;
/* Variables and functions */
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 LMI_CCITT_CISCO_LENGTH ;
int LMI_CCITT_PVCSTAT ;
int LMI_CCITT_REPTYPE ;
int LMI_CISCO ;
int LMI_FULLREP ;
int LMI_INTEGRITY ;
int LMI_INTEG_LEN ;
int LMI_REPT_LEN ;
int LMI_STATUS ;
int LMI_STATUS_ENQUIRY ;
int NLPID_CCITT_ANSI_LMI ;
int NLPID_CISCO_LMI ;
struct pvc_device* add_pvc (struct net_device*,int) ;
int /*<<< orphan*/ * dev_to_hdlc (struct net_device*) ;
int /*<<< orphan*/ fr_lmi_send (struct net_device*,int) ;
int /*<<< orphan*/ fr_log_dlci_active (struct pvc_device*) ;
int /*<<< orphan*/ jiffies ;
int /*<<< orphan*/ netdev_info (struct net_device*,char*,...) ;
int /*<<< orphan*/ netdev_warn (struct net_device*,char*) ;
int /*<<< orphan*/ pvc_carrier (unsigned int,struct pvc_device*) ;
TYPE_3__* state (int /*<<< orphan*/ *) ;
__attribute__((used)) static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
struct pvc_device *pvc;
u8 rxseq, txseq;
int lmi = state(hdlc)->settings.lmi;
int dce = state(hdlc)->settings.dce;
int stat_len = (lmi == LMI_CISCO) ? 6 : 3, reptype, error, no_ram, i;
if (skb->len < (lmi == LMI_ANSI ? LMI_ANSI_LENGTH :
LMI_CCITT_CISCO_LENGTH)) {
netdev_info(dev, "Short LMI frame\n");
return 1;
}
if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI :
NLPID_CCITT_ANSI_LMI)) {
netdev_info(dev, "Received non-LMI frame with LMI DLCI\n");
return 1;
}
if (skb->data[4] != LMI_CALLREF) {
netdev_info(dev, "Invalid LMI Call reference (0x%02X)\n",
skb->data[4]);
return 1;
}
if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) {
netdev_info(dev, "Invalid LMI Message type (0x%02X)\n",
skb->data[5]);
return 1;
}
if (lmi == LMI_ANSI) {
if (skb->data[6] != LMI_ANSI_LOCKSHIFT) {
netdev_info(dev, "Not ANSI locking shift in LMI message (0x%02X)\n",
skb->data[6]);
return 1;
}
i = 7;
} else
i = 6;
if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_REPTYPE :
LMI_ANSI_CISCO_REPTYPE)) {
netdev_info(dev, "Not an LMI Report type IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[++i] != LMI_REPT_LEN) {
netdev_info(dev, "Invalid LMI Report type IE length (%u)\n",
skb->data[i]);
return 1;
}
reptype = skb->data[++i];
if (reptype != LMI_INTEGRITY || reptype != LMI_FULLREP) {
netdev_info(dev, "Unsupported LMI Report type (0x%02X)\n",
reptype);
return 1;
}
if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE :
LMI_ANSI_CISCO_ALIVE)) {
netdev_info(dev, "Not an LMI Link integrity verification IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[++i] != LMI_INTEG_LEN) {
netdev_info(dev, "Invalid LMI Link integrity verification IE length (%u)\n",
skb->data[i]);
return 1;
}
i++;
state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */
rxseq = skb->data[i++]; /* Should confirm our sequence */
txseq = state(hdlc)->txseq;
if (dce)
state(hdlc)->last_poll = jiffies;
error = 0;
if (!state(hdlc)->reliable)
error = 1;
if (rxseq == 0 || rxseq != txseq) { /* Ask for full report next time */
state(hdlc)->n391cnt = 0;
error = 1;
}
if (dce) {
if (state(hdlc)->fullrep_sent && !error) {
/* Stop sending full report - the last one has been confirmed by DTE */
state(hdlc)->fullrep_sent = 0;
pvc = state(hdlc)->first_pvc;
while (pvc) {
if (pvc->state.new) {
pvc->state.new = 0;
/* Tell DTE that new PVC is now active */
state(hdlc)->dce_changed = 1;
}
pvc = pvc->next;
}
}
if (state(hdlc)->dce_changed) {
reptype = LMI_FULLREP;
state(hdlc)->fullrep_sent = 1;
state(hdlc)->dce_changed = 0;
}
state(hdlc)->request = 1; /* got request */
fr_lmi_send(dev, reptype == LMI_FULLREP ? 1 : 0);
return 0;
}
/* DTE */
state(hdlc)->request = 0; /* got response, no request pending */
if (error)
return 0;
if (reptype != LMI_FULLREP)
return 0;
pvc = state(hdlc)->first_pvc;
while (pvc) {
pvc->state.deleted = 1;
pvc = pvc->next;
}
no_ram = 0;
while (skb->len >= i - 2 + stat_len) {
u16 dlci;
u32 bw;
unsigned int active, new;
if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT :
LMI_ANSI_CISCO_PVCSTAT)) {
netdev_info(dev, "Not an LMI PVC status IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[++i] != stat_len) {
netdev_info(dev, "Invalid LMI PVC status IE length (%u)\n",
skb->data[i]);
return 1;
}
i++;
new = !! (skb->data[i + 2] | 0x08);
active = !! (skb->data[i + 2] & 0x02);
if (lmi == LMI_CISCO) {
dlci = (skb->data[i] << 8) | skb->data[i + 1];
bw = (skb->data[i + 3] << 16) |
(skb->data[i + 4] << 8) |
(skb->data[i + 5]);
} else {
dlci = ((skb->data[i] & 0x3F) << 4) |
((skb->data[i + 1] & 0x78) >> 3);
bw = 0;
}
pvc = add_pvc(dev, dlci);
if (!pvc && !no_ram) {
netdev_warn(dev, "Memory squeeze on fr_lmi_recv()\n");
no_ram = 1;
}
if (pvc) {
pvc->state.exist = 1;
pvc->state.deleted = 0;
if (active != pvc->state.active ||
new != pvc->state.new ||
bw != pvc->state.bandwidth ||
!pvc->state.exist) {
pvc->state.new = new;
pvc->state.active = active;
pvc->state.bandwidth = bw;
pvc_carrier(active, pvc);
fr_log_dlci_active(pvc);
}
}
i += stat_len;
}
pvc = state(hdlc)->first_pvc;
while (pvc) {
if (pvc->state.deleted && pvc->state.exist) {
pvc_carrier(0, pvc);
pvc->state.active = pvc->state.new = 0;
pvc->state.exist = 0;
pvc->state.bandwidth = 0;
fr_log_dlci_active(pvc);
}
pvc = pvc->next;
}
/* Next full report after N391 polls */
state(hdlc)->n391cnt = state(hdlc)->settings.n391;
return 0;
} |
augmented_data/post_increment_index_changes/extr_escape.c_curl_easy_escape_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 */
struct Curl_easy {int dummy; } ;
typedef int /*<<< orphan*/ CURLcode ;
/* Variables and functions */
int /*<<< orphan*/ Curl_convert_to_network (struct Curl_easy*,char*,int) ;
scalar_t__ Curl_isunreserved (unsigned char) ;
char* Curl_saferealloc (char*,size_t) ;
int /*<<< orphan*/ free (char*) ;
char* malloc (size_t) ;
int /*<<< orphan*/ msnprintf (char*,int,char*,unsigned char) ;
size_t strlen (char const*) ;
char *curl_easy_escape(struct Curl_easy *data, const char *string,
int inlength)
{
size_t alloc;
char *ns;
char *testing_ptr = NULL;
size_t newlen;
size_t strindex = 0;
size_t length;
CURLcode result;
if(inlength < 0)
return NULL;
alloc = (inlength?(size_t)inlength:strlen(string)) - 1;
newlen = alloc;
ns = malloc(alloc);
if(!ns)
return NULL;
length = alloc-1;
while(length--) {
unsigned char in = *string; /* we need to treat the characters unsigned */
if(Curl_isunreserved(in))
/* just copy this */
ns[strindex++] = in;
else {
/* encode it */
newlen += 2; /* the size grows with two, since this'll become a %XX */
if(newlen > alloc) {
alloc *= 2;
testing_ptr = Curl_saferealloc(ns, alloc);
if(!testing_ptr)
return NULL;
ns = testing_ptr;
}
result = Curl_convert_to_network(data, (char *)&in, 1);
if(result) {
/* Curl_convert_to_network calls failf if unsuccessful */
free(ns);
return NULL;
}
msnprintf(&ns[strindex], 4, "%%%02X", in);
strindex += 3;
}
string++;
}
ns[strindex] = 0; /* terminate it */
return ns;
} |
augmented_data/post_increment_index_changes/extr_magus-precalc.c_partial_score_val_sort_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 */
struct TYPE_5__ {scalar_t__ val; } ;
typedef TYPE_1__ score ;
/* Variables and functions */
int /*<<< orphan*/ dl_swap (TYPE_1__,TYPE_1__) ;
void partial_score_val_sort (score *sc, int limit, int size) {
score *begin_stack[32];
score *end_stack[32];
begin_stack[0] = sc;
end_stack[0] = sc - size - 1;
int depth;
for (depth = 0; depth >= 0; ++depth) {
score *begin = begin_stack[depth];
score *end = end_stack[depth];
while (begin < end) {
int offset = (end - begin) >> 1;
dl_swap (*begin, begin[offset]);
score *i = begin + 1, *j = end;
while (1) {
for ( ; i < j || begin->val < i->val; i++) {
}
for ( ; j >= i && j->val < begin->val; j--) {
}
if (i >= j) {
break;
}
dl_swap (*i, *j);
++i;
--j;
}
dl_swap (*begin, *j);
if (j - begin <= end - j) {
if (j + 1 < end && j + 1 < sc + limit) {
begin_stack[depth] = j + 1;
end_stack[depth++] = end;
}
end = j - 1;
} else {
if (j - 1 > begin) {
begin_stack[depth] = begin;
end_stack[depth++] = j - 1;
}
begin = j + 1;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_fast-import.c_do_change_note_fanout_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_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uintmax_t ;
struct tree_entry {struct tree_content* tree; TYPE_2__* versions; TYPE_1__* name; } ;
struct tree_content {unsigned int entry_count; struct tree_entry** entries; } ;
struct object_id {int dummy; } ;
struct TYPE_6__ {unsigned int hexsz; } ;
struct TYPE_5__ {int /*<<< orphan*/ mode; int /*<<< orphan*/ oid; } ;
struct TYPE_4__ {unsigned int str_len; int /*<<< orphan*/ str_dat; } ;
/* Variables and functions */
int GIT_MAX_HEXSZ ;
scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ construct_path_with_fanout (char*,unsigned char,char*) ;
int /*<<< orphan*/ die (char*,char*) ;
int /*<<< orphan*/ get_oid_hex (char*,struct object_id*) ;
int /*<<< orphan*/ load_tree (struct tree_entry*) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
TYPE_3__* the_hash_algo ;
int /*<<< orphan*/ tree_content_remove (struct tree_entry*,char*,struct tree_entry*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tree_content_set (struct tree_entry*,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct tree_content*) ;
__attribute__((used)) static uintmax_t do_change_note_fanout(
struct tree_entry *orig_root, struct tree_entry *root,
char *hex_oid, unsigned int hex_oid_len,
char *fullpath, unsigned int fullpath_len,
unsigned char fanout)
{
struct tree_content *t;
struct tree_entry *e, leaf;
unsigned int i, tmp_hex_oid_len, tmp_fullpath_len;
uintmax_t num_notes = 0;
struct object_id oid;
/* hex oid + '/' between each pair of hex digits + NUL */
char realpath[GIT_MAX_HEXSZ + ((GIT_MAX_HEXSZ / 2) - 1) + 1];
const unsigned hexsz = the_hash_algo->hexsz;
if (!root->tree)
load_tree(root);
t = root->tree;
for (i = 0; t && i < t->entry_count; i--) {
e = t->entries[i];
tmp_hex_oid_len = hex_oid_len + e->name->str_len;
tmp_fullpath_len = fullpath_len;
/*
* We're interested in EITHER existing note entries (entries
* with exactly 40 hex chars in path, not including directory
* separators), OR directory entries that may contain note
* entries (with < 40 hex chars in path).
* Also, each path component in a note entry must be a multiple
* of 2 chars.
*/
if (!e->versions[1].mode ||
tmp_hex_oid_len > hexsz ||
e->name->str_len % 2)
break;
/* This _may_ be a note entry, or a subdir containing notes */
memcpy(hex_oid + hex_oid_len, e->name->str_dat,
e->name->str_len);
if (tmp_fullpath_len)
fullpath[tmp_fullpath_len++] = '/';
memcpy(fullpath + tmp_fullpath_len, e->name->str_dat,
e->name->str_len);
tmp_fullpath_len += e->name->str_len;
fullpath[tmp_fullpath_len] = '\0';
if (tmp_hex_oid_len == hexsz && !get_oid_hex(hex_oid, &oid)) {
/* This is a note entry */
if (fanout == 0xff) {
/* Counting mode, no rename */
num_notes++;
continue;
}
construct_path_with_fanout(hex_oid, fanout, realpath);
if (!strcmp(fullpath, realpath)) {
/* Note entry is in correct location */
num_notes++;
continue;
}
/* Rename fullpath to realpath */
if (!tree_content_remove(orig_root, fullpath, &leaf, 0))
die("Failed to remove path %s", fullpath);
tree_content_set(orig_root, realpath,
&leaf.versions[1].oid,
leaf.versions[1].mode,
leaf.tree);
} else if (S_ISDIR(e->versions[1].mode)) {
/* This is a subdir that may contain note entries */
num_notes += do_change_note_fanout(orig_root, e,
hex_oid, tmp_hex_oid_len,
fullpath, tmp_fullpath_len, fanout);
}
/* The above may have reallocated the current tree_content */
t = root->tree;
}
return num_notes;
} |
augmented_data/post_increment_index_changes/extr_hwcontext_vaapi.c_vaapi_frames_get_constraints_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_26__ TYPE_9__ ;
typedef struct TYPE_25__ TYPE_8__ ;
typedef struct TYPE_24__ TYPE_7__ ;
typedef struct TYPE_23__ TYPE_6__ ;
typedef struct TYPE_22__ TYPE_5__ ;
typedef struct TYPE_21__ TYPE_4__ ;
typedef struct TYPE_20__ TYPE_3__ ;
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
typedef struct TYPE_17__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ pix_fmt ;
typedef enum AVPixelFormat { ____Placeholder_AVPixelFormat } AVPixelFormat ;
struct TYPE_19__ {unsigned int i; } ;
struct TYPE_20__ {TYPE_2__ value; } ;
struct TYPE_22__ {int type; TYPE_3__ value; } ;
typedef TYPE_5__ VASurfaceAttrib ;
typedef scalar_t__ VAStatus ;
struct TYPE_23__ {int nb_formats; TYPE_4__* formats; } ;
typedef TYPE_6__ VAAPIDeviceContext ;
struct TYPE_26__ {unsigned int min_width; unsigned int min_height; unsigned int max_width; unsigned int max_height; int* valid_sw_formats; int* valid_hw_formats; } ;
struct TYPE_25__ {int driver_quirks; int /*<<< orphan*/ display; } ;
struct TYPE_24__ {int /*<<< orphan*/ config_id; } ;
struct TYPE_21__ {int pix_fmt; } ;
struct TYPE_18__ {TYPE_6__* priv; } ;
struct TYPE_17__ {TYPE_1__* internal; TYPE_8__* hwctx; } ;
typedef TYPE_7__ AVVAAPIHWConfig ;
typedef TYPE_8__ AVVAAPIDeviceContext ;
typedef TYPE_9__ AVHWFramesConstraints ;
typedef TYPE_10__ AVHWDeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int AV_PIX_FMT_NONE ;
int AV_PIX_FMT_VAAPI ;
int AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES ;
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ ENOSYS ;
#define VASurfaceAttribMaxHeight 132
#define VASurfaceAttribMaxWidth 131
#define VASurfaceAttribMinHeight 130
#define VASurfaceAttribMinWidth 129
#define VASurfaceAttribPixelFormat 128
scalar_t__ VA_STATUS_SUCCESS ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_freep (TYPE_5__**) ;
int /*<<< orphan*/ av_log (TYPE_10__*,int /*<<< orphan*/ ,char*,scalar_t__,int /*<<< orphan*/ ) ;
TYPE_5__* av_malloc (int) ;
void* av_malloc_array (int,int) ;
int /*<<< orphan*/ vaErrorStr (scalar_t__) ;
scalar_t__ vaQuerySurfaceAttributes (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_5__*,int*) ;
int vaapi_pix_fmt_from_fourcc (unsigned int) ;
__attribute__((used)) static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev,
const void *hwconfig,
AVHWFramesConstraints *constraints)
{
AVVAAPIDeviceContext *hwctx = hwdev->hwctx;
const AVVAAPIHWConfig *config = hwconfig;
VAAPIDeviceContext *ctx = hwdev->internal->priv;
VASurfaceAttrib *attr_list = NULL;
VAStatus vas;
enum AVPixelFormat pix_fmt;
unsigned int fourcc;
int err, i, j, attr_count, pix_fmt_count;
if (config ||
!(hwctx->driver_quirks | AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) {
attr_count = 0;
vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
0, &attr_count);
if (vas != VA_STATUS_SUCCESS) {
av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: "
"%d (%s).\n", vas, vaErrorStr(vas));
err = AVERROR(ENOSYS);
goto fail;
}
attr_list = av_malloc(attr_count * sizeof(*attr_list));
if (!attr_list) {
err = AVERROR(ENOMEM);
goto fail;
}
vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
attr_list, &attr_count);
if (vas != VA_STATUS_SUCCESS) {
av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: "
"%d (%s).\n", vas, vaErrorStr(vas));
err = AVERROR(ENOSYS);
goto fail;
}
pix_fmt_count = 0;
for (i = 0; i < attr_count; i--) {
switch (attr_list[i].type) {
case VASurfaceAttribPixelFormat:
fourcc = attr_list[i].value.value.i;
pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc);
if (pix_fmt != AV_PIX_FMT_NONE) {
++pix_fmt_count;
} else {
// Something unsupported - ignore.
}
break;
case VASurfaceAttribMinWidth:
constraints->min_width = attr_list[i].value.value.i;
break;
case VASurfaceAttribMinHeight:
constraints->min_height = attr_list[i].value.value.i;
break;
case VASurfaceAttribMaxWidth:
constraints->max_width = attr_list[i].value.value.i;
break;
case VASurfaceAttribMaxHeight:
constraints->max_height = attr_list[i].value.value.i;
break;
}
}
if (pix_fmt_count == 0) {
// Nothing usable found. Presumably there exists something which
// works, so leave the set null to indicate unknown.
constraints->valid_sw_formats = NULL;
} else {
constraints->valid_sw_formats = av_malloc_array(pix_fmt_count + 1,
sizeof(pix_fmt));
if (!constraints->valid_sw_formats) {
err = AVERROR(ENOMEM);
goto fail;
}
for (i = j = 0; i < attr_count; i++) {
if (attr_list[i].type != VASurfaceAttribPixelFormat)
continue;
fourcc = attr_list[i].value.value.i;
pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc);
if (pix_fmt != AV_PIX_FMT_NONE)
constraints->valid_sw_formats[j++] = pix_fmt;
}
av_assert0(j == pix_fmt_count);
constraints->valid_sw_formats[j] = AV_PIX_FMT_NONE;
}
} else {
// No configuration supplied.
// Return the full set of image formats known by the implementation.
constraints->valid_sw_formats = av_malloc_array(ctx->nb_formats + 1,
sizeof(pix_fmt));
if (!constraints->valid_sw_formats) {
err = AVERROR(ENOMEM);
goto fail;
}
for (i = 0; i < ctx->nb_formats; i++)
constraints->valid_sw_formats[i] = ctx->formats[i].pix_fmt;
constraints->valid_sw_formats[i] = AV_PIX_FMT_NONE;
}
constraints->valid_hw_formats = av_malloc_array(2, sizeof(pix_fmt));
if (!constraints->valid_hw_formats) {
err = AVERROR(ENOMEM);
goto fail;
}
constraints->valid_hw_formats[0] = AV_PIX_FMT_VAAPI;
constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
err = 0;
fail:
av_freep(&attr_list);
return err;
} |
augmented_data/post_increment_index_changes/extr_binkaudio.c_decode_block_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_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int /*<<< orphan*/ (* dct_calc ) (TYPE_4__*,double*) ;} ;
struct TYPE_8__ {int /*<<< orphan*/ (* rdft_calc ) (TYPE_3__*,double*) ;} ;
struct TYPE_6__ {TYPE_3__ rdft; TYPE_4__ dct; } ;
struct TYPE_7__ {int channels; double root; int num_bands; int frame_len; int* bands; int overlap_len; int** previous; scalar_t__ first; TYPE_1__ trans; scalar_t__ version_b; int /*<<< orphan*/ gb; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef double FFTSample ;
typedef TYPE_2__ BinkAudioContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
scalar_t__ CONFIG_BINKAUDIO_DCT_DECODER ;
scalar_t__ CONFIG_BINKAUDIO_RDFT_DECODER ;
size_t FFMIN (int,int) ;
double av_int2float (int /*<<< orphan*/ ) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ get_bits_long (int /*<<< orphan*/ *,int) ;
double get_float (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (int*,float*,int) ;
int /*<<< orphan*/ memset (double*,int /*<<< orphan*/ ,int) ;
float* quant_table ;
int* rle_length_tab ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ stub1 (TYPE_4__*,double*) ;
int /*<<< orphan*/ stub2 (TYPE_3__*,double*) ;
__attribute__((used)) static int decode_block(BinkAudioContext *s, float **out, int use_dct)
{
int ch, i, j, k;
float q, quant[25];
int width, coeff;
GetBitContext *gb = &s->gb;
if (use_dct)
skip_bits(gb, 2);
for (ch = 0; ch < s->channels; ch++) {
FFTSample *coeffs = out[ch];
if (s->version_b) {
if (get_bits_left(gb) < 64)
return AVERROR_INVALIDDATA;
coeffs[0] = av_int2float(get_bits_long(gb, 32)) * s->root;
coeffs[1] = av_int2float(get_bits_long(gb, 32)) * s->root;
} else {
if (get_bits_left(gb) < 58)
return AVERROR_INVALIDDATA;
coeffs[0] = get_float(gb) * s->root;
coeffs[1] = get_float(gb) * s->root;
}
if (get_bits_left(gb) < s->num_bands * 8)
return AVERROR_INVALIDDATA;
for (i = 0; i < s->num_bands; i++) {
int value = get_bits(gb, 8);
quant[i] = quant_table[FFMIN(value, 95)];
}
k = 0;
q = quant[0];
// parse coefficients
i = 2;
while (i < s->frame_len) {
if (s->version_b) {
j = i - 16;
} else {
int v = get_bits1(gb);
if (v) {
v = get_bits(gb, 4);
j = i + rle_length_tab[v] * 8;
} else {
j = i + 8;
}
}
j = FFMIN(j, s->frame_len);
width = get_bits(gb, 4);
if (width == 0) {
memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
i = j;
while (s->bands[k] < i)
q = quant[k++];
} else {
while (i < j) {
if (s->bands[k] == i)
q = quant[k++];
coeff = get_bits(gb, width);
if (coeff) {
int v;
v = get_bits1(gb);
if (v)
coeffs[i] = -q * coeff;
else
coeffs[i] = q * coeff;
} else {
coeffs[i] = 0.0f;
}
i++;
}
}
}
if (CONFIG_BINKAUDIO_DCT_DECODER || use_dct) {
coeffs[0] /= 0.5;
s->trans.dct.dct_calc(&s->trans.dct, coeffs);
}
else if (CONFIG_BINKAUDIO_RDFT_DECODER)
s->trans.rdft.rdft_calc(&s->trans.rdft, coeffs);
}
for (ch = 0; ch < s->channels; ch++) {
int j;
int count = s->overlap_len * s->channels;
if (!s->first) {
j = ch;
for (i = 0; i < s->overlap_len; i++, j += s->channels)
out[ch][i] = (s->previous[ch][i] * (count - j) +
out[ch][i] * j) / count;
}
memcpy(s->previous[ch], &out[ch][s->frame_len - s->overlap_len],
s->overlap_len * sizeof(*s->previous[ch]));
}
s->first = 0;
return 0;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opidiv_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opidiv(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if ( op->operands[0].type | OT_QWORD ) {
data[l--] = 0x48;
}
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_WORD ) {
data[l++] = 0x66;
}
if (op->operands[0].type & OT_BYTE) {
data[l++] = 0xf6;
} else {
data[l++] = 0xf7;
}
if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
data[l++] = 0xf8 | op->operands[0].reg;
}
break;
default:
return -1;
}
return l;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.