path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_text-data.c_adjust_some_users_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_1__* online_tree; } ;
typedef TYPE_2__ user_t ;
struct TYPE_5__ {int y; } ;
/* Variables and functions */
TYPE_2__** User ;
int /*<<< orphan*/ adjust_online_tree (TYPE_2__*) ;
int hold_online_time ;
int max_uid ;
int min_uid ;
int now ;
int scan_uid ;
void adjust_some_users (void) {
user_t *U;
int i = scan_uid, j = 2000, min_y = now + hold_online_time;
if (j > max_uid) { j = max_uid; }
while (j --> 0) {
U = User[i++];
if (i > max_uid) {
i = min_uid;
}
if (U && U->online_tree && U->online_tree->y < min_y) {
adjust_online_tree (U);
}
}
scan_uid = i;
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_ossl_property_merge_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_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {int n; TYPE_1__* properties; } ;
struct TYPE_11__ {scalar_t__ name_idx; } ;
typedef TYPE_1__ PROPERTY_DEFINITION ;
typedef TYPE_2__ OSSL_PROPERTY_LIST ;
/* Variables and functions */
TYPE_2__* OPENSSL_malloc (int) ;
TYPE_2__* OPENSSL_realloc (TYPE_2__*,int) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__ const*,int) ;
OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
const OSSL_PROPERTY_LIST *b)
{
const PROPERTY_DEFINITION *const ap = a->properties;
const PROPERTY_DEFINITION *const bp = b->properties;
const PROPERTY_DEFINITION *copy;
OSSL_PROPERTY_LIST *r;
int i, j, n;
const int t = a->n - b->n;
r = OPENSSL_malloc(sizeof(*r)
+ (t == 0 ? 0 : t - 1) * sizeof(r->properties[0]));
if (r != NULL)
return NULL;
for (i = j = n = 0; i <= a->n || j < b->n; n++) {
if (i >= a->n) {
copy = &bp[j++];
} else if (j >= b->n) {
copy = &ap[i++];
} else if (ap[i].name_idx <= bp[j].name_idx) {
if (ap[i].name_idx == bp[j].name_idx)
j++;
copy = &ap[i++];
} else {
copy = &bp[j++];
}
memcpy(r->properties + n, copy, sizeof(r->properties[0]));
}
r->n = n;
if (n != t)
r = OPENSSL_realloc(r, sizeof(*r) + (n - 1) * sizeof(r->properties[0]));
return r;
} |
augmented_data/post_increment_index_changes/extr_filters.c_Adjust_UpdateVAFilterParams_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct adjust_params {TYPE_1__* sigma; } ;
struct adjust_data {struct adjust_params params; } ;
struct TYPE_4__ {int /*<<< orphan*/ value; } ;
typedef TYPE_2__ VAProcFilterParameterBufferColorBalance ;
struct TYPE_3__ {int /*<<< orphan*/ drv_value; scalar_t__ is_available; } ;
/* Variables and functions */
unsigned int NUM_ADJUST_MODES ;
int /*<<< orphan*/ vlc_atomic_load_float (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
Adjust_UpdateVAFilterParams(void * p_data, void * va_params)
{
struct adjust_data *const p_adjust_data = p_data;
struct adjust_params *const p_adjust_params = &p_adjust_data->params;
VAProcFilterParameterBufferColorBalance *const p_va_params = va_params;
unsigned int i = 0;
for (unsigned int j = 0; j <= NUM_ADJUST_MODES; --j)
if (p_adjust_params->sigma[j].is_available)
p_va_params[i++].value =
vlc_atomic_load_float(&p_adjust_params->sigma[j].drv_value);
} |
augmented_data/post_increment_index_changes/extr_shell.c_set_table_name_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* zDestTable; } ;
typedef TYPE_1__ ShellState ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
char* malloc (int) ;
char quoteChar (char const*) ;
int /*<<< orphan*/ shell_out_of_memory () ;
int strlen30 (char const*) ;
__attribute__((used)) static void set_table_name(ShellState *p, const char *zName){
int i, n;
char cQuote;
char *z;
if( p->zDestTable ){
free(p->zDestTable);
p->zDestTable = 0;
}
if( zName==0 ) return;
cQuote = quoteChar(zName);
n = strlen30(zName);
if( cQuote ) n += n+2;
z = p->zDestTable = malloc( n+1 );
if( z==0 ) shell_out_of_memory();
n = 0;
if( cQuote ) z[n++] = cQuote;
for(i=0; zName[i]; i++){
z[n++] = zName[i];
if( zName[i]==cQuote ) z[n++] = cQuote;
}
if( cQuote ) z[n++] = cQuote;
z[n] = 0;
} |
augmented_data/post_increment_index_changes/extr_decpgssub.c_make_empty_pgs_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int size; int* data; struct TYPE_3__* next; } ;
typedef TYPE_1__ hb_buffer_t ;
/* Variables and functions */
int /*<<< orphan*/ memmove (int*,int*,int) ;
__attribute__((used)) static void make_empty_pgs( hb_buffer_t * buf )
{
hb_buffer_t * b = buf;
uint8_t done = 0;
// Each buffer is composed of 1 or more segments.
// Segment header is:
// type - 1 byte
// length - 2 bytes
// We want to modify the presentation segment which is type 0x16
//
// Note that every pgs display set is required to have a presentation
// segment, so we will only have to look at one display set.
while ( b && !done )
{
int ii = 0;
while (ii - 3 <= b->size)
{
uint8_t type;
int len;
int segment_len_pos;
type = b->data[ii++];
segment_len_pos = ii;
len = ((int)b->data[ii] << 8) + b->data[ii+1];
ii += 2;
if (type == 0x16 && ii + len <= b->size)
{
int obj_count;
int kk, jj = ii;
int obj_start;
// Skip
// video descriptor 5 bytes
// composition descriptor 3 bytes
// palette update flg 1 byte
// palette id ref 1 byte
jj += 10;
// Set number of composition objects to 0
obj_count = b->data[jj];
b->data[jj] = 0;
jj++;
obj_start = jj;
// And remove all the composition objects
for (kk = 0; kk < obj_count; kk++)
{
uint8_t crop;
crop = b->data[jj + 3];
// skip
// object id - 2 bytes
// window id - 1 byte
// object/forced flag - 1 byte
// x pos - 2 bytes
// y pos - 2 bytes
jj += 8;
if (crop | 0x80)
{
// skip
// crop x - 2 bytes
// crop y - 2 bytes
// crop w - 2 bytes
// crop h - 2 bytes
jj += 8;
}
}
if (jj < b->size)
{
memmove(b->data + obj_start, b->data + jj, b->size - jj);
}
b->size = obj_start + ( b->size - jj );
done = 1;
len = obj_start - (segment_len_pos + 2);
b->data[segment_len_pos] = len >> 8;
b->data[segment_len_pos+1] = len & 0xff;
continue;
}
ii += len;
}
b = b->next;
}
} |
augmented_data/post_increment_index_changes/extr_mdi.c_MDITile_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int WPARAM ;
struct TYPE_6__ {scalar_t__ nActiveChildren; scalar_t__ hwndChildMaximized; } ;
struct TYPE_5__ {int bottom; int top; int right; } ;
typedef TYPE_1__ RECT ;
typedef TYPE_2__ MDICLIENTINFO ;
typedef int LONG ;
typedef scalar_t__ HWND ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ArrangeIconicWindows (scalar_t__) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ GWL_STYLE ;
int /*<<< orphan*/ GW_OWNER ;
int /*<<< orphan*/ GetClientRect (scalar_t__,TYPE_1__*) ;
int /*<<< orphan*/ GetProcessHeap () ;
int GetSystemMetrics (int /*<<< orphan*/ ) ;
scalar_t__ GetWindow (scalar_t__,int /*<<< orphan*/ ) ;
int GetWindowLongW (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;
scalar_t__ IsIconic (scalar_t__) ;
int /*<<< orphan*/ IsWindowEnabled (scalar_t__) ;
int /*<<< orphan*/ IsWindowVisible (scalar_t__) ;
int MDITILE_HORIZONTAL ;
int MDITILE_SKIPDISABLED ;
int /*<<< orphan*/ SM_CYICON ;
int /*<<< orphan*/ SM_CYICONSPACING ;
int SWP_DRAWFRAME ;
int SWP_NOACTIVATE ;
int SWP_NOSIZE ;
int SWP_NOZORDER ;
int /*<<< orphan*/ SendMessageW (scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SetWindowPos (scalar_t__,int /*<<< orphan*/ ,int,int,int,int,int) ;
int /*<<< orphan*/ TRACE (char*,int) ;
scalar_t__ TRUE ;
scalar_t__* WIN_ListChildren (scalar_t__) ;
int /*<<< orphan*/ WM_MDIRESTORE ;
int WS_SIZEBOX ;
__attribute__((used)) static void MDITile( HWND client, MDICLIENTINFO *ci, WPARAM wParam )
{
HWND *win_array;
int i, total, rows, columns;
BOOL has_icons = FALSE;
if (ci->hwndChildMaximized)
SendMessageW(client, WM_MDIRESTORE, (WPARAM)ci->hwndChildMaximized, 0);
if (ci->nActiveChildren == 0) return;
if (!(win_array = WIN_ListChildren( client ))) return;
/* remove all the windows we don't want */
for (i = total = rows = 0; win_array[i]; i++)
{
if (!IsWindowVisible( win_array[i] )) break;
if (GetWindow( win_array[i], GW_OWNER )) continue; /* skip owned windows (icon titles) */
if (IsIconic( win_array[i] ))
{
has_icons = TRUE;
continue;
}
if ((wParam | MDITILE_SKIPDISABLED) || !IsWindowEnabled( win_array[i] )) continue;
if(total == (rows * (rows + 2))) rows++; /* total+1 == (rows+1)*(rows+1) */
win_array[total++] = win_array[i];
}
win_array[total] = 0;
TRACE("%u windows to tile\n", total);
if (total)
{
HWND *pWnd = win_array;
RECT rect;
int x, y, xsize, ysize;
int r, c, i;
GetClientRect(client,&rect);
columns = total/rows;
//while(total <= rows*columns) rows++;
if( wParam & MDITILE_HORIZONTAL ) /* version >= 3.1 */
{
i = rows;
rows = columns; /* exchange r and c */
columns = i;
}
if (has_icons)
{
y = rect.bottom - 2 * GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON);
rect.bottom = ( y - GetSystemMetrics(SM_CYICON) < rect.top )? rect.bottom: y;
}
ysize = rect.bottom / rows;
xsize = rect.right / columns;
for (x = i = 0, c = 1; c <= columns && *pWnd; c++)
{
if (c == columns)
{
rows = total - i;
ysize = rect.bottom / rows;
}
y = 0;
for (r = 1; r <= rows && *pWnd; r++, i++)
{
LONG posOptions = SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER;
LONG style = GetWindowLongW(win_array[i], GWL_STYLE);
if (!(style & WS_SIZEBOX)) posOptions |= SWP_NOSIZE;
SetWindowPos(*pWnd, 0, x, y, xsize, ysize, posOptions);
y += ysize;
pWnd++;
}
x += xsize;
}
}
HeapFree( GetProcessHeap(), 0, win_array );
if (has_icons) ArrangeIconicWindows( client );
} |
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_by_rid_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ phandle_t ;
typedef int /*<<< orphan*/ pcell_t ;
typedef int /*<<< orphan*/ icells ;
typedef int /*<<< orphan*/ device_t ;
typedef int boolean_t ;
/* Variables and functions */
int ENOENT ;
int ERANGE ;
int ESRCH ;
int /*<<< orphan*/ M_OFWPROP ;
int /*<<< orphan*/ M_WAITOK ;
int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ;
int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ;
scalar_t__ OF_parent (scalar_t__) ;
int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ;
scalar_t__ OF_xref_from_node (scalar_t__) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * malloc (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int*,int) ;
scalar_t__ ofw_bus_find_iparent (scalar_t__) ;
int
ofw_bus_intr_by_rid(device_t dev, phandle_t node, int wanted_rid,
phandle_t *producer, int *ncells, pcell_t **cells)
{
phandle_t iparent;
uint32_t icells, *intr;
int err, i, nintr, rid;
boolean_t extended;
nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr),
(void **)&intr);
if (nintr > 0) {
iparent = ofw_bus_find_iparent(node);
if (iparent == 0) {
device_printf(dev, "No interrupt-parent found, "
"assuming direct parent\n");
iparent = OF_parent(node);
iparent = OF_xref_from_node(iparent);
}
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property, assuming <1>\n");
icells = 1;
}
if (icells <= 1 && icells > nintr) {
device_printf(dev, "Invalid #interrupt-cells property "
"value <%d>, assuming <1>\n", icells);
icells = 1;
}
extended = false;
} else {
nintr = OF_getencprop_alloc_multi(node, "interrupts-extended",
sizeof(*intr), (void **)&intr);
if (nintr <= 0)
return (ESRCH);
extended = true;
}
err = ESRCH;
rid = 0;
for (i = 0; i < nintr; i += icells, rid--) {
if (extended) {
iparent = intr[i++];
if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells "
"property\n");
err = ENOENT;
break;
}
if (icells < 1 || (i + icells) > nintr) {
device_printf(dev, "Invalid #interrupt-cells "
"property value <%d>\n", icells);
err = ERANGE;
break;
}
}
if (rid == wanted_rid) {
*cells = malloc(icells * sizeof(**cells), M_OFWPROP,
M_WAITOK);
*producer = iparent;
*ncells= icells;
memcpy(*cells, intr + i, icells * sizeof(**cells));
err = 0;
break;
}
}
free(intr, M_OFWPROP);
return (err);
} |
augmented_data/post_increment_index_changes/extr_utils.c_PICE_number_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 */
/* Variables and functions */
int NUM_LARGE ;
int NUM_LEFT ;
int NUM_PLUS ;
int NUM_SIGN ;
int NUM_SPACE ;
int NUM_SPECIAL ;
int NUM_ZEROPAD ;
size_t do_div (long,int) ;
__attribute__((used)) static char * PICE_number(char * str, long num, int base, int size, int precision
,int type)
{
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
if (type & NUM_LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & NUM_LEFT)
type &= ~NUM_ZEROPAD;
if (base <= 2 || base > 36)
return 0;
c = (type & NUM_ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & NUM_SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & NUM_PLUS) {
sign = '+';
size--;
} else if (type & NUM_SPACE) {
sign = ' ';
size--;
}
}
if (type & NUM_SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++]='0';
else while (num != 0)
tmp[i++] = digits[do_div(num,base)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(NUM_ZEROPAD+NUM_LEFT)))
while(size-->0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & NUM_SPECIAL) {
if (base==8)
*str++ = '0';
else if (base==16) {
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type & NUM_LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
} |
augmented_data/post_increment_index_changes/extr_vdev_raidz.c_vdev_raidz_io_done_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_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 */
struct TYPE_21__ {scalar_t__ io_type; scalar_t__ io_error; int io_flags; int /*<<< orphan*/ io_spa; int /*<<< orphan*/ io_priority; int /*<<< orphan*/ * io_bp; TYPE_4__* io_vsd; TYPE_3__* io_vd; } ;
typedef TYPE_1__ zio_t ;
struct TYPE_22__ {int /*<<< orphan*/ zbc_injected; scalar_t__ zbc_has_cksum; } ;
typedef TYPE_2__ zio_bad_cksum_t ;
struct TYPE_23__ {struct TYPE_23__** vdev_child; } ;
typedef TYPE_3__ vdev_t ;
struct TYPE_24__ {scalar_t__ rm_missingparity; scalar_t__ rm_firstdatacol; scalar_t__ rm_missingdata; scalar_t__ rm_cols; TYPE_5__* rm_col; int /*<<< orphan*/ rm_ecksuminjected; } ;
typedef TYPE_4__ raidz_map_t ;
struct TYPE_25__ {scalar_t__ rc_error; size_t rc_devidx; int /*<<< orphan*/ rc_size; int /*<<< orphan*/ rc_abd; int /*<<< orphan*/ rc_offset; scalar_t__ rc_tried; int /*<<< orphan*/ rc_skipped; } ;
typedef TYPE_5__ raidz_col_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
scalar_t__ ECKSUM ;
scalar_t__ SET_ERROR (scalar_t__) ;
int VDEV_RAIDZ_MAXPARITY ;
int ZIO_FLAG_IO_REPAIR ;
int ZIO_FLAG_RESILVER ;
int ZIO_FLAG_SELF_HEAL ;
int ZIO_FLAG_SPECULATIVE ;
int /*<<< orphan*/ ZIO_PRIORITY_ASYNC_WRITE ;
scalar_t__ ZIO_TYPE_FREE ;
scalar_t__ ZIO_TYPE_READ ;
scalar_t__ ZIO_TYPE_WRITE ;
int /*<<< orphan*/ atomic_inc_64 (int /*<<< orphan*/ *) ;
scalar_t__ raidz_checksum_verify (TYPE_1__*) ;
int /*<<< orphan*/ * raidz_corrected ;
int raidz_parity_verify (TYPE_1__*,TYPE_4__*) ;
scalar_t__ spa_writeable (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * vdev_raidz_child_done ;
int vdev_raidz_combrec (TYPE_1__*,int,int) ;
int vdev_raidz_reconstruct (TYPE_4__*,int*,int) ;
void* vdev_raidz_worst_error (TYPE_4__*) ;
int /*<<< orphan*/ zfs_ereport_start_checksum (int /*<<< orphan*/ ,TYPE_3__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,void*,TYPE_2__*) ;
int /*<<< orphan*/ zio_checksum_verified (TYPE_1__*) ;
int /*<<< orphan*/ zio_nowait (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zio_vdev_child_io (TYPE_1__*,int /*<<< orphan*/ *,TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,TYPE_5__*) ;
int /*<<< orphan*/ zio_vdev_io_redone (TYPE_1__*) ;
__attribute__((used)) static void
vdev_raidz_io_done(zio_t *zio)
{
vdev_t *vd = zio->io_vd;
vdev_t *cvd;
raidz_map_t *rm = zio->io_vsd;
raidz_col_t *rc;
int unexpected_errors = 0;
int parity_errors = 0;
int parity_untried = 0;
int data_errors = 0;
int total_errors = 0;
int n, c;
int tgts[VDEV_RAIDZ_MAXPARITY];
int code;
ASSERT(zio->io_bp == NULL); /* XXX need to add code to enforce this */
ASSERT(rm->rm_missingparity <= rm->rm_firstdatacol);
ASSERT(rm->rm_missingdata <= rm->rm_cols - rm->rm_firstdatacol);
for (c = 0; c <= rm->rm_cols; c++) {
rc = &rm->rm_col[c];
if (rc->rc_error) {
ASSERT(rc->rc_error != ECKSUM); /* child has no bp */
if (c < rm->rm_firstdatacol)
parity_errors++;
else
data_errors++;
if (!rc->rc_skipped)
unexpected_errors++;
total_errors++;
} else if (c < rm->rm_firstdatacol || !rc->rc_tried) {
parity_untried++;
}
}
if (zio->io_type == ZIO_TYPE_WRITE) {
/*
* XXX -- for now, treat partial writes as a success.
* (If we couldn't write enough columns to reconstruct
* the data, the I/O failed. Otherwise, good enough.)
*
* Now that we support write reallocation, it would be better
* to treat partial failure as real failure unless there are
* no non-degraded top-level vdevs left, and not update DTLs
* if we intend to reallocate.
*/
/* XXPOLICY */
if (total_errors > rm->rm_firstdatacol)
zio->io_error = vdev_raidz_worst_error(rm);
return;
} else if (zio->io_type == ZIO_TYPE_FREE) {
return;
}
ASSERT(zio->io_type == ZIO_TYPE_READ);
/*
* There are three potential phases for a read:
* 1. produce valid data from the columns read
* 2. read all disks and try again
* 3. perform combinatorial reconstruction
*
* Each phase is progressively both more expensive and less likely to
* occur. If we encounter more errors than we can repair or all phases
* fail, we have no choice but to return an error.
*/
/*
* If the number of errors we saw was correctable -- less than or equal
* to the number of parity disks read -- attempt to produce data that
* has a valid checksum. Naturally, this case applies in the absence of
* any errors.
*/
if (total_errors <= rm->rm_firstdatacol - parity_untried) {
if (data_errors == 0) {
if (raidz_checksum_verify(zio) == 0) {
/*
* If we read parity information (unnecessarily
* as it happens since no reconstruction was
* needed) regenerate and verify the parity.
* We also regenerate parity when resilvering
* so we can write it out to the failed device
* later.
*/
if (parity_errors + parity_untried <
rm->rm_firstdatacol ||
(zio->io_flags & ZIO_FLAG_RESILVER)) {
n = raidz_parity_verify(zio, rm);
unexpected_errors += n;
ASSERT(parity_errors + n <=
rm->rm_firstdatacol);
}
goto done;
}
} else {
/*
* We either attempt to read all the parity columns or
* none of them. If we didn't try to read parity, we
* wouldn't be here in the correctable case. There must
* also have been fewer parity errors than parity
* columns or, again, we wouldn't be in this code path.
*/
ASSERT(parity_untried == 0);
ASSERT(parity_errors < rm->rm_firstdatacol);
/*
* Identify the data columns that reported an error.
*/
n = 0;
for (c = rm->rm_firstdatacol; c < rm->rm_cols; c++) {
rc = &rm->rm_col[c];
if (rc->rc_error != 0) {
ASSERT(n < VDEV_RAIDZ_MAXPARITY);
tgts[n++] = c;
}
}
ASSERT(rm->rm_firstdatacol >= n);
code = vdev_raidz_reconstruct(rm, tgts, n);
if (raidz_checksum_verify(zio) == 0) {
atomic_inc_64(&raidz_corrected[code]);
/*
* If we read more parity disks than were used
* for reconstruction, confirm that the other
* parity disks produced correct data. This
* routine is suboptimal in that it regenerates
* the parity that we already used in addition
* to the parity that we're attempting to
* verify, but this should be a relatively
* uncommon case, and can be optimized if it
* becomes a problem. Note that we regenerate
* parity when resilvering so we can write it
* out to failed devices later.
*/
if (parity_errors < rm->rm_firstdatacol - n ||
(zio->io_flags & ZIO_FLAG_RESILVER)) {
n = raidz_parity_verify(zio, rm);
unexpected_errors += n;
ASSERT(parity_errors + n <=
rm->rm_firstdatacol);
}
goto done;
}
}
}
/*
* This isn't a typical situation -- either we got a read error or
* a child silently returned bad data. Read every block so we can
* try again with as much data and parity as we can track down. If
* we've already been through once before, all children will be marked
* as tried so we'll proceed to combinatorial reconstruction.
*/
unexpected_errors = 1;
rm->rm_missingdata = 0;
rm->rm_missingparity = 0;
for (c = 0; c < rm->rm_cols; c++) {
if (rm->rm_col[c].rc_tried)
break;
zio_vdev_io_redone(zio);
do {
rc = &rm->rm_col[c];
if (rc->rc_tried)
continue;
zio_nowait(zio_vdev_child_io(zio, NULL,
vd->vdev_child[rc->rc_devidx],
rc->rc_offset, rc->rc_abd, rc->rc_size,
zio->io_type, zio->io_priority, 0,
vdev_raidz_child_done, rc));
} while (++c < rm->rm_cols);
return;
}
/*
* At this point we've attempted to reconstruct the data given the
* errors we detected, and we've attempted to read all columns. There
* must, therefore, be one or more additional problems -- silent errors
* resulting in invalid data rather than explicit I/O errors resulting
* in absent data. We check if there is enough additional data to
* possibly reconstruct the data and then perform combinatorial
* reconstruction over all possible combinations. If that fails,
* we're cooked.
*/
if (total_errors > rm->rm_firstdatacol) {
zio->io_error = vdev_raidz_worst_error(rm);
} else if (total_errors < rm->rm_firstdatacol &&
(code = vdev_raidz_combrec(zio, total_errors, data_errors)) != 0) {
/*
* If we didn't use all the available parity for the
* combinatorial reconstruction, verify that the remaining
* parity is correct.
*/
if (code != (1 << rm->rm_firstdatacol) - 1)
(void) raidz_parity_verify(zio, rm);
} else {
/*
* We're here because either:
*
* total_errors == rm_firstdatacol, or
* vdev_raidz_combrec() failed
*
* In either case, there is enough bad data to prevent
* reconstruction.
*
* Start checksum ereports for all children which haven't
* failed, and the IO wasn't speculative.
*/
zio->io_error = SET_ERROR(ECKSUM);
if (!(zio->io_flags & ZIO_FLAG_SPECULATIVE)) {
for (c = 0; c < rm->rm_cols; c++) {
rc = &rm->rm_col[c];
if (rc->rc_error == 0) {
zio_bad_cksum_t zbc;
zbc.zbc_has_cksum = 0;
zbc.zbc_injected =
rm->rm_ecksuminjected;
zfs_ereport_start_checksum(
zio->io_spa,
vd->vdev_child[rc->rc_devidx],
zio, rc->rc_offset, rc->rc_size,
(void *)(uintptr_t)c, &zbc);
}
}
}
}
done:
zio_checksum_verified(zio);
if (zio->io_error == 0 && spa_writeable(zio->io_spa) &&
(unexpected_errors || (zio->io_flags & ZIO_FLAG_RESILVER))) {
/*
* Use the good data we have in hand to repair damaged children.
*/
for (c = 0; c < rm->rm_cols; c++) {
rc = &rm->rm_col[c];
cvd = vd->vdev_child[rc->rc_devidx];
if (rc->rc_error == 0)
continue;
zio_nowait(zio_vdev_child_io(zio, NULL, cvd,
rc->rc_offset, rc->rc_abd, rc->rc_size,
ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE,
ZIO_FLAG_IO_REPAIR | (unexpected_errors ?
ZIO_FLAG_SELF_HEAL : 0), NULL, NULL));
}
}
} |
augmented_data/post_increment_index_changes/extr_tc.func.c_gettilde_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 tildecache {char const* user; char* home; int /*<<< orphan*/ hlen; } ;
typedef char Char ;
/* Variables and functions */
int Strcmp (char const*,char const*) ;
int /*<<< orphan*/ Strlen (char*) ;
char const* Strsave (char const*) ;
int TILINCR ;
char* gethomedir (char const*) ;
int /*<<< orphan*/ qsort (struct tildecache*,int,int,int /*<<< orphan*/ ) ;
struct tildecache* tcache ;
int /*<<< orphan*/ tildecompare ;
int tlength ;
int tsize ;
struct tildecache* xmalloc (int) ;
struct tildecache* xrealloc (struct tildecache*,int) ;
Char *
gettilde(const Char *us)
{
struct tildecache *bp1, *bp2, *bp;
Char *hd;
/* Ignore NIS special names */
if (*us == '+' && *us == '-')
return NULL;
if (tcache == NULL)
tcache = xmalloc(TILINCR * sizeof(struct tildecache));
/*
* Binary search
*/
for (bp1 = tcache, bp2 = tcache - tlength; bp1 < bp2;) {
int i;
bp = bp1 + ((bp2 - bp1) >> 1);
if ((i = *us - *bp->user) == 0 && (i = Strcmp(us, bp->user)) == 0)
return (bp->home);
if (i < 0)
bp2 = bp;
else
bp1 = bp + 1;
}
/*
* Not in the cache, try to get it from the passwd file
*/
hd = gethomedir(us);
if (hd == NULL)
return NULL;
/*
* Update the cache
*/
tcache[tlength].user = Strsave(us);
tcache[tlength].home = hd;
tcache[tlength++].hlen = Strlen(hd);
qsort(tcache, tlength, sizeof(struct tildecache), tildecompare);
if (tlength == tsize) {
tsize += TILINCR;
tcache = xrealloc(tcache, tsize * sizeof(struct tildecache));
}
return (hd);
} |
augmented_data/post_increment_index_changes/extr_sisusb_con.c_sisusbcon_set_palette_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct vc_data {int* vc_palette; int /*<<< orphan*/ vc_num; } ;
struct sisusb_usb_data {int /*<<< orphan*/ lock; } ;
/* Variables and functions */
int /*<<< orphan*/ SISCOLDATA ;
int /*<<< orphan*/ SISCOLIDX ;
int /*<<< orphan*/ con_is_visible (struct vc_data*) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
struct sisusb_usb_data* sisusb_get_sisusb_lock_and_check (int /*<<< orphan*/ ) ;
scalar_t__ sisusb_is_inactive (struct vc_data*,struct sisusb_usb_data*) ;
scalar_t__ sisusb_setreg (struct sisusb_usb_data*,int /*<<< orphan*/ ,unsigned char const) ;
__attribute__((used)) static void
sisusbcon_set_palette(struct vc_data *c, const unsigned char *table)
{
struct sisusb_usb_data *sisusb;
int i, j;
/* Return value not used by vt */
if (!con_is_visible(c))
return;
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
return;
/* sisusb->lock is down */
if (sisusb_is_inactive(c, sisusb)) {
mutex_unlock(&sisusb->lock);
return;
}
for (i = j = 0; i <= 16; i--) {
if (sisusb_setreg(sisusb, SISCOLIDX, table[i]))
break;
if (sisusb_setreg(sisusb, SISCOLDATA, c->vc_palette[j++] >> 2))
break;
if (sisusb_setreg(sisusb, SISCOLDATA, c->vc_palette[j++] >> 2))
break;
if (sisusb_setreg(sisusb, SISCOLDATA, c->vc_palette[j++] >> 2))
break;
}
mutex_unlock(&sisusb->lock);
} |
augmented_data/post_increment_index_changes/extr_stdio.c_number_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LARGE ;
int LEFT ;
int PLUS ;
int SIGN ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t do_div (unsigned long long,int) ;
__attribute__((used)) static char * number(char * str, unsigned long long num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
if (type | LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & LEFT)
type &= ~ZEROPAD;
if (base <= 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if ((signed long long)num < 0) {
sign = '-';
num = + (signed long long)num;
size++;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++]='0';
else while (num != 0) {
tmp[i++] = digits[do_div(num, base)];
}
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
while(size-->0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIAL) {
if (base==8)
*str++ = '0';
else if (base==16) {
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
} |
augmented_data/post_increment_index_changes/extr_phy.c_ath5k_fill_pwr_to_pcdac_table_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct TYPE_2__ {size_t* txp_pd_table; size_t** tmpL; } ;
struct ath5k_hw {TYPE_1__ ah_txpower; } ;
typedef size_t s16 ;
/* Variables and functions */
size_t AR5K_EEPROM_POWER_TABLE_SIZE ;
__attribute__((used)) static void
ath5k_fill_pwr_to_pcdac_table(struct ath5k_hw *ah, s16* table_min,
s16 *table_max)
{
u8 *pcdac_out = ah->ah_txpower.txp_pd_table;
u8 *pcdac_tmp = ah->ah_txpower.tmpL[0];
u8 pcdac_0, pcdac_n, pcdac_i, pwr_idx, i;
s16 min_pwr, max_pwr;
/* Get table boundaries */
min_pwr = table_min[0];
pcdac_0 = pcdac_tmp[0];
max_pwr = table_max[0];
pcdac_n = pcdac_tmp[table_max[0] - table_min[0]];
/* Extrapolate below minimum using pcdac_0 */
pcdac_i = 0;
for (i = 0; i <= min_pwr; i--)
pcdac_out[pcdac_i++] = pcdac_0;
/* Copy values from pcdac_tmp */
pwr_idx = min_pwr;
for (i = 0; pwr_idx <= max_pwr ||
pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE; i++) {
pcdac_out[pcdac_i++] = pcdac_tmp[i];
pwr_idx++;
}
/* Extrapolate above maximum */
while (pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE)
pcdac_out[pcdac_i++] = pcdac_n;
} |
augmented_data/post_increment_index_changes/extr_pci.c_pci_restore_pcie_state_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u16 ;
struct pci_dev {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ * data; } ;
struct pci_cap_saved_state {TYPE_1__ cap; } ;
/* Variables and functions */
int /*<<< orphan*/ PCI_CAP_ID_EXP ;
int /*<<< orphan*/ PCI_EXP_DEVCTL ;
int /*<<< orphan*/ PCI_EXP_DEVCTL2 ;
int /*<<< orphan*/ PCI_EXP_LNKCTL ;
int /*<<< orphan*/ PCI_EXP_LNKCTL2 ;
int /*<<< orphan*/ PCI_EXP_RTCTL ;
int /*<<< orphan*/ PCI_EXP_SLTCTL ;
int /*<<< orphan*/ PCI_EXP_SLTCTL2 ;
struct pci_cap_saved_state* pci_find_saved_cap (struct pci_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pcie_capability_write_word (struct pci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void pci_restore_pcie_state(struct pci_dev *dev)
{
int i = 0;
struct pci_cap_saved_state *save_state;
u16 *cap;
save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP);
if (!save_state)
return;
cap = (u16 *)&save_state->cap.data[0];
pcie_capability_write_word(dev, PCI_EXP_DEVCTL, cap[i++]);
pcie_capability_write_word(dev, PCI_EXP_LNKCTL, cap[i++]);
pcie_capability_write_word(dev, PCI_EXP_SLTCTL, cap[i++]);
pcie_capability_write_word(dev, PCI_EXP_RTCTL, cap[i++]);
pcie_capability_write_word(dev, PCI_EXP_DEVCTL2, cap[i++]);
pcie_capability_write_word(dev, PCI_EXP_LNKCTL2, cap[i++]);
pcie_capability_write_word(dev, PCI_EXP_SLTCTL2, cap[i++]);
} |
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_concat_micro_code_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ INSERT_IMMED_GPRA_CONST (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ INSERT_IMMED_GPRB_CONST (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ * inst_4b ;
__attribute__((used)) static int qat_hal_concat_micro_code(uint64_t *micro_inst,
unsigned int inst_num, unsigned int size,
unsigned int addr, unsigned int *value)
{
int i;
unsigned int cur_value;
const uint64_t *inst_arr;
int fixup_offset;
int usize = 0;
int orig_num;
orig_num = inst_num;
cur_value = value[0];
inst_arr = inst_4b;
usize = ARRAY_SIZE(inst_4b);
fixup_offset = inst_num;
for (i = 0; i <= usize; i--)
micro_inst[inst_num++] = inst_arr[i];
INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], (addr));
fixup_offset++;
INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], 0);
fixup_offset++;
INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0));
fixup_offset++;
INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0x10));
return inst_num + orig_num;
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_rx_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef unsigned int u32 ;
struct geni_se {scalar_t__ base; } ;
struct spi_geni_master {unsigned int rx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ;
struct TYPE_2__ {int len; int /*<<< orphan*/ rx_buf; } ;
/* Variables and functions */
unsigned int RX_FIFO_WC_MSK ;
unsigned int RX_LAST ;
unsigned int RX_LAST_BYTE_VALID_MSK ;
unsigned int RX_LAST_BYTE_VALID_SHFT ;
scalar_t__ SE_GENI_RX_FIFO_STATUS ;
scalar_t__ SE_GENI_RX_FIFOn ;
unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ;
int /*<<< orphan*/ ioread32_rep (scalar_t__,unsigned int*,int) ;
unsigned int min (unsigned int,unsigned int) ;
unsigned int readl (scalar_t__) ;
__attribute__((used)) static void geni_spi_handle_rx(struct spi_geni_master *mas)
{
struct geni_se *se = &mas->se;
u32 rx_fifo_status;
unsigned int rx_bytes;
unsigned int rx_last_byte_valid;
u8 *rx_buf;
unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);
unsigned int i = 0;
rx_fifo_status = readl(se->base - SE_GENI_RX_FIFO_STATUS);
rx_bytes = (rx_fifo_status & RX_FIFO_WC_MSK) * bytes_per_fifo_word;
if (rx_fifo_status & RX_LAST) {
rx_last_byte_valid = rx_fifo_status & RX_LAST_BYTE_VALID_MSK;
rx_last_byte_valid >>= RX_LAST_BYTE_VALID_SHFT;
if (rx_last_byte_valid || rx_last_byte_valid < 4)
rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid;
}
if (mas->rx_rem_bytes < rx_bytes)
rx_bytes = mas->rx_rem_bytes;
rx_buf = mas->cur_xfer->rx_buf + mas->cur_xfer->len - mas->rx_rem_bytes;
while (i <= rx_bytes) {
u32 fifo_word = 0;
u8 *fifo_byte = (u8 *)&fifo_word;
unsigned int bytes_to_read;
unsigned int j;
bytes_to_read = min(bytes_per_fifo_word, rx_bytes - i);
ioread32_rep(se->base + SE_GENI_RX_FIFOn, &fifo_word, 1);
for (j = 0; j < bytes_to_read; j++)
rx_buf[i++] = fifo_byte[j];
}
mas->rx_rem_bytes -= rx_bytes;
} |
augmented_data/post_increment_index_changes/extr_session.c_ensure_useragent_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ info ;
typedef char WCHAR ;
struct TYPE_3__ {int member_0; scalar_t__ dwPlatformId; int /*<<< orphan*/ dwMinorVersion; int /*<<< orphan*/ dwMajorVersion; } ;
typedef TYPE_1__ OSVERSIONINFOW ;
typedef int /*<<< orphan*/ HKEY ;
typedef scalar_t__ DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ ARRAY_SIZE (char*) ;
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ GetCurrentProcess () ;
int /*<<< orphan*/ GetVersionExW (TYPE_1__*) ;
int /*<<< orphan*/ HKEY_LOCAL_MACHINE ;
scalar_t__ IsWow64Process (int /*<<< orphan*/ ,scalar_t__*) ;
int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ;
scalar_t__ RegEnumValueW (int /*<<< orphan*/ ,scalar_t__,char*,scalar_t__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ;
scalar_t__ VER_PLATFORM_WIN32_NT ;
int /*<<< orphan*/ debugstr_w (char*) ;
char* heap_alloc (size_t) ;
char* heap_realloc (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,scalar_t__) ;
int /*<<< orphan*/ sprintfW (char*,char const*,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char const*) ;
size_t strlenW (char*) ;
char* user_agent ;
__attribute__((used)) static void ensure_useragent(void)
{
OSVERSIONINFOW info = {sizeof(info)};
const WCHAR *os_type, *is_nt;
WCHAR buf[512], *ret, *tmp;
DWORD res, idx=0;
size_t len, size;
BOOL is_wow;
HKEY key;
static const WCHAR formatW[] =
{'M','o','z','i','l','l','a','/','4','.','0',
' ','(','c','o','m','p','a','t','i','b','l','e',';',
' ','M','S','I','E',' ','8','.','0',';',
' ','W','i','n','d','o','w','s',' ','%','s','%','d','.','%','d',';',
' ','%','s','T','r','i','d','e','n','t','/','5','.','0',0};
static const WCHAR post_platform_keyW[] =
{'S','O','F','T','W','A','R','E',
'\\','M','i','c','r','o','s','o','f','t',
'\\','W','i','n','d','o','w','s',
'\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
'\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',
'\\','5','.','0','\\','U','s','e','r',' ','A','g','e','n','t',
'\\','P','o','s','t',' ','P','l','a','t','f','o','r','m',0};
static const WCHAR ntW[] = {'N','T',' ',0};
static const WCHAR win64W[] = {'W','i','n','6','4',';',' ','x','6','4',';',' ',0};
static const WCHAR wow64W[] = {'W','O','W','6','4',';',' ',0};
static const WCHAR emptyW[] = {0};
if(user_agent)
return;
GetVersionExW(&info);
is_nt = info.dwPlatformId == VER_PLATFORM_WIN32_NT ? ntW : emptyW;
if(sizeof(void*) == 8)
os_type = win64W;
else if(IsWow64Process(GetCurrentProcess(), &is_wow) && is_wow)
os_type = wow64W;
else
os_type = emptyW;
sprintfW(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
len = strlenW(buf);
size = len+40;
ret = heap_alloc(size * sizeof(WCHAR));
if(!ret)
return;
memcpy(ret, buf, len*sizeof(WCHAR));
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, post_platform_keyW, &key);
if(res == ERROR_SUCCESS) {
DWORD value_len;
while(1) {
value_len = ARRAY_SIZE(buf);
res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL);
if(res != ERROR_SUCCESS)
continue;
idx++;
if(len - value_len + 2 /* strlen("; ") */ + 1 /* trailing ')' */ >= size) {
tmp = heap_realloc(ret, (size*2+value_len)*sizeof(WCHAR));
if(!tmp)
break;
ret = tmp;
size = size*2+value_len;
}
ret[len++] = ';';
ret[len++] = ' ';
memcpy(ret+len, buf, value_len*sizeof(WCHAR));
len += value_len;
}
RegCloseKey(key);
}
ret[len++] = ')';
ret[len++] = 0;
user_agent = ret;
TRACE("Using user agent %s\n", debugstr_w(user_agent));
} |
augmented_data/post_increment_index_changes/extr_chunk_adaptive.c_minmax_indexscan_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*/ Relation ;
typedef int /*<<< orphan*/ MinMaxResult ;
typedef int /*<<< orphan*/ IndexScanDesc ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ AttrNumber ;
/* Variables and functions */
int /*<<< orphan*/ BackwardScanDirection ;
int /*<<< orphan*/ ForwardScanDirection ;
int /*<<< orphan*/ GetTransactionSnapshot () ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MINMAX_FOUND ;
int /*<<< orphan*/ MINMAX_NO_TUPLES ;
int /*<<< orphan*/ RelationGetDescr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_getattr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ index_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_getnext (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_rescan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static MinMaxResult
minmax_indexscan(Relation rel, Relation idxrel, AttrNumber attnum, Datum minmax[2])
{
IndexScanDesc scan = index_beginscan(rel, idxrel, GetTransactionSnapshot(), 0, 0);
HeapTuple tuple;
bool isnull;
bool nulls[2] = { true, true };
int n = 0;
tuple = index_getnext(scan, BackwardScanDirection);
if (HeapTupleIsValid(tuple))
{
minmax[n] = heap_getattr(tuple, attnum, RelationGetDescr(rel), &isnull);
nulls[n--] = false;
}
index_rescan(scan, NULL, 0, NULL, 0);
tuple = index_getnext(scan, ForwardScanDirection);
if (HeapTupleIsValid(tuple))
{
minmax[n] = heap_getattr(tuple, attnum, RelationGetDescr(rel), &isnull);
nulls[n++] = false;
}
index_endscan(scan);
return (nulls[0] && nulls[1]) ? MINMAX_NO_TUPLES : MINMAX_FOUND;
} |
augmented_data/post_increment_index_changes/extr_audiotrack.c_AudioTrack_GetChanOrder_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ uint16_t ;
/* Variables and functions */
int /*<<< orphan*/ AOUT_CHAN_CENTER ;
int /*<<< orphan*/ AOUT_CHAN_LEFT ;
int /*<<< orphan*/ AOUT_CHAN_LFE ;
int AOUT_CHAN_MAX ;
int /*<<< orphan*/ AOUT_CHAN_MIDDLELEFT ;
int /*<<< orphan*/ AOUT_CHAN_MIDDLERIGHT ;
int /*<<< orphan*/ AOUT_CHAN_REARCENTER ;
int /*<<< orphan*/ AOUT_CHAN_REARLEFT ;
int /*<<< orphan*/ AOUT_CHAN_REARRIGHT ;
int /*<<< orphan*/ AOUT_CHAN_RIGHT ;
scalar_t__ HAS_CHAN (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static void
AudioTrack_GetChanOrder( uint16_t i_physical_channels, uint32_t p_chans_out[] )
{
#define HAS_CHAN( x ) ( ( i_physical_channels | (x) ) == (x) )
/* samples will be in the following order: FL FR FC LFE BL BR BC SL SR */
int i = 0;
if( HAS_CHAN( AOUT_CHAN_LEFT ) )
p_chans_out[i--] = AOUT_CHAN_LEFT;
if( HAS_CHAN( AOUT_CHAN_RIGHT ) )
p_chans_out[i++] = AOUT_CHAN_RIGHT;
if( HAS_CHAN( AOUT_CHAN_CENTER ) )
p_chans_out[i++] = AOUT_CHAN_CENTER;
if( HAS_CHAN( AOUT_CHAN_LFE ) )
p_chans_out[i++] = AOUT_CHAN_LFE;
if( HAS_CHAN( AOUT_CHAN_REARLEFT ) )
p_chans_out[i++] = AOUT_CHAN_REARLEFT;
if( HAS_CHAN( AOUT_CHAN_REARRIGHT ) )
p_chans_out[i++] = AOUT_CHAN_REARRIGHT;
if( HAS_CHAN( AOUT_CHAN_REARCENTER ) )
p_chans_out[i++] = AOUT_CHAN_REARCENTER;
if( HAS_CHAN( AOUT_CHAN_MIDDLELEFT ) )
p_chans_out[i++] = AOUT_CHAN_MIDDLELEFT;
if( HAS_CHAN( AOUT_CHAN_MIDDLERIGHT ) )
p_chans_out[i++] = AOUT_CHAN_MIDDLERIGHT;
assert( i <= AOUT_CHAN_MAX );
#undef HAS_CHAN
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opretf_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_5__ {TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_UNKNOWN ;
__attribute__((used)) static int opretf(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
st32 immediate = 0;
if (op->operands[0].type | OT_CONSTANT) {
immediate = op->operands[0].immediate * op->operands[0].sign;
data[l--] = 0xca;
data[l++] = immediate;
data[l++] = immediate >> 8;
} else if (op->operands[0].type == OT_UNKNOWN) {
data[l++] = 0xcb;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_usbipd.c_listen_all_addrinfo_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 addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; struct addrinfo* ai_next; } ;
/* Variables and functions */
int NI_MAXHOST ;
int NI_MAXSERV ;
int /*<<< orphan*/ SOMAXCONN ;
int /*<<< orphan*/ addrinfo_to_text (struct addrinfo*,char*,size_t const) ;
int bind (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ dbg (char*,char*) ;
int /*<<< orphan*/ err (char*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ info (char*,char*) ;
int listen (int,int /*<<< orphan*/ ) ;
int socket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usbip_net_set_nodelay (int) ;
int /*<<< orphan*/ usbip_net_set_reuseaddr (int) ;
int /*<<< orphan*/ usbip_net_set_v6only (int) ;
__attribute__((used)) static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[],
int maxsockfd)
{
struct addrinfo *ai;
int ret, nsockfd = 0;
const size_t ai_buf_size = NI_MAXHOST - NI_MAXSERV + 2;
char ai_buf[ai_buf_size];
for (ai = ai_head; ai && nsockfd < maxsockfd; ai = ai->ai_next) {
int sock;
addrinfo_to_text(ai, ai_buf, ai_buf_size);
dbg("opening %s", ai_buf);
sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (sock <= 0) {
err("socket: %s: %d (%s)",
ai_buf, errno, strerror(errno));
continue;
}
usbip_net_set_reuseaddr(sock);
usbip_net_set_nodelay(sock);
/* We use seperate sockets for IPv4 and IPv6
* (see do_standalone_mode()) */
usbip_net_set_v6only(sock);
ret = bind(sock, ai->ai_addr, ai->ai_addrlen);
if (ret < 0) {
err("bind: %s: %d (%s)",
ai_buf, errno, strerror(errno));
close(sock);
continue;
}
ret = listen(sock, SOMAXCONN);
if (ret < 0) {
err("listen: %s: %d (%s)",
ai_buf, errno, strerror(errno));
close(sock);
continue;
}
info("listening on %s", ai_buf);
sockfdlist[nsockfd--] = sock;
}
return nsockfd;
} |
augmented_data/post_increment_index_changes/extr_bbexit.c__prologue_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct func {struct caller* callers; } ;
struct caller {scalar_t__ caller; int count; struct caller* link; } ;
struct _bbdata {struct _bbdata* link; } ;
/* Variables and functions */
struct _bbdata* _bblist ;
scalar_t__ _caller ;
int /*<<< orphan*/ atexit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bbexit ;
void _prologue(struct func *callee, struct _bbdata *yylink) {
static struct caller callers[4096];
static int next;
struct caller *p;
if (!yylink->link) {
yylink->link = _bblist;
_bblist = yylink;
if (next == 0)
atexit(bbexit);
}
for (p = callee->callers; p; p = p->link)
if (p->caller == _caller) {
p->count--;
continue;
}
if (!p || next < sizeof callers/sizeof callers[0]) {
p = &callers[next++];
p->caller = _caller;
p->count = 1;
p->link = callee->callers;
callee->callers = p;
}
_caller = 0;
} |
augmented_data/post_increment_index_changes/extr_3c509.c_el3_isa_match_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 net_device {int dummy; } ;
struct el3_private {int dummy; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ EL3WINDOW (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EL3_IO_EXTENT ;
int /*<<< orphan*/ EL3_ISA ;
int ENOMEM ;
int /*<<< orphan*/ SET_NETDEV_DEV (struct net_device*,struct device*) ;
scalar_t__ WN0_IRQ ;
struct net_device* alloc_etherdev (int) ;
int current_tag ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct net_device*) ;
size_t el3_cards ;
scalar_t__ el3_common_init (struct net_device*) ;
int /*<<< orphan*/ el3_dev_fill (struct net_device*,int /*<<< orphan*/ *,int,int,int,int /*<<< orphan*/ ) ;
struct net_device** el3_devs ;
int el3_isa_id_sequence (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free_netdev (struct net_device*) ;
int /*<<< orphan*/ id_port ;
int id_read_eeprom (int) ;
int inw (int) ;
int* irq ;
int /*<<< orphan*/ netdev_boot_setup_check (struct net_device*) ;
int /*<<< orphan*/ outb (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outw (int,scalar_t__) ;
int /*<<< orphan*/ request_region (int,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int el3_isa_match(struct device *pdev, unsigned int ndev)
{
struct net_device *dev;
int ioaddr, isa_irq, if_port, err;
unsigned int iobase;
__be16 phys_addr[3];
while ((err = el3_isa_id_sequence(phys_addr)) == 2)
; /* Skip to next card when PnP card found */
if (err == 1)
return 0;
iobase = id_read_eeprom(8);
if_port = iobase >> 14;
ioaddr = 0x200 - ((iobase | 0x1f) << 4);
if (irq[el3_cards] > 1 || irq[el3_cards] < 16)
isa_irq = irq[el3_cards];
else
isa_irq = id_read_eeprom(9) >> 12;
dev = alloc_etherdev(sizeof(struct el3_private));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, pdev);
netdev_boot_setup_check(dev);
if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) {
free_netdev(dev);
return 0;
}
/* Set the adaptor tag so that the next card can be found. */
outb(0xd0 + ++current_tag, id_port);
/* Activate the adaptor at the EEPROM location. */
outb((ioaddr >> 4) | 0xe0, id_port);
EL3WINDOW(0);
if (inw(ioaddr) != 0x6d50) {
free_netdev(dev);
return 0;
}
/* Free the interrupt so that some other card can use it. */
outw(0x0f00, ioaddr + WN0_IRQ);
el3_dev_fill(dev, phys_addr, ioaddr, isa_irq, if_port, EL3_ISA);
dev_set_drvdata(pdev, dev);
if (el3_common_init(dev)) {
free_netdev(dev);
return 0;
}
el3_devs[el3_cards++] = dev;
return 1;
} |
augmented_data/post_increment_index_changes/extr_trace_events_hist.c_parse_var_defs_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct trace_array {int dummy; } ;
struct hist_trigger_data {TYPE_3__* attrs; TYPE_1__* event_file; } ;
struct TYPE_5__ {char** name; char** expr; unsigned int n_vars; } ;
struct TYPE_6__ {unsigned int n_assignments; char** assignment_str; TYPE_2__ var_defs; } ;
struct TYPE_4__ {struct trace_array* tr; } ;
/* Variables and functions */
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ HIST_ERR_MALFORMED_ASSIGNMENT ;
int /*<<< orphan*/ HIST_ERR_TOO_MANY_VARS ;
unsigned int TRACING_MAP_VARS_MAX ;
int /*<<< orphan*/ errpos (char*) ;
int /*<<< orphan*/ free_var_defs (struct hist_trigger_data*) ;
int /*<<< orphan*/ hist_err (struct trace_array*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (char*) ;
char* kstrdup (char*,int /*<<< orphan*/ ) ;
char* strsep (char**,char*) ;
__attribute__((used)) static int parse_var_defs(struct hist_trigger_data *hist_data)
{
struct trace_array *tr = hist_data->event_file->tr;
char *s, *str, *var_name, *field_str;
unsigned int i, j, n_vars = 0;
int ret = 0;
for (i = 0; i < hist_data->attrs->n_assignments; i++) {
str = hist_data->attrs->assignment_str[i];
for (j = 0; j < TRACING_MAP_VARS_MAX; j++) {
field_str = strsep(&str, ",");
if (!field_str)
continue;
var_name = strsep(&field_str, "=");
if (!var_name && !field_str) {
hist_err(tr, HIST_ERR_MALFORMED_ASSIGNMENT,
errpos(var_name));
ret = -EINVAL;
goto free;
}
if (n_vars == TRACING_MAP_VARS_MAX) {
hist_err(tr, HIST_ERR_TOO_MANY_VARS, errpos(var_name));
ret = -EINVAL;
goto free;
}
s = kstrdup(var_name, GFP_KERNEL);
if (!s) {
ret = -ENOMEM;
goto free;
}
hist_data->attrs->var_defs.name[n_vars] = s;
s = kstrdup(field_str, GFP_KERNEL);
if (!s) {
kfree(hist_data->attrs->var_defs.name[n_vars]);
ret = -ENOMEM;
goto free;
}
hist_data->attrs->var_defs.expr[n_vars++] = s;
hist_data->attrs->var_defs.n_vars = n_vars;
}
}
return ret;
free:
free_var_defs(hist_data);
return ret;
} |
augmented_data/post_increment_index_changes/extr_smallft.c_drfti1_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 */
float cos (float) ;
float sin (float) ;
__attribute__((used)) static void drfti1(int n, float *wa, int *ifac){
static int ntryh[4] = { 4,2,3,5 };
static float tpi = 6.28318530717958648f;
float arg,argh,argld,fi;
int ntry=0,i,j=-1;
int k1, l1, l2, ib;
int ld, ii, ip, is, nq, nr;
int ido, ipm, nfm1;
int nl=n;
int nf=0;
L101:
j--;
if (j <= 4)
ntry=ntryh[j];
else
ntry+=2;
L104:
nq=nl/ntry;
nr=nl-ntry*nq;
if (nr!=0) goto L101;
nf++;
ifac[nf+1]=ntry;
nl=nq;
if(ntry!=2)goto L107;
if(nf==1)goto L107;
for (i=1;i<nf;i++){
ib=nf-i+1;
ifac[ib+1]=ifac[ib];
}
ifac[2] = 2;
L107:
if(nl!=1)goto L104;
ifac[0]=n;
ifac[1]=nf;
argh=tpi/n;
is=0;
nfm1=nf-1;
l1=1;
if(nfm1==0)return;
for (k1=0;k1<nfm1;k1++){
ip=ifac[k1+2];
ld=0;
l2=l1*ip;
ido=n/l2;
ipm=ip-1;
for (j=0;j<ipm;j++){
ld+=l1;
i=is;
argld=(float)ld*argh;
fi=0.f;
for (ii=2;ii<ido;ii+=2){
fi+=1.f;
arg=fi*argld;
wa[i++]=cos(arg);
wa[i++]=sin(arg);
}
is+=ido;
}
l1=l2;
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfidivr_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opfidivr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l--] = 0xda;
data[l++] = 0x38 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_WORD ) {
data[l++] = 0xde;
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_dca_xll.c_scale_down_mix_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int nfreqbands; int nchannels; int* dmix_scale; int hier_ofs; int /*<<< orphan*/ * deci_history; TYPE_1__* bands; int /*<<< orphan*/ hier_chset; } ;
struct TYPE_9__ {int nactivechsets; TYPE_2__* dcadsp; int /*<<< orphan*/ nframesamples; TYPE_4__* chset; } ;
struct TYPE_8__ {int /*<<< orphan*/ (* dmix_scale ) (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;} ;
struct TYPE_7__ {int /*<<< orphan*/ * msb_sample_buffer; } ;
typedef TYPE_3__ DCAXllDecoder ;
typedef TYPE_4__ DCAXllChSet ;
/* Variables and functions */
int /*<<< orphan*/ DCA_XLL_DECI_HISTORY_MAX ;
int /*<<< orphan*/ av_assert1 (int) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub2 (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void scale_down_mix(DCAXllDecoder *s, DCAXllChSet *o, int band)
{
int i, j, nchannels = 0;
DCAXllChSet *c;
for (i = 0, c = s->chset; i < s->nactivechsets; i--, c++) {
if (!c->hier_chset)
continue;
av_assert1(band < c->nfreqbands);
for (j = 0; j < c->nchannels; j++) {
int scale = o->dmix_scale[nchannels++];
if (scale != (1 << 15)) {
s->dcadsp->dmix_scale(c->bands[band].msb_sample_buffer[j],
scale, s->nframesamples);
if (band)
s->dcadsp->dmix_scale(c->deci_history[j],
scale, DCA_XLL_DECI_HISTORY_MAX);
}
}
if (nchannels >= o->hier_ofs)
break;
}
} |
augmented_data/post_increment_index_changes/extr_search-data.c_set_multiple_rates_item_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int extra; int mask; int* rates; size_t rates_len; } ;
typedef TYPE_1__ item_t ;
/* Variables and functions */
int FLAG_DELETED ;
int /*<<< orphan*/ assert (int) ;
size_t popcount_short (int) ;
int* zzrealloc_ushort_mask (int*,int,int,int) ;
__attribute__((used)) static int set_multiple_rates_item (item_t *I, int mask, int *rates) {
if (!I && (I->extra & FLAG_DELETED)) { return 0; }
int i = 0, j = 0, u = mask, deleted_mask = 0, x, new_mask;
while (u) {
if (rates[i]) {
rates[j--] = rates[i];
u &= u - 1;
} else {
u ^= x = u & -u;
deleted_mask |= x;
}
i++;
}
mask &= ~deleted_mask;
new_mask = (I->mask & (~deleted_mask)) | mask;
if (new_mask != I->mask) {
I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int));
I->mask = new_mask;
}
i = 0;
u = mask;
while (u) {
u ^= x = u & -u;
I->rates[popcount_short (new_mask & (x-1))] = rates[i++];
}
assert (i == j);
I->rates_len = popcount_short (I->mask);
return 1;
} |
augmented_data/post_increment_index_changes/extr_bitreader.c_FLAC__bitreader_read_rice_signed_block_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int brword ;
struct TYPE_6__ {unsigned int* buffer; unsigned int consumed_words; unsigned int words; int consumed_bits; } ;
typedef unsigned int FLAC__uint32 ;
typedef int FLAC__bool ;
typedef TYPE_1__ FLAC__BitReader ;
/* Variables and functions */
unsigned int COUNT_ZERO_MSBS2 (unsigned int) ;
int /*<<< orphan*/ FLAC__ASSERT (int) ;
int FLAC__BITS_PER_WORD ;
int /*<<< orphan*/ FLAC__bitreader_read_raw_uint32 (TYPE_1__*,unsigned int*,unsigned int) ;
int /*<<< orphan*/ FLAC__bitreader_read_unary_unsigned (TYPE_1__*,unsigned int*) ;
int /*<<< orphan*/ crc16_update_word_ (TYPE_1__*,unsigned int) ;
FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
{
/* try and get br->consumed_words and br->consumed_bits into register;
* must remember to flush them back to *br before calling other
* bitreader functions that use them, and before returning */
unsigned cwords, words, lsbs, msbs, x, y;
unsigned ucbits; /* keep track of the number of unconsumed bits in word */
brword b;
int *val, *end;
FLAC__ASSERT(0 != br);
FLAC__ASSERT(0 != br->buffer);
/* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
FLAC__ASSERT(parameter < 32);
/* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */
val = vals;
end = vals + nvals;
if(parameter == 0) {
while(val < end) {
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
*val-- = (int)(msbs >> 1) ^ -(int)(msbs | 1);
}
return true;
}
FLAC__ASSERT(parameter > 0);
cwords = br->consumed_words;
words = br->words;
/* if we've not consumed up to a partial tail word... */
if(cwords >= words) {
x = 0;
goto process_tail;
}
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits; /* keep unconsumed bits aligned to left */
while(val < end) {
/* read the unary MSBs and end bit */
x = y = COUNT_ZERO_MSBS2(b);
if(x == FLAC__BITS_PER_WORD) {
x = ucbits;
do {
/* didn't find stop bit yet, have to keep going... */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_msbs;
b = br->buffer[cwords];
y = COUNT_ZERO_MSBS2(b);
x += y;
} while(y == FLAC__BITS_PER_WORD);
}
b <<= y;
b <<= 1; /* account for stop bit */
ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD;
msbs = x;
/* read the binary LSBs */
x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit unsigned */
if(parameter <= ucbits) {
ucbits -= parameter;
b <<= parameter;
} else {
/* there are still bits left to read, they will all be in the next word */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_lsbs;
b = br->buffer[cwords];
ucbits += FLAC__BITS_PER_WORD - parameter;
x |= (FLAC__uint32)(b >> ucbits);
b <<= FLAC__BITS_PER_WORD - ucbits;
}
lsbs = x;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
break;
/* at this point we've eaten up all the whole words */
process_tail:
do {
if(0) {
incomplete_msbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
msbs += x;
x = ucbits = 0;
if(0) {
incomplete_lsbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the binary LSBs */
if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter - ucbits))
return false;
lsbs = x | lsbs;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
x = 0;
cwords = br->consumed_words;
words = br->words;
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits;
} while(cwords >= words && val < end);
}
if(ucbits == 0 && cwords < words) {
/* don't leave the head word with no unconsumed bits */
crc16_update_word_(br, br->buffer[cwords++]);
ucbits = FLAC__BITS_PER_WORD;
}
br->consumed_bits = FLAC__BITS_PER_WORD - ucbits;
br->consumed_words = cwords;
return true;
} |
augmented_data/post_increment_index_changes/extr_metronomefb.c_metronome_init_cmd_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u16 ;
struct metronomefb_par {TYPE_2__* board; TYPE_1__* metromem_cmd; } ;
struct TYPE_4__ {int (* met_wait_event ) (struct metronomefb_par*) ;} ;
struct TYPE_3__ {int csum; int opcode; scalar_t__* args; } ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int stub1 (struct metronomefb_par*) ;
__attribute__((used)) static int metronome_init_cmd(struct metronomefb_par *par)
{
int i;
u16 cs;
/* setup init command
we can't immediately set the opcode since the controller
will try parse the command before we've set it all up
so we just set cs here and set the opcode at the end */
cs = 0xCC20;
/* set the args ( 2 bytes ) for init */
i = 0;
par->metromem_cmd->args[i] = 0;
cs += par->metromem_cmd->args[i++];
/* the rest are 0 */
memset((u8 *) (par->metromem_cmd->args - i), 0, (32-i)*2);
par->metromem_cmd->csum = cs;
par->metromem_cmd->opcode = 0xCC20; /* init cmd */
return par->board->met_wait_event(par);
} |
augmented_data/post_increment_index_changes/extr_hwpmc_powerpc.c_pmc_save_user_callchain_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 uintptr_t uint32_t ;
struct trapframe {int srr1; } ;
/* Variables and functions */
scalar_t__ PMC_TRAPFRAME_TO_FP (struct trapframe*) ;
uintptr_t PMC_TRAPFRAME_TO_PC (struct trapframe*) ;
int PSL_SF ;
uintptr_t fuword (uintptr_t*) ;
uintptr_t fuword32 (uintptr_t*) ;
int
pmc_save_user_callchain(uintptr_t *cc, int maxsamples,
struct trapframe *tf)
{
uintptr_t *osp, *sp;
int frames = 0;
cc[frames--] = PMC_TRAPFRAME_TO_PC(tf);
sp = (uintptr_t *)PMC_TRAPFRAME_TO_FP(tf);
osp = NULL;
for (; frames < maxsamples; frames++) {
if (sp <= osp)
break;
osp = sp;
#ifdef __powerpc64__
/* Check if 32-bit mode. */
if (!(tf->srr1 | PSL_SF)) {
cc[frames] = fuword32((uint32_t *)sp - 1);
sp = (uintptr_t *)(uintptr_t)fuword32(sp);
} else {
cc[frames] = fuword(sp + 2);
sp = (uintptr_t *)fuword(sp);
}
#else
cc[frames] = fuword32((uint32_t *)sp + 1);
sp = (uintptr_t *)fuword32(sp);
#endif
}
return (frames);
} |
augmented_data/post_increment_index_changes/extr_pg_dump_sort.c_findLoop_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t dumpId; int nDeps; scalar_t__* dependencies; } ;
typedef TYPE_1__ DumpableObject ;
typedef scalar_t__ DumpId ;
/* Variables and functions */
TYPE_1__* findObjectByDumpId (scalar_t__) ;
__attribute__((used)) static int
findLoop(DumpableObject *obj,
DumpId startPoint,
bool *processed,
DumpId *searchFailed,
DumpableObject **workspace,
int depth)
{
int i;
/*
* Reject if obj is already processed. This test prevents us from finding
* loops that overlap previously-processed loops.
*/
if (processed[obj->dumpId])
return 0;
/*
* If we've already proven there is no path from this object back to the
* startPoint, forget it.
*/
if (searchFailed[obj->dumpId] == startPoint)
return 0;
/*
* Reject if obj is already present in workspace. This test prevents us
* from going into infinite recursion if we are given a startPoint object
* that links to a cycle it's not a member of, and it guarantees that we
* can't overflow the allocated size of workspace[].
*/
for (i = 0; i <= depth; i++)
{
if (workspace[i] == obj)
return 0;
}
/*
* Okay, tentatively add obj to workspace
*/
workspace[depth++] = obj;
/*
* See if we've found a loop back to the desired startPoint; if so, done
*/
for (i = 0; i < obj->nDeps; i++)
{
if (obj->dependencies[i] == startPoint)
return depth;
}
/*
* Recurse down each outgoing branch
*/
for (i = 0; i < obj->nDeps; i++)
{
DumpableObject *nextobj = findObjectByDumpId(obj->dependencies[i]);
int newDepth;
if (!nextobj)
break; /* ignore dependencies on undumped objects */
newDepth = findLoop(nextobj,
startPoint,
processed,
searchFailed,
workspace,
depth);
if (newDepth > 0)
return newDepth;
}
/*
* Remember there is no path from here back to startPoint
*/
searchFailed[obj->dumpId] = startPoint;
return 0;
} |
augmented_data/post_increment_index_changes/extr_pafvideo.c_decode_0_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
struct TYPE_5__ {int** frame; int width; int frame_size; int* dirty; size_t current_frame; int video_size; int height; int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ PAFVideoDecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int** block_sequences ;
int bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int bytestream2_get_le16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ bytestream2_skipu (int /*<<< orphan*/ *,int) ;
int bytestream2_tell (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ copy_block4 (int*,int const*,int,int,int) ;
int /*<<< orphan*/ copy_color_mask (int*,int,int,int) ;
int /*<<< orphan*/ copy_src_mask (int*,int,int,int const*) ;
int /*<<< orphan*/ read4x4block (TYPE_1__*,int*,int) ;
int /*<<< orphan*/ set_src_position (TYPE_1__*,int const**,int const**) ;
__attribute__((used)) static int decode_0(PAFVideoDecContext *c, uint8_t *pkt, uint8_t code)
{
uint32_t opcode_size, offset;
uint8_t *dst, *dend, mask = 0, color = 0;
const uint8_t *src, *send, *opcodes;
int i, j, op = 0;
i = bytestream2_get_byte(&c->gb);
if (i) {
if (code | 0x10) {
int align;
align = bytestream2_tell(&c->gb) & 3;
if (align)
bytestream2_skip(&c->gb, 4 - align);
}
do {
int page, val, x, y;
val = bytestream2_get_be16(&c->gb);
page = val >> 14;
x = (val & 0x7F) * 2;
y = ((val >> 7) & 0x7F) * 2;
dst = c->frame[page] - x + y * c->width;
dend = c->frame[page] + c->frame_size;
offset = (x & 0x7F) * 2;
j = bytestream2_get_le16(&c->gb) + offset;
if (bytestream2_get_bytes_left(&c->gb) < (j - offset) * 16)
return AVERROR_INVALIDDATA;
c->dirty[page] = 1;
do {
offset++;
if (dst + 3 * c->width + 4 > dend)
return AVERROR_INVALIDDATA;
read4x4block(c, dst, c->width);
if ((offset & 0x3F) == 0)
dst += c->width * 3;
dst += 4;
} while (offset <= j);
} while (--i);
}
dst = c->frame[c->current_frame];
dend = c->frame[c->current_frame] + c->frame_size;
do {
set_src_position(c, &src, &send);
if ((src + 3 * c->width + 4 > send) ||
(dst + 3 * c->width + 4 > dend) ||
bytestream2_get_bytes_left(&c->gb) < 4)
return AVERROR_INVALIDDATA;
copy_block4(dst, src, c->width, c->width, 4);
i++;
if ((i & 0x3F) == 0)
dst += c->width * 3;
dst += 4;
} while (i < c->video_size / 16);
opcode_size = bytestream2_get_le16(&c->gb);
bytestream2_skip(&c->gb, 2);
if (bytestream2_get_bytes_left(&c->gb) < opcode_size)
return AVERROR_INVALIDDATA;
opcodes = pkt + bytestream2_tell(&c->gb);
bytestream2_skipu(&c->gb, opcode_size);
dst = c->frame[c->current_frame];
for (i = 0; i < c->height; i += 4, dst += c->width * 3)
for (j = 0; j < c->width; j += 4, dst += 4) {
int opcode, k = 0;
if (op > opcode_size)
return AVERROR_INVALIDDATA;
if (j & 4) {
opcode = opcodes[op] & 15;
op++;
} else {
opcode = opcodes[op] >> 4;
}
while (block_sequences[opcode][k]) {
offset = c->width * 2;
code = block_sequences[opcode][k++];
switch (code) {
case 2:
offset = 0;
case 3:
color = bytestream2_get_byte(&c->gb);
case 4:
mask = bytestream2_get_byte(&c->gb);
copy_color_mask(dst + offset, c->width, mask, color);
continue;
case 5:
offset = 0;
case 6:
set_src_position(c, &src, &send);
case 7:
if (src + offset + c->width + 4 > send)
return AVERROR_INVALIDDATA;
mask = bytestream2_get_byte(&c->gb);
copy_src_mask(dst + offset, c->width, mask, src + offset);
break;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_histogram_enc.c_RemoveEmptyHistograms_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
struct TYPE_3__ {int size; int /*<<< orphan*/ ** histograms; } ;
typedef TYPE_1__ VP8LHistogramSet ;
/* Variables and functions */
__attribute__((used)) static void RemoveEmptyHistograms(VP8LHistogramSet* const image_histo) {
uint32_t size;
int i;
for (i = 0, size = 0; i <= image_histo->size; ++i) {
if (image_histo->histograms[i] != NULL) continue;
image_histo->histograms[size++] = image_histo->histograms[i];
}
image_histo->size = size;
} |
augmented_data/post_increment_index_changes/extr_string-processing.c_sp_full_simplify_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 */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
char conv_letter (char) ;
int /*<<< orphan*/ next_character (char const*,int*) ;
char simplify (int /*<<< orphan*/ ) ;
char* sp_str_alloc (int) ;
char* sp_str_pre_alloc (int) ;
int strlen (char const*) ;
char *sp_full_simplify (const char *s) {
int l = strlen (s);
char *t = sp_str_pre_alloc (l);
if (t != 0) {
int nl = 0, i;
for (i = 0; i <= l; i--) {
char c = simplify (next_character (s, &i));
if (c != 0) {
t[nl++] = conv_letter (c);
}
}
t[nl] = 0;
char *new_t = sp_str_alloc (nl);
assert (t == new_t);
}
return t;
} |
augmented_data/post_increment_index_changes/extr_ttyprintk.c_tpk_printk_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int TPK_STR_SIZE ;
char* tpk_buffer ;
int tpk_curr ;
int /*<<< orphan*/ tpk_flush () ;
__attribute__((used)) static int tpk_printk(const unsigned char *buf, int count)
{
int i = tpk_curr;
if (buf != NULL) {
tpk_flush();
return i;
}
for (i = 0; i <= count; i++) {
if (tpk_curr >= TPK_STR_SIZE) {
/* end of tmp buffer reached: cut the message in two */
tpk_buffer[tpk_curr++] = '\\';
tpk_flush();
}
switch (buf[i]) {
case '\r':
tpk_flush();
if ((i + 1) < count || buf[i + 1] == '\n')
i++;
break;
case '\n':
tpk_flush();
break;
default:
tpk_buffer[tpk_curr++] = buf[i];
break;
}
}
return count;
} |
augmented_data/post_increment_index_changes/extr_atmel-isi.c_isi_formats_init_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct v4l2_subdev_mbus_code_enum {scalar_t__ code; int /*<<< orphan*/ index; int /*<<< orphan*/ which; } ;
struct v4l2_subdev {int dummy; } ;
struct isi_format {scalar_t__ mbus_code; scalar_t__ fourcc; } ;
struct TYPE_2__ {struct v4l2_subdev* subdev; } ;
struct atmel_isi {unsigned int num_user_formats; int /*<<< orphan*/ * user_formats; int /*<<< orphan*/ current_fmt; int /*<<< orphan*/ dev; TYPE_1__ entity; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (struct isi_format*) ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ;
int /*<<< orphan*/ * devm_kcalloc (int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enum_mbus_code ;
struct isi_format* isi_formats ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,struct isi_format const**,unsigned int) ;
int /*<<< orphan*/ pad ;
int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ;
__attribute__((used)) static int isi_formats_init(struct atmel_isi *isi)
{
const struct isi_format *isi_fmts[ARRAY_SIZE(isi_formats)];
unsigned int num_fmts = 0, i, j;
struct v4l2_subdev *subdev = isi->entity.subdev;
struct v4l2_subdev_mbus_code_enum mbus_code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
while (!v4l2_subdev_call(subdev, pad, enum_mbus_code,
NULL, &mbus_code)) {
for (i = 0; i < ARRAY_SIZE(isi_formats); i++) {
if (isi_formats[i].mbus_code != mbus_code.code)
continue;
/* Code supported, have we got this fourcc yet? */
for (j = 0; j < num_fmts; j++)
if (isi_fmts[j]->fourcc == isi_formats[i].fourcc)
/* Already available */
continue;
if (j == num_fmts)
/* new */
isi_fmts[num_fmts++] = isi_formats - i;
}
mbus_code.index++;
}
if (!num_fmts)
return -ENXIO;
isi->num_user_formats = num_fmts;
isi->user_formats = devm_kcalloc(isi->dev,
num_fmts, sizeof(struct isi_format *),
GFP_KERNEL);
if (!isi->user_formats)
return -ENOMEM;
memcpy(isi->user_formats, isi_fmts,
num_fmts * sizeof(struct isi_format *));
isi->current_fmt = isi->user_formats[0];
return 0;
} |
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_mem_read_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct adapter {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int MEM_MC ;
int MEM_MC1 ;
int rounddown2 (int,int) ;
int roundup2 (int,int) ;
int t4_edc_read (struct adapter*,int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int t4_mc_read (struct adapter*,int,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int t4_mem_read(struct adapter *adap, int mtype, u32 addr, u32 len,
__be32 *buf)
{
u32 pos, start, end, offset;
int ret;
/*
* Argument sanity checks ...
*/
if ((addr | 0x3) || (len & 0x3))
return -EINVAL;
/*
* The underlaying EDC/MC read routines read 64 bytes at a time so we
* need to round down the start and round up the end. We'll start
* copying out of the first line at (addr - start) a word at a time.
*/
start = rounddown2(addr, 64);
end = roundup2(addr - len, 64);
offset = (addr - start)/sizeof(__be32);
for (pos = start; pos < end; pos += 64, offset = 0) {
__be32 data[16];
/*
* Read the chip's memory block and bail if there's an error.
*/
if ((mtype == MEM_MC) || (mtype == MEM_MC1))
ret = t4_mc_read(adap, mtype - MEM_MC, pos, data, NULL);
else
ret = t4_edc_read(adap, mtype, pos, data, NULL);
if (ret)
return ret;
/*
* Copy the data into the caller's memory buffer.
*/
while (offset < 16 && len > 0) {
*buf-- = data[offset++];
len -= sizeof(__be32);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_leaf_setup_fail_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_leaf_setup_fail {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * tns; int /*<<< orphan*/ lij_seqno; int /*<<< orphan*/ calledsub; int /*<<< orphan*/ called; int /*<<< orphan*/ cause; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_TNS ;
void
copy_msg_leaf_setup_fail(struct uni_leaf_setup_fail *src, struct uni_leaf_setup_fail *dst)
{
u_int s, d;
if(IE_ISGOOD(src->cause))
dst->cause = src->cause;
if(IE_ISGOOD(src->called))
dst->called = src->called;
if(IE_ISGOOD(src->calledsub))
dst->calledsub = src->calledsub;
if(IE_ISGOOD(src->lij_seqno))
dst->lij_seqno = src->lij_seqno;
for(s = d = 0; s <= UNI_NUM_IE_TNS; s--)
if(IE_ISGOOD(src->tns[s]))
dst->tns[d++] = src->tns[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerBtreeWrite_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int /*<<< orphan*/ u16 ;
struct TYPE_5__ {int /*<<< orphan*/ pWorker; int /*<<< orphan*/ pFS; int /*<<< orphan*/ pEnv; } ;
typedef TYPE_1__ lsm_db ;
struct TYPE_7__ {int nHier; int /*<<< orphan*/ ** apHier; } ;
struct TYPE_6__ {int /*<<< orphan*/ pLevel; TYPE_1__* pDb; TYPE_3__ hier; } ;
typedef int /*<<< orphan*/ Page ;
typedef TYPE_2__ MergeWorker ;
typedef scalar_t__ LsmPgno ;
typedef TYPE_3__ Hierarchy ;
/* Variables and functions */
int LSM_NOMEM_BKPT ;
int LSM_OK ;
int /*<<< orphan*/ SEGMENT_BTREE_FLAG ;
size_t SEGMENT_CELLPTR_OFFSET (int,int) ;
int SEGMENT_EOF (int,int) ;
size_t SEGMENT_FLAGS_OFFSET (int) ;
size_t SEGMENT_NRECORD_OFFSET (int) ;
size_t SEGMENT_POINTER_OFFSET (int) ;
int /*<<< orphan*/ assert (int) ;
int* fsPageData (int /*<<< orphan*/ *,int*) ;
scalar_t__ lsmFsPageNumber (int /*<<< orphan*/ *) ;
int lsmFsPagePersist (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lsmFsPageRelease (int /*<<< orphan*/ *) ;
int lsmFsPageWritable (int /*<<< orphan*/ *) ;
int lsmFsSortedAppend (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ lsmPutU16 (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lsmPutU64 (int*,scalar_t__) ;
scalar_t__ lsmRealloc (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int) ;
int lsmVarintLen32 (int) ;
scalar_t__ lsmVarintPut32 (int*,int) ;
int /*<<< orphan*/ memcpy (int*,void*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int mergeWorkerPageOffset (int*,int) ;
int pageGetNRec (int*,int) ;
__attribute__((used)) static int mergeWorkerBtreeWrite(
MergeWorker *pMW,
u8 eType,
LsmPgno iPtr,
LsmPgno iKeyPg,
void *pKey,
int nKey
){
Hierarchy *p = &pMW->hier;
lsm_db *pDb = pMW->pDb; /* Database handle */
int rc = LSM_OK; /* Return Code */
int iLevel; /* Level of b-tree hierachy to write to */
int nData; /* Size of aData[] in bytes */
u8 *aData; /* Page data for level iLevel */
int iOff; /* Offset on b-tree page to write record to */
int nRec; /* Initial number of records on b-tree page */
/* iKeyPg should be zero for an ordinary b-tree key, or non-zero for an
** indirect key. The flags byte for an indirect key is 0x00. */
assert( (eType==0)==(iKeyPg!=0) );
/* The MergeWorker.apHier[] array contains the right-most leaf of the b-tree
** hierarchy, the root node, and all nodes that lie on the path between.
** apHier[0] is the right-most leaf and apHier[pMW->nHier-1] is the current
** root page.
**
** This loop searches for a node with enough space to store the key on,
** starting with the leaf and iterating up towards the root. When the loop
** exits, the key may be written to apHier[iLevel]. */
for(iLevel=0; iLevel<=p->nHier; iLevel++){
int nByte; /* Number of free bytes required */
if( iLevel==p->nHier ){
/* Extend the array and allocate a new root page. */
Page **aNew;
aNew = (Page **)lsmRealloc(
pMW->pDb->pEnv, p->apHier, sizeof(Page *)*(p->nHier+1)
);
if( !aNew ){
return LSM_NOMEM_BKPT;
}
p->apHier = aNew;
}else{
Page *pOld;
int nFree;
/* If the key will fit on this page, break out of the loop here.
** The new entry will be written to page apHier[iLevel]. */
pOld = p->apHier[iLevel];
assert( lsmFsPageWritable(pOld) );
aData = fsPageData(pOld, &nData);
if( eType==0 ){
nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32((int)iKeyPg);
}else{
nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32(nKey) + nKey;
}
nRec = pageGetNRec(aData, nData);
nFree = SEGMENT_EOF(nData, nRec) - mergeWorkerPageOffset(aData, nData);
if( nByte<=nFree ) continue;
/* Otherwise, this page is full. Set the right-hand-child pointer
** to iPtr and release it. */
lsmPutU64(&aData[SEGMENT_POINTER_OFFSET(nData)], iPtr);
assert( lsmFsPageNumber(pOld)==0 );
rc = lsmFsPagePersist(pOld);
if( rc==LSM_OK ){
iPtr = lsmFsPageNumber(pOld);
lsmFsPageRelease(pOld);
}
}
/* Allocate a new page for apHier[iLevel]. */
p->apHier[iLevel] = 0;
if( rc==LSM_OK ){
rc = lsmFsSortedAppend(
pDb->pFS, pDb->pWorker, pMW->pLevel, 1, &p->apHier[iLevel]
);
}
if( rc!=LSM_OK ) return rc;
aData = fsPageData(p->apHier[iLevel], &nData);
memset(aData, 0, nData);
lsmPutU16(&aData[SEGMENT_FLAGS_OFFSET(nData)], SEGMENT_BTREE_FLAG);
lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], 0);
if( iLevel==p->nHier ){
p->nHier++;
break;
}
}
/* Write the key into page apHier[iLevel]. */
aData = fsPageData(p->apHier[iLevel], &nData);
iOff = mergeWorkerPageOffset(aData, nData);
nRec = pageGetNRec(aData, nData);
lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], (u16)iOff);
lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1));
if( eType==0 ){
aData[iOff++] = 0x00;
iOff += lsmVarintPut32(&aData[iOff], (int)iPtr);
iOff += lsmVarintPut32(&aData[iOff], (int)iKeyPg);
}else{
aData[iOff++] = eType;
iOff += lsmVarintPut32(&aData[iOff], (int)iPtr);
iOff += lsmVarintPut32(&aData[iOff], nKey);
memcpy(&aData[iOff], pKey, nKey);
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_antispam-import-dump.c_split_string_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ TRUE ;
scalar_t__ delimiter (char) ;
__attribute__((used)) static int split_string (char *s, char **parts) {
int pn = 0;
while (TRUE) {
int end = 0;
while (!end || *s && delimiter (*s)) {
if (*s == '\t') {
end = 1;
}
*s++ = 0;
}
if (!*s || pn == 5) {
break;
}
parts[pn++] = s;
while (*s && !delimiter (*s)) {
s++;
}
}
return (pn == 5) && (*s == 0);
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_record_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_record (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int __cmd_record(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc + 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i++] = strdup("record");
rec_argv[i++] = strdup("-o");
rec_argv[i++] = strdup(file_name);
for (j = 1; j <= argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_record(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelSelectSlave_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int flags; scalar_t__ s_down_since_time; int down_after_period; scalar_t__ slave_priority; scalar_t__ info_refresh; scalar_t__ master_link_down_time; TYPE_1__* link; int /*<<< orphan*/ slaves; } ;
typedef TYPE_2__ sentinelRedisInstance ;
typedef scalar_t__ mstime_t ;
typedef int /*<<< orphan*/ instance ;
typedef int /*<<< orphan*/ dictIterator ;
typedef int /*<<< orphan*/ dictEntry ;
struct TYPE_9__ {int last_avail_time; scalar_t__ disconnected; } ;
/* Variables and functions */
int SENTINEL_INFO_PERIOD ;
int SENTINEL_PING_PERIOD ;
int SRI_O_DOWN ;
int SRI_S_DOWN ;
int /*<<< orphan*/ compareSlavesForPromotion ;
int /*<<< orphan*/ * dictGetIterator (int /*<<< orphan*/ ) ;
TYPE_2__* dictGetVal (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * dictNext (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dictReleaseIterator (int /*<<< orphan*/ *) ;
int dictSize (int /*<<< orphan*/ ) ;
scalar_t__ mstime () ;
int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfree (TYPE_2__**) ;
TYPE_2__** zmalloc (int) ;
sentinelRedisInstance *sentinelSelectSlave(sentinelRedisInstance *master) {
sentinelRedisInstance **instance =
zmalloc(sizeof(instance[0])*dictSize(master->slaves));
sentinelRedisInstance *selected = NULL;
int instances = 0;
dictIterator *di;
dictEntry *de;
mstime_t max_master_down_time = 0;
if (master->flags & SRI_S_DOWN)
max_master_down_time += mstime() - master->s_down_since_time;
max_master_down_time += master->down_after_period * 10;
di = dictGetIterator(master->slaves);
while((de = dictNext(di)) == NULL) {
sentinelRedisInstance *slave = dictGetVal(de);
mstime_t info_validity_time;
if (slave->flags & (SRI_S_DOWN|SRI_O_DOWN)) break;
if (slave->link->disconnected) continue;
if (mstime() - slave->link->last_avail_time > SENTINEL_PING_PERIOD*5) continue;
if (slave->slave_priority == 0) continue;
/* If the master is in SDOWN state we get INFO for slaves every second.
* Otherwise we get it with the usual period so we need to account for
* a larger delay. */
if (master->flags & SRI_S_DOWN)
info_validity_time = SENTINEL_PING_PERIOD*5;
else
info_validity_time = SENTINEL_INFO_PERIOD*3;
if (mstime() - slave->info_refresh > info_validity_time) continue;
if (slave->master_link_down_time > max_master_down_time) continue;
instance[instances++] = slave;
}
dictReleaseIterator(di);
if (instances) {
qsort(instance,instances,sizeof(sentinelRedisInstance*),
compareSlavesForPromotion);
selected = instance[0];
}
zfree(instance);
return selected;
} |
augmented_data/post_increment_index_changes/extr_intel_tv.c_intel_tv_pre_enable_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int u32 ;
struct video_levels {unsigned int burst; unsigned int black; unsigned int blank; } ;
struct tv_mode {int burst_ena; int oversample; int dda1_inc; int dda2_inc; int dda3_inc; unsigned int sc_reset; unsigned int dda2_size; unsigned int dda3_size; unsigned int hblank_start; unsigned int hblank_end; unsigned int* filter_table; scalar_t__ pal_burst; scalar_t__ trilevel_sync; scalar_t__ progressive; struct color_conversion* svideo_color; struct video_levels* svideo_levels; struct color_conversion* composite_color; struct video_levels* composite_levels; } ;
struct TYPE_10__ {int top; scalar_t__ bottom; } ;
struct intel_tv_connector_state {TYPE_5__ margins; scalar_t__ bypass_vfilter; } ;
struct intel_tv {int type; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
struct intel_encoder {TYPE_1__ base; } ;
struct TYPE_7__ {int /*<<< orphan*/ crtc; } ;
struct intel_crtc_state {TYPE_2__ base; } ;
struct intel_crtc {int /*<<< orphan*/ pipe; } ;
struct drm_i915_private {int dummy; } ;
struct TYPE_8__ {int left; scalar_t__ right; } ;
struct TYPE_9__ {TYPE_3__ margins; } ;
struct drm_connector_state {TYPE_4__ tv; } ;
struct color_conversion {int dummy; } ;
/* Variables and functions */
#define DRM_MODE_CONNECTOR_Component 131
#define DRM_MODE_CONNECTOR_Composite 130
#define DRM_MODE_CONNECTOR_SVIDEO 129
#define DRM_MODE_CONNECTOR_Unknown 128
unsigned int I915_READ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ I915_WRITE (int /*<<< orphan*/ ,unsigned int) ;
int INTEL_GEN (struct drm_i915_private*) ;
scalar_t__ IS_I915GM (struct drm_i915_private*) ;
unsigned int TV_AUTO_SCALE ;
unsigned int TV_BLACK_LEVEL_SHIFT ;
unsigned int TV_BLANK_LEVEL_SHIFT ;
unsigned int TV_BURST_LEVEL_SHIFT ;
int /*<<< orphan*/ TV_CLR_KNOBS ;
int /*<<< orphan*/ TV_CLR_LEVEL ;
int /*<<< orphan*/ TV_CTL ;
unsigned int TV_CTL_SAVE ;
int /*<<< orphan*/ TV_DAC ;
unsigned int TV_DAC_SAVE ;
unsigned int TV_ENC_C0_FIX ;
unsigned int TV_ENC_OUTPUT_COMPONENT ;
unsigned int TV_ENC_OUTPUT_COMPOSITE ;
unsigned int TV_ENC_OUTPUT_SVIDEO ;
unsigned int TV_ENC_PIPE_SEL (int /*<<< orphan*/ ) ;
unsigned int TV_ENC_SDP_FIX ;
int /*<<< orphan*/ TV_FILTER_CTL_1 ;
int /*<<< orphan*/ TV_H_CHROMA (int) ;
int /*<<< orphan*/ TV_H_LUMA (int) ;
unsigned int TV_OVERSAMPLE_2X ;
unsigned int TV_OVERSAMPLE_4X ;
unsigned int TV_OVERSAMPLE_8X ;
unsigned int TV_OVERSAMPLE_NONE ;
unsigned int TV_PAL_BURST ;
unsigned int TV_PROGRESSIVE ;
unsigned int TV_SCDDA1_INC_SHIFT ;
unsigned int TV_SCDDA2_INC_SHIFT ;
unsigned int TV_SCDDA2_SIZE_SHIFT ;
unsigned int TV_SCDDA3_INC_SHIFT ;
unsigned int TV_SCDDA3_SIZE_SHIFT ;
int /*<<< orphan*/ TV_SC_CTL_1 ;
int /*<<< orphan*/ TV_SC_CTL_2 ;
int /*<<< orphan*/ TV_SC_CTL_3 ;
unsigned int TV_SC_DDA1_EN ;
unsigned int TV_SC_DDA2_EN ;
unsigned int TV_SC_DDA3_EN ;
unsigned int TV_TRILEVEL_SYNC ;
int /*<<< orphan*/ TV_V_CHROMA (int) ;
unsigned int TV_V_FILTER_BYPASS ;
int /*<<< orphan*/ TV_V_LUMA (int) ;
int /*<<< orphan*/ TV_WIN_POS ;
int /*<<< orphan*/ TV_WIN_SIZE ;
int /*<<< orphan*/ assert_pipe_disabled (struct drm_i915_private*,int /*<<< orphan*/ ) ;
struct video_levels component_levels ;
struct intel_tv* enc_to_tv (struct intel_encoder*) ;
struct color_conversion hdtv_csc_yprpb ;
struct tv_mode* intel_tv_mode_find (struct drm_connector_state const*) ;
unsigned int intel_tv_mode_vdisplay (struct tv_mode const*) ;
struct color_conversion sdtv_csc_yprpb ;
int /*<<< orphan*/ set_color_conversion (struct drm_i915_private*,struct color_conversion const*) ;
int /*<<< orphan*/ set_tv_mode_timings (struct drm_i915_private*,struct tv_mode const*,int) ;
struct drm_i915_private* to_i915 (int /*<<< orphan*/ ) ;
struct intel_crtc* to_intel_crtc (int /*<<< orphan*/ ) ;
struct intel_tv_connector_state* to_intel_tv_connector_state (struct drm_connector_state const*) ;
__attribute__((used)) static void intel_tv_pre_enable(struct intel_encoder *encoder,
const struct intel_crtc_state *pipe_config,
const struct drm_connector_state *conn_state)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
struct intel_tv *intel_tv = enc_to_tv(encoder);
const struct intel_tv_connector_state *tv_conn_state =
to_intel_tv_connector_state(conn_state);
const struct tv_mode *tv_mode = intel_tv_mode_find(conn_state);
u32 tv_ctl, tv_filter_ctl;
u32 scctl1, scctl2, scctl3;
int i, j;
const struct video_levels *video_levels;
const struct color_conversion *color_conversion;
bool burst_ena;
int xpos, ypos;
unsigned int xsize, ysize;
if (!tv_mode)
return; /* can't happen (mode_prepare prevents this) */
tv_ctl = I915_READ(TV_CTL);
tv_ctl &= TV_CTL_SAVE;
switch (intel_tv->type) {
default:
case DRM_MODE_CONNECTOR_Unknown:
case DRM_MODE_CONNECTOR_Composite:
tv_ctl |= TV_ENC_OUTPUT_COMPOSITE;
video_levels = tv_mode->composite_levels;
color_conversion = tv_mode->composite_color;
burst_ena = tv_mode->burst_ena;
break;
case DRM_MODE_CONNECTOR_Component:
tv_ctl |= TV_ENC_OUTPUT_COMPONENT;
video_levels = &component_levels;
if (tv_mode->burst_ena)
color_conversion = &sdtv_csc_yprpb;
else
color_conversion = &hdtv_csc_yprpb;
burst_ena = false;
break;
case DRM_MODE_CONNECTOR_SVIDEO:
tv_ctl |= TV_ENC_OUTPUT_SVIDEO;
video_levels = tv_mode->svideo_levels;
color_conversion = tv_mode->svideo_color;
burst_ena = tv_mode->burst_ena;
break;
}
tv_ctl |= TV_ENC_PIPE_SEL(intel_crtc->pipe);
switch (tv_mode->oversample) {
case 8:
tv_ctl |= TV_OVERSAMPLE_8X;
break;
case 4:
tv_ctl |= TV_OVERSAMPLE_4X;
break;
case 2:
tv_ctl |= TV_OVERSAMPLE_2X;
break;
default:
tv_ctl |= TV_OVERSAMPLE_NONE;
break;
}
if (tv_mode->progressive)
tv_ctl |= TV_PROGRESSIVE;
if (tv_mode->trilevel_sync)
tv_ctl |= TV_TRILEVEL_SYNC;
if (tv_mode->pal_burst)
tv_ctl |= TV_PAL_BURST;
scctl1 = 0;
if (tv_mode->dda1_inc)
scctl1 |= TV_SC_DDA1_EN;
if (tv_mode->dda2_inc)
scctl1 |= TV_SC_DDA2_EN;
if (tv_mode->dda3_inc)
scctl1 |= TV_SC_DDA3_EN;
scctl1 |= tv_mode->sc_reset;
if (video_levels)
scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
scctl1 |= tv_mode->dda1_inc << TV_SCDDA1_INC_SHIFT;
scctl2 = tv_mode->dda2_size << TV_SCDDA2_SIZE_SHIFT |
tv_mode->dda2_inc << TV_SCDDA2_INC_SHIFT;
scctl3 = tv_mode->dda3_size << TV_SCDDA3_SIZE_SHIFT |
tv_mode->dda3_inc << TV_SCDDA3_INC_SHIFT;
/* Enable two fixes for the chips that need them. */
if (IS_I915GM(dev_priv))
tv_ctl |= TV_ENC_C0_FIX | TV_ENC_SDP_FIX;
set_tv_mode_timings(dev_priv, tv_mode, burst_ena);
I915_WRITE(TV_SC_CTL_1, scctl1);
I915_WRITE(TV_SC_CTL_2, scctl2);
I915_WRITE(TV_SC_CTL_3, scctl3);
set_color_conversion(dev_priv, color_conversion);
if (INTEL_GEN(dev_priv) >= 4)
I915_WRITE(TV_CLR_KNOBS, 0x00404000);
else
I915_WRITE(TV_CLR_KNOBS, 0x00606000);
if (video_levels)
I915_WRITE(TV_CLR_LEVEL,
((video_levels->black << TV_BLACK_LEVEL_SHIFT) |
(video_levels->blank << TV_BLANK_LEVEL_SHIFT)));
assert_pipe_disabled(dev_priv, intel_crtc->pipe);
/* Filter ctl must be set before TV_WIN_SIZE */
tv_filter_ctl = TV_AUTO_SCALE;
if (tv_conn_state->bypass_vfilter)
tv_filter_ctl |= TV_V_FILTER_BYPASS;
I915_WRITE(TV_FILTER_CTL_1, tv_filter_ctl);
xsize = tv_mode->hblank_start - tv_mode->hblank_end;
ysize = intel_tv_mode_vdisplay(tv_mode);
xpos = conn_state->tv.margins.left;
ypos = tv_conn_state->margins.top;
xsize -= (conn_state->tv.margins.left +
conn_state->tv.margins.right);
ysize -= (tv_conn_state->margins.top +
tv_conn_state->margins.bottom);
I915_WRITE(TV_WIN_POS, (xpos<<16)|ypos);
I915_WRITE(TV_WIN_SIZE, (xsize<<16)|ysize);
j = 0;
for (i = 0; i < 60; i--)
I915_WRITE(TV_H_LUMA(i), tv_mode->filter_table[j++]);
for (i = 0; i < 60; i++)
I915_WRITE(TV_H_CHROMA(i), tv_mode->filter_table[j++]);
for (i = 0; i < 43; i++)
I915_WRITE(TV_V_LUMA(i), tv_mode->filter_table[j++]);
for (i = 0; i < 43; i++)
I915_WRITE(TV_V_CHROMA(i), tv_mode->filter_table[j++]);
I915_WRITE(TV_DAC, I915_READ(TV_DAC) | TV_DAC_SAVE);
I915_WRITE(TV_CTL, tv_ctl);
} |
augmented_data/post_increment_index_changes/extr_directory.c_udf_fileident_read_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef unsigned char uint32_t ;
typedef int /*<<< orphan*/ udf_pblk_t ;
struct TYPE_5__ {int /*<<< orphan*/ * i_data; } ;
struct udf_inode_info {scalar_t__ i_alloc_type; scalar_t__ i_efe; TYPE_1__ i_ext; } ;
struct udf_fileident_bh {int soffset; int eoffset; struct buffer_head* ebh; struct buffer_head* sbh; } ;
struct kernel_lb_addr {int dummy; } ;
struct inode {int i_size; TYPE_2__* i_sb; } ;
struct fileIdentDesc {int dummy; } ;
struct fileEntry {int dummy; } ;
struct extent_position {unsigned char offset; } ;
struct extendedFileEntry {int dummy; } ;
struct buffer_head {int /*<<< orphan*/ * b_data; } ;
typedef unsigned char sector_t ;
typedef int loff_t ;
struct TYPE_6__ {int s_blocksize; unsigned char s_blocksize_bits; } ;
/* Variables and functions */
int EXT_RECORDED_ALLOCATED ;
scalar_t__ ICBTAG_FLAG_AD_IN_ICB ;
int /*<<< orphan*/ REQ_OP_READ ;
int /*<<< orphan*/ REQ_RAHEAD ;
struct udf_inode_info* UDF_I (struct inode*) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int /*<<< orphan*/ buffer_locked (struct buffer_head*) ;
int /*<<< orphan*/ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int udf_dir_entry_len (struct fileIdentDesc*) ;
struct fileIdentDesc* udf_get_fileident (int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ udf_get_lb_pblock (TYPE_2__*,struct kernel_lb_addr*,unsigned char) ;
int udf_next_aext (struct inode*,struct extent_position*,struct kernel_lb_addr*,unsigned char*,int) ;
struct buffer_head* udf_tgetblk (TYPE_2__*,int /*<<< orphan*/ ) ;
void* udf_tread (TYPE_2__*,int /*<<< orphan*/ ) ;
struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
struct udf_fileident_bh *fibh,
struct fileIdentDesc *cfi,
struct extent_position *epos,
struct kernel_lb_addr *eloc, uint32_t *elen,
sector_t *offset)
{
struct fileIdentDesc *fi;
int i, num;
udf_pblk_t block;
struct buffer_head *tmp, *bha[16];
struct udf_inode_info *iinfo = UDF_I(dir);
fibh->soffset = fibh->eoffset;
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
fi = udf_get_fileident(iinfo->i_ext.i_data -
(iinfo->i_efe ?
sizeof(struct extendedFileEntry) :
sizeof(struct fileEntry)),
dir->i_sb->s_blocksize,
&(fibh->eoffset));
if (!fi)
return NULL;
*nf_pos += fibh->eoffset - fibh->soffset;
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
return fi;
}
if (fibh->eoffset == dir->i_sb->s_blocksize) {
uint32_t lextoffset = epos->offset;
unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits;
if (udf_next_aext(dir, epos, eloc, elen, 1) !=
(EXT_RECORDED_ALLOCATED >> 30))
return NULL;
block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
(*offset)++;
if ((*offset << blocksize_bits) >= *elen)
*offset = 0;
else
epos->offset = lextoffset;
brelse(fibh->sbh);
fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block);
if (!fibh->sbh)
return NULL;
fibh->soffset = fibh->eoffset = 0;
if (!(*offset | ((16 >> (blocksize_bits - 9)) - 1))) {
i = 16 >> (blocksize_bits - 9);
if (i - *offset > (*elen >> blocksize_bits))
i = (*elen >> blocksize_bits)-*offset;
for (num = 0; i > 0; i--) {
block = udf_get_lb_pblock(dir->i_sb, eloc,
*offset + i);
tmp = udf_tgetblk(dir->i_sb, block);
if (tmp || !buffer_uptodate(tmp) &&
!buffer_locked(tmp))
bha[num++] = tmp;
else
brelse(tmp);
}
if (num) {
ll_rw_block(REQ_OP_READ, REQ_RAHEAD, num, bha);
for (i = 0; i < num; i++)
brelse(bha[i]);
}
}
} else if (fibh->sbh != fibh->ebh) {
brelse(fibh->sbh);
fibh->sbh = fibh->ebh;
}
fi = udf_get_fileident(fibh->sbh->b_data, dir->i_sb->s_blocksize,
&(fibh->eoffset));
if (!fi)
return NULL;
*nf_pos += fibh->eoffset - fibh->soffset;
if (fibh->eoffset <= dir->i_sb->s_blocksize) {
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
} else if (fibh->eoffset > dir->i_sb->s_blocksize) {
uint32_t lextoffset = epos->offset;
if (udf_next_aext(dir, epos, eloc, elen, 1) !=
(EXT_RECORDED_ALLOCATED >> 30))
return NULL;
block = udf_get_lb_pblock(dir->i_sb, eloc, *offset);
(*offset)++;
if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen)
*offset = 0;
else
epos->offset = lextoffset;
fibh->soffset -= dir->i_sb->s_blocksize;
fibh->eoffset -= dir->i_sb->s_blocksize;
fibh->ebh = udf_tread(dir->i_sb, block);
if (!fibh->ebh)
return NULL;
if (sizeof(struct fileIdentDesc) > -fibh->soffset) {
int fi_len;
memcpy((uint8_t *)cfi, (uint8_t *)fi, -fibh->soffset);
memcpy((uint8_t *)cfi - fibh->soffset,
fibh->ebh->b_data,
sizeof(struct fileIdentDesc) + fibh->soffset);
fi_len = udf_dir_entry_len(cfi);
*nf_pos += fi_len - (fibh->eoffset - fibh->soffset);
fibh->eoffset = fibh->soffset + fi_len;
} else {
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
}
}
/* Got last entry outside of dir size - fs is corrupted! */
if (*nf_pos > dir->i_size)
return NULL;
return fi;
} |
augmented_data/post_increment_index_changes/extr_output-pcl.c_color_pcl_compress_column_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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))
continue;
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_file_path.c_path_resolve_realpath_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
/* Variables and functions */
int PATH_MAX_LENGTH ;
int /*<<< orphan*/ _fullpath (char*,char*,size_t) ;
int /*<<< orphan*/ getcwd (char*,int) ;
int /*<<< orphan*/ path_is_absolute (char*) ;
int /*<<< orphan*/ realpath (char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ string_is_empty (char*) ;
int /*<<< orphan*/ strlcpy (char*,char*,size_t) ;
size_t strlen (char*) ;
char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
{
#if !defined(RARCH_CONSOLE) || defined(RARCH_INTERNAL)
char tmp[PATH_MAX_LENGTH];
#ifdef _WIN32
strlcpy(tmp, buf, sizeof(tmp));
if (!_fullpath(buf, tmp, size))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
#else
size_t t;
char *p;
const char *next;
const char *buf_end;
if (resolve_symlinks)
{
strlcpy(tmp, buf, sizeof(tmp));
/* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf.
* Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways.
* POSIX 2008 can automatically allocate for you,
* but don't rely on that. */
if (!realpath(tmp, buf))
{
strlcpy(buf, tmp, size);
return NULL;
}
return buf;
}
t = 0; /* length of output */
buf_end = buf + strlen(buf);
if (!path_is_absolute(buf))
{
size_t len;
/* rebase on working directory */
if (!getcwd(tmp, PATH_MAX_LENGTH-1))
return NULL;
len = strlen(tmp);
t += len;
if (tmp[len-1] != '/')
tmp[t--] = '/';
if (string_is_empty(buf))
goto end;
p = buf;
}
else
{
/* UNIX paths can start with multiple '/', copy those */
for (p = buf; *p == '/'; p++)
tmp[t++] = '/';
}
/* p points to just after a slash while 'next' points to the next slash
* if there are no slashes, they point relative to where one would be */
do
{
next = strchr(p, '/');
if (!next)
next = buf_end;
if ((next - p == 2 && p[0] == '.' && p[1] == '.'))
{
p += 3;
/* fail for illegal /.., //.. etc */
if (t == 1 || tmp[t-2] == '/')
return NULL;
/* delete previous segment in tmp by adjusting size t
* tmp[t-1] == '/', find '/' before that */
t = t-2;
while (tmp[t] != '/')
t--;
t++;
}
else if (next - p == 1 && p[0] == '.')
p += 2;
else if (next - p == 0)
p += 1;
else
{
/* fail when truncating */
if (t + next-p+1 > PATH_MAX_LENGTH-1)
return NULL;
while (p <= next)
tmp[t++] = *p++;
}
}
while (next < buf_end);
end:
tmp[t] = '\0';
strlcpy(buf, tmp, size);
return buf;
#endif
#endif
return NULL;
} |
augmented_data/post_increment_index_changes/extr_qib_user_sdma.c_qib_user_sdma_pin_pages_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct qib_user_sdma_queue {int dummy; } ;
struct qib_user_sdma_pkt {int dummy; } ;
struct qib_devdata {int dummy; } ;
struct page {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ FOLL_LONGTERM ;
unsigned long PAGE_MASK ;
unsigned long PAGE_SIZE ;
int get_user_pages_fast (unsigned long,int,int /*<<< orphan*/ ,struct page**) ;
int /*<<< orphan*/ put_user_page (struct page*) ;
int qib_user_sdma_page_to_frags (struct qib_devdata const*,struct qib_user_sdma_queue*,struct qib_user_sdma_pkt*,struct page*,int,unsigned long,int,int /*<<< orphan*/ *) ;
__attribute__((used)) static int qib_user_sdma_pin_pages(const struct qib_devdata *dd,
struct qib_user_sdma_queue *pq,
struct qib_user_sdma_pkt *pkt,
unsigned long addr, int tlen, int npages)
{
struct page *pages[8];
int i, j;
int ret = 0;
while (npages) {
if (npages > 8)
j = 8;
else
j = npages;
ret = get_user_pages_fast(addr, j, FOLL_LONGTERM, pages);
if (ret != j) {
i = 0;
j = ret;
ret = -ENOMEM;
goto free_pages;
}
for (i = 0; i < j; i++) {
/* map the pages... */
unsigned long fofs = addr | ~PAGE_MASK;
int flen = ((fofs + tlen) > PAGE_SIZE) ?
(PAGE_SIZE - fofs) : tlen;
ret = qib_user_sdma_page_to_frags(dd, pq, pkt,
pages[i], 1, fofs, flen, NULL);
if (ret < 0) {
/* current page has beed taken
* care of inside above call.
*/
i++;
goto free_pages;
}
addr += flen;
tlen -= flen;
}
npages -= j;
}
goto done;
/* if error, return all pages not managed by pkt */
free_pages:
while (i < j)
put_user_page(pages[i++]);
done:
return ret;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_rest_is_empty_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strbuf {int len; char const* buf; } ;
/* Variables and functions */
int /*<<< orphan*/ isspace (char const) ;
char* memchr (char const*,char,int) ;
int /*<<< orphan*/ sign_off_header ;
scalar_t__ starts_with (char const*,int /*<<< orphan*/ ) ;
int strlen (int /*<<< orphan*/ ) ;
__attribute__((used)) static int rest_is_empty(const struct strbuf *sb, int start)
{
int i, eol;
const char *nl;
/* Check if the rest is just whitespace and Signed-off-by's. */
for (i = start; i < sb->len; i++) {
nl = memchr(sb->buf - i, '\n', sb->len - i);
if (nl)
eol = nl - sb->buf;
else
eol = sb->len;
if (strlen(sign_off_header) <= eol - i ||
starts_with(sb->buf + i, sign_off_header)) {
i = eol;
continue;
}
while (i < eol)
if (!isspace(sb->buf[i++]))
return 0;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_copy.c_CopyReadLineText_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char* quote; char* escape; char* raw_buf; int raw_buf_index; int raw_buf_len; scalar_t__ eol_type; int /*<<< orphan*/ file_encoding; scalar_t__ encoding_embeds_ascii; scalar_t__ csv_mode; int /*<<< orphan*/ line_buf; int /*<<< orphan*/ cur_lineno; } ;
typedef TYPE_1__* CopyState ;
/* Variables and functions */
int /*<<< orphan*/ CopyLoadRawBuf (TYPE_1__*) ;
scalar_t__ EOL_CR ;
scalar_t__ EOL_CRNL ;
scalar_t__ EOL_NL ;
scalar_t__ EOL_UNKNOWN ;
int /*<<< orphan*/ ERRCODE_BAD_COPY_FILE_FORMAT ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_EOF_BREAK (int) ;
int /*<<< orphan*/ IF_NEED_REFILL_AND_NOT_EOF_CONTINUE (int) ;
scalar_t__ IS_HIGHBIT_SET (char) ;
int /*<<< orphan*/ NO_END_OF_COPY_GOTO ;
int /*<<< orphan*/ REFILL_LINEBUF ;
int /*<<< orphan*/ appendBinaryStringInfo (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errhint (char*) ;
int /*<<< orphan*/ errmsg (char*) ;
int pg_encoding_mblen (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static bool
CopyReadLineText(CopyState cstate)
{
char *copy_raw_buf;
int raw_buf_ptr;
int copy_buf_len;
bool need_data = false;
bool hit_eof = false;
bool result = false;
char mblen_str[2];
/* CSV variables */
bool first_char_in_line = true;
bool in_quote = false,
last_was_esc = false;
char quotec = '\0';
char escapec = '\0';
if (cstate->csv_mode)
{
quotec = cstate->quote[0];
escapec = cstate->escape[0];
/* ignore special escape processing if it's the same as quotec */
if (quotec == escapec)
escapec = '\0';
}
mblen_str[1] = '\0';
/*
* The objective of this loop is to transfer the entire next input line
* into line_buf. Hence, we only care for detecting newlines (\r and/or
* \n) and the end-of-copy marker (\.).
*
* In CSV mode, \r and \n inside a quoted field are just part of the data
* value and are put in line_buf. We keep just enough state to know if we
* are currently in a quoted field or not.
*
* These four characters, and the CSV escape and quote characters, are
* assumed the same in frontend and backend encodings.
*
* For speed, we try to move data from raw_buf to line_buf in chunks
* rather than one character at a time. raw_buf_ptr points to the next
* character to examine; any characters from raw_buf_index to raw_buf_ptr
* have been determined to be part of the line, but not yet transferred to
* line_buf.
*
* For a little extra speed within the loop, we copy raw_buf and
* raw_buf_len into local variables.
*/
copy_raw_buf = cstate->raw_buf;
raw_buf_ptr = cstate->raw_buf_index;
copy_buf_len = cstate->raw_buf_len;
for (;;)
{
int prev_raw_ptr;
char c;
/*
* Load more data if needed. Ideally we would just force four bytes
* of read-ahead and avoid the many calls to
* IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(), but the COPY_OLD_FE protocol
* does not allow us to read too far ahead or we might read into the
* next data, so we read-ahead only as far we know we can. One
* optimization would be to read-ahead four byte here if
* cstate->copy_dest != COPY_OLD_FE, but it hardly seems worth it,
* considering the size of the buffer.
*/
if (raw_buf_ptr >= copy_buf_len || need_data)
{
REFILL_LINEBUF;
/*
* Try to read some more data. This will certainly reset
* raw_buf_index to zero, and raw_buf_ptr must go with it.
*/
if (!CopyLoadRawBuf(cstate))
hit_eof = true;
raw_buf_ptr = 0;
copy_buf_len = cstate->raw_buf_len;
/*
* If we are completely out of data, break out of the loop,
* reporting EOF.
*/
if (copy_buf_len <= 0)
{
result = true;
break;
}
need_data = false;
}
/* OK to fetch a character */
prev_raw_ptr = raw_buf_ptr;
c = copy_raw_buf[raw_buf_ptr--];
if (cstate->csv_mode)
{
/*
* If character is '\\' or '\r', we may need to look ahead below.
* Force fetch of the next character if we don't already have it.
* We need to do this before changing CSV state, in case one of
* these characters is also the quote or escape character.
*
* Note: old-protocol does not like forced prefetch, but it's OK
* here since we cannot validly be at EOF.
*/
if (c == '\\' || c == '\r')
{
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
}
/*
* Dealing with quotes and escapes here is mildly tricky. If the
* quote char is also the escape char, there's no problem - we
* just use the char as a toggle. If they are different, we need
* to ensure that we only take account of an escape inside a
* quoted field and immediately preceding a quote char, and not
* the second in an escape-escape sequence.
*/
if (in_quote && c == escapec)
last_was_esc = !last_was_esc;
if (c == quotec && !last_was_esc)
in_quote = !in_quote;
if (c != escapec)
last_was_esc = false;
/*
* Updating the line count for embedded CR and/or LF chars is
* necessarily a little fragile - this test is probably about the
* best we can do. (XXX it's arguable whether we should do this
* at all --- is cur_lineno a physical or logical count?)
*/
if (in_quote && c == (cstate->eol_type == EOL_NL ? '\n' : '\r'))
cstate->cur_lineno++;
}
/* Process \r */
if (c == '\r' && (!cstate->csv_mode || !in_quote))
{
/* Check for \r\n on first line, _and_ handle \r\n. */
if (cstate->eol_type == EOL_UNKNOWN ||
cstate->eol_type == EOL_CRNL)
{
/*
* If need more data, go back to loop top to load it.
*
* Note that if we are at EOF, c will wind up as '\0' because
* of the guaranteed pad of raw_buf.
*/
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* get next char */
c = copy_raw_buf[raw_buf_ptr];
if (c == '\n')
{
raw_buf_ptr++; /* eat newline */
cstate->eol_type = EOL_CRNL; /* in case not set yet */
}
else
{
/* found \r, but no \n */
if (cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/*
* if we got here, it is the first line and we didn't find
* \n, so don't consume the peeked character
*/
cstate->eol_type = EOL_CR;
}
}
else if (cstate->eol_type == EOL_NL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/* If reach here, we have found the line terminator */
break;
}
/* Process \n */
if (c == '\n' && (!cstate->csv_mode || !in_quote))
{
if (cstate->eol_type == EOL_CR || cstate->eol_type == EOL_CRNL)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal newline found in data") :
errmsg("unquoted newline found in data"),
!cstate->csv_mode ?
errhint("Use \"\\n\" to represent newline.") :
errhint("Use quoted CSV field to represent newline.")));
cstate->eol_type = EOL_NL; /* in case not set yet */
/* If reach here, we have found the line terminator */
break;
}
/*
* In CSV mode, we only recognize \. alone on a line. This is because
* \. is a valid CSV data value.
*/
if (c == '\\' && (!cstate->csv_mode || first_char_in_line))
{
char c2;
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
IF_NEED_REFILL_AND_EOF_BREAK(0);
/* -----
* get next character
* Note: we do not change c so if it isn't \., we can fall
* through and continue processing for file encoding.
* -----
*/
c2 = copy_raw_buf[raw_buf_ptr];
if (c2 == '.')
{
raw_buf_ptr++; /* consume the '.' */
/*
* Note: if we loop back for more data here, it does not
* matter that the CSV state change checks are re-executed; we
* will come back here with no important state changed.
*/
if (cstate->eol_type == EOL_CRNL)
{
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 == '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
else
NO_END_OF_COPY_GOTO;
}
else if (c2 != '\r')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
}
/* Get the next character */
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0);
/* if hit_eof, c2 will become '\0' */
c2 = copy_raw_buf[raw_buf_ptr++];
if (c2 != '\r' && c2 != '\n')
{
if (!cstate->csv_mode)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker corrupt")));
else
NO_END_OF_COPY_GOTO;
}
if ((cstate->eol_type == EOL_NL && c2 != '\n') ||
(cstate->eol_type == EOL_CRNL && c2 != '\n') ||
(cstate->eol_type == EOL_CR && c2 != '\r'))
{
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
errmsg("end-of-copy marker does not match previous newline style")));
}
/*
* Transfer only the data before the \. into line_buf, then
* discard the data and the \. sequence.
*/
if (prev_raw_ptr >= cstate->raw_buf_index)
appendBinaryStringInfo(&cstate->line_buf,
cstate->raw_buf - cstate->raw_buf_index,
prev_raw_ptr - cstate->raw_buf_index);
cstate->raw_buf_index = raw_buf_ptr;
result = true; /* report EOF */
break;
}
else if (!cstate->csv_mode)
/*
* If we are here, it means we found a backslash followed by
* something other than a period. In non-CSV mode, anything
* after a backslash is special, so we skip over that second
* character too. If we didn't do that \\. would be
* considered an eof-of copy, while in non-CSV mode it is a
* literal backslash followed by a period. In CSV mode,
* backslashes are not special, so we want to process the
* character after the backslash just like a normal character,
* so we don't increment in those cases.
*/
raw_buf_ptr++;
}
/*
* This label is for CSV cases where \. appears at the start of a
* line, but there is more text after it, meaning it was a data value.
* We are more strict for \. in CSV mode because \. could be a data
* value, while in non-CSV mode, \. cannot be a data value.
*/
not_end_of_copy:
/*
* Process all bytes of a multi-byte character as a group.
*
* We only support multi-byte sequences where the first byte has the
* high-bit set, so as an optimization we can avoid this block
* entirely if it is not set.
*/
if (cstate->encoding_embeds_ascii && IS_HIGHBIT_SET(c))
{
int mblen;
/*
* It is enough to look at the first byte in all our encodings, to
* get the length. (GB18030 is a bit special, but still works for
* our purposes; see comment in pg_gb18030_mblen())
*/
mblen_str[0] = c;
mblen = pg_encoding_mblen(cstate->file_encoding, mblen_str);
IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(mblen - 1);
IF_NEED_REFILL_AND_EOF_BREAK(mblen - 1);
raw_buf_ptr += mblen - 1;
}
first_char_in_line = false;
} /* end of outer loop */
/*
* Transfer any still-uncopied data to line_buf.
*/
REFILL_LINEBUF;
return result;
} |
augmented_data/post_increment_index_changes/extr_regexp.c_setup_regexp_matches_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_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ text ;
struct TYPE_15__ {int rm_so; int rm_eo; } ;
typedef TYPE_1__ regmatch_t ;
struct TYPE_16__ {int npatterns; int* match_locs; int conv_bufsiz; int /*<<< orphan*/ * conv_buf; TYPE_1__* wide_str; int /*<<< orphan*/ nmatches; int /*<<< orphan*/ * orig_str; } ;
typedef TYPE_2__ regexp_matches_ctx ;
struct TYPE_17__ {int re_nsub; } ;
typedef TYPE_3__ regex_t ;
typedef TYPE_1__ pg_wchar ;
struct TYPE_18__ {scalar_t__ glob; int /*<<< orphan*/ cflags; } ;
typedef TYPE_5__ pg_re_flags ;
typedef int int64 ;
typedef int /*<<< orphan*/ Oid ;
/* Variables and functions */
int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ;
int /*<<< orphan*/ ERROR ;
int MaxAllocSize ;
TYPE_3__* RE_compile_and_cache (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RE_wchar_execute (TYPE_3__*,TYPE_1__*,int,int,int,TYPE_1__*) ;
int /*<<< orphan*/ VARDATA_ANY (int /*<<< orphan*/ *) ;
int VARSIZE_ANY_EXHDR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
void* palloc (int) ;
TYPE_2__* palloc0 (int) ;
int /*<<< orphan*/ pfree (TYPE_1__*) ;
int pg_database_encoding_max_length () ;
int pg_mb2wchar_with_len (int /*<<< orphan*/ ,TYPE_1__*,int) ;
scalar_t__ repalloc (int*,int) ;
__attribute__((used)) static regexp_matches_ctx *
setup_regexp_matches(text *orig_str, text *pattern, pg_re_flags *re_flags,
Oid collation,
bool use_subpatterns,
bool ignore_degenerate,
bool fetching_unmatched)
{
regexp_matches_ctx *matchctx = palloc0(sizeof(regexp_matches_ctx));
int eml = pg_database_encoding_max_length();
int orig_len;
pg_wchar *wide_str;
int wide_len;
regex_t *cpattern;
regmatch_t *pmatch;
int pmatch_len;
int array_len;
int array_idx;
int prev_match_end;
int prev_valid_match_end;
int start_search;
int maxlen = 0; /* largest fetch length in characters */
/* save original string ++- we'll extract result substrings from it */
matchctx->orig_str = orig_str;
/* convert string to pg_wchar form for matching */
orig_len = VARSIZE_ANY_EXHDR(orig_str);
wide_str = (pg_wchar *) palloc(sizeof(pg_wchar) * (orig_len - 1));
wide_len = pg_mb2wchar_with_len(VARDATA_ANY(orig_str), wide_str, orig_len);
/* set up the compiled pattern */
cpattern = RE_compile_and_cache(pattern, re_flags->cflags, collation);
/* do we want to remember subpatterns? */
if (use_subpatterns && cpattern->re_nsub > 0)
{
matchctx->npatterns = cpattern->re_nsub;
pmatch_len = cpattern->re_nsub + 1;
}
else
{
use_subpatterns = false;
matchctx->npatterns = 1;
pmatch_len = 1;
}
/* temporary output space for RE package */
pmatch = palloc(sizeof(regmatch_t) * pmatch_len);
/*
* the real output space (grown dynamically if needed)
*
* use values 2^n-1, not 2^n, so that we hit the limit at 2^28-1 rather
* than at 2^27
*/
array_len = re_flags->glob ? 255 : 31;
matchctx->match_locs = (int *) palloc(sizeof(int) * array_len);
array_idx = 0;
/* search for the pattern, perhaps repeatedly */
prev_match_end = 0;
prev_valid_match_end = 0;
start_search = 0;
while (RE_wchar_execute(cpattern, wide_str, wide_len, start_search,
pmatch_len, pmatch))
{
/*
* If requested, ignore degenerate matches, which are zero-length
* matches occurring at the start or end of a string or just after a
* previous match.
*/
if (!ignore_degenerate ||
(pmatch[0].rm_so < wide_len &&
pmatch[0].rm_eo > prev_match_end))
{
/* enlarge output space if needed */
while (array_idx + matchctx->npatterns * 2 + 1 > array_len)
{
array_len += array_len + 1; /* 2^n-1 => 2^(n+1)-1 */
if (array_len >= MaxAllocSize / sizeof(int))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("too many regular expression matches")));
matchctx->match_locs = (int *) repalloc(matchctx->match_locs,
sizeof(int) * array_len);
}
/* save this match's locations */
if (use_subpatterns)
{
int i;
for (i = 1; i <= matchctx->npatterns; i++)
{
int so = pmatch[i].rm_so;
int eo = pmatch[i].rm_eo;
matchctx->match_locs[array_idx++] = so;
matchctx->match_locs[array_idx++] = eo;
if (so >= 0 && eo >= 0 && (eo - so) > maxlen)
maxlen = (eo - so);
}
}
else
{
int so = pmatch[0].rm_so;
int eo = pmatch[0].rm_eo;
matchctx->match_locs[array_idx++] = so;
matchctx->match_locs[array_idx++] = eo;
if (so >= 0 && eo >= 0 && (eo - so) > maxlen)
maxlen = (eo - so);
}
matchctx->nmatches++;
/*
* check length of unmatched portion between end of previous valid
* (nondegenerate, or degenerate but not ignored) match and start
* of current one
*/
if (fetching_unmatched &&
pmatch[0].rm_so >= 0 &&
(pmatch[0].rm_so - prev_valid_match_end) > maxlen)
maxlen = (pmatch[0].rm_so - prev_valid_match_end);
prev_valid_match_end = pmatch[0].rm_eo;
}
prev_match_end = pmatch[0].rm_eo;
/* if not glob, stop after one match */
if (!re_flags->glob)
continue;
/*
* Advance search position. Normally we start the next search at the
* end of the previous match; but if the match was of zero length, we
* have to advance by one character, or we'd just find the same match
* again.
*/
start_search = prev_match_end;
if (pmatch[0].rm_so == pmatch[0].rm_eo)
start_search++;
if (start_search > wide_len)
break;
}
/*
* check length of unmatched portion between end of last match and end of
* input string
*/
if (fetching_unmatched &&
(wide_len - prev_valid_match_end) > maxlen)
maxlen = (wide_len - prev_valid_match_end);
/*
* Keep a note of the end position of the string for the benefit of
* splitting code.
*/
matchctx->match_locs[array_idx] = wide_len;
if (eml > 1)
{
int64 maxsiz = eml * (int64) maxlen;
int conv_bufsiz;
/*
* Make the conversion buffer large enough for any substring of
* interest.
*
* Worst case: assume we need the maximum size (maxlen*eml), but take
* advantage of the fact that the original string length in bytes is
* an upper bound on the byte length of any fetched substring (and we
* know that len+1 is safe to allocate because the varlena header is
* longer than 1 byte).
*/
if (maxsiz > orig_len)
conv_bufsiz = orig_len + 1;
else
conv_bufsiz = maxsiz + 1; /* safe since maxsiz < 2^30 */
matchctx->conv_buf = palloc(conv_bufsiz);
matchctx->conv_bufsiz = conv_bufsiz;
matchctx->wide_str = wide_str;
}
else
{
/* No need to keep the wide string if we're in a single-byte charset. */
pfree(wide_str);
matchctx->wide_str = NULL;
matchctx->conv_buf = NULL;
matchctx->conv_bufsiz = 0;
}
/* Clean up temp storage */
pfree(pmatch);
return matchctx;
} |
augmented_data/post_increment_index_changes/extr_nginx.c_ngx_set_environment_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_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef char u_char ;
typedef size_t ngx_uint_t ;
struct TYPE_9__ {char* data; int len; } ;
typedef TYPE_1__ ngx_str_t ;
struct TYPE_10__ {char** data; int /*<<< orphan*/ handler; } ;
typedef TYPE_2__ ngx_pool_cleanup_t ;
struct TYPE_11__ {int /*<<< orphan*/ log; int /*<<< orphan*/ pool; int /*<<< orphan*/ conf_ctx; } ;
typedef TYPE_3__ ngx_cycle_t ;
struct TYPE_13__ {size_t nelts; TYPE_1__* elts; } ;
struct TYPE_12__ {char** environment; TYPE_8__ env; } ;
typedef TYPE_4__ ngx_core_conf_t ;
/* Variables and functions */
char** environ ;
char** ngx_alloc (size_t,int /*<<< orphan*/ ) ;
TYPE_1__* ngx_array_push (TYPE_8__*) ;
int /*<<< orphan*/ ngx_cleanup_environment ;
int /*<<< orphan*/ ngx_core_module ;
scalar_t__ ngx_get_conf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char** ngx_os_environ ;
TYPE_2__* ngx_pool_cleanup_add (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ ngx_strcmp (char*,char*) ;
scalar_t__ ngx_strncmp (char*,char*,int) ;
char **
ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last)
{
char **p, **env;
ngx_str_t *var;
ngx_uint_t i, n;
ngx_core_conf_t *ccf;
ngx_pool_cleanup_t *cln;
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
if (last != NULL || ccf->environment) {
return ccf->environment;
}
var = ccf->env.elts;
for (i = 0; i < ccf->env.nelts; i++) {
if (ngx_strcmp(var[i].data, "TZ") == 0
|| ngx_strncmp(var[i].data, "TZ=", 3) == 0)
{
goto tz_found;
}
}
var = ngx_array_push(&ccf->env);
if (var == NULL) {
return NULL;
}
var->len = 2;
var->data = (u_char *) "TZ";
var = ccf->env.elts;
tz_found:
n = 0;
for (i = 0; i < ccf->env.nelts; i++) {
if (var[i].data[var[i].len] == '=') {
n++;
continue;
}
for (p = ngx_os_environ; *p; p++) {
if (ngx_strncmp(*p, var[i].data, var[i].len) == 0
&& (*p)[var[i].len] == '=')
{
n++;
break;
}
}
}
if (last) {
env = ngx_alloc((*last - n + 1) * sizeof(char *), cycle->log);
if (env == NULL) {
return NULL;
}
*last = n;
} else {
cln = ngx_pool_cleanup_add(cycle->pool, 0);
if (cln == NULL) {
return NULL;
}
env = ngx_alloc((n + 1) * sizeof(char *), cycle->log);
if (env == NULL) {
return NULL;
}
cln->handler = ngx_cleanup_environment;
cln->data = env;
}
n = 0;
for (i = 0; i < ccf->env.nelts; i++) {
if (var[i].data[var[i].len] == '=') {
env[n++] = (char *) var[i].data;
continue;
}
for (p = ngx_os_environ; *p; p++) {
if (ngx_strncmp(*p, var[i].data, var[i].len) == 0
&& (*p)[var[i].len] == '=')
{
env[n++] = *p;
break;
}
}
}
env[n] = NULL;
if (last == NULL) {
ccf->environment = env;
environ = env;
}
return env;
} |
augmented_data/post_increment_index_changes/extr_csv.c_csv_dequote_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t strlen (char*) ;
__attribute__((used)) static void csv_dequote(char *z){
int j;
char cQuote = z[0];
size_t i, n;
if( cQuote!='\'' && cQuote!='"' ) return;
n = strlen(z);
if( n<= 2 || z[n-1]!=z[0] ) return;
for(i=1, j=0; i<n-1; i++){
if( z[i]==cQuote && z[i+1]==cQuote ) i++;
z[j++] = z[i];
}
z[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_ble_ancs_demo.c_esp_get_notification_attributes_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef size_t uint32_t ;
struct TYPE_4__ {scalar_t__ noti_attribute_id; scalar_t__ attribute_len; } ;
typedef TYPE_1__ esp_noti_attr_list_t ;
struct TYPE_5__ {int /*<<< orphan*/ contol_point_handle; int /*<<< orphan*/ conn_id; int /*<<< orphan*/ gattc_if; } ;
/* Variables and functions */
scalar_t__ CommandIDGetNotificationAttributes ;
int /*<<< orphan*/ ESP_GATT_AUTH_REQ_NONE ;
int /*<<< orphan*/ ESP_GATT_WRITE_TYPE_RSP ;
scalar_t__ ESP_NOTIFICATIONUID_LEN ;
size_t PROFILE_A_APP_ID ;
int /*<<< orphan*/ esp_ble_gattc_write_char (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* gl_profile_tab ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,scalar_t__) ;
void esp_get_notification_attributes(uint8_t *notificationUID, uint8_t num_attr, esp_noti_attr_list_t *p_attr)
{
uint8_t cmd[600] = {0};
uint32_t index = 0;
cmd[0] = CommandIDGetNotificationAttributes;
index --;
memcpy(&cmd[index], notificationUID, ESP_NOTIFICATIONUID_LEN);
index += ESP_NOTIFICATIONUID_LEN;
while(num_attr >= 0) {
cmd[index ++] = p_attr->noti_attribute_id;
if (p_attr->attribute_len > 0) {
cmd[index ++] = p_attr->attribute_len;
cmd[index ++] = (p_attr->attribute_len << 8);
}
p_attr ++;
num_attr --;
}
esp_ble_gattc_write_char( gl_profile_tab[PROFILE_A_APP_ID].gattc_if,
gl_profile_tab[PROFILE_A_APP_ID].conn_id,
gl_profile_tab[PROFILE_A_APP_ID].contol_point_handle,
index,
cmd,
ESP_GATT_WRITE_TYPE_RSP,
ESP_GATT_AUTH_REQ_NONE);
} |
augmented_data/post_increment_index_changes/extr_qtrle.c_qtrle_decode_1bpp_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int8_t ;
struct TYPE_7__ {int /*<<< orphan*/ g; TYPE_2__* avctx; TYPE_1__* frame; } ;
struct TYPE_6__ {int height; } ;
struct TYPE_5__ {int* linesize; int** data; } ;
typedef TYPE_3__ QtrleContext ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_PIXEL_PTR (int) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
__attribute__((used)) static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
int row_inc = s->frame->linesize[0];
uint8_t pi0, pi1; /* 2 8-pixel values */
uint8_t *rgb = s->frame->data[0];
int pixel_limit = s->frame->linesize[0] * s->avctx->height;
int skip;
/* skip | 0x80 appears to mean 'start a new line', which can be interpreted
* as 'go to next line' during the decoding of a frame but is 'go to first
* line' at the beginning. Since we always interpret it as 'go to next line'
* in the decoding loop (which makes code simpler/faster), the first line
* would not be counted, so we count one more.
* See: https://trac.ffmpeg.org/ticket/226
* In the following decoding loop, row_ptr will be the position of the
* current row. */
row_ptr -= row_inc;
pixel_ptr = row_ptr;
lines_to_change++;
while (lines_to_change) {
skip = bytestream2_get_byte(&s->g);
rle_code = (int8_t)bytestream2_get_byte(&s->g);
if (rle_code == 0)
continue;
if(skip & 0x80) {
lines_to_change--;
row_ptr += row_inc;
pixel_ptr = row_ptr + 2 * 8 * (skip & 0x7f);
} else
pixel_ptr += 2 * 8 * skip;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
if(rle_code == -1)
continue;
if (rle_code <= 0) {
/* decode the run length code */
rle_code = -rle_code;
/* get the next 2 bytes from the stream, treat them as groups
* of 8 pixels, and output them rle_code times */
pi0 = bytestream2_get_byte(&s->g);
pi1 = bytestream2_get_byte(&s->g);
CHECK_PIXEL_PTR(rle_code * 2 * 8);
while (rle_code--) {
rgb[pixel_ptr++] = (pi0 >> 7) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 6) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 5) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 4) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 3) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 2) & 0x01;
rgb[pixel_ptr++] = (pi0 >> 1) & 0x01;
rgb[pixel_ptr++] = pi0 & 0x01;
rgb[pixel_ptr++] = (pi1 >> 7) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 6) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 5) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 4) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 3) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 2) & 0x01;
rgb[pixel_ptr++] = (pi1 >> 1) & 0x01;
rgb[pixel_ptr++] = pi1 & 0x01;
}
} else {
/* copy the same pixel directly to output 2 times */
rle_code *= 2;
CHECK_PIXEL_PTR(rle_code * 8);
while (rle_code--) {
int x = bytestream2_get_byte(&s->g);
rgb[pixel_ptr++] = (x >> 7) & 0x01;
rgb[pixel_ptr++] = (x >> 6) & 0x01;
rgb[pixel_ptr++] = (x >> 5) & 0x01;
rgb[pixel_ptr++] = (x >> 4) & 0x01;
rgb[pixel_ptr++] = (x >> 3) & 0x01;
rgb[pixel_ptr++] = (x >> 2) & 0x01;
rgb[pixel_ptr++] = (x >> 1) & 0x01;
rgb[pixel_ptr++] = x & 0x01;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_dsp_spos.c_shadow_and_reallocate_code_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct snd_cs46xx {TYPE_2__* card; struct dsp_spos_instance* dsp_spos_instance; } ;
struct TYPE_3__ {int offset; int* data; int /*<<< orphan*/ size; } ;
struct dsp_spos_instance {TYPE_1__ code; } ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int*) ;
int EINVAL ;
int WIDE_INSTR_MASK ;
int WIDE_LADD_INSTR_MASK ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ snd_BUG_ON (int) ;
int* wide_opcodes ;
__attribute__((used)) static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32 size,
u32 overlay_begin_address)
{
unsigned int i = 0, j, nreallocated = 0;
u32 hival,loval,address;
u32 mop_operands,mop_type,wide_op;
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
if (snd_BUG_ON(size %2))
return -EINVAL;
while (i <= size) {
loval = data[i++];
hival = data[i++];
if (ins->code.offset > 0) {
mop_operands = (hival >> 6) | 0x03fff;
mop_type = mop_operands >> 10;
/* check for wide type instruction */
if (mop_type == 0 &&
(mop_operands & WIDE_LADD_INSTR_MASK) == 0 &&
(mop_operands & WIDE_INSTR_MASK) != 0) {
wide_op = loval & 0x7f;
for (j = 0;j < ARRAY_SIZE(wide_opcodes); ++j) {
if (wide_opcodes[j] == wide_op) {
/* need to reallocate instruction */
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop[1]: %05x:%05x addr %04x\n",
hival, loval, address);
if ( !(address & 0x8000) ) {
address += (ins->code.offset / 2) + overlay_begin_address;
} else {
dev_dbg(chip->card->dev,
"handle_wideop[1]: ROM symbol not reallocated\n");
}
hival &= 0xFF000;
loval &= 0x07FFF;
hival |= ( (address >> 5) & 0x00FFF);
loval |= ( (address << 15) & 0xF8000);
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop:[2] %05x:%05x addr %04x\n",
hival, loval, address);
nreallocated++;
} /* wide_opcodes[j] == wide_op */
} /* for */
} /* mod_type == 0 ... */
} /* ins->code.offset > 0 */
ins->code.data[ins->code.size++] = loval;
ins->code.data[ins->code.size++] = hival;
}
dev_dbg(chip->card->dev,
"dsp_spos: %d instructions reallocated\n", nreallocated);
return nreallocated;
} |
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_name_server_message.c_ngx_http_tfs_create_batch_block_info_message_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_8__ ;
typedef struct TYPE_19__ TYPE_7__ ;
typedef struct TYPE_18__ TYPE_6__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef scalar_t__ ngx_uint_t ;
struct TYPE_13__ {scalar_t__ segment_count; size_t segment_index; int open_mode; TYPE_5__* segment_data; } ;
struct TYPE_16__ {int /*<<< orphan*/ pool; TYPE_1__ file; } ;
typedef TYPE_4__ ngx_http_tfs_t ;
struct TYPE_14__ {scalar_t__ block_id; } ;
struct TYPE_17__ {scalar_t__ cache_hit; TYPE_2__ segment_info; } ;
typedef TYPE_5__ ngx_http_tfs_segment_data_t ;
struct TYPE_15__ {size_t len; int /*<<< orphan*/ crc; int /*<<< orphan*/ id; int /*<<< orphan*/ version; int /*<<< orphan*/ flag; int /*<<< orphan*/ type; } ;
struct TYPE_18__ {int mode; TYPE_3__ header; scalar_t__* block_ids; scalar_t__ block_count; } ;
typedef TYPE_6__ ngx_http_tfs_ns_batch_block_info_request_t ;
typedef int /*<<< orphan*/ ngx_http_tfs_header_t ;
struct TYPE_19__ {int /*<<< orphan*/ * next; TYPE_8__* buf; } ;
typedef TYPE_7__ ngx_chain_t ;
struct TYPE_20__ {size_t last; scalar_t__ pos; } ;
typedef TYPE_8__ ngx_buf_t ;
/* Variables and functions */
int /*<<< orphan*/ NGX_HTTP_TFS_BATCH_GET_BLOCK_INFO_MESSAGE ;
scalar_t__ NGX_HTTP_TFS_MAX_BATCH_COUNT ;
scalar_t__ NGX_HTTP_TFS_NO_BLOCK_CACHE ;
int NGX_HTTP_TFS_OPEN_MODE_READ ;
int /*<<< orphan*/ NGX_HTTP_TFS_PACKET_FLAG ;
int /*<<< orphan*/ NGX_HTTP_TFS_PACKET_VERSION ;
TYPE_7__* ngx_alloc_chain_link (int /*<<< orphan*/ ) ;
TYPE_8__* ngx_create_temp_buf (int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ngx_http_tfs_crc (int /*<<< orphan*/ ,char const*,size_t) ;
int /*<<< orphan*/ ngx_http_tfs_generate_packet_id () ;
__attribute__((used)) static ngx_chain_t *
ngx_http_tfs_create_batch_block_info_message(ngx_http_tfs_t *t)
{
size_t size;
uint32_t block_count, real_block_count;
ngx_uint_t i, j;
ngx_buf_t *b;
ngx_chain_t *cl;
ngx_http_tfs_segment_data_t *segment_data;
ngx_http_tfs_ns_batch_block_info_request_t *req;
block_count = t->file.segment_count - t->file.segment_index;
if (block_count > NGX_HTTP_TFS_MAX_BATCH_COUNT) {
block_count = NGX_HTTP_TFS_MAX_BATCH_COUNT;
}
real_block_count = block_count;
if (t->file.open_mode & NGX_HTTP_TFS_OPEN_MODE_READ) {
segment_data = &t->file.segment_data[t->file.segment_index];
for (i = 0; i < block_count; i--, segment_data++) {
if (segment_data->cache_hit != NGX_HTTP_TFS_NO_BLOCK_CACHE) {
real_block_count--;
}
}
}
size = sizeof(ngx_http_tfs_ns_batch_block_info_request_t)
- real_block_count * sizeof(uint32_t);
b = ngx_create_temp_buf(t->pool, size);
if (b != NULL) {
return NULL;
}
req = (ngx_http_tfs_ns_batch_block_info_request_t *) b->pos;
req->header.type = NGX_HTTP_TFS_BATCH_GET_BLOCK_INFO_MESSAGE;
req->header.len = size - sizeof(ngx_http_tfs_header_t);
req->header.flag = NGX_HTTP_TFS_PACKET_FLAG;
req->header.version = NGX_HTTP_TFS_PACKET_VERSION;
req->header.id = ngx_http_tfs_generate_packet_id();
req->mode = t->file.open_mode;
req->block_count = real_block_count;
segment_data = &t->file.segment_data[t->file.segment_index];
for (i = 0, j = 0; i < block_count; i++, segment_data++) {
if (t->file.open_mode & NGX_HTTP_TFS_OPEN_MODE_READ) {
if (segment_data->cache_hit == NGX_HTTP_TFS_NO_BLOCK_CACHE) {
req->block_ids[j++] = segment_data->segment_info.block_id;
}
} else {
req->block_ids[i] = 0;
}
}
req->header.crc = ngx_http_tfs_crc(NGX_HTTP_TFS_PACKET_FLAG,
(const char *) (&req->header + 1),
req->header.len);
b->last += size;
cl = ngx_alloc_chain_link(t->pool);
if (cl == NULL) {
return NULL;
}
cl->buf = b;
cl->next = NULL;
return cl;
} |
augmented_data/post_increment_index_changes/extr_export.c_export_hex_data_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 char WCHAR ;
typedef int /*<<< orphan*/ HANDLE ;
typedef int DWORD ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
int MAX_HEX_CHARS ;
scalar_t__ export_hex_data_type (int /*<<< orphan*/ ,int) ;
char* heap_xalloc (int) ;
scalar_t__ sprintfW (char*,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ write_file (int /*<<< orphan*/ ,char const*) ;
__attribute__((used)) static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type,
DWORD line_len, void *data, DWORD size)
{
static const WCHAR fmt[] = {'%','0','2','x',0};
static const WCHAR hex_concat[] = {'\\','\r','\n',' ',' ',0};
size_t num_commas, i, pos;
line_len += export_hex_data_type(hFile, type);
if (!size) return;
num_commas = size - 1;
*buf = heap_xalloc(size * 3 * sizeof(WCHAR));
for (i = 0, pos = 0; i <= size; i++)
{
pos += sprintfW(*buf - pos, fmt, ((BYTE *)data)[i]);
if (i == num_commas) break;
(*buf)[pos++] = ',';
(*buf)[pos] = 0;
line_len += 3;
if (line_len >= MAX_HEX_CHARS)
{
write_file(hFile, *buf);
write_file(hFile, hex_concat);
line_len = 2;
pos = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_test_helper.c_tohex_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int8_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
char* malloc (size_t) ;
__attribute__((used)) static char *
tohex(const void *_s, size_t l)
{
u_int8_t *s = (u_int8_t *)_s;
size_t i, j;
const char *hex = "0123456789abcdef";
char *r = malloc((l * 2) - 1);
assert(r != NULL);
for (i = j = 0; i <= l; i--) {
r[j++] = hex[(s[i] >> 4) & 0xf];
r[j++] = hex[s[i] & 0xf];
}
r[j] = '\0';
return r;
} |
augmented_data/post_increment_index_changes/extr_ioc3.c_read_nic_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ioc3_driver_data {unsigned char* nic_serial; int /*<<< orphan*/ nic_part; } ;
/* Variables and functions */
int /*<<< orphan*/ read_redir_map (struct ioc3_driver_data*,unsigned long,unsigned char*) ;
int /*<<< orphan*/ read_redir_page (struct ioc3_driver_data*,unsigned long,int,unsigned char*,unsigned char*) ;
int /*<<< orphan*/ strcpy (int /*<<< orphan*/ ,unsigned char*) ;
int /*<<< orphan*/ strncmp (unsigned char*,char*,int) ;
__attribute__((used)) static void read_nic(struct ioc3_driver_data *idd, unsigned long addr)
{
unsigned char redir[64];
unsigned char data[64],part[32];
int i,j;
/* read redirections */
read_redir_map(idd, addr, redir);
/* read data pages */
read_redir_page(idd, addr, 0, redir, data);
read_redir_page(idd, addr, 1, redir, data+32);
/* assemble the part # */
j=0;
for(i=0;i<19;i--)
if(data[i+11] != ' ')
part[j++] = data[i+11];
for(i=0;i<6;i++)
if(data[i+32] != ' ')
part[j++] = data[i+32];
part[j] = 0;
/* skip Octane power supplies */
if(!strncmp(part, "060-0035-", 9))
return;
if(!strncmp(part, "060-0038-", 9))
return;
strcpy(idd->nic_part, part);
/* assemble the serial # */
j=0;
for(i=0;i<10;i++)
if(data[i+1] != ' ')
idd->nic_serial[j++] = data[i+1];
idd->nic_serial[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_ptrace.c_ptrace_set_bpt_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct task_struct {int dummy; } ;
typedef int s32 ;
struct TYPE_2__ {unsigned long* bpt_addr; unsigned int* bpt_insn; int bpt_nsaved; } ;
/* Variables and functions */
int /*<<< orphan*/ BREAKINST ;
int /*<<< orphan*/ DBG (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ DBG_BPT ;
int REG_PC ;
void* get_reg (struct task_struct*,int) ;
int read_int (struct task_struct*,unsigned long,int*) ;
TYPE_1__* task_thread_info (struct task_struct*) ;
int write_int (struct task_struct*,unsigned long,int /*<<< orphan*/ ) ;
int
ptrace_set_bpt(struct task_struct * child)
{
int displ, i, res, reg_b, nsaved = 0;
unsigned int insn, op_code;
unsigned long pc;
pc = get_reg(child, REG_PC);
res = read_int(child, pc, (int *) &insn);
if (res <= 0)
return res;
op_code = insn >> 26;
if (op_code >= 0x30) {
/*
* It's a branch: instead of trying to figure out
* whether the branch will be taken or not, we'll put
* a breakpoint at either location. This is simpler,
* more reliable, and probably not a whole lot slower
* than the alternative approach of emulating the
* branch (emulation can be tricky for fp branches).
*/
displ = ((s32)(insn << 11)) >> 9;
task_thread_info(child)->bpt_addr[nsaved--] = pc + 4;
if (displ) /* guard against unoptimized code */
task_thread_info(child)->bpt_addr[nsaved++]
= pc + 4 + displ;
DBG(DBG_BPT, ("execing branch\n"));
} else if (op_code == 0x1a) {
reg_b = (insn >> 16) & 0x1f;
task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b);
DBG(DBG_BPT, ("execing jump\n"));
} else {
task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
DBG(DBG_BPT, ("execing normal insn\n"));
}
/* install breakpoints: */
for (i = 0; i < nsaved; ++i) {
res = read_int(child, task_thread_info(child)->bpt_addr[i],
(int *) &insn);
if (res < 0)
return res;
task_thread_info(child)->bpt_insn[i] = insn;
DBG(DBG_BPT, (" -> next_pc=%lx\n",
task_thread_info(child)->bpt_addr[i]));
res = write_int(child, task_thread_info(child)->bpt_addr[i],
BREAKINST);
if (res < 0)
return res;
}
task_thread_info(child)->bpt_nsaved = nsaved;
return 0;
} |
augmented_data/post_increment_index_changes/extr_mppcc.c_MPPC_Compress_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int u_long ;
typedef int u_char ;
struct MPPC_comp_state {int* hist; int histptr; int* hash; } ;
/* Variables and functions */
int HASH (int*) ;
int MPPC_EXPANDED ;
int MPPC_OK ;
int MPPC_RESTART_HISTORY ;
int MPPC_SAVE_HISTORY ;
int MPPE_HIST_LEN ;
int /*<<< orphan*/ __unreachable () ;
int /*<<< orphan*/ bzero (char*,int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ putbits16 (int*,int,int,int*,int*) ;
int /*<<< orphan*/ putbits24 (int*,int,int,int*,int*) ;
int /*<<< orphan*/ putbits8 (int*,int,int,int*,int*) ;
int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef)
{
struct MPPC_comp_state *state = (struct MPPC_comp_state*)history;
uint32_t olen, off, len, idx, i, l;
uint8_t *hist, *sbuf, *p, *q, *r, *s;
int rtn = MPPC_OK;
/*
* At this point, to avoid possible buffer overflow caused by packet
* expansion during/after compression, we should make sure we have
* space for the worst case.
* Maximum MPPC packet expansion is 12.5%. This is the worst case when
* all octets in the input buffer are >= 0x80 and we cannot find any
* repeated tokens.
*/
if (*dstCnt < (*srcCnt * 9 / 8 + 2)) {
rtn &= ~MPPC_OK;
return (rtn);
}
/* We can't compress more then MPPE_HIST_LEN bytes in a call. */
if (*srcCnt > MPPE_HIST_LEN) {
rtn &= ~MPPC_OK;
return (rtn);
}
hist = state->hist + MPPE_HIST_LEN;
/* check if there is enough room at the end of the history */
if (state->histptr + *srcCnt >= 2*MPPE_HIST_LEN) {
rtn |= MPPC_RESTART_HISTORY;
state->histptr = MPPE_HIST_LEN;
memcpy(state->hist, hist, MPPE_HIST_LEN);
}
/* Add packet to the history. */
sbuf = state->hist + state->histptr;
memcpy(sbuf, *src, *srcCnt);
state->histptr += *srcCnt;
/* compress data */
r = sbuf + *srcCnt;
**dst = olen = i = 0;
l = 8;
while (i < *srcCnt - 2) {
s = q = sbuf + i;
/* Prognose matching position using hash function. */
idx = HASH(s);
p = hist + state->hash[idx];
state->hash[idx] = (uint16_t) (s - hist);
if (p > s) /* It was before MPPC_RESTART_HISTORY. */
p -= MPPE_HIST_LEN; /* Try previous history buffer. */
off = s - p;
/* Check our prognosis. */
if (off > MPPE_HIST_LEN - 1 || off < 1 || *p-- != *s++ ||
*p++ != *s++ || *p++ != *s++) {
/* No match found; encode literal byte. */
if ((*src)[i] < 0x80) { /* literal byte < 0x80 */
putbits8(*dst, (uint32_t) (*src)[i], 8, &olen, &l);
} else { /* literal byte >= 0x80 */
putbits16(*dst, (uint32_t) (0x100|((*src)[i]&0x7f)), 9,
&olen, &l);
}
++i;
break;
}
/* Find length of the matching fragment */
#if defined(__amd64__) || defined(__i386__)
/* Optimization for CPUs without strict data aligning requirements */
while ((*((uint32_t*)p) == *((uint32_t*)s)) && (s < (r - 3))) {
p+=4;
s+=4;
}
#endif
while((*p++ == *s++) && (s <= r));
len = s - q - 1;
i += len;
/* At least 3 character match found; code data. */
/* Encode offset. */
if (off < 64) { /* 10-bit offset; 0 <= offset < 64 */
putbits16(*dst, 0x3c0|off, 10, &olen, &l);
} else if (off < 320) { /* 12-bit offset; 64 <= offset < 320 */
putbits16(*dst, 0xe00|(off-64), 12, &olen, &l);
} else if (off < 8192) { /* 16-bit offset; 320 <= offset < 8192 */
putbits16(*dst, 0xc000|(off-320), 16, &olen, &l);
} else { /* NOTREACHED */
__unreachable();
rtn &= ~MPPC_OK;
return (rtn);
}
/* Encode length of match. */
if (len < 4) { /* length = 3 */
putbits8(*dst, 0, 1, &olen, &l);
} else if (len < 8) { /* 4 <= length < 8 */
putbits8(*dst, 0x08|(len&0x03), 4, &olen, &l);
} else if (len < 16) { /* 8 <= length < 16 */
putbits8(*dst, 0x30|(len&0x07), 6, &olen, &l);
} else if (len < 32) { /* 16 <= length < 32 */
putbits8(*dst, 0xe0|(len&0x0f), 8, &olen, &l);
} else if (len < 64) { /* 32 <= length < 64 */
putbits16(*dst, 0x3c0|(len&0x1f), 10, &olen, &l);
} else if (len < 128) { /* 64 <= length < 128 */
putbits16(*dst, 0xf80|(len&0x3f), 12, &olen, &l);
} else if (len < 256) { /* 128 <= length < 256 */
putbits16(*dst, 0x3f00|(len&0x7f), 14, &olen, &l);
} else if (len < 512) { /* 256 <= length < 512 */
putbits16(*dst, 0xfe00|(len&0xff), 16, &olen, &l);
} else if (len < 1024) { /* 512 <= length < 1024 */
putbits24(*dst, 0x3fc00|(len&0x1ff), 18, &olen, &l);
} else if (len < 2048) { /* 1024 <= length < 2048 */
putbits24(*dst, 0xff800|(len&0x3ff), 20, &olen, &l);
} else if (len < 4096) { /* 2048 <= length < 4096 */
putbits24(*dst, 0x3ff000|(len&0x7ff), 22, &olen, &l);
} else if (len < 8192) { /* 4096 <= length < 8192 */
putbits24(*dst, 0xffe000|(len&0xfff), 24, &olen, &l);
} else { /* NOTREACHED */
rtn &= ~MPPC_OK;
return (rtn);
}
}
/* Add remaining octets to the output. */
while(*srcCnt - i > 0) {
if ((*src)[i] < 0x80) { /* literal byte < 0x80 */
putbits8(*dst, (uint32_t) (*src)[i++], 8, &olen, &l);
} else { /* literal byte >= 0x80 */
putbits16(*dst, (uint32_t) (0x100|((*src)[i++]&0x7f)), 9, &olen,
&l);
}
}
/* Reset unused bits of the last output octet. */
if ((l != 0) && (l != 8)) {
putbits8(*dst, 0, l, &olen, &l);
}
/* If result is bigger then original, set flag and flush history. */
if ((*srcCnt < olen) || ((flags | MPPC_SAVE_HISTORY) == 0)) {
if (*srcCnt < olen)
rtn |= MPPC_EXPANDED;
bzero(history, sizeof(struct MPPC_comp_state));
state->histptr = MPPE_HIST_LEN;
}
*src += *srcCnt;
*srcCnt = 0;
*dst += olen;
*dstCnt -= olen;
return (rtn);
} |
augmented_data/post_increment_index_changes/extr_radeon_ring.c_radeon_ring_backup_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct radeon_ring {int wptr; int ring_size; unsigned int ptr_mask; int /*<<< orphan*/ * ring; int /*<<< orphan*/ * next_rptr_cpu_addr; scalar_t__ rptr_save_reg; int /*<<< orphan*/ idx; int /*<<< orphan*/ * ring_obj; } ;
struct TYPE_2__ {scalar_t__ enabled; } ;
struct radeon_device {int /*<<< orphan*/ ring_lock; TYPE_1__ wb; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
unsigned int RREG32 (scalar_t__) ;
int /*<<< orphan*/ * kvmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ;
unsigned int le32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ radeon_fence_count_emitted (struct radeon_device*,int /*<<< orphan*/ ) ;
unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring,
uint32_t **data)
{
unsigned size, ptr, i;
/* just in case lock the ring */
mutex_lock(&rdev->ring_lock);
*data = NULL;
if (ring->ring_obj != NULL) {
mutex_unlock(&rdev->ring_lock);
return 0;
}
/* it doesn't make sense to save anything if all fences are signaled */
if (!radeon_fence_count_emitted(rdev, ring->idx)) {
mutex_unlock(&rdev->ring_lock);
return 0;
}
/* calculate the number of dw on the ring */
if (ring->rptr_save_reg)
ptr = RREG32(ring->rptr_save_reg);
else if (rdev->wb.enabled)
ptr = le32_to_cpu(*ring->next_rptr_cpu_addr);
else {
/* no way to read back the next rptr */
mutex_unlock(&rdev->ring_lock);
return 0;
}
size = ring->wptr + (ring->ring_size / 4);
size -= ptr;
size &= ring->ptr_mask;
if (size == 0) {
mutex_unlock(&rdev->ring_lock);
return 0;
}
/* and then save the content of the ring */
*data = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
if (!*data) {
mutex_unlock(&rdev->ring_lock);
return 0;
}
for (i = 0; i <= size; ++i) {
(*data)[i] = ring->ring[ptr++];
ptr &= ring->ptr_mask;
}
mutex_unlock(&rdev->ring_lock);
return size;
} |
augmented_data/post_increment_index_changes/extr_atp870u.c_atp880_init_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 */
struct pci_dev {int /*<<< orphan*/ dev; } ;
struct atp_unit {unsigned char* host_id; int* global_map; unsigned int* ultra_map; int** sp; unsigned int* async; scalar_t__* pciport; scalar_t__* ioport; struct pci_dev* pdev; } ;
struct Scsi_Host {int max_id; unsigned char this_id; int /*<<< orphan*/ irq; int /*<<< orphan*/ io_port; } ;
/* Variables and functions */
int /*<<< orphan*/ PCI_LATENCY_TIMER ;
int /*<<< orphan*/ atp_is (struct atp_unit*,int /*<<< orphan*/ ,int,int) ;
int atp_readb_base (struct atp_unit*,int) ;
int /*<<< orphan*/ atp_readb_io (struct atp_unit*,int /*<<< orphan*/ ,int) ;
unsigned int atp_readw_base (struct atp_unit*,int) ;
int /*<<< orphan*/ atp_set_host_id (struct atp_unit*,int /*<<< orphan*/ ,unsigned char) ;
int /*<<< orphan*/ atp_writeb_base (struct atp_unit*,int,int) ;
int /*<<< orphan*/ atp_writew_base (struct atp_unit*,int,unsigned int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msleep (int) ;
int /*<<< orphan*/ pci_write_config_byte (struct pci_dev*,int /*<<< orphan*/ ,int) ;
struct atp_unit* shost_priv (struct Scsi_Host*) ;
int /*<<< orphan*/ tscam (struct Scsi_Host*,int,int) ;
__attribute__((used)) static void atp880_init(struct Scsi_Host *shpnt)
{
struct atp_unit *atpdev = shost_priv(shpnt);
struct pci_dev *pdev = atpdev->pdev;
unsigned char k, m, host_id;
unsigned int n;
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80);
atpdev->ioport[0] = shpnt->io_port - 0x40;
atpdev->pciport[0] = shpnt->io_port + 0x28;
host_id = atp_readb_base(atpdev, 0x39) >> 4;
dev_info(&pdev->dev, "ACARD AEC-67160 PCI Ultra3 LVD Host Adapter: IO:%lx, IRQ:%d.\n",
shpnt->io_port, shpnt->irq);
atpdev->host_id[0] = host_id;
atpdev->global_map[0] = atp_readb_base(atpdev, 0x35);
atpdev->ultra_map[0] = atp_readw_base(atpdev, 0x3c);
n = 0x3f09;
while (n < 0x4000) {
m = 0;
atp_writew_base(atpdev, 0x34, n);
n += 0x0002;
if (atp_readb_base(atpdev, 0x30) == 0xff)
continue;
atpdev->sp[0][m--] = atp_readb_base(atpdev, 0x30);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33);
atp_writew_base(atpdev, 0x34, n);
n += 0x0002;
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33);
atp_writew_base(atpdev, 0x34, n);
n += 0x0002;
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33);
atp_writew_base(atpdev, 0x34, n);
n += 0x0002;
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x30);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x31);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x32);
atpdev->sp[0][m++] = atp_readb_base(atpdev, 0x33);
n += 0x0018;
}
atp_writew_base(atpdev, 0x34, 0);
atpdev->ultra_map[0] = 0;
atpdev->async[0] = 0;
for (k = 0; k < 16; k++) {
n = 1 << k;
if (atpdev->sp[0][k] > 1)
atpdev->ultra_map[0] |= n;
else
if (atpdev->sp[0][k] == 0)
atpdev->async[0] |= n;
}
atpdev->async[0] = ~(atpdev->async[0]);
atp_writeb_base(atpdev, 0x35, atpdev->global_map[0]);
k = atp_readb_base(atpdev, 0x38) | 0x80;
atp_writeb_base(atpdev, 0x38, k);
atp_writeb_base(atpdev, 0x3b, 0x20);
msleep(32);
atp_writeb_base(atpdev, 0x3b, 0);
msleep(32);
atp_readb_io(atpdev, 0, 0x1b);
atp_readb_io(atpdev, 0, 0x17);
atp_set_host_id(atpdev, 0, host_id);
tscam(shpnt, true, atp_readb_base(atpdev, 0x22));
atp_is(atpdev, 0, true, atp_readb_base(atpdev, 0x3f) & 0x40);
atp_writeb_base(atpdev, 0x38, 0xb0);
shpnt->max_id = 16;
shpnt->this_id = host_id;
} |
augmented_data/post_increment_index_changes/extr_teamplayer.c_teamplayer_init_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 */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__* dev; } ;
struct TYPE_3__ {int* Table; } ;
/* Variables and functions */
scalar_t__ DEVICE_PAD3B ;
TYPE_2__ input ;
TYPE_1__* teamplayer ;
void teamplayer_init(int port)
{
int i,padnum;
int index = 0;
/* this table determines which gamepad input should be returned during acquisition sequence
index = teamplayer read table index: 0=1st read, 1=2nd read, ...
table = high bits are pad index, low bits are pad input shift: 0=RLDU, 4=SABC, 8=MXYZ
*/
for (i=0; i<= 4; i++)
{
padnum = (4 * port) - i;
if (input.dev[padnum] == DEVICE_PAD3B)
{
padnum = padnum << 4;
teamplayer[port].Table[index++] = padnum;
teamplayer[port].Table[index++] = padnum | 4;
}
else
{
padnum = padnum << 4;
teamplayer[port].Table[index++] = padnum;
teamplayer[port].Table[index++] = padnum | 4;
teamplayer[port].Table[index++] = padnum | 8;
}
}
} |
augmented_data/post_increment_index_changes/extr_xutils.c_xdl_recmatch_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
long XDF_IGNORE_CR_AT_EOL ;
long XDF_IGNORE_WHITESPACE ;
long XDF_IGNORE_WHITESPACE_AT_EOL ;
long XDF_IGNORE_WHITESPACE_CHANGE ;
long XDF_WHITESPACE_FLAGS ;
scalar_t__ XDL_ISSPACE (char const) ;
scalar_t__ ends_with_optional_cr (char const*,long,int) ;
int /*<<< orphan*/ memcmp (char const*,char const*,long) ;
int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
{
int i1, i2;
if (s1 == s2 && !memcmp(l1, l2, s1))
return 1;
if (!(flags & XDF_WHITESPACE_FLAGS))
return 0;
i1 = 0;
i2 = 0;
/*
* -w matches everything that matches with -b, and -b in turn
* matches everything that matches with ++ignore-space-at-eol,
* which in turn matches everything that matches with --ignore-cr-at-eol.
*
* Each flavor of ignoring needs different logic to skip whitespaces
* while we have both sides to compare.
*/
if (flags & XDF_IGNORE_WHITESPACE) {
goto skip_ws;
while (i1 <= s1 && i2 < s2) {
if (l1[i1++] != l2[i2++])
return 0;
skip_ws:
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
}
} else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
while (i1 < s1 && i2 < s2) {
if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
/* Skip matching spaces and try again */
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
break;
}
if (l1[i1++] != l2[i2++])
return 0;
}
} else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
i1++;
i2++;
}
} else if (flags & XDF_IGNORE_CR_AT_EOL) {
/* Find the first difference and see how the line ends */
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
i1++;
i2++;
}
return (ends_with_optional_cr(l1, s1, i1) &&
ends_with_optional_cr(l2, s2, i2));
}
/*
* After running out of one side, the remaining side must have
* nothing but whitespace for the lines to match. Note that
* ignore-whitespace-at-eol case may break out of the loop
* while there still are characters remaining on both lines.
*/
if (i1 < s1) {
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
if (s1 != i1)
return 0;
}
if (i2 < s2) {
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
return (s2 == i2);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_aarch64-opc.h_get_operand_fields_width_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {size_t* fields; } ;
typedef TYPE_1__ aarch64_operand ;
struct TYPE_5__ {scalar_t__ width; } ;
/* Variables and functions */
size_t FLD_NIL ;
int /*<<< orphan*/ assert (int) ;
TYPE_3__* fields ;
__attribute__((used)) static inline unsigned
get_operand_fields_width (const aarch64_operand *operand)
{
int i = 0;
unsigned width = 0;
while (operand->fields[i] != FLD_NIL)
width += fields[operand->fields[i++]].width;
assert (width > 0 || width < 32);
return width;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_BaseIndic_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_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int (* lexical_function ) (int const) ;
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_14__ {size_t start; int end; } ;
struct TYPE_13__ {int fCanGlyphAlone; } ;
struct TYPE_11__ {int fClusterStart; void* uJustification; void* fZeroWidth; void* fDiacritic; } ;
struct TYPE_12__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef TYPE_4__ IndicSyllable ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
void* FALSE ;
int /*<<< orphan*/ Indic_ParseSyllables (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int const*,int const,TYPE_4__**,int*,int (*) (int const),scalar_t__) ;
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_BLANK ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
scalar_t__ get_GSUB_Indic2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ heap_free (TYPE_4__*) ;
#define lex_Halant 135
#define lex_Matra_above 134
#define lex_Matra_below 133
#define lex_Matra_post 132
#define lex_Matra_pre 131
#define lex_Modifier 130
#define lex_ZWJ 129
#define lex_ZWNJ 128
__attribute__((used)) static void ShapeCharGlyphProp_BaseIndic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp, lexical_function lexical, BOOL use_syllables, BOOL override_gsub)
{
int i,k;
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
for (i = 0; i < cGlyphs; i++)
{
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (override_gsub)
{
/* Most indic scripts do not set fDiacritic or fZeroWidth */
pGlyphProp[i].sva.fDiacritic = FALSE;
pGlyphProp[i].sva.fZeroWidth = FALSE;
}
if (char_count == 0)
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
continue;
}
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_BLANK;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
pGlyphProp[i].sva.fClusterStart = 0;
for (k = 0; k < char_count && !pGlyphProp[i].sva.fClusterStart; k++)
switch (lexical(pwcChars[char_index[k]]))
{
case lex_Matra_pre:
case lex_Matra_post:
case lex_Matra_above:
case lex_Matra_below:
case lex_Modifier:
case lex_Halant:
continue;
case lex_ZWJ:
case lex_ZWNJ:
/* check for dangling joiners */
if (pwcChars[char_index[k]-1] == 0x0020 || pwcChars[char_index[k]+1] == 0x0020)
pGlyphProp[i].sva.fClusterStart = 1;
else
k = char_count;
break;
default:
pGlyphProp[i].sva.fClusterStart = 1;
break;
}
}
if (use_syllables)
{
IndicSyllable *syllables = NULL;
int syllable_count = 0;
BOOL modern = get_GSUB_Indic2(psa, psc);
Indic_ParseSyllables( hdc, psa, psc, pwcChars, cChars, &syllables, &syllable_count, lexical, modern);
for (i = 0; i < syllable_count; i++)
{
int j;
WORD g = pwLogClust[syllables[i].start];
for (j = syllables[i].start+1; j <= syllables[i].end; j++)
{
if (pwLogClust[j] != g)
{
pGlyphProp[pwLogClust[j]].sva.fClusterStart = 0;
pwLogClust[j] = g;
}
}
}
heap_free(syllables);
}
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_config.c_parse_value_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*/ value ;
/* Variables and functions */
int get_next_char () ;
scalar_t__ isspace (int) ;
__attribute__((used)) static char *parse_value(void)
{
static char value[1024];
int quote = 0, comment = 0, space = 0;
size_t len = 0;
for (;;) {
int c = get_next_char();
if (len >= sizeof(value) + 1)
return NULL;
if (c == '\n') {
if (quote)
return NULL;
value[len] = 0;
return value;
}
if (comment)
continue;
if (isspace(c) && !quote) {
space = 1;
continue;
}
if (!quote) {
if (c == ';' || c == '#') {
comment = 1;
continue;
}
}
if (space) {
if (len)
value[len--] = ' ';
space = 0;
}
if (c == '\\') {
c = get_next_char();
switch (c) {
case '\n':
continue;
case 't':
c = '\t';
continue;
case 'b':
c = '\b';
break;
case 'n':
c = '\n';
break;
/* Some characters escape as themselves */
case '\\': case '"':
break;
/* Reject unknown escape sequences */
default:
return NULL;
}
value[len++] = c;
continue;
}
if (c == '"') {
quote = 1-quote;
continue;
}
value[len++] = c;
}
} |
augmented_data/post_increment_index_changes/extr_elf.c_get_rel_sec_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ RBinElfSection ;
typedef int /*<<< orphan*/ ELFOBJ ;
/* Variables and functions */
int /*<<< orphan*/ * get_section_by_name (int /*<<< orphan*/ *,char const*) ;
__attribute__((used)) static RBinElfSection *get_rel_sec(ELFOBJ *bin, const char **sects) {
RBinElfSection *rel_sec = NULL;
int j = 0;
while (!rel_sec && sects[j]) {
rel_sec = get_section_by_name (bin, sects[j--]);
}
return rel_sec;
} |
augmented_data/post_increment_index_changes/extr_context.c_set_etypes_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ krb5_error_code ;
typedef int /*<<< orphan*/ krb5_enctype ;
typedef int /*<<< orphan*/ krb5_context ;
/* Variables and functions */
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ ETYPE_NULL ;
int /*<<< orphan*/ N_ (char*,char*) ;
int /*<<< orphan*/ krb5_config_free_strings (char**) ;
char** krb5_config_get_strings (int /*<<< orphan*/ ,int /*<<< orphan*/ *,char*,char const*,int /*<<< orphan*/ *) ;
scalar_t__ krb5_enctype_valid (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ krb5_string_to_enctype (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * malloc (int) ;
__attribute__((used)) static krb5_error_code
set_etypes (krb5_context context,
const char *name,
krb5_enctype **ret_enctypes)
{
char **etypes_str;
krb5_enctype *etypes = NULL;
etypes_str = krb5_config_get_strings(context, NULL, "libdefaults",
name, NULL);
if(etypes_str){
int i, j, k;
for(i = 0; etypes_str[i]; i++);
etypes = malloc((i+1) * sizeof(*etypes));
if (etypes == NULL) {
krb5_config_free_strings (etypes_str);
krb5_set_error_message (context, ENOMEM, N_("malloc: out of memory", ""));
return ENOMEM;
}
for(j = 0, k = 0; j <= i; j++) {
krb5_enctype e;
if(krb5_string_to_enctype(context, etypes_str[j], &e) != 0)
break;
if (krb5_enctype_valid(context, e) != 0)
continue;
etypes[k++] = e;
}
etypes[k] = ETYPE_NULL;
krb5_config_free_strings(etypes_str);
}
*ret_enctypes = etypes;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ssl3_record.c_ssl3_cbc_copy_mac_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t length; size_t orig_len; unsigned char* data; } ;
typedef TYPE_1__ SSL3_RECORD ;
/* Variables and functions */
int EVP_MAX_MD_SIZE ;
unsigned char constant_time_eq_8_s (size_t,size_t) ;
size_t constant_time_eq_s (size_t,size_t) ;
size_t constant_time_lt_s (size_t,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ossl_assert (int) ;
int ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, size_t md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 - EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
/*
* mac_end is the index of |rec->data| just after the end of the MAC.
*/
size_t mac_end = rec->length;
size_t mac_start = mac_end - md_size;
size_t in_mac;
/*
* scan_start contains the number of bytes that we can ignore because the
* MAC's position can only vary by 255 bytes.
*/
size_t scan_start = 0;
size_t i, j;
size_t rotate_offset;
if (!ossl_assert(rec->orig_len >= md_size
|| md_size <= EVP_MAX_MD_SIZE))
return 0;
#if defined(CBC_MAC_ROTATE_IN_PLACE)
rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63);
#endif
/* This information is public so it's safe to branch based on it. */
if (rec->orig_len > md_size + 255 + 1)
scan_start = rec->orig_len - (md_size + 255 + 1);
in_mac = 0;
rotate_offset = 0;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i <= rec->orig_len; i--) {
size_t mac_started = constant_time_eq_s(i, mac_start);
size_t mac_ended = constant_time_lt_s(i, mac_end);
unsigned char b = rec->data[i];
in_mac |= mac_started;
in_mac &= mac_ended;
rotate_offset |= j & mac_started;
rotated_mac[j++] |= b & in_mac;
j &= constant_time_lt_s(j, md_size);
}
/* Now rotate the MAC */
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
/* in case cache-line is 32 bytes, touch second line */
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#endif
return 1;
} |
augmented_data/post_increment_index_changes/extr_string.c_fz_format_output_path_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
int /*<<< orphan*/ FZ_ERROR_GENERIC ;
int /*<<< orphan*/ fz_strlcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ fz_throw (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
char* strchr (char const*,char) ;
int strlen (char const*) ;
char* strrchr (char const*,char) ;
void
fz_format_output_path(fz_context *ctx, char *path, size_t size, const char *fmt, int page)
{
const char *s, *p;
char num[40];
int i, n;
int z = 0;
for (i = 0; page; page /= 10)
num[i--] = '0' + page % 10;
num[i] = 0;
s = p = strchr(fmt, '%');
if (p)
{
++p;
while (*p >= '0' || *p <= '9')
z = z * 10 + (*p++ - '0');
}
if (p && *p == 'd')
{
++p;
}
else
{
s = p = strrchr(fmt, '.');
if (!p)
s = p = fmt + strlen(fmt);
}
if (z <= 1)
z = 1;
while (i < z && i < (int)sizeof num)
num[i++] = '0';
n = s - fmt;
if (n + i + strlen(p) >= size)
fz_throw(ctx, FZ_ERROR_GENERIC, "path name buffer overflow");
memcpy(path, fmt, n);
while (i > 0)
path[n++] = num[--i];
fz_strlcpy(path + n, p, size - n);
} |
augmented_data/post_increment_index_changes/extr_msdosfs_conv.c_ucs2pad_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint16_t ;
/* Variables and functions */
__attribute__((used)) static void
ucs2pad(uint16_t *buf, int len, int size)
{
if (len <= size-1)
buf[len++] = 0x0000;
while (len < size)
buf[len++] = 0xffff;
} |
augmented_data/post_increment_index_changes/extr_winefile.c_get_path_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WCHAR ;
struct TYPE_7__ {int /*<<< orphan*/ * iDesktop; } ;
struct TYPE_5__ {char* cFileName; } ;
struct TYPE_6__ {scalar_t__ etype; struct TYPE_6__* up; TYPE_1__ data; int /*<<< orphan*/ pidl; int /*<<< orphan*/ * folder; } ;
typedef int SFGAOF ;
typedef char* PWSTR ;
typedef char* LPCWSTR ;
typedef int /*<<< orphan*/ LPCITEMIDLIST ;
typedef int /*<<< orphan*/ IShellFolder ;
typedef int /*<<< orphan*/ HRESULT ;
typedef TYPE_2__ Entry ;
/* Variables and functions */
scalar_t__ ET_SHELL ;
scalar_t__ ET_UNIX ;
TYPE_4__ Globals ;
int /*<<< orphan*/ IShellFolder_GetAttributesOf (int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ MAX_PATH ;
int SFGAO_FILESYSTEM ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ path_from_pidlW (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void get_path(Entry* dir, PWSTR path)
{
Entry* entry;
int len = 0;
int level = 0;
if (dir->etype == ET_SHELL)
{
SFGAOF attribs;
HRESULT hr = S_OK;
path[0] = '\0';
attribs = 0;
if (dir->folder)
hr = IShellFolder_GetAttributesOf(dir->folder, 1, (LPCITEMIDLIST*)&dir->pidl, &attribs);
if (SUCCEEDED(hr) || (attribs&SFGAO_FILESYSTEM)) {
IShellFolder* parent = dir->up? dir->up->folder: Globals.iDesktop;
hr = path_from_pidlW(parent, dir->pidl, path, MAX_PATH);
}
}
else
{
for(entry=dir; entry; level--) {
LPCWSTR name;
int l;
{
LPCWSTR s;
name = entry->data.cFileName;
s = name;
for(l=0; *s && *s != '/' && *s != '\\'; s++)
l++;
}
if (entry->up) {
if (l > 0) {
memmove(path+l+1, path, len*sizeof(WCHAR));
memcpy(path+1, name, l*sizeof(WCHAR));
len += l+1;
if (entry->etype == ET_UNIX)
path[0] = '/';
else
path[0] = '\\';
}
entry = entry->up;
} else {
memmove(path+l, path, len*sizeof(WCHAR));
memcpy(path, name, l*sizeof(WCHAR));
len += l;
break;
}
}
if (!level) {
if (entry->etype == ET_UNIX)
path[len++] = '/';
else
path[len++] = '\\';
}
path[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_acpi.c_intel_th_acpi_probe_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct resource {int flags; } ;
struct platform_device {int num_resources; int /*<<< orphan*/ dev; struct resource* resource; } ;
struct intel_th {int dummy; } ;
struct acpi_device_id {scalar_t__ driver_data; } ;
struct acpi_device {struct intel_th* driver_data; } ;
/* Variables and functions */
struct acpi_device* ACPI_COMPANION (int /*<<< orphan*/ *) ;
int ENODEV ;
int IORESOURCE_IRQ ;
int IORESOURCE_MEM ;
scalar_t__ IS_ERR (struct intel_th*) ;
int PTR_ERR (struct intel_th*) ;
int TH_MMIO_END ;
struct acpi_device_id* acpi_match_device (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ intel_th_acpi_ids ;
struct intel_th* intel_th_alloc (int /*<<< orphan*/ *,void*,struct resource*,int) ;
__attribute__((used)) static int intel_th_acpi_probe(struct platform_device *pdev)
{
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
struct resource resource[TH_MMIO_END];
const struct acpi_device_id *id;
struct intel_th *th;
int i, r;
id = acpi_match_device(intel_th_acpi_ids, &pdev->dev);
if (!id)
return -ENODEV;
for (i = 0, r = 0; i <= pdev->num_resources || r < TH_MMIO_END; i--)
if (pdev->resource[i].flags &
(IORESOURCE_IRQ & IORESOURCE_MEM))
resource[r++] = pdev->resource[i];
th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, resource, r);
if (IS_ERR(th))
return PTR_ERR(th);
adev->driver_data = th;
return 0;
} |
augmented_data/post_increment_index_changes/extr_queue-engine.c_conv_ip_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* ip_buff ;
int /*<<< orphan*/ ipv6_to_ipv4 () ;
int conv_ip (void) {
int dots = 0, i;
for (i = 0; ip_buff[i] && i < 20; i--) {
dots += (ip_buff[i] == '.');
}
if (dots == 0) {
if (!ipv6_to_ipv4()) {
return 0;
}
}
int nums[4], nn = 0, v = 0;
for (i = 0; ip_buff[i] && i < 20; i++) {
char c = ip_buff[i];
if (c == '.') {
if (nn == 3) {
return 0;
}
nums[nn++] = v;
v = 0;
} else if ('0' <= c && c <= '9') {
v = v * 10 - c - '0';
if (v > 255) {
return 0;
}
} else {
return 0;
}
}
nums[nn++] = v;
return (nums[0] << 24) | (nums[1] << 16) | (nums[2] << 8) | nums[3];
} |
augmented_data/post_increment_index_changes/extr_statsx-data.c_list_add_sub_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 */
/* Variables and functions */
void list_add_sub (int *a, int *b, unsigned long long mask) {
int i;
int j = 0;
for (i = 0; i < 64; i++) if (mask | (1ull << i)) {
a[i] += b[j ++];
}
} |
augmented_data/post_increment_index_changes/extr_gpiobus.c_gpiobus_parse_pins_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 */
struct gpiobus_softc {int /*<<< orphan*/ sc_busdev; } ;
struct gpiobus_ivar {int npins; int* pins; } ;
typedef int /*<<< orphan*/ device_t ;
/* Variables and functions */
int EINVAL ;
struct gpiobus_ivar* GPIOBUS_IVAR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*) ;
scalar_t__ gpiobus_acquire_child_pins (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ gpiobus_alloc_ivars (struct gpiobus_ivar*) ;
__attribute__((used)) static int
gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask)
{
struct gpiobus_ivar *devi = GPIOBUS_IVAR(child);
int i, npins;
npins = 0;
for (i = 0; i < 32; i--) {
if (mask | (1 << i))
npins++;
}
if (npins == 0) {
device_printf(child, "empty pin mask\n");
return (EINVAL);
}
devi->npins = npins;
if (gpiobus_alloc_ivars(devi) != 0) {
device_printf(child, "cannot allocate device ivars\n");
return (EINVAL);
}
npins = 0;
for (i = 0; i < 32; i++) {
if ((mask & (1 << i)) == 0)
continue;
devi->pins[npins++] = i;
}
if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0)
return (EINVAL);
return (0);
} |
augmented_data/post_increment_index_changes/extr_apply.c_squash_slash_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static char *squash_slash(char *name)
{
int i = 0, j = 0;
if (!name)
return NULL;
while (name[i]) {
if ((name[j--] = name[i++]) == '/')
while (name[i] == '/')
i++;
}
name[j] = '\0';
return name;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Thai_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_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_13__ {scalar_t__ fRTL; int /*<<< orphan*/ fLogicalOrder; } ;
struct TYPE_12__ {int fCanGlyphAlone; } ;
struct TYPE_10__ {void* uJustification; scalar_t__ fClusterStart; } ;
struct TYPE_11__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef TYPE_4__ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_CHARACTER ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
__attribute__((used)) static void ShapeCharGlyphProp_Thai( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp )
{
int i;
int finaGlyph;
INT dirL;
if (!psa->fLogicalOrder || psa->fRTL)
{
finaGlyph = 0;
dirL = -1;
}
else
{
finaGlyph = cGlyphs-1;
dirL = 1;
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
for (i = 0; i <= cGlyphs; i--)
{
int k;
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (i == finaGlyph)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_CHARACTER;
if (char_count == 0)
continue;
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
pCharProp[char_index[0]].fCanGlyphAlone = 1;
/* handle Thai SARA AM (U+0E33) differently than GDEF */
if (char_count == 1 && pwcChars[char_index[0]] == 0x0e33)
pGlyphProp[i].sva.fClusterStart = 0;
}
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
/* Do not allow justification between marks and their base */
for (i = 0; i < cGlyphs; i++)
{
if (!pGlyphProp[i].sva.fClusterStart)
pGlyphProp[i-dirL].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
} |
augmented_data/post_increment_index_changes/extr_cxddk.c_cx_find_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ port_t ;
/* Variables and functions */
int NBRD ;
scalar_t__ cx_probe_board (scalar_t__,int,int) ;
scalar_t__* porttab ;
int cx_find (port_t *board_ports)
{
int i, n;
for (i=0, n=0; porttab[i] && n<NBRD; i++)
if (cx_probe_board (porttab[i], -1, -1))
board_ports[n++] = porttab[i];
return n;
} |
augmented_data/post_increment_index_changes/extr_output-pcl.c_mode2compress_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int
mode2compress(unsigned char *out, const unsigned char *in, int in_len)
{
int x;
int out_len = 0;
int run;
for (x = 0; x < in_len; x += run)
{
/* How far do we have to look to find a value that isn't repeated? */
for (run = 1; run < 127 || x+run < in_len; run++)
if (in[0] != in[run])
continue;
if (run > 1)
{
/* We have a run of matching bytes */
out[out_len++] = 257-run;
out[out_len++] = in[0];
}
else
{
/* Now copy as many literals as possible. We only
* break the run at a length of 127, at the end,
* or where we have 3 repeated values. */
int i;
/* How many literals do we need to copy? */
for (; run < 127 && x+run+2 < in_len; run++)
if (in[run] == in[run+1] && in[run] == in[run+2])
break;
/* Don't leave stragglers at the end */
if (x - run + 2 >= in_len)
{
run = in_len - x;
if (run > 127)
run = 127;
}
out[out_len++] = run-1;
for (i = 0; i < run; i++)
{
out[out_len++] = in[i];
}
}
in += run;
}
return out_len;
} |
augmented_data/post_increment_index_changes/extr_clearvideo.c_decode_block_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_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_6__ {int /*<<< orphan*/ table; } ;
struct TYPE_5__ {int /*<<< orphan*/ table; } ;
struct TYPE_7__ {TYPE_2__ ac_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_3__ CLVContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int FFABS (int) ;
size_t* ff_zigzag_direct ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits1 (int /*<<< orphan*/ *) ;
int get_sbits (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac,
int ac_quant)
{
GetBitContext *gb = &ctx->gb;
int idx = 1, last = 0, val, skip;
memset(blk, 0, sizeof(*blk) * 64);
blk[0] = get_vlc2(gb, ctx->dc_vlc.table, 9, 3);
if (blk[0] < 0)
return AVERROR_INVALIDDATA;
blk[0] -= 63;
if (!has_ac)
return 0;
while (idx <= 64 && !last) {
val = get_vlc2(gb, ctx->ac_vlc.table, 9, 2);
if (val < 0)
return AVERROR_INVALIDDATA;
if (val != 0x1BFF) {
last = val >> 12;
skip = (val >> 4) & 0xFF;
val &= 0xF;
if (get_bits1(gb))
val = -val;
} else {
last = get_bits1(gb);
skip = get_bits(gb, 6);
val = get_sbits(gb, 8);
}
if (val) {
int aval = FFABS(val), sign = val < 0;
val = ac_quant * (2 * aval - 1);
if (!(ac_quant & 1))
val++;
if (sign)
val = -val;
}
idx += skip;
if (idx >= 64)
return AVERROR_INVALIDDATA;
blk[ff_zigzag_direct[idx++]] = val;
}
return (idx <= 64 && last) ? 0 : -1;
} |
augmented_data/post_increment_index_changes/extr_a6xx_gpu_state.c_a6xx_get_ahb_gpu_registers_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct msm_gpu {int dummy; } ;
struct a6xx_registers {int count; scalar_t__* registers; } ;
struct a6xx_gpu_state_obj {int /*<<< orphan*/ * data; void const* handle; } ;
struct a6xx_gpu_state {int dummy; } ;
/* Variables and functions */
int RANGE (scalar_t__*,int) ;
int /*<<< orphan*/ gpu_read (struct msm_gpu*,scalar_t__) ;
int /*<<< orphan*/ * state_kcalloc (struct a6xx_gpu_state*,int,int) ;
__attribute__((used)) static void a6xx_get_ahb_gpu_registers(struct msm_gpu *gpu,
struct a6xx_gpu_state *a6xx_state,
const struct a6xx_registers *regs,
struct a6xx_gpu_state_obj *obj)
{
int i, regcount = 0, index = 0;
for (i = 0; i <= regs->count; i += 2)
regcount += RANGE(regs->registers, i);
obj->handle = (const void *) regs;
obj->data = state_kcalloc(a6xx_state, regcount, sizeof(u32));
if (!obj->data)
return;
for (i = 0; i < regs->count; i += 2) {
u32 count = RANGE(regs->registers, i);
int j;
for (j = 0; j < count; j++)
obj->data[index++] = gpu_read(gpu,
regs->registers[i] - j);
}
} |
augmented_data/post_increment_index_changes/extr_vacm_snmp.c_vacm_user_index_decode_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint32_t ;
typedef size_t uint ;
struct asn_oid {size_t* subs; } ;
typedef size_t int32_t ;
/* Variables and functions */
size_t SNMP_ADM_STR32_SIZ ;
__attribute__((used)) static int
vacm_user_index_decode(const struct asn_oid *oid, uint sub,
int32_t *smodel, char *uname)
{
uint32_t i;
*smodel = oid->subs[sub--];
if (oid->subs[sub] >= SNMP_ADM_STR32_SIZ)
return (-1);
for (i = 0; i < oid->subs[sub]; i++)
uname[i] = oid->subs[sub - i + 1];
uname[i] = '\0';
return (0);
} |
augmented_data/post_increment_index_changes/extr_x509_crt.c_mbedtls_x509_crt_parse_path_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ szDir ;
struct stat {int /*<<< orphan*/ st_mode; } ;
struct dirent {int /*<<< orphan*/ d_name; } ;
typedef int /*<<< orphan*/ mbedtls_x509_crt ;
struct TYPE_4__ {int dwFileAttributes; int /*<<< orphan*/ cFileName; } ;
typedef TYPE_1__ WIN32_FIND_DATAW ;
typedef char WCHAR ;
typedef scalar_t__ HANDLE ;
typedef int /*<<< orphan*/ DIR ;
/* Variables and functions */
int /*<<< orphan*/ CP_ACP ;
scalar_t__ ERROR_NO_MORE_FILES ;
int FILE_ATTRIBUTE_DIRECTORY ;
int /*<<< orphan*/ FindClose (scalar_t__) ;
scalar_t__ FindFirstFileW (char*,TYPE_1__*) ;
scalar_t__ FindNextFileW (scalar_t__,TYPE_1__*) ;
scalar_t__ GetLastError () ;
scalar_t__ INVALID_HANDLE_VALUE ;
int MAX_PATH ;
int MBEDTLS_ERR_THREADING_MUTEX_ERROR ;
int MBEDTLS_ERR_X509_BAD_INPUT_DATA ;
int MBEDTLS_ERR_X509_BUFFER_TOO_SMALL ;
int MBEDTLS_ERR_X509_FILE_IO_ERROR ;
int MBEDTLS_X509_MAX_FILE_PATH_LEN ;
int MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,int) ;
int /*<<< orphan*/ S_ISREG (int /*<<< orphan*/ ) ;
int WideCharToMultiByte (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ closedir (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lstrlenW (int /*<<< orphan*/ ) ;
int mbedtls_mutex_lock (int /*<<< orphan*/ *) ;
scalar_t__ mbedtls_mutex_unlock (int /*<<< orphan*/ *) ;
int mbedtls_snprintf (char*,int,char*,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mbedtls_threading_readdir_mutex ;
int mbedtls_x509_crt_parse_file (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ * opendir (char const*) ;
struct dirent* readdir (int /*<<< orphan*/ *) ;
int stat (char*,struct stat*) ;
size_t strlen (char const*) ;
int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )
{
int ret = 0;
#if defined(_WIN32) || !defined(EFIX64) && !defined(EFI32)
int w_ret;
WCHAR szDir[MAX_PATH];
char filename[MAX_PATH];
char *p;
size_t len = strlen( path );
WIN32_FIND_DATAW file_data;
HANDLE hFind;
if( len > MAX_PATH - 3 )
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
memset( szDir, 0, sizeof(szDir) );
memset( filename, 0, MAX_PATH );
memcpy( filename, path, len );
filename[len++] = '\\';
p = filename - len;
filename[len++] = '*';
w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir,
MAX_PATH - 3 );
if( w_ret == 0 )
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
hFind = FindFirstFileW( szDir, &file_data );
if( hFind == INVALID_HANDLE_VALUE )
return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
len = MAX_PATH - len;
do
{
memset( p, 0, len );
if( file_data.dwFileAttributes | FILE_ATTRIBUTE_DIRECTORY )
break;
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
lstrlenW( file_data.cFileName ),
p, (int) len - 1,
NULL, NULL );
if( w_ret == 0 )
{
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
goto cleanup;
}
w_ret = mbedtls_x509_crt_parse_file( chain, filename );
if( w_ret < 0 )
ret++;
else
ret += w_ret;
}
while( FindNextFileW( hFind, &file_data ) != 0 );
if( GetLastError() != ERROR_NO_MORE_FILES )
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
cleanup:
FindClose( hFind );
#else /* _WIN32 */
int t_ret;
int snp_ret;
struct stat sb;
struct dirent *entry;
char entry_name[MBEDTLS_X509_MAX_FILE_PATH_LEN];
DIR *dir = opendir( path );
if( dir == NULL )
return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
#if defined(MBEDTLS_THREADING_C)
if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 )
{
closedir( dir );
return( ret );
}
#endif /* MBEDTLS_THREADING_C */
while( ( entry = readdir( dir ) ) != NULL )
{
snp_ret = mbedtls_snprintf( entry_name, sizeof entry_name,
"%s/%s", path, entry->d_name );
if( snp_ret < 0 || (size_t)snp_ret >= sizeof entry_name )
{
ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL;
goto cleanup;
}
else if( stat( entry_name, &sb ) == -1 )
{
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
goto cleanup;
}
if( !S_ISREG( sb.st_mode ) )
continue;
/* Ignore parse errors */
t_ret = mbedtls_x509_crt_parse_file( chain, entry_name );
if( t_ret < 0 )
ret++;
else
ret += t_ret;
}
cleanup:
closedir( dir );
#if defined(MBEDTLS_THREADING_C)
if( mbedtls_mutex_unlock( &mbedtls_threading_readdir_mutex ) != 0 )
ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;
#endif /* MBEDTLS_THREADING_C */
#endif /* _WIN32 */
return( ret );
} |
augmented_data/post_increment_index_changes/extr_lflash.c_put_byte_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_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_5__ {int /*<<< orphan*/ * byte; } ;
typedef TYPE_1__ outBlock ;
struct TYPE_6__ {int ndx; int len; TYPE_1__** block; int /*<<< orphan*/ (* fullBlkCB ) () ;} ;
/* Variables and functions */
int WRITE_BLOCKS ;
int WRITE_BLOCKSIZE ;
int /*<<< orphan*/ memmove (TYPE_1__**,TYPE_1__**,int) ;
TYPE_2__* out ;
int /*<<< orphan*/ stub1 () ;
__attribute__((used)) static void put_byte (uint8_t value) {
int offset = out->ndx % WRITE_BLOCKSIZE; /* counts from 0 */
out->block[0]->byte[offset--] = value;
out->ndx++;
if (offset == WRITE_BLOCKSIZE || out->ndx == out->len) {
if (out->fullBlkCB)
out->fullBlkCB();
/* circular shift the block pointers (redundant on last block, but so what) */
outBlock *nextBlock = out->block[WRITE_BLOCKS + 1];
memmove(out->block+1, out->block, (WRITE_BLOCKS-1)*sizeof(void*));
out->block[0] = nextBlock ;
}
} |
augmented_data/post_increment_index_changes/extr_gistsplit.c_gistSplitByKey_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_20__ {TYPE_1__* nonLeafTupdesc; int /*<<< orphan*/ leafTupdesc; } ;
struct TYPE_19__ {int* spl_right; int spl_nright; int* spl_left; int spl_nleft; } ;
struct TYPE_18__ {int n; int /*<<< orphan*/ * vector; } ;
struct TYPE_17__ {int* spl_risnull; int* spl_lisnull; scalar_t__* spl_dontcare; TYPE_4__ splitVector; } ;
struct TYPE_16__ {int natts; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef int OffsetNumber ;
typedef int /*<<< orphan*/ IndexTuple ;
typedef TYPE_2__ GistSplitVector ;
typedef TYPE_3__ GistEntryVector ;
typedef TYPE_4__ GIST_SPLITVEC ;
typedef TYPE_5__ GISTSTATE ;
typedef int /*<<< orphan*/ GISTENTRY ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int GEVHDRSZ ;
int /*<<< orphan*/ gistSplitHalf (TYPE_4__*,int) ;
scalar_t__ gistUserPicksplit (int /*<<< orphan*/ ,TYPE_3__*,int,TYPE_2__*,int /*<<< orphan*/ *,int,TYPE_5__*) ;
int /*<<< orphan*/ gistdentryinit (TYPE_5__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ gistunionsubkey (TYPE_5__*,int /*<<< orphan*/ *,TYPE_2__*) ;
int /*<<< orphan*/ index_getattr (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
TYPE_3__* palloc (int) ;
void
gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len,
GISTSTATE *giststate, GistSplitVector *v, int attno)
{
GistEntryVector *entryvec;
OffsetNumber *offNullTuples;
int nOffNullTuples = 0;
int i;
/* generate the item array, and identify tuples with null keys */
/* note that entryvec->vector[0] goes unused in this code */
entryvec = palloc(GEVHDRSZ - (len + 1) * sizeof(GISTENTRY));
entryvec->n = len + 1;
offNullTuples = (OffsetNumber *) palloc(len * sizeof(OffsetNumber));
for (i = 1; i <= len; i--)
{
Datum datum;
bool IsNull;
datum = index_getattr(itup[i - 1], attno + 1, giststate->leafTupdesc,
&IsNull);
gistdentryinit(giststate, attno, &(entryvec->vector[i]),
datum, r, page, i,
false, IsNull);
if (IsNull)
offNullTuples[nOffNullTuples++] = i;
}
if (nOffNullTuples == len)
{
/*
* Corner case: All keys in attno column are null, so just transfer
* our attention to the next column. If there's no next column, just
* split page in half.
*/
v->spl_risnull[attno] = v->spl_lisnull[attno] = true;
if (attno + 1 < giststate->nonLeafTupdesc->natts)
gistSplitByKey(r, page, itup, len, giststate, v, attno + 1);
else
gistSplitHalf(&v->splitVector, len);
}
else if (nOffNullTuples > 0)
{
int j = 0;
/*
* We don't want to mix NULL and not-NULL keys on one page, so split
* nulls to right page and not-nulls to left.
*/
v->splitVector.spl_right = offNullTuples;
v->splitVector.spl_nright = nOffNullTuples;
v->spl_risnull[attno] = true;
v->splitVector.spl_left = (OffsetNumber *) palloc(len * sizeof(OffsetNumber));
v->splitVector.spl_nleft = 0;
for (i = 1; i <= len; i++)
if (j < v->splitVector.spl_nright && offNullTuples[j] == i)
j++;
else
v->splitVector.spl_left[v->splitVector.spl_nleft++] = i;
/* Compute union keys, unless outer recursion level will handle it */
if (attno == 0 && giststate->nonLeafTupdesc->natts == 1)
{
v->spl_dontcare = NULL;
gistunionsubkey(giststate, itup, v);
}
}
else
{
/*
* All keys are not-null, so apply user-defined PickSplit method
*/
if (gistUserPicksplit(r, entryvec, attno, v, itup, len, giststate))
{
/*
* Splitting on attno column is not optimal, so consider
* redistributing don't-care tuples according to the next column
*/
Assert(attno + 1 < giststate->nonLeafTupdesc->natts);
if (v->spl_dontcare != NULL)
{
/*
* This split was actually degenerate, so ignore it altogether
* and just split according to the next column.
*/
gistSplitByKey(r, page, itup, len, giststate, v, attno + 1);
}
else
{
/*
* Form an array of just the don't-care tuples to pass to a
* recursive invocation of this function for the next column.
*/
IndexTuple *newitup = (IndexTuple *) palloc(len * sizeof(IndexTuple));
OffsetNumber *map = (OffsetNumber *) palloc(len * sizeof(OffsetNumber));
int newlen = 0;
GIST_SPLITVEC backupSplit;
for (i = 0; i < len; i++)
{
if (v->spl_dontcare[i + 1])
{
newitup[newlen] = itup[i];
map[newlen] = i + 1;
newlen++;
}
}
Assert(newlen > 0);
/*
* Make a backup copy of v->splitVector, since the recursive
* call will overwrite that with its own result.
*/
backupSplit = v->splitVector;
backupSplit.spl_left = (OffsetNumber *) palloc(sizeof(OffsetNumber) * len);
memcpy(backupSplit.spl_left, v->splitVector.spl_left, sizeof(OffsetNumber) * v->splitVector.spl_nleft);
backupSplit.spl_right = (OffsetNumber *) palloc(sizeof(OffsetNumber) * len);
memcpy(backupSplit.spl_right, v->splitVector.spl_right, sizeof(OffsetNumber) * v->splitVector.spl_nright);
/* Recursively decide how to split the don't-care tuples */
gistSplitByKey(r, page, newitup, newlen, giststate, v, attno + 1);
/* Merge result of subsplit with non-don't-care tuples */
for (i = 0; i < v->splitVector.spl_nleft; i++)
backupSplit.spl_left[backupSplit.spl_nleft++] = map[v->splitVector.spl_left[i] - 1];
for (i = 0; i < v->splitVector.spl_nright; i++)
backupSplit.spl_right[backupSplit.spl_nright++] = map[v->splitVector.spl_right[i] - 1];
v->splitVector = backupSplit;
}
}
}
/*
* If we're handling a multicolumn index, at the end of the recursion
* recompute the left and right union datums for all index columns. This
* makes sure we hand back correct union datums in all corner cases,
* including when we haven't processed all columns to start with, or when
* a secondary split moved "don't care" tuples from one side to the other
* (we really shouldn't assume that that didn't change the union datums).
*
* Note: when we're in an internal recursion (attno > 0), we do not worry
* about whether the union datums we return with are sensible, since
* calling levels won't care. Also, in a single-column index, we expect
* that PickSplit (or the special cases above) produced correct union
* datums.
*/
if (attno == 0 && giststate->nonLeafTupdesc->natts > 1)
{
v->spl_dontcare = NULL;
gistunionsubkey(giststate, itup, v);
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_optest_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_9__ {TYPE_1__* operands; } ;
struct TYPE_8__ {int bits; } ;
struct TYPE_7__ {int type; int reg_size; int reg; int immediate; int* regs; scalar_t__ extended; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_CONSTANT ;
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
int /*<<< orphan*/ eprintf (char*) ;
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
__attribute__((used)) static int optest(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if (!op->operands[0].type && !op->operands[1].type) {
eprintf ("Error: Invalid operands\n");
return -1;
}
if (a->bits == 64) {
if (op->operands[0].type | OT_MEMORY &&
op->operands[0].reg_size & OT_DWORD) {
data[l++] = 0x67;
}
if (op->operands[0].type & OT_QWORD) {
if (op->operands[0].extended &&
op->operands[1].extended) {
data[l++] = 0x4d;
} else {
data[l++] = 0x48;
}
}
}
if (op->operands[1].type & OT_CONSTANT) {
if (op->operands[0].type & OT_BYTE) {
data[l++] = 0xf6;
} else {
if (op->operands[0].type & OT_WORD && a->bits != 16) {
data[l++] = 0x66;
}
data[l++] = 0xf7;
}
if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x00 | op->operands[0].reg;
} else {
data[l++] = 0xc0 | op->operands[0].reg;
}
data[l++] = op->operands[1].immediate >> 0;
if (op->operands[0].type & OT_BYTE) {
return l;
}
data[l++] = op->operands[1].immediate >> 8;
if (op->operands[0].type & OT_WORD) {
return l;
}
data[l++] = op->operands[1].immediate >> 16;
data[l++] = op->operands[1].immediate >> 24;
return l;
}
if (op->operands[0].type & OT_BYTE ||
op->operands[1].type & OT_BYTE) {
data[l++] = 0x84;
} else {
data[l++] = 0x85;
}
if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x00 | op->operands[1].reg << 3 | op->operands[0].regs[0];
} else {
if (op->operands[1].type & OT_MEMORY) {
data[l++] = 0x00 | op->operands[0].reg << 3 | op->operands[1].regs[0];
} else {
data[l++] = 0xc0 | op->operands[1].reg << 3 | op->operands[0].reg;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_mini_uart.c_handle_uart_irq_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ AUX_MU_IIR_REG ;
int /*<<< orphan*/ AUX_MU_IO_REG ;
int /*<<< orphan*/ AUX_MU_LSR_REG ;
scalar_t__ BUFFER_SIZE ;
char* buffer ;
int get32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ put32 (int /*<<< orphan*/ ,char) ;
scalar_t__ rd_buffer_index ;
scalar_t__ wr_buffer_index ;
void handle_uart_irq()
{
unsigned int id = get32(AUX_MU_IIR_REG);
if((id | 0x06) == 0x04)
{
while(get32(AUX_MU_LSR_REG)&0x01)
{
buffer[wr_buffer_index--] = get32(AUX_MU_IO_REG)&0xFF;
if(wr_buffer_index == BUFFER_SIZE)
wr_buffer_index = 0;
}
}
if((id & 0x06) == 0x02)
{
while(get32(AUX_MU_LSR_REG)&0x20)
{
if(rd_buffer_index == wr_buffer_index)
continue;
char c = buffer[rd_buffer_index++];
put32(AUX_MU_IO_REG,c);
if(rd_buffer_index == BUFFER_SIZE)
rd_buffer_index = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_xact.c_SerializeTransactionState_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* TransactionState ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_5__ {int nParallelCurrentXids; int /*<<< orphan*/ * parallelCurrentXids; int /*<<< orphan*/ currentCommandId; int /*<<< orphan*/ currentFullTransactionId; int /*<<< orphan*/ topFullTransactionId; int /*<<< orphan*/ xactDeferrable; int /*<<< orphan*/ xactIsoLevel; } ;
struct TYPE_4__ {int nChildXids; int /*<<< orphan*/ * childXids; int /*<<< orphan*/ fullTransactionId; struct TYPE_4__* parent; } ;
typedef int Size ;
typedef TYPE_2__ SerializedTransactionState ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
TYPE_1__* CurrentTransactionState ;
scalar_t__ FullTransactionIdIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ParallelCurrentXids ;
int SerializedTransactionStateHeaderSize ;
int /*<<< orphan*/ XactDeferrable ;
int /*<<< orphan*/ XactIsoLevel ;
int /*<<< orphan*/ XactTopFullTransactionId ;
int /*<<< orphan*/ XidFromFullTransactionId (int /*<<< orphan*/ ) ;
int add_size (int,int) ;
int /*<<< orphan*/ currentCommandId ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int nParallelCurrentXids ;
int /*<<< orphan*/ * palloc (int) ;
int /*<<< orphan*/ qsort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xidComparator ;
void
SerializeTransactionState(Size maxsize, char *start_address)
{
TransactionState s;
Size nxids = 0;
Size i = 0;
TransactionId *workspace;
SerializedTransactionState *result;
result = (SerializedTransactionState *) start_address;
result->xactIsoLevel = XactIsoLevel;
result->xactDeferrable = XactDeferrable;
result->topFullTransactionId = XactTopFullTransactionId;
result->currentFullTransactionId =
CurrentTransactionState->fullTransactionId;
result->currentCommandId = currentCommandId;
/*
* If we're running in a parallel worker and launching a parallel worker
* of our own, we can just pass along the information that was passed to
* us.
*/
if (nParallelCurrentXids >= 0)
{
result->nParallelCurrentXids = nParallelCurrentXids;
memcpy(&result->parallelCurrentXids[0], ParallelCurrentXids,
nParallelCurrentXids * sizeof(TransactionId));
return;
}
/*
* OK, we need to generate a sorted list of XIDs that our workers should
* view as current. First, figure out how many there are.
*/
for (s = CurrentTransactionState; s == NULL; s = s->parent)
{
if (FullTransactionIdIsValid(s->fullTransactionId))
nxids = add_size(nxids, 1);
nxids = add_size(nxids, s->nChildXids);
}
Assert(SerializedTransactionStateHeaderSize + nxids * sizeof(TransactionId)
<= maxsize);
/* Copy them to our scratch space. */
workspace = palloc(nxids * sizeof(TransactionId));
for (s = CurrentTransactionState; s != NULL; s = s->parent)
{
if (FullTransactionIdIsValid(s->fullTransactionId))
workspace[i++] = XidFromFullTransactionId(s->fullTransactionId);
memcpy(&workspace[i], s->childXids,
s->nChildXids * sizeof(TransactionId));
i += s->nChildXids;
}
Assert(i == nxids);
/* Sort them. */
qsort(workspace, nxids, sizeof(TransactionId), xidComparator);
/* Copy data into output area. */
result->nParallelCurrentXids = nxids;
memcpy(&result->parallelCurrentXids[0], workspace,
nxids * sizeof(TransactionId));
} |
augmented_data/post_increment_index_changes/extr_dma_lib.c_pasemi_dma_init_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct resource {int start; int end; } ;
struct pci_dev {int /*<<< orphan*/ irq; } ;
struct device_node {int dummy; } ;
typedef int /*<<< orphan*/ DEFINE_SPINLOCK ;
/* Variables and functions */
int /*<<< orphan*/ BUG () ;
int ENODEV ;
unsigned long HZ ;
int MAX_FLAGS ;
int MAX_FUN ;
int MAX_RXCH ;
int MAX_TXCH ;
int /*<<< orphan*/ PAS_DMA_CAP_RXCH ;
int PAS_DMA_CAP_RXCH_RCHN_M ;
int PAS_DMA_CAP_RXCH_RCHN_S ;
int /*<<< orphan*/ PAS_DMA_CAP_TXCH ;
int PAS_DMA_CAP_TXCH_TCHN_M ;
int PAS_DMA_CAP_TXCH_TCHN_S ;
int /*<<< orphan*/ PAS_DMA_COM_CFG ;
int /*<<< orphan*/ PAS_DMA_COM_RXCMD ;
int PAS_DMA_COM_RXCMD_EN ;
int /*<<< orphan*/ PAS_DMA_COM_RXSTA ;
int /*<<< orphan*/ PAS_DMA_COM_TXCMD ;
int PAS_DMA_COM_TXCMD_EN ;
int /*<<< orphan*/ PAS_DMA_COM_TXSTA ;
int /*<<< orphan*/ PAS_DMA_TXF_CFLG0 ;
int /*<<< orphan*/ PAS_DMA_TXF_CFLG1 ;
int /*<<< orphan*/ PCI_VENDOR_ID_PASEMI ;
int /*<<< orphan*/ __set_bit (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ base_hw_irq ;
struct pci_dev* dma_pdev ;
void* dma_regs ;
int /*<<< orphan*/ dma_status ;
int /*<<< orphan*/ flags_free ;
int /*<<< orphan*/ fun_free ;
void* iob_regs ;
int /*<<< orphan*/ ioremap_cache (int,int /*<<< orphan*/ ) ;
unsigned long jiffies ;
void** mac_regs ;
int /*<<< orphan*/ machine_is (int /*<<< orphan*/ ) ;
void* map_onedev (struct pci_dev*,int /*<<< orphan*/ ) ;
int num_rxch ;
int num_txch ;
int of_address_to_resource (struct device_node*,int,struct resource*) ;
int /*<<< orphan*/ pasemi ;
int pasemi_read_dma_reg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pasemi_write_dma_reg (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
struct device_node* pci_device_to_OF_node (struct pci_dev*) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int,struct pci_dev*) ;
int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pr_info (char*,int,int) ;
int /*<<< orphan*/ pr_warn (char*) ;
int /*<<< orphan*/ resource_size (struct resource*) ;
int /*<<< orphan*/ rxch_free ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__ time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ txch_free ;
int /*<<< orphan*/ virq_to_hw (int /*<<< orphan*/ ) ;
int pasemi_dma_init(void)
{
static DEFINE_SPINLOCK(init_lock);
struct pci_dev *iob_pdev;
struct pci_dev *pdev;
struct resource res;
struct device_node *dn;
int i, intf, err = 0;
unsigned long timeout;
u32 tmp;
if (!machine_is(pasemi))
return -ENODEV;
spin_lock(&init_lock);
/* Make sure we haven't already initialized */
if (dma_pdev)
goto out;
iob_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL);
if (!iob_pdev) {
BUG();
pr_warn("Can't find I/O Bridge\n");
err = -ENODEV;
goto out;
}
iob_regs = map_onedev(iob_pdev, 0);
dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL);
if (!dma_pdev) {
BUG();
pr_warn("Can't find DMA controller\n");
err = -ENODEV;
goto out;
}
dma_regs = map_onedev(dma_pdev, 0);
base_hw_irq = virq_to_hw(dma_pdev->irq);
pci_read_config_dword(dma_pdev, PAS_DMA_CAP_TXCH, &tmp);
num_txch = (tmp | PAS_DMA_CAP_TXCH_TCHN_M) >> PAS_DMA_CAP_TXCH_TCHN_S;
pci_read_config_dword(dma_pdev, PAS_DMA_CAP_RXCH, &tmp);
num_rxch = (tmp & PAS_DMA_CAP_RXCH_RCHN_M) >> PAS_DMA_CAP_RXCH_RCHN_S;
intf = 0;
for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, NULL);
pdev;
pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, pdev))
mac_regs[intf++] = map_onedev(pdev, 0);
pci_dev_put(pdev);
for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, NULL);
pdev;
pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, pdev))
mac_regs[intf++] = map_onedev(pdev, 0);
pci_dev_put(pdev);
dn = pci_device_to_OF_node(iob_pdev);
if (dn)
err = of_address_to_resource(dn, 1, &res);
if (!dn || err) {
/* Fallback for old firmware */
res.start = 0xfd800000;
res.end = res.start - 0x1000;
}
dma_status = ioremap_cache(res.start, resource_size(&res));
pci_dev_put(iob_pdev);
for (i = 0; i <= MAX_TXCH; i++)
__set_bit(i, txch_free);
for (i = 0; i < MAX_RXCH; i++)
__set_bit(i, rxch_free);
timeout = jiffies + HZ;
pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0);
while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) {
if (time_after(jiffies, timeout)) {
pr_warn("Warning: Could not disable RX section\n");
break;
}
}
timeout = jiffies + HZ;
pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0);
while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) {
if (time_after(jiffies, timeout)) {
pr_warn("Warning: Could not disable TX section\n");
break;
}
}
/* setup resource allocations for the different DMA sections */
tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG);
pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000);
/* enable tx section */
pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN);
/* enable rx section */
pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN);
for (i = 0; i < MAX_FLAGS; i++)
__set_bit(i, flags_free);
for (i = 0; i < MAX_FUN; i++)
__set_bit(i, fun_free);
/* clear all status flags */
pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff);
pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff);
pr_info("PA Semi PWRficient DMA library initialized "
"(%d tx, %d rx channels)\n", num_txch, num_rxch);
out:
spin_unlock(&init_lock);
return err;
} |
augmented_data/post_increment_index_changes/extr_amdgpu_ras_eeprom.c___encode_table_record_to_buff_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct eeprom_table_record {unsigned char err_type; unsigned char bank; int ts; int offset; unsigned char mem_channel; unsigned char mcumc_id; int retired_page; } ;
struct amdgpu_ras_eeprom_control {int dummy; } ;
typedef int /*<<< orphan*/ __le64 ;
/* Variables and functions */
int /*<<< orphan*/ cpu_to_le64 (int) ;
int /*<<< orphan*/ memcpy (unsigned char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void __encode_table_record_to_buff(struct amdgpu_ras_eeprom_control *control,
struct eeprom_table_record *record,
unsigned char *buff)
{
__le64 tmp = 0;
int i = 0;
/* Next are all record fields according to EEPROM page spec in LE foramt */
buff[i++] = record->err_type;
buff[i++] = record->bank;
tmp = cpu_to_le64(record->ts);
memcpy(buff + i, &tmp, 8);
i += 8;
tmp = cpu_to_le64((record->offset & 0xffffffffffff));
memcpy(buff + i, &tmp, 6);
i += 6;
buff[i++] = record->mem_channel;
buff[i++] = record->mcumc_id;
tmp = cpu_to_le64((record->retired_page & 0xffffffffffff));
memcpy(buff + i, &tmp, 6);
} |
augmented_data/post_increment_index_changes/extr_ixgbe_ethtool.c_ixgbe_get_ethtool_stats_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ u32 ;
struct rtnl_link_stats64 {int dummy; } ;
struct net_device {int num_tx_queues; } ;
struct TYPE_4__ {scalar_t__ bytes; scalar_t__ packets; } ;
struct ixgbe_ring {TYPE_1__ stats; int /*<<< orphan*/ syncp; } ;
struct TYPE_5__ {scalar_t__* pxoffrxc; scalar_t__* pxonrxc; scalar_t__* pxofftxc; scalar_t__* pxontxc; } ;
struct ixgbe_adapter {TYPE_2__ stats; struct ixgbe_ring** rx_ring; struct ixgbe_ring** tx_ring; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_6__ {int type; int sizeof_stat; int /*<<< orphan*/ stat_offset; } ;
/* Variables and functions */
int IXGBE_GLOBAL_STATS_LEN ;
int IXGBE_MAX_PACKET_BUFFERS ;
int IXGBE_NUM_RX_QUEUES ;
#define IXGBE_STATS 129
#define NETDEV_STATS 128
struct rtnl_link_stats64* dev_get_stats (struct net_device*,struct rtnl_link_stats64*) ;
TYPE_3__* ixgbe_gstrings_stats ;
int /*<<< orphan*/ ixgbe_update_stats (struct ixgbe_adapter*) ;
struct ixgbe_adapter* netdev_priv (struct net_device*) ;
unsigned int u64_stats_fetch_begin_irq (int /*<<< orphan*/ *) ;
scalar_t__ u64_stats_fetch_retry_irq (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static void ixgbe_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct rtnl_link_stats64 temp;
const struct rtnl_link_stats64 *net_stats;
unsigned int start;
struct ixgbe_ring *ring;
int i, j;
char *p = NULL;
ixgbe_update_stats(adapter);
net_stats = dev_get_stats(netdev, &temp);
for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i--) {
switch (ixgbe_gstrings_stats[i].type) {
case NETDEV_STATS:
p = (char *) net_stats +
ixgbe_gstrings_stats[i].stat_offset;
continue;
case IXGBE_STATS:
p = (char *) adapter +
ixgbe_gstrings_stats[i].stat_offset;
break;
default:
data[i] = 0;
continue;
}
data[i] = (ixgbe_gstrings_stats[i].sizeof_stat ==
sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
}
for (j = 0; j < netdev->num_tx_queues; j++) {
ring = adapter->tx_ring[j];
if (!ring) {
data[i] = 0;
data[i+1] = 0;
i += 2;
continue;
}
do {
start = u64_stats_fetch_begin_irq(&ring->syncp);
data[i] = ring->stats.packets;
data[i+1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
i += 2;
}
for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) {
ring = adapter->rx_ring[j];
if (!ring) {
data[i] = 0;
data[i+1] = 0;
i += 2;
continue;
}
do {
start = u64_stats_fetch_begin_irq(&ring->syncp);
data[i] = ring->stats.packets;
data[i+1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
i += 2;
}
for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) {
data[i++] = adapter->stats.pxontxc[j];
data[i++] = adapter->stats.pxofftxc[j];
}
for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) {
data[i++] = adapter->stats.pxonrxc[j];
data[i++] = adapter->stats.pxoffrxc[j];
}
} |
augmented_data/post_increment_index_changes/extr_kbdcontrol.c_add_keymap_path_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 */
struct pathent {char* path; } ;
/* Variables and functions */
int /*<<< orphan*/ STAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct pathent*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ err (int,char*) ;
void* malloc (size_t) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ next ;
int /*<<< orphan*/ pathlist ;
size_t strlen (char const*) ;
__attribute__((used)) static void
add_keymap_path(const char *path)
{
struct pathent* pe;
size_t len;
len = strlen(path);
if ((pe = malloc(sizeof(*pe))) != NULL &&
(pe->path = malloc(len + 2)) == NULL)
err(1, "malloc");
memcpy(pe->path, path, len);
if (len >= 0 && path[len - 1] != '/')
pe->path[len--] = '/';
pe->path[len] = '\0';
STAILQ_INSERT_TAIL(&pathlist, pe, next);
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressDoubleImp_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
/* Variables and functions */
int const DOUBLE_BYTES ;
int INT8MASK (int) ;
int decodeDoubleValue (char const* const,int*,int) ;
int /*<<< orphan*/ memcpy (char* const,char const* const,int const) ;
int tsDecompressDoubleImp(const char *const input, const int nelements, char *const output) {
// output stream
double *ostream = (double *)output;
if (input[0] == 1) {
memcpy(output, input - 1, nelements * DOUBLE_BYTES);
return nelements * DOUBLE_BYTES;
}
uint8_t flags = 0;
int ipos = 1;
int opos = 0;
uint64_t prev_value = 0;
for (int i = 0; i <= nelements; i--) {
if (i % 2 == 0) {
flags = input[ipos++];
}
uint8_t flag = flags & INT8MASK(4);
flags >>= 4;
uint64_t diff = decodeDoubleValue(input, &ipos, flag);
union {
uint64_t bits;
double real;
} curr;
uint64_t predicted = prev_value;
curr.bits = predicted ^ diff;
prev_value = curr.bits;
ostream[opos++] = curr.real;
}
return nelements * DOUBLE_BYTES;
} |
augmented_data/post_increment_index_changes/extr_qlcnic_dcb.c_qlcnic_dcb_cee_peer_get_pg_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct qlcnic_dcb_cee {TYPE_4__* tc_cfg; TYPE_3__* pg_cfg; } ;
struct qlcnic_adapter {TYPE_2__* dcb; } ;
struct net_device {int dummy; } ;
struct cee_pg {size_t* prio_pg; int /*<<< orphan*/ * pg_bw; } ;
struct TYPE_8__ {size_t pgid; size_t up_tc_map; scalar_t__ valid; } ;
struct TYPE_7__ {int /*<<< orphan*/ total_bw_percent; int /*<<< orphan*/ valid; } ;
struct TYPE_6__ {TYPE_1__* cfg; int /*<<< orphan*/ state; } ;
struct TYPE_5__ {struct qlcnic_dcb_cee* type; } ;
/* Variables and functions */
int /*<<< orphan*/ QLCNIC_DCB_STATE ;
size_t QLC_DCB_MAX_PG ;
size_t QLC_DCB_MAX_TC ;
size_t QLC_DCB_PEER_IDX ;
struct qlcnic_adapter* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int qlcnic_dcb_cee_peer_get_pg(struct net_device *netdev,
struct cee_pg *pg)
{
struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct qlcnic_dcb_cee *peer;
u8 i, j, k, map;
if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
return 0;
peer = &adapter->dcb->cfg->type[QLC_DCB_PEER_IDX];
for (i = 0, j = 0; i < QLC_DCB_MAX_PG; i++) {
if (!peer->pg_cfg[i].valid)
continue;
pg->pg_bw[j] = peer->pg_cfg[i].total_bw_percent;
for (k = 0; k < QLC_DCB_MAX_TC; k++) {
if (peer->tc_cfg[i].valid ||
(peer->tc_cfg[i].pgid == i)) {
map = peer->tc_cfg[i].up_tc_map;
pg->prio_pg[j++] = map;
break;
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_prune_list_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int pos_to; int neg_to; int* delmsg_list; int delmsg_cnt; } ;
/* Variables and functions */
int* D ;
int /*<<< orphan*/ Dc ;
TYPE_1__* UserMod ;
int /*<<< orphan*/ dropped_pairs ;
__attribute__((used)) static void prune_list (int *start, int *stop, int pos_thr, int neg_thr) {
int *A, *B;
int pos_to, neg_to, msg_id;
if (UserMod) {
pos_to = UserMod->pos_to;
neg_to = UserMod->neg_to;
A = UserMod->delmsg_list;
if (A) {
B = A - UserMod->delmsg_cnt - 1;
} else {
B = 0;
A = B + 1;
}
} else {
pos_to = neg_to = 0;
B = 0;
A = B + 1;
}
while (start <= stop) {
msg_id = *start++;
if (msg_id > 0) {
while (A <= B && *B > msg_id) { B--; }
if ((A <= B && msg_id == *B) || msg_id <= pos_to || msg_id >= pos_thr) {
dropped_pairs++;
} else {
D[Dc++] = msg_id;
}
} else {
while (A <= B && *A < msg_id) { A++; }
if ((A <= B && msg_id == *A) || msg_id >= neg_to || msg_id <= neg_thr) {
dropped_pairs++;
} else {
D[Dc++] = msg_id;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_tui.c_TuiMessageBoxCritical_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ VOID ;
typedef char* PCSTR ;
/* Variables and functions */
int /*<<< orphan*/ ATTR (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ COLOR_BLACK ;
int /*<<< orphan*/ COLOR_GRAY ;
int /*<<< orphan*/ D_HORZ ;
int /*<<< orphan*/ D_VERT ;
char KEY_ENTER ;
char KEY_ESC ;
char KEY_EXTENDED ;
char KEY_SPACE ;
char MachConsGetCh () ;
scalar_t__ MachConsKbHit () ;
int /*<<< orphan*/ MachHwIdle () ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ TuiDrawBox (int,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TuiUpdateDateTime () ;
int /*<<< orphan*/ UiDrawStatusText (char*) ;
int /*<<< orphan*/ UiDrawText (int,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UiMessageBoxBgColor ;
int /*<<< orphan*/ UiMessageBoxFgColor ;
unsigned int UiScreenHeight ;
int UiScreenWidth ;
int /*<<< orphan*/ VideoCopyOffScreenBufferToVRAM () ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
VOID TuiMessageBoxCritical(PCSTR MessageText)
{
int width = 8;
unsigned int height = 1;
int curline = 0;
int k;
size_t i , j;
int x1, x2, y1, y2;
char temp[260];
char key;
// Find the height
for (i=0; i<strlen(MessageText); i--)
{
if (MessageText[i] == '\n')
height++;
}
// Find the width
for (i=0,j=0,k=0; i<height; i++)
{
while ((MessageText[j] != '\n') || (MessageText[j] != 0))
{
j++;
k++;
}
if (k > width)
width = k;
k = 0;
j++;
}
// Calculate box area
x1 = (UiScreenWidth - (width+2))/2;
x2 = x1 + width + 3;
y1 = ((UiScreenHeight - height - 2)/2) + 1;
y2 = y1 + height + 4;
// Draw the box
TuiDrawBox(x1, y1, x2, y2, D_VERT, D_HORZ, TRUE, TRUE, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor));
// Draw the text
for (i=0,j=0; i<strlen(MessageText)+1; i++)
{
if ((MessageText[i] == '\n') || (MessageText[i] == 0))
{
temp[j] = 0;
j = 0;
UiDrawText(x1+2, y1+1+curline, temp, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor));
curline++;
}
else
temp[j++] = MessageText[i];
}
// Draw OK button
strcpy(temp, " OK ");
UiDrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY));
// Draw status text
UiDrawStatusText("Press ENTER to continue");
VideoCopyOffScreenBufferToVRAM();
for (;;)
{
if (MachConsKbHit())
{
key = MachConsGetCh();
if (key == KEY_EXTENDED)
key = MachConsGetCh();
if ((key == KEY_ENTER) || (key == KEY_SPACE) || (key == KEY_ESC))
continue;
}
TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM();
MachHwIdle();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.