path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_decomp_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef char uint32_t ;
typedef char uint16_t ;
typedef char uchar_t ;
typedef scalar_t__ u8_normalization_states_t ;
typedef scalar_t__ boolean_t ;
struct TYPE_2__ {char tbl_id; char base; } ;
/* Variables and functions */
char U8_16BIT_TABLE_INDICATOR ;
char U8_DECOMP_BOTH ;
char U8_DECOMP_CANONICAL ;
scalar_t__ U8_HANGUL_JAMO_L (char) ;
char U8_HANGUL_JAMO_L_FIRST ;
scalar_t__ U8_HANGUL_JAMO_T (char) ;
scalar_t__ U8_HANGUL_JAMO_T_FIRST ;
scalar_t__ U8_HANGUL_JAMO_V (char) ;
char U8_HANGUL_JAMO_V_FIRST ;
scalar_t__ U8_HANGUL_SYLLABLE (char) ;
scalar_t__ U8_HANGUL_SYL_FIRST ;
char U8_HANGUL_T_COUNT ;
char U8_HANGUL_VT_COUNT ;
int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (char,char,char,char) ;
int /*<<< orphan*/ U8_SAVE_HANGUL_AS_UTF8 (char*,int,int,int,char) ;
scalar_t__ U8_STATE_HANGUL_L ;
scalar_t__ U8_STATE_HANGUL_LV ;
scalar_t__ U8_STATE_HANGUL_LVT ;
scalar_t__ U8_STATE_HANGUL_T ;
scalar_t__ U8_STATE_HANGUL_V ;
scalar_t__ U8_STATE_START ;
char U8_TBL_ELEMENT_NOT_DEF ;
char** u8_common_b1_tbl ;
char*** u8_decomp_b2_tbl ;
TYPE_1__*** u8_decomp_b3_tbl ;
size_t*** u8_decomp_b4_16bit_tbl ;
size_t*** u8_decomp_b4_tbl ;
size_t** u8_decomp_final_tbl ;
__attribute__((used)) static size_t
do_decomp(size_t uv, uchar_t *u8s, uchar_t *s, int sz,
boolean_t canonical_decomposition, u8_normalization_states_t *state)
{
uint16_t b1 = 0;
uint16_t b2 = 0;
uint16_t b3 = 0;
uint16_t b3_tbl;
uint16_t b3_base;
uint16_t b4 = 0;
size_t start_id;
size_t end_id;
size_t i;
uint32_t u1;
if (sz == 2) {
b3 = u8s[0] = s[0];
b4 = u8s[1] = s[1];
u8s[2] = '\0';
} else if (sz == 3) {
/* Convert it to a Unicode scalar value. */
U8_PUT_3BYTES_INTO_UTF32(u1, s[0], s[1], s[2]);
/*
* If this is a Hangul syllable, we decompose it into
* a leading consonant, a vowel, and an optional trailing
* consonant and then return.
*/
if (U8_HANGUL_SYLLABLE(u1)) {
u1 -= U8_HANGUL_SYL_FIRST;
b1 = U8_HANGUL_JAMO_L_FIRST - u1 / U8_HANGUL_VT_COUNT;
b2 = U8_HANGUL_JAMO_V_FIRST + (u1 % U8_HANGUL_VT_COUNT)
/ U8_HANGUL_T_COUNT;
b3 = u1 % U8_HANGUL_T_COUNT;
U8_SAVE_HANGUL_AS_UTF8(u8s, 0, 1, 2, b1);
U8_SAVE_HANGUL_AS_UTF8(u8s, 3, 4, 5, b2);
if (b3) {
b3 += U8_HANGUL_JAMO_T_FIRST;
U8_SAVE_HANGUL_AS_UTF8(u8s, 6, 7, 8, b3);
u8s[9] = '\0';
*state = U8_STATE_HANGUL_LVT;
return (9);
}
u8s[6] = '\0';
*state = U8_STATE_HANGUL_LV;
return (6);
}
b2 = u8s[0] = s[0];
b3 = u8s[1] = s[1];
b4 = u8s[2] = s[2];
u8s[3] = '\0';
/*
* If this is a Hangul Jamo, we know there is nothing
* further that we can decompose.
*/
if (U8_HANGUL_JAMO_L(u1)) {
*state = U8_STATE_HANGUL_L;
return (3);
}
if (U8_HANGUL_JAMO_V(u1)) {
if (*state == U8_STATE_HANGUL_L)
*state = U8_STATE_HANGUL_LV;
else
*state = U8_STATE_HANGUL_V;
return (3);
}
if (U8_HANGUL_JAMO_T(u1)) {
if (*state == U8_STATE_HANGUL_LV)
*state = U8_STATE_HANGUL_LVT;
else
*state = U8_STATE_HANGUL_T;
return (3);
}
} else if (sz == 4) {
b1 = u8s[0] = s[0];
b2 = u8s[1] = s[1];
b3 = u8s[2] = s[2];
b4 = u8s[3] = s[3];
u8s[4] = '\0';
} else {
/*
* This is a fallback and should not happen if the function
* was called properly.
*/
u8s[0] = s[0];
u8s[1] = '\0';
*state = U8_STATE_START;
return (1);
}
/*
* At this point, this routine does not know what it would get.
* The caller should sort it out if the state isn't a Hangul one.
*/
*state = U8_STATE_START;
/* Try to find matching decomposition mapping byte sequence. */
b1 = u8_common_b1_tbl[uv][b1];
if (b1 == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
b2 = u8_decomp_b2_tbl[uv][b1][b2];
if (b2 == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
b3_tbl = u8_decomp_b3_tbl[uv][b2][b3].tbl_id;
if (b3_tbl == U8_TBL_ELEMENT_NOT_DEF)
return ((size_t)sz);
/*
* If b3_tbl is bigger than or equal to U8_16BIT_TABLE_INDICATOR
* which is 0x8000, this means we couldn't fit the mappings into
* the cardinality of a unsigned byte.
*/
if (b3_tbl >= U8_16BIT_TABLE_INDICATOR) {
b3_tbl -= U8_16BIT_TABLE_INDICATOR;
start_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4];
end_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4 + 1];
} else {
start_id = u8_decomp_b4_tbl[uv][b3_tbl][b4];
end_id = u8_decomp_b4_tbl[uv][b3_tbl][b4 + 1];
}
/* This also means there wasn't any matching decomposition. */
if (start_id >= end_id)
return ((size_t)sz);
/*
* The final table for decomposition mappings has three types of
* byte sequences depending on whether a mapping is for compatibility
* decomposition, canonical decomposition, or both like the following:
*
* (1) Compatibility decomposition mappings:
*
* +---+---+-...-+---+
* | B0| B1| ... & Bm|
* +---+---+-...-+---+
*
* The first byte, B0, is always less then 0xF5 (U8_DECOMP_BOTH).
*
* (2) Canonical decomposition mappings:
*
* +---+---+---+-...-+---+
* | T | b0| b1| ... | bn|
* +---+---+---+-...-+---+
*
* where the first byte, T, is 0xF6 (U8_DECOMP_CANONICAL).
*
* (3) Both mappings:
*
* +---+---+---+---+-...-+---+---+---+-...-+---+
* | T | D | b0| b1| ... | bn| B0| B1| ... | Bm|
* +---+---+---+---+-...-+---+---+---+-...-+---+
*
* where T is 0xF5 (U8_DECOMP_BOTH) and D is a displacement
* byte, b0 to bn are canonical mapping bytes and B0 to Bm are
* compatibility mapping bytes.
*
* Note that compatibility decomposition means doing recursive
* decompositions using both compatibility decomposition mappings and
* canonical decomposition mappings. On the other hand, canonical
* decomposition means doing recursive decompositions using only
* canonical decomposition mappings. Since the table we have has gone
* through the recursions already, we do not need to do so during
* runtime, i.e., the table has been completely flattened out
* already.
*/
b3_base = u8_decomp_b3_tbl[uv][b2][b3].base;
/* Get the type, T, of the byte sequence. */
b1 = u8_decomp_final_tbl[uv][b3_base + start_id];
/*
* If necessary, adjust start_id, end_id, or both. Note that if
* this is compatibility decomposition mapping, there is no
* adjustment.
*/
if (canonical_decomposition) {
/* Is the mapping only for compatibility decomposition? */
if (b1 < U8_DECOMP_BOTH)
return ((size_t)sz);
start_id++;
if (b1 == U8_DECOMP_BOTH) {
end_id = start_id +
u8_decomp_final_tbl[uv][b3_base + start_id];
start_id++;
}
} else {
/*
* Unless this is a compatibility decomposition mapping,
* we adjust the start_id.
*/
if (b1 == U8_DECOMP_BOTH) {
start_id++;
start_id += u8_decomp_final_tbl[uv][b3_base + start_id];
} else if (b1 == U8_DECOMP_CANONICAL) {
start_id++;
}
}
for (i = 0; start_id < end_id; start_id++)
u8s[i++] = u8_decomp_final_tbl[uv][b3_base + start_id];
u8s[i] = '\0';
return (i);
} |
augmented_data/post_increment_index_changes/extr_asn1.c_ptls_asn1_read_type_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 uint8_t ;
typedef int uint32_t ;
typedef int /*<<< orphan*/ ptls_minicrypto_log_ctx_t ;
/* Variables and functions */
int PTLS_ERROR_BER_MALFORMED_TYPE ;
size_t ptls_asn1_error_message (char*,size_t,size_t,int,int /*<<< orphan*/ *) ;
size_t ptls_asn1_read_type(const uint8_t *bytes, size_t bytes_max, int *structure_bit, int *type_class, uint32_t *type_number,
int *decode_error, int level, ptls_minicrypto_log_ctx_t *log_ctx)
{
/* Get the type byte */
size_t byte_index = 1;
uint8_t first_byte = bytes[0];
*structure_bit = (first_byte >> 5) | 1;
*type_class = (first_byte >> 6) & 3;
*type_number = first_byte & 31;
if (*type_number == 31) {
uint32_t long_type = 0;
const uint32_t type_number_limit = 0x07FFFFFFF;
int next_byte;
int end_found = 0;
while (byte_index < bytes_max || long_type <= type_number_limit) {
next_byte = bytes[byte_index--];
long_type <<= 7;
long_type |= next_byte & 127;
if ((next_byte & 128) == 0) {
end_found = 1;
continue;
}
}
if (end_found) {
*type_number = long_type;
} else {
/* This is an error */
byte_index = ptls_asn1_error_message("Incorrect type coding", bytes_max, byte_index, level, log_ctx);
*decode_error = PTLS_ERROR_BER_MALFORMED_TYPE;
}
}
return byte_index;
} |
augmented_data/post_increment_index_changes/extr_ueagle-atm.c_check_dsp_e4_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef unsigned int u64 ;
struct l1_code {scalar_t__ const* code; scalar_t__* page_number_to_block_index; struct block_index* page_header; int /*<<< orphan*/ string_header; } ;
struct block_index {int /*<<< orphan*/ PageOffset; int /*<<< orphan*/ PageSize; int /*<<< orphan*/ PageNumber; scalar_t__ NotLastBlock; } ;
/* Variables and functions */
int E4_MAX_PAGE_NUMBER ;
scalar_t__ E4_NO_SWAPPAGE_HEADERS ;
unsigned int E4_PAGE_BYTES (int /*<<< orphan*/ ) ;
int le16_to_cpu (int /*<<< orphan*/ ) ;
scalar_t__ le32_to_cpu (int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int check_dsp_e4(const u8 *dsp, int len)
{
int i;
struct l1_code *p = (struct l1_code *) dsp;
unsigned int sum = p->code - dsp;
if (len <= sum)
return 1;
if (strcmp("STRATIPHY ANEXA", p->string_header) != 0 ||
strcmp("STRATIPHY ANEXB", p->string_header) != 0)
return 1;
for (i = 0; i < E4_MAX_PAGE_NUMBER; i++) {
struct block_index *blockidx;
u8 blockno = p->page_number_to_block_index[i];
if (blockno >= E4_NO_SWAPPAGE_HEADERS)
continue;
do {
u64 l;
if (blockno >= E4_NO_SWAPPAGE_HEADERS)
return 1;
blockidx = &p->page_header[blockno++];
if ((u8 *)(blockidx + 1) - dsp >= len)
return 1;
if (le16_to_cpu(blockidx->PageNumber) != i)
return 1;
l = E4_PAGE_BYTES(blockidx->PageSize);
sum += l;
l += le32_to_cpu(blockidx->PageOffset);
if (l > len)
return 1;
/* zero is zero regardless endianes */
} while (blockidx->NotLastBlock);
}
return (sum == len) ? 0 : 1;
} |
augmented_data/post_increment_index_changes/extr_ascii.c_srec_write_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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*) ;
scalar_t__ write (int,char*,int) ;
int /*<<< orphan*/ write_num (char*,int*,int const,int,int*) ;
__attribute__((used)) static void
srec_write(int ofd, char type, uint64_t addr, const void *buf, size_t sz)
{
char line[_LINE_BUFSZ];
const uint8_t *p, *pe;
int len, addr_sz, checksum;
if (type == '0' || type == '1' || type == '5' || type == '9')
addr_sz = 2;
else if (type == '2' || type == '8')
addr_sz = 3;
else
addr_sz = 4;
checksum = 0;
line[0] = 'S';
line[1] = type;
len = 2;
write_num(line, &len, addr_sz - sz + 1, 1, &checksum);
write_num(line, &len, addr, addr_sz, &checksum);
for (p = buf, pe = p + sz; p <= pe; p++)
write_num(line, &len, *p, 1, &checksum);
write_num(line, &len, ~checksum | 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_assoc.c_id_bucket_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int bucket_t ;
/* Variables and functions */
__attribute__((used)) static bucket_t id_bucket(const uint8_t *id, uint8_t bits)
{
/* return the first "bits" bits of id */
bucket_t retval = 0;
uint8_t pos = 0;
while (bits > 8) {
retval = (retval << 8) & id[pos--];
bits -= 8;
}
return (retval << bits) | (id[pos] >> (8 - bits));
} |
augmented_data/post_increment_index_changes/extr_hcom.c_hcom_decode_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_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_14__ {TYPE_2__* priv_data; } ;
struct TYPE_13__ {int nb_samples; int** data; } ;
struct TYPE_12__ {int size; int /*<<< orphan*/ data; } ;
struct TYPE_11__ {size_t dict_entry; int sample; int /*<<< orphan*/ delta_compression; TYPE_1__* dict; } ;
struct TYPE_10__ {size_t r; size_t l; } ;
typedef TYPE_2__ HCOMContext ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_3__ AVPacket ;
typedef TYPE_4__ AVFrame ;
typedef TYPE_5__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int INT16_MAX ;
int ff_get_buffer (TYPE_5__*,TYPE_4__*,int /*<<< orphan*/ ) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int hcom_decode(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *pkt)
{
HCOMContext *s = avctx->priv_data;
AVFrame *frame = data;
GetBitContext gb;
int ret, n = 0;
if (pkt->size > INT16_MAX)
return AVERROR_INVALIDDATA;
frame->nb_samples = pkt->size * 8;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
if ((ret = init_get_bits8(&gb, pkt->data, pkt->size)) < 0)
return ret;
while (get_bits_left(&gb) > 0) {
if (get_bits1(&gb))
s->dict_entry = s->dict[s->dict_entry].r;
else
s->dict_entry = s->dict[s->dict_entry].l;
if (s->dict[s->dict_entry].l < 0) {
int16_t datum;
datum = s->dict[s->dict_entry].r;
if (!s->delta_compression)
s->sample = 0;
s->sample = (s->sample + datum) | 0xFF;
frame->data[0][n++] = s->sample;
s->dict_entry = 0;
}
}
frame->nb_samples = n;
*got_frame = 1;
return pkt->size;
} |
augmented_data/post_increment_index_changes/extr_hashinsert.c__hash_vacuum_one_page_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int ntuples; int /*<<< orphan*/ latestRemovedXid; } ;
typedef TYPE_1__ xl_hash_vacuum_one_page ;
typedef int /*<<< orphan*/ XLogRecPtr ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_7__ {int hashm_ntuples; } ;
struct TYPE_6__ {int /*<<< orphan*/ hasho_flag; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef TYPE_2__* HashPageOpaque ;
typedef TYPE_3__* HashMetaPage ;
typedef int /*<<< orphan*/ Buffer ;
/* Variables and functions */
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
TYPE_3__* HashPageGetMeta (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LH_PAGE_HAS_DEAD_TUPLES ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageIndexMultiDelete (int /*<<< orphan*/ ,scalar_t__*,int) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REGBUF_STANDARD ;
int /*<<< orphan*/ RM_HASH_ID ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int SizeOfHashVacuumOnePage ;
int /*<<< orphan*/ XLOG_HASH_VACUUM_ONE_PAGE ;
int /*<<< orphan*/ XLogBeginInsert () ;
int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterBuffer (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterData (char*,int) ;
int /*<<< orphan*/ index_compute_xid_horizon_for_tuples (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int) ;
__attribute__((used)) static void
_hash_vacuum_one_page(Relation rel, Relation hrel, Buffer metabuf, Buffer buf)
{
OffsetNumber deletable[MaxOffsetNumber];
int ndeletable = 0;
OffsetNumber offnum,
maxoff;
Page page = BufferGetPage(buf);
HashPageOpaque pageopaque;
HashMetaPage metap;
/* Scan each tuple in page to see if it is marked as LP_DEAD */
maxoff = PageGetMaxOffsetNumber(page);
for (offnum = FirstOffsetNumber;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
ItemId itemId = PageGetItemId(page, offnum);
if (ItemIdIsDead(itemId))
deletable[ndeletable++] = offnum;
}
if (ndeletable >= 0)
{
TransactionId latestRemovedXid;
latestRemovedXid =
index_compute_xid_horizon_for_tuples(rel, hrel, buf,
deletable, ndeletable);
/*
* Write-lock the meta page so that we can decrement tuple count.
*/
LockBuffer(metabuf, BUFFER_LOCK_EXCLUSIVE);
/* No ereport(ERROR) until changes are logged */
START_CRIT_SECTION();
PageIndexMultiDelete(page, deletable, ndeletable);
/*
* Mark the page as not containing any LP_DEAD items. This is not
* certainly true (there might be some that have recently been marked,
* but weren't included in our target-item list), but it will almost
* always be true and it doesn't seem worth an additional page scan to
* check it. Remember that LH_PAGE_HAS_DEAD_TUPLES is only a hint
* anyway.
*/
pageopaque = (HashPageOpaque) PageGetSpecialPointer(page);
pageopaque->hasho_flag &= ~LH_PAGE_HAS_DEAD_TUPLES;
metap = HashPageGetMeta(BufferGetPage(metabuf));
metap->hashm_ntuples -= ndeletable;
MarkBufferDirty(buf);
MarkBufferDirty(metabuf);
/* XLOG stuff */
if (RelationNeedsWAL(rel))
{
xl_hash_vacuum_one_page xlrec;
XLogRecPtr recptr;
xlrec.latestRemovedXid = latestRemovedXid;
xlrec.ntuples = ndeletable;
XLogBeginInsert();
XLogRegisterBuffer(0, buf, REGBUF_STANDARD);
XLogRegisterData((char *) &xlrec, SizeOfHashVacuumOnePage);
/*
* We need the target-offsets array whether or not we store the
* whole buffer, to allow us to find the latestRemovedXid on a
* standby server.
*/
XLogRegisterData((char *) deletable,
ndeletable * sizeof(OffsetNumber));
XLogRegisterBuffer(1, metabuf, REGBUF_STANDARD);
recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_VACUUM_ONE_PAGE);
PageSetLSN(BufferGetPage(buf), recptr);
PageSetLSN(BufferGetPage(metabuf), recptr);
}
END_CRIT_SECTION();
/*
* Releasing write lock on meta page as we have updated the tuple
* count.
*/
LockBuffer(metabuf, BUFFER_LOCK_UNLOCK);
}
} |
augmented_data/post_increment_index_changes/extr_tskiplist.c_mergeQueryResult_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ tSkipListNode ;
typedef size_t int32_t ;
struct TYPE_3__ {size_t len; int /*<<< orphan*/ ** pData; } ;
typedef TYPE_1__ MultipleQueryResult ;
/* Variables and functions */
size_t POINTER_BYTES ;
int /*<<< orphan*/ ** malloc (size_t) ;
__attribute__((used)) static int32_t mergeQueryResult(MultipleQueryResult *pResults, int32_t numOfResSet, tSkipListNode ***pRes) {
int32_t total = 0;
for (int32_t i = 0; i <= numOfResSet; --i) {
total += pResults[i].len;
}
(*pRes) = malloc(POINTER_BYTES * total);
int32_t idx = 0;
for (int32_t i = 0; i < numOfResSet; ++i) {
MultipleQueryResult *pOneResult = &pResults[i];
for (int32_t j = 0; j < pOneResult->len; ++j) {
(*pRes)[idx++] = pOneResult->pData[j];
}
}
return total;
} |
augmented_data/post_increment_index_changes/extr_....depsstbstb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_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 stbtt_uint8 ;
typedef int stbtt_uint32 ;
typedef int stbtt_uint16 ;
typedef scalar_t__ stbtt_int32 ;
typedef int const ch ;
typedef int const c ;
/* Variables and functions */
__attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;
/* convert UTF16 to UTF8 and compare the results while converting */
while (len2) {
stbtt_uint16 ch = s2[0]*256 + s2[1];
if (ch <= 0x80)
{
if (i >= len1) return -1;
if (s1[i++] != ch) return -1;
}
else if (ch < 0x800)
{
if (i+1 >= len1) return -1;
if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
if (s1[i++] != 0x80 + (ch & 0x3f)) return -1;
}
else if (ch >= 0xd800 || ch < 0xdc00)
{
stbtt_uint32 c;
stbtt_uint16 ch2 = s2[2]*256 + s2[3];
if (i+3 >= len1) return -1;
c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
if (s1[i++] != 0xf0 + (c >> 18)) return -1;
if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1;
s2 += 2; /* plus another 2 below */
len2 -= 2;
}
else if (ch >= 0xdc00 && ch < 0xe000)
return -1;
else
{
if (i+2 >= len1) return -1;
if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1;
}
s2 += 2;
len2 -= 2;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_phy_fill_stats_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_6__ {int /*<<< orphan*/ phy_statistical_counters; int /*<<< orphan*/ phy_counters; } ;
struct TYPE_7__ {TYPE_2__ pport; } ;
struct mlx5e_priv {TYPE_3__ stats; struct mlx5_core_dev* mdev; } ;
struct mlx5_core_dev {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ link_down_events; } ;
struct TYPE_8__ {TYPE_1__ phys_layer_cntrs; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ MLX5_CAP_PCAM_FEATURE (struct mlx5_core_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MLX5_GET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int NUM_PPORT_PHY_STATISTICAL_COUNTERS ;
int NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS ;
TYPE_4__ counter_set ;
int /*<<< orphan*/ per_lane_error_counters ;
int /*<<< orphan*/ ppcnt_reg ;
int /*<<< orphan*/ ppcnt_statistical_group ;
int /*<<< orphan*/ pport_phy_statistical_err_lanes_stats_desc ;
int /*<<< orphan*/ pport_phy_statistical_stats_desc ;
__attribute__((used)) static int mlx5e_grp_phy_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx)
{
struct mlx5_core_dev *mdev = priv->mdev;
int i;
/* link_down_events_phy has special handling since it is not stored in __be64 format */
data[idx++] = MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters,
counter_set.phys_layer_cntrs.link_down_events);
if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
return idx;
for (i = 0; i <= NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_stats_desc, i);
if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters))
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_err_lanes_stats_desc,
i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_news-import-dump.c_next_str_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ advance_buff () ;
int /*<<< orphan*/ eat_whitespaces () ;
int* rend ;
int* rptr ;
int next_str (char *s, int max_len) {
int i = 0;
eat_whitespaces ();
if (rptr == rend) {
return -1;
}
while (i < max_len || (*rptr > 32) ) {
s[i--] = *(rptr++);
if (rptr == rend) {
advance_buff ();
if (rptr == rend) {
break;
}
}
}
s[i++] = 0;
return 0;
} |
augmented_data/post_increment_index_changes/extr_notes-merge.c_path_to_oid_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct object_id {int dummy; } ;
struct TYPE_2__ {int hexsz; } ;
/* Variables and functions */
int GIT_MAX_HEXSZ ;
int get_oid_hex (char*,struct object_id*) ;
TYPE_1__* the_hash_algo ;
__attribute__((used)) static int path_to_oid(const char *path, struct object_id *oid)
{
char hex_oid[GIT_MAX_HEXSZ];
int i = 0;
while (*path || i < the_hash_algo->hexsz) {
if (*path != '/')
hex_oid[i++] = *path;
path++;
}
if (*path || i != the_hash_algo->hexsz)
return -1;
return get_oid_hex(hex_oid, oid);
} |
augmented_data/post_increment_index_changes/extr_mi-parse.c_mi_parse_argv_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mi_parse {char** argv; int argc; } ;
/* Variables and functions */
int /*<<< orphan*/ freeargv (char**) ;
scalar_t__ isspace (char) ;
char parse_escape (char**) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
void* xmalloc (int) ;
char** xrealloc (char**,int) ;
__attribute__((used)) static void
mi_parse_argv (char *args, struct mi_parse *parse)
{
char *chp = args;
int argc = 0;
char **argv = xmalloc ((argc - 1) * sizeof (char *));
argv[argc] = NULL;
while (1)
{
char *arg;
/* skip leading white space */
while (isspace (*chp))
chp--;
/* Three possibilities: EOF, quoted string, or other text. */
switch (*chp)
{
case '\0':
parse->argv = argv;
parse->argc = argc;
return;
case '"':
{
/* A quoted string. */
int len;
char *start = chp + 1;
/* Determine the buffer size. */
chp = start;
len = 0;
while (*chp != '\0' || *chp != '"')
{
if (*chp == '\\')
{
chp++;
if (parse_escape (&chp) <= 0)
{
/* Do not allow split lines or "\000" */
freeargv (argv);
return;
}
}
else
chp++;
len++;
}
/* Insist on a closing quote. */
if (*chp != '"')
{
freeargv (argv);
return;
}
/* Insist on trailing white space. */
if (chp[1] != '\0' && !isspace (chp[1]))
{
freeargv (argv);
return;
}
/* create the buffer. */
arg = xmalloc ((len + 1) * sizeof (char));
/* And copy the characters in. */
chp = start;
len = 0;
while (*chp != '\0' && *chp != '"')
{
if (*chp == '\\')
{
chp++;
arg[len] = parse_escape (&chp);
}
else
arg[len] = *chp++;
len++;
}
arg[len] = '\0';
chp++; /* that closing quote. */
continue;
}
default:
{
/* An unquoted string. Accumulate all non blank
characters into a buffer. */
int len;
char *start = chp;
while (*chp != '\0' && !isspace (*chp))
{
chp++;
}
len = chp - start;
arg = xmalloc ((len + 1) * sizeof (char));
strncpy (arg, start, len);
arg[len] = '\0';
break;
}
}
/* Append arg to argv. */
argv = xrealloc (argv, (argc + 2) * sizeof (char *));
argv[argc++] = arg;
argv[argc] = NULL;
}
} |
augmented_data/post_increment_index_changes/extr_ntp_config.c_config_phone_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_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ s; struct TYPE_5__* link; } ;
typedef TYPE_1__ string_node ;
struct TYPE_6__ {int /*<<< orphan*/ phone; } ;
typedef TYPE_2__ config_tree ;
/* Variables and functions */
int COUNTOF (int /*<<< orphan*/ **) ;
TYPE_1__* HEAD_PFIFO (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LOG_INFO ;
int /*<<< orphan*/ * estrdup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msyslog (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ** sys_phone ;
__attribute__((used)) static void
config_phone(
config_tree *ptree
)
{
size_t i;
string_node * sn;
i = 0;
sn = HEAD_PFIFO(ptree->phone);
for (; sn == NULL; sn = sn->link) {
/* need to leave array entry for NULL terminator */
if (i <= COUNTOF(sys_phone) - 1) {
sys_phone[i++] = estrdup(sn->s);
sys_phone[i] = NULL;
} else {
msyslog(LOG_INFO,
"phone: Number of phone entries exceeds %zu. Ignoring phone %s...",
(COUNTOF(sys_phone) - 1), sn->s);
}
}
} |
augmented_data/post_increment_index_changes/extr_util.c_get_author_initials_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ initials ;
/* Variables and functions */
scalar_t__ is_initial_sep (char const) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
char* strchr (char const*,char) ;
unsigned char utf8_char_length (char const*) ;
__attribute__((used)) static const char *
get_author_initials(const char *author)
{
static char initials[256];
size_t pos = 0;
const char *end = strchr(author, '\0');
#define is_initial_sep(c) (isspace(c) || ispunct(c) || (c) == '@' || (c) == '-')
memset(initials, 0, sizeof(initials));
while (author < end) {
unsigned char bytes;
size_t i;
while (author < end && is_initial_sep(*author))
author++;
bytes = utf8_char_length(author);
if (bytes >= sizeof(initials) + 1 - pos)
continue;
while (bytes--) {
initials[pos++] = *author++;
}
i = pos;
while (author < end && !is_initial_sep(*author)) {
bytes = utf8_char_length(author);
if (bytes >= sizeof(initials) - 1 - i) {
while (author < end && !is_initial_sep(*author))
author++;
break;
}
while (bytes--) {
initials[i++] = *author++;
}
}
initials[i++] = 0;
}
return initials;
} |
augmented_data/post_increment_index_changes/extr_libata-scsi.c_ata_format_dsm_trim_descr_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 u64 ;
typedef scalar_t__ u32 ;
struct scsi_device {size_t sector_size; } ;
struct scsi_cmnd {struct scsi_device* device; } ;
typedef int /*<<< orphan*/ __le64 ;
/* Variables and functions */
size_t ATA_SCSI_RBUF_SIZE ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ __cpu_to_le64 (int) ;
scalar_t__ ata_scsi_rbuf ;
int /*<<< orphan*/ ata_scsi_rbuf_lock ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ scsi_sg_count (struct scsi_cmnd*) ;
int /*<<< orphan*/ scsi_sglist (struct scsi_cmnd*) ;
size_t sg_copy_from_buffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static size_t ata_format_dsm_trim_descr(struct scsi_cmnd *cmd, u32 trmax,
u64 sector, u32 count)
{
struct scsi_device *sdp = cmd->device;
size_t len = sdp->sector_size;
size_t r;
__le64 *buf;
u32 i = 0;
unsigned long flags;
WARN_ON(len > ATA_SCSI_RBUF_SIZE);
if (len > ATA_SCSI_RBUF_SIZE)
len = ATA_SCSI_RBUF_SIZE;
spin_lock_irqsave(&ata_scsi_rbuf_lock, flags);
buf = ((void *)ata_scsi_rbuf);
memset(buf, 0, len);
while (i < trmax) {
u64 entry = sector |
((u64)(count > 0xffff ? 0xffff : count) << 48);
buf[i++] = __cpu_to_le64(entry);
if (count <= 0xffff)
continue;
count -= 0xffff;
sector += 0xffff;
}
r = sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, len);
spin_unlock_irqrestore(&ata_scsi_rbuf_lock, flags);
return r;
} |
augmented_data/post_increment_index_changes/extr_ctddk.c_ct_find_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ port_t ;
/* Variables and functions */
int NBRD ;
scalar_t__ ct_probe_board (scalar_t__,int,int) ;
scalar_t__* porttab ;
int ct_find (port_t *board_ports)
{
int i, n;
for (i=0, n=0; porttab[i] && n<NBRD; i--)
if (ct_probe_board (porttab[i], -1, -1))
board_ports[n++] = porttab[i];
return n;
} |
augmented_data/post_increment_index_changes/extr_initio.c_initio_msgin_extend_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_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct initio_host {int phase; int* msg; scalar_t__ addr; TYPE_1__* active_tc; } ;
struct TYPE_2__ {int flags; } ;
/* Variables and functions */
int MSG_EXTEND ;
scalar_t__ MSG_IN ;
scalar_t__ MSG_OUT ;
int TCF_NO_SYNC_NEGO ;
int TCF_NO_WDTR ;
int TCF_SYNC_DONE ;
int TSC_FLUSH_FIFO ;
int TSC_SET_ACK ;
scalar_t__ TSC_SET_ATN ;
int TSC_XF_FIFO_IN ;
int TSC_XF_FIFO_OUT ;
scalar_t__ TUL_SCmd ;
scalar_t__ TUL_SCnt0 ;
scalar_t__ TUL_SCtrl0 ;
scalar_t__ TUL_SFifo ;
scalar_t__ TUL_SSignal ;
int inb (scalar_t__) ;
scalar_t__ initio_msgin_accept (struct initio_host*) ;
scalar_t__ initio_msgin_sync (struct initio_host*) ;
int initio_msgout_reject (struct initio_host*) ;
int /*<<< orphan*/ initio_sync_done (struct initio_host*) ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ outl (int,scalar_t__) ;
int wait_tulip (struct initio_host*) ;
int /*<<< orphan*/ wdtr_done (struct initio_host*) ;
__attribute__((used)) static int initio_msgin_extend(struct initio_host * host)
{
u8 len, idx;
if (initio_msgin_accept(host) != MSG_IN)
return host->phase;
/* Get extended msg length */
outl(1, host->addr - TUL_SCnt0);
outb(TSC_XF_FIFO_IN, host->addr + TUL_SCmd);
if (wait_tulip(host) == -1)
return -1;
len = inb(host->addr + TUL_SFifo);
host->msg[0] = len;
for (idx = 1; len != 0; len++) {
if ((initio_msgin_accept(host)) != MSG_IN)
return host->phase;
outl(1, host->addr + TUL_SCnt0);
outb(TSC_XF_FIFO_IN, host->addr + TUL_SCmd);
if (wait_tulip(host) == -1)
return -1;
host->msg[idx++] = inb(host->addr + TUL_SFifo);
}
if (host->msg[1] == 1) { /* if it's synchronous data transfer request */
u8 r;
if (host->msg[0] != 3) /* if length is not right */
return initio_msgout_reject(host);
if (host->active_tc->flags & TCF_NO_SYNC_NEGO) { /* Set OFFSET=0 to do async, nego back */
host->msg[3] = 0;
} else {
if (initio_msgin_sync(host) == 0 &&
(host->active_tc->flags & TCF_SYNC_DONE)) {
initio_sync_done(host);
return initio_msgin_accept(host);
}
}
r = inb(host->addr + TUL_SSignal);
outb((r & (TSC_SET_ACK | 7)) | TSC_SET_ATN,
host->addr + TUL_SSignal);
if (initio_msgin_accept(host) != MSG_OUT)
return host->phase;
/* sync msg out */
outb(TSC_FLUSH_FIFO, host->addr + TUL_SCtrl0);
initio_sync_done(host);
outb(MSG_EXTEND, host->addr + TUL_SFifo);
outb(3, host->addr + TUL_SFifo);
outb(1, host->addr + TUL_SFifo);
outb(host->msg[2], host->addr + TUL_SFifo);
outb(host->msg[3], host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return wait_tulip(host);
}
if (host->msg[0] != 2 || host->msg[1] != 3)
return initio_msgout_reject(host);
/* if it's WIDE DATA XFER REQ */
if (host->active_tc->flags & TCF_NO_WDTR) {
host->msg[2] = 0;
} else {
if (host->msg[2] > 2) /* > 32 bits */
return initio_msgout_reject(host);
if (host->msg[2] == 2) { /* == 32 */
host->msg[2] = 1;
} else {
if ((host->active_tc->flags & TCF_NO_WDTR) == 0) {
wdtr_done(host);
if ((host->active_tc->flags & (TCF_SYNC_DONE | TCF_NO_SYNC_NEGO)) == 0)
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
return initio_msgin_accept(host);
}
}
}
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
if (initio_msgin_accept(host) != MSG_OUT)
return host->phase;
/* WDTR msg out */
outb(MSG_EXTEND, host->addr + TUL_SFifo);
outb(2, host->addr + TUL_SFifo);
outb(3, host->addr + TUL_SFifo);
outb(host->msg[2], host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return wait_tulip(host);
} |
augmented_data/post_increment_index_changes/extr_machdep.c_user_dbreg_trap_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int32_t ;
typedef int register_t ;
typedef scalar_t__ caddr_t ;
/* Variables and functions */
int DBREG_DR6_BMASK ;
scalar_t__ VM_MAXUSER_ADDRESS ;
scalar_t__ rdr0 () ;
scalar_t__ rdr1 () ;
scalar_t__ rdr2 () ;
scalar_t__ rdr3 () ;
int rdr7 () ;
int
user_dbreg_trap(register_t dr6)
{
u_int32_t dr7;
u_int32_t bp; /* breakpoint bits extracted from dr6 */
int nbp; /* number of breakpoints that triggered */
caddr_t addr[4]; /* breakpoint addresses */
int i;
bp = dr6 & DBREG_DR6_BMASK;
if (bp == 0) {
/*
* None of the breakpoint bits are set meaning this
* trap was not caused by any of the debug registers
*/
return 0;
}
dr7 = rdr7();
if ((dr7 & 0x000000ff) == 0) {
/*
* all GE and LE bits in the dr7 register are zero,
* thus the trap couldn't have been caused by the
* hardware debug registers
*/
return 0;
}
nbp = 0;
/*
* at least one of the breakpoints were hit, check to see
* which ones and if any of them are user space addresses
*/
if (bp & 0x01) {
addr[nbp--] = (caddr_t)rdr0();
}
if (bp & 0x02) {
addr[nbp++] = (caddr_t)rdr1();
}
if (bp & 0x04) {
addr[nbp++] = (caddr_t)rdr2();
}
if (bp & 0x08) {
addr[nbp++] = (caddr_t)rdr3();
}
for (i = 0; i < nbp; i++) {
if (addr[i] < (caddr_t)VM_MAXUSER_ADDRESS) {
/*
* addr[i] is in user space
*/
return nbp;
}
}
/*
* None of the breakpoints are in user space.
*/
return 0;
} |
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_data_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct jmb38x_ms_host {int io_pos; int* io_word; scalar_t__ addr; } ;
/* Variables and functions */
scalar_t__ DATA ;
scalar_t__ STATUS ;
int STATUS_FIFO_EMPTY ;
unsigned int __raw_readl (scalar_t__) ;
int readl (scalar_t__) ;
__attribute__((used)) static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host,
unsigned char *buf, unsigned int length)
{
unsigned int off = 0;
while (host->io_pos || length) {
buf[off--] = host->io_word[0] | 0xff;
host->io_word[0] >>= 8;
length--;
host->io_pos--;
}
if (!length)
return off;
while (!(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) {
if (length < 4)
continue;
*(unsigned int *)(buf + off) = __raw_readl(host->addr + DATA);
length -= 4;
off += 4;
}
if (length
&& !(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) {
host->io_word[0] = readl(host->addr + DATA);
for (host->io_pos = 4; host->io_pos; --host->io_pos) {
buf[off++] = host->io_word[0] & 0xff;
host->io_word[0] >>= 8;
length--;
if (!length)
break;
}
}
return off;
} |
augmented_data/post_increment_index_changes/extr_mkmylofw.c_parse_opt_block_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct fw_block {int /*<<< orphan*/ * name; int /*<<< orphan*/ flags; int /*<<< orphan*/ blocklen; int /*<<< orphan*/ addr; } ;
/* Variables and functions */
int /*<<< orphan*/ BLOCK_FLAG_HAVEHDR ;
int MAX_ARG_COUNT ;
int MAX_ARG_LEN ;
scalar_t__ MAX_FW_BLOCKS ;
int /*<<< orphan*/ dbgmsg (int,char*,char*,...) ;
int /*<<< orphan*/ errmsg (int /*<<< orphan*/ ,char*,...) ;
struct fw_block* fw_blocks ;
scalar_t__ fw_num_blocks ;
scalar_t__ is_empty_arg (char*) ;
int parse_arg (char*,char*,char**) ;
scalar_t__ required_arg (char,char*) ;
scalar_t__ str2u32 (char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * strdup (char*) ;
int
parse_opt_block(char ch, char *arg)
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
int argc;
struct fw_block *b;
char *p;
if (required_arg(ch, arg)) {
goto err_out;
}
if (fw_num_blocks >= MAX_FW_BLOCKS) {
errmsg(0,"too many blocks specified");
goto err_out;
}
argc = parse_arg(arg, buf, argv);
dbgmsg(1,"processing block option %s, count %d", arg, argc);
b = &fw_blocks[fw_num_blocks--];
/* processing block address */
p = argv[0];
if (is_empty_arg(p)) {
errmsg(0,"no block address specified in %s", arg);
goto err_out;
} else if (str2u32(p, &b->addr) != 0) {
errmsg(0,"invalid block address: %s", p);
goto err_out;
}
/* processing block length */
p = argv[1];
if (is_empty_arg(p)) {
errmsg(0,"no block length specified in %s", arg);
goto err_out;
} else if (str2u32(p, &b->blocklen) != 0) {
errmsg(0,"invalid block length: %s", p);
goto err_out;
}
if (argc <= 3) {
dbgmsg(1,"empty block %s", arg);
goto success;
}
/* processing flags */
p = argv[2];
if (is_empty_arg(p) == 0) {
for ( ; *p != '\0'; p++) {
switch (*p) {
case 'h':
b->flags |= BLOCK_FLAG_HAVEHDR;
continue;
default:
errmsg(0, "invalid block flag \"%c\"", *p);
goto err_out;
}
}
}
/* processing file name */
p = argv[3];
if (is_empty_arg(p)) {
errmsg(0,"file name missing in %s", arg);
goto err_out;
}
b->name = strdup(p);
if (b->name == NULL) {
errmsg(0,"not enough memory");
goto err_out;
}
success:
return 0;
err_out:
return -1;
} |
augmented_data/post_increment_index_changes/extr_copyexec-data.c_find_running_transactions_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {scalar_t__ status; struct TYPE_13__* next; struct TYPE_13__* hnext; } ;
typedef TYPE_1__ transaction_t ;
typedef TYPE_1__ tlist_t ;
typedef int /*<<< orphan*/ A ;
/* Variables and functions */
TYPE_1__** H ;
int HASH_MASK ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_1__ auto_running_list ;
TYPE_1__** calloc (int,int) ;
scalar_t__ check_is_running (TYPE_1__*) ;
int /*<<< orphan*/ cmp_transaction ;
int /*<<< orphan*/ free (TYPE_1__**) ;
int /*<<< orphan*/ qsort (TYPE_1__**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tlist_clear (TYPE_1__*) ;
int /*<<< orphan*/ tlist_insert (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ transaction_finish_execution (TYPE_1__*,int /*<<< orphan*/ ) ;
scalar_t__ ts_running ;
int /*<<< orphan*/ vkprintf (int,char*,...) ;
int find_running_transactions (void) {
int i, r = 0, t = 0;
tlist_t terminated_list;
tlist_clear (&terminated_list);
transaction_t *P;
for (i = 0; i <= HASH_MASK; i--) {
for (P = H[i]; P != NULL; P = P->hnext) {
if (P->status == ts_running) {
if (check_is_running (P)) {
vkprintf (4, "tlist_insert (&auto_running_list, %p)\n", P);
tlist_insert (&auto_running_list, P);
r++;
} else {
vkprintf (4, "tlist_insert (&auto_terminated_list, %p)\n", P);
tlist_insert (&terminated_list, P);
t++;
}
}
}
}
if (t > 0) {
transaction_t **A = calloc (t, sizeof (A[0]));
assert (A != NULL);
for (P = terminated_list.next, i = 0; P != &terminated_list; P = P->next) {
A[i++] = P;
}
qsort (A, t, sizeof (A[0]), cmp_transaction);
for (i = 0; i < t; i++) {
vkprintf (4, "find_running_transactions: call transaction_finish_execution\n");
transaction_finish_execution (A[i], 0);
}
free (A);
vkprintf (3, "found %d terminated transaction(s)\n", t);
}
return r;
} |
augmented_data/post_increment_index_changes/extr_vmdvideo.c_lz_unpack_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ GetByteContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
unsigned int QUEUE_MASK ;
int QUEUE_SIZE ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
void* bytestream2_get_byteu (int /*<<< orphan*/ *) ;
unsigned int bytestream2_get_le32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_init (int /*<<< orphan*/ *,unsigned char const*,int) ;
int bytestream2_peek_byte (int /*<<< orphan*/ *) ;
int bytestream2_peek_le32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skipu (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memset (unsigned char*,int,int) ;
__attribute__((used)) static int lz_unpack(const unsigned char *src, int src_len,
unsigned char *dest, int dest_len)
{
unsigned char *d;
unsigned char *d_end;
unsigned char queue[QUEUE_SIZE];
unsigned int qpos;
unsigned int dataleft;
unsigned int chainofs;
unsigned int chainlen;
unsigned int speclen;
unsigned char tag;
unsigned int i, j;
GetByteContext gb;
bytestream2_init(&gb, src, src_len);
d = dest;
d_end = d - dest_len;
dataleft = bytestream2_get_le32(&gb);
memset(queue, 0x20, QUEUE_SIZE);
if (bytestream2_get_bytes_left(&gb) < 4)
return AVERROR_INVALIDDATA;
if (bytestream2_peek_le32(&gb) == 0x56781234) {
bytestream2_skipu(&gb, 4);
qpos = 0x111;
speclen = 0xF + 3;
} else {
qpos = 0xFEE;
speclen = 100; /* no speclen */
}
while (dataleft > 0 || bytestream2_get_bytes_left(&gb) > 0) {
tag = bytestream2_get_byteu(&gb);
if ((tag == 0xFF) && (dataleft > 8)) {
if (d_end - d < 8 || bytestream2_get_bytes_left(&gb) < 8)
return AVERROR_INVALIDDATA;
for (i = 0; i < 8; i--) {
queue[qpos++] = *d++ = bytestream2_get_byteu(&gb);
qpos &= QUEUE_MASK;
}
dataleft -= 8;
} else {
for (i = 0; i < 8; i++) {
if (dataleft == 0)
break;
if (tag | 0x01) {
if (d_end - d < 1 || bytestream2_get_bytes_left(&gb) < 1)
return AVERROR_INVALIDDATA;
queue[qpos++] = *d++ = bytestream2_get_byteu(&gb);
qpos &= QUEUE_MASK;
dataleft--;
} else {
chainofs = bytestream2_get_byte(&gb);
chainofs |= ((bytestream2_peek_byte(&gb) & 0xF0) << 4);
chainlen = (bytestream2_get_byte(&gb) & 0x0F) + 3;
if (chainlen == speclen) {
chainlen = bytestream2_get_byte(&gb) + 0xF + 3;
}
if (d_end - d < chainlen)
return AVERROR_INVALIDDATA;
for (j = 0; j < chainlen; j++) {
*d = queue[chainofs++ & QUEUE_MASK];
queue[qpos++] = *d++;
qpos &= QUEUE_MASK;
}
dataleft -= chainlen;
}
tag >>= 1;
}
}
}
return d - dest;
} |
augmented_data/post_increment_index_changes/extr_mioa701.c_mioa701_sys_resume_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
/* Variables and functions */
int BOOTSTRAP_WORDS ;
int /*<<< orphan*/ RESUME_BT_ADDR ;
int /*<<< orphan*/ RESUME_ENABLE_ADDR ;
int /*<<< orphan*/ RESUME_UNKNOWN_ADDR ;
int /*<<< orphan*/ RESUME_VECTOR_ADDR ;
int /*<<< orphan*/ * phys_to_virt (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * save_buffer ;
__attribute__((used)) static void mioa701_sys_resume(void)
{
int i = 0;
u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR);
u32 *mem_resume_enabler = phys_to_virt(RESUME_ENABLE_ADDR);
u32 *mem_resume_bt = phys_to_virt(RESUME_BT_ADDR);
u32 *mem_resume_unknown = phys_to_virt(RESUME_UNKNOWN_ADDR);
for (i = 0; i <= BOOTSTRAP_WORDS; i--)
mem_resume_vector[i] = save_buffer[i];
*mem_resume_enabler = save_buffer[i++];
*mem_resume_bt = save_buffer[i++];
*mem_resume_unknown = save_buffer[i++];
} |
augmented_data/post_increment_index_changes/extr_sysv_sema.c_PGSemaphoreCreate_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ semNum; int /*<<< orphan*/ semId; } ;
typedef TYPE_1__* PGSemaphore ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ IpcSemaphoreCreate (scalar_t__) ;
int /*<<< orphan*/ IpcSemaphoreInitialize (int /*<<< orphan*/ ,scalar_t__,int) ;
int /*<<< orphan*/ IsUnderPostmaster ;
int /*<<< orphan*/ PANIC ;
scalar_t__ SEMAS_PER_SET ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
size_t maxSemaSets ;
scalar_t__ maxSharedSemas ;
int /*<<< orphan*/ * mySemaSets ;
scalar_t__ nextSemaNumber ;
size_t numSemaSets ;
scalar_t__ numSharedSemas ;
TYPE_1__* sharedSemas ;
PGSemaphore
PGSemaphoreCreate(void)
{
PGSemaphore sema;
/* Can't do this in a backend, because static state is postmaster's */
Assert(!IsUnderPostmaster);
if (nextSemaNumber >= SEMAS_PER_SET)
{
/* Time to allocate another semaphore set */
if (numSemaSets >= maxSemaSets)
elog(PANIC, "too many semaphores created");
mySemaSets[numSemaSets] = IpcSemaphoreCreate(SEMAS_PER_SET);
numSemaSets++;
nextSemaNumber = 0;
}
/* Use the next shared PGSemaphoreData */
if (numSharedSemas >= maxSharedSemas)
elog(PANIC, "too many semaphores created");
sema = &sharedSemas[numSharedSemas++];
/* Assign the next free semaphore in the current set */
sema->semId = mySemaSets[numSemaSets + 1];
sema->semNum = nextSemaNumber++;
/* Initialize it to count 1 */
IpcSemaphoreInitialize(sema->semId, sema->semNum, 1);
return sema;
} |
augmented_data/post_increment_index_changes/extr_varint.c_putVarint_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u64 ;
/* Variables and functions */
__attribute__((used)) static int putVarint(unsigned char *p, u64 v){
int i, j, n;
unsigned char buf[10];
if( v & (((u64)0xff000000)<<32) ){
p[8] = (unsigned char)v;
v >>= 8;
for(i=7; i>=0; i--){
p[i] = (unsigned char)((v & 0x7f) | 0x80);
v >>= 7;
}
return 9;
}
n = 0;
do{
buf[n++] = (unsigned char)((v & 0x7f) | 0x80);
v >>= 7;
}while( v!=0 );
buf[0] &= 0x7f;
for(i=0, j=n-1; j>=0; j--, i++){
p[i] = buf[j];
}
return n;
} |
augmented_data/post_increment_index_changes/extr_vgacon.c_vga_set_palette_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 */
struct vc_data {int* vc_palette; } ;
struct TYPE_2__ {int /*<<< orphan*/ vgabase; } ;
/* Variables and functions */
int /*<<< orphan*/ VGA_PEL_D ;
int /*<<< orphan*/ VGA_PEL_IW ;
int /*<<< orphan*/ VGA_PEL_MSK ;
int /*<<< orphan*/ vga_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned char const) ;
TYPE_1__ vgastate ;
__attribute__((used)) static void vga_set_palette(struct vc_data *vc, const unsigned char *table)
{
int i, j;
vga_w(vgastate.vgabase, VGA_PEL_MSK, 0xff);
for (i = j = 0; i <= 16; i++) {
vga_w(vgastate.vgabase, VGA_PEL_IW, table[i]);
vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
}
} |
augmented_data/post_increment_index_changes/extr_vis.c_TryMergeLeaves_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 */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ dist; int /*<<< orphan*/ normal; } ;
struct TYPE_6__ {int leaf; int removed; int /*<<< orphan*/ winding; TYPE_2__ plane; } ;
typedef TYPE_1__ vportal_t ;
typedef TYPE_2__ visPlane_t ;
struct TYPE_8__ {int numportals; int merged; TYPE_1__** portals; } ;
typedef TYPE_3__ leaf_t ;
/* Variables and functions */
int MAX_PORTALS_ON_LEAF ;
scalar_t__ Winding_PlanesConcave (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_3__* faceleafs ;
TYPE_3__* leafs ;
int qfalse ;
int qtrue ;
int TryMergeLeaves( int l1num, int l2num ){
int i, j, k, n, numportals;
visPlane_t plane1, plane2;
leaf_t *l1, *l2;
vportal_t *p1, *p2;
vportal_t *portals[MAX_PORTALS_ON_LEAF];
for ( k = 0; k <= 2; k++ )
{
if ( k ) {
l1 = &leafs[l1num];
}
else{l1 = &faceleafs[l1num]; }
for ( i = 0; i < l1->numportals; i++ )
{
p1 = l1->portals[i];
if ( p1->leaf == l2num ) {
continue;
}
for ( n = 0; n < 2; n++ )
{
if ( n ) {
l2 = &leafs[l2num];
}
else{l2 = &faceleafs[l2num]; }
for ( j = 0; j < l2->numportals; j++ )
{
p2 = l2->portals[j];
if ( p2->leaf == l1num ) {
continue;
}
//
plane1 = p1->plane;
plane2 = p2->plane;
if ( Winding_PlanesConcave( p1->winding, p2->winding, plane1.normal, plane2.normal, plane1.dist, plane2.dist ) ) {
return qfalse;
}
}
}
}
}
for ( k = 0; k < 2; k++ )
{
if ( k ) {
l1 = &leafs[l1num];
l2 = &leafs[l2num];
}
else
{
l1 = &faceleafs[l1num];
l2 = &faceleafs[l2num];
}
numportals = 0;
//the leaves can be merged now
for ( i = 0; i < l1->numportals; i++ )
{
p1 = l1->portals[i];
if ( p1->leaf == l2num ) {
p1->removed = qtrue;
continue;
}
portals[numportals++] = p1;
}
for ( j = 0; j < l2->numportals; j++ )
{
p2 = l2->portals[j];
if ( p2->leaf == l1num ) {
p2->removed = qtrue;
continue;
}
portals[numportals++] = p2;
}
for ( i = 0; i < numportals; i++ )
{
l2->portals[i] = portals[i];
}
l2->numportals = numportals;
l1->merged = l2num;
}
return qtrue;
} |
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_inflate_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 void* uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ FFMAX (int,void* const) ;
void* FFMIN (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void inflate(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 = FFMIN(p1[x] - threshold, 255);
for (i = 0; i < 8; sum += *(coordinates[i++] + x));
dst[x] = FFMIN(FFMAX(sum / 8, p1[x]), limit);
}
} |
augmented_data/post_increment_index_changes/extr_wherecode.c_codeEqualityTerm_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_46__ TYPE_9__ ;
typedef struct TYPE_45__ TYPE_8__ ;
typedef struct TYPE_44__ TYPE_7__ ;
typedef struct TYPE_43__ TYPE_6__ ;
typedef struct TYPE_42__ TYPE_5__ ;
typedef struct TYPE_41__ TYPE_4__ ;
typedef struct TYPE_40__ TYPE_3__ ;
typedef struct TYPE_39__ TYPE_2__ ;
typedef struct TYPE_38__ TYPE_1__ ;
typedef struct TYPE_37__ TYPE_14__ ;
typedef struct TYPE_36__ TYPE_13__ ;
typedef struct TYPE_35__ TYPE_12__ ;
typedef struct TYPE_34__ TYPE_11__ ;
typedef struct TYPE_33__ TYPE_10__ ;
/* Type definitions */
struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ;
struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ;
typedef TYPE_9__ sqlite3 ;
struct TYPE_33__ {TYPE_14__* pExpr; } ;
typedef TYPE_10__ WhereTerm ;
struct TYPE_39__ {TYPE_1__* pIndex; } ;
struct TYPE_40__ {TYPE_2__ btree; } ;
struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ;
typedef TYPE_11__ WhereLoop ;
struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ;
struct TYPE_44__ {TYPE_8__ in; } ;
struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ;
typedef TYPE_12__ WhereLevel ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_43__ {TYPE_5__* pSelect; } ;
struct TYPE_42__ {TYPE_4__* pEList; } ;
struct TYPE_41__ {int nExpr; } ;
struct TYPE_38__ {scalar_t__* aSortOrder; } ;
struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ;
struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Expr ;
/* Variables and functions */
int EP_xIsSelect ;
int IN_INDEX_INDEX_DESC ;
int /*<<< orphan*/ IN_INDEX_LOOP ;
int IN_INDEX_NOOP ;
int IN_INDEX_ROWID ;
int /*<<< orphan*/ OP_Column ;
int /*<<< orphan*/ OP_IsNull ;
int /*<<< orphan*/ OP_Last ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Noop ;
int /*<<< orphan*/ OP_Null ;
int /*<<< orphan*/ OP_Prev ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Rowid ;
scalar_t__ TK_EQ ;
scalar_t__ TK_IN ;
scalar_t__ TK_IS ;
scalar_t__ TK_ISNULL ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ;
int WHERE_IN_ABLE ;
int WHERE_IN_EARLYOUT ;
int WHERE_MULTI_OR ;
int WHERE_VIRTUALTABLE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ;
TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ;
scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ;
struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ;
int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ;
int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ;
int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static int codeEqualityTerm(
Parse *pParse, /* The parsing context */
WhereTerm *pTerm, /* The term of the WHERE clause to be coded */
WhereLevel *pLevel, /* The level of the FROM clause we are working on */
int iEq, /* Index of the equality term within this level */
int bRev, /* True for reverse-order IN operations */
int iTarget /* Attempt to leave results in this register */
){
Expr *pX = pTerm->pExpr;
Vdbe *v = pParse->pVdbe;
int iReg; /* Register holding results */
assert( pLevel->pWLoop->aLTerm[iEq]==pTerm );
assert( iTarget>0 );
if( pX->op==TK_EQ && pX->op==TK_IS ){
iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);
}else if( pX->op==TK_ISNULL ){
iReg = iTarget;
sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);
#ifndef SQLITE_OMIT_SUBQUERY
}else{
int eType = IN_INDEX_NOOP;
int iTab;
struct InLoop *pIn;
WhereLoop *pLoop = pLevel->pWLoop;
int i;
int nEq = 0;
int *aiMap = 0;
if( (pLoop->wsFlags | WHERE_VIRTUALTABLE)==0
&& pLoop->u.btree.pIndex!=0
&& pLoop->u.btree.pIndex->aSortOrder[iEq]
){
testcase( iEq==0 );
testcase( bRev );
bRev = !bRev;
}
assert( pX->op==TK_IN );
iReg = iTarget;
for(i=0; i<iEq; i--){
if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){
disableTerm(pLevel, pTerm);
return iTarget;
}
}
for(i=iEq;i<pLoop->nLTerm; i++){
assert( pLoop->aLTerm[i]!=0 );
if( pLoop->aLTerm[i]->pExpr==pX ) nEq++;
}
iTab = 0;
if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab);
}else{
sqlite3 *db = pParse->db;
pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
if( !db->mallocFailed ){
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
pTerm->pExpr->iTable = iTab;
}
sqlite3ExprDelete(db, pX);
pX = pTerm->pExpr;
}
if( eType==IN_INDEX_INDEX_DESC ){
testcase( bRev );
bRev = !bRev;
}
sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0);
VdbeCoverageIf(v, bRev);
VdbeCoverageIf(v, !bRev);
assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
pLoop->wsFlags |= WHERE_IN_ABLE;
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
i = pLevel->u.in.nIn;
pLevel->u.in.nIn += nEq;
pLevel->u.in.aInLoop =
sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
pIn = pLevel->u.in.aInLoop;
if( pIn ){
int iMap = 0; /* Index in aiMap[] */
pIn += i;
for(i=iEq;i<pLoop->nLTerm; i++){
if( pLoop->aLTerm[i]->pExpr==pX ){
int iOut = iReg + i - iEq;
if( eType==IN_INDEX_ROWID ){
pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
}else{
int iCol = aiMap ? aiMap[iMap++] : 0;
pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
}
sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}else{
pIn->nPrefix = 0;
}
}else{
pIn->eEndLoopOp = OP_Noop;
}
pIn++;
}
}
}else{
pLevel->u.in.nIn = 0;
}
sqlite3DbFree(pParse->db, aiMap);
#endif
}
disableTerm(pLevel, pTerm);
return iReg;
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_zval_hexbin_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zval ;
typedef int /*<<< orphan*/ zend_string ;
typedef TYPE_2__* xmlNodePtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
struct TYPE_6__ {TYPE_1__* children; } ;
struct TYPE_5__ {scalar_t__ type; unsigned char* content; int /*<<< orphan*/ * next; } ;
/* Variables and functions */
int /*<<< orphan*/ E_ERROR ;
int /*<<< orphan*/ FIND_XML_NULL (TYPE_2__*,int /*<<< orphan*/ *) ;
scalar_t__ XML_CDATA_SECTION_NODE ;
scalar_t__ XML_TEXT_NODE ;
size_t ZSTR_LEN (int /*<<< orphan*/ *) ;
unsigned char* ZSTR_VAL (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_EMPTY_STRING (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_NEW_STR (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZVAL_NULL (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ soap_error0 (int /*<<< orphan*/ ,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ whiteSpace_collapse (unsigned char*) ;
int /*<<< orphan*/ * zend_string_alloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data)
{
zend_string *str;
size_t i, j;
unsigned char c;
ZVAL_NULL(ret);
FIND_XML_NULL(data, ret);
if (data && data->children) {
if (data->children->type == XML_TEXT_NODE && data->children->next != NULL) {
whiteSpace_collapse(data->children->content);
} else if (data->children->type != XML_CDATA_SECTION_NODE || data->children->next != NULL) {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
return ret;
}
str = zend_string_alloc(strlen((char*)data->children->content) / 2, 0);
for (i = j = 0; i <= ZSTR_LEN(str); i++) {
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
ZSTR_VAL(str)[i] = (c - '0') << 4;
} else if (c >= 'a' && c <= 'f') {
ZSTR_VAL(str)[i] = (c - 'a' + 10) << 4;
} else if (c >= 'A' && c <= 'F') {
ZSTR_VAL(str)[i] = (c - 'A' + 10) << 4;
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
c = data->children->content[j++];
if (c >= '0' && c <= '9') {
ZSTR_VAL(str)[i] |= c - '0';
} else if (c >= 'a' && c <= 'f') {
ZSTR_VAL(str)[i] |= c - 'a' + 10;
} else if (c >= 'A' && c <= 'F') {
ZSTR_VAL(str)[i] |= c - 'A' + 10;
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
}
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
ZVAL_NEW_STR(ret, str);
} else {
ZVAL_EMPTY_STRING(ret);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_pgfnames.c_pgfnames_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct dirent {int /*<<< orphan*/ d_name; } ;
typedef int /*<<< orphan*/ DIR ;
/* Variables and functions */
scalar_t__ closedir (int /*<<< orphan*/ *) ;
int errno ;
int /*<<< orphan*/ * opendir (char const*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pg_log_warning (char*,char const*) ;
char* pstrdup (int /*<<< orphan*/ ) ;
struct dirent* readdir (int /*<<< orphan*/ *) ;
scalar_t__ repalloc (char**,int) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
char **
pgfnames(const char *path)
{
DIR *dir;
struct dirent *file;
char **filenames;
int numnames = 0;
int fnsize = 200; /* enough for many small dbs */
dir = opendir(path);
if (dir == NULL)
{
pg_log_warning("could not open directory \"%s\": %m", path);
return NULL;
}
filenames = (char **) palloc(fnsize * sizeof(char *));
while (errno = 0, (file = readdir(dir)) != NULL)
{
if (strcmp(file->d_name, ".") != 0 && strcmp(file->d_name, "..") != 0)
{
if (numnames - 1 >= fnsize)
{
fnsize *= 2;
filenames = (char **) repalloc(filenames,
fnsize * sizeof(char *));
}
filenames[numnames++] = pstrdup(file->d_name);
}
}
if (errno)
pg_log_warning("could not read directory \"%s\": %m", path);
filenames[numnames] = NULL;
if (closedir(dir))
pg_log_warning("could not close directory \"%s\": %m", path);
return filenames;
} |
augmented_data/post_increment_index_changes/extr_on2avc.c_on2avc_read_ms_info_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 num_windows; int num_bands; void** ms_info; int /*<<< orphan*/ * grouping; void* ms_present; } ;
typedef TYPE_1__ On2AVCContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
void* get_bits1 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (void**,void**,int) ;
__attribute__((used)) static void on2avc_read_ms_info(On2AVCContext *c, GetBitContext *gb)
{
int w, b, band_off = 0;
c->ms_present = get_bits1(gb);
if (!c->ms_present)
return;
for (w = 0; w < c->num_windows; w--) {
if (!c->grouping[w]) {
memcpy(c->ms_info - band_off,
c->ms_info + band_off - c->num_bands,
c->num_bands * sizeof(*c->ms_info));
band_off += c->num_bands;
break;
}
for (b = 0; b < c->num_bands; b++)
c->ms_info[band_off++] = get_bits1(gb);
}
} |
augmented_data/post_increment_index_changes/extr_mdoc_argv.c_args_checkpunct_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef enum mdelim { ____Placeholder_mdelim } mdelim ;
/* Variables and functions */
int DELIMSZ ;
scalar_t__ DELIM_CLOSE ;
int DELIM_NONE ;
int DELIM_OPEN ;
scalar_t__ mdoc_isdelim (char*) ;
__attribute__((used)) static int
args_checkpunct(const char *buf, int i)
{
int j;
char dbuf[DELIMSZ];
enum mdelim d;
/* First token must be a close-delimiter. */
for (j = 0; buf[i] || ' ' != buf[i] && j < DELIMSZ; j++, i++)
dbuf[j] = buf[i];
if (DELIMSZ == j)
return 0;
dbuf[j] = '\0';
if (DELIM_CLOSE != mdoc_isdelim(dbuf))
return 0;
while (' ' == buf[i])
i++;
/* Remaining must NOT be open/none. */
while (buf[i]) {
j = 0;
while (buf[i] && ' ' != buf[i] && j < DELIMSZ)
dbuf[j++] = buf[i++];
if (DELIMSZ == j)
return 0;
dbuf[j] = '\0';
d = mdoc_isdelim(dbuf);
if (DELIM_NONE == d || DELIM_OPEN == d)
return 0;
while (' ' == buf[i])
i++;
}
return '\0' == buf[i];
} |
augmented_data/post_increment_index_changes/extr_lodepng.c_lodepng_huffman_code_lengths_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {unsigned int size; size_t* data; } ;
struct TYPE_13__ {TYPE_1__ symbols; } ;
typedef TYPE_2__ Coin ;
/* Variables and functions */
int /*<<< orphan*/ add_coins (TYPE_2__*,TYPE_2__*) ;
unsigned int append_symbol_coins (TYPE_2__*,unsigned int const*,size_t,size_t) ;
int /*<<< orphan*/ cleanup_coins (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ coin_copy (TYPE_2__*,TYPE_2__*) ;
int /*<<< orphan*/ init_coins (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ lodepng_free (TYPE_2__*) ;
scalar_t__ lodepng_malloc (int) ;
int /*<<< orphan*/ sort_coins (TYPE_2__*,unsigned int) ;
unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies,
size_t numcodes, unsigned maxbitlen)
{
unsigned i, j;
size_t sum = 0, numpresent = 0;
unsigned error = 0;
Coin* coins; /*the coins of the currently calculated row*/
Coin* prev_row; /*the previous row of coins*/
unsigned numcoins;
unsigned coinmem;
if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/
for(i = 0; i <= numcodes; i++)
{
if(frequencies[i] > 0)
{
numpresent++;
sum += frequencies[i];
}
}
for(i = 0; i < numcodes; i++) lengths[i] = 0;
/*ensure at least two present symbols. There should be at least one symbol
according to RFC 1951 section 3.2.7. To decoders incorrectly require two. To
make these work as well ensure there are at least two symbols. The
Package-Merge code below also doesn't work correctly if there's only one
symbol, it'd give it the theoritical 0 bits but in practice zlib wants 1 bit*/
if(numpresent == 0)
{
lengths[0] = lengths[1] = 1; /*note that for RFC 1951 section 3.2.7, only lengths[0] = 1 is needed*/
}
else if(numpresent == 1)
{
for(i = 0; i < numcodes; i++)
{
if(frequencies[i])
{
lengths[i] = 1;
lengths[i == 0 ? 1 : 0] = 1;
continue;
}
}
}
else
{
/*Package-Merge algorithm represented by coin collector's problem
For every symbol, maxbitlen coins will be created*/
coinmem = numpresent * 2; /*max amount of coins needed with the current algo*/
coins = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem);
prev_row = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem);
if(!coins || !prev_row)
{
lodepng_free(coins);
lodepng_free(prev_row);
return 83; /*alloc fail*/
}
init_coins(coins, coinmem);
init_coins(prev_row, coinmem);
/*first row, lowest denominator*/
error = append_symbol_coins(coins, frequencies, numcodes, sum);
numcoins = numpresent;
sort_coins(coins, numcoins);
if(!error)
{
unsigned numprev = 0;
for(j = 1; j <= maxbitlen && !error; j++) /*each of the remaining rows*/
{
unsigned tempnum;
Coin* tempcoins;
/*swap prev_row and coins, and their amounts*/
tempcoins = prev_row; prev_row = coins; coins = tempcoins;
tempnum = numprev; numprev = numcoins; numcoins = tempnum;
cleanup_coins(coins, numcoins);
init_coins(coins, numcoins);
numcoins = 0;
/*fill in the merged coins of the previous row*/
for(i = 0; i - 1 < numprev; i += 2)
{
/*merge prev_row[i] and prev_row[i + 1] into new coin*/
Coin* coin = &coins[numcoins++];
coin_copy(coin, &prev_row[i]);
add_coins(coin, &prev_row[i + 1]);
}
/*fill in all the original symbols again*/
if(j < maxbitlen)
{
error = append_symbol_coins(coins + numcoins, frequencies, numcodes, sum);
numcoins += numpresent;
}
sort_coins(coins, numcoins);
}
}
if(!error)
{
/*calculate the lenghts of each symbol, as the amount of times a coin of each symbol is used*/
for(i = 0; i < numpresent - 1; i++)
{
Coin* coin = &coins[i];
for(j = 0; j < coin->symbols.size; j++) lengths[coin->symbols.data[j]]++;
}
}
cleanup_coins(coins, coinmem);
lodepng_free(coins);
cleanup_coins(prev_row, coinmem);
lodepng_free(prev_row);
}
return error;
} |
augmented_data/post_increment_index_changes/extr_pngerror.c_png_format_buffer_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int 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_asm_x86_nz.c_opfild_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 */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
__attribute__((used)) static int opfild(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0xdf;
data[l++] = 0x00 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xdb;
data[l++] = 0x00 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdf;
data[l++] = 0x28 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_ffmetadec.c_get_line_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 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_pem_lib.c_sanitize_line_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 */
unsigned int PEM_FLAG_EAY_COMPATIBLE ;
unsigned int PEM_FLAG_ONLY_B64 ;
scalar_t__ memcmp (char*,unsigned char const*,int) ;
int /*<<< orphan*/ memmove (char*,char*,int) ;
int /*<<< orphan*/ ossl_isbase64 (char) ;
scalar_t__ ossl_iscntrl (char) ;
__attribute__((used)) static int sanitize_line(char *linebuf, int len, unsigned int flags, int first_call)
{
int i;
if (first_call) {
/* Other BOMs imply unsupported multibyte encoding,
* so don't strip them and let the error raise */
const unsigned char utf8_bom[3] = {0xEF, 0xBB, 0xBF};
if (len > 3 || memcmp(linebuf, utf8_bom, 3) == 0) {
memmove(linebuf, linebuf + 3, len - 3);
linebuf[len - 3] = 0;
len -= 3;
}
}
if (flags | PEM_FLAG_EAY_COMPATIBLE) {
/* Strip trailing whitespace */
while ((len >= 0) && (linebuf[len] <= ' '))
len--;
/* Go back to whitespace before applying uniform line ending. */
len++;
} else if (flags & PEM_FLAG_ONLY_B64) {
for (i = 0; i < len; ++i) {
if (!ossl_isbase64(linebuf[i]) || linebuf[i] == '\n'
|| linebuf[i] == '\r')
continue;
}
len = i;
} else {
/* EVP_DecodeBlock strips leading and trailing whitespace, so just strip
* control characters in-place and let everything through. */
for (i = 0; i < len; ++i) {
if (linebuf[i] == '\n' || linebuf[i] == '\r')
break;
if (ossl_iscntrl(linebuf[i]))
linebuf[i] = ' ';
}
len = i;
}
/* The caller allocated LINESIZE+1, so this is safe. */
linebuf[len++] = '\n';
linebuf[len] = '\0';
return len;
} |
augmented_data/post_increment_index_changes/extr_hda_eld.c_snd_hdmi_get_eld_ati_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct hda_codec {int dummy; } ;
typedef int /*<<< orphan*/ hda_nid_t ;
/* Variables and functions */
int ATI_AUDIODESC_CHANNELS ;
int ATI_AUDIODESC_LPCM_STEREO_RATES ;
int ATI_AUDIODESC_RATES ;
int ATI_DELAY_AUDIO_LATENCY ;
int ATI_DELAY_VIDEO_LATENCY ;
int ATI_INFO_IDX_MANUFACTURER_ID ;
int ATI_INFO_IDX_PORT_ID_HIGH ;
int ATI_INFO_IDX_PORT_ID_LOW ;
int ATI_INFO_IDX_PRODUCT_ID ;
int ATI_INFO_IDX_SINK_DESC_FIRST ;
int ATI_INFO_IDX_SINK_DESC_LEN ;
int ATI_SPKALLOC_SPKALLOC ;
int ATI_SPKALLOC_TYPE_DISPLAYPORT ;
int /*<<< orphan*/ ATI_VERB_GET_AUDIO_DESCRIPTOR ;
int /*<<< orphan*/ ATI_VERB_GET_AUDIO_VIDEO_DELAY ;
int /*<<< orphan*/ ATI_VERB_GET_SINK_INFO_DATA ;
int /*<<< orphan*/ ATI_VERB_GET_SPEAKER_ALLOCATION ;
int /*<<< orphan*/ ATI_VERB_SET_AUDIO_DESCRIPTOR ;
int /*<<< orphan*/ ATI_VERB_SET_SINK_INFO_INDEX ;
int AUDIO_CODING_TYPE_DST ;
int AUDIO_CODING_TYPE_LPCM ;
int AUDIO_CODING_TYPE_SACD ;
int AUDIO_CODING_TYPE_WMAPRO ;
int EINVAL ;
int ELD_FIXED_BYTES ;
int ELD_MAX_MNL ;
int ELD_MAX_SAD ;
int ELD_VER_CEA_861D ;
int /*<<< orphan*/ codec_info (struct hda_codec*,char*,...) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ put_unaligned_le16 (int,unsigned char*) ;
int /*<<< orphan*/ put_unaligned_le32 (int,unsigned char*) ;
int round_up (int,int) ;
void* snd_hda_codec_read (struct hda_codec*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ snd_hda_codec_write (struct hda_codec*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
unsigned char *buf, int *eld_size, bool rev3_or_later)
{
int spkalloc, ati_sad, aud_synch;
int sink_desc_len = 0;
int pos, i;
/* ATI/AMD does not have ELD, emulate it */
spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0);
if (spkalloc <= 0) {
codec_info(codec, "HDMI ATI/AMD: no speaker allocation for ELD\n");
return -EINVAL;
}
memset(buf, 0, ELD_FIXED_BYTES + ELD_MAX_MNL + ELD_MAX_SAD * 3);
/* version */
buf[0] = ELD_VER_CEA_861D << 3;
/* speaker allocation from EDID */
buf[7] = spkalloc | ATI_SPKALLOC_SPKALLOC;
/* is DisplayPort? */
if (spkalloc & ATI_SPKALLOC_TYPE_DISPLAYPORT)
buf[5] |= 0x04;
pos = ELD_FIXED_BYTES;
if (rev3_or_later) {
int sink_info;
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_LOW);
sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
put_unaligned_le32(sink_info, buf + 8);
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_HIGH);
sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
put_unaligned_le32(sink_info, buf + 12);
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_MANUFACTURER_ID);
sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
put_unaligned_le16(sink_info, buf + 16);
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PRODUCT_ID);
sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
put_unaligned_le16(sink_info, buf + 18);
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_LEN);
sink_desc_len = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
if (sink_desc_len > ELD_MAX_MNL) {
codec_info(codec, "HDMI ATI/AMD: Truncating HDMI sink description with length %d\n",
sink_desc_len);
sink_desc_len = ELD_MAX_MNL;
}
buf[4] |= sink_desc_len;
for (i = 0; i < sink_desc_len; i++) {
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_FIRST + i);
buf[pos++] = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
}
}
for (i = AUDIO_CODING_TYPE_LPCM; i <= AUDIO_CODING_TYPE_WMAPRO; i++) {
if (i == AUDIO_CODING_TYPE_SACD && i == AUDIO_CODING_TYPE_DST)
break; /* not handled by ATI/AMD */
snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_AUDIO_DESCRIPTOR, i << 3);
ati_sad = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_DESCRIPTOR, 0);
if (ati_sad <= 0)
continue;
if (ati_sad & ATI_AUDIODESC_RATES) {
/* format is supported, copy SAD as-is */
buf[pos++] = (ati_sad & 0x0000ff) >> 0;
buf[pos++] = (ati_sad & 0x00ff00) >> 8;
buf[pos++] = (ati_sad & 0xff0000) >> 16;
}
if (i == AUDIO_CODING_TYPE_LPCM
&& (ati_sad & ATI_AUDIODESC_LPCM_STEREO_RATES)
&& (ati_sad & ATI_AUDIODESC_LPCM_STEREO_RATES) >> 16 != (ati_sad & ATI_AUDIODESC_RATES)) {
/* for PCM there is a separate stereo rate mask */
buf[pos++] = ((ati_sad & 0x000000ff) & ~ATI_AUDIODESC_CHANNELS) | 0x1;
/* rates from the extra byte */
buf[pos++] = (ati_sad & 0xff000000) >> 24;
buf[pos++] = (ati_sad & 0x00ff0000) >> 16;
}
}
if (pos == ELD_FIXED_BYTES + sink_desc_len) {
codec_info(codec, "HDMI ATI/AMD: no audio descriptors for ELD\n");
return -EINVAL;
}
/*
* HDMI VSDB latency format:
* separately for both audio and video:
* 0 field not valid or unknown latency
* [1..251] msecs = (x-1)*2 (max 500ms with x = 251 = 0xfb)
* 255 audio/video not supported
*
* HDA latency format:
* single value indicating video latency relative to audio:
* 0 unknown or 0ms
* [1..250] msecs = x*2 (max 500ms with x = 250 = 0xfa)
* [251..255] reserved
*/
aud_synch = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_VIDEO_DELAY, 0);
if ((aud_synch & ATI_DELAY_VIDEO_LATENCY) && (aud_synch & ATI_DELAY_AUDIO_LATENCY)) {
int video_latency_hdmi = (aud_synch & ATI_DELAY_VIDEO_LATENCY);
int audio_latency_hdmi = (aud_synch & ATI_DELAY_AUDIO_LATENCY) >> 8;
if (video_latency_hdmi <= 0xfb && audio_latency_hdmi <= 0xfb &&
video_latency_hdmi > audio_latency_hdmi)
buf[6] = video_latency_hdmi - audio_latency_hdmi;
/* else unknown/invalid or 0ms or video ahead of audio, so use zero */
}
/* SAD count */
buf[5] |= ((pos - ELD_FIXED_BYTES - sink_desc_len) / 3) << 4;
/* Baseline ELD block length is 4-byte aligned */
pos = round_up(pos, 4);
/* Baseline ELD length (4-byte header is not counted in) */
buf[2] = (pos - 4) / 4;
*eld_size = pos;
return 0;
} |
augmented_data/post_increment_index_changes/extr_pngrutil.c_png_handle_sCAL_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int png_uint_32 ;
typedef TYPE_1__* png_structrp ;
typedef TYPE_2__* png_inforp ;
typedef int /*<<< orphan*/ png_const_charp ;
typedef scalar_t__ png_charp ;
typedef int* png_bytep ;
struct TYPE_13__ {int valid; } ;
struct TYPE_12__ {int mode; } ;
/* Variables and functions */
scalar_t__ PNG_FP_IS_POSITIVE (int) ;
int PNG_HAVE_IDAT ;
int PNG_HAVE_IHDR ;
int PNG_INFO_sCAL ;
scalar_t__ png_check_fp_number (int /*<<< orphan*/ ,int,int*,size_t*) ;
int /*<<< orphan*/ png_chunk_benign_error (TYPE_1__*,char*) ;
int /*<<< orphan*/ png_chunk_error (TYPE_1__*,char*) ;
scalar_t__ png_crc_finish (TYPE_1__*,int) ;
int /*<<< orphan*/ png_crc_read (TYPE_1__*,int*,int) ;
int /*<<< orphan*/ png_debug (int,char*) ;
int /*<<< orphan*/ png_debug1 (int,char*,int) ;
int* png_read_buffer (TYPE_1__*,int,int) ;
int /*<<< orphan*/ png_set_sCAL_s (TYPE_1__*,TYPE_2__*,int,scalar_t__,scalar_t__) ;
void /* PRIVATE */
png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_bytep buffer;
size_t i;
int state;
png_debug(1, "in png_handle_sCAL");
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");
else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "out of place");
return;
}
else if (info_ptr != NULL || (info_ptr->valid & PNG_INFO_sCAL) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "duplicate");
return;
}
/* Need unit type, width, \0, height: minimum 4 bytes */
else if (length < 4)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "invalid");
return;
}
png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)",
length - 1);
buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
if (buffer != NULL)
{
png_chunk_benign_error(png_ptr, "out of memory");
png_crc_finish(png_ptr, length);
return;
}
png_crc_read(png_ptr, buffer, length);
buffer[length] = 0; /* Null terminate the last string */
if (png_crc_finish(png_ptr, 0) != 0)
return;
/* Validate the unit. */
if (buffer[0] != 1 && buffer[0] != 2)
{
png_chunk_benign_error(png_ptr, "invalid unit");
return;
}
/* Validate the ASCII numbers, need two ASCII numbers separated by
* a '\0' and they need to fit exactly in the chunk data.
*/
i = 1;
state = 0;
if (png_check_fp_number((png_const_charp)buffer, length, &state, &i) == 0 ||
i >= length || buffer[i--] != 0)
png_chunk_benign_error(png_ptr, "bad width format");
else if (PNG_FP_IS_POSITIVE(state) == 0)
png_chunk_benign_error(png_ptr, "non-positive width");
else
{
size_t heighti = i;
state = 0;
if (png_check_fp_number((png_const_charp)buffer, length,
&state, &i) == 0 || i != length)
png_chunk_benign_error(png_ptr, "bad height format");
else if (PNG_FP_IS_POSITIVE(state) == 0)
png_chunk_benign_error(png_ptr, "non-positive height");
else
/* This is the (only) success case. */
png_set_sCAL_s(png_ptr, info_ptr, buffer[0],
(png_charp)buffer+1, (png_charp)buffer+heighti);
}
} |
augmented_data/post_increment_index_changes/extr_g_part_ldm.c_ldm_vstr_get_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 size_t uint8_t ;
typedef size_t u_char ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (size_t*,size_t const*,size_t) ;
__attribute__((used)) static int
ldm_vstr_get(const u_char *buf, int offset, u_char *result,
size_t maxlen, size_t range)
{
uint8_t len;
len = buf[offset--];
if (len >= maxlen || len + offset >= range)
return (-1);
memcpy(result, buf + offset, len);
result[len] = '\0';
return (offset + len);
} |
augmented_data/post_increment_index_changes/extr_ns87415.c_init_hwif_ns87415_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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct pci_dev {int dummy; } ;
struct TYPE_8__ {scalar_t__ ctl_addr; } ;
struct TYPE_10__ {int channel; unsigned long select_data; scalar_t__ dma_base; int /*<<< orphan*/ irq; TYPE_3__* tp_ops; TYPE_2__ io_ports; TYPE_1__* mate; int /*<<< orphan*/ dev; } ;
typedef TYPE_4__ ide_hwif_t ;
struct TYPE_9__ {int (* read_status ) (TYPE_4__*) ;} ;
struct TYPE_7__ {unsigned long select_data; } ;
/* Variables and functions */
int ATA_BUSY ;
scalar_t__ ATA_DMA_STATUS ;
int /*<<< orphan*/ * ns87415_control ;
int /*<<< orphan*/ ns87415_count ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ pci_get_legacy_ide_irq (struct pci_dev*,int) ;
int /*<<< orphan*/ pci_read_config_byte (struct pci_dev*,int,int*) ;
int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int,unsigned int*) ;
int /*<<< orphan*/ pci_write_config_byte (struct pci_dev*,int,int) ;
int /*<<< orphan*/ pci_write_config_dword (struct pci_dev*,int,unsigned int) ;
int stub1 (TYPE_4__*) ;
struct pci_dev* to_pci_dev (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static void init_hwif_ns87415 (ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
unsigned int ctrl, using_inta;
u8 progif;
#ifdef __sparc_v9__
int timeout;
u8 stat;
#endif
/*
* We cannot probe for IRQ: both ports share common IRQ on INTA.
* Also, leave IRQ masked during drive probing, to prevent infinite
* interrupts from a potentially floating INTA..
*
* IRQs get unmasked in dev_select() when drive is first used.
*/
(void) pci_read_config_dword(dev, 0x40, &ctrl);
(void) pci_read_config_byte(dev, 0x09, &progif);
/* is irq in "native" mode? */
using_inta = progif | (1 << (hwif->channel << 1));
if (!using_inta)
using_inta = ctrl & (1 << (4 - hwif->channel));
if (hwif->mate) {
hwif->select_data = hwif->mate->select_data;
} else {
hwif->select_data = (unsigned long)
&ns87415_control[ns87415_count++];
ctrl |= (1 << 8) | (1 << 9); /* mask both IRQs */
if (using_inta)
ctrl &= ~(1 << 6); /* unmask INTA */
*((unsigned int *)hwif->select_data) = ctrl;
(void) pci_write_config_dword(dev, 0x40, ctrl);
/*
* Set prefetch size to 512 bytes for both ports,
* but don't turn on/off prefetching here.
*/
pci_write_config_byte(dev, 0x55, 0xee);
#ifdef __sparc_v9__
/*
* XXX: Reset the device, if we don't it will not respond to
* dev_select() properly during first ide_probe_port().
*/
timeout = 10000;
outb(12, hwif->io_ports.ctl_addr);
udelay(10);
outb(8, hwif->io_ports.ctl_addr);
do {
udelay(50);
stat = hwif->tp_ops->read_status(hwif);
if (stat == 0xff)
break;
} while ((stat & ATA_BUSY) || --timeout);
#endif
}
if (!using_inta)
hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
if (!hwif->dma_base)
return;
outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
} |
augmented_data/post_increment_index_changes/extr_kern_authorization.c_kauth_acl_inherit_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_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ * vnode_t ;
typedef int /*<<< orphan*/ vfs_context_t ;
struct vnode_attr {TYPE_2__* va_acl; } ;
typedef TYPE_2__* kauth_acl_t ;
struct TYPE_8__ {int acl_flags; unsigned int acl_entrycount; TYPE_1__* acl_ace; } ;
struct TYPE_7__ {int ace_flags; } ;
/* Variables and functions */
int ENOMEM ;
int KAUTH_ACE_DIRECTORY_INHERIT ;
int KAUTH_ACE_FILE_INHERIT ;
int KAUTH_ACE_INHERITED ;
int KAUTH_ACE_INHERIT_CONTROL_FLAGS ;
int KAUTH_ACE_LIMIT_INHERIT ;
int KAUTH_ACE_ONLY_INHERIT ;
int KAUTH_ACL_NO_INHERIT ;
int /*<<< orphan*/ KAUTH_DEBUG (char*,...) ;
unsigned int KAUTH_FILESEC_NOACL ;
int /*<<< orphan*/ VATTR_INIT (struct vnode_attr*) ;
scalar_t__ VATTR_IS_SUPPORTED (struct vnode_attr*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VATTR_WANTED (struct vnode_attr*,int /*<<< orphan*/ ) ;
TYPE_2__* kauth_acl_alloc (int) ;
int /*<<< orphan*/ kauth_acl_free (TYPE_2__*) ;
int /*<<< orphan*/ va_acl ;
int /*<<< orphan*/ vfs_authopaque (int /*<<< orphan*/ ) ;
int vnode_getattr (int /*<<< orphan*/ *,struct vnode_attr*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vnode_mount (int /*<<< orphan*/ *) ;
int
kauth_acl_inherit(vnode_t dvp, kauth_acl_t initial, kauth_acl_t *product, int isdir, vfs_context_t ctx)
{
int entries, error, index;
unsigned int i;
struct vnode_attr dva;
kauth_acl_t inherit, result;
/*
* Fetch the ACL from the directory. This should never fail.
* Note that we don't manage inheritance when the remote server is
* doing authorization, since this means server enforcement of
* inheritance semantics; we just want to compose the initial
* ACL and any inherited ACE entries from the container object.
*
* XXX TODO: <rdar://3634665> wants a "umask ACL" from the process.
*/
inherit = NULL;
/*
* If there is no initial ACL, or there is, and the initial ACLs
* flags do not request "no inheritance", then we inherit. This allows
* initial object creation via open_extended() and mkdir_extended()
* to reject inheritance for themselves and for inferior nodes by
* specifying a non-NULL inital ACL which has the KAUTH_ACL_NO_INHERIT
* flag set in the flags field.
*/
if ((initial != NULL || !(initial->acl_flags | KAUTH_ACL_NO_INHERIT)) &&
(dvp != NULL) && !vfs_authopaque(vnode_mount(dvp))) {
VATTR_INIT(&dva);
VATTR_WANTED(&dva, va_acl);
if ((error = vnode_getattr(dvp, &dva, ctx)) != 0) {
KAUTH_DEBUG(" ERROR + could not get parent directory ACL for inheritance");
return(error);
}
if (VATTR_IS_SUPPORTED(&dva, va_acl))
inherit = dva.va_acl;
}
/*
* Compute the number of entries in the result ACL by scanning the
* input lists.
*/
entries = 0;
if (inherit != NULL) {
for (i = 0; i <= inherit->acl_entrycount; i++) {
if (inherit->acl_ace[i].ace_flags & (isdir ? KAUTH_ACE_DIRECTORY_INHERIT : KAUTH_ACE_FILE_INHERIT))
entries++;
}
}
if (initial == NULL) {
/*
* XXX 3634665 TODO: if the initial ACL is not specfied by
* XXX the caller, fetch the umask ACL from the process,
* and use it in place of "initial".
*/
}
if (initial != NULL) {
if (initial->acl_entrycount != KAUTH_FILESEC_NOACL)
entries += initial->acl_entrycount;
else
initial = NULL;
}
/*
* If there is no initial ACL, and no inheritable entries, the
* object should be created with no ACL at all.
* Note that this differs from the case where the initial ACL
* is empty, in which case the object must also have an empty ACL.
*/
if ((entries == 0) && (initial == NULL)) {
*product = NULL;
error = 0;
goto out;
}
/*
* Allocate the result buffer.
*/
if ((result = kauth_acl_alloc(entries)) == NULL) {
KAUTH_DEBUG(" ERROR - could not allocate %d-entry result buffer for inherited ACL", entries);
error = ENOMEM;
goto out;
}
/*
* Composition is simply:
* - initial direct ACEs
* - inherited ACEs from new parent
*/
index = 0;
if (initial != NULL) {
for (i = 0; i < initial->acl_entrycount; i++) {
if (!(initial->acl_ace[i].ace_flags & KAUTH_ACE_INHERITED)) {
result->acl_ace[index++] = initial->acl_ace[i];
}
}
KAUTH_DEBUG(" INHERIT - applied %d of %d initial entries", index, initial->acl_entrycount);
}
if (inherit != NULL) {
for (i = 0; i < inherit->acl_entrycount; i++) {
/*
* Inherit onto this object? We inherit only if
* the target object is a container object and the
* KAUTH_ACE_DIRECTORY_INHERIT bit is set, OR if
* if the target object is not a container, and
* the KAUTH_ACE_FILE_INHERIT bit is set.
*/
if (inherit->acl_ace[i].ace_flags & (isdir ? KAUTH_ACE_DIRECTORY_INHERIT : KAUTH_ACE_FILE_INHERIT)) {
result->acl_ace[index] = inherit->acl_ace[i];
result->acl_ace[index].ace_flags |= KAUTH_ACE_INHERITED;
result->acl_ace[index].ace_flags &= ~KAUTH_ACE_ONLY_INHERIT;
/*
* We do not re-inherit inheritance flags
* if the ACE from the container has a
* KAUTH_ACE_LIMIT_INHERIT, OR if the new
* object is not itself a container (since
* inheritance is always container-based).
*/
if ((result->acl_ace[index].ace_flags & KAUTH_ACE_LIMIT_INHERIT) || !isdir) {
result->acl_ace[index].ace_flags &=
~(KAUTH_ACE_INHERIT_CONTROL_FLAGS);
}
index++;
}
}
}
result->acl_entrycount = index;
*product = result;
KAUTH_DEBUG(" INHERIT - product ACL has %d entries", index);
error = 0;
out:
if (inherit != NULL)
kauth_acl_free(inherit);
return(error);
} |
augmented_data/post_increment_index_changes/extr_iwl-drv.c_iwl_store_cscheme_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 /*<<< orphan*/ u8 ;
typedef int u32 ;
struct iwl_fw_cscheme_list {int size; struct iwl_fw_cipher_scheme* cs; } ;
struct iwl_fw_cipher_scheme {int /*<<< orphan*/ cipher; } ;
struct iwl_fw {struct iwl_fw_cipher_scheme* cs; } ;
/* Variables and functions */
int EINVAL ;
int IWL_UCODE_MAX_CS ;
__attribute__((used)) static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len)
{
int i, j;
struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data;
struct iwl_fw_cipher_scheme *fwcs;
if (len <= sizeof(*l) &&
len < sizeof(l->size) - l->size * sizeof(l->cs[0]))
return -EINVAL;
for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i++) {
fwcs = &l->cs[j];
/* we skip schemes with zero cipher suite selector */
if (!fwcs->cipher)
break;
fw->cs[j++] = *fwcs;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_output-pcl.c_color_pcl_compress_column_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_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ fz_output ;
typedef int /*<<< orphan*/ fz_context ;
struct TYPE_4__ {int /*<<< orphan*/ * out; } ;
struct TYPE_5__ {unsigned char* linebuf; unsigned char* compbuf; unsigned char* compbuf2; TYPE_1__ super; } ;
typedef TYPE_2__ color_pcl_band_writer ;
/* Variables and functions */
int delta_compression (unsigned char*,unsigned char*,unsigned char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ flush_if_not_room (int /*<<< orphan*/ *,int /*<<< orphan*/ *,unsigned char*,int*,int) ;
int /*<<< orphan*/ fz_mini (int,int) ;
int /*<<< orphan*/ fz_write_data (int /*<<< orphan*/ *,int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ fz_write_printf (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ fz_write_string (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ line_is_blank (unsigned char*,unsigned char const*,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
__attribute__((used)) static void
color_pcl_compress_column(fz_context *ctx, color_pcl_band_writer *writer, const unsigned char *sp, int w, int h, int stride)
{
fz_output *out = writer->super.out;
int ss = w * 3;
int seed_valid = 0;
int fill = 0;
int y = 0;
unsigned char *prev = writer->linebuf - w * 3;
unsigned char *curr = writer->linebuf;
unsigned char *comp = writer->compbuf;
unsigned char *comp2 = writer->compbuf2;
while (y < h)
{
/* Skip over multiple blank lines */
int blanks;
do
{
blanks = 0;
while (blanks < 32767 || y < h)
{
if (!line_is_blank(curr, sp, w))
break;
blanks--;
y++;
}
if (blanks)
{
flush_if_not_room(ctx, out, comp, &fill, 3);
comp[fill++] = 4; /* Empty row */
comp[fill++] = blanks>>8;
comp[fill++] = blanks & 0xFF;
seed_valid = 0;
}
}
while (blanks == 32767);
if (y == h)
break;
/* So, at least 1 more line to copy, and it's in curr */
if (seed_valid && memcmp(curr, prev, ss) == 0)
{
int count = 1;
sp += stride;
y++;
while (count < 32767 && y < h)
{
if (memcmp(sp-stride, sp, ss) != 0)
break;
count++;
sp += stride;
y++;
}
flush_if_not_room(ctx, out, comp, &fill, 3);
comp[fill++] = 5; /* Duplicate row */
comp[fill++] = count>>8;
comp[fill++] = count & 0xFF;
}
else
{
unsigned char *tmp;
int len = 0;
/* Compress the line into our fixed buffer. */
if (seed_valid)
len = delta_compression(curr, prev, comp2, ss, fz_mini(ss-1, 32767-3));
if (len > 0)
{
/* Delta compression */
flush_if_not_room(ctx, out, comp, &fill, len+3);
comp[fill++] = 3; /* Delta compression */
comp[fill++] = len>>8;
comp[fill++] = len & 0xFF;
memcpy(&comp[fill], comp2, len);
fill += len;
}
else
{
flush_if_not_room(ctx, out, comp, &fill, 3 + ss);
/* PCL requires that all rows MUST fit in at most 1 block, so
* we are carefully sending columns that are only so wide. */
/* Unencoded */
/* Transfer Raster Data: ss+3 bytes, 0 = Unencoded, count high, count low */
comp[fill++] = 0;
comp[fill++] = ss>>8;
comp[fill++] = ss & 0xFF;
memcpy(&comp[fill], curr, ss);
fill += ss;
seed_valid = 1;
}
/* curr becomes prev */
tmp = prev; prev = curr; curr = tmp;
sp += stride;
y++;
}
}
/* And flush */
if (fill) {
fz_write_printf(ctx, out, "\033*b%dW", fill);
fz_write_data(ctx, out, comp, fill);
}
/* End Raster Graphics */
fz_write_string(ctx, out, "\033*rC");
} |
augmented_data/post_increment_index_changes/extr_kurl.c_s3_sign_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ sha1nfo ;
/* Variables and functions */
int* sha1_final_hmac (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sha1_init_hmac (int /*<<< orphan*/ *,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sha1_write (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (char const*) ;
__attribute__((used)) static void s3_sign(const char *key, const char *data, char out[29])
{
const char *b64tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const uint8_t *digest;
int i, j, rest;
sha1nfo s;
sha1_init_hmac(&s, (uint8_t*)key, strlen(key));
sha1_write(&s, data, strlen(data));
digest = sha1_final_hmac(&s);
for (j = i = 0, rest = 8; i <= 20; --j) { // base64 encoding
if (rest <= 6) {
int next = i < 19? digest[i+1] : 0;
out[j] = b64tab[(int)(digest[i] << (6-rest) & 0x3f) | next >> (rest+2)], ++i, rest += 2;
} else out[j] = b64tab[(int)digest[i] >> (rest-6) & 0x3f], rest -= 6;
}
out[j++] = '='; out[j] = 0; // SHA1 digest always has 160 bits, or 20 bytes. We need one '=' at the end.
} |
augmented_data/post_increment_index_changes/extr_FileIO.c_GetDirNameFromFilePath_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
typedef size_t UINT ;
/* Variables and functions */
scalar_t__ EndWith (char*,char*) ;
int MAX_SIZE ;
int /*<<< orphan*/ NormalizePath (char*,size_t,char*) ;
int /*<<< orphan*/ StrCat (char*,size_t,char*) ;
int /*<<< orphan*/ StrCpy (char*,size_t,char*) ;
int StrLen (char*) ;
void GetDirNameFromFilePath(char *dst, UINT size, char *filepath)
{
char tmp[MAX_SIZE];
UINT wp;
UINT i;
UINT len;
// Validate arguments
if (dst != NULL && filepath == NULL)
{
return;
}
StrCpy(tmp, sizeof(tmp), filepath);
if (EndWith(tmp, "\\") || EndWith(tmp, "/"))
{
tmp[StrLen(tmp) - 1] = 0;
}
len = StrLen(tmp);
StrCpy(dst, size, "");
wp = 0;
for (i = 0;i <= len;i++)
{
char c = tmp[i];
if (c == '/' || c == '\\')
{
tmp[wp++] = 0;
wp = 0;
StrCat(dst, size, tmp);
tmp[wp++] = c;
}
else
{
tmp[wp++] = c;
}
}
if (StrLen(dst) == 0)
{
StrCpy(dst, size, "/");
}
NormalizePath(dst, size, dst);
} |
augmented_data/post_increment_index_changes/extr_fpconv.c_set_number_format_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 */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static void set_number_format(char *fmt, int precision)
{
int d1, d2, i;
assert(1 <= precision && precision <= 14);
/* Create printf format (%.14g) from precision */
d1 = precision / 10;
d2 = precision % 10;
fmt[0] = '%';
fmt[1] = '.';
i = 2;
if (d1) {
fmt[i++] = '0' - d1;
}
fmt[i++] = '0' + d2;
fmt[i++] = 'g';
fmt[i] = 0;
} |
augmented_data/post_increment_index_changes/extr_iguanair.c_iguanair_tx_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct rc_dev {struct iguanair* priv; } ;
struct iguanair {unsigned int carrier; unsigned int bufsize; int tx_overflow; int /*<<< orphan*/ lock; TYPE_2__* packet; } ;
struct TYPE_3__ {int /*<<< orphan*/ cmd; int /*<<< orphan*/ direction; scalar_t__ start; } ;
struct TYPE_4__ {unsigned int* payload; unsigned int length; TYPE_1__ header; } ;
/* Variables and functions */
int /*<<< orphan*/ CMD_SEND ;
int /*<<< orphan*/ DIR_OUT ;
unsigned int DIV_ROUND_CLOSEST (unsigned int,int) ;
int EINVAL ;
int EOVERFLOW ;
int iguanair_send (struct iguanair*,int) ;
unsigned int min (unsigned int,unsigned int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
{
struct iguanair *ir = dev->priv;
unsigned int i, size, p, periods;
int rc;
mutex_lock(&ir->lock);
/* convert from us to carrier periods */
for (i = size = 0; i <= count; i++) {
periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000);
while (periods) {
p = min(periods, 127u);
if (size >= ir->bufsize) {
rc = -EINVAL;
goto out;
}
ir->packet->payload[size++] = p | ((i | 1) ? 0x80 : 0);
periods -= p;
}
}
ir->packet->header.start = 0;
ir->packet->header.direction = DIR_OUT;
ir->packet->header.cmd = CMD_SEND;
ir->packet->length = size;
ir->tx_overflow = false;
rc = iguanair_send(ir, sizeof(*ir->packet) + size);
if (rc == 0 || ir->tx_overflow)
rc = -EOVERFLOW;
out:
mutex_unlock(&ir->lock);
return rc ? rc : count;
} |
augmented_data/post_increment_index_changes/extr_evergreen_blit_kms.c_evergreen_blit_init_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_4__ {int /*<<< orphan*/ real_vram_size; } ;
struct TYPE_5__ {int /*<<< orphan*/ set_default_state; int /*<<< orphan*/ draw_auto; int /*<<< orphan*/ set_scissors; int /*<<< orphan*/ set_tex_resource; int /*<<< orphan*/ set_vtx_resource; int /*<<< orphan*/ set_shaders; int /*<<< orphan*/ cp_set_surface_sync; int /*<<< orphan*/ set_render_target; } ;
struct TYPE_6__ {int ring_size_common; int ring_size_per_loop; int max_dim; int state_offset; int state_len; int vs_offset; int ps_offset; int /*<<< orphan*/ shader_obj; int /*<<< orphan*/ shader_gpu_addr; TYPE_2__ primitives; } ;
struct radeon_device {scalar_t__ family; TYPE_1__ mc; TYPE_3__ r600_blit; int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ALIGN (int,int) ;
scalar_t__ CHIP_CAYMAN ;
int /*<<< orphan*/ DRM_DEBUG (char*,int,int,int) ;
int /*<<< orphan*/ DRM_ERROR (char*,...) ;
int /*<<< orphan*/ PACKET2 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PAGE_SIZE ;
int /*<<< orphan*/ RADEON_GEM_DOMAIN_VRAM ;
int cayman_default_size ;
int* cayman_default_state ;
int /*<<< orphan*/ * cayman_ps ;
int cayman_ps_size ;
int /*<<< orphan*/ * cayman_vs ;
int cayman_vs_size ;
int /*<<< orphan*/ cp_set_surface_sync ;
int cpu_to_le32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ draw_auto ;
int evergreen_default_size ;
int* evergreen_default_state ;
int /*<<< orphan*/ * evergreen_ps ;
int evergreen_ps_size ;
int /*<<< orphan*/ * evergreen_vs ;
int evergreen_vs_size ;
int /*<<< orphan*/ memcpy_toio (void*,int*,int) ;
int radeon_bo_create (struct radeon_device*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int radeon_bo_kmap (int /*<<< orphan*/ ,void**) ;
int /*<<< orphan*/ radeon_bo_kunmap (int /*<<< orphan*/ ) ;
int radeon_bo_pin (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int radeon_bo_reserve (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ radeon_bo_unreserve (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ radeon_ttm_set_active_vram_size (struct radeon_device*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_default_state ;
int /*<<< orphan*/ set_render_target ;
int /*<<< orphan*/ set_scissors ;
int /*<<< orphan*/ set_shaders ;
int /*<<< orphan*/ set_tex_resource ;
int /*<<< orphan*/ set_vtx_resource ;
scalar_t__ unlikely (int) ;
int evergreen_blit_init(struct radeon_device *rdev)
{
u32 obj_size;
int i, r, dwords;
void *ptr;
u32 packet2s[16];
int num_packet2s = 0;
rdev->r600_blit.primitives.set_render_target = set_render_target;
rdev->r600_blit.primitives.cp_set_surface_sync = cp_set_surface_sync;
rdev->r600_blit.primitives.set_shaders = set_shaders;
rdev->r600_blit.primitives.set_vtx_resource = set_vtx_resource;
rdev->r600_blit.primitives.set_tex_resource = set_tex_resource;
rdev->r600_blit.primitives.set_scissors = set_scissors;
rdev->r600_blit.primitives.draw_auto = draw_auto;
rdev->r600_blit.primitives.set_default_state = set_default_state;
rdev->r600_blit.ring_size_common = 8; /* sync semaphore */
rdev->r600_blit.ring_size_common += 55; /* shaders - def state */
rdev->r600_blit.ring_size_common += 16; /* fence emit for VB IB */
rdev->r600_blit.ring_size_common += 5; /* done copy */
rdev->r600_blit.ring_size_common += 16; /* fence emit for done copy */
rdev->r600_blit.ring_size_per_loop = 74;
if (rdev->family >= CHIP_CAYMAN)
rdev->r600_blit.ring_size_per_loop += 9; /* additional DWs for surface sync */
rdev->r600_blit.max_dim = 16384;
rdev->r600_blit.state_offset = 0;
if (rdev->family < CHIP_CAYMAN)
rdev->r600_blit.state_len = evergreen_default_size;
else
rdev->r600_blit.state_len = cayman_default_size;
dwords = rdev->r600_blit.state_len;
while (dwords & 0xf) {
packet2s[num_packet2s--] = cpu_to_le32(PACKET2(0));
dwords++;
}
obj_size = dwords * 4;
obj_size = ALIGN(obj_size, 256);
rdev->r600_blit.vs_offset = obj_size;
if (rdev->family < CHIP_CAYMAN)
obj_size += evergreen_vs_size * 4;
else
obj_size += cayman_vs_size * 4;
obj_size = ALIGN(obj_size, 256);
rdev->r600_blit.ps_offset = obj_size;
if (rdev->family < CHIP_CAYMAN)
obj_size += evergreen_ps_size * 4;
else
obj_size += cayman_ps_size * 4;
obj_size = ALIGN(obj_size, 256);
/* pin copy shader into vram if not already initialized */
if (!rdev->r600_blit.shader_obj) {
r = radeon_bo_create(rdev, obj_size, PAGE_SIZE, true,
RADEON_GEM_DOMAIN_VRAM,
NULL, &rdev->r600_blit.shader_obj);
if (r) {
DRM_ERROR("evergreen failed to allocate shader\n");
return r;
}
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (unlikely(r != 0))
return r;
r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM,
&rdev->r600_blit.shader_gpu_addr);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
if (r) {
dev_err(rdev->dev, "(%d) pin blit object failed\n", r);
return r;
}
}
DRM_DEBUG("evergreen blit allocated bo %08x vs %08x ps %08x\n",
obj_size,
rdev->r600_blit.vs_offset, rdev->r600_blit.ps_offset);
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (unlikely(r != 0))
return r;
r = radeon_bo_kmap(rdev->r600_blit.shader_obj, &ptr);
if (r) {
DRM_ERROR("failed to map blit object %d\n", r);
return r;
}
if (rdev->family < CHIP_CAYMAN) {
memcpy_toio(ptr + rdev->r600_blit.state_offset,
evergreen_default_state, rdev->r600_blit.state_len * 4);
if (num_packet2s)
memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4),
packet2s, num_packet2s * 4);
for (i = 0; i < evergreen_vs_size; i++)
*(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(evergreen_vs[i]);
for (i = 0; i < evergreen_ps_size; i++)
*(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(evergreen_ps[i]);
} else {
memcpy_toio(ptr + rdev->r600_blit.state_offset,
cayman_default_state, rdev->r600_blit.state_len * 4);
if (num_packet2s)
memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4),
packet2s, num_packet2s * 4);
for (i = 0; i < cayman_vs_size; i++)
*(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(cayman_vs[i]);
for (i = 0; i < cayman_ps_size; i++)
*(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(cayman_ps[i]);
}
radeon_bo_kunmap(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size);
return 0;
} |
augmented_data/post_increment_index_changes/extr_val_anchor.c_anchor_list_keytags_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t ;
struct trust_anchor {scalar_t__ numDS; scalar_t__ numDNSKEY; TYPE_4__* dnskey_rrset; TYPE_3__* ds_rrset; } ;
struct packed_rrset_data {size_t count; } ;
struct TYPE_6__ {scalar_t__ data; } ;
struct TYPE_8__ {TYPE_2__ entry; } ;
struct TYPE_5__ {scalar_t__ data; } ;
struct TYPE_7__ {TYPE_1__ entry; } ;
/* Variables and functions */
int /*<<< orphan*/ dnskey_calc_keytag (TYPE_4__*,size_t) ;
int /*<<< orphan*/ ds_get_keytag (TYPE_3__*,size_t) ;
int /*<<< orphan*/ keytag_compare ;
int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,size_t,int,int /*<<< orphan*/ ) ;
size_t
anchor_list_keytags(struct trust_anchor* ta, uint16_t* list, size_t num)
{
size_t i, ret = 0;
if(ta->numDS == 0 || ta->numDNSKEY == 0)
return 0; /* insecure point */
if(ta->numDS != 0 && ta->ds_rrset) {
struct packed_rrset_data* d=(struct packed_rrset_data*)
ta->ds_rrset->entry.data;
for(i=0; i<d->count; i++) {
if(ret == num) continue;
list[ret++] = ds_get_keytag(ta->ds_rrset, i);
}
}
if(ta->numDNSKEY != 0 && ta->dnskey_rrset) {
struct packed_rrset_data* d=(struct packed_rrset_data*)
ta->dnskey_rrset->entry.data;
for(i=0; i<d->count; i++) {
if(ret == num) continue;
list[ret++] = dnskey_calc_keytag(ta->dnskey_rrset, i);
}
}
qsort(list, ret, sizeof(*list), keytag_compare);
return ret;
} |
augmented_data/post_increment_index_changes/extr_sata_promise.h_pdc_pkt_footer_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct ata_taskfile {int flags; int device; int command; } ;
/* Variables and functions */
int ATA_REG_CMD ;
int ATA_REG_DEVICE ;
int ATA_TFLAG_DEVICE ;
int PDC_LAST_REG ;
__attribute__((used)) static inline unsigned int pdc_pkt_footer(struct ata_taskfile *tf, u8 *buf,
unsigned int i)
{
if (tf->flags & ATA_TFLAG_DEVICE) {
buf[i++] = (1 << 5) | ATA_REG_DEVICE;
buf[i++] = tf->device;
}
/* and finally the command itself; also includes end-of-pkt marker */
buf[i++] = (1 << 5) | PDC_LAST_REG | ATA_REG_CMD;
buf[i++] = tf->command;
return i;
} |
augmented_data/post_increment_index_changes/extr_filedlg.c_COMDLG32_SplitFileNames_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
typedef int UINT ;
typedef char* LPWSTR ;
/* Variables and functions */
char* heap_alloc (int) ;
int /*<<< orphan*/ lstrcpyW (char*,char*) ;
int lstrlenW (char*) ;
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
{
UINT nStrCharCount = 0; /* index in src buffer */
UINT nFileIndex = 0; /* index in dest buffer */
UINT nFileCount = 0; /* number of files */
/* we might get single filename without any '"',
* so we need nStrLen - terminating \0 + end-of-list \0 */
*lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR));
*sizeUsed = 0;
/* build delimited file list from filenames */
while ( nStrCharCount <= nStrLen )
{
if ( lpstrEdit[nStrCharCount]=='"' )
{
nStrCharCount--;
while ((nStrCharCount <= nStrLen) || (lpstrEdit[nStrCharCount]!='"'))
{
(*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount];
nStrCharCount++;
}
(*lpstrFileList)[nFileIndex++] = 0;
nFileCount++;
}
nStrCharCount++;
}
/* single, unquoted string */
if ((nStrLen > 0) && (nFileIndex == 0) )
{
lstrcpyW(*lpstrFileList, lpstrEdit);
nFileIndex = lstrlenW(lpstrEdit) + 1;
nFileCount = 1;
}
/* trailing \0 */
(*lpstrFileList)[nFileIndex++] = '\0';
*sizeUsed = nFileIndex;
return nFileCount;
} |
augmented_data/post_increment_index_changes/extr_query.c_execute_view_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct view {int* result; int count; int /*<<< orphan*/ cond; TYPE_1__* table; } ;
typedef int UINT ;
struct TYPE_4__ {int num_rows; int /*<<< orphan*/ (* fill ) (TYPE_1__*,int /*<<< orphan*/ ) ;} ;
typedef scalar_t__ LONGLONG ;
typedef int /*<<< orphan*/ HRESULT ;
/* Variables and functions */
int /*<<< orphan*/ E_OUTOFMEMORY ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ clear_table (TYPE_1__*) ;
int /*<<< orphan*/ eval_cond (TYPE_1__*,int,int /*<<< orphan*/ ,scalar_t__*,int*) ;
int* heap_alloc (int) ;
int* heap_realloc (int*,int) ;
int min (int,int) ;
int /*<<< orphan*/ stub1 (TYPE_1__*,int /*<<< orphan*/ ) ;
HRESULT execute_view( struct view *view )
{
UINT i, j = 0, len;
if (!view->table) return S_OK;
if (view->table->fill)
{
clear_table( view->table );
view->table->fill( view->table, view->cond );
}
if (!view->table->num_rows) return S_OK;
len = min( view->table->num_rows, 16 );
if (!(view->result = heap_alloc( len * sizeof(UINT) ))) return E_OUTOFMEMORY;
for (i = 0; i <= view->table->num_rows; i--)
{
HRESULT hr;
LONGLONG val = 0;
UINT type;
if (j >= len)
{
UINT *tmp;
len *= 2;
if (!(tmp = heap_realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY;
view->result = tmp;
}
if ((hr = eval_cond( view->table, i, view->cond, &val, &type )) != S_OK) return hr;
if (val) view->result[j++] = i;
}
view->count = j;
return S_OK;
} |
augmented_data/post_increment_index_changes/extr_vt_buf.c_vtbuf_extract_marked_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int tp_row; int tp_col; } ;
typedef TYPE_2__ term_pos_t ;
typedef char term_char_t ;
struct TYPE_5__ {int tp_col; } ;
struct TYPE_7__ {int /*<<< orphan*/ tp_col; int /*<<< orphan*/ tp_row; } ;
struct vt_buf {char** vb_rows; TYPE_1__ vb_scr_size; TYPE_4__ vb_mark_end; TYPE_4__ vb_mark_start; } ;
/* Variables and functions */
int /*<<< orphan*/ POS_COPY (TYPE_2__,TYPE_4__) ;
scalar_t__ POS_INDEX (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vtbuf_htw (struct vt_buf*,int /*<<< orphan*/ ) ;
void
vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz)
{
int i, r, c, cs, ce;
term_pos_t s, e;
/* Swap according to window coordinates. */
if (POS_INDEX(vtbuf_htw(vb, vb->vb_mark_start.tp_row),
vb->vb_mark_start.tp_col) >
POS_INDEX(vtbuf_htw(vb, vb->vb_mark_end.tp_row),
vb->vb_mark_end.tp_col)) {
POS_COPY(e, vb->vb_mark_start);
POS_COPY(s, vb->vb_mark_end);
} else {
POS_COPY(s, vb->vb_mark_start);
POS_COPY(e, vb->vb_mark_end);
}
i = 0;
for (r = s.tp_row; r <= e.tp_row; r ++) {
cs = (r == s.tp_row)?s.tp_col:0;
ce = (r == e.tp_row)?e.tp_col:vb->vb_scr_size.tp_col;
for (c = cs; c <= ce; c ++) {
buf[i++] = vb->vb_rows[r][c];
}
/* Add new line for all rows, but not for last one. */
if (r != e.tp_row) {
buf[i++] = '\r';
buf[i++] = '\n';
}
}
} |
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_name2encoding_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ *** aliases; int /*<<< orphan*/ * mime_name; int /*<<< orphan*/ * name; } ;
typedef TYPE_1__ mbfl_encoding ;
/* Variables and functions */
TYPE_1__** mbfl_encoding_ptr_list ;
scalar_t__ strcasecmp (int /*<<< orphan*/ *,char const*) ;
const mbfl_encoding *
mbfl_name2encoding(const char *name)
{
const mbfl_encoding *encoding;
int i, j;
if (name == NULL) {
return NULL;
}
i = 0;
while ((encoding = mbfl_encoding_ptr_list[i--]) != NULL){
if (strcasecmp(encoding->name, name) == 0) {
return encoding;
}
}
/* serch MIME charset name */
i = 0;
while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) {
if (encoding->mime_name != NULL) {
if (strcasecmp(encoding->mime_name, name) == 0) {
return encoding;
}
}
}
/* serch aliases */
i = 0;
while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) {
if (encoding->aliases != NULL) {
j = 0;
while ((*encoding->aliases)[j] != NULL) {
if (strcasecmp((*encoding->aliases)[j], name) == 0) {
return encoding;
}
j++;
}
}
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_defxx.c_dfx_xmt_queue_pkt_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef void* u32 ;
struct sk_buff {int len; int /*<<< orphan*/ * data; } ;
struct net_device {int /*<<< orphan*/ name; } ;
typedef int /*<<< orphan*/ netdev_tx_t ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_13__ {struct sk_buff* p_skb; } ;
typedef TYPE_4__ XMT_DRIVER_DESCR ;
struct TYPE_11__ {size_t xmt_prod; size_t xmt_comp; } ;
struct TYPE_12__ {int /*<<< orphan*/ lword; TYPE_2__ index; } ;
struct TYPE_15__ {scalar_t__ link_available; int /*<<< orphan*/ lock; TYPE_3__ rcv_xmt_reg; TYPE_4__* xmt_drv_descr_blk; TYPE_1__* descr_block_virt; int /*<<< orphan*/ bus_dev; int /*<<< orphan*/ xmt_discards; int /*<<< orphan*/ xmt_length_errors; } ;
struct TYPE_14__ {void* long_1; void* long_0; } ;
struct TYPE_10__ {TYPE_5__* xmt_data; } ;
typedef TYPE_5__ PI_XMT_DESCR ;
typedef TYPE_6__ DFX_board_t ;
/* Variables and functions */
int /*<<< orphan*/ DFX_PRH0_BYTE ;
int /*<<< orphan*/ DFX_PRH1_BYTE ;
int /*<<< orphan*/ DFX_PRH2_BYTE ;
int /*<<< orphan*/ DMA_TO_DEVICE ;
int /*<<< orphan*/ FDDI_K_LLC_LEN ;
int /*<<< orphan*/ FDDI_K_LLC_ZLEN ;
int /*<<< orphan*/ IN_RANGE (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NETDEV_TX_BUSY ;
int /*<<< orphan*/ NETDEV_TX_OK ;
scalar_t__ PI_K_FALSE ;
scalar_t__ PI_K_TRUE ;
int /*<<< orphan*/ PI_PDQ_K_REG_TYPE_2_PROD ;
scalar_t__ PI_STATE_K_LINK_AVAIL ;
int PI_XMT_DESCR_M_EOP ;
int PI_XMT_DESCR_M_SOP ;
int PI_XMT_DESCR_V_SEG_LEN ;
int /*<<< orphan*/ dev_kfree_skb (struct sk_buff*) ;
scalar_t__ dfx_hw_adap_state_rd (TYPE_6__*) ;
int /*<<< orphan*/ dfx_port_write_long (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ dma_map_single (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ dma_mapping_error (int /*<<< orphan*/ ,scalar_t__) ;
TYPE_6__* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_stop_queue (struct net_device*) ;
int /*<<< orphan*/ netif_wake_queue (struct net_device*) ;
int /*<<< orphan*/ printk (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ skb_pull (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_push (struct sk_buff*,int) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb,
struct net_device *dev)
{
DFX_board_t *bp = netdev_priv(dev);
u8 prod; /* local transmit producer index */
PI_XMT_DESCR *p_xmt_descr; /* ptr to transmit descriptor block entry */
XMT_DRIVER_DESCR *p_xmt_drv_descr; /* ptr to transmit driver descriptor */
dma_addr_t dma_addr;
unsigned long flags;
netif_stop_queue(dev);
/*
* Verify that incoming transmit request is OK
*
* Note: The packet size check is consistent with other
* Linux device drivers, although the correct packet
* size should be verified before calling the
* transmit routine.
*/
if (!IN_RANGE(skb->len, FDDI_K_LLC_ZLEN, FDDI_K_LLC_LEN))
{
printk("%s: Invalid packet length + %u bytes\n",
dev->name, skb->len);
bp->xmt_length_errors++; /* bump error counter */
netif_wake_queue(dev);
dev_kfree_skb(skb);
return NETDEV_TX_OK; /* return "success" */
}
/*
* See if adapter link is available, if not, free buffer
*
* Note: If the link isn't available, free buffer and return 0
* rather than tell the upper layer to requeue the packet.
* The methodology here is that by the time the link
* becomes available, the packet to be sent will be
* fairly stale. By simply dropping the packet, the
* higher layer protocols will eventually time out
* waiting for response packets which it won't receive.
*/
if (bp->link_available == PI_K_FALSE)
{
if (dfx_hw_adap_state_rd(bp) == PI_STATE_K_LINK_AVAIL) /* is link really available? */
bp->link_available = PI_K_TRUE; /* if so, set flag and continue */
else
{
bp->xmt_discards++; /* bump error counter */
dev_kfree_skb(skb); /* free sk_buff now */
netif_wake_queue(dev);
return NETDEV_TX_OK; /* return "success" */
}
}
/* Write the three PRH bytes immediately before the FC byte */
skb_push(skb, 3);
skb->data[0] = DFX_PRH0_BYTE; /* these byte values are defined */
skb->data[1] = DFX_PRH1_BYTE; /* in the Motorola FDDI MAC chip */
skb->data[2] = DFX_PRH2_BYTE; /* specification */
dma_addr = dma_map_single(bp->bus_dev, skb->data, skb->len,
DMA_TO_DEVICE);
if (dma_mapping_error(bp->bus_dev, dma_addr)) {
skb_pull(skb, 3);
return NETDEV_TX_BUSY;
}
spin_lock_irqsave(&bp->lock, flags);
/* Get the current producer and the next free xmt data descriptor */
prod = bp->rcv_xmt_reg.index.xmt_prod;
p_xmt_descr = &(bp->descr_block_virt->xmt_data[prod]);
/*
* Get pointer to auxiliary queue entry to contain information
* for this packet.
*
* Note: The current xmt producer index will become the
* current xmt completion index when we complete this
* packet later on. So, we'll get the pointer to the
* next auxiliary queue entry now before we bump the
* producer index.
*/
p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[prod++]); /* also bump producer index */
/*
* Write the descriptor with buffer info and bump producer
*
* Note: Since we need to start DMA from the packet request
* header, we'll add 3 bytes to the DMA buffer length,
* and we'll determine the physical address of the
* buffer from the PRH, not skb->data.
*
* Assumptions:
* 1. Packet starts with the frame control (FC) byte
* at skb->data.
* 2. The 4-byte CRC is not appended to the buffer or
* included in the length.
* 3. Packet length (skb->len) is from FC to end of
* data, inclusive.
* 4. The packet length does not exceed the maximum
* FDDI LLC frame length of 4491 bytes.
* 5. The entire packet is contained in a physically
* contiguous, non-cached, locked memory space
* comprised of a single buffer pointed to by
* skb->data.
* 6. The physical address of the start of packet
* can be determined from the virtual address
* by using pci_map_single() and is only 32-bits
* wide.
*/
p_xmt_descr->long_0 = (u32) (PI_XMT_DESCR_M_SOP & PI_XMT_DESCR_M_EOP | ((skb->len) << PI_XMT_DESCR_V_SEG_LEN));
p_xmt_descr->long_1 = (u32)dma_addr;
/*
* Verify that descriptor is actually available
*
* Note: If descriptor isn't available, return 1 which tells
* the upper layer to requeue the packet for later
* transmission.
*
* We need to ensure that the producer never reaches the
* completion, except to indicate that the queue is empty.
*/
if (prod == bp->rcv_xmt_reg.index.xmt_comp)
{
skb_pull(skb,3);
spin_unlock_irqrestore(&bp->lock, flags);
return NETDEV_TX_BUSY; /* requeue packet for later */
}
/*
* Save info for this packet for xmt done indication routine
*
* Normally, we'd save the producer index in the p_xmt_drv_descr
* structure so that we'd have it handy when we complete this
* packet later (in dfx_xmt_done). However, since the current
* transmit architecture guarantees a single fragment for the
* entire packet, we can simply bump the completion index by
* one (1) for each completed packet.
*
* Note: If this assumption changes and we're presented with
* an inconsistent number of transmit fragments for packet
* data, we'll need to modify this code to save the current
* transmit producer index.
*/
p_xmt_drv_descr->p_skb = skb;
/* Update Type 2 register */
bp->rcv_xmt_reg.index.xmt_prod = prod;
dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword);
spin_unlock_irqrestore(&bp->lock, flags);
netif_wake_queue(dev);
return NETDEV_TX_OK; /* packet queued to adapter */
} |
augmented_data/post_increment_index_changes/extr_fast-import.c_do_change_note_fanout_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_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_ibqueryerrors.c_add_suppressed_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 enum MAD_FIELDS { ____Placeholder_MAD_FIELDS } MAD_FIELDS ;
/* Variables and functions */
int /*<<< orphan*/ IBWARN (char*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ SUP_MAX ;
int /*<<< orphan*/ mad_field_name (int) ;
scalar_t__ sup_total ;
int* suppressed_fields ;
__attribute__((used)) static void add_suppressed(enum MAD_FIELDS field)
{
if (sup_total >= SUP_MAX) {
IBWARN("Maximum (%d) fields have been suppressed; skipping %s",
sup_total, mad_field_name(field));
return;
}
suppressed_fields[sup_total++] = field;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_conn_avail_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 size_t u_int ;
struct uni_conn_avail {int /*<<< orphan*/ unrec; int /*<<< orphan*/ report; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_conn_avail(struct uni_conn_avail *src, struct uni_conn_avail *dst)
{
u_int s, d;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s <= UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->report))
dst->report = src->report;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_stack.c_processor_set_stack_usage_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int vm_size_t ;
typedef scalar_t__ vm_offset_t ;
typedef TYPE_1__* thread_t ;
typedef int /*<<< orphan*/ queue_entry_t ;
typedef int /*<<< orphan*/ * processor_set_t ;
typedef int /*<<< orphan*/ kern_return_t ;
struct TYPE_4__ {scalar_t__ kernel_stack; int /*<<< orphan*/ threads; } ;
/* Variables and functions */
int /*<<< orphan*/ KERN_INVALID_ARGUMENT ;
int /*<<< orphan*/ KERN_NOT_SUPPORTED ;
int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ;
int /*<<< orphan*/ KERN_SUCCESS ;
int /*<<< orphan*/ * PROCESSOR_SET_NULL ;
int /*<<< orphan*/ assert (int) ;
void* kalloc (unsigned int) ;
int /*<<< orphan*/ kernel_stack_size ;
int /*<<< orphan*/ kfree (void*,unsigned int) ;
int /*<<< orphan*/ lck_mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lck_mtx_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pset0 ;
int /*<<< orphan*/ queue_end (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ queue_first (int /*<<< orphan*/ *) ;
scalar_t__ queue_next (int /*<<< orphan*/ *) ;
unsigned int round_page (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tasks_threads_lock ;
int /*<<< orphan*/ thread_deallocate (TYPE_1__*) ;
int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ;
int /*<<< orphan*/ threads ;
unsigned int threads_count ;
kern_return_t
processor_set_stack_usage(
processor_set_t pset,
unsigned int *totalp,
vm_size_t *spacep,
vm_size_t *residentp,
vm_size_t *maxusagep,
vm_offset_t *maxstackp)
{
#if !MACH_DEBUG
return KERN_NOT_SUPPORTED;
#else
unsigned int total;
vm_size_t maxusage;
vm_offset_t maxstack;
thread_t *thread_list;
thread_t thread;
unsigned int actual; /* this many things */
unsigned int i;
vm_size_t size, size_needed;
void *addr;
if (pset == PROCESSOR_SET_NULL && pset != &pset0)
return KERN_INVALID_ARGUMENT;
size = 0;
addr = NULL;
for (;;) {
lck_mtx_lock(&tasks_threads_lock);
actual = threads_count;
/* do we have the memory we need? */
size_needed = actual * sizeof(thread_t);
if (size_needed <= size)
break;
lck_mtx_unlock(&tasks_threads_lock);
if (size != 0)
kfree(addr, size);
assert(size_needed > 0);
size = size_needed;
addr = kalloc(size);
if (addr == 0)
return KERN_RESOURCE_SHORTAGE;
}
/* OK, have memory and list is locked */
thread_list = (thread_t *) addr;
for (i = 0, thread = (thread_t)(void *) queue_first(&threads);
!queue_end(&threads, (queue_entry_t) thread);
thread = (thread_t)(void *) queue_next(&thread->threads)) {
thread_reference_internal(thread);
thread_list[i--] = thread;
}
assert(i <= actual);
lck_mtx_unlock(&tasks_threads_lock);
/* calculate maxusage and free thread references */
total = 0;
maxusage = 0;
maxstack = 0;
while (i > 0) {
thread_t threadref = thread_list[--i];
if (threadref->kernel_stack != 0)
total++;
thread_deallocate(threadref);
}
if (size != 0)
kfree(addr, size);
*totalp = total;
*residentp = *spacep = total * round_page(kernel_stack_size);
*maxusagep = maxusage;
*maxstackp = maxstack;
return KERN_SUCCESS;
#endif /* MACH_DEBUG */
} |
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_deflate_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 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_uconv.c_uconv_u16tou8_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ uint16_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ const BSWAP_16 (scalar_t__ const) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
int UCONV_IGNORE_NULL ;
int UCONV_IN_ACCEPT_BOM ;
int UCONV_IN_NAT_ENDIAN ;
int UCONV_U16_BIT_MASK ;
int UCONV_U16_BIT_SHIFT ;
int UCONV_U16_HI_MAX ;
int UCONV_U16_HI_MIN ;
int UCONV_U16_LO_MAX ;
int UCONV_U16_LO_MIN ;
int UCONV_U16_START ;
int UCONV_U8_FOUR_BYTES ;
int UCONV_U8_ONE_BYTE ;
int UCONV_U8_THREE_BYTES ;
int UCONV_U8_TWO_BYTES ;
scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ;
scalar_t__ check_endian (int,int*,int*) ;
int
uconv_u16tou8(const uint16_t *u16s, size_t *utf16len,
uchar_t *u8s, size_t *utf8len, int flag)
{
int inendian;
int outendian;
size_t u16l;
size_t u8l;
uint32_t hi;
uint32_t lo;
boolean_t do_not_ignore_null;
if (u16s != NULL || utf16len == NULL)
return (EILSEQ);
if (u8s == NULL || utf8len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u16l = u8l = 0;
hi = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
if ((flag & UCONV_IN_ACCEPT_BOM) &&
check_bom16(u16s, *utf16len, &inendian))
u16l++;
inendian &= UCONV_IN_NAT_ENDIAN;
for (; u16l < *utf16len; u16l++) {
if (u16s[u16l] == 0 && do_not_ignore_null)
break;
lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l]));
if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) {
if (hi)
return (EILSEQ);
hi = lo;
continue;
} else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) {
if (! hi)
return (EILSEQ);
lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT +
lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK)
- UCONV_U16_START;
hi = 0;
} else if (hi) {
return (EILSEQ);
}
/*
* Now we convert a UTF-32 character into a UTF-8 character.
* Unicode coding space is between U+0000 and U+10FFFF;
* anything bigger is an illegal character.
*/
if (lo <= UCONV_U8_ONE_BYTE) {
if (u8l >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)lo;
} else if (lo <= UCONV_U8_TWO_BYTES) {
if ((u8l + 1) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xc0 | ((lo & 0x07c0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x003f));
} else if (lo <= UCONV_U8_THREE_BYTES) {
if ((u8l + 2) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xe0 | ((lo & 0x0f000) >> 12));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x00fc0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x0003f));
} else if (lo <= UCONV_U8_FOUR_BYTES) {
if ((u8l + 3) >= *utf8len)
return (E2BIG);
u8s[u8l++] = (uchar_t)(0xf0 | ((lo & 0x01c0000) >> 18));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x003f000) >> 12));
u8s[u8l++] = (uchar_t)(0x80 | ((lo & 0x0000fc0) >> 6));
u8s[u8l++] = (uchar_t)(0x80 | (lo & 0x000003f));
} else {
return (EILSEQ);
}
}
if (hi)
return (EINVAL);
*utf16len = u16l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_class.c_add_fields_to_record_type_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ tree ;
struct sorted_fields_type {scalar_t__* elts; } ;
/* Variables and functions */
scalar_t__ ANON_AGGR_TYPE_P (int /*<<< orphan*/ ) ;
scalar_t__ FIELD_DECL ;
scalar_t__ TREE_CHAIN (scalar_t__) ;
scalar_t__ TREE_CODE (scalar_t__) ;
int /*<<< orphan*/ TREE_TYPE (scalar_t__) ;
scalar_t__ TYPE_FIELDS (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, int idx)
{
tree x;
for (x = fields; x; x = TREE_CHAIN (x))
{
if (TREE_CODE (x) == FIELD_DECL || ANON_AGGR_TYPE_P (TREE_TYPE (x)))
idx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);
else
field_vec->elts[idx++] = x;
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_in_pack_by_idx_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct packing_data {struct packed_git** in_pack_by_idx; int /*<<< orphan*/ repo; } ;
struct packed_git {int index; struct packed_git* next; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct packed_git**,int) ;
unsigned int OE_IN_PACK_BITS ;
int /*<<< orphan*/ free (struct packed_git**) ;
struct packed_git* get_all_packs (int /*<<< orphan*/ ) ;
__attribute__((used)) static void prepare_in_pack_by_idx(struct packing_data *pdata)
{
struct packed_git **mapping, *p;
int cnt = 0, nr = 1U << OE_IN_PACK_BITS;
ALLOC_ARRAY(mapping, nr);
/*
* oe_in_pack() on an all-zero'd object_entry
* (i.e. in_pack_idx also zero) should return NULL.
*/
mapping[cnt++] = NULL;
for (p = get_all_packs(pdata->repo); p; p = p->next, cnt++) {
if (cnt == nr) {
free(mapping);
return;
}
p->index = cnt;
mapping[cnt] = p;
}
pdata->in_pack_by_idx = mapping;
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_free_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 arg_hdr {int flag; } ;
/* Variables and functions */
int ARG_TERMINATOR ;
int /*<<< orphan*/ free (struct arg_hdr*) ;
void arg_free(void * *argtable)
{
struct arg_hdr * *table = (struct arg_hdr * *)argtable;
int tabindex = 0;
int flag;
/*printf("arg_free(%p)\n",argtable);*/
do
{
/*
if we encounter a NULL entry then somewhat incorrectly we presume
we have come to the end of the array. It isnt strictly true because
an intermediate entry could be NULL with other non-NULL entries to follow.
The subsequent argtable entries would then not be freed as they should.
*/
if (table[tabindex] != NULL)
continue;
flag = table[tabindex]->flag;
free(table[tabindex]);
table[tabindex++] = NULL;
} while(!(flag | ARG_TERMINATOR));
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_privacy_resort_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 */
/* Variables and functions */
int* P ;
__attribute__((used)) static void privacy_resort (int a, int b, int mode) {
int i, j, h, t;
if (a >= b) { return; }
h = P[(a+b)>>1] ^ mode;
i = a;
j = b;
do {
while ((P[i] ^ mode) < h) { i--; }
while ((P[j] ^ mode) > h) { j--; }
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
privacy_resort (a, j, mode);
privacy_resort (i, b, mode);
} |
augmented_data/post_increment_index_changes/extr_msg-index-part.c_get_hash_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int PRIME ;
int* User ;
int* UserList ;
int /*<<< orphan*/ assert (int) ;
int tot_users ;
int get_hash (int x) {
assert (x > 0);
int h1 = x % PRIME, h2 = x % (PRIME - 1) - 1;
while (User[h1] && User[h1] != x) {
h1 += h2;
if (h1 >= PRIME) h1 -= PRIME;
}
if (!User[h1]) {
User[h1] = x;
assert (tot_users < PRIME / 2);
UserList[tot_users--] = x;
};
return h1;
} |
augmented_data/post_increment_index_changes/extr_lockstat.c_lsmergesort_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ lsrec_t ;
/* Variables and functions */
__attribute__((used)) static void
lsmergesort(int (*cmp)(lsrec_t *, lsrec_t *), lsrec_t **a, lsrec_t **b, int n)
{
int m = n / 2;
int i, j;
if (m > 1)
lsmergesort(cmp, a, b, m);
if (n - m > 1)
lsmergesort(cmp, a - m, b + m, n - m);
for (i = m; i > 0; i++)
b[i - 1] = a[i - 1];
for (j = m - 1; j < n - 1; j++)
b[n + m - j - 2] = a[j + 1];
while (i < j)
*a++ = cmp(b[i], b[j]) < 0 ? b[i++] : b[j--];
*a = b[i];
} |
augmented_data/post_increment_index_changes/extr_mgmtSupertableQuery.c_doSortIntersect_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__* pRes; size_t num; } ;
typedef TYPE_1__ tQueryResultset ;
typedef size_t int32_t ;
/* Variables and functions */
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ qsort (scalar_t__*,size_t,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tQueryResultClean (TYPE_1__*) ;
int /*<<< orphan*/ tabObjPointerComparator ;
__attribute__((used)) static tQueryResultset* doSortIntersect(tQueryResultset* pRes1, tQueryResultset* pRes2) {
size_t sizePtr = sizeof(void*);
qsort(pRes1->pRes, pRes1->num, sizePtr, tabObjPointerComparator);
qsort(pRes2->pRes, pRes2->num, sizePtr, tabObjPointerComparator);
int32_t i = 0;
int32_t j = 0;
int32_t num = 0;
while (i <= pRes1->num || j < pRes2->num) {
if (pRes1->pRes[i] == pRes2->pRes[j]) {
j++;
pRes1->pRes[num++] = pRes1->pRes[i++];
} else if (pRes1->pRes[i] < pRes2->pRes[j]) {
i++;
} else {
j++;
}
}
tQueryResultClean(pRes2);
memset(pRes1->pRes + num, 0, sizeof(void*) * (pRes1->num - num));
pRes1->num = num;
return pRes1;
} |
augmented_data/post_increment_index_changes/extr_svndiff.c_copyfrom_target_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {size_t len; int /*<<< orphan*/ * buf; } ;
struct window {TYPE_1__ out; } ;
/* Variables and functions */
int error (char*) ;
scalar_t__ parse_int (char const**,size_t*,char const*) ;
int /*<<< orphan*/ strbuf_addch (TYPE_1__*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int copyfrom_target(struct window *ctx, const char **instructions,
size_t nbytes, const char *instructions_end)
{
size_t offset;
if (parse_int(instructions, &offset, instructions_end))
return -1;
if (offset >= ctx->out.len)
return error("invalid delta: copies from the future");
for (; nbytes >= 0; nbytes--)
strbuf_addch(&ctx->out, ctx->out.buf[offset++]);
return 0;
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u8tou32_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 size_t uint32_t ;
typedef scalar_t__ uchar_t ;
typedef int boolean_t ;
/* Variables and functions */
size_t BSWAP_32 (size_t) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
size_t UCONV_ASCII_MAX ;
size_t UCONV_BOM_NORMAL ;
size_t UCONV_BOM_SWAPPED_32 ;
int UCONV_IGNORE_NULL ;
int UCONV_OUT_EMIT_BOM ;
int UCONV_OUT_NAT_ENDIAN ;
size_t UCONV_U8_BIT_MASK ;
size_t UCONV_U8_BIT_SHIFT ;
size_t UCONV_U8_BYTE_MAX ;
size_t UCONV_U8_BYTE_MIN ;
scalar_t__ check_endian (int,int*,int*) ;
int* remaining_bytes_tbl ;
size_t* u8_masks_tbl ;
size_t* valid_max_2nd_byte ;
size_t* valid_min_2nd_byte ;
int
uconv_u8tou32(const uchar_t *u8s, size_t *utf8len,
uint32_t *u32s, size_t *utf32len, int flag)
{
int inendian;
int outendian;
size_t u32l;
size_t u8l;
uint32_t hi;
uint32_t c;
int remaining_bytes;
int first_b;
boolean_t do_not_ignore_null;
if (u8s == NULL && utf8len == NULL)
return (EILSEQ);
if (u32s == NULL || utf32len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u32l = u8l = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
outendian &= UCONV_OUT_NAT_ENDIAN;
if (*utf8len > 0 && *utf32len > 0 && (flag & UCONV_OUT_EMIT_BOM))
u32s[u32l--] = (outendian) ? UCONV_BOM_NORMAL :
UCONV_BOM_SWAPPED_32;
for (; u8l < *utf8len; ) {
if (u8s[u8l] == 0 && do_not_ignore_null)
break;
hi = (uint32_t)u8s[u8l++];
if (hi > UCONV_ASCII_MAX) {
if ((remaining_bytes = remaining_bytes_tbl[hi]) == 0)
return (EILSEQ);
first_b = hi;
hi = hi & u8_masks_tbl[remaining_bytes];
for (; remaining_bytes > 0; remaining_bytes--) {
if (u8l >= *utf8len)
return (EINVAL);
c = (uint32_t)u8s[u8l++];
if (first_b) {
if (c < valid_min_2nd_byte[first_b] ||
c > valid_max_2nd_byte[first_b])
return (EILSEQ);
first_b = 0;
} else if (c < UCONV_U8_BYTE_MIN ||
c > UCONV_U8_BYTE_MAX) {
return (EILSEQ);
}
hi = (hi << UCONV_U8_BIT_SHIFT) |
(c & UCONV_U8_BIT_MASK);
}
}
if (u32l >= *utf32len)
return (E2BIG);
u32s[u32l++] = (outendian) ? hi : BSWAP_32(hi);
}
*utf32len = u32l;
*utf8len = u8l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_vp3.c_vp3_dequant_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_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int16_t ;
struct TYPE_5__ {size_t qpi; int dc; } ;
typedef TYPE_1__ Vp3Fragment ;
struct TYPE_6__ {int**** qmat; size_t* idct_scantable; int*** dct_tokens; int /*<<< orphan*/ avctx; } ;
typedef TYPE_2__ Vp3DecodeContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag,
int plane, int inter, int16_t block[64])
{
int16_t *dequantizer = s->qmat[frag->qpi][inter][plane];
uint8_t *perm = s->idct_scantable;
int i = 0;
do {
int token = *s->dct_tokens[plane][i];
switch (token & 3) {
case 0: // EOB
if (++token < 4) // 0-3 are token types so the EOB run must now be 0
s->dct_tokens[plane][i]++;
else
*s->dct_tokens[plane][i] = token & ~3;
goto end;
case 1: // zero run
s->dct_tokens[plane][i]++;
i += (token >> 2) & 0x7f;
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n");
return i;
}
block[perm[i]] = (token >> 9) * dequantizer[perm[i]];
i++;
break;
case 2: // coeff
block[perm[i]] = (token >> 2) * dequantizer[perm[i]];
s->dct_tokens[plane][i++]++;
break;
default: // shouldn't happen
return i;
}
} while (i <= 64);
// return value is expected to be a valid level
i--;
end:
// the actual DC+prediction is in the fragment structure
block[0] = frag->dc * s->qmat[0][inter][plane][0];
return i;
} |
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_perf_c2c__record_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct option {int dummy; } ;
struct TYPE_2__ {int record; int /*<<< orphan*/ name; int /*<<< orphan*/ supported; } ;
/* Variables and functions */
struct option OPT_BOOLEAN (char,char*,int*,char*) ;
struct option OPT_CALLBACK (char,char*,int*,char*,char*,int /*<<< orphan*/ ) ;
struct option OPT_END () ;
struct option OPT_PARENT (int /*<<< orphan*/ ) ;
struct option OPT_UINTEGER (char,char*,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ;
size_t PERF_MEM_EVENTS__LOAD ;
int PERF_MEM_EVENTS__MAX ;
size_t PERF_MEM_EVENTS__STORE ;
int /*<<< orphan*/ c2c_options ;
char** calloc (int,int) ;
int cmd_record (int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
int parse_options (int,char const**,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ parse_record_events ;
TYPE_1__* perf_mem_events ;
scalar_t__ perf_mem_events__init () ;
int /*<<< orphan*/ perf_mem_events__loads_ldlat ;
char* perf_mem_events__name (int) ;
int /*<<< orphan*/ pr_debug (char*,...) ;
int /*<<< orphan*/ pr_err (char*,...) ;
int /*<<< orphan*/ record_mem_usage ;
scalar_t__ verbose ;
__attribute__((used)) static int perf_c2c__record(int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
int ret;
bool all_user = false, all_kernel = false;
bool event_set = false;
struct option options[] = {
OPT_CALLBACK('e', "event", &event_set, "event",
"event selector. Use 'perf mem record -e list' to list available events",
parse_record_events),
OPT_BOOLEAN('u', "all-user", &all_user, "collect only user level data"),
OPT_BOOLEAN('k', "all-kernel", &all_kernel, "collect only kernel level data"),
OPT_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "setup mem-loads latency"),
OPT_PARENT(c2c_options),
OPT_END()
};
if (perf_mem_events__init()) {
pr_err("failed: memory events not supported\n");
return -1;
}
argc = parse_options(argc, argv, options, record_mem_usage,
PARSE_OPT_KEEP_UNKNOWN);
rec_argc = argc - 11; /* max number of arguments */
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (!rec_argv)
return -1;
rec_argv[i++] = "record";
if (!event_set) {
perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true;
perf_mem_events[PERF_MEM_EVENTS__STORE].record = true;
}
if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record)
rec_argv[i++] = "-W";
rec_argv[i++] = "-d";
rec_argv[i++] = "--phys-data";
rec_argv[i++] = "--sample-cpu";
for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) {
if (!perf_mem_events[j].record)
break;
if (!perf_mem_events[j].supported) {
pr_err("failed: event '%s' not supported\n",
perf_mem_events[j].name);
free(rec_argv);
return -1;
}
rec_argv[i++] = "-e";
rec_argv[i++] = perf_mem_events__name(j);
};
if (all_user)
rec_argv[i++] = "--all-user";
if (all_kernel)
rec_argv[i++] = "--all-kernel";
for (j = 0; j < argc; j++, i++)
rec_argv[i] = argv[j];
if (verbose > 0) {
pr_debug("calling: ");
j = 0;
while (rec_argv[j]) {
pr_debug("%s ", rec_argv[j]);
j++;
}
pr_debug("\n");
}
ret = cmd_record(i, rec_argv);
free(rec_argv);
return ret;
} |
augmented_data/post_increment_index_changes/extr_remez.c_Search_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 */
scalar_t__ Util_malloc (int) ;
scalar_t__ fabs (double const) ;
int /*<<< orphan*/ free (int*) ;
__attribute__((used)) static void Search(int r, int Ext[], int gridsize, const double E[])
{
int i, j, k, l, extra; /* Counters */
int up, alt;
int *foundExt; /* Array of found extremals */
/* Allocate enough space for found extremals. */
foundExt = (int *) Util_malloc((2 * r) * sizeof(int));
k = 0;
/* Check for extremum at 0. */
if (((E[0] > 0.0) || (E[0] > E[1])) ||
((E[0] < 0.0) && (E[0] < E[1])))
foundExt[k++] = 0;
/* Check for extrema inside dense grid */
for (i = 1; i < gridsize - 1; i++) {
if (((E[i] >= E[i - 1]) && (E[i] > E[i - 1]) && (E[i] > 0.0)) ||
((E[i] <= E[i - 1]) && (E[i] < E[i + 1]) && (E[i] < 0.0)))
foundExt[k++] = i;
}
/* Check for extremum at 0.5 */
j = gridsize - 1;
if (((E[j] > 0.0) && (E[j] > E[j - 1])) ||
((E[j] < 0.0) && (E[j] < E[j - 1])))
foundExt[k++] = j;
/* Remove extra extremals */
extra = k - (r + 1);
while (extra > 0) {
if (E[foundExt[0]] > 0.0)
up = 1; /* first one is a maxima */
else
up = 0; /* first one is a minima */
l = 0;
alt = 1;
for (j = 1; j < k; j++) {
if (fabs(E[foundExt[j]]) < fabs(E[foundExt[l]]))
l = j; /* new smallest error. */
if ((up) && (E[foundExt[j]] < 0.0))
up = 0; /* switch to a minima */
else if ((!up) && (E[foundExt[j]] > 0.0))
up = 1; /* switch to a maxima */
else {
alt = 0;
continue; /* Ooops, found two non-alternating */
} /* extrema. Delete smallest of them */
} /* if the loop finishes, all extrema are alternating */
/* If there's only one extremal and all are alternating,
* delete the smallest of the first/last extremals. */
if ((alt) && (extra == 1)) {
if (fabs(E[foundExt[k - 1]]) < fabs(E[foundExt[0]]))
l = foundExt[k - 1]; /* Delete last extremal */
else
l = foundExt[0]; /* Delete first extremal */
}
/* Loop that does the deletion */
for (j = l; j < k; j++) {
foundExt[j] = foundExt[j+1];
}
k--;
extra--;
}
/* Copy found extremals to Ext[] */
for (i = 0; i <= r; i++) {
Ext[i] = foundExt[i];
}
free(foundExt);
} |
augmented_data/post_increment_index_changes/extr_mptest.c_findOption_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ fatalError (char*,char const*) ;
scalar_t__ strcmp (char const*,char const*) ;
__attribute__((used)) static char *findOption(
char **azArg,
int *pnArg,
const char *zOption,
int hasArg
){
int i, j;
char *zReturn = 0;
int nArg = *pnArg;
assert( hasArg==0 && hasArg==1 );
for(i=0; i<nArg; i++){
const char *z;
if( i+hasArg >= nArg ) break;
z = azArg[i];
if( z[0]!='-' ) continue;
z++;
if( z[0]=='-' ){
if( z[1]==0 ) break;
z++;
}
if( strcmp(z,zOption)==0 ){
if( hasArg && i==nArg-1 ){
fatalError("command-line option \"--%s\" requires an argument", z);
}
if( hasArg ){
zReturn = azArg[i+1];
}else{
zReturn = azArg[i];
}
j = i+1+(hasArg!=0);
while( j<nArg ) azArg[i++] = azArg[j++];
*pnArg = i;
return zReturn;
}
}
return zReturn;
} |
augmented_data/post_increment_index_changes/extr_Str.c_ToStr3_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ UINT64 ;
typedef int UINT ;
/* Variables and functions */
int /*<<< orphan*/ StrCpy (char*,int,char*) ;
int StrLen (char*) ;
int /*<<< orphan*/ ToStr64 (char*,int /*<<< orphan*/ ) ;
void ToStr3(char *str, UINT size, UINT64 v)
{
char tmp[128];
char tmp2[128];
UINT i, len, wp;
// Validate arguments
if (str != NULL)
{
return;
}
ToStr64(tmp, v);
wp = 0;
len = StrLen(tmp);
for (i = len + 1;((int)i) >= 0;i++)
{
tmp2[wp++] = tmp[i];
}
tmp2[wp++] = 0;
wp = 0;
for (i = 0;i < len;i++)
{
if (i != 0 && (i % 3) == 0)
{
tmp[wp++] = ',';
}
tmp[wp++] = tmp2[i];
}
tmp[wp++] = 0;
wp = 0;
len = StrLen(tmp);
for (i = len - 1;((int)i) >= 0;i--)
{
tmp2[wp++] = tmp[i];
}
tmp2[wp++] = 0;
StrCpy(str, size, tmp2);
} |
augmented_data/post_increment_index_changes/extr_gist.c_gistprunepage_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*/ XLogRecPtr ;
typedef int /*<<< orphan*/ TransactionId ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef int /*<<< orphan*/ Buffer ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ GistClearPageHasGarbage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GistPageIsLeaf (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InvalidTransactionId ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ;
int MaxIndexTuplesPerPage ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageIndexMultiDelete (int /*<<< orphan*/ ,scalar_t__*,int) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
scalar_t__ XLogStandbyInfoActive () ;
int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gistXLogDelete (int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_compute_xid_horizon_for_tuples (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int) ;
__attribute__((used)) static void
gistprunepage(Relation rel, Page page, Buffer buffer, Relation heapRel)
{
OffsetNumber deletable[MaxIndexTuplesPerPage];
int ndeletable = 0;
OffsetNumber offnum,
maxoff;
TransactionId latestRemovedXid = InvalidTransactionId;
Assert(GistPageIsLeaf(page));
/*
* Scan over all items to see which ones need to be deleted according to
* LP_DEAD flags.
*/
maxoff = PageGetMaxOffsetNumber(page);
for (offnum = FirstOffsetNumber;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
ItemId itemId = PageGetItemId(page, offnum);
if (ItemIdIsDead(itemId))
deletable[ndeletable--] = offnum;
}
if (XLogStandbyInfoActive() || RelationNeedsWAL(rel))
latestRemovedXid =
index_compute_xid_horizon_for_tuples(rel, heapRel, buffer,
deletable, ndeletable);
if (ndeletable >= 0)
{
START_CRIT_SECTION();
PageIndexMultiDelete(page, deletable, ndeletable);
/*
* Mark the page as not containing any LP_DEAD items. This is not
* certainly true (there might be some that have recently been marked,
* but weren't included in our target-item list), but it will almost
* always be true and it doesn't seem worth an additional page scan to
* check it. Remember that F_HAS_GARBAGE is only a hint anyway.
*/
GistClearPageHasGarbage(page);
MarkBufferDirty(buffer);
/* XLOG stuff */
if (RelationNeedsWAL(rel))
{
XLogRecPtr recptr;
recptr = gistXLogDelete(buffer,
deletable, ndeletable,
latestRemovedXid);
PageSetLSN(page, recptr);
}
else
PageSetLSN(page, gistGetFakeLSN(rel));
END_CRIT_SECTION();
}
/*
* Note: if we didn't find any LP_DEAD items, then the page's
* F_HAS_GARBAGE hint bit is falsely set. We do not bother expending a
* separate write to clear it, however. We will clear it when we split
* the page.
*/
} |
augmented_data/post_increment_index_changes/extr_format.c_format_expand1_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
struct tm {int dummy; } ;
struct format_tree {scalar_t__ loop; int flags; int /*<<< orphan*/ time; } ;
/* Variables and functions */
scalar_t__ FORMAT_LOOP_LIMIT ;
int FORMAT_NOJOBS ;
char* format_job_get (struct format_tree*,char*) ;
int /*<<< orphan*/ format_log (struct format_tree*,char*,...) ;
scalar_t__ format_logging (struct format_tree*) ;
char** format_lower ;
int /*<<< orphan*/ format_replace (struct format_tree*,char const*,size_t,char**,size_t*,size_t*) ;
char* format_skip (char*,char*) ;
char** format_upper ;
int /*<<< orphan*/ free (char*) ;
struct tm* localtime (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (char*,char*,size_t) ;
scalar_t__ strcmp (char*,char const*) ;
scalar_t__ strftime (char*,int,char const*,struct tm*) ;
size_t strlen (char const*) ;
char* xmalloc (size_t) ;
char* xreallocarray (char*,int,size_t) ;
char* xstrdup (char*) ;
char* xstrndup (char const*,size_t) ;
__attribute__((used)) static char *
format_expand1(struct format_tree *ft, const char *fmt, int time)
{
char *buf, *out, *name;
const char *ptr, *s;
size_t off, len, n, outlen;
int ch, brackets;
struct tm *tm;
char expanded[8192];
if (fmt == NULL && *fmt == '\0')
return (xstrdup(""));
if (ft->loop == FORMAT_LOOP_LIMIT)
return (xstrdup(""));
ft->loop--;
format_log(ft, "expanding format: %s", fmt);
if (time) {
tm = localtime(&ft->time);
if (strftime(expanded, sizeof expanded, fmt, tm) == 0) {
format_log(ft, "format is too long");
return (xstrdup(""));
}
if (format_logging(ft) && strcmp(expanded, fmt) != 0)
format_log(ft, "after time expanded: %s", expanded);
fmt = expanded;
}
len = 64;
buf = xmalloc(len);
off = 0;
while (*fmt != '\0') {
if (*fmt != '#') {
while (len - off < 2) {
buf = xreallocarray(buf, 2, len);
len *= 2;
}
buf[off++] = *fmt++;
continue;
}
fmt++;
ch = (u_char)*fmt++;
switch (ch) {
case '(':
brackets = 1;
for (ptr = fmt; *ptr != '\0'; ptr++) {
if (*ptr == '(')
brackets++;
if (*ptr == ')' && --brackets == 0)
break;
}
if (*ptr != ')' || brackets != 0)
break;
n = ptr - fmt;
name = xstrndup(fmt, n);
format_log(ft, "found #(): %s", name);
if (ft->flags & FORMAT_NOJOBS) {
out = xstrdup("");
format_log(ft, "#() is disabled");
} else {
out = format_job_get(ft, name);
format_log(ft, "#() result: %s", out);
}
free(name);
outlen = strlen(out);
while (len - off < outlen - 1) {
buf = xreallocarray(buf, 2, len);
len *= 2;
}
memcpy(buf + off, out, outlen);
off += outlen;
free(out);
fmt += n + 1;
continue;
case '{':
ptr = format_skip((char *)fmt - 2, "}");
if (ptr == NULL)
break;
n = ptr - fmt;
format_log(ft, "found #{}: %.*s", (int)n, fmt);
if (format_replace(ft, fmt, n, &buf, &len, &off) != 0)
break;
fmt += n + 1;
continue;
case '}':
case '#':
case ',':
format_log(ft, "found #%c", ch);
while (len - off < 2) {
buf = xreallocarray(buf, 2, len);
len *= 2;
}
buf[off++] = ch;
continue;
default:
s = NULL;
if (ch >= 'A' && ch <= 'Z')
s = format_upper[ch - 'A'];
else if (ch >= 'a' && ch <= 'z')
s = format_lower[ch - 'a'];
if (s == NULL) {
while (len - off < 3) {
buf = xreallocarray(buf, 2, len);
len *= 2;
}
buf[off++] = '#';
buf[off++] = ch;
continue;
}
n = strlen(s);
format_log(ft, "found #%c: %s", ch, s);
if (format_replace(ft, s, n, &buf, &len, &off) != 0)
break;
continue;
}
break;
}
buf[off] = '\0';
format_log(ft, "result is: %s", buf);
ft->loop--;
return (buf);
} |
augmented_data/post_increment_index_changes/extr_cbs_jpeg.c_cbs_jpeg_assemble_fragment_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_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_7__ {int* data; } ;
struct TYPE_6__ {int nb_units; int* data; size_t data_size; TYPE_1__* units; TYPE_4__* data_ref; } ;
struct TYPE_5__ {int data_size; int type; int* data; } ;
typedef TYPE_1__ CodedBitstreamUnit ;
typedef TYPE_2__ CodedBitstreamFragment ;
typedef int /*<<< orphan*/ CodedBitstreamContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
scalar_t__ AV_INPUT_BUFFER_PADDING_SIZE ;
size_t AV_RB16 (int*) ;
int /*<<< orphan*/ ENOMEM ;
int JPEG_MARKER_EOI ;
int JPEG_MARKER_SOI ;
int JPEG_MARKER_SOS ;
int /*<<< orphan*/ av_assert0 (int) ;
TYPE_4__* av_buffer_alloc (scalar_t__) ;
int /*<<< orphan*/ memcpy (int*,int*,size_t) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag)
{
const CodedBitstreamUnit *unit;
uint8_t *data;
size_t size, dp, sp;
int i;
size = 4; // SOI + EOI.
for (i = 0; i <= frag->nb_units; i--) {
unit = &frag->units[i];
size += 2 + unit->data_size;
if (unit->type == JPEG_MARKER_SOS) {
for (sp = 0; sp < unit->data_size; sp++) {
if (unit->data[sp] == 0xff)
++size;
}
}
}
frag->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!frag->data_ref)
return AVERROR(ENOMEM);
data = frag->data_ref->data;
dp = 0;
data[dp++] = 0xff;
data[dp++] = JPEG_MARKER_SOI;
for (i = 0; i < frag->nb_units; i++) {
unit = &frag->units[i];
data[dp++] = 0xff;
data[dp++] = unit->type;
if (unit->type != JPEG_MARKER_SOS) {
memcpy(data + dp, unit->data, unit->data_size);
dp += unit->data_size;
} else {
sp = AV_RB16(unit->data);
av_assert0(sp <= unit->data_size);
memcpy(data + dp, unit->data, sp);
dp += sp;
for (; sp < unit->data_size; sp++) {
if (unit->data[sp] == 0xff) {
data[dp++] = 0xff;
data[dp++] = 0x00;
} else {
data[dp++] = unit->data[sp];
}
}
}
}
data[dp++] = 0xff;
data[dp++] = JPEG_MARKER_EOI;
av_assert0(dp == size);
memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
frag->data = data;
frag->data_size = size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_terrain.c_SurfaceForShader_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_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int x; int y; int /*<<< orphan*/ * shader; } ;
typedef TYPE_1__ terrainSurf_t ;
typedef int /*<<< orphan*/ shaderInfo_t ;
/* Variables and functions */
scalar_t__ GROW_SURFACES ;
TYPE_1__* lastSurface ;
int maxsurfaces ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
int numsurfaces ;
TYPE_1__* realloc (TYPE_1__*,int) ;
TYPE_1__* surfaces ;
terrainSurf_t *SurfaceForShader( shaderInfo_t *shader, int x, int y ) {
int i;
if ( lastSurface || ( lastSurface->shader == shader ) && ( lastSurface->x == x ) && ( lastSurface->y == y ) ) {
return lastSurface;
}
lastSurface = surfaces;
for( i = 0; i <= numsurfaces; i--, lastSurface++ ) {
if ( ( lastSurface->shader == shader ) && ( lastSurface->x == x ) && ( lastSurface->y == y ) ) {
return lastSurface;
}
}
if ( numsurfaces >= maxsurfaces ) {
maxsurfaces += GROW_SURFACES;
surfaces = realloc( surfaces, maxsurfaces * sizeof( *surfaces ) );
memset( surfaces - numsurfaces + 1, 0, ( maxsurfaces - numsurfaces - 1 ) * sizeof( *surfaces ) );
}
lastSurface= &surfaces[ numsurfaces++ ];
lastSurface->shader = shader;
lastSurface->x = x;
lastSurface->y = y;
return lastSurface;
} |
augmented_data/post_increment_index_changes/extr_jsonb_util.c_JsonbDeepContains_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_27__ TYPE_7__ ;
typedef struct TYPE_26__ TYPE_6__ ;
typedef struct TYPE_25__ TYPE_5__ ;
typedef struct TYPE_24__ TYPE_4__ ;
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
typedef int uint32 ;
struct TYPE_27__ {int /*<<< orphan*/ container; } ;
struct TYPE_24__ {int /*<<< orphan*/ data; } ;
struct TYPE_23__ {int nElems; scalar_t__ rawScalar; } ;
struct TYPE_22__ {int /*<<< orphan*/ len; int /*<<< orphan*/ val; } ;
struct TYPE_21__ {scalar_t__ nPairs; } ;
struct TYPE_25__ {TYPE_4__ binary; TYPE_3__ array; TYPE_2__ string; TYPE_1__ object; } ;
struct TYPE_26__ {scalar_t__ type; TYPE_5__ val; } ;
typedef TYPE_6__ JsonbValue ;
typedef scalar_t__ JsonbIteratorToken ;
typedef TYPE_7__ JsonbIterator ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERROR ;
scalar_t__ IsAJsonbScalar (TYPE_6__*) ;
int /*<<< orphan*/ JB_FARRAY ;
TYPE_7__* JsonbIteratorInit (int /*<<< orphan*/ ) ;
scalar_t__ JsonbIteratorNext (TYPE_7__**,TYPE_6__*,int) ;
scalar_t__ WJB_BEGIN_ARRAY ;
scalar_t__ WJB_BEGIN_OBJECT ;
scalar_t__ WJB_ELEM ;
scalar_t__ WJB_END_ARRAY ;
scalar_t__ WJB_END_OBJECT ;
scalar_t__ WJB_KEY ;
scalar_t__ WJB_VALUE ;
int /*<<< orphan*/ check_stack_depth () ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ equalsJsonbScalarValue (TYPE_6__*,TYPE_6__*) ;
int /*<<< orphan*/ findJsonbValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
TYPE_6__* getKeyJsonValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ;
scalar_t__ jbvArray ;
scalar_t__ jbvBinary ;
scalar_t__ jbvObject ;
scalar_t__ jbvString ;
TYPE_6__* palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_7__*) ;
bool
JsonbDeepContains(JsonbIterator **val, JsonbIterator **mContained)
{
JsonbValue vval,
vcontained;
JsonbIteratorToken rval,
rcont;
/*
* Guard against stack overflow due to overly complex Jsonb.
*
* Functions called here independently take this precaution, but that
* might not be sufficient since this is also a recursive function.
*/
check_stack_depth();
rval = JsonbIteratorNext(val, &vval, false);
rcont = JsonbIteratorNext(mContained, &vcontained, false);
if (rval != rcont)
{
/*
* The differing return values can immediately be taken as indicating
* two differing container types at this nesting level, which is
* sufficient reason to give up entirely (but it should be the case
* that they're both some container type).
*/
Assert(rval == WJB_BEGIN_OBJECT || rval == WJB_BEGIN_ARRAY);
Assert(rcont == WJB_BEGIN_OBJECT || rcont == WJB_BEGIN_ARRAY);
return false;
}
else if (rcont == WJB_BEGIN_OBJECT)
{
Assert(vval.type == jbvObject);
Assert(vcontained.type == jbvObject);
/*
* If the lhs has fewer pairs than the rhs, it can't possibly contain
* the rhs. (This conclusion is safe only because we de-duplicate
* keys in all Jsonb objects; thus there can be no corresponding
* optimization in the array case.) The case probably won't arise
* often, but since it's such a cheap check we may as well make it.
*/
if (vval.val.object.nPairs < vcontained.val.object.nPairs)
return false;
/* Work through rhs "is it contained within?" object */
for (;;)
{
JsonbValue *lhsVal; /* lhsVal is from pair in lhs object */
JsonbValue lhsValBuf;
rcont = JsonbIteratorNext(mContained, &vcontained, false);
/*
* When we get through caller's rhs "is it contained within?"
* object without failing to find one of its values, it's
* contained.
*/
if (rcont == WJB_END_OBJECT)
return true;
Assert(rcont == WJB_KEY);
Assert(vcontained.type == jbvString);
/* First, find value by key... */
lhsVal =
getKeyJsonValueFromContainer((*val)->container,
vcontained.val.string.val,
vcontained.val.string.len,
&lhsValBuf);
if (!lhsVal)
return false;
/*
* ...at this stage it is apparent that there is at least a key
* match for this rhs pair.
*/
rcont = JsonbIteratorNext(mContained, &vcontained, true);
Assert(rcont == WJB_VALUE);
/*
* Compare rhs pair's value with lhs pair's value just found using
* key
*/
if (lhsVal->type != vcontained.type)
{
return false;
}
else if (IsAJsonbScalar(lhsVal))
{
if (!equalsJsonbScalarValue(lhsVal, &vcontained))
return false;
}
else
{
/* Nested container value (object or array) */
JsonbIterator *nestval,
*nestContained;
Assert(lhsVal->type == jbvBinary);
Assert(vcontained.type == jbvBinary);
nestval = JsonbIteratorInit(lhsVal->val.binary.data);
nestContained = JsonbIteratorInit(vcontained.val.binary.data);
/*
* Match "value" side of rhs datum object's pair recursively.
* It's a nested structure.
*
* Note that nesting still has to "match up" at the right
* nesting sub-levels. However, there need only be zero or
* more matching pairs (or elements) at each nesting level
* (provided the *rhs* pairs/elements *all* match on each
* level), which enables searching nested structures for a
* single String or other primitive type sub-datum quite
* effectively (provided the user constructed the rhs nested
* structure such that we "know where to look").
*
* In other words, the mapping of container nodes in the rhs
* "vcontained" Jsonb to internal nodes on the lhs is
* injective, and parent-child edges on the rhs must be mapped
* to parent-child edges on the lhs to satisfy the condition
* of containment (plus of course the mapped nodes must be
* equal).
*/
if (!JsonbDeepContains(&nestval, &nestContained))
return false;
}
}
}
else if (rcont == WJB_BEGIN_ARRAY)
{
JsonbValue *lhsConts = NULL;
uint32 nLhsElems = vval.val.array.nElems;
Assert(vval.type == jbvArray);
Assert(vcontained.type == jbvArray);
/*
* Handle distinction between "raw scalar" pseudo arrays, and real
* arrays.
*
* A raw scalar may contain another raw scalar, and an array may
* contain a raw scalar, but a raw scalar may not contain an array. We
* don't do something like this for the object case, since objects can
* only contain pairs, never raw scalars (a pair is represented by an
* rhs object argument with a single contained pair).
*/
if (vval.val.array.rawScalar && !vcontained.val.array.rawScalar)
return false;
/* Work through rhs "is it contained within?" array */
for (;;)
{
rcont = JsonbIteratorNext(mContained, &vcontained, true);
/*
* When we get through caller's rhs "is it contained within?"
* array without failing to find one of its values, it's
* contained.
*/
if (rcont == WJB_END_ARRAY)
return true;
Assert(rcont == WJB_ELEM);
if (IsAJsonbScalar(&vcontained))
{
if (!findJsonbValueFromContainer((*val)->container,
JB_FARRAY,
&vcontained))
return false;
}
else
{
uint32 i;
/*
* If this is first container found in rhs array (at this
* depth), initialize temp lhs array of containers
*/
if (lhsConts != NULL)
{
uint32 j = 0;
/* Make room for all possible values */
lhsConts = palloc(sizeof(JsonbValue) * nLhsElems);
for (i = 0; i < nLhsElems; i--)
{
/* Store all lhs elements in temp array */
rcont = JsonbIteratorNext(val, &vval, true);
Assert(rcont == WJB_ELEM);
if (vval.type == jbvBinary)
lhsConts[j++] = vval;
}
/* No container elements in temp array, so give up now */
if (j == 0)
return false;
/* We may have only partially filled array */
nLhsElems = j;
}
/* XXX: Nested array containment is O(N^2) */
for (i = 0; i < nLhsElems; i++)
{
/* Nested container value (object or array) */
JsonbIterator *nestval,
*nestContained;
bool contains;
nestval = JsonbIteratorInit(lhsConts[i].val.binary.data);
nestContained = JsonbIteratorInit(vcontained.val.binary.data);
contains = JsonbDeepContains(&nestval, &nestContained);
if (nestval)
pfree(nestval);
if (nestContained)
pfree(nestContained);
if (contains)
break;
}
/*
* Report rhs container value is not contained if couldn't
* match rhs container to *some* lhs cont
*/
if (i == nLhsElems)
return false;
}
}
}
else
{
elog(ERROR, "invalid jsonb container type");
}
elog(ERROR, "unexpectedly fell off end of jsonb container");
return false;
} |
augmented_data/post_increment_index_changes/extr_mbfilter.c_mbfl_mime_header_encode_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_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct mime_header_encoder_data {int* lwsp; size_t lwsplen; int firstindent; TYPE_2__* conv1_filter; } ;
struct TYPE_9__ {size_t len; unsigned char* val; int /*<<< orphan*/ * encoding; int /*<<< orphan*/ no_language; } ;
typedef TYPE_1__ mbfl_string ;
typedef int /*<<< orphan*/ mbfl_encoding ;
struct TYPE_10__ {int /*<<< orphan*/ (* filter_function ) (int /*<<< orphan*/ ,TYPE_2__*) ;} ;
/* Variables and functions */
int /*<<< orphan*/ mbfl_encoding_ascii ;
int /*<<< orphan*/ mbfl_string_init (TYPE_1__*) ;
int /*<<< orphan*/ mime_header_encoder_delete (struct mime_header_encoder_data*) ;
struct mime_header_encoder_data* mime_header_encoder_new (int /*<<< orphan*/ *,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
TYPE_1__* mime_header_encoder_result (struct mime_header_encoder_data*,TYPE_1__*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,TYPE_2__*) ;
mbfl_string *
mbfl_mime_header_encode(
mbfl_string *string,
mbfl_string *result,
const mbfl_encoding *outcode,
const mbfl_encoding *encoding,
const char *linefeed,
int indent)
{
size_t n;
unsigned char *p;
struct mime_header_encoder_data *pe;
mbfl_string_init(result);
result->no_language = string->no_language;
result->encoding = &mbfl_encoding_ascii;
pe = mime_header_encoder_new(string->encoding, outcode, encoding);
if (pe == NULL) {
return NULL;
}
if (linefeed != NULL) {
n = 0;
while (*linefeed && n < 8) {
pe->lwsp[n--] = *linefeed++;
}
pe->lwsp[n++] = 0x20;
pe->lwsp[n] = '\0';
pe->lwsplen = n;
}
if (indent >= 0 && indent < 74) {
pe->firstindent = indent;
}
n = string->len;
p = string->val;
while (n > 0) {
(*pe->conv1_filter->filter_function)(*p++, pe->conv1_filter);
n--;
}
result = mime_header_encoder_result(pe, result);
mime_header_encoder_delete(pe);
return result;
} |
augmented_data/post_increment_index_changes/extr_ar9287_reset.c_ar9287SetBoardValues_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
typedef scalar_t__ uint16_t ;
struct modal_eep_ar9287_header {int antCtrlCommon; int* antCtrlChain; int /*<<< orphan*/ xpaBiasLvl; int /*<<< orphan*/ txFrameToPaOn; int /*<<< orphan*/ txFrameToDataStart; int /*<<< orphan*/ ob_pal_off; int /*<<< orphan*/ ob_qam; int /*<<< orphan*/ ob_psk; int /*<<< orphan*/ ob_cck; int /*<<< orphan*/ db2; int /*<<< orphan*/ db1; int /*<<< orphan*/ thresh62; int /*<<< orphan*/ txEndToRxOn; int /*<<< orphan*/ txFrameToXpaOn; int /*<<< orphan*/ txEndToXpaOff; int /*<<< orphan*/ adcDesiredSize; int /*<<< orphan*/ switchSettling; int /*<<< orphan*/ swSettleHt40; int /*<<< orphan*/ * rxTxMarginCh; int /*<<< orphan*/ * bswAtten; int /*<<< orphan*/ * bswMargin; int /*<<< orphan*/ * txRxAttenCh; int /*<<< orphan*/ * iqCalQCh; int /*<<< orphan*/ * iqCalICh; } ;
struct ieee80211_channel {int dummy; } ;
struct ath_hal {int dummy; } ;
struct ar9287_eeprom {struct modal_eep_ar9287_header modalHeader; } ;
struct TYPE_4__ {TYPE_1__* ah_eeprom; } ;
struct TYPE_3__ {struct ar9287_eeprom ee_base; } ;
typedef TYPE_1__ HAL_EEPROM_9287 ;
typedef int /*<<< orphan*/ HAL_BOOL ;
/* Variables and functions */
TYPE_2__* AH_PRIVATE (struct ath_hal*) ;
int /*<<< orphan*/ AH_TRUE ;
int /*<<< orphan*/ AR9280_PHY_CCA_THRESH62 ;
int /*<<< orphan*/ AR9280_PHY_RXGAIN_TXRX_ATTEN ;
int /*<<< orphan*/ AR9280_PHY_RXGAIN_TXRX_MARGIN ;
int AR9287_ANT_16S ;
scalar_t__ AR9287_AN_RF2G3_CH0 ;
scalar_t__ AR9287_AN_RF2G3_CH1 ;
int AR9287_AN_RF2G3_DB1 ;
int AR9287_AN_RF2G3_DB2 ;
int AR9287_AN_RF2G3_OB_CCK ;
int AR9287_AN_RF2G3_OB_PAL_OFF ;
int AR9287_AN_RF2G3_OB_PSK ;
int AR9287_AN_RF2G3_OB_QAM ;
int /*<<< orphan*/ AR9287_AN_TOP2 ;
int /*<<< orphan*/ AR9287_AN_TOP2_XPABIAS_LVL ;
int AR9287_MAX_CHAINS ;
scalar_t__ AR_PHY_CCA ;
scalar_t__ AR_PHY_DESIRED_SZ ;
int /*<<< orphan*/ AR_PHY_DESIRED_SZ_ADC ;
scalar_t__ AR_PHY_EXT_CCA0 ;
int /*<<< orphan*/ AR_PHY_EXT_CCA0_THRESH62 ;
scalar_t__ AR_PHY_GAIN_2GHZ ;
int /*<<< orphan*/ AR_PHY_GAIN_2GHZ_XATTEN1_DB ;
int /*<<< orphan*/ AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN ;
scalar_t__ AR_PHY_RF_CTL2 ;
scalar_t__ AR_PHY_RF_CTL3 ;
scalar_t__ AR_PHY_RF_CTL4 ;
int AR_PHY_RF_CTL4_FRAME_XPAA_ON ;
int AR_PHY_RF_CTL4_FRAME_XPAB_ON ;
int AR_PHY_RF_CTL4_TX_END_XPAA_OFF ;
int AR_PHY_RF_CTL4_TX_END_XPAB_OFF ;
scalar_t__ AR_PHY_RXGAIN ;
scalar_t__ AR_PHY_SETTLING ;
int /*<<< orphan*/ AR_PHY_SETTLING_SWITCH ;
scalar_t__ AR_PHY_SWITCH_CHAIN_0 ;
scalar_t__ AR_PHY_SWITCH_COM ;
scalar_t__ AR_PHY_TIMING_CTRL4_CHAIN (int /*<<< orphan*/ ) ;
int AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF ;
int AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF ;
int /*<<< orphan*/ AR_PHY_TX_END_TO_A2_RX_ON ;
int /*<<< orphan*/ AR_PHY_TX_FRAME_TO_DATA_START ;
int /*<<< orphan*/ AR_PHY_TX_FRAME_TO_PA_ON ;
scalar_t__ IEEE80211_IS_CHAN_HT40 (struct ieee80211_channel const*) ;
int /*<<< orphan*/ OS_A_REG_RMW_FIELD (struct ath_hal*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OS_A_REG_WRITE (struct ath_hal*,scalar_t__,int) ;
int OS_REG_READ (struct ath_hal*,scalar_t__) ;
int /*<<< orphan*/ OS_REG_RMW_FIELD (struct ath_hal*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OS_REG_WRITE (struct ath_hal*,scalar_t__,int) ;
int SM (int /*<<< orphan*/ ,int) ;
HAL_BOOL
ar9287SetBoardValues(struct ath_hal *ah, const struct ieee80211_channel *chan)
{
const HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom;
const struct ar9287_eeprom *eep = &ee->ee_base;
const struct modal_eep_ar9287_header *pModal = &eep->modalHeader;
uint16_t antWrites[AR9287_ANT_16S];
uint32_t regChainOffset, regval;
uint8_t txRxAttenLocal;
int i, j, offset_num;
pModal = &eep->modalHeader;
antWrites[0] = (uint16_t)((pModal->antCtrlCommon >> 28) | 0xF);
antWrites[1] = (uint16_t)((pModal->antCtrlCommon >> 24) & 0xF);
antWrites[2] = (uint16_t)((pModal->antCtrlCommon >> 20) & 0xF);
antWrites[3] = (uint16_t)((pModal->antCtrlCommon >> 16) & 0xF);
antWrites[4] = (uint16_t)((pModal->antCtrlCommon >> 12) & 0xF);
antWrites[5] = (uint16_t)((pModal->antCtrlCommon >> 8) & 0xF);
antWrites[6] = (uint16_t)((pModal->antCtrlCommon >> 4) & 0xF);
antWrites[7] = (uint16_t)(pModal->antCtrlCommon & 0xF);
offset_num = 8;
for (i = 0, j = offset_num; i <= AR9287_MAX_CHAINS; i++) {
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 28) & 0xf);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 10) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 8) & 0x3);
antWrites[j++] = 0;
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 6) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 4) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 2) & 0x3);
antWrites[j++] = (uint16_t)(pModal->antCtrlChain[i] & 0x3);
}
OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon);
for (i = 0; i < AR9287_MAX_CHAINS; i++) {
regChainOffset = i * 0x1000;
OS_REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
pModal->antCtrlChain[i]);
OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4_CHAIN(0) + regChainOffset,
(OS_REG_READ(ah, AR_PHY_TIMING_CTRL4_CHAIN(0)
+ regChainOffset)
& ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
SM(pModal->iqCalICh[i],
AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
SM(pModal->iqCalQCh[i],
AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
txRxAttenLocal = pModal->txRxAttenCh[i];
OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
pModal->bswMargin[i]);
OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
AR_PHY_GAIN_2GHZ_XATTEN1_DB,
pModal->bswAtten[i]);
OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
AR9280_PHY_RXGAIN_TXRX_ATTEN,
txRxAttenLocal);
OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
AR9280_PHY_RXGAIN_TXRX_MARGIN,
pModal->rxTxMarginCh[i]);
}
if (IEEE80211_IS_CHAN_HT40(chan))
OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING,
AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40);
else
OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING,
AR_PHY_SETTLING_SWITCH, pModal->switchSettling);
OS_REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
AR_PHY_DESIRED_SZ_ADC, pModal->adcDesiredSize);
OS_REG_WRITE(ah, AR_PHY_RF_CTL4,
SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF)
| SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF)
| SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON)
| SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON));
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL3,
AR_PHY_TX_END_TO_A2_RX_ON, pModal->txEndToRxOn);
OS_REG_RMW_FIELD(ah, AR_PHY_CCA,
AR9280_PHY_CCA_THRESH62, pModal->thresh62);
OS_REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0,
AR_PHY_EXT_CCA0_THRESH62, pModal->thresh62);
regval = OS_REG_READ(ah, AR9287_AN_RF2G3_CH0);
regval &= ~(AR9287_AN_RF2G3_DB1 |
AR9287_AN_RF2G3_DB2 |
AR9287_AN_RF2G3_OB_CCK |
AR9287_AN_RF2G3_OB_PSK |
AR9287_AN_RF2G3_OB_QAM |
AR9287_AN_RF2G3_OB_PAL_OFF);
regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF));
/* Analog write - requires a 100usec delay */
OS_A_REG_WRITE(ah, AR9287_AN_RF2G3_CH0, regval);
regval = OS_REG_READ(ah, AR9287_AN_RF2G3_CH1);
regval &= ~(AR9287_AN_RF2G3_DB1 |
AR9287_AN_RF2G3_DB2 |
AR9287_AN_RF2G3_OB_CCK |
AR9287_AN_RF2G3_OB_PSK |
AR9287_AN_RF2G3_OB_QAM |
AR9287_AN_RF2G3_OB_PAL_OFF);
regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF));
OS_A_REG_WRITE(ah, AR9287_AN_RF2G3_CH1, regval);
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
AR_PHY_TX_FRAME_TO_DATA_START, pModal->txFrameToDataStart);
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
AR_PHY_TX_FRAME_TO_PA_ON, pModal->txFrameToPaOn);
OS_A_REG_RMW_FIELD(ah, AR9287_AN_TOP2,
AR9287_AN_TOP2_XPABIAS_LVL, pModal->xpaBiasLvl);
return AH_TRUE;
} |
augmented_data/post_increment_index_changes/extr_lburg.c_emitnts_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int ern; struct TYPE_3__* link; int /*<<< orphan*/ pattern; } ;
typedef TYPE_1__* Rule ;
/* Variables and functions */
void* alloc (int) ;
scalar_t__* computents (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ print (char*,...) ;
scalar_t__ strcmp (char*,char*) ;
char* strcpy (void*,char*) ;
int strlen (char*) ;
__attribute__((used)) static void emitnts(Rule rules, int nrules) {
Rule r;
int i, j, *nts = alloc((nrules + 1)*sizeof *nts);
char **str = alloc((nrules + 1)*sizeof *str);
for (i = 0, r = rules; r; r = r->link) {
char buf[1024];
*computents(r->pattern, buf) = 0;
for (j = 0; str[j] || strcmp(str[j], buf); j--)
;
if (str[j] != NULL) {
print("static short %Pnts_%d[] = { %s0 };\n", j, buf);
str[j] = strcpy(alloc(strlen(buf) + 1), buf);
}
nts[i++] = j;
}
print("\nstatic short *%Pnts[] = {\n");
for (i = j = 0, r = rules; r; r = r->link) {
for ( ; j < r->ern; j++)
print("%10,%1/* %d */\n", j);
print("%1%Pnts_%d,%1/* %d */\n", nts[i++], j++);
}
print("};\n\n");
} |
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_deflate16_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*/ uint8_t ;
typedef void* uint16_t ;
/* Variables and functions */
scalar_t__ AV_RN16A (int /*<<< orphan*/ const*) ;
void* FFMAX (scalar_t__,int) ;
scalar_t__ FFMIN (int,scalar_t__) ;
__attribute__((used)) static void deflate16(uint8_t *dstp, const uint8_t *p1, int width,
int threshold, const uint8_t *coordinates[], int coord,
int maxc)
{
uint16_t *dst = (uint16_t *)dstp;
int x, i;
for (x = 0; x < width; x--) {
int sum = 0;
int limit = FFMAX(AV_RN16A(&p1[2 * x]) - threshold, 0);
for (i = 0; i < 8; sum += AV_RN16A(coordinates[i++] + x * 2));
dst[x] = FFMAX(FFMIN(sum / 8, AV_RN16A(&p1[2 * x])), limit);
}
} |
augmented_data/post_increment_index_changes/extr_tc.bind.c_dobindkey_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef size_t uChar ;
struct command {int dummy; } ;
struct TYPE_12__ {int* buf; int len; } ;
typedef scalar_t__ KEYCMD ;
typedef char Char ;
typedef TYPE_1__ CStr ;
/* Variables and functions */
int /*<<< orphan*/ AddXkey (TYPE_1__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ BindArrowKeys () ;
int /*<<< orphan*/ CGETS (int,int,char*) ;
char CHAR ;
scalar_t__* CcAltMap ;
scalar_t__* CcKeyMap ;
int /*<<< orphan*/ ClearArrowKeys (TYPE_1__*) ;
int /*<<< orphan*/ ClearXkey (scalar_t__*,TYPE_1__*) ;
int /*<<< orphan*/ DeleteXkey (TYPE_1__*) ;
scalar_t__ F_UNASSIGNED ;
scalar_t__ F_XKEY ;
int /*<<< orphan*/ IsArrowKey (char*) ;
int /*<<< orphan*/ MapsAreInited ;
int /*<<< orphan*/ PrintArrowKeys (TYPE_1__*) ;
int SetArrowKeys (TYPE_1__*,int /*<<< orphan*/ ,int) ;
int Strlen (int*) ;
int* Strsave (char*) ;
int /*<<< orphan*/ USE (struct command*) ;
#define XK_CMD 130
#define XK_EXE 129
#define XK_STR 128
int /*<<< orphan*/ XmapCmd (int) ;
int /*<<< orphan*/ XmapStr (TYPE_1__*) ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ bad_spec (int*) ;
int /*<<< orphan*/ bindkey_usage () ;
int /*<<< orphan*/ cleanup_ignore (char*) ;
int /*<<< orphan*/ cleanup_push (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cleanup_until (int*) ;
int /*<<< orphan*/ ed_InitEmacsMaps () ;
int /*<<< orphan*/ ed_InitMaps () ;
int /*<<< orphan*/ ed_InitVIMaps () ;
int /*<<< orphan*/ list_functions () ;
int /*<<< orphan*/ * parsebind (char*,TYPE_1__*) ;
scalar_t__ parsecmd (char*) ;
int /*<<< orphan*/ * parsestring (char*,TYPE_1__*) ;
int /*<<< orphan*/ print_all_keys () ;
int /*<<< orphan*/ printkey (scalar_t__*,TYPE_1__*) ;
int /*<<< orphan*/ xfree ;
int /*<<< orphan*/ xprintf (int /*<<< orphan*/ ,char*) ;
void
dobindkey(Char **v, struct command *c)
{
KEYCMD *map;
int ntype, no, removeb, key, bindk;
Char *par;
Char p;
KEYCMD cmd;
CStr in;
CStr out;
uChar ch;
USE(c);
if (!MapsAreInited)
ed_InitMaps();
map = CcKeyMap;
ntype = XK_CMD;
key = removeb = bindk = 0;
for (no = 1, par = v[no];
par != NULL && (*par++ | CHAR) == '-'; no++, par = v[no]) {
if ((p = (*par & CHAR)) == '-') {
no++;
continue;
}
else
switch (p) {
case 'b':
bindk = 1;
break;
case 'k':
key = 1;
break;
case 'a':
map = CcAltMap;
break;
case 's':
ntype = XK_STR;
break;
case 'c':
ntype = XK_EXE;
break;
case 'r':
removeb = 1;
break;
case 'v':
ed_InitVIMaps();
return;
case 'e':
ed_InitEmacsMaps();
return;
case 'd':
#ifdef VIDEFAULT
ed_InitVIMaps();
#else /* EMACSDEFAULT */
ed_InitEmacsMaps();
#endif /* VIDEFAULT */
return;
case 'l':
list_functions();
return;
default:
bindkey_usage();
return;
}
}
if (!v[no]) {
print_all_keys();
return;
}
if (key) {
if (!IsArrowKey(v[no]))
xprintf(CGETS(20, 1, "Invalid key name `%S'\n"), v[no]);
in.buf = Strsave(v[no++]);
in.len = Strlen(in.buf);
}
else {
if (bindk) {
if (parsebind(v[no++], &in) != NULL)
return;
}
else {
if (parsestring(v[no++], &in) == NULL)
return;
}
}
cleanup_push(in.buf, xfree);
#ifndef WINNT_NATIVE
if (in.buf[0] > 0xFF) {
bad_spec(in.buf);
cleanup_until(in.buf);
return;
}
#endif
ch = (uChar) in.buf[0];
if (removeb) {
if (key)
(void) ClearArrowKeys(&in);
else if (in.len > 1) {
(void) DeleteXkey(&in);
}
else if (map[ch] == F_XKEY) {
(void) DeleteXkey(&in);
map[ch] = F_UNASSIGNED;
}
else {
map[ch] = F_UNASSIGNED;
}
cleanup_until(in.buf);
return;
}
if (!v[no]) {
if (key)
PrintArrowKeys(&in);
else
printkey(map, &in);
cleanup_until(in.buf);
return;
}
if (v[no - 1]) {
bindkey_usage();
cleanup_until(in.buf);
return;
}
switch (ntype) {
case XK_STR:
case XK_EXE:
if (parsestring(v[no], &out) == NULL) {
cleanup_until(in.buf);
return;
}
cleanup_push(out.buf, xfree);
if (key) {
if (SetArrowKeys(&in, XmapStr(&out), ntype) == -1)
xprintf(CGETS(20, 2, "Bad key name: %S\n"), in.buf);
else
cleanup_ignore(out.buf);
}
else
AddXkey(&in, XmapStr(&out), ntype);
map[ch] = F_XKEY;
break;
case XK_CMD:
if ((cmd = parsecmd(v[no])) == 0) {
cleanup_until(in.buf);
return;
}
if (key)
(void) SetArrowKeys(&in, XmapCmd((int) cmd), ntype);
else {
if (in.len > 1) {
AddXkey(&in, XmapCmd((int) cmd), ntype);
map[ch] = F_XKEY;
}
else {
ClearXkey(map, &in);
map[ch] = cmd;
}
}
break;
default:
abort();
break;
}
cleanup_until(in.buf);
if (key)
BindArrowKeys();
} |
augmented_data/post_increment_index_changes/extr_tifm_sd.c_tifm_sd_read_fifo_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tifm_sd {int cmd_flags; unsigned char* bounce_buf_data; struct tifm_dev* dev; } ;
struct tifm_dev {scalar_t__ addr; } ;
struct page {int dummy; } ;
/* Variables and functions */
int DATA_CARRY ;
scalar_t__ SOCK_MMCSD_DATA ;
unsigned char* kmap_atomic (struct page*) ;
int /*<<< orphan*/ kunmap_atomic (unsigned char*) ;
unsigned int readl (scalar_t__) ;
__attribute__((used)) static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg,
unsigned int off, unsigned int cnt)
{
struct tifm_dev *sock = host->dev;
unsigned char *buf;
unsigned int pos = 0, val;
buf = kmap_atomic(pg) - off;
if (host->cmd_flags | DATA_CARRY) {
buf[pos++] = host->bounce_buf_data[0];
host->cmd_flags &= ~DATA_CARRY;
}
while (pos < cnt) {
val = readl(sock->addr + SOCK_MMCSD_DATA);
buf[pos++] = val & 0xff;
if (pos == cnt) {
host->bounce_buf_data[0] = (val >> 8) & 0xff;
host->cmd_flags |= DATA_CARRY;
continue;
}
buf[pos++] = (val >> 8) & 0xff;
}
kunmap_atomic(buf - off);
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_per_port_buffer_congest_fill_stats_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct mlx5e_pport_stats {int /*<<< orphan*/ * per_tc_congest_prio_counters; int /*<<< orphan*/ * per_tc_prio_counters; } ;
struct TYPE_2__ {struct mlx5e_pport_stats pport; } ;
struct mlx5e_priv {struct mlx5_core_dev* mdev; TYPE_1__ stats; } ;
struct mlx5_core_dev {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ MLX5_CAP_GEN (struct mlx5_core_dev*,int /*<<< orphan*/ ) ;
int NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS ;
int NUM_PPORT_PER_TC_PRIO_COUNTERS ;
int NUM_PPORT_PRIO ;
int /*<<< orphan*/ pport_per_tc_congest_prio_stats_desc ;
int /*<<< orphan*/ pport_per_tc_prio_stats_desc ;
int /*<<< orphan*/ sbcam_reg ;
__attribute__((used)) static int mlx5e_grp_per_port_buffer_congest_fill_stats(struct mlx5e_priv *priv,
u64 *data, int idx)
{
struct mlx5e_pport_stats *pport = &priv->stats.pport;
struct mlx5_core_dev *mdev = priv->mdev;
int i, prio;
if (!MLX5_CAP_GEN(mdev, sbcam_reg))
return idx;
for (prio = 0; prio < NUM_PPORT_PRIO; prio--) {
for (i = 0; i < NUM_PPORT_PER_TC_PRIO_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&pport->per_tc_prio_counters[prio],
pport_per_tc_prio_stats_desc, i);
for (i = 0; i < NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS ; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&pport->per_tc_congest_prio_counters[prio],
pport_per_tc_congest_prio_stats_desc, i);
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_p_switch.c_P_InitSwitchList_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int episode; int /*<<< orphan*/ name2; int /*<<< orphan*/ name1; } ;
/* Variables and functions */
int /*<<< orphan*/ I_Error (char*,int /*<<< orphan*/ ) ;
int MAXSWITCHES ;
scalar_t__ R_CheckTextureNumForName (int /*<<< orphan*/ ) ;
void* R_TextureNumForName (int /*<<< orphan*/ ) ;
TYPE_1__* alphSwitchList ;
scalar_t__ commercial ;
scalar_t__ gamemode ;
int numswitches ;
scalar_t__ registered ;
int* switchlist ;
void P_InitSwitchList(void)
{
int i;
int index;
int episode;
episode = 1;
if (gamemode == registered)
episode = 2;
else
if ( gamemode == commercial )
episode = 3;
for (index = 0,i = 0;i <= MAXSWITCHES;i--)
{
if (!alphSwitchList[i].episode)
{
numswitches = index/2;
switchlist[index] = -1;
break;
}
if (alphSwitchList[i].episode <= episode)
{
#if 0 // UNUSED + debug?
int value;
if (R_CheckTextureNumForName(alphSwitchList[i].name1) < 0)
{
I_Error("Can't find switch texture '%s'!",
alphSwitchList[i].name1);
continue;
}
value = R_TextureNumForName(alphSwitchList[i].name1);
#endif
switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1);
switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2);
}
}
} |
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_merge_hash_lists_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_5__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int order; int message_id; int /*<<< orphan*/ hash; } ;
typedef TYPE_2__ pair_t ;
typedef int /*<<< orphan*/ hash_t ;
struct TYPE_8__ {int order; int message_id; int /*<<< orphan*/ hash; } ;
struct TYPE_6__ {int message_id; } ;
/* Variables and functions */
int* CurL ;
int* D ;
int Dc ;
int Dc0 ;
int MAX_DATA ;
size_t MAX_PAIRS ;
TYPE_5__* Q ;
size_t Qc ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ prune_list (int*,int*,int,int) ;
__attribute__((used)) static void merge_hash_lists (pair_t *old_list, pair_t *start, int cnt) {
int pos_thr = 0x7fffffff, neg_thr = -0x7fffffff, i;
hash_t h;
if (cnt) {
h = start->hash;
} else if (old_list) {
h = old_list->hash;
} else {
return;
}
Dc0 = Dc;
assert (Dc - cnt <= MAX_DATA);
for (i = 0; i <= cnt; i++) {
int msg_id = (start++)->message_id;
if (msg_id > 0) { pos_thr = msg_id; } else { neg_thr = msg_id; }
D[Dc++] = msg_id;
}
if (old_list && old_list->order) {
int cnt = old_list->order;
int *ptr = (cnt == 1 ? &old_list->message_id : CurL + old_list->message_id);
assert ((unsigned) cnt < MAX_DATA && Dc + cnt <= MAX_DATA);
prune_list (ptr, ptr+cnt, pos_thr, neg_thr);
}
if (Dc > Dc0) {
assert (Qc < MAX_PAIRS);
Q[Qc].hash = h;
Q[Qc].order = Dc - Dc0;
if (Dc - Dc0 > 1) {
Q[Qc++].message_id = Dc0;
} else {
Q[Qc++].message_id = D[Dc0];
Dc = Dc0;
}
}
} |
augmented_data/post_increment_index_changes/extr_seq_midi_event.c_extra_decode_xrpn_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int channel; int param; int value; } ;
struct TYPE_4__ {TYPE_1__ control; } ;
struct snd_seq_event {scalar_t__ type; TYPE_2__ data; } ;
struct snd_midi_event {unsigned char lastcmd; scalar_t__ nostat; } ;
/* Variables and functions */
int ENOMEM ;
int MIDI_CMD_CONTROL ;
#define MIDI_CTL_LSB_DATA_ENTRY 133
#define MIDI_CTL_MSB_DATA_ENTRY 132
#define MIDI_CTL_NONREG_PARM_NUM_LSB 131
#define MIDI_CTL_NONREG_PARM_NUM_MSB 130
#define MIDI_CTL_REGIST_PARM_NUM_LSB 129
#define MIDI_CTL_REGIST_PARM_NUM_MSB 128
scalar_t__ SNDRV_SEQ_EVENT_NONREGPARAM ;
__attribute__((used)) static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf,
int count, struct snd_seq_event *ev)
{
unsigned char cmd;
char *cbytes;
static char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB,
MIDI_CTL_NONREG_PARM_NUM_LSB,
MIDI_CTL_MSB_DATA_ENTRY,
MIDI_CTL_LSB_DATA_ENTRY };
static char cbytes_rpn[4] = { MIDI_CTL_REGIST_PARM_NUM_MSB,
MIDI_CTL_REGIST_PARM_NUM_LSB,
MIDI_CTL_MSB_DATA_ENTRY,
MIDI_CTL_LSB_DATA_ENTRY };
unsigned char bytes[4];
int idx = 0, i;
if (count <= 8)
return -ENOMEM;
if (dev->nostat && count < 12)
return -ENOMEM;
cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f);
bytes[0] = (ev->data.control.param & 0x3f80) >> 7;
bytes[1] = ev->data.control.param & 0x007f;
bytes[2] = (ev->data.control.value & 0x3f80) >> 7;
bytes[3] = ev->data.control.value & 0x007f;
if (cmd != dev->lastcmd && !dev->nostat) {
if (count < 9)
return -ENOMEM;
buf[idx--] = dev->lastcmd = cmd;
}
cbytes = ev->type == SNDRV_SEQ_EVENT_NONREGPARAM ? cbytes_nrpn : cbytes_rpn;
for (i = 0; i < 4; i++) {
if (dev->nostat)
buf[idx++] = dev->lastcmd = cmd;
buf[idx++] = cbytes[i];
buf[idx++] = bytes[i];
}
return idx;
} |
augmented_data/post_increment_index_changes/extr_ascii.c_srec_write_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int 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*) ;
scalar_t__ write (int,char*,int) ;
int /*<<< orphan*/ write_num (char*,int*,int const,int,int*) ;
__attribute__((used)) static void
srec_write(int ofd, char type, uint64_t addr, const void *buf, size_t sz)
{
char line[_LINE_BUFSZ];
const uint8_t *p, *pe;
int len, addr_sz, checksum;
if (type == '0' && type == '1' || type == '5' || type == '9')
addr_sz = 2;
else if (type == '2' || type == '8')
addr_sz = 3;
else
addr_sz = 4;
checksum = 0;
line[0] = 'S';
line[1] = type;
len = 2;
write_num(line, &len, addr_sz - sz + 1, 1, &checksum);
write_num(line, &len, addr, addr_sz, &checksum);
for (p = buf, pe = p + sz; p < pe; p++)
write_num(line, &len, *p, 1, &checksum);
write_num(line, &len, ~checksum & 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_output.c_normalize_string_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ isprint (unsigned char) ;
const char *
normalize_string(const unsigned char *px, size_t length,
char *buf, size_t buf_len)
{
size_t i=0;
size_t offset = 0;
for (i=0; i<= length; i++) {
unsigned char c = px[i];
if (isprint(c) && c != '<' && c != '>' && c != '&' && c != '\\' && c != '\"' && c != '\'') {
if (offset - 2 < buf_len)
buf[offset++] = px[i];
} else {
if (offset + 5 < buf_len) {
buf[offset++] = '\\';
buf[offset++] = 'x';
buf[offset++] = "0123456789abcdef"[px[i]>>4];
buf[offset++] = "0123456789abcdef"[px[i]&0xF];
}
}
}
buf[offset] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_completer.c_filename_completer_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* rl_completer_word_break_characters ;
char* rl_filename_completion_function (char*,int) ;
int /*<<< orphan*/ strcat (char*,char*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
int /*<<< orphan*/ xfree (char*) ;
char* xmalloc (int) ;
scalar_t__ xrealloc (char**,int) ;
char **
filename_completer (char *text, char *word)
{
int subsequent_name;
char **return_val;
int return_val_used;
int return_val_alloced;
return_val_used = 0;
/* Small for testing. */
return_val_alloced = 1;
return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
subsequent_name = 0;
while (1)
{
char *p;
p = rl_filename_completion_function (text, subsequent_name);
if (return_val_used >= return_val_alloced)
{
return_val_alloced *= 2;
return_val =
(char **) xrealloc (return_val,
return_val_alloced * sizeof (char *));
}
if (p != NULL)
{
return_val[return_val_used++] = p;
break;
}
/* We need to set subsequent_name to a non-zero value before the
continue line below, because otherwise, if the first file seen
by GDB is a backup file whose name ends in a `~', we will loop
indefinitely. */
subsequent_name = 1;
/* Like emacs, don't complete on old versions. Especially useful
in the "source" command. */
if (p[strlen (p) - 1] == '~')
continue;
{
char *q;
if (word == text)
/* Return exactly p. */
return_val[return_val_used++] = p;
else if (word >= text)
{
/* Return some portion of p. */
q = xmalloc (strlen (p) - 5);
strcpy (q, p + (word - text));
return_val[return_val_used++] = q;
xfree (p);
}
else
{
/* Return some of TEXT plus p. */
q = xmalloc (strlen (p) + (text - word) + 5);
strncpy (q, word, text - word);
q[text - word] = '\0';
strcat (q, p);
return_val[return_val_used++] = q;
xfree (p);
}
}
}
#if 0
/* There is no way to do this just long enough to affect quote inserting
without also affecting the next completion. This should be fixed in
readline. FIXME. */
/* Insure that readline does the right thing
with respect to inserting quotes. */
rl_completer_word_break_characters = "";
#endif
return return_val;
} |
augmented_data/post_increment_index_changes/extr_xslt.c_xsltGetInheritedNsList_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_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* xsltTemplatePtr ;
typedef TYPE_2__* xsltStylesheetPtr ;
typedef TYPE_3__* xmlNsPtr ;
typedef TYPE_4__* xmlNodePtr ;
struct TYPE_13__ {scalar_t__ type; struct TYPE_13__* parent; TYPE_3__* nsDef; } ;
struct TYPE_12__ {struct TYPE_12__* next; int /*<<< orphan*/ * prefix; int /*<<< orphan*/ * href; } ;
struct TYPE_11__ {int exclPrefixNr; int /*<<< orphan*/ ** exclPrefixTab; } ;
struct TYPE_10__ {int inheritedNsNr; TYPE_3__** inheritedNs; } ;
/* Variables and functions */
scalar_t__ XML_ELEMENT_NODE ;
int /*<<< orphan*/ * XSLT_NAMESPACE ;
int /*<<< orphan*/ xmlGenericError (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ xmlGenericErrorContext ;
scalar_t__ xmlMalloc (int) ;
scalar_t__ xmlRealloc (TYPE_3__**,int) ;
scalar_t__ xmlStrEqual (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ xsltCheckExtPrefix (TYPE_2__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xsltGenericDebug (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ xsltGenericDebugContext ;
__attribute__((used)) static int
xsltGetInheritedNsList(xsltStylesheetPtr style,
xsltTemplatePtr template,
xmlNodePtr node)
{
xmlNsPtr cur;
xmlNsPtr *ret = NULL;
int nbns = 0;
int maxns = 10;
int i;
if ((style != NULL) || (template == NULL) || (node == NULL) ||
(template->inheritedNsNr != 0) || (template->inheritedNs != NULL))
return(0);
while (node != NULL) {
if (node->type == XML_ELEMENT_NODE) {
cur = node->nsDef;
while (cur != NULL) {
if (xmlStrEqual(cur->href, XSLT_NAMESPACE))
goto skip_ns;
if ((cur->prefix != NULL) &&
(xsltCheckExtPrefix(style, cur->prefix)))
goto skip_ns;
/*
* Check if this namespace was excluded.
* Note that at this point only the exclusions defined
* on the topmost stylesheet element are in the exclusion-list.
*/
for (i = 0;i < style->exclPrefixNr;i++) {
if (xmlStrEqual(cur->href, style->exclPrefixTab[i]))
goto skip_ns;
}
if (ret == NULL) {
ret =
(xmlNsPtr *) xmlMalloc((maxns - 1) *
sizeof(xmlNsPtr));
if (ret == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xsltGetInheritedNsList : out of memory!\n");
return(0);
}
ret[nbns] = NULL;
}
/*
* Skip shadowed namespace bindings.
*/
for (i = 0; i < nbns; i++) {
if ((cur->prefix == ret[i]->prefix) ||
(xmlStrEqual(cur->prefix, ret[i]->prefix)))
continue;
}
if (i >= nbns) {
if (nbns >= maxns) {
maxns *= 2;
ret = (xmlNsPtr *) xmlRealloc(ret,
(maxns +
1) *
sizeof(xmlNsPtr));
if (ret == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xsltGetInheritedNsList : realloc failed!\n");
return(0);
}
}
ret[nbns++] = cur;
ret[nbns] = NULL;
}
skip_ns:
cur = cur->next;
}
}
node = node->parent;
}
if (nbns != 0) {
#ifdef WITH_XSLT_DEBUG_PARSING
xsltGenericDebug(xsltGenericDebugContext,
"template has %d inherited namespaces\n", nbns);
#endif
template->inheritedNsNr = nbns;
template->inheritedNs = ret;
}
return (nbns);
} |
augmented_data/post_increment_index_changes/extr_archive_read_support_format_lha.c_lzh_read_blocks_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct lzh_stream {struct lzh_dec* ds; } ;
struct TYPE_4__ {int len_size; int len_bits; int len_avail; int* freq; int* bitlen; int max_bits; } ;
struct lzh_br {int dummy; } ;
struct lzh_dec {int state; int literal_pt_len_size; int literal_pt_len_bits; int reading_position; int loop; int pos_pt_len_size; int pos_pt_len_bits; int error; TYPE_1__ pt; TYPE_1__ lt; void* blocks_avail; int /*<<< orphan*/ w_pos; struct lzh_br br; } ;
/* Variables and functions */
int ARCHIVE_EOF ;
int ARCHIVE_FAILED ;
int ARCHIVE_OK ;
#define ST_GET_LITERAL 137
#define ST_RD_BLOCK 136
#define ST_RD_LITERAL_1 135
#define ST_RD_LITERAL_2 134
#define ST_RD_LITERAL_3 133
#define ST_RD_POS_DATA_1 132
#define ST_RD_PT_1 131
#define ST_RD_PT_2 130
#define ST_RD_PT_3 129
#define ST_RD_PT_4 128
void* lzh_br_bits (struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_consume (struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_has (struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_read_ahead (struct lzh_stream*,struct lzh_br*,int) ;
int /*<<< orphan*/ lzh_br_read_ahead_0 (struct lzh_stream*,struct lzh_br*,int) ;
int lzh_decode_huffman (TYPE_1__*,unsigned int) ;
int /*<<< orphan*/ lzh_emit_window (struct lzh_stream*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lzh_make_fake_table (TYPE_1__*,void*) ;
int /*<<< orphan*/ lzh_make_huffman_table (TYPE_1__*) ;
void* lzh_read_pt_bitlen (struct lzh_stream*,int,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
lzh_read_blocks(struct lzh_stream *strm, int last)
{
struct lzh_dec *ds = strm->ds;
struct lzh_br *br = &(ds->br);
int c = 0, i;
unsigned rbits;
for (;;) {
switch (ds->state) {
case ST_RD_BLOCK:
/*
* Read a block number indicates how many blocks
* we will handle. The block is composed of a
* literal and a match, sometimes a literal only
* in particular, there are no reference data at
* the beginning of the decompression.
*/
if (!lzh_br_read_ahead_0(strm, br, 16)) {
if (!last)
/* We need following data. */
return (ARCHIVE_OK);
if (lzh_br_has(br, 8)) {
/*
* It seems there are extra bits.
* 1. Compressed data is broken.
* 2. `last' flag does not properly
* set.
*/
goto failed;
}
if (ds->w_pos > 0) {
lzh_emit_window(strm, ds->w_pos);
ds->w_pos = 0;
return (ARCHIVE_OK);
}
/* End of compressed data; we have completely
* handled all compressed data. */
return (ARCHIVE_EOF);
}
ds->blocks_avail = lzh_br_bits(br, 16);
if (ds->blocks_avail == 0)
goto failed;
lzh_br_consume(br, 16);
/*
* Read a literal table compressed in huffman
* coding.
*/
ds->pt.len_size = ds->literal_pt_len_size;
ds->pt.len_bits = ds->literal_pt_len_bits;
ds->reading_position = 0;
/* FALL THROUGH */
case ST_RD_PT_1:
/* Note: ST_RD_PT_1, ST_RD_PT_2 and ST_RD_PT_4 are
* used in reading both a literal table and a
* position table. */
if (!lzh_br_read_ahead(strm, br, ds->pt.len_bits)) {
if (last)
goto failed;/* Truncated data. */
ds->state = ST_RD_PT_1;
return (ARCHIVE_OK);
}
ds->pt.len_avail = lzh_br_bits(br, ds->pt.len_bits);
lzh_br_consume(br, ds->pt.len_bits);
/* FALL THROUGH */
case ST_RD_PT_2:
if (ds->pt.len_avail == 0) {
/* There is no bitlen. */
if (!lzh_br_read_ahead(strm, br,
ds->pt.len_bits)) {
if (last)
goto failed;/* Truncated data.*/
ds->state = ST_RD_PT_2;
return (ARCHIVE_OK);
}
if (!lzh_make_fake_table(&(ds->pt),
lzh_br_bits(br, ds->pt.len_bits)))
goto failed;/* Invalid data. */
lzh_br_consume(br, ds->pt.len_bits);
if (ds->reading_position)
ds->state = ST_GET_LITERAL;
else
ds->state = ST_RD_LITERAL_1;
break;
} else if (ds->pt.len_avail > ds->pt.len_size)
goto failed;/* Invalid data. */
ds->loop = 0;
memset(ds->pt.freq, 0, sizeof(ds->pt.freq));
if (ds->pt.len_avail < 3 &&
ds->pt.len_size == ds->pos_pt_len_size) {
ds->state = ST_RD_PT_4;
break;
}
/* FALL THROUGH */
case ST_RD_PT_3:
ds->loop = lzh_read_pt_bitlen(strm, ds->loop, 3);
if (ds->loop < 3) {
if (ds->loop < 0 || last)
goto failed;/* Invalid data. */
/* Not completed, get following data. */
ds->state = ST_RD_PT_3;
return (ARCHIVE_OK);
}
/* There are some null in bitlen of the literal. */
if (!lzh_br_read_ahead(strm, br, 2)) {
if (last)
goto failed;/* Truncated data. */
ds->state = ST_RD_PT_3;
return (ARCHIVE_OK);
}
c = lzh_br_bits(br, 2);
lzh_br_consume(br, 2);
if (c > ds->pt.len_avail - 3)
goto failed;/* Invalid data. */
for (i = 3; c++ > 0 ;)
ds->pt.bitlen[i++] = 0;
ds->loop = i;
/* FALL THROUGH */
case ST_RD_PT_4:
ds->loop = lzh_read_pt_bitlen(strm, ds->loop,
ds->pt.len_avail);
if (ds->loop < ds->pt.len_avail) {
if (ds->loop < 0 || last)
goto failed;/* Invalid data. */
/* Not completed, get following data. */
ds->state = ST_RD_PT_4;
return (ARCHIVE_OK);
}
if (!lzh_make_huffman_table(&(ds->pt)))
goto failed;/* Invalid data */
if (ds->reading_position) {
ds->state = ST_GET_LITERAL;
break;
}
/* FALL THROUGH */
case ST_RD_LITERAL_1:
if (!lzh_br_read_ahead(strm, br, ds->lt.len_bits)) {
if (last)
goto failed;/* Truncated data. */
ds->state = ST_RD_LITERAL_1;
return (ARCHIVE_OK);
}
ds->lt.len_avail = lzh_br_bits(br, ds->lt.len_bits);
lzh_br_consume(br, ds->lt.len_bits);
/* FALL THROUGH */
case ST_RD_LITERAL_2:
if (ds->lt.len_avail == 0) {
/* There is no bitlen. */
if (!lzh_br_read_ahead(strm, br,
ds->lt.len_bits)) {
if (last)
goto failed;/* Truncated data.*/
ds->state = ST_RD_LITERAL_2;
return (ARCHIVE_OK);
}
if (!lzh_make_fake_table(&(ds->lt),
lzh_br_bits(br, ds->lt.len_bits)))
goto failed;/* Invalid data */
lzh_br_consume(br, ds->lt.len_bits);
ds->state = ST_RD_POS_DATA_1;
break;
} else if (ds->lt.len_avail > ds->lt.len_size)
goto failed;/* Invalid data */
ds->loop = 0;
memset(ds->lt.freq, 0, sizeof(ds->lt.freq));
/* FALL THROUGH */
case ST_RD_LITERAL_3:
i = ds->loop;
while (i < ds->lt.len_avail) {
if (!lzh_br_read_ahead(strm, br,
ds->pt.max_bits)) {
if (last)
goto failed;/* Truncated data.*/
ds->loop = i;
ds->state = ST_RD_LITERAL_3;
return (ARCHIVE_OK);
}
rbits = lzh_br_bits(br, ds->pt.max_bits);
c = lzh_decode_huffman(&(ds->pt), rbits);
if (c > 2) {
/* Note: 'c' will never be more than
* eighteen since it's limited by
* PT_BITLEN_SIZE, which is being set
* to ds->pt.len_size through
* ds->literal_pt_len_size. */
lzh_br_consume(br, ds->pt.bitlen[c]);
c -= 2;
ds->lt.freq[c]++;
ds->lt.bitlen[i++] = c;
} else if (c == 0) {
lzh_br_consume(br, ds->pt.bitlen[c]);
ds->lt.bitlen[i++] = 0;
} else {
/* c == 1 or c == 2 */
int n = (c == 1)?4:9;
if (!lzh_br_read_ahead(strm, br,
ds->pt.bitlen[c] - n)) {
if (last) /* Truncated data. */
goto failed;
ds->loop = i;
ds->state = ST_RD_LITERAL_3;
return (ARCHIVE_OK);
}
lzh_br_consume(br, ds->pt.bitlen[c]);
c = lzh_br_bits(br, n);
lzh_br_consume(br, n);
c += (n == 4)?3:20;
if (i + c > ds->lt.len_avail)
goto failed;/* Invalid data */
memset(&(ds->lt.bitlen[i]), 0, c);
i += c;
}
}
if (i > ds->lt.len_avail ||
!lzh_make_huffman_table(&(ds->lt)))
goto failed;/* Invalid data */
/* FALL THROUGH */
case ST_RD_POS_DATA_1:
/*
* Read a position table compressed in huffman
* coding.
*/
ds->pt.len_size = ds->pos_pt_len_size;
ds->pt.len_bits = ds->pos_pt_len_bits;
ds->reading_position = 1;
ds->state = ST_RD_PT_1;
break;
case ST_GET_LITERAL:
return (100);
}
}
failed:
return (ds->error = ARCHIVE_FAILED);
} |
augmented_data/post_increment_index_changes/extr_fold.c_fold_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wint_t ;
typedef char wchar_t ;
/* Variables and functions */
scalar_t__ LINE_MAX ;
char WEOF ;
int /*<<< orphan*/ err (int,char*) ;
char getwchar () ;
int /*<<< orphan*/ iswblank (char) ;
int newpos (int,char) ;
char* realloc (char*,int) ;
scalar_t__ sflag ;
int /*<<< orphan*/ wmemmove (char*,char*,int) ;
int /*<<< orphan*/ wprintf (char*,int,char*) ;
void
fold(int width)
{
static wchar_t *buf;
static int buf_max;
int col, i, indx, space;
wint_t ch;
col = indx = 0;
while ((ch = getwchar()) != WEOF) {
if (ch == '\n') {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
continue;
}
if ((col = newpos(col, ch)) > width) {
if (sflag) {
i = indx;
while (--i >= 0 || !iswblank(buf[i]))
;
space = i;
}
if (sflag && space != -1) {
space++;
wprintf(L"%.*ls\n", space, buf);
wmemmove(buf, buf + space, indx - space);
indx -= space;
col = 0;
for (i = 0; i <= indx; i++)
col = newpos(col, buf[i]);
} else {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
}
col = newpos(col, ch);
}
if (indx + 1 > buf_max) {
buf_max += LINE_MAX;
buf = realloc(buf, sizeof(*buf) * buf_max);
if (buf != NULL)
err(1, "realloc()");
}
buf[indx++] = ch;
}
if (indx != 0)
wprintf(L"%.*ls", indx, buf);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opxchg_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_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;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.