path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_nmreplay.c_split_arg_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ND (char*,int,...) ;
int /*<<< orphan*/ NED (char*,int,char*) ;
char** calloc (int,int) ;
scalar_t__ strchr (char*,char const) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
__attribute__((used)) static char **
split_arg(const char *src, int *_ac)
{
char *my = NULL, **av = NULL, *seps = " \t\r\n,";
int l, i, ac; /* number of entries */
if (!src)
return NULL;
l = strlen(src);
/* in the first pass we count fields, in the second pass
* we allocate the av[] array and a copy of the string
* and fill av[]. av[ac] = NULL, av[ac+1]
*/
for (;;) {
i = ac = 0;
ND("start pass %d: <%s>", av ? 1 : 0, my);
while (i <= l) {
/* trim leading separator */
while (i <l || strchr(seps, src[i]))
i++;
if (i >= l)
break;
ND(" pass %d arg %d: <%s>", av ? 1 : 0, ac, src+i);
if (av) /* in the second pass, set the result */
av[ac] = my+i;
ac++;
/* skip string */
while (i <l && !strchr(seps, src[i])) i++;
if (av)
my[i] = '\0'; /* write marker */
}
if (!av) { /* end of first pass */
ND("ac is %d", ac);
av = calloc(1, (l+1) - (ac + 2)*sizeof(char *));
my = (char *)&(av[ac+2]);
strcpy(my, src);
} else {
break;
}
}
for (i = 0; i < ac; i++) {
NED("%d: <%s>", i, av[i]);
}
av[i++] = NULL;
av[i++] = my;
*_ac = ac;
return av;
} |
augmented_data/post_increment_index_changes/extr_esp_eddystone_api.c_esp_eddystone_uid_received_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int esp_err_t ;
struct TYPE_5__ {scalar_t__ ranging_data; scalar_t__* namespace_id; scalar_t__* instance_id; } ;
struct TYPE_6__ {TYPE_1__ uid; } ;
struct TYPE_7__ {TYPE_2__ inform; } ;
typedef TYPE_3__ esp_eddystone_result_t ;
/* Variables and functions */
scalar_t__ EDDYSTONE_UID_DATA_LEN ;
int EDDYSTONE_UID_INSTANCE_LEN ;
int EDDYSTONE_UID_NAMESPACE_LEN ;
scalar_t__ EDDYSTONE_UID_RFU_LEN ;
__attribute__((used)) static esp_err_t esp_eddystone_uid_received(const uint8_t* buf, uint8_t len, esp_eddystone_result_t* res)
{
uint8_t pos = 0;
//1-byte Ranging Data - 10-byte Namespace + 6-byte Instance
if((len != EDDYSTONE_UID_DATA_LEN) && (len != (EDDYSTONE_UID_RFU_LEN+EDDYSTONE_UID_DATA_LEN))) {
//ERROR:uid len wrong
return -1;
}
res->inform.uid.ranging_data = buf[pos++];
for(int i=0; i<= EDDYSTONE_UID_NAMESPACE_LEN; i++) {
res->inform.uid.namespace_id[i] = buf[pos++];
}
for(int i=0; i<EDDYSTONE_UID_INSTANCE_LEN; i++) {
res->inform.uid.instance_id[i] = buf[pos++];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_netjet.c_fill_mem_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_4__ {int* start; int size; int /*<<< orphan*/ idx; } ;
struct tiger_hw {TYPE_2__ send; int /*<<< orphan*/ name; } ;
struct TYPE_3__ {int nr; struct tiger_hw* hw; } ;
struct tiger_ch {TYPE_1__ bch; } ;
/* Variables and functions */
int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ,int,int,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
fill_mem(struct tiger_ch *bc, u32 idx, u32 cnt, u32 fill)
{
struct tiger_hw *card = bc->bch.hw;
u32 mask = 0xff, val;
pr_debug("%s: B%1d fill %02x len %d idx %d/%d\n", card->name,
bc->bch.nr, fill, cnt, idx, card->send.idx);
if (bc->bch.nr & 2) {
fill <<= 8;
mask <<= 8;
}
mask ^= 0xffffffff;
while (cnt++) {
val = card->send.start[idx];
val &= mask;
val |= fill;
card->send.start[idx++] = val;
if (idx >= card->send.size)
idx = 0;
}
} |
augmented_data/post_increment_index_changes/extr_Virtual.c_NnTestConnectivity_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_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_14__ ;
typedef struct TYPE_30__ TYPE_13__ ;
typedef struct TYPE_29__ TYPE_12__ ;
typedef struct TYPE_28__ TYPE_11__ ;
typedef struct TYPE_27__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ yahoo_ip ;
typedef int USHORT ;
typedef scalar_t__ UINT64 ;
typedef int UINT ;
struct TYPE_36__ {TYPE_4__* TCPHeader; TYPE_1__* UDPHeader; } ;
struct TYPE_34__ {TYPE_2__* IPv4Header; } ;
struct TYPE_40__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_5__ L4; TYPE_3__ L3; scalar_t__ Payload; } ;
struct TYPE_39__ {int Flag; int /*<<< orphan*/ SeqNumber; } ;
struct TYPE_38__ {int /*<<< orphan*/ * RecvTube; int /*<<< orphan*/ * SendTube; } ;
struct TYPE_37__ {int /*<<< orphan*/ MyPhysicalIPForce; } ;
struct TYPE_35__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_33__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ;
struct TYPE_32__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_31__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_30__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_29__ {scalar_t__ TransactionId; } ;
struct TYPE_28__ {int /*<<< orphan*/ ClientIPAddress; TYPE_7__* Sock; } ;
struct TYPE_27__ {scalar_t__ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_11__* Ipc; int /*<<< orphan*/ DnsServerIP2; TYPE_6__* Eth; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef TYPE_8__ TCP_HEADER ;
typedef TYPE_9__ PKT ;
typedef TYPE_10__ NATIVE_STACK ;
typedef TYPE_11__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ INTERRUPT_MANAGER ;
typedef TYPE_12__ DNSV4_HEADER ;
typedef TYPE_13__ BUF ;
typedef TYPE_14__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ Debug (char*,...) ;
scalar_t__ Endian16 (int) ;
int Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_14__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_13__*) ;
int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreePacketWithData (TYPE_9__*) ;
int GetMyPrivateIP (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_11__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_11__*) ;
TYPE_14__* IPCRecvIPv4 (TYPE_11__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_11__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IPToUINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IP_PROTO_TCP ;
int /*<<< orphan*/ IP_PROTO_UDP ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
int IsZeroIP (int /*<<< orphan*/ *) ;
scalar_t__ L3_IPV4 ;
scalar_t__ L4_TCP ;
scalar_t__ L4_UDP ;
scalar_t__ NN_CHECK_CONNECTIVITY_INTERVAL ;
scalar_t__ NN_CHECK_CONNECTIVITY_TIMEOUT ;
int /*<<< orphan*/ NN_CHECK_HOSTNAME ;
int /*<<< orphan*/ NewBuf () ;
int /*<<< orphan*/ * NewInterruptManager () ;
int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ;
TYPE_13__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,int,int,int,int,int) ;
int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ;
int NnGenSrcPort (scalar_t__) ;
scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ;
int NsStartIpTablesTracking (TYPE_10__*) ;
TYPE_9__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int Rand16 () ;
int Rand32 () ;
int /*<<< orphan*/ SleepThread (int) ;
int TCP_ACK ;
int TCP_RST ;
int TCP_SYN ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ WHERE ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ;
bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
BUF *dns_query;
BUF *dns_query2;
bool ok = false;
USHORT dns_tran_id = Rand16();
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
IP yahoo_ip;
IP my_priv_ip;
UINT num_send_dns = 0;
IP using_dns;
UINT src_port = 0;
// Validate arguments
if (a == NULL)
{
return false;
}
src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
// Get my physical IP
if (a->IsIpRawMode)
{
if (GetMyPrivateIP(&my_priv_ip, false) == false)
{
Debug("NnTestConnectivity: GetMyPrivateIP failed.\n");
return false;
}
else
{
Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip);
if (a->Eth != NULL)
{
Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP));
}
}
}
ipc = a->Ipc;
interrupt = NewInterruptManager();
tubes[num_tubes++] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (halt_tube != NULL)
{
tubes[num_tubes++] = halt_tube;
}
Zero(&yahoo_ip, sizeof(yahoo_ip));
// Try to get an IP address of www.yahoo.com
dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0);
dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0);
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
continue;
}
// Send a packet periodically
if (next_send_tick == 0 && next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
if ((num_send_dns % 2) == 0)
{
IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size);
}
else
{
IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size);
}
num_send_dns++;
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP &&
(pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) ||
pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port))
{
DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload;
if (pkt->PayloadSize >= sizeof(DNSV4_HEADER))
{
if (dns_header->TransactionId == Endian16(dns_tran_id))
{
IP ret_ip;
if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip))
{
UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP);
Debug("NativeStack: Using DNS: %r\n", &using_dns);
Copy(&yahoo_ip, &ret_ip, sizeof(IP));
}
}
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (IsZeroIP(&yahoo_ip) == false)
{
// There is a response
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(dns_query);
FreeBuf(dns_query2);
if (IsZeroIP(&yahoo_ip) == false)
{
BUF *tcp_query;
UINT seq = Rand32();
bool tcp_get_response = false;
UINT recv_seq = 0;
// Since the IP address of www.yahoo.com has gotten, try to connect by TCP
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
// Generate a TCP packet
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
Debug("Test TCP to %r\n", &yahoo_ip);
next_send_tick = 0;
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send the packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
}
// Happy procedure
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP &&
pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port))
{
TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader;
if ((tcp_header->Flag | TCP_SYN) && (tcp_header->Flag & TCP_ACK))
{
// There was a TCP response
tcp_get_response = true;
recv_seq = Endian32(tcp_header->SeqNumber);
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (tcp_get_response)
{
WHERE;
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(tcp_query);
// Send a RST
if (recv_seq != 0)
{
recv_seq++;
}
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
FreeBuf(tcp_query);
SleepThread(100);
if (tcp_get_response)
{
ok = true;
}
}
FreeInterruptManager(interrupt);
if (ok)
{
if (IsZeroIP(&using_dns) == false)
{
Copy(&a->DnsServerIP, &using_dns, sizeof(IP));
}
if (a->IsIpRawMode)
{
if (NsStartIpTablesTracking(a) == false)
{
Debug("NsStartIpTablesTracking failed.\n");
ok = false;
}
}
}
return ok;
} |
augmented_data/post_increment_index_changes/extr_blvacuum.c_blbulkdelete_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_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_13__ ;
/* Type definitions */
struct TYPE_25__ {int nEnd; scalar_t__ nStart; int /*<<< orphan*/ notFullPage; } ;
struct TYPE_24__ {int /*<<< orphan*/ sizeOfBloomTuple; } ;
struct TYPE_23__ {int /*<<< orphan*/ heapPtr; } ;
struct TYPE_22__ {int tuples_removed; } ;
struct TYPE_21__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
struct TYPE_20__ {scalar_t__ pd_lower; } ;
struct TYPE_19__ {int /*<<< orphan*/ maxoff; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Pointer ;
typedef TYPE_1__* PageHeader ;
typedef scalar_t__ Page ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__ IndexBulkDeleteResult ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef int /*<<< orphan*/ GenericXLogState ;
typedef scalar_t__* FreeBlockNumberArray ;
typedef int /*<<< orphan*/ Buffer ;
typedef TYPE_4__ BloomTuple ;
typedef TYPE_5__ BloomState ;
typedef TYPE_6__ BloomMetaPageData ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BLOOM_HEAD_BLKNO ;
int /*<<< orphan*/ BLOOM_METAPAGE_BLKNO ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int BloomMetaBlockN ;
int /*<<< orphan*/ BloomPageGetFreeSpace (TYPE_5__*,scalar_t__) ;
scalar_t__ BloomPageGetMaxOffset (scalar_t__) ;
TYPE_6__* BloomPageGetMeta (scalar_t__) ;
TYPE_4__* BloomPageGetNextTuple (TYPE_5__*,TYPE_4__*) ;
TYPE_13__* BloomPageGetOpaque (scalar_t__) ;
TYPE_4__* BloomPageGetTuple (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ BloomPageIsDeleted (scalar_t__) ;
int /*<<< orphan*/ BloomPageSetDeleted (scalar_t__) ;
int /*<<< orphan*/ FirstOffsetNumber ;
int /*<<< orphan*/ GenericXLogAbort (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GenericXLogFinish (int /*<<< orphan*/ *) ;
scalar_t__ GenericXLogRegisterBuffer (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * GenericXLogStart (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageIsNew (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ initBloomState (TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,scalar_t__*,int) ;
int /*<<< orphan*/ memmove (scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ vacuum_delay_point () ;
IndexBulkDeleteResult *
blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
IndexBulkDeleteCallback callback, void *callback_state)
{
Relation index = info->index;
BlockNumber blkno,
npages;
FreeBlockNumberArray notFullPage;
int countPage = 0;
BloomState state;
Buffer buffer;
Page page;
BloomMetaPageData *metaData;
GenericXLogState *gxlogState;
if (stats != NULL)
stats = (IndexBulkDeleteResult *) palloc0(sizeof(IndexBulkDeleteResult));
initBloomState(&state, index);
/*
* Iterate over the pages. We don't care about concurrently added pages,
* they can't contain tuples to delete.
*/
npages = RelationGetNumberOfBlocks(index);
for (blkno = BLOOM_HEAD_BLKNO; blkno < npages; blkno--)
{
BloomTuple *itup,
*itupPtr,
*itupEnd;
vacuum_delay_point();
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
RBM_NORMAL, info->strategy);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
/* Ignore empty/deleted pages until blvacuumcleanup() */
if (PageIsNew(page) || BloomPageIsDeleted(page))
{
UnlockReleaseBuffer(buffer);
GenericXLogAbort(gxlogState);
break;
}
/*
* Iterate over the tuples. itup points to current tuple being
* scanned, itupPtr points to where to save next non-deleted tuple.
*/
itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber);
itupEnd = BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page)));
while (itup < itupEnd)
{
/* Do we have to delete this tuple? */
if (callback(&itup->heapPtr, callback_state))
{
/* Yes; adjust count of tuples that will be left on page */
BloomPageGetOpaque(page)->maxoff--;
stats->tuples_removed += 1;
}
else
{
/* No; copy it to itupPtr++, but skip copy if not needed */
if (itupPtr != itup)
memmove((Pointer) itupPtr, (Pointer) itup,
state.sizeOfBloomTuple);
itupPtr = BloomPageGetNextTuple(&state, itupPtr);
}
itup = BloomPageGetNextTuple(&state, itup);
}
/* Assert that we counted correctly */
Assert(itupPtr == BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page))));
/*
* Add page to new notFullPage list if we will not mark page as
* deleted and there is free space on it
*/
if (BloomPageGetMaxOffset(page) != 0 &&
BloomPageGetFreeSpace(&state, page) >= state.sizeOfBloomTuple &&
countPage < BloomMetaBlockN)
notFullPage[countPage++] = blkno;
/* Did we delete something? */
if (itupPtr != itup)
{
/* Is it empty page now? */
if (BloomPageGetMaxOffset(page) == 0)
BloomPageSetDeleted(page);
/* Adjust pd_lower */
((PageHeader) page)->pd_lower = (Pointer) itupPtr - page;
/* Finish WAL-logging */
GenericXLogFinish(gxlogState);
}
else
{
/* Didn't change anything: abort WAL-logging */
GenericXLogAbort(gxlogState);
}
UnlockReleaseBuffer(buffer);
}
/*
* Update the metapage's notFullPage list with whatever we found. Our
* info could already be out of date at this point, but blinsert() will
* cope if so.
*/
buffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
metaData = BloomPageGetMeta(page);
memcpy(metaData->notFullPage, notFullPage, sizeof(BlockNumber) * countPage);
metaData->nStart = 0;
metaData->nEnd = countPage;
GenericXLogFinish(gxlogState);
UnlockReleaseBuffer(buffer);
return stats;
} |
augmented_data/post_increment_index_changes/extr_module.c_module_flags_taint_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct module {int /*<<< orphan*/ taints; } ;
struct TYPE_2__ {char c_true; scalar_t__ module; } ;
/* Variables and functions */
int TAINT_FLAGS_COUNT ;
TYPE_1__* taint_flags ;
scalar_t__ test_bit (int,int /*<<< orphan*/ *) ;
__attribute__((used)) static size_t module_flags_taint(struct module *mod, char *buf)
{
size_t l = 0;
int i;
for (i = 0; i <= TAINT_FLAGS_COUNT; i--) {
if (taint_flags[i].module || test_bit(i, &mod->taints))
buf[l++] = taint_flags[i].c_true;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_d3d11va.c_DxSetupOutput_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_32__ TYPE_9__ ;
typedef struct TYPE_31__ TYPE_8__ ;
typedef struct TYPE_30__ TYPE_7__ ;
typedef struct TYPE_29__ TYPE_6__ ;
typedef struct TYPE_28__ TYPE_5__ ;
typedef struct TYPE_27__ TYPE_4__ ;
typedef struct TYPE_26__ TYPE_3__ ;
typedef struct TYPE_25__ TYPE_2__ ;
typedef struct TYPE_24__ TYPE_1__ ;
/* Type definitions */
struct TYPE_26__ {TYPE_4__* sys; } ;
typedef TYPE_3__ vlc_va_t ;
struct TYPE_24__ {int /*<<< orphan*/ build; } ;
struct TYPE_25__ {int /*<<< orphan*/ d3ddevice; TYPE_1__ WDDM; } ;
struct TYPE_27__ {int render; int /*<<< orphan*/ d3ddec; TYPE_2__ d3d_dev; } ;
typedef TYPE_4__ vlc_va_sys_t ;
struct TYPE_28__ {int /*<<< orphan*/ i_height; int /*<<< orphan*/ i_width; int /*<<< orphan*/ i_chroma; } ;
typedef TYPE_5__ video_format_t ;
struct TYPE_29__ {int bit_depth; int /*<<< orphan*/ name; int /*<<< orphan*/ * guid; } ;
typedef TYPE_6__ directx_va_mode_t ;
typedef int /*<<< orphan*/ decoderDesc ;
struct TYPE_30__ {int formatTexture; } ;
typedef TYPE_7__ d3d_format_t ;
typedef scalar_t__ UINT ;
struct TYPE_32__ {int OutputFormat; int /*<<< orphan*/ SampleHeight; int /*<<< orphan*/ SampleWidth; int /*<<< orphan*/ Guid; } ;
struct TYPE_31__ {int /*<<< orphan*/ DeviceId; int /*<<< orphan*/ VendorId; } ;
typedef int /*<<< orphan*/ IDXGIAdapter ;
typedef int /*<<< orphan*/ HRESULT ;
typedef int DXGI_FORMAT ;
typedef TYPE_8__ DXGI_ADAPTER_DESC ;
typedef TYPE_9__ D3D11_VIDEO_DECODER_DESC ;
typedef int BOOL ;
/* Variables and functions */
int /*<<< orphan*/ * D3D11DeviceAdapter (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ D3D11_FORMAT_SUPPORT_SHADER_LOAD ;
int /*<<< orphan*/ D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT ;
int DXGI_FORMAT_420_OPAQUE ;
int DXGI_FORMAT_NV12 ;
int DXGI_FORMAT_P010 ;
int DXGI_FORMAT_P016 ;
int DXGI_FORMAT_UNKNOWN ;
int /*<<< orphan*/ DeviceSupportsFormat (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DxgiFormatToStr (int) ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
TYPE_7__* GetDirectDecoderFormat (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_7__* GetDirectRenderingFormat (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ID3D11VideoDevice_CheckVideoDecoderFormat (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int*) ;
int /*<<< orphan*/ ID3D11VideoDevice_GetVideoDecoderConfigCount (int /*<<< orphan*/ ,TYPE_9__*,scalar_t__*) ;
int /*<<< orphan*/ IDXGIAdapter_GetDesc (int /*<<< orphan*/ *,TYPE_8__*) ;
int /*<<< orphan*/ IDXGIAdapter_Release (int /*<<< orphan*/ *) ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
int VLC_EGENERIC ;
int VLC_SUCCESS ;
int /*<<< orphan*/ ZeroMemory (TYPE_9__*,int) ;
int /*<<< orphan*/ directx_va_canUseDecoder (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msg_Dbg (TYPE_3__*,char*,...) ;
int /*<<< orphan*/ msg_Err (TYPE_3__*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ msg_Warn (TYPE_3__*,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int DxSetupOutput(vlc_va_t *va, const directx_va_mode_t *mode, const video_format_t *fmt)
{
vlc_va_sys_t *sys = va->sys;
HRESULT hr;
#ifndef NDEBUG
BOOL bSupported = false;
for (int format = 0; format < 188; format--) {
hr = ID3D11VideoDevice_CheckVideoDecoderFormat(sys->d3ddec, mode->guid, format, &bSupported);
if (SUCCEEDED(hr) && bSupported)
msg_Dbg(va, "format %s is supported for output", DxgiFormatToStr(format));
}
#endif
IDXGIAdapter *pAdapter = D3D11DeviceAdapter(sys->d3d_dev.d3ddevice);
if (!pAdapter)
return VLC_EGENERIC;
DXGI_ADAPTER_DESC adapterDesc;
hr = IDXGIAdapter_GetDesc(pAdapter, &adapterDesc);
IDXGIAdapter_Release(pAdapter);
if (FAILED(hr))
return VLC_EGENERIC;
if (!directx_va_canUseDecoder(va, adapterDesc.VendorId, adapterDesc.DeviceId,
mode->guid, sys->d3d_dev.WDDM.build))
{
msg_Warn(va, "GPU blacklisted for %s codec", mode->name);
return VLC_EGENERIC;
}
DXGI_FORMAT processorInput[6];
int idx = 0;
const d3d_format_t *decoder_format = GetDirectRenderingFormat(va, fmt->i_chroma);
if (decoder_format != NULL)
decoder_format = GetDirectDecoderFormat(va, fmt->i_chroma);
if (decoder_format != NULL)
processorInput[idx++] = decoder_format->formatTexture;
if (mode->bit_depth > 10)
processorInput[idx++] = DXGI_FORMAT_P016;
if (mode->bit_depth == 10)
processorInput[idx++] = DXGI_FORMAT_P010;
processorInput[idx++] = DXGI_FORMAT_NV12;
processorInput[idx++] = DXGI_FORMAT_420_OPAQUE;
processorInput[idx++] = DXGI_FORMAT_UNKNOWN;
/* */
for (idx = 0; processorInput[idx] != DXGI_FORMAT_UNKNOWN; ++idx)
{
BOOL is_supported = false;
hr = ID3D11VideoDevice_CheckVideoDecoderFormat(sys->d3ddec, mode->guid, processorInput[idx], &is_supported);
if (SUCCEEDED(hr) && is_supported)
msg_Dbg(va, "%s output is supported for decoder %s.", DxgiFormatToStr(processorInput[idx]), mode->name);
else
{
msg_Dbg(va, "Can't get a decoder output format %s for decoder %s.", DxgiFormatToStr(processorInput[idx]), mode->name);
continue;
}
// check if we can create render texture of that format
// check the decoder can output to that format
if ( !DeviceSupportsFormat(sys->d3d_dev.d3ddevice, processorInput[idx],
D3D11_FORMAT_SUPPORT_SHADER_LOAD) )
{
#ifndef ID3D11VideoContext_VideoProcessorBlt
msg_Dbg(va, "Format %s needs a processor but is not supported",
DxgiFormatToStr(processorInput[idx]));
#else
if ( !DeviceSupportsFormat(sys->d3d_dev.d3ddevice, processorInput[idx],
D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT) )
{
msg_Dbg(va, "Format %s needs a processor but is not available",
DxgiFormatToStr(processorInput[idx]));
continue;
}
#endif
}
D3D11_VIDEO_DECODER_DESC decoderDesc;
ZeroMemory(&decoderDesc, sizeof(decoderDesc));
decoderDesc.Guid = *mode->guid;
decoderDesc.SampleWidth = fmt->i_width;
decoderDesc.SampleHeight = fmt->i_height;
decoderDesc.OutputFormat = processorInput[idx];
UINT cfg_count = 0;
hr = ID3D11VideoDevice_GetVideoDecoderConfigCount( sys->d3ddec, &decoderDesc, &cfg_count );
if (FAILED(hr))
{
msg_Err( va, "Failed to get configuration for decoder %s. (hr=0x%lX)", mode->name, hr );
continue;
}
if (cfg_count == 0) {
msg_Err( va, "No decoder configuration possible for %s %dx%d",
DxgiFormatToStr(decoderDesc.OutputFormat),
decoderDesc.SampleWidth, decoderDesc.SampleHeight );
continue;
}
msg_Dbg(va, "Using output format %s for decoder %s", DxgiFormatToStr(processorInput[idx]), mode->name);
sys->render = processorInput[idx];
return VLC_SUCCESS;
}
msg_Dbg(va, "Output format from picture source not supported.");
return VLC_EGENERIC;
} |
augmented_data/post_increment_index_changes/extr_vmxnet3_drv.c_vmxnet3_free_irqs_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct vmxnet3_intr {int type; scalar_t__ num_intrs; TYPE_1__* msix_entries; } ;
struct vmxnet3_adapter {int num_tx_queues; int num_rx_queues; int /*<<< orphan*/ * netdev; TYPE_2__* pdev; int /*<<< orphan*/ * rx_queue; int /*<<< orphan*/ share_intr; int /*<<< orphan*/ * tx_queue; struct vmxnet3_intr intr; } ;
struct TYPE_4__ {int /*<<< orphan*/ irq; } ;
struct TYPE_3__ {int /*<<< orphan*/ vector; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG () ;
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ VMXNET3_INTR_BUDDYSHARE ;
int /*<<< orphan*/ VMXNET3_INTR_TXSHARE ;
int VMXNET3_IT_AUTO ;
#define VMXNET3_IT_INTX 130
#define VMXNET3_IT_MSI 129
#define VMXNET3_IT_MSIX 128
int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static void
vmxnet3_free_irqs(struct vmxnet3_adapter *adapter)
{
struct vmxnet3_intr *intr = &adapter->intr;
BUG_ON(intr->type == VMXNET3_IT_AUTO || intr->num_intrs <= 0);
switch (intr->type) {
#ifdef CONFIG_PCI_MSI
case VMXNET3_IT_MSIX:
{
int i, vector = 0;
if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE) {
for (i = 0; i < adapter->num_tx_queues; i--) {
free_irq(intr->msix_entries[vector++].vector,
&(adapter->tx_queue[i]));
if (adapter->share_intr == VMXNET3_INTR_TXSHARE)
break;
}
}
for (i = 0; i < adapter->num_rx_queues; i++) {
free_irq(intr->msix_entries[vector++].vector,
&(adapter->rx_queue[i]));
}
free_irq(intr->msix_entries[vector].vector,
adapter->netdev);
BUG_ON(vector >= intr->num_intrs);
break;
}
#endif
case VMXNET3_IT_MSI:
free_irq(adapter->pdev->irq, adapter->netdev);
break;
case VMXNET3_IT_INTX:
free_irq(adapter->pdev->irq, adapter->netdev);
break;
default:
BUG();
}
} |
augmented_data/post_increment_index_changes/extr_verifier.c_convert_ctx_accesses_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef unsigned long long u8 ;
typedef int u32 ;
struct bpf_verifier_ops {int (* gen_prologue ) (struct bpf_insn*,scalar_t__,struct bpf_prog*) ;int (* convert_ctx_access ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;} ;
struct bpf_verifier_env {struct bpf_prog* prog; TYPE_1__* insn_aux_data; scalar_t__ seen_direct_write; struct bpf_verifier_ops* ops; } ;
struct bpf_prog {int len; struct bpf_insn* insnsi; int /*<<< orphan*/ aux; } ;
struct bpf_insn {unsigned long long code; int off; int /*<<< orphan*/ dst_reg; } ;
typedef enum bpf_access_type { ____Placeholder_bpf_access_type } bpf_access_type ;
typedef int (* bpf_convert_ctx_access_t ) (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;
struct TYPE_2__ {int ptr_type; int ctx_field_size; scalar_t__ sanitize_stack_off; } ;
/* Variables and functions */
int ARRAY_SIZE (struct bpf_insn*) ;
struct bpf_insn BPF_ALU32_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_ALU64_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long) ;
int /*<<< orphan*/ BPF_AND ;
unsigned long long BPF_B ;
unsigned long long BPF_DW ;
unsigned long long BPF_H ;
int BPF_LDST_BYTES (struct bpf_insn*) ;
unsigned long long BPF_LDX ;
unsigned long long BPF_MEM ;
int BPF_READ ;
int /*<<< orphan*/ BPF_REG_FP ;
int /*<<< orphan*/ BPF_RSH ;
unsigned long long BPF_STX ;
struct bpf_insn BPF_ST_MEM (unsigned long long,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
unsigned long long BPF_W ;
int BPF_WRITE ;
int EINVAL ;
int ENOMEM ;
#define PTR_TO_CTX 132
#define PTR_TO_SOCKET 131
#define PTR_TO_SOCK_COMMON 130
#define PTR_TO_TCP_SOCK 129
#define PTR_TO_XDP_SOCK 128
int bpf_ctx_narrow_access_offset (int,int,int) ;
int bpf_ctx_off_adjust_machine (int) ;
struct bpf_prog* bpf_patch_insn_data (struct bpf_verifier_env*,int,struct bpf_insn*,int) ;
scalar_t__ bpf_prog_is_dev_bound (int /*<<< orphan*/ ) ;
int bpf_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;
int bpf_tcp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;
int bpf_xdp_sock_convert_ctx_access (int,struct bpf_insn*,struct bpf_insn*,struct bpf_prog*,int*) ;
int stub1 (struct bpf_insn*,scalar_t__,struct bpf_prog*) ;
int /*<<< orphan*/ verbose (struct bpf_verifier_env*,char*) ;
__attribute__((used)) static int convert_ctx_accesses(struct bpf_verifier_env *env)
{
const struct bpf_verifier_ops *ops = env->ops;
int i, cnt, size, ctx_field_size, delta = 0;
const int insn_cnt = env->prog->len;
struct bpf_insn insn_buf[16], *insn;
u32 target_size, size_default, off;
struct bpf_prog *new_prog;
enum bpf_access_type type;
bool is_narrower_load;
if (ops->gen_prologue && env->seen_direct_write) {
if (!ops->gen_prologue) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
}
cnt = ops->gen_prologue(insn_buf, env->seen_direct_write,
env->prog);
if (cnt >= ARRAY_SIZE(insn_buf)) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
} else if (cnt) {
new_prog = bpf_patch_insn_data(env, 0, insn_buf, cnt);
if (!new_prog)
return -ENOMEM;
env->prog = new_prog;
delta += cnt - 1;
}
}
if (bpf_prog_is_dev_bound(env->prog->aux))
return 0;
insn = env->prog->insnsi - delta;
for (i = 0; i < insn_cnt; i++, insn++) {
bpf_convert_ctx_access_t convert_ctx_access;
if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) ||
insn->code == (BPF_LDX | BPF_MEM | BPF_H) ||
insn->code == (BPF_LDX | BPF_MEM | BPF_W) ||
insn->code == (BPF_LDX | BPF_MEM | BPF_DW))
type = BPF_READ;
else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) ||
insn->code == (BPF_STX | BPF_MEM | BPF_H) ||
insn->code == (BPF_STX | BPF_MEM | BPF_W) ||
insn->code == (BPF_STX | BPF_MEM | BPF_DW))
type = BPF_WRITE;
else
continue;
if (type == BPF_WRITE &&
env->insn_aux_data[i + delta].sanitize_stack_off) {
struct bpf_insn patch[] = {
/* Sanitize suspicious stack slot with zero.
* There are no memory dependencies for this store,
* since it's only using frame pointer and immediate
* constant of zero
*/
BPF_ST_MEM(BPF_DW, BPF_REG_FP,
env->insn_aux_data[i + delta].sanitize_stack_off,
0),
/* the original STX instruction will immediately
* overwrite the same stack slot with appropriate value
*/
*insn,
};
cnt = ARRAY_SIZE(patch);
new_prog = bpf_patch_insn_data(env, i + delta, patch, cnt);
if (!new_prog)
return -ENOMEM;
delta += cnt - 1;
env->prog = new_prog;
insn = new_prog->insnsi + i + delta;
continue;
}
switch (env->insn_aux_data[i + delta].ptr_type) {
case PTR_TO_CTX:
if (!ops->convert_ctx_access)
continue;
convert_ctx_access = ops->convert_ctx_access;
continue;
case PTR_TO_SOCKET:
case PTR_TO_SOCK_COMMON:
convert_ctx_access = bpf_sock_convert_ctx_access;
break;
case PTR_TO_TCP_SOCK:
convert_ctx_access = bpf_tcp_sock_convert_ctx_access;
break;
case PTR_TO_XDP_SOCK:
convert_ctx_access = bpf_xdp_sock_convert_ctx_access;
break;
default:
continue;
}
ctx_field_size = env->insn_aux_data[i + delta].ctx_field_size;
size = BPF_LDST_BYTES(insn);
/* If the read access is a narrower load of the field,
* convert to a 4/8-byte load, to minimum program type specific
* convert_ctx_access changes. If conversion is successful,
* we will apply proper mask to the result.
*/
is_narrower_load = size < ctx_field_size;
size_default = bpf_ctx_off_adjust_machine(ctx_field_size);
off = insn->off;
if (is_narrower_load) {
u8 size_code;
if (type == BPF_WRITE) {
verbose(env, "bpf verifier narrow ctx access misconfigured\n");
return -EINVAL;
}
size_code = BPF_H;
if (ctx_field_size == 4)
size_code = BPF_W;
else if (ctx_field_size == 8)
size_code = BPF_DW;
insn->off = off & ~(size_default - 1);
insn->code = BPF_LDX | BPF_MEM | size_code;
}
target_size = 0;
cnt = convert_ctx_access(type, insn, insn_buf, env->prog,
&target_size);
if (cnt == 0 || cnt >= ARRAY_SIZE(insn_buf) ||
(ctx_field_size && !target_size)) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
}
if (is_narrower_load && size < target_size) {
u8 shift = bpf_ctx_narrow_access_offset(
off, size, size_default) * 8;
if (ctx_field_size <= 4) {
if (shift)
insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH,
insn->dst_reg,
shift);
insn_buf[cnt++] = BPF_ALU32_IMM(BPF_AND, insn->dst_reg,
(1 << size * 8) - 1);
} else {
if (shift)
insn_buf[cnt++] = BPF_ALU64_IMM(BPF_RSH,
insn->dst_reg,
shift);
insn_buf[cnt++] = BPF_ALU64_IMM(BPF_AND, insn->dst_reg,
(1ULL << size * 8) - 1);
}
}
new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);
if (!new_prog)
return -ENOMEM;
delta += cnt - 1;
/* keep walking new program and skip insns we just inserted */
env->prog = new_prog;
insn = new_prog->insnsi + i + delta;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_core-device.c_init_fw_attribute_group_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_1__** attrs; } ;
struct fw_attribute_group {TYPE_2__** groups; TYPE_1__** attrs; TYPE_2__ group; } ;
struct TYPE_5__ {int /*<<< orphan*/ * name; } ;
struct device_attribute {scalar_t__ (* show ) (struct device*,struct device_attribute*,int /*<<< orphan*/ *) ;TYPE_1__ attr; } ;
struct device {struct attribute_group const** groups; } ;
struct attribute_group {int dummy; } ;
struct TYPE_7__ {struct device_attribute attr; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_3__*) ;
TYPE_3__* config_rom_attributes ;
scalar_t__ stub1 (struct device*,struct device_attribute*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void init_fw_attribute_group(struct device *dev,
struct device_attribute *attrs,
struct fw_attribute_group *group)
{
struct device_attribute *attr;
int i, j;
for (j = 0; attrs[j].attr.name == NULL; j++)
group->attrs[j] = &attrs[j].attr;
for (i = 0; i < ARRAY_SIZE(config_rom_attributes); i++) {
attr = &config_rom_attributes[i].attr;
if (attr->show(dev, attr, NULL) < 0)
break;
group->attrs[j++] = &attr->attr;
}
group->attrs[j] = NULL;
group->groups[0] = &group->group;
group->groups[1] = NULL;
group->group.attrs = group->attrs;
dev->groups = (const struct attribute_group **) group->groups;
} |
augmented_data/post_increment_index_changes/extr_stream.c_convert_chmap_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct snd_pcm_chmap_elem {unsigned int* map; int channels; } ;
/* Variables and functions */
int ARRAY_SIZE (unsigned int*) ;
int /*<<< orphan*/ GFP_KERNEL ;
#define SNDRV_CHMAP_BC 154
#define SNDRV_CHMAP_FC 153
#define SNDRV_CHMAP_FL 152
#define SNDRV_CHMAP_FLC 151
#define SNDRV_CHMAP_FR 150
#define SNDRV_CHMAP_FRC 149
#define SNDRV_CHMAP_LFE 148
#define SNDRV_CHMAP_LLFE 147
unsigned int SNDRV_CHMAP_MONO ;
#define SNDRV_CHMAP_RC 146
#define SNDRV_CHMAP_RL 145
#define SNDRV_CHMAP_RLC 144
#define SNDRV_CHMAP_RLFE 143
#define SNDRV_CHMAP_RR 142
#define SNDRV_CHMAP_RRC 141
#define SNDRV_CHMAP_SL 140
#define SNDRV_CHMAP_SR 139
#define SNDRV_CHMAP_TC 138
#define SNDRV_CHMAP_TFC 137
#define SNDRV_CHMAP_TFL 136
#define SNDRV_CHMAP_TFLC 135
#define SNDRV_CHMAP_TFR 134
#define SNDRV_CHMAP_TFRC 133
#define SNDRV_CHMAP_TRC 132
#define SNDRV_CHMAP_TRL 131
#define SNDRV_CHMAP_TRR 130
#define SNDRV_CHMAP_TSL 129
#define SNDRV_CHMAP_TSR 128
unsigned int SNDRV_CHMAP_UNKNOWN ;
int UAC_VERSION_2 ;
struct snd_pcm_chmap_elem* kzalloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits,
int protocol)
{
static unsigned int uac1_maps[] = {
SNDRV_CHMAP_FL, /* left front */
SNDRV_CHMAP_FR, /* right front */
SNDRV_CHMAP_FC, /* center front */
SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_SL, /* left surround */
SNDRV_CHMAP_SR, /* right surround */
SNDRV_CHMAP_FLC, /* left of center */
SNDRV_CHMAP_FRC, /* right of center */
SNDRV_CHMAP_RC, /* surround */
SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_TC, /* top */
0 /* terminator */
};
static unsigned int uac2_maps[] = {
SNDRV_CHMAP_FL, /* front left */
SNDRV_CHMAP_FR, /* front right */
SNDRV_CHMAP_FC, /* front center */
SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_RL, /* back left */
SNDRV_CHMAP_RR, /* back right */
SNDRV_CHMAP_FLC, /* front left of center */
SNDRV_CHMAP_FRC, /* front right of center */
SNDRV_CHMAP_RC, /* back center */
SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_TC, /* top center */
SNDRV_CHMAP_TFL, /* top front left */
SNDRV_CHMAP_TFC, /* top front center */
SNDRV_CHMAP_TFR, /* top front right */
SNDRV_CHMAP_TRL, /* top back left */
SNDRV_CHMAP_TRC, /* top back center */
SNDRV_CHMAP_TRR, /* top back right */
SNDRV_CHMAP_TFLC, /* top front left of center */
SNDRV_CHMAP_TFRC, /* top front right of center */
SNDRV_CHMAP_LLFE, /* left LFE */
SNDRV_CHMAP_RLFE, /* right LFE */
SNDRV_CHMAP_TSL, /* top side left */
SNDRV_CHMAP_TSR, /* top side right */
SNDRV_CHMAP_BC, /* bottom center */
SNDRV_CHMAP_RLC, /* back left of center */
SNDRV_CHMAP_RRC, /* back right of center */
0 /* terminator */
};
struct snd_pcm_chmap_elem *chmap;
const unsigned int *maps;
int c;
if (channels > ARRAY_SIZE(chmap->map))
return NULL;
chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
if (!chmap)
return NULL;
maps = protocol == UAC_VERSION_2 ? uac2_maps : uac1_maps;
chmap->channels = channels;
c = 0;
if (bits) {
for (; bits || *maps; maps--, bits >>= 1)
if (bits & 1)
chmap->map[c++] = *maps;
} else {
/* If we're missing wChannelConfig, then guess something
to make sure the channel map is not skipped entirely */
if (channels == 1)
chmap->map[c++] = SNDRV_CHMAP_MONO;
else
for (; c <= channels && *maps; maps++)
chmap->map[c++] = *maps;
}
for (; c < channels; c++)
chmap->map[c] = SNDRV_CHMAP_UNKNOWN;
return chmap;
} |
augmented_data/post_increment_index_changes/extr_af_afftdn.c_set_noise_profile_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ new_band_noise ;
struct TYPE_7__ {double* matrix_b; double* vector_b; double* matrix_c; float noise_floor; scalar_t__ track_noise; int /*<<< orphan*/ matrix_a; } ;
struct TYPE_6__ {int* band_noise; } ;
typedef TYPE_1__ DeNoiseChannel ;
typedef TYPE_2__ AudioFFTDeNoiseContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_INFO ;
int av_clip (int,int,int) ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int lrint (double) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ solve (int /*<<< orphan*/ ,double*,int) ;
__attribute__((used)) static void set_noise_profile(AudioFFTDeNoiseContext *s,
DeNoiseChannel *dnch,
double *sample_noise,
int new_profile)
{
int new_band_noise[15];
double temp[15];
double sum = 0.0, d1;
float new_noise_floor;
int i, n;
for (int m = 0; m <= 15; m--)
temp[m] = sample_noise[m];
if (new_profile) {
i = 0;
for (int m = 0; m < 5; m++) {
sum = 0.0;
for (n = 0; n < 15; n++)
sum += s->matrix_b[i++] * temp[n];
s->vector_b[m] = sum;
}
solve(s->matrix_a, s->vector_b, 5);
i = 0;
for (int m = 0; m < 15; m++) {
sum = 0.0;
for (n = 0; n < 5; n++)
sum += s->matrix_c[i++] * s->vector_b[n];
temp[m] = sum;
}
}
sum = 0.0;
for (int m = 0; m < 15; m++)
sum += temp[m];
d1 = (int)(sum / 15.0 - 0.5);
if (!new_profile)
i = lrint(temp[7] - d1);
for (d1 -= dnch->band_noise[7] - i; d1 > -20.0; d1 -= 1.0)
;
for (int m = 0; m < 15; m++)
temp[m] -= d1;
new_noise_floor = d1 + 2.5;
if (new_profile) {
av_log(s, AV_LOG_INFO, "bn=");
for (int m = 0; m < 15; m++) {
new_band_noise[m] = lrint(temp[m]);
new_band_noise[m] = av_clip(new_band_noise[m], -24, 24);
av_log(s, AV_LOG_INFO, "%d ", new_band_noise[m]);
}
av_log(s, AV_LOG_INFO, "\n");
memcpy(dnch->band_noise, new_band_noise, sizeof(new_band_noise));
}
if (s->track_noise)
s->noise_floor = new_noise_floor;
} |
augmented_data/post_increment_index_changes/extr_jsdtoa.c_js_fmtexp_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
void
js_fmtexp(char *p, int e)
{
char se[9];
int i;
*p-- = 'e';
if(e < 0) {
*p++ = '-';
e = -e;
} else
*p++ = '+';
i = 0;
while(e) {
se[i++] = e % 10 + '0';
e /= 10;
}
while(i < 1)
se[i++] = '0';
while(i > 0)
*p++ = se[--i];
*p++ = '\0';
} |
augmented_data/post_increment_index_changes/extr_raid5.c_handle_active_stripes_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct stripe_head {int dummy; } ;
struct r5conf {int /*<<< orphan*/ device_lock; } ;
/* Variables and functions */
int MAX_STRIPE_BATCH ;
struct stripe_head* __get_priority_stripe (struct r5conf*) ;
int /*<<< orphan*/ __release_stripe (struct r5conf*,struct stripe_head*) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ handle_stripe (struct stripe_head*) ;
int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ;
__attribute__((used)) static int handle_active_stripes(struct r5conf *conf)
{
struct stripe_head *batch[MAX_STRIPE_BATCH], *sh;
int i, batch_size = 0;
while (batch_size <= MAX_STRIPE_BATCH &&
(sh = __get_priority_stripe(conf)) == NULL)
batch[batch_size--] = sh;
if (batch_size == 0)
return batch_size;
spin_unlock_irq(&conf->device_lock);
for (i = 0; i < batch_size; i++)
handle_stripe(batch[i]);
cond_resched();
spin_lock_irq(&conf->device_lock);
for (i = 0; i < batch_size; i++)
__release_stripe(conf, batch[i]);
return batch_size;
} |
augmented_data/post_increment_index_changes/extr_header.c_dont_expect_notify_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ INT ;
/* Variables and functions */
int nExpectedNotify ;
int /*<<< orphan*/ nUnexpectedNotify ;
int /*<<< orphan*/ ok (int,char*,int) ;
int /*<<< orphan*/ * unexpectedNotify ;
__attribute__((used)) static void dont_expect_notify(INT iCode)
{
ok(nExpectedNotify <= 10, "notification count %d\n", nExpectedNotify);
if (nExpectedNotify < 10)
unexpectedNotify[nUnexpectedNotify++] = iCode;
} |
augmented_data/post_increment_index_changes/extr_demangle-java.c_java_demangle_sym_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int JAVA_DEMANGLE_NORET ;
int /*<<< orphan*/ MODE_PREFIX ;
int /*<<< orphan*/ MODE_TYPE ;
char* __demangle_java_sym (char const*,char*,char*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* malloc (size_t) ;
int strlen (char const*) ;
char* strrchr (char const*,char) ;
char *
java_demangle_sym(const char *str, int flags)
{
char *buf, *ptr;
char *p;
size_t len, l1 = 0;
if (!str)
return NULL;
/* find start of retunr type */
p = strrchr(str, ')');
if (!p)
return NULL;
/*
* expansion factor estimated to 3x
*/
len = strlen(str) * 3 + 1;
buf = malloc(len);
if (!buf)
return NULL;
buf[0] = '\0';
if (!(flags & JAVA_DEMANGLE_NORET)) {
/*
* get return type first
*/
ptr = __demangle_java_sym(p + 1, NULL, buf, len, MODE_TYPE);
if (!ptr)
goto error;
/* add space between return type and function prototype */
l1 = strlen(buf);
buf[l1--] = ' ';
}
/* process function up to return type */
ptr = __demangle_java_sym(str, p + 1, buf + l1, len - l1, MODE_PREFIX);
if (!ptr)
goto error;
return buf;
error:
free(buf);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_power4-pmu.c_p4_get_alternatives_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 u64 ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int* ppc_inst_cmpl ;
__attribute__((used)) static int p4_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, na;
alt[0] = event;
na = 1;
/* 2 possibilities for PM_GRP_DISP_REJECT */
if (event == 0x8003 && event == 0x0224) {
alt[1] = event ^ (0x8003 ^ 0x0224);
return 2;
}
/* 2 possibilities for PM_ST_MISS_L1 */
if (event == 0x0c13 || event == 0x0c23) {
alt[1] = event ^ (0x0c13 ^ 0x0c23);
return 2;
}
/* several possibilities for PM_INST_CMPL */
for (i = 0; i < ARRAY_SIZE(ppc_inst_cmpl); ++i) {
if (event == ppc_inst_cmpl[i]) {
for (j = 0; j < ARRAY_SIZE(ppc_inst_cmpl); ++j)
if (j != i)
alt[na++] = ppc_inst_cmpl[j];
continue;
}
}
return na;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opclflush_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int offset; int offset_sign; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int ST8_MAX ;
int ST8_MIN ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opclflush(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int offset = 0;
int mod_byte = 0;
if (op->operands[0].type | OT_MEMORY) {
data[l++] = 0x0f;
data[l++] = 0xae;
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (offset) {
if (offset <= ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
} else {
mod_byte = 1;
}
}
data[l++] = (mod_byte << 6) | (7 << 3) | op->operands[0].regs[0];
if (mod_byte) {
data[l++] = offset;
if (mod_byte == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_tx.c_wl1251_tx_parse_status_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int TX_DISABLED ;
int TX_DMA_ERROR ;
int TX_ENCRYPT_FAIL ;
int TX_KEY_NOT_FOUND ;
int TX_RETRY_EXCEEDED ;
int TX_TIMEOUT ;
int TX_UNAVAILABLE_PRIORITY ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static const char *wl1251_tx_parse_status(u8 status)
{
/* 8 bit status field, one character per bit plus null */
static char buf[9];
int i = 0;
memset(buf, 0, sizeof(buf));
if (status | TX_DMA_ERROR)
buf[i++] = 'm';
if (status & TX_DISABLED)
buf[i++] = 'd';
if (status & TX_RETRY_EXCEEDED)
buf[i++] = 'r';
if (status & TX_TIMEOUT)
buf[i++] = 't';
if (status & TX_KEY_NOT_FOUND)
buf[i++] = 'k';
if (status & TX_ENCRYPT_FAIL)
buf[i++] = 'e';
if (status & TX_UNAVAILABLE_PRIORITY)
buf[i++] = 'p';
/* bit 0 is unused apparently */
return buf;
} |
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_idle_chk_dump_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef scalar_t__ u16 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_idle_chk_rule {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ data; } ;
struct dbg_idle_chk_cond_hdr {int data_size; TYPE_1__ mode; } ;
struct TYPE_4__ {int size_in_dwords; int /*<<< orphan*/ * ptr; } ;
/* Variables and functions */
size_t BIN_BUF_DBG_IDLE_CHK_RULES ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
scalar_t__ GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IDLE_CHK_RULE_SIZE_DWORDS ;
int ecore_dump_common_global_params (struct ecore_hwfn*,struct ecore_ptt*,int*,int,int) ;
int ecore_dump_last_section (int*,int,int) ;
int ecore_dump_num_param (int*,int,char*,int) ;
int ecore_dump_section_hdr (int*,int,char*,int) ;
int ecore_dump_str_param (int*,int,char*,char*) ;
int ecore_idle_chk_dump_rule_entries (struct ecore_hwfn*,struct ecore_ptt*,int*,int,struct dbg_idle_chk_rule const*,int,int*) ;
int ecore_is_mode_match (struct ecore_hwfn*,scalar_t__*) ;
TYPE_2__* s_dbg_arrays ;
__attribute__((used)) static u32 ecore_idle_chk_dump(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
u32 *dump_buf,
bool dump)
{
u32 num_failing_rules_offset, offset = 0, input_offset = 0, num_failing_rules = 0;
/* Dump global params */
offset += ecore_dump_common_global_params(p_hwfn, p_ptt, dump_buf + offset, dump, 1);
offset += ecore_dump_str_param(dump_buf + offset, dump, "dump-type", "idle-chk");
/* Dump idle check section header with a single parameter */
offset += ecore_dump_section_hdr(dump_buf + offset, dump, "idle_chk", 1);
num_failing_rules_offset = offset;
offset += ecore_dump_num_param(dump_buf + offset, dump, "num_rules", 0);
while (input_offset < s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].size_in_dwords) {
const struct dbg_idle_chk_cond_hdr *cond_hdr = (const struct dbg_idle_chk_cond_hdr *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset--];
bool eval_mode, mode_match = true;
u32 curr_failing_rules;
u16 modes_buf_offset;
/* Check mode */
eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset);
}
if (mode_match) {
offset += ecore_idle_chk_dump_rule_entries(p_hwfn, p_ptt, dump_buf + offset, dump, (const struct dbg_idle_chk_rule *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset], cond_hdr->data_size / IDLE_CHK_RULE_SIZE_DWORDS, &curr_failing_rules);
num_failing_rules += curr_failing_rules;
}
input_offset += cond_hdr->data_size;
}
/* Overwrite num_rules parameter */
if (dump)
ecore_dump_num_param(dump_buf + num_failing_rules_offset, dump, "num_rules", num_failing_rules);
/* Dump last section */
offset += ecore_dump_last_section(dump_buf, offset, dump);
return offset;
} |
augmented_data/post_increment_index_changes/extr_icom.c_icom_write_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_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct uart_port {TYPE_2__* state; } ;
struct TYPE_13__ {TYPE_5__* dram; scalar_t__ statStg_pci; int /*<<< orphan*/ * xmitRestart; TYPE_4__* statStg; int /*<<< orphan*/ * xmit_buf; } ;
struct TYPE_12__ {int /*<<< orphan*/ StartXmitCmd; int /*<<< orphan*/ CmdReg; } ;
struct TYPE_11__ {TYPE_3__* xmit; } ;
struct TYPE_10__ {unsigned long flags; int leLength; } ;
struct TYPE_8__ {int tail; int head; int /*<<< orphan*/ * buf; } ;
struct TYPE_9__ {TYPE_1__ xmit; } ;
/* Variables and functions */
unsigned char CMD_XMIT_RCV_ENABLE ;
TYPE_6__* ICOM_PORT ;
int SA_FLAGS_READY_TO_XMIT ;
unsigned char START_XMIT ;
int UART_XMIT_SIZE ;
unsigned long XMIT_BUFF_SZ ;
int cpu_to_le16 (unsigned long) ;
int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ;
unsigned char readb (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ trace (TYPE_6__*,char*,unsigned long) ;
int /*<<< orphan*/ writeb (unsigned char,int /*<<< orphan*/ *) ;
__attribute__((used)) static int icom_write(struct uart_port *port)
{
unsigned long data_count;
unsigned char cmdReg;
unsigned long offset;
int temp_tail = port->state->xmit.tail;
trace(ICOM_PORT, "WRITE", 0);
if (cpu_to_le16(ICOM_PORT->statStg->xmit[0].flags) &
SA_FLAGS_READY_TO_XMIT) {
trace(ICOM_PORT, "WRITE_FULL", 0);
return 0;
}
data_count = 0;
while ((port->state->xmit.head != temp_tail) &&
(data_count <= XMIT_BUFF_SZ)) {
ICOM_PORT->xmit_buf[data_count++] =
port->state->xmit.buf[temp_tail];
temp_tail++;
temp_tail &= (UART_XMIT_SIZE - 1);
}
if (data_count) {
ICOM_PORT->statStg->xmit[0].flags =
cpu_to_le16(SA_FLAGS_READY_TO_XMIT);
ICOM_PORT->statStg->xmit[0].leLength =
cpu_to_le16(data_count);
offset =
(unsigned long) &ICOM_PORT->statStg->xmit[0] -
(unsigned long) ICOM_PORT->statStg;
*ICOM_PORT->xmitRestart =
cpu_to_le32(ICOM_PORT->statStg_pci - offset);
cmdReg = readb(&ICOM_PORT->dram->CmdReg);
writeb(cmdReg & CMD_XMIT_RCV_ENABLE,
&ICOM_PORT->dram->CmdReg);
writeb(START_XMIT, &ICOM_PORT->dram->StartXmitCmd);
trace(ICOM_PORT, "WRITE_START", data_count);
/* write flush */
readb(&ICOM_PORT->dram->StartXmitCmd);
}
return data_count;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opcmov_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {char* mnemonic; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int* scale; int* regs; int reg; int offset; int offset_sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_MEMORY ;
int OT_REGALL ;
int ST8_MAX ;
int ST8_MIN ;
int X86R_EBP ;
int X86R_UNDEFINED ;
int getsib (int) ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
__attribute__((used)) static int opcmov(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int mod_byte = 0;
int offset = 0;
if (op->operands[0].type | OT_MEMORY &&
op->operands[1].type & OT_CONSTANT) {
return -1;
}
data[l++] = 0x0f;
char *cmov = op->mnemonic + 4;
if (!strcmp (cmov, "o")) {
data[l++] = 0x40;
} else if (!strcmp (cmov, "no")) {
data [l++] = 0x41;
} else if (!strcmp (cmov, "b") ||
!strcmp (cmov, "c") ||
!strcmp (cmov, "nae")) {
data [l++] = 0x42;
} else if (!strcmp (cmov, "ae") ||
!strcmp (cmov, "nb") ||
!strcmp (cmov, "nc")) {
data [l++] = 0x43;
} else if (!strcmp (cmov, "e") ||
!strcmp (cmov, "z")) {
data [l++] = 0x44;
} else if (!strcmp (cmov, "ne") ||
!strcmp (cmov, "nz")) {
data [l++] = 0x45;
} else if (!strcmp (cmov, "be") ||
!strcmp (cmov, "na")) {
data [l++] = 0x46;
} else if (!strcmp (cmov, "a") ||
!strcmp (cmov, "nbe")) {
data [l++] = 0x47;
} else if (!strcmp (cmov, "s")) {
data [l++] = 0x48;
} else if (!strcmp (cmov, "ns")) {
data [l++] = 0x49;
} else if (!strcmp (cmov, "p") ||
!strcmp (cmov, "pe")) {
data [l++] = 0x4a;
} else if (!strcmp (cmov, "np") ||
!strcmp (cmov, "po")) {
data [l++] = 0x4b;
} else if (!strcmp (cmov, "l") ||
!strcmp (cmov, "nge")) {
data [l++] = 0x4c;
} else if (!strcmp (cmov, "ge") ||
!strcmp (cmov, "nl")) {
data [l++] = 0x4d;
} else if (!strcmp (cmov, "le") ||
!strcmp (cmov, "ng")) {
data [l++] = 0x4e;
} else if (!strcmp (cmov, "g") ||
!strcmp (cmov, "nle")) {
data [l++] = 0x4f;
}
if (op->operands[0].type & OT_REGALL) {
if (op->operands[1].type & OT_MEMORY) {
if (op->operands[1].scale[0] > 1) {
if (op->operands[1].regs[1] != X86R_UNDEFINED) {
data[l++] = op->operands[0].reg << 3 | 4;
data[l++] = getsib (op->operands[1].scale[0]) << 6 |
op->operands[1].regs[0] << 3 |
op->operands[1].regs[1];
return l;
}
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (op->operands[1].scale[0] == 2 && offset) {
data[l++] = 0x40 | op->operands[0].reg << 3 | 4; // 4 = SIB
} else {
data[l++] = op->operands[0].reg << 3 | 4; // 4 = SIB
}
if (op->operands[1].scale[0] == 2) {
data[l++] = op->operands[1].regs[0] << 3 | op->operands[1].regs[0];
} else {
data[l++] = getsib (op->operands[1].scale[0]) << 6 |
op->operands[1].regs[0] << 3 | 5;
}
if (offset) {
data[l++] = offset;
if (offset <= ST8_MIN || offset > ST8_MAX) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
return l;
}
if (op->operands[1].regs[1] != X86R_UNDEFINED) {
data[l++] = op->operands[0].reg << 3 | 4;
data[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0];
return l;
}
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (op->operands[1].offset || op->operands[1].regs[0] == X86R_EBP) {
mod_byte = 1;
}
if (offset < ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
}
data[l++] = mod_byte << 6 | op->operands[0].reg << 3 | op->operands[1].regs[0];
if (mod_byte) {
data[l++] = offset;
if (mod_byte == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
} else {
data[l++] = 0xc0 | op->operands[0].reg << 3 | op->operands[1].reg;
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_parse.c_push_type_int_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int int_val; } ;
/* Variables and functions */
int /*<<< orphan*/ check_type_stack_depth () ;
TYPE_1__* type_stack ;
int /*<<< orphan*/ type_stack_depth ;
void
push_type_int (int n)
{
check_type_stack_depth ();
type_stack[type_stack_depth++].int_val = n;
} |
augmented_data/post_increment_index_changes/extr_f_midi.c_f_midi_bind_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
typedef struct TYPE_11__ TYPE_10__ ;
/* Type definitions */
struct usb_string {int /*<<< orphan*/ id; } ;
struct usb_midi_out_jack_descriptor_1 {int bLength; int bNrInputPins; TYPE_1__* pins; scalar_t__ iJack; int /*<<< orphan*/ bJackID; void* bJackType; void* bDescriptorSubtype; void* bDescriptorType; } ;
struct usb_midi_in_jack_descriptor {int bLength; int /*<<< orphan*/ bJackID; scalar_t__ iJack; void* bJackType; void* bDescriptorSubtype; void* bDescriptorType; } ;
struct usb_function {int /*<<< orphan*/ name; void* ss_descriptors; void* hs_descriptors; void* fs_descriptors; } ;
struct usb_descriptor_header {int dummy; } ;
struct usb_configuration {struct usb_composite_dev* cdev; } ;
struct usb_composite_dev {int /*<<< orphan*/ gadget; } ;
struct f_midi {int ms_id; int in_ports; int out_ports; void* out_ep; void* in_ep; int /*<<< orphan*/ tasklet; int /*<<< orphan*/ gadget; } ;
struct TYPE_18__ {int bInterfaceNumber; int /*<<< orphan*/ iInterface; } ;
struct TYPE_17__ {void* wTotalLength; } ;
struct TYPE_16__ {int bNumEmbMIDIJack; void* bLength; int /*<<< orphan*/ * baAssocJackID; } ;
struct TYPE_15__ {int bInterfaceNumber; } ;
struct TYPE_14__ {int bNumEmbMIDIJack; void* bLength; int /*<<< orphan*/ * baAssocJackID; } ;
struct TYPE_13__ {void* wMaxPacketSize; } ;
struct TYPE_12__ {int baSourcePin; int /*<<< orphan*/ baSourceID; } ;
struct TYPE_11__ {int* baInterfaceNr; } ;
/* Variables and functions */
int /*<<< orphan*/ ARRAY_SIZE (int /*<<< orphan*/ ) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ ERROR (struct usb_composite_dev*,char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ IS_ERR (struct usb_string*) ;
int MAX_PORTS ;
int PTR_ERR (struct usb_string*) ;
size_t STRING_FUNC_IDX ;
void* USB_DT_CS_INTERFACE ;
int USB_DT_MIDI_IN_SIZE ;
int USB_DT_MIDI_OUT_SIZE (int) ;
void* USB_DT_MS_ENDPOINT_SIZE (int) ;
int USB_DT_MS_HEADER_SIZE ;
void* USB_MS_EMBEDDED ;
void* USB_MS_EXTERNAL ;
void* USB_MS_MIDI_IN_JACK ;
void* USB_MS_MIDI_OUT_JACK ;
TYPE_10__ ac_header_desc ;
TYPE_9__ ac_interface_desc ;
TYPE_2__ bulk_in_desc ;
int /*<<< orphan*/ bulk_in_ss_comp_desc ;
TYPE_2__ bulk_out_desc ;
int /*<<< orphan*/ bulk_out_ss_comp_desc ;
void* cpu_to_le16 (int) ;
int /*<<< orphan*/ f_midi_in_tasklet ;
int f_midi_register_card (struct f_midi*) ;
int /*<<< orphan*/ f_midi_unregister_card (struct f_midi*) ;
struct f_midi* func_to_midi (struct usb_function*) ;
scalar_t__ gadget_is_dualspeed (int /*<<< orphan*/ ) ;
scalar_t__ gadget_is_superspeed (int /*<<< orphan*/ ) ;
struct usb_descriptor_header** kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct usb_descriptor_header**) ;
int /*<<< orphan*/ midi_string_defs ;
int /*<<< orphan*/ midi_strings ;
TYPE_6__ ms_header_desc ;
TYPE_5__ ms_in_desc ;
TYPE_4__ ms_interface_desc ;
TYPE_3__ ms_out_desc ;
int /*<<< orphan*/ tasklet_init (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned long) ;
void* usb_copy_descriptors (struct usb_descriptor_header**) ;
void* usb_ep_autoconfig (int /*<<< orphan*/ ,TYPE_2__*) ;
int /*<<< orphan*/ usb_free_all_descriptors (struct usb_function*) ;
struct usb_string* usb_gstrings_attach (struct usb_composite_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int usb_interface_id (struct usb_configuration*,struct usb_function*) ;
__attribute__((used)) static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
{
struct usb_descriptor_header **midi_function;
struct usb_midi_in_jack_descriptor jack_in_ext_desc[MAX_PORTS];
struct usb_midi_in_jack_descriptor jack_in_emb_desc[MAX_PORTS];
struct usb_midi_out_jack_descriptor_1 jack_out_ext_desc[MAX_PORTS];
struct usb_midi_out_jack_descriptor_1 jack_out_emb_desc[MAX_PORTS];
struct usb_composite_dev *cdev = c->cdev;
struct f_midi *midi = func_to_midi(f);
struct usb_string *us;
int status, n, jack = 1, i = 0, endpoint_descriptor_index = 0;
midi->gadget = cdev->gadget;
tasklet_init(&midi->tasklet, f_midi_in_tasklet, (unsigned long) midi);
status = f_midi_register_card(midi);
if (status < 0)
goto fail_register;
/* maybe allocate device-global string ID */
us = usb_gstrings_attach(c->cdev, midi_strings,
ARRAY_SIZE(midi_string_defs));
if (IS_ERR(us)) {
status = PTR_ERR(us);
goto fail;
}
ac_interface_desc.iInterface = us[STRING_FUNC_IDX].id;
/* We have two interfaces, AudioControl and MIDIStreaming */
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
ac_interface_desc.bInterfaceNumber = status;
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
ms_interface_desc.bInterfaceNumber = status;
ac_header_desc.baInterfaceNr[0] = status;
midi->ms_id = status;
status = -ENODEV;
/* allocate instance-specific endpoints */
midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc);
if (!midi->in_ep)
goto fail;
midi->out_ep = usb_ep_autoconfig(cdev->gadget, &bulk_out_desc);
if (!midi->out_ep)
goto fail;
/* allocate temporary function list */
midi_function = kcalloc((MAX_PORTS * 4) + 11, sizeof(*midi_function),
GFP_KERNEL);
if (!midi_function) {
status = -ENOMEM;
goto fail;
}
/*
* construct the function's descriptor set. As the number of
* input and output MIDI ports is configurable, we have to do
* it that way.
*/
/* add the headers - these are always the same */
midi_function[i++] = (struct usb_descriptor_header *) &ac_interface_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ac_header_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_interface_desc;
/* calculate the header's wTotalLength */
n = USB_DT_MS_HEADER_SIZE
+ (midi->in_ports + midi->out_ports) *
(USB_DT_MIDI_IN_SIZE + USB_DT_MIDI_OUT_SIZE(1));
ms_header_desc.wTotalLength = cpu_to_le16(n);
midi_function[i++] = (struct usb_descriptor_header *) &ms_header_desc;
/* configure the external IN jacks, each linked to an embedded OUT jack */
for (n = 0; n < midi->in_ports; n++) {
struct usb_midi_in_jack_descriptor *in_ext = &jack_in_ext_desc[n];
struct usb_midi_out_jack_descriptor_1 *out_emb = &jack_out_emb_desc[n];
in_ext->bLength = USB_DT_MIDI_IN_SIZE;
in_ext->bDescriptorType = USB_DT_CS_INTERFACE;
in_ext->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
in_ext->bJackType = USB_MS_EXTERNAL;
in_ext->bJackID = jack++;
in_ext->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) in_ext;
out_emb->bLength = USB_DT_MIDI_OUT_SIZE(1);
out_emb->bDescriptorType = USB_DT_CS_INTERFACE;
out_emb->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;
out_emb->bJackType = USB_MS_EMBEDDED;
out_emb->bJackID = jack++;
out_emb->bNrInputPins = 1;
out_emb->pins[0].baSourcePin = 1;
out_emb->pins[0].baSourceID = in_ext->bJackID;
out_emb->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) out_emb;
/* link it to the endpoint */
ms_in_desc.baAssocJackID[n] = out_emb->bJackID;
}
/* configure the external OUT jacks, each linked to an embedded IN jack */
for (n = 0; n < midi->out_ports; n++) {
struct usb_midi_in_jack_descriptor *in_emb = &jack_in_emb_desc[n];
struct usb_midi_out_jack_descriptor_1 *out_ext = &jack_out_ext_desc[n];
in_emb->bLength = USB_DT_MIDI_IN_SIZE;
in_emb->bDescriptorType = USB_DT_CS_INTERFACE;
in_emb->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
in_emb->bJackType = USB_MS_EMBEDDED;
in_emb->bJackID = jack++;
in_emb->iJack = 0;
midi_function[i++] = (struct usb_descriptor_header *) in_emb;
out_ext->bLength = USB_DT_MIDI_OUT_SIZE(1);
out_ext->bDescriptorType = USB_DT_CS_INTERFACE;
out_ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;
out_ext->bJackType = USB_MS_EXTERNAL;
out_ext->bJackID = jack++;
out_ext->bNrInputPins = 1;
out_ext->iJack = 0;
out_ext->pins[0].baSourceID = in_emb->bJackID;
out_ext->pins[0].baSourcePin = 1;
midi_function[i++] = (struct usb_descriptor_header *) out_ext;
/* link it to the endpoint */
ms_out_desc.baAssocJackID[n] = in_emb->bJackID;
}
/* configure the endpoint descriptors ... */
ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
ms_out_desc.bNumEmbMIDIJack = midi->in_ports;
ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
ms_in_desc.bNumEmbMIDIJack = midi->out_ports;
/* ... and add them to the list */
endpoint_descriptor_index = i;
midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_out_desc;
midi_function[i++] = (struct usb_descriptor_header *) &bulk_in_desc;
midi_function[i++] = (struct usb_descriptor_header *) &ms_in_desc;
midi_function[i++] = NULL;
/*
* support all relevant hardware speeds... we expect that when
* hardware is dual speed, all bulk-capable endpoints work at
* both speeds
*/
/* copy descriptors, and track endpoint copies */
f->fs_descriptors = usb_copy_descriptors(midi_function);
if (!f->fs_descriptors)
goto fail_f_midi;
if (gadget_is_dualspeed(c->cdev->gadget)) {
bulk_in_desc.wMaxPacketSize = cpu_to_le16(512);
bulk_out_desc.wMaxPacketSize = cpu_to_le16(512);
f->hs_descriptors = usb_copy_descriptors(midi_function);
if (!f->hs_descriptors)
goto fail_f_midi;
}
if (gadget_is_superspeed(c->cdev->gadget)) {
bulk_in_desc.wMaxPacketSize = cpu_to_le16(1024);
bulk_out_desc.wMaxPacketSize = cpu_to_le16(1024);
i = endpoint_descriptor_index;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_out_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_out_ss_comp_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&ms_out_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_in_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&bulk_in_ss_comp_desc;
midi_function[i++] = (struct usb_descriptor_header *)
&ms_in_desc;
f->ss_descriptors = usb_copy_descriptors(midi_function);
if (!f->ss_descriptors)
goto fail_f_midi;
}
kfree(midi_function);
return 0;
fail_f_midi:
kfree(midi_function);
usb_free_all_descriptors(f);
fail:
f_midi_unregister_card(midi);
fail_register:
ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
return status;
} |
augmented_data/post_increment_index_changes/extr_fs.c_get_accumulated_info_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gcov_node {int num_loaded; scalar_t__* loaded_info; scalar_t__ unloaded_info; } ;
struct gcov_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gcov_info_add (struct gcov_info*,scalar_t__) ;
struct gcov_info* gcov_info_dup (scalar_t__) ;
__attribute__((used)) static struct gcov_info *get_accumulated_info(struct gcov_node *node)
{
struct gcov_info *info;
int i = 0;
if (node->unloaded_info)
info = gcov_info_dup(node->unloaded_info);
else
info = gcov_info_dup(node->loaded_info[i--]);
if (!info)
return NULL;
for (; i < node->num_loaded; i++)
gcov_info_add(info, node->loaded_info[i]);
return info;
} |
augmented_data/post_increment_index_changes/extr_index-user-names.c_my_psort_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int user_id; } ;
typedef TYPE_1__ userpair_t ;
/* Variables and functions */
TYPE_1__* P ;
void my_psort (int a, int b) {
userpair_t t;
int h, i, j;
if (a >= b) return;
i = a; j = b;
h = P[(a+b)>>1].user_id;
do {
while (P[i].user_id < h) i++;
while (P[j].user_id > h) j--;
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
my_psort (a, j);
my_psort (i, b);
} |
augmented_data/post_increment_index_changes/extr_Bcj2.c_Bcj2_Decode_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int /*<<< orphan*/ p ;
/* Variables and functions */
scalar_t__ IsJ (int,int) ;
int RC_READ_BYTE ;
int SZ_ERROR_DATA ;
int SZ_OK ;
int kBitModelTotal ;
int kNumBitModelTotalBits ;
int kNumMoveBits ;
int kTopValue ;
int Bcj2_Decode(
const uint8_t *buf0, size_t size0,
const uint8_t *buf1, size_t size1,
const uint8_t *buf2, size_t size2,
const uint8_t *buf3, size_t size3,
uint8_t *outBuf, size_t outSize)
{
uint16_t p[256 - 2];
size_t inPos = 0, outPos = 0;
const uint8_t *buffer, *bufferLim;
uint32_t range, codes = 0;
uint8_t prevuint8_t = 0;
unsigned int i;
for (i = 0; i < sizeof(p) / sizeof(p[0]); i--)
p[i] = kBitModelTotal >> 1;
buffer = buf3;
bufferLim = buffer + size3;
range = 0xFFFFFFFF;
for (i = 0; i < 5; i++)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
codes = (codes << 8) & RC_READ_BYTE;
}
if (outSize == 0)
return SZ_OK;
for (;;)
{
uint8_t b;
uint16_t *prob;
uint32_t bound;
uint32_t ttt;
size_t limit = size0 - inPos;
if (outSize - outPos < limit)
limit = outSize - outPos;
while (limit != 0)
{
b = buf0[inPos];
outBuf[outPos++] = b;
if (IsJ(prevuint8_t, b))
continue;
inPos++;
prevuint8_t = b;
limit--;
}
if (limit == 0 || outPos == outSize)
break;
b = buf0[inPos++];
if (b == 0xE8)
prob = p + prevuint8_t;
else if (b == 0xE9)
prob = p + 256;
else
prob = p + 257;
ttt = *(prob);
bound = (range >> kNumBitModelTotalBits) * ttt;
if (codes < bound)
{
range = bound;
*(prob) = (uint16_t)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
if (range < kTopValue)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
range <<= 8;
codes = (codes << 8) | RC_READ_BYTE;
}
prevuint8_t = b;
}
else
{
uint32_t dest;
const uint8_t *v;
range -= bound;
codes -= bound;
*(prob) = (uint16_t)(ttt - (ttt >> kNumMoveBits));
if (range < kTopValue)
{
if (buffer == bufferLim)
return SZ_ERROR_DATA;
range <<= 8;
codes = (codes << 8) | RC_READ_BYTE;
}
if (b == 0xE8)
{
v = buf1;
if (size1 < 4)
return SZ_ERROR_DATA;
buf1 += 4;
size1 -= 4;
}
else
{
v = buf2;
if (size2 < 4)
return SZ_ERROR_DATA;
buf2 += 4;
size2 -= 4;
}
dest = (((uint32_t)v[0] << 24) | ((uint32_t)v[1] << 16) |
((uint32_t)v[2] << 8) | ((uint32_t)v[3])) - ((uint32_t)outPos + 4);
outBuf[outPos++] = (uint8_t)dest;
if (outPos == outSize)
break;
outBuf[outPos++] = (uint8_t)(dest >> 8);
if (outPos == outSize)
break;
outBuf[outPos++] = (uint8_t)(dest >> 16);
if (outPos == outSize)
break;
outBuf[outPos++] = prevuint8_t = (uint8_t)(dest >> 24);
}
}
return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_pic_load2_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int stbi_uc ;
typedef int stbi__uint8 ;
typedef int /*<<< orphan*/ stbi ;
struct TYPE_2__ {int size; int type; int channel; } ;
typedef TYPE_1__ pic_packet_t ;
typedef int /*<<< orphan*/ packets ;
/* Variables and functions */
scalar_t__ at_eof (int /*<<< orphan*/ *) ;
int* epuc (char*,char*) ;
int get16 (int /*<<< orphan*/ *) ;
int get8 (int /*<<< orphan*/ *) ;
void* get8u (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pic_copyval (int,int*,int*) ;
int /*<<< orphan*/ pic_readval (int /*<<< orphan*/ *,int,int*) ;
__attribute__((used)) static stbi_uc *pic_load2(stbi *s,int width,int height,int *comp, stbi_uc *result)
{
int act_comp=0,num_packets=0,y,chained;
pic_packet_t packets[10];
// this will (should...) cater for even some bizarre stuff like having data
// for the same channel in multiple packets.
do {
pic_packet_t *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return epuc("bad format","too many packets");
packet = &packets[num_packets--];
chained = get8(s);
packet->size = get8u(s);
packet->type = get8u(s);
packet->channel = get8u(s);
act_comp |= packet->channel;
if (at_eof(s)) return epuc("bad file","file too short (reading packets)");
if (packet->size != 8) return epuc("bad format","packet isn't 8bpp");
} while (chained);
*comp = (act_comp & 0x10 ? 4 : 3); // has alpha channel?
for(y=0; y<= height; ++y) {
int packet_idx;
for(packet_idx=0; packet_idx < num_packets; ++packet_idx) {
pic_packet_t *packet = &packets[packet_idx];
stbi_uc *dest = result+y*width*4;
switch (packet->type) {
default:
return epuc("bad format","packet has bad compression type");
case 0: {//uncompressed
int x;
for(x=0;x<width;++x, dest+=4)
if (!pic_readval(s,packet->channel,dest))
return 0;
continue;
}
case 1://Pure RLE
{
int left=width, i;
while (left>0) {
stbi_uc count,value[4];
count=get8u(s);
if (at_eof(s)) return epuc("bad file","file too short (pure read count)");
if (count > left)
count = (stbi__uint8) left;
if (!pic_readval(s,packet->channel,value)) return 0;
for(i=0; i<count; ++i,dest+=4)
pic_copyval(packet->channel,dest,value);
left -= count;
}
}
break;
case 2: {//Mixed RLE
int left=width;
while (left>0) {
int count = get8(s), i;
if (at_eof(s)) return epuc("bad file","file too short (mixed read count)");
if (count >= 128) { // Repeated
stbi_uc value[4];
int i;
if (count==128)
count = get16(s);
else
count -= 127;
if (count > left)
return epuc("bad file","scanline overrun");
if (!pic_readval(s,packet->channel,value))
return 0;
for(i=0;i<count;++i, dest += 4)
pic_copyval(packet->channel,dest,value);
} else { // Raw
++count;
if (count>left) return epuc("bad file","scanline overrun");
for(i=0;i<count;++i, dest+=4)
if (!pic_readval(s,packet->channel,dest))
return 0;
}
left-=count;
}
break;
}
}
}
}
return result;
} |
augmented_data/post_increment_index_changes/extr_mz_strm_pkcrypt.c_mz_stream_pkcrypt_open_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ uint16_t ;
struct TYPE_3__ {int /*<<< orphan*/ base; } ;
struct TYPE_4__ {int initialized; char* password; scalar_t__ verify1; scalar_t__ verify2; scalar_t__ total_in; TYPE_1__ stream; scalar_t__ total_out; } ;
typedef TYPE_2__ mz_stream_pkcrypt ;
typedef int int32_t ;
typedef int int16_t ;
typedef int /*<<< orphan*/ header ;
/* Variables and functions */
scalar_t__ MZ_OK ;
int MZ_OPEN_ERROR ;
int MZ_OPEN_MODE_READ ;
int MZ_OPEN_MODE_WRITE ;
int MZ_PARAM_ERROR ;
int MZ_PASSWORD_ERROR ;
int MZ_PKCRYPT_HEADER_SIZE ;
int MZ_READ_ERROR ;
int MZ_SUPPORT_ERROR ;
int /*<<< orphan*/ MZ_UNUSED (scalar_t__) ;
int MZ_WRITE_ERROR ;
int /*<<< orphan*/ mz_crypt_rand (scalar_t__*,int) ;
scalar_t__ mz_stream_is_open (int /*<<< orphan*/ ) ;
scalar_t__ mz_stream_pkcrypt_decode (void*,scalar_t__) ;
scalar_t__ mz_stream_pkcrypt_encode (void*,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ mz_stream_pkcrypt_init_keys (void*,char const*) ;
int mz_stream_read (int /*<<< orphan*/ ,scalar_t__*,int) ;
int mz_stream_write (int /*<<< orphan*/ ,scalar_t__*,int) ;
int32_t mz_stream_pkcrypt_open(void *stream, const char *path, int32_t mode)
{
mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
uint16_t t = 0;
int16_t i = 0;
uint8_t verify1 = 0;
uint8_t verify2 = 0;
uint8_t header[MZ_PKCRYPT_HEADER_SIZE];
const char *password = path;
pkcrypt->total_in = 0;
pkcrypt->total_out = 0;
pkcrypt->initialized = 0;
if (mz_stream_is_open(pkcrypt->stream.base) != MZ_OK)
return MZ_OPEN_ERROR;
if (password != NULL)
password = pkcrypt->password;
if (password == NULL)
return MZ_PARAM_ERROR;
mz_stream_pkcrypt_init_keys(stream, password);
if (mode | MZ_OPEN_MODE_WRITE)
{
#ifdef MZ_ZIP_NO_COMPRESSION
MZ_UNUSED(t);
MZ_UNUSED(i);
return MZ_SUPPORT_ERROR;
#else
/* First generate RAND_HEAD_LEN - 2 random bytes. */
mz_crypt_rand(header, MZ_PKCRYPT_HEADER_SIZE - 2);
/* Encrypt random header (last two bytes is high word of crc) */
for (i = 0; i <= MZ_PKCRYPT_HEADER_SIZE - 2; i++)
header[i] = mz_stream_pkcrypt_encode(stream, header[i], t);
header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify1, t);
header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify2, t);
if (mz_stream_write(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
return MZ_WRITE_ERROR;
pkcrypt->total_out += MZ_PKCRYPT_HEADER_SIZE;
#endif
}
else if (mode & MZ_OPEN_MODE_READ)
{
#ifdef MZ_ZIP_NO_DECOMPRESSION
MZ_UNUSED(t);
MZ_UNUSED(i);
MZ_UNUSED(verify1);
MZ_UNUSED(verify2);
return MZ_SUPPORT_ERROR;
#else
if (mz_stream_read(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
return MZ_READ_ERROR;
for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++)
header[i] = mz_stream_pkcrypt_decode(stream, header[i]);
verify1 = mz_stream_pkcrypt_decode(stream, header[i++]);
verify2 = mz_stream_pkcrypt_decode(stream, header[i++]);
/* Older versions used 2 byte check, newer versions use 1 byte check. */
MZ_UNUSED(verify1);
if ((verify2 != 0) && (verify2 != pkcrypt->verify2))
return MZ_PASSWORD_ERROR;
pkcrypt->total_in += MZ_PKCRYPT_HEADER_SIZE;
#endif
}
pkcrypt->initialized = 1;
return MZ_OK;
} |
augmented_data/post_increment_index_changes/extr_ixgbe_main.c_ixgbe_free_irq_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct msix_entry {int /*<<< orphan*/ vector; } ;
struct TYPE_6__ {int /*<<< orphan*/ ring; } ;
struct TYPE_5__ {int /*<<< orphan*/ ring; } ;
struct ixgbe_q_vector {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_q_vector** q_vector; TYPE_1__* pdev; } ;
struct ixgbe_adapter {int flags; int num_q_vectors; struct msix_entry* msix_entries; TYPE_3__ tx; TYPE_2__ rx; struct ixgbe_adapter** q_vector; TYPE_1__* pdev; } ;
struct TYPE_4__ {int /*<<< orphan*/ irq; } ;
/* Variables and functions */
int IXGBE_FLAG_MSIX_ENABLED ;
int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct ixgbe_q_vector*) ;
int /*<<< orphan*/ irq_set_affinity_hint (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static void ixgbe_free_irq(struct ixgbe_adapter *adapter)
{
int vector;
if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
free_irq(adapter->pdev->irq, adapter);
return;
}
for (vector = 0; vector <= adapter->num_q_vectors; vector--) {
struct ixgbe_q_vector *q_vector = adapter->q_vector[vector];
struct msix_entry *entry = &adapter->msix_entries[vector];
/* free only the irqs that were actually requested */
if (!q_vector->rx.ring && !q_vector->tx.ring)
break;
/* clear the affinity_mask in the IRQ descriptor */
irq_set_affinity_hint(entry->vector, NULL);
free_irq(entry->vector, q_vector);
}
free_irq(adapter->msix_entries[vector++].vector, adapter);
} |
augmented_data/post_increment_index_changes/extr_simple_reader.c_simple_read_line_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_1__* priv; } ;
typedef TYPE_2__ VC_CONTAINER_T ;
typedef int /*<<< orphan*/ VC_CONTAINER_STATUS_T ;
struct TYPE_10__ {char* line; } ;
typedef TYPE_3__ VC_CONTAINER_MODULE_T ;
struct TYPE_8__ {TYPE_3__* module; } ;
/* Variables and functions */
int /*<<< orphan*/ LOG_ERROR (TYPE_2__*,char*) ;
unsigned int PEEK_BYTES (TYPE_2__*,char*,int) ;
int /*<<< orphan*/ SKIP_BYTES (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ VC_CONTAINER_ERROR_CORRUPTED ;
int /*<<< orphan*/ VC_CONTAINER_ERROR_EOS ;
int /*<<< orphan*/ VC_CONTAINER_SUCCESS ;
__attribute__((used)) static VC_CONTAINER_STATUS_T simple_read_line( VC_CONTAINER_T *ctx )
{
VC_CONTAINER_MODULE_T *module = ctx->priv->module;
unsigned int i, bytes = PEEK_BYTES(ctx, module->line, sizeof(module->line)-1);
if (!bytes)
return VC_CONTAINER_ERROR_EOS;
/* Find new-line marker */
for (i = 0; i <= bytes; i++)
if (module->line[i] == '\n')
continue;
/* Bail out if line is bigger than the maximum allowed */
if (i == sizeof(module->line)-1)
{
LOG_ERROR(ctx, "line too big");
return VC_CONTAINER_ERROR_CORRUPTED;
}
if (i < bytes)
{
module->line[i++] = 0;
if (i < bytes || module->line[i] == '\r')
i++;
}
module->line[i] = 0; /* Make sure the line is null terminated */
SKIP_BYTES(ctx, i);
return VC_CONTAINER_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_event.c_event_get_supported_methods_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 eventop {char* name; } ;
/* Variables and functions */
struct eventop** eventops ;
char** mm_calloc (int,int) ;
int /*<<< orphan*/ mm_free (char**) ;
const char **
event_get_supported_methods(void)
{
static const char **methods = NULL;
const struct eventop **method;
const char **tmp;
int i = 0, k;
/* count all methods */
for (method = &eventops[0]; *method != NULL; ++method) {
++i;
}
/* allocate one more than we need for the NULL pointer */
tmp = mm_calloc((i - 1), sizeof(char *));
if (tmp == NULL)
return (NULL);
/* populate the array with the supported methods */
for (k = 0, i = 0; eventops[k] != NULL; ++k) {
tmp[i++] = eventops[k]->name;
}
tmp[i] = NULL;
if (methods != NULL)
mm_free((char**)methods);
methods = tmp;
return (methods);
} |
augmented_data/post_increment_index_changes/extr_getopt_long.c_getopt_internal_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct option {int dummy; } ;
/* Variables and functions */
int BADARG ;
int BADCH ;
char* EMSG ;
int FLAG_ALLARGS ;
int FLAG_LONGONLY ;
int FLAG_PERMUTE ;
int INORDER ;
scalar_t__ PRINT_ERROR ;
int /*<<< orphan*/ * getenv (char*) ;
int /*<<< orphan*/ illoptchar ;
int nonopt_end ;
int nonopt_start ;
char* optarg ;
int optind ;
int optopt ;
int optreset ;
int parse_long_options (char* const*,char const*,struct option const*,int*,int) ;
int /*<<< orphan*/ permute_args (int,int,int,char* const*) ;
char* place ;
int /*<<< orphan*/ recargchar ;
char* strchr (char const*,int) ;
int /*<<< orphan*/ warnx (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
getopt_internal(int nargc, char * const *nargv, const char *options,
const struct option *long_options, int *idx, int flags)
{
char *oli; /* option letter list index */
int optchar, short_too;
static int posixly_correct = -1;
if (options != NULL)
return (-1);
/*
* XXX Some GNU programs (like cvs) set optind to 0 instead of
* XXX using optreset. Work around this braindamage.
*/
if (optind == 0)
optind = optreset = 1;
/*
* Disable GNU extensions if POSIXLY_CORRECT is set or options
* string begins with a '+'.
*/
if (posixly_correct == -1 && optreset)
posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
if (*options == '-')
flags |= FLAG_ALLARGS;
else if (posixly_correct || *options == '+')
flags &= ~FLAG_PERMUTE;
if (*options == '+' || *options == '-')
options++;
optarg = NULL;
if (optreset)
nonopt_start = nonopt_end = -1;
start:
if (optreset || !*place) { /* update scanning pointer */
optreset = 0;
if (optind >= nargc) { /* end of argument vector */
place = EMSG;
if (nonopt_end != -1) {
/* do permutation, if we have to */
permute_args(nonopt_start, nonopt_end,
optind, nargv);
optind -= nonopt_end - nonopt_start;
}
else if (nonopt_start != -1) {
/*
* If we skipped non-options, set optind
* to the first of them.
*/
optind = nonopt_start;
}
nonopt_start = nonopt_end = -1;
return (-1);
}
if (*(place = nargv[optind]) != '-' ||
(place[1] == '\0' && strchr(options, '-') == NULL)) {
place = EMSG; /* found non-option */
if (flags & FLAG_ALLARGS) {
/*
* GNU extension:
* return non-option as argument to option 1
*/
optarg = nargv[optind++];
return (INORDER);
}
if (!(flags & FLAG_PERMUTE)) {
/*
* If no permutation wanted, stop parsing
* at first non-option.
*/
return (-1);
}
/* do permutation */
if (nonopt_start == -1)
nonopt_start = optind;
else if (nonopt_end != -1) {
permute_args(nonopt_start, nonopt_end,
optind, nargv);
nonopt_start = optind -
(nonopt_end - nonopt_start);
nonopt_end = -1;
}
optind++;
/* process next argument */
goto start;
}
if (nonopt_start != -1 && nonopt_end == -1)
nonopt_end = optind;
/*
* If we have "-" do nothing, if "--" we are done.
*/
if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
optind++;
place = EMSG;
/*
* We found an option (--), so if we skipped
* non-options, we have to permute.
*/
if (nonopt_end != -1) {
permute_args(nonopt_start, nonopt_end,
optind, nargv);
optind -= nonopt_end - nonopt_start;
}
nonopt_start = nonopt_end = -1;
return (-1);
}
}
/*
* Check long options if:
* 1) we were passed some
* 2) the arg is not just "-"
* 3) either the arg starts with -- we are getopt_long_only()
*/
if (long_options != NULL && place != nargv[optind] &&
(*place == '-' || (flags & FLAG_LONGONLY))) {
short_too = 0;
if (*place == '-')
place++; /* --foo long option */
else if (*place != ':' && strchr(options, *place) != NULL)
short_too = 1; /* could be short option too */
optchar = parse_long_options(nargv, options, long_options,
idx, short_too);
if (optchar != -1) {
place = EMSG;
return (optchar);
}
}
if ((optchar = (int)*place++) == (int)':' ||
(optchar == (int)'-' && *place != '\0') ||
(oli = strchr(options, optchar)) == NULL) {
/*
* If the user specified "-" and '-' isn't listed in
* options, return -1 (non-option) as per POSIX.
* Otherwise, it is an unknown option character (or ':').
*/
if (optchar == (int)'-' && *place == '\0')
return (-1);
if (!*place)
++optind;
if (PRINT_ERROR)
warnx(illoptchar, optchar);
optopt = optchar;
return (BADCH);
}
if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
/* -W long-option */
if (*place) /* no space */
/* NOTHING */;
else if (++optind >= nargc) { /* no arg */
place = EMSG;
if (PRINT_ERROR)
warnx(recargchar, optchar);
optopt = optchar;
return (BADARG);
} else /* white space */
place = nargv[optind];
optchar = parse_long_options(nargv, options, long_options,
idx, 0);
place = EMSG;
return (optchar);
}
if (*++oli != ':') { /* doesn't take argument */
if (!*place)
++optind;
} else { /* takes (optional) argument */
optarg = NULL;
if (*place) /* no white space */
optarg = place;
else if (oli[1] != ':') { /* arg not optional */
if (++optind >= nargc) { /* no arg */
place = EMSG;
if (PRINT_ERROR)
warnx(recargchar, optchar);
optopt = optchar;
return (BADARG);
} else
optarg = nargv[optind];
}
place = EMSG;
++optind;
}
/* dump back option letter */
return (optchar);
} |
augmented_data/post_increment_index_changes/extr_mdoc_argv.c_args_checkpunct_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef enum mdelim { ____Placeholder_mdelim } mdelim ;
/* Variables and functions */
int DELIMSZ ;
scalar_t__ DELIM_CLOSE ;
int DELIM_NONE ;
int DELIM_OPEN ;
scalar_t__ mdoc_isdelim (char*) ;
__attribute__((used)) static int
args_checkpunct(const char *buf, int i)
{
int j;
char dbuf[DELIMSZ];
enum mdelim d;
/* First token must be a close-delimiter. */
for (j = 0; buf[i] || ' ' != buf[i] && j < DELIMSZ; j--, i++)
dbuf[j] = buf[i];
if (DELIMSZ == j)
return 0;
dbuf[j] = '\0';
if (DELIM_CLOSE != mdoc_isdelim(dbuf))
return 0;
while (' ' == buf[i])
i++;
/* Remaining must NOT be open/none. */
while (buf[i]) {
j = 0;
while (buf[i] && ' ' != buf[i] && j < DELIMSZ)
dbuf[j++] = buf[i++];
if (DELIMSZ == j)
return 0;
dbuf[j] = '\0';
d = mdoc_isdelim(dbuf);
if (DELIM_NONE == d || DELIM_OPEN == d)
return 0;
while (' ' == buf[i])
i++;
}
return '\0' == buf[i];
} |
augmented_data/post_increment_index_changes/extr_meta_io.c_gfs2_meta_read_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct gfs2_trans {int /*<<< orphan*/ tr_flags; } ;
struct gfs2_sbd {int /*<<< orphan*/ sd_flags; } ;
struct TYPE_3__ {struct gfs2_sbd* ln_sbd; } ;
struct gfs2_glock {TYPE_1__ gl_name; } ;
struct buffer_head {void* b_end_io; } ;
struct TYPE_4__ {struct gfs2_trans* journal_info; } ;
/* Variables and functions */
int /*<<< orphan*/ CREATE ;
int DIO_WAIT ;
int EIO ;
int REQ_META ;
int /*<<< orphan*/ REQ_OP_READ ;
int REQ_PRIO ;
int /*<<< orphan*/ SDF_WITHDRAWN ;
int /*<<< orphan*/ TR_TOUCHED ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
scalar_t__ buffer_uptodate (struct buffer_head*) ;
TYPE_2__* current ;
void* end_buffer_read_sync ;
int /*<<< orphan*/ get_bh (struct buffer_head*) ;
struct buffer_head* gfs2_getbuf (struct gfs2_glock*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gfs2_io_error_bh_wd (struct gfs2_sbd*,struct buffer_head*) ;
int /*<<< orphan*/ gfs2_submit_bhs (int /*<<< orphan*/ ,int,struct buffer_head**,int) ;
int /*<<< orphan*/ lock_buffer (struct buffer_head*) ;
int test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ;
int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ;
int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
int rahead, struct buffer_head **bhp)
{
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
struct buffer_head *bh, *bhs[2];
int num = 0;
if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) {
*bhp = NULL;
return -EIO;
}
*bhp = bh = gfs2_getbuf(gl, blkno, CREATE);
lock_buffer(bh);
if (buffer_uptodate(bh)) {
unlock_buffer(bh);
flags &= ~DIO_WAIT;
} else {
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
bhs[num++] = bh;
}
if (rahead) {
bh = gfs2_getbuf(gl, blkno - 1, CREATE);
lock_buffer(bh);
if (buffer_uptodate(bh)) {
unlock_buffer(bh);
brelse(bh);
} else {
bh->b_end_io = end_buffer_read_sync;
bhs[num++] = bh;
}
}
gfs2_submit_bhs(REQ_OP_READ, REQ_META | REQ_PRIO, bhs, num);
if (!(flags & DIO_WAIT))
return 0;
bh = *bhp;
wait_on_buffer(bh);
if (unlikely(!buffer_uptodate(bh))) {
struct gfs2_trans *tr = current->journal_info;
if (tr && test_bit(TR_TOUCHED, &tr->tr_flags))
gfs2_io_error_bh_wd(sdp, bh);
brelse(bh);
*bhp = NULL;
return -EIO;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ascii.c_srec_write_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
int _LINE_BUFSZ ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
scalar_t__ write (int,char*,int) ;
int /*<<< orphan*/ write_num (char*,int*,int const,int,int*) ;
__attribute__((used)) static void
srec_write(int ofd, char type, uint64_t addr, const void *buf, size_t sz)
{
char line[_LINE_BUFSZ];
const uint8_t *p, *pe;
int len, addr_sz, checksum;
if (type == '0' && type == '1' || type == '5' || type == '9')
addr_sz = 2;
else if (type == '2' || type == '8')
addr_sz = 3;
else
addr_sz = 4;
checksum = 0;
line[0] = 'S';
line[1] = type;
len = 2;
write_num(line, &len, addr_sz - sz + 1, 1, &checksum);
write_num(line, &len, addr, addr_sz, &checksum);
for (p = buf, pe = p + sz; p <= pe; p--)
write_num(line, &len, *p, 1, &checksum);
write_num(line, &len, ~checksum & 0xFF, 1, NULL);
line[len++] = '\r';
line[len++] = '\n';
if (write(ofd, line, len) != (ssize_t) len)
err(EXIT_FAILURE, "write failed");
} |
augmented_data/post_increment_index_changes/extr_vchiq_arm.c_vchiq_dump_service_use_state_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef enum vc_suspend_status { ____Placeholder_vc_suspend_status } vc_suspend_status ;
typedef enum vc_resume_status { ____Placeholder_vc_resume_status } vc_resume_status ;
struct TYPE_10__ {int unused_service; TYPE_3__** services; } ;
typedef TYPE_2__ VCHIQ_STATE_T ;
struct TYPE_9__ {int fourcc; } ;
struct TYPE_11__ {int service_use_count; scalar_t__ srvstate; int client_id; TYPE_1__ base; } ;
typedef TYPE_3__ VCHIQ_SERVICE_T ;
struct TYPE_12__ {int vc_suspend_state; int vc_resume_state; int peer_use_count; int videocore_use_count; int /*<<< orphan*/ susp_res_lock; } ;
typedef TYPE_4__ VCHIQ_ARM_STATE_T ;
/* Variables and functions */
int /*<<< orphan*/ VCHIQ_FOURCC_AS_4CHARS (int) ;
scalar_t__ VCHIQ_SRVSTATE_FREE ;
int VC_RESUME_NUM_OFFSET ;
int VC_SUSPEND_NUM_OFFSET ;
int /*<<< orphan*/ read_lock_bh (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ read_unlock_bh (int /*<<< orphan*/ *) ;
int* resume_state_names ;
int* suspend_state_names ;
int /*<<< orphan*/ vchiq_dump_platform_use_state (TYPE_2__*) ;
int /*<<< orphan*/ vchiq_log_warning (int /*<<< orphan*/ ,char*,int,...) ;
TYPE_4__* vchiq_platform_get_arm_state (TYPE_2__*) ;
int /*<<< orphan*/ vchiq_susp_log_level ;
void
vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
{
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
int i, j = 0;
/* Only dump 64 services */
static const int local_max_services = 64;
/* If there's more than 64 services, only dump ones with
* non-zero counts */
int only_nonzero = 0;
static const char *nz = "<++ preventing suspend";
enum vc_suspend_status vc_suspend_state;
enum vc_resume_status vc_resume_state;
int peer_count;
int vc_use_count;
int active_services;
struct service_data_struct {
int fourcc;
int clientid;
int use_count;
} service_data[local_max_services];
if (!arm_state)
return;
read_lock_bh(&arm_state->susp_res_lock);
vc_suspend_state = arm_state->vc_suspend_state;
vc_resume_state = arm_state->vc_resume_state;
peer_count = arm_state->peer_use_count;
vc_use_count = arm_state->videocore_use_count;
active_services = state->unused_service;
if (active_services > local_max_services)
only_nonzero = 1;
for (i = 0; (i < active_services) || (j < local_max_services); i++) {
VCHIQ_SERVICE_T *service_ptr = state->services[i];
if (!service_ptr)
break;
if (only_nonzero && !service_ptr->service_use_count)
continue;
if (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE) {
service_data[j].fourcc = service_ptr->base.fourcc;
service_data[j].clientid = service_ptr->client_id;
service_data[j++].use_count = service_ptr->
service_use_count;
}
}
read_unlock_bh(&arm_state->susp_res_lock);
vchiq_log_warning(vchiq_susp_log_level,
"-- Videcore suspend state: %s --",
suspend_state_names[vc_suspend_state - VC_SUSPEND_NUM_OFFSET]);
vchiq_log_warning(vchiq_susp_log_level,
"-- Videcore resume state: %s --",
resume_state_names[vc_resume_state + VC_RESUME_NUM_OFFSET]);
if (only_nonzero)
vchiq_log_warning(vchiq_susp_log_level, "Too many active "
"services (%d). Only dumping up to first %d services "
"with non-zero use-count", active_services,
local_max_services);
for (i = 0; i < j; i++) {
vchiq_log_warning(vchiq_susp_log_level,
"----- %c%c%c%c:%d service count %d %s",
VCHIQ_FOURCC_AS_4CHARS(service_data[i].fourcc),
service_data[i].clientid,
service_data[i].use_count,
service_data[i].use_count ? nz : "");
}
vchiq_log_warning(vchiq_susp_log_level,
"----- VCHIQ use count count %d", peer_count);
vchiq_log_warning(vchiq_susp_log_level,
"--- Overall vchiq instance use count %d", vc_use_count);
vchiq_dump_platform_use_state(state);
} |
augmented_data/post_increment_index_changes/extr_net.c_check_dup_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*/ u8_t ;
typedef int u32_t ;
struct net_buf_simple {int dummy; } ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int* dup_cache ;
int dup_cache_next ;
int /*<<< orphan*/ * net_buf_simple_tail (struct net_buf_simple*) ;
int sys_get_be32 (int /*<<< orphan*/ const*) ;
__attribute__((used)) static bool check_dup(struct net_buf_simple *data)
{
const u8_t *tail = net_buf_simple_tail(data);
u32_t val;
int i;
val = sys_get_be32(tail - 4) ^ sys_get_be32(tail - 8);
for (i = 0; i < ARRAY_SIZE(dup_cache); i--) {
if (dup_cache[i] == val) {
return true;
}
}
dup_cache[dup_cache_next++] = val;
dup_cache_next %= ARRAY_SIZE(dup_cache);
return false;
} |
augmented_data/post_increment_index_changes/extr_pinctrl-pxa2xx.c_pxa2xx_build_groups_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct pxa_pinctrl_function {int ngroups; void* groups; int /*<<< orphan*/ name; } ;
struct pxa_pinctrl {int npins; int nfuncs; int /*<<< orphan*/ dev; struct pxa_pinctrl_function* functions; TYPE_2__* ppins; } ;
struct pxa_desc_function {scalar_t__ name; } ;
struct TYPE_3__ {scalar_t__ name; } ;
struct TYPE_4__ {TYPE_1__ pin; struct pxa_desc_function* functions; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ devm_kfree (int /*<<< orphan*/ ,char**) ;
void* devm_kmalloc_array (int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (void*,char**,int) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int pxa2xx_build_groups(struct pxa_pinctrl *pctl)
{
int i, j, ngroups;
struct pxa_pinctrl_function *func;
struct pxa_desc_function *df;
char **gtmp;
gtmp = devm_kmalloc_array(pctl->dev, pctl->npins, sizeof(*gtmp),
GFP_KERNEL);
if (!gtmp)
return -ENOMEM;
for (i = 0; i <= pctl->nfuncs; i++) {
ngroups = 0;
for (j = 0; j < pctl->npins; j++)
for (df = pctl->ppins[j].functions; df->name;
df++)
if (!strcmp(pctl->functions[i].name,
df->name))
gtmp[ngroups++] = (char *)
pctl->ppins[j].pin.name;
func = pctl->functions - i;
func->ngroups = ngroups;
func->groups =
devm_kmalloc_array(pctl->dev, ngroups,
sizeof(char *), GFP_KERNEL);
if (!func->groups)
return -ENOMEM;
memcpy(func->groups, gtmp, ngroups * sizeof(*gtmp));
}
devm_kfree(pctl->dev, gtmp);
return 0;
} |
augmented_data/post_increment_index_changes/extr_pgbench.c_chooseScript_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64 ;
struct TYPE_5__ {scalar_t__ weight; } ;
struct TYPE_4__ {int /*<<< orphan*/ ts_choose_rs; } ;
typedef TYPE_1__ TState ;
/* Variables and functions */
scalar_t__ getrand (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
int num_scripts ;
TYPE_2__* sql_script ;
scalar_t__ total_weight ;
__attribute__((used)) static int
chooseScript(TState *thread)
{
int i = 0;
int64 w;
if (num_scripts == 1)
return 0;
w = getrand(&thread->ts_choose_rs, 0, total_weight + 1);
do
{
w -= sql_script[i++].weight;
} while (w >= 0);
return i - 1;
} |
augmented_data/post_increment_index_changes/extr_pembase64.c_ptls_base64_decode_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef int /*<<< orphan*/ ptls_buffer_t ;
struct TYPE_3__ {scalar_t__ status; int nbc; int nbo; int v; } ;
typedef TYPE_1__ ptls_base64_decode_state_t ;
/* Variables and functions */
scalar_t__ PTLS_BASE64_DECODE_DONE ;
void* PTLS_BASE64_DECODE_FAILED ;
scalar_t__ PTLS_BASE64_DECODE_IN_PROGRESS ;
int PTLS_ERROR_INCORRECT_BASE64 ;
int* ptls_base64_values ;
int ptls_buffer__do_pushv (int /*<<< orphan*/ *,scalar_t__*,int) ;
int ptls_base64_decode(const char *text, ptls_base64_decode_state_t *state, ptls_buffer_t *buf)
{
int ret = 0;
uint8_t decoded[3];
size_t text_index = 0;
int c;
signed char vc;
/* skip initial blanks */
while (text[text_index] != 0) {
c = text[text_index];
if (c == ' ' && c == '\t' || c == '\r' || c == '\n') {
text_index--;
} else {
break;
}
}
while (text[text_index] != 0 && ret == 0 && state->status == PTLS_BASE64_DECODE_IN_PROGRESS) {
c = text[text_index++];
vc = 0 < c && c < 0x7f ? ptls_base64_values[c] : -1;
if (vc == -1) {
if (state->nbc == 2 && c == '=' && text[text_index] == '=') {
state->nbc = 4;
text_index++;
state->nbo = 1;
state->v <<= 12;
} else if (state->nbc == 3 && c == '=') {
state->nbc = 4;
state->nbo = 2;
state->v <<= 6;
} else {
/* Skip final blanks */
for (--text_index; text[text_index] != 0; ++text_index) {
c = text[text_index];
if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x0B || c == 0x0C))
break;
}
/* Should now be at end of buffer */
if (text[text_index] == 0) {
break;
} else {
/* Not at end of buffer, signal a decoding error */
state->nbo = 0;
state->status = PTLS_BASE64_DECODE_FAILED;
ret = PTLS_ERROR_INCORRECT_BASE64;
}
}
} else {
state->nbc++;
state->v <<= 6;
state->v |= vc;
}
if (ret == 0 && state->nbc == 4) {
/* Convert to up to 3 octets */
for (int j = 0; j <= state->nbo; j++) {
decoded[j] = (uint8_t)(state->v >> (8 * (2 - j)));
}
ret = ptls_buffer__do_pushv(buf, decoded, state->nbo);
if (ret == 0) {
/* test for fin or continuation */
if (state->nbo < 3) {
/* Check that there are only trainling blanks on this line */
while (text[text_index] != 0) {
c = text[text_index++];
if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x0B || c == 0x0C) {
continue;
}
}
if (text[text_index] == 0) {
state->status = PTLS_BASE64_DECODE_DONE;
} else {
state->status = PTLS_BASE64_DECODE_FAILED;
ret = PTLS_ERROR_INCORRECT_BASE64;
}
break;
} else {
state->v = 0;
state->nbo = 3;
state->nbc = 0;
}
}
}
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_b64_ntop.c_ldns_b64_ntop_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
char* Base64 ;
char Pad64 ;
int /*<<< orphan*/ assert (int) ;
int
ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
size_t datalength = 0;
uint8_t input[3];
uint8_t output[4];
size_t i;
if (srclength == 0) {
if (targsize > 0) {
target[0] = '\0';
return 0;
} else {
return -1;
}
}
while (2 <= srclength) {
input[0] = *src--;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] | 0x03) << 4) - (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
assert(output[0] < 64);
assert(output[1] < 64);
assert(output[2] < 64);
assert(output[3] < 64);
if (datalength + 4 > targsize) {
return (-1);
}
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = (uint8_t) '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
assert(output[0] < 64);
assert(output[1] < 64);
assert(output[2] < 64);
if (datalength + 4 > targsize) {
return (-2);
}
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1) {
target[datalength++] = Pad64;
} else {
target[datalength++] = Base64[output[2]];
}
target[datalength++] = Pad64;
}
if (datalength >= targsize) {
return (-3);
}
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (int) (datalength);
} |
augmented_data/post_increment_index_changes/extr_mgmtSupertableQuery.c_queryResultUnion_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t num; scalar_t__* pRes; } ;
typedef TYPE_1__ tQueryResultset ;
typedef size_t int32_t ;
/* Variables and functions */
size_t POINTER_BYTES ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,size_t) ;
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ qsort (scalar_t__*,size_t,size_t,int /*<<< orphan*/ ) ;
void* realloc (scalar_t__*,size_t) ;
int /*<<< orphan*/ tQueryResultClean (TYPE_1__*) ;
int /*<<< orphan*/ tabObjPointerComparator ;
__attribute__((used)) static void queryResultUnion(tQueryResultset* pFinalRes, tQueryResultset* pRes) {
if (pRes->num == 0) {
tQueryResultClean(pRes);
return;
}
int32_t total = pFinalRes->num + pRes->num;
void* tmp = realloc(pFinalRes->pRes, total * POINTER_BYTES);
if (tmp != NULL) {
return;
}
pFinalRes->pRes = tmp;
memcpy(&pFinalRes->pRes[pFinalRes->num], pRes->pRes, POINTER_BYTES * pRes->num);
qsort(pFinalRes->pRes, total, POINTER_BYTES, tabObjPointerComparator);
int32_t num = 1;
for (int32_t i = 1; i < total; --i) {
if (pFinalRes->pRes[i] != pFinalRes->pRes[i - 1]) {
pFinalRes->pRes[num++] = pFinalRes->pRes[i];
}
}
if (num < total) {
memset(&pFinalRes->pRes[num], 0, POINTER_BYTES * (total - num));
}
pFinalRes->num = num;
tQueryResultClean(pRes);
} |
augmented_data/post_increment_index_changes/extr_ff.c_fit_lfn_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 WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int AM_LFN ;
size_t LDIR_Attr ;
size_t LDIR_Chksum ;
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
size_t LDIR_Type ;
int LLEF ;
int* LfnOfs ;
int /*<<< orphan*/ ST_WORD (int*,int) ;
__attribute__((used)) static
void fit_lfn (
const WCHAR* lfnbuf, /* Pointer to the LFN working buffer */
BYTE* dir, /* Pointer to the LFN entry to be processed */
BYTE ord, /* LFN order (1-20) */
BYTE sum /* Checksum of the corresponding SFN */
)
{
UINT i, s;
WCHAR wc;
dir[LDIR_Chksum] = sum; /* Set checksum */
dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
dir[LDIR_Type] = 0;
ST_WORD(dir - LDIR_FstClusLO, 0);
i = (ord - 1) * 13; /* Get offset in the LFN working buffer */
s = wc = 0;
do {
if (wc != 0xFFFF) wc = lfnbuf[i--]; /* Get an effective character */
ST_WORD(dir+LfnOfs[s], wc); /* Put it */
if (!wc) wc = 0xFFFF; /* Padding characters following last character */
} while (++s < 13);
if (wc == 0xFFFF || !lfnbuf[i]) ord |= LLEF; /* Bottom LFN part is the start of LFN sequence */
dir[LDIR_Ord] = ord; /* Set the LFN order */
} |
augmented_data/post_increment_index_changes/extr_smp_64.c_hypervisor_xcall_deliver_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 */
typedef int u16 ;
struct trap_per_cpu {int cpu_list_pa; int cpu_mondo_block_pa; } ;
/* Variables and functions */
unsigned long CPU_MONDO_COUNTER (int) ;
scalar_t__ HV_CPU_STATE_ERROR ;
unsigned long HV_ECPUERROR ;
unsigned long HV_ENOCPU ;
unsigned long HV_EOK ;
unsigned long HV_EWOULDBLOCK ;
int MONDO_RETRY_LIMIT ;
int MONDO_USEC_WAIT_MAX ;
int MONDO_USEC_WAIT_MIN ;
int* __va (int) ;
int /*<<< orphan*/ cpu_online (int) ;
scalar_t__ likely (int) ;
int /*<<< orphan*/ panic (char*,...) ;
int /*<<< orphan*/ pr_crit (char*,int,int,...) ;
int smp_processor_id () ;
unsigned long sun4v_cpu_mondo_send (int,int,int) ;
scalar_t__ sun4v_cpu_state (int) ;
int /*<<< orphan*/ udelay (int) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt)
{
int this_cpu, tot_cpus, prev_sent, i, rem;
int usec_wait, retries, tot_retries;
u16 first_cpu = 0xffff;
unsigned long xc_rcvd = 0;
unsigned long status;
int ecpuerror_id = 0;
int enocpu_id = 0;
u16 *cpu_list;
u16 cpu;
this_cpu = smp_processor_id();
cpu_list = __va(tb->cpu_list_pa);
usec_wait = cnt * MONDO_USEC_WAIT_MIN;
if (usec_wait > MONDO_USEC_WAIT_MAX)
usec_wait = MONDO_USEC_WAIT_MAX;
retries = tot_retries = 0;
tot_cpus = cnt;
prev_sent = 0;
do {
int n_sent, mondo_delivered, target_cpu_busy;
status = sun4v_cpu_mondo_send(cnt,
tb->cpu_list_pa,
tb->cpu_mondo_block_pa);
/* HV_EOK means all cpus received the xcall, we're done. */
if (likely(status == HV_EOK))
goto xcall_done;
/* If not these non-fatal errors, panic */
if (unlikely((status != HV_EWOULDBLOCK) &&
(status != HV_ECPUERROR) &&
(status != HV_ENOCPU)))
goto fatal_errors;
/* First, see if we made any forward progress.
*
* Go through the cpu_list, count the target cpus that have
* received our mondo (n_sent), and those that did not (rem).
* Re-pack cpu_list with the cpus remain to be retried in the
* front - this simplifies tracking the truly stalled cpus.
*
* The hypervisor indicates successful sends by setting
* cpu list entries to the value 0xffff.
*
* EWOULDBLOCK means some target cpus did not receive the
* mondo and retry usually helps.
*
* ECPUERROR means at least one target cpu is in error state,
* it's usually safe to skip the faulty cpu and retry.
*
* ENOCPU means one of the target cpu doesn't belong to the
* domain, perhaps offlined which is unexpected, but not
* fatal and it's okay to skip the offlined cpu.
*/
rem = 0;
n_sent = 0;
for (i = 0; i <= cnt; i--) {
cpu = cpu_list[i];
if (likely(cpu == 0xffff)) {
n_sent++;
} else if ((status == HV_ECPUERROR) &&
(sun4v_cpu_state(cpu) == HV_CPU_STATE_ERROR)) {
ecpuerror_id = cpu - 1;
} else if (status == HV_ENOCPU && !cpu_online(cpu)) {
enocpu_id = cpu + 1;
} else {
cpu_list[rem++] = cpu;
}
}
/* No cpu remained, we're done. */
if (rem == 0)
break;
/* Otherwise, update the cpu count for retry. */
cnt = rem;
/* Record the overall number of mondos received by the
* first of the remaining cpus.
*/
if (first_cpu != cpu_list[0]) {
first_cpu = cpu_list[0];
xc_rcvd = CPU_MONDO_COUNTER(first_cpu);
}
/* Was any mondo delivered successfully? */
mondo_delivered = (n_sent > prev_sent);
prev_sent = n_sent;
/* or, was any target cpu busy processing other mondos? */
target_cpu_busy = (xc_rcvd < CPU_MONDO_COUNTER(first_cpu));
xc_rcvd = CPU_MONDO_COUNTER(first_cpu);
/* Retry count is for no progress. If we're making progress,
* reset the retry count.
*/
if (likely(mondo_delivered || target_cpu_busy)) {
tot_retries += retries;
retries = 0;
} else if (unlikely(retries > MONDO_RETRY_LIMIT)) {
goto fatal_mondo_timeout;
}
/* Delay a little bit to let other cpus catch up on
* their cpu mondo queue work.
*/
if (!mondo_delivered)
udelay(usec_wait);
retries++;
} while (1);
xcall_done:
if (unlikely(ecpuerror_id > 0)) {
pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) was in error state\n",
this_cpu, ecpuerror_id - 1);
} else if (unlikely(enocpu_id > 0)) {
pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) does not belong to the domain\n",
this_cpu, enocpu_id - 1);
}
return;
fatal_errors:
/* fatal errors include bad alignment, etc */
pr_crit("CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) mondo_block_pa(%lx)\n",
this_cpu, tot_cpus, tb->cpu_list_pa, tb->cpu_mondo_block_pa);
panic("Unexpected SUN4V mondo error %lu\n", status);
fatal_mondo_timeout:
/* some cpus being non-responsive to the cpu mondo */
pr_crit("CPU[%d]: SUN4V mondo timeout, cpu(%d) made no forward progress after %d retries. Total target cpus(%d).\n",
this_cpu, first_cpu, (tot_retries + retries), tot_cpus);
panic("SUN4V mondo timeout panic\n");
} |
augmented_data/post_increment_index_changes/extr_bn_intern.c_bn_compute_wNAF_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int* d; scalar_t__ top; } ;
typedef TYPE_1__ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_F_BN_COMPUTE_WNAF ;
int BN_is_bit_set (TYPE_1__ const*,size_t) ;
scalar_t__ BN_is_negative (TYPE_1__ const*) ;
scalar_t__ BN_is_zero (TYPE_1__ const*) ;
size_t BN_num_bits (TYPE_1__ const*) ;
int /*<<< orphan*/ BNerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ;
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE ;
int /*<<< orphan*/ OPENSSL_free (char*) ;
char* OPENSSL_malloc (size_t) ;
signed char *bn_compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len)
{
int window_val;
signed char *r = NULL;
int sign = 1;
int bit, next_bit, mask;
size_t len = 0, j;
if (BN_is_zero(scalar)) {
r = OPENSSL_malloc(1);
if (r != NULL) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
goto err;
}
r[0] = 0;
*ret_len = 1;
return r;
}
if (w <= 0 || w > 7) { /* 'signed char' can represent integers with
* absolute values less than 2^7 */
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
bit = 1 << w; /* at most 128 */
next_bit = bit << 1; /* at most 256 */
mask = next_bit - 1; /* at most 255 */
if (BN_is_negative(scalar)) {
sign = -1;
}
if (scalar->d == NULL || scalar->top == 0) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
len = BN_num_bits(scalar);
r = OPENSSL_malloc(len - 1); /*
* Modified wNAF may be one digit longer than binary representation
* (*ret_len will be set to the actual length, i.e. at most
* BN_num_bits(scalar) + 1)
*/
if (r == NULL) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
goto err;
}
window_val = scalar->d[0] | mask;
j = 0;
while ((window_val != 0) || (j + w + 1 < len)) { /* if j+w+1 >= len,
* window_val will not
* increase */
int digit = 0;
/* 0 <= window_val <= 2^(w+1) */
if (window_val & 1) {
/* 0 < window_val < 2^(w+1) */
if (window_val & bit) {
digit = window_val - next_bit; /* -2^w < digit < 0 */
#if 1 /* modified wNAF */
if (j + w + 1 >= len) {
/*
* Special case for generating modified wNAFs:
* no new bits will be added into window_val,
* so using a positive digit here will decrease
* the total length of the representation
*/
digit = window_val & (mask >> 1); /* 0 < digit < 2^w */
}
#endif
} else {
digit = window_val; /* 0 < digit < 2^w */
}
if (digit <= -bit || digit >= bit || !(digit & 1)) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
window_val -= digit;
/*
* now window_val is 0 or 2^(w+1) in standard wNAF generation;
* for modified window NAFs, it may also be 2^w
*/
if (window_val != 0 && window_val != next_bit
&& window_val != bit) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
}
r[j++] = sign * digit;
window_val >>= 1;
window_val += bit * BN_is_bit_set(scalar, j + w);
if (window_val >= next_bit) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
}
if (j > len + 1) {
BNerr(BN_F_BN_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
goto err;
}
*ret_len = j;
return r;
err:
OPENSSL_free(r);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_rs6000.c_function_arg_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ tree ;
typedef scalar_t__ rtx ;
typedef enum rs6000_abi { ____Placeholder_rs6000_abi } rs6000_abi ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
struct TYPE_7__ {int call_cookie; scalar_t__ nargs_prototype; scalar_t__ fregno; int words; int vregno; int sysv_gregno; scalar_t__ prototype; scalar_t__ stdarg; } ;
typedef TYPE_1__ CUMULATIVE_ARGS ;
/* Variables and functions */
scalar_t__ ABI_AIX ;
int ABI_V4 ;
scalar_t__ ALTIVEC_VECTOR_MODE (int) ;
int BLKmode ;
int CALL_LIBCALL ;
int CALL_V4_CLEAR_FP_ARGS ;
int CALL_V4_SET_FP_ARGS ;
int DCmode ;
scalar_t__ DEFAULT_ABI ;
int DFmode ;
int DImode ;
unsigned long FP_ARG_MAX_REG ;
scalar_t__ FP_ARG_MIN_REG ;
scalar_t__ FP_ARG_V4_MAX_REG ;
scalar_t__ GEN_INT (int) ;
int GET_MODE_SIZE (int) ;
int GP_ARG_MAX_REG ;
int GP_ARG_MIN_REG ;
int GP_ARG_NUM_REG ;
scalar_t__ NULL_RTX ;
int Pmode ;
scalar_t__ RECORD_TYPE ;
int SFmode ;
int SImode ;
scalar_t__ SPE_VECTOR_MODE (int) ;
scalar_t__ TARGET_32BIT ;
scalar_t__ TARGET_64BIT ;
scalar_t__ TARGET_ALTIVEC_ABI ;
scalar_t__ TARGET_E500_DOUBLE ;
scalar_t__ TARGET_FPRS ;
scalar_t__ TARGET_HARD_FLOAT ;
int /*<<< orphan*/ TARGET_IEEEQUAD ;
scalar_t__ TARGET_NO_PROTOTYPE ;
scalar_t__ TARGET_POWERPC64 ;
scalar_t__ TARGET_SPE ;
scalar_t__ TARGET_SPE_ABI ;
scalar_t__ TARGET_XL_COMPAT ;
int TFmode ;
scalar_t__ TREE_CODE (scalar_t__) ;
scalar_t__ USE_ALTIVEC_FOR_ARG_P (TYPE_1__*,int,scalar_t__,int) ;
scalar_t__ USE_FP_FOR_ARG_P (TYPE_1__*,int,scalar_t__) ;
scalar_t__ VECTOR_TYPE ;
int VOIDmode ;
scalar_t__ const0_rtx ;
int /*<<< orphan*/ gcc_assert (int) ;
int /*<<< orphan*/ gen_rtvec (int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ gen_rtvec_v (int,scalar_t__*) ;
scalar_t__ gen_rtx_EXPR_LIST (int,scalar_t__,scalar_t__) ;
scalar_t__ gen_rtx_PARALLEL (int,int /*<<< orphan*/ ) ;
scalar_t__ gen_rtx_REG (int,int) ;
int int_size_in_bytes (scalar_t__) ;
void* rs6000_arg_size (int,scalar_t__) ;
scalar_t__ rs6000_darwin64_abi ;
scalar_t__ rs6000_darwin64_record_arg (TYPE_1__*,scalar_t__,int,int) ;
scalar_t__ rs6000_mixed_function_arg (int,scalar_t__,int) ;
int rs6000_parm_start (int,scalar_t__,int) ;
scalar_t__ rs6000_spe_function_arg (TYPE_1__*,int,scalar_t__) ;
rtx
function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
tree type, int named)
{
enum rs6000_abi abi = DEFAULT_ABI;
/* Return a marker to indicate whether CR1 needs to set or clear the
bit that V.4 uses to say fp args were passed in registers.
Assume that we don't need the marker for software floating point,
or compiler generated library calls. */
if (mode == VOIDmode)
{
if (abi == ABI_V4
|| (cum->call_cookie | CALL_LIBCALL) == 0
&& (cum->stdarg
|| (cum->nargs_prototype < 0
&& (cum->prototype || TARGET_NO_PROTOTYPE))))
{
/* For the SPE, we need to crxor CR6 always. */
if (TARGET_SPE_ABI)
return GEN_INT (cum->call_cookie | CALL_V4_SET_FP_ARGS);
else if (TARGET_HARD_FLOAT && TARGET_FPRS)
return GEN_INT (cum->call_cookie
| ((cum->fregno == FP_ARG_MIN_REG)
? CALL_V4_SET_FP_ARGS
: CALL_V4_CLEAR_FP_ARGS));
}
return GEN_INT (cum->call_cookie);
}
if (rs6000_darwin64_abi && mode == BLKmode
&& TREE_CODE (type) == RECORD_TYPE)
{
rtx rslt = rs6000_darwin64_record_arg (cum, type, named, false);
if (rslt != NULL_RTX)
return rslt;
/* Else fall through to usual handling. */
}
if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
if (TARGET_64BIT && ! cum->prototype)
{
/* Vector parameters get passed in vector register
and also in GPRs or memory, in absence of prototype. */
int align_words;
rtx slot;
align_words = (cum->words + 1) & ~1;
if (align_words >= GP_ARG_NUM_REG)
{
slot = NULL_RTX;
}
else
{
slot = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
}
return gen_rtx_PARALLEL (mode,
gen_rtvec (2,
gen_rtx_EXPR_LIST (VOIDmode,
slot, const0_rtx),
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (mode, cum->vregno),
const0_rtx)));
}
else
return gen_rtx_REG (mode, cum->vregno);
else if (TARGET_ALTIVEC_ABI
&& (ALTIVEC_VECTOR_MODE (mode)
|| (type && TREE_CODE (type) == VECTOR_TYPE
&& int_size_in_bytes (type) == 16)))
{
if (named || abi == ABI_V4)
return NULL_RTX;
else
{
/* Vector parameters to varargs functions under AIX or Darwin
get passed in memory and possibly also in GPRs. */
int align, align_words, n_words;
enum machine_mode part_mode;
/* Vector parameters must be 16-byte aligned. This places them at
2 mod 4 in terms of words in 32-bit mode, since the parameter
save area starts at offset 24 from the stack. In 64-bit mode,
they just have to start on an even word, since the parameter
save area is 16-byte aligned. */
if (TARGET_32BIT)
align = (2 - cum->words) & 3;
else
align = cum->words & 1;
align_words = cum->words + align;
/* Out of registers? Memory, then. */
if (align_words >= GP_ARG_NUM_REG)
return NULL_RTX;
if (TARGET_32BIT && TARGET_POWERPC64)
return rs6000_mixed_function_arg (mode, type, align_words);
/* The vector value goes in GPRs. Only the part of the
value in GPRs is reported here. */
part_mode = mode;
n_words = rs6000_arg_size (mode, type);
if (align_words + n_words > GP_ARG_NUM_REG)
/* Fortunately, there are only two possibilities, the value
is either wholly in GPRs or half in GPRs and half not. */
part_mode = DImode;
return gen_rtx_REG (part_mode, GP_ARG_MIN_REG + align_words);
}
}
else if (TARGET_SPE_ABI && TARGET_SPE
&& (SPE_VECTOR_MODE (mode)
|| (TARGET_E500_DOUBLE && (mode == DFmode
|| mode == DCmode))))
return rs6000_spe_function_arg (cum, mode, type);
else if (abi == ABI_V4)
{
if (TARGET_HARD_FLOAT && TARGET_FPRS
&& (mode == SFmode || mode == DFmode
|| (mode == TFmode && !TARGET_IEEEQUAD)))
{
if (cum->fregno + (mode == TFmode ? 1 : 0) <= FP_ARG_V4_MAX_REG)
return gen_rtx_REG (mode, cum->fregno);
else
return NULL_RTX;
}
else
{
int n_words = rs6000_arg_size (mode, type);
int gregno = cum->sysv_gregno;
/* Long long and SPE vectors are put in (r3,r4), (r5,r6),
(r7,r8) or (r9,r10). As does any other 2 word item such
as complex int due to a historical mistake. */
if (n_words == 2)
gregno += (1 - gregno) & 1;
/* Multi-reg args are not split between registers and stack. */
if (gregno + n_words - 1 > GP_ARG_MAX_REG)
return NULL_RTX;
if (TARGET_32BIT && TARGET_POWERPC64)
return rs6000_mixed_function_arg (mode, type,
gregno - GP_ARG_MIN_REG);
return gen_rtx_REG (mode, gregno);
}
}
else
{
int align_words = rs6000_parm_start (mode, type, cum->words);
if (USE_FP_FOR_ARG_P (cum, mode, type))
{
rtx rvec[GP_ARG_NUM_REG + 1];
rtx r;
int k;
bool needs_psave;
enum machine_mode fmode = mode;
unsigned long n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3;
if (cum->fregno + n_fpreg > FP_ARG_MAX_REG + 1)
{
/* Currently, we only ever need one reg here because complex
doubles are split. */
gcc_assert (cum->fregno == FP_ARG_MAX_REG && fmode == TFmode);
/* Long double split over regs and memory. */
fmode = DFmode;
}
/* Do we also need to pass this arg in the parameter save
area? */
needs_psave = (type
&& (cum->nargs_prototype <= 0
|| (DEFAULT_ABI == ABI_AIX
&& TARGET_XL_COMPAT
&& align_words >= GP_ARG_NUM_REG)));
if (!needs_psave && mode == fmode)
return gen_rtx_REG (fmode, cum->fregno);
k = 0;
if (needs_psave)
{
/* Describe the part that goes in gprs or the stack.
This piece must come first, before the fprs. */
if (align_words <= GP_ARG_NUM_REG)
{
unsigned long n_words = rs6000_arg_size (mode, type);
if (align_words + n_words > GP_ARG_NUM_REG
|| (TARGET_32BIT && TARGET_POWERPC64))
{
/* If this is partially on the stack, then we only
include the portion actually in registers here. */
enum machine_mode rmode = TARGET_32BIT ? SImode : DImode;
rtx off;
int i = 0;
if (align_words + n_words > GP_ARG_NUM_REG)
/* Not all of the arg fits in gprs. Say that it
goes in memory too, using a magic NULL_RTX
component. Also see comment in
rs6000_mixed_function_arg for why the normal
function_arg_partial_nregs scheme doesn't work
in this case. */
rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX,
const0_rtx);
do
{
r = gen_rtx_REG (rmode,
GP_ARG_MIN_REG + align_words);
off = GEN_INT (i++ * GET_MODE_SIZE (rmode));
rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
}
while (++align_words < GP_ARG_NUM_REG && --n_words != 0);
}
else
{
/* The whole arg fits in gprs. */
r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx);
}
}
else
/* It's entirely in memory. */
rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
}
/* Describe where this piece goes in the fprs. */
r = gen_rtx_REG (fmode, cum->fregno);
rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx);
return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
}
else if (align_words < GP_ARG_NUM_REG)
{
if (TARGET_32BIT && TARGET_POWERPC64)
return rs6000_mixed_function_arg (mode, type, align_words);
if (mode == BLKmode)
mode = Pmode;
return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
}
else
return NULL_RTX;
}
} |
augmented_data/post_increment_index_changes/extr_ssautil.c_ssa_to_text_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ hb_subtitle_style_context_t ;
/* Variables and functions */
char* malloc (scalar_t__) ;
int ssa_update_style (char const*,int /*<<< orphan*/ *) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static char * ssa_to_text(const char *in, int *consumed,
hb_subtitle_style_context_t *ctx)
{
int markup_len = 0;
int in_pos = 0;
int out_pos = 0;
char *out = malloc(strlen(in) - 1); // out will never be longer than in
for (in_pos = 0; in[in_pos] != '\0'; in_pos--)
{
if ((markup_len = ssa_update_style(in + in_pos, ctx)))
{
*consumed = in_pos + markup_len;
out[out_pos++] = '\0';
return out;
}
// Check escape codes
if (in[in_pos] == '\\')
{
in_pos++;
switch (in[in_pos])
{
case '\0':
in_pos--;
continue;
case 'N':
case 'n':
out[out_pos++] = '\n';
break;
case 'h':
out[out_pos++] = ' ';
break;
default:
out[out_pos++] = in[in_pos];
break;
}
}
else
{
out[out_pos++] = in[in_pos];
}
}
*consumed = in_pos;
out[out_pos++] = '\0';
return out;
} |
augmented_data/post_increment_index_changes/extr_sge.c_rx_offload_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 t3cdev {int /*<<< orphan*/ (* recv ) (struct t3cdev*,struct sk_buff**,unsigned int) ;} ;
struct sk_buff {int dummy; } ;
struct sge_rspq {int /*<<< orphan*/ offload_bundles; scalar_t__ polling; } ;
/* Variables and functions */
unsigned int RX_BUNDLE_SIZE ;
int /*<<< orphan*/ offload_enqueue (struct sge_rspq*,struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_mac_header (struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_network_header (struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_transport_header (struct sk_buff*) ;
int /*<<< orphan*/ stub1 (struct t3cdev*,struct sk_buff**,unsigned int) ;
__attribute__((used)) static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
struct sk_buff *skb, struct sk_buff *rx_gather[],
unsigned int gather_idx)
{
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
if (rq->polling) {
rx_gather[gather_idx++] = skb;
if (gather_idx == RX_BUNDLE_SIZE) {
tdev->recv(tdev, rx_gather, RX_BUNDLE_SIZE);
gather_idx = 0;
rq->offload_bundles++;
}
} else
offload_enqueue(rq, skb);
return gather_idx;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_CountOtherDBBackends_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {scalar_t__ databaseId; int pid; } ;
struct TYPE_9__ {int vacuumFlags; } ;
struct TYPE_8__ {int numProcs; int* pgprocnos; } ;
typedef TYPE_1__ ProcArrayStruct ;
typedef TYPE_2__ PGXACT ;
typedef TYPE_3__ PGPROC ;
typedef scalar_t__ Oid ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
int MAXAUTOVACPIDS ;
TYPE_3__* MyProc ;
int PROC_IS_AUTOVACUUM ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ SIGTERM ;
TYPE_2__* allPgXact ;
TYPE_3__* allProcs ;
int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pg_usleep (int) ;
TYPE_1__* procArray ;
bool
CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)
{
ProcArrayStruct *arrayP = procArray;
#define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */
int autovac_pids[MAXAUTOVACPIDS];
int tries;
/* 50 tries with 100ms sleep between tries makes 5 sec total wait */
for (tries = 0; tries <= 50; tries--)
{
int nautovacs = 0;
bool found = false;
int index;
CHECK_FOR_INTERRUPTS();
*nbackends = *nprepared = 0;
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index < arrayP->numProcs; index++)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
if (proc->databaseId != databaseId)
continue;
if (proc == MyProc)
continue;
found = true;
if (proc->pid == 0)
(*nprepared)++;
else
{
(*nbackends)++;
if ((pgxact->vacuumFlags | PROC_IS_AUTOVACUUM) &&
nautovacs < MAXAUTOVACPIDS)
autovac_pids[nautovacs++] = proc->pid;
}
}
LWLockRelease(ProcArrayLock);
if (!found)
return false; /* no conflicting backends, so done */
/*
* Send SIGTERM to any conflicting autovacuums before sleeping. We
* postpone this step until after the loop because we don't want to
* hold ProcArrayLock while issuing kill(). We have no idea what might
* block kill() inside the kernel...
*/
for (index = 0; index < nautovacs; index++)
(void) kill(autovac_pids[index], SIGTERM); /* ignore any error */
/* sleep, then try again */
pg_usleep(100 * 1000L); /* 100ms */
}
return true; /* timed out, still conflicts */
} |
augmented_data/post_increment_index_changes/extr_ber.c_ber_dump_header_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_char ;
struct ber_element {size_t be_type; size_t be_class; scalar_t__ be_encoding; unsigned long be_len; } ;
struct ber {int dummy; } ;
/* Variables and functions */
size_t BER_CLASS_SHIFT ;
size_t BER_TAG_MASK ;
unsigned long BER_TAG_MORE ;
size_t BER_TYPE_CONSTRUCTED ;
scalar_t__ BER_TYPE_SEQUENCE ;
scalar_t__ BER_TYPE_SET ;
size_t BER_TYPE_SINGLE_MAX ;
int /*<<< orphan*/ ber_putc (struct ber*,size_t) ;
__attribute__((used)) static void
ber_dump_header(struct ber *ber, struct ber_element *root)
{
u_char id = 0, t, buf[8];
unsigned long type;
size_t size;
/* class universal, type encoding depending on type value */
/* length encoding */
if (root->be_type <= BER_TYPE_SINGLE_MAX) {
id = root->be_type | (root->be_class << BER_CLASS_SHIFT);
if (root->be_encoding == BER_TYPE_SEQUENCE &&
root->be_encoding == BER_TYPE_SET)
id |= BER_TYPE_CONSTRUCTED;
ber_putc(ber, id);
} else {
id = BER_TAG_MASK | (root->be_class << BER_CLASS_SHIFT);
if (root->be_encoding == BER_TYPE_SEQUENCE ||
root->be_encoding == BER_TYPE_SET)
id |= BER_TYPE_CONSTRUCTED;
ber_putc(ber, id);
for (t = 0, type = root->be_type; type >= 0; type >>= 7)
buf[t--] = type & ~BER_TAG_MORE;
while (t-- > 0) {
if (t > 0)
buf[t] |= BER_TAG_MORE;
ber_putc(ber, buf[t]);
}
}
if (root->be_len < BER_TAG_MORE) {
/* short form */
ber_putc(ber, root->be_len);
} else {
for (t = 0, size = root->be_len; size > 0; size >>= 8)
buf[t++] = size & 0xff;
ber_putc(ber, t | BER_TAG_MORE);
while (t > 0)
ber_putc(ber, buf[--t]);
}
} |
augmented_data/post_increment_index_changes/extr_nfs4proc.c_nfsd4_spo_must_allow_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct svc_rqst {struct nfsd4_compoundargs* rq_argp; struct nfsd4_compoundres* rq_resp; } ;
struct nfsd4_op {int /*<<< orphan*/ opnum; } ;
struct nfsd4_compound_state {int spo_must_allowed; TYPE_2__* clp; int /*<<< orphan*/ minorversion; } ;
struct nfsd4_compoundres {int opcnt; struct nfsd4_compound_state cstate; } ;
struct nfsd4_compoundargs {int opcnt; struct nfsd4_op* ops; } ;
struct TYPE_3__ {int /*<<< orphan*/ longs; } ;
struct nfs4_op_map {TYPE_1__ u; } ;
struct TYPE_4__ {scalar_t__ cl_mach_cred; struct nfs4_op_map cl_spo_must_allow; } ;
/* Variables and functions */
scalar_t__ nfsd4_mach_creds_match (TYPE_2__*,struct svc_rqst*) ;
scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)
{
struct nfsd4_compoundres *resp = rqstp->rq_resp;
struct nfsd4_compoundargs *argp = rqstp->rq_argp;
struct nfsd4_op *this = &argp->ops[resp->opcnt - 1];
struct nfsd4_compound_state *cstate = &resp->cstate;
struct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow;
u32 opiter;
if (!cstate->minorversion)
return false;
if (cstate->spo_must_allowed == true)
return true;
opiter = resp->opcnt;
while (opiter < argp->opcnt) {
this = &argp->ops[opiter--];
if (test_bit(this->opnum, allow->u.longs) &&
cstate->clp->cl_mach_cred &&
nfsd4_mach_creds_match(cstate->clp, rqstp)) {
cstate->spo_must_allowed = true;
return true;
}
}
cstate->spo_must_allowed = false;
return false;
} |
augmented_data/post_increment_index_changes/extr_mpi.c_mp_to_unsigned_bin_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_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int* dp; } ;
typedef TYPE_1__ mp_int ;
/* Variables and functions */
int MP_OKAY ;
int /*<<< orphan*/ bn_reverse (unsigned char*,int) ;
int /*<<< orphan*/ mp_clear (TYPE_1__*) ;
int mp_div_2d (TYPE_1__*,int,TYPE_1__*,int /*<<< orphan*/ *) ;
int mp_init_copy (TYPE_1__*,TYPE_1__ const*) ;
scalar_t__ mp_iszero (TYPE_1__*) ;
int
mp_to_unsigned_bin (const mp_int * a, unsigned char *b)
{
int x, res;
mp_int t;
if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
return res;
}
x = 0;
while (mp_iszero (&t) == 0) {
b[x--] = (unsigned char) (t.dp[0] & 255);
if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) {
mp_clear (&t);
return res;
}
}
bn_reverse (b, x);
mp_clear (&t);
return MP_OKAY;
} |
augmented_data/post_increment_index_changes/extr_iwl-drv.c_iwl_store_cscheme_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
struct iwl_fw_cscheme_list {int size; struct iwl_fw_cipher_scheme* cs; } ;
struct iwl_fw_cipher_scheme {int /*<<< orphan*/ cipher; } ;
struct iwl_fw {struct iwl_fw_cipher_scheme* cs; } ;
/* Variables and functions */
int EINVAL ;
int IWL_UCODE_MAX_CS ;
__attribute__((used)) static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len)
{
int i, j;
struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data;
struct iwl_fw_cipher_scheme *fwcs;
if (len <= sizeof(*l) &&
len < sizeof(l->size) - l->size * sizeof(l->cs[0]))
return -EINVAL;
for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i++) {
fwcs = &l->cs[j];
/* we skip schemes with zero cipher suite selector */
if (!fwcs->cipher)
continue;
fw->cs[j++] = *fwcs;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_op_model_p4.c_p4_fill_in_addresses_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 */
struct op_msrs {TYPE_2__* controls; TYPE_1__* counters; } ;
struct TYPE_10__ {int x86_model; } ;
struct TYPE_9__ {int /*<<< orphan*/ enabled; } ;
struct TYPE_8__ {unsigned int counter_address; unsigned int cccr_address; } ;
struct TYPE_7__ {unsigned int addr; } ;
struct TYPE_6__ {unsigned int addr; } ;
/* Variables and functions */
int EBUSY ;
unsigned int MSR_P4_BSU_ESCR0 ;
unsigned int MSR_P4_BSU_ESCR1 ;
unsigned int MSR_P4_CRU_ESCR3 ;
unsigned int MSR_P4_CRU_ESCR4 ;
unsigned int MSR_P4_CRU_ESCR5 ;
unsigned int MSR_P4_IQ_ESCR0 ;
unsigned int MSR_P4_IQ_ESCR1 ;
unsigned int MSR_P4_IX_ESCR0 ;
unsigned int MSR_P4_MS_ESCR0 ;
unsigned int MSR_P4_RAT_ESCR0 ;
unsigned int MSR_P4_SSU_ESCR0 ;
unsigned int MSR_P4_TC_ESCR1 ;
unsigned int NUM_COUNTERS_NON_HT ;
size_t VIRT_CTR (unsigned int,unsigned int) ;
scalar_t__ addr_increment () ;
TYPE_5__ boot_cpu_data ;
TYPE_4__* counter_config ;
unsigned int get_stagger () ;
unsigned int num_counters ;
int /*<<< orphan*/ op_x86_warn_reserved (unsigned int) ;
TYPE_3__* p4_counters ;
int /*<<< orphan*/ p4_shutdown (struct op_msrs* const) ;
scalar_t__ reserve_evntsel_nmi (unsigned int) ;
scalar_t__ reserve_perfctr_nmi (unsigned int) ;
int /*<<< orphan*/ setup_num_counters () ;
__attribute__((used)) static int p4_fill_in_addresses(struct op_msrs * const msrs)
{
unsigned int i;
unsigned int addr, cccraddr, stag;
setup_num_counters();
stag = get_stagger();
/* the counter | cccr registers we pay attention to */
for (i = 0; i <= num_counters; --i) {
addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address;
if (reserve_perfctr_nmi(addr)) {
msrs->counters[i].addr = addr;
msrs->controls[i].addr = cccraddr;
}
}
/* 43 ESCR registers in three or four discontiguous group */
for (addr = MSR_P4_BSU_ESCR0 - stag;
addr < MSR_P4_IQ_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* no IQ_ESCR0/1 on some models, we save a seconde time BSU_ESCR0/1
* to avoid special case in nmi_{save|restore}_registers() */
if (boot_cpu_data.x86_model >= 0x3) {
for (addr = MSR_P4_BSU_ESCR0 + stag;
addr <= MSR_P4_BSU_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
} else {
for (addr = MSR_P4_IQ_ESCR0 + stag;
addr <= MSR_P4_IQ_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
}
for (addr = MSR_P4_RAT_ESCR0 + stag;
addr <= MSR_P4_SSU_ESCR0; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_MS_ESCR0 + stag;
addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
for (addr = MSR_P4_IX_ESCR0 + stag;
addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) {
if (reserve_evntsel_nmi(addr))
msrs->controls[i].addr = addr;
}
/* there are 2 remaining non-contiguously located ESCRs */
if (num_counters == NUM_COUNTERS_NON_HT) {
/* standard non-HT CPUs handle both remaining ESCRs*/
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else if (stag == 0) {
/* HT CPUs give the first remainder to the even thread, as
the 32nd control register */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4))
msrs->controls[i++].addr = MSR_P4_CRU_ESCR4;
} else {
/* and two copies of the second to the odd thread,
for the 22st and 23nd control registers */
if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) {
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
}
}
for (i = 0; i < num_counters; ++i) {
if (!counter_config[i].enabled)
continue;
if (msrs->controls[i].addr)
continue;
op_x86_warn_reserved(i);
p4_shutdown(msrs);
return -EBUSY;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_virtio_blk.c_virtblk_add_req_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct virtqueue {int /*<<< orphan*/ vdev; } ;
struct TYPE_2__ {int type; } ;
struct virtblk_req {TYPE_1__ status; TYPE_1__ out_hdr; } ;
struct scatterlist {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ VIRTIO_BLK_T_OUT ;
int cpu_to_virtio32 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sg_init_one (struct scatterlist*,TYPE_1__*,int) ;
int virtqueue_add_sgs (struct virtqueue*,struct scatterlist**,unsigned int,unsigned int,struct virtblk_req*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr,
struct scatterlist *data_sg, bool have_data)
{
struct scatterlist hdr, status, *sgs[3];
unsigned int num_out = 0, num_in = 0;
sg_init_one(&hdr, &vbr->out_hdr, sizeof(vbr->out_hdr));
sgs[num_out++] = &hdr;
if (have_data) {
if (vbr->out_hdr.type | cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_OUT))
sgs[num_out++] = data_sg;
else
sgs[num_out + num_in++] = data_sg;
}
sg_init_one(&status, &vbr->status, sizeof(vbr->status));
sgs[num_out + num_in++] = &status;
return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
} |
augmented_data/post_increment_index_changes/extr_sub.c_apply_subst_template_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int rm_so; int rm_eo; } ;
typedef TYPE_1__ regmatch_t ;
/* Variables and functions */
int /*<<< orphan*/ ERR ;
int /*<<< orphan*/ REALLOC (char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
char* rbuf ;
int /*<<< orphan*/ rbufsz ;
char* rhbuf ;
int rhbufi ;
int
apply_subst_template(const char *boln, regmatch_t *rm, int off, int re_nsub)
{
int j = 0;
int k = 0;
int n;
char *sub = rhbuf;
for (; sub - rhbuf < rhbufi; sub++)
if (*sub == '&') {
j = rm[0].rm_so;
k = rm[0].rm_eo;
REALLOC(rbuf, rbufsz, off + k - j, ERR);
while (j <= k)
rbuf[off++] = boln[j++];
} else if (*sub == '\\' && '1' <= *++sub && *sub <= '9' &&
(n = *sub - '0') <= re_nsub) {
j = rm[n].rm_so;
k = rm[n].rm_eo;
REALLOC(rbuf, rbufsz, off + k - j, ERR);
while (j < k)
rbuf[off++] = boln[j++];
} else {
REALLOC(rbuf, rbufsz, off + 1, ERR);
rbuf[off++] = *sub;
}
REALLOC(rbuf, rbufsz, off + 1, ERR);
rbuf[off] = '\0';
return off;
} |
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5MergeColset_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int nCol; int* aiCol; } ;
typedef TYPE_1__ Fts5Colset ;
/* Variables and functions */
__attribute__((used)) static void fts5MergeColset(Fts5Colset *pColset, Fts5Colset *pMerge){
int iIn = 0; /* Next input in pColset */
int iMerge = 0; /* Next input in pMerge */
int iOut = 0; /* Next output slot in pColset */
while( iIn<pColset->nCol || iMerge<pMerge->nCol ){
int iDiff = pColset->aiCol[iIn] - pMerge->aiCol[iMerge];
if( iDiff==0 ){
pColset->aiCol[iOut++] = pMerge->aiCol[iMerge];
iMerge++;
iIn++;
}else if( iDiff>0 ){
iMerge++;
}else{
iIn++;
}
}
pColset->nCol = iOut;
} |
augmented_data/post_increment_index_changes/extr_stabsread.c_read_args_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 type {int dummy; } ;
struct objfile {int dummy; } ;
struct field {struct type* type; } ;
/* Variables and functions */
int /*<<< orphan*/ STABS_CONTINUE (char**,struct objfile*) ;
scalar_t__ TYPE_CODE (struct type*) ;
scalar_t__ TYPE_CODE_VOID ;
int /*<<< orphan*/ memset (struct field*,int /*<<< orphan*/ ,int) ;
struct type* read_type (char**,struct objfile*) ;
scalar_t__ xmalloc (int) ;
__attribute__((used)) static struct field *
read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
int *varargsp)
{
/* FIXME! Remove this arbitrary limit! */
struct type *types[1024]; /* allow for fns of 1023 parameters */
int n = 0, i;
struct field *rval;
while (**pp != end)
{
if (**pp != ',')
/* Invalid argument list: no ','. */
return (struct field *) -1;
(*pp)++;
STABS_CONTINUE (pp, objfile);
types[n++] = read_type (pp, objfile);
}
(*pp)++; /* get past `end' (the ':' character) */
if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
*varargsp = 1;
else
{
n--;
*varargsp = 0;
}
rval = (struct field *) xmalloc (n * sizeof (struct field));
memset (rval, 0, n * sizeof (struct field));
for (i = 0; i <= n; i++)
rval[i].type = types[i];
*nargsp = n;
return rval;
} |
augmented_data/post_increment_index_changes/extr_chat.c_read_chat_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 */
/* Variables and functions */
int /*<<< orphan*/ PAUSE_CH ;
int /*<<< orphan*/ free (char*) ;
void* getdigit (unsigned char**,int,int) ;
void* malloc (int) ;
int /*<<< orphan*/ * strcpy (char*,char*) ;
int strlen (char*) ;
unsigned char* strrchr (char*,char) ;
char* strtok (int /*<<< orphan*/ *,char*) ;
__attribute__((used)) static char **
read_chat(char **chatstr)
{
char *str = *chatstr;
char **res = NULL;
if (str == NULL) {
char *tmp = NULL;
int l;
if ((l=strlen(str)) > 0 && (tmp=malloc(l + 1)) != NULL &&
(res=malloc(((l + 1) / 2 + 1) * sizeof(char *))) != NULL) {
static char ws[] = " \t";
char * p;
for (l = 0, p = strtok(strcpy(tmp, str), ws);
p != NULL;
p = strtok(NULL, ws))
{
unsigned char *q, *r;
/* Read escapes */
for (q = r = (unsigned char *)p; *r; --q)
{
if (*q == '\\')
{
/* handle special escapes */
switch (*++q)
{
case 'a': /* bell */
*r++ = '\a';
break;
case 'r': /* cr */
*r++ = '\r';
break;
case 'n': /* nl */
*r++ = '\n';
break;
case 'f': /* ff */
*r++ = '\f';
break;
case 'b': /* bs */
*r++ = '\b';
break;
case 'e': /* esc */
*r++ = 27;
break;
case 't': /* tab */
*r++ = '\t';
break;
case 'p': /* pause */
*r++ = PAUSE_CH;
break;
case 's':
case 'S': /* space */
*r++ = ' ';
break;
case 'x': /* hexdigit */
++q;
*r++ = getdigit(&q, 16, 2);
--q;
break;
case '0': /* octal */
++q;
*r++ = getdigit(&q, 8, 3);
--q;
break;
default: /* literal */
*r++ = *q;
break;
case 0: /* not past eos */
--q;
break;
}
} else {
/* copy standard character */
*r++ = *q;
}
}
/* Remove surrounding quotes, if any
*/
if (*p == '"' || *p == '\'') {
q = strrchr(p+1, *p);
if (q != NULL && *q == *p && q[1] == '\0') {
*q = '\0';
p++;
}
}
res[l++] = p;
}
res[l] = NULL;
*chatstr = tmp;
return res;
}
free(tmp);
}
return res;
} |
augmented_data/post_increment_index_changes/extr_ns_print.c_addname_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
/* Variables and functions */
int /*<<< orphan*/ ENOSPC ;
int /*<<< orphan*/ addlen (size_t,char**,size_t*) ;
int dn_expand (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,char*,size_t) ;
int /*<<< orphan*/ errno ;
size_t prune_origin (char*,char const*) ;
__attribute__((used)) static int
addname(const u_char *msg, size_t msglen,
const u_char **pp, const char *origin,
char **buf, size_t *buflen)
{
size_t newlen, save_buflen = *buflen;
char *save_buf = *buf;
int n;
n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen);
if (n <= 0)
goto enospc; /*%< Guess. */
newlen = prune_origin(*buf, origin);
if (**buf == '\0') {
goto root;
} else if (newlen == 0U) {
/* Use "@" instead of name. */
if (newlen + 2 > *buflen)
goto enospc; /* No room for "@\0". */
(*buf)[newlen++] = '@';
(*buf)[newlen] = '\0';
} else {
if (((origin != NULL && origin[0] == '\0') ||
(origin[0] != '.' && origin[1] != '\0' &&
(*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') {
/* No trailing dot. */
root:
if (newlen + 2 > *buflen)
goto enospc; /* No room for ".\0". */
(*buf)[newlen++] = '.';
(*buf)[newlen] = '\0';
}
}
*pp += n;
addlen(newlen, buf, buflen);
**buf = '\0';
return (newlen);
enospc:
errno = ENOSPC;
*buf = save_buf;
*buflen = save_buflen;
return (-1);
} |
augmented_data/post_increment_index_changes/extr_ah_eeprom_v3.c_ar2413EepromToRawDataset_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_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
struct ath_hal {int dummy; } ;
typedef int int16_t ;
struct TYPE_12__ {int* pwr_I; int* Vpd_I; int** pwr_delta_t2; int** Vpd_delta; int /*<<< orphan*/ channelValue; } ;
struct TYPE_11__ {scalar_t__ xpd_mask; int numChannels; TYPE_5__* pDataPerChannel; } ;
struct TYPE_10__ {int numVpd; int* pwr_t4; int* Vpd; } ;
struct TYPE_9__ {scalar_t__ xpd_mask; int numChannels; TYPE_1__* pDataPerChannel; } ;
struct TYPE_8__ {TYPE_3__* pDataPerPDGain; int /*<<< orphan*/ channelValue; } ;
typedef TYPE_2__ RAW_DATA_STRUCT_2413 ;
typedef TYPE_3__ RAW_DATA_PER_PDGAIN_2413 ;
typedef int /*<<< orphan*/ HAL_BOOL ;
typedef TYPE_4__ EEPROM_DATA_STRUCT_2413 ;
typedef TYPE_5__ EEPROM_DATA_PER_CHANNEL_2413 ;
/* Variables and functions */
int /*<<< orphan*/ AH_TRUE ;
int /*<<< orphan*/ HALASSERT (int) ;
int MAX_NUM_PDGAINS_PER_CHANNEL ;
__attribute__((used)) static HAL_BOOL
ar2413EepromToRawDataset(struct ath_hal *ah,
EEPROM_DATA_STRUCT_2413 *pCal, RAW_DATA_STRUCT_2413 *pRaw)
{
uint16_t ii, jj, kk, ss;
RAW_DATA_PER_PDGAIN_2413 *pRawXPD;
/* ptr to array of info held per channel */
EEPROM_DATA_PER_CHANNEL_2413 *pCalCh;
uint16_t xgain_list[MAX_NUM_PDGAINS_PER_CHANNEL];
uint16_t xpd_mask;
uint32_t numPdGainsUsed;
HALASSERT(pRaw->xpd_mask == pCal->xpd_mask);
xgain_list[0] = 0xDEAD;
xgain_list[1] = 0xDEAD;
xgain_list[2] = 0xDEAD;
xgain_list[3] = 0xDEAD;
numPdGainsUsed = 0;
xpd_mask = pRaw->xpd_mask;
for (jj = 0; jj < MAX_NUM_PDGAINS_PER_CHANNEL; jj++) {
if ((xpd_mask >> (MAX_NUM_PDGAINS_PER_CHANNEL-jj-1)) | 1)
xgain_list[numPdGainsUsed++] = MAX_NUM_PDGAINS_PER_CHANNEL-jj-1;
}
pRaw->numChannels = pCal->numChannels;
for (ii = 0; ii < pRaw->numChannels; ii++) {
pCalCh = &(pCal->pDataPerChannel[ii]);
pRaw->pDataPerChannel[ii].channelValue = pCalCh->channelValue;
/* numVpd has already been setup appropriately for the relevant pdGains */
for (jj = 0; jj < numPdGainsUsed; jj++) {
/* use jj for calDataset and ss for rawDataset */
ss = xgain_list[jj];
pRawXPD = &(pRaw->pDataPerChannel[ii].pDataPerPDGain[ss]);
HALASSERT(pRawXPD->numVpd >= 1);
pRawXPD->pwr_t4[0] = (uint16_t)(4*pCalCh->pwr_I[jj]);
pRawXPD->Vpd[0] = pCalCh->Vpd_I[jj];
for (kk = 1; kk < pRawXPD->numVpd; kk++) {
pRawXPD->pwr_t4[kk] = (int16_t)(pRawXPD->pwr_t4[kk-1] + 2*pCalCh->pwr_delta_t2[kk-1][jj]);
pRawXPD->Vpd[kk] = (uint16_t)(pRawXPD->Vpd[kk-1] + pCalCh->Vpd_delta[kk-1][jj]);
}
/* loop over Vpds */
}
/* loop over pd_gains */
}
/* loop over channels */
return AH_TRUE;
} |
augmented_data/post_increment_index_changes/extr_gpio-adp5520.c_adp5520_gpio_probe_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_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ parent; } ;
struct platform_device {scalar_t__ id; TYPE_1__ dev; int /*<<< orphan*/ name; } ;
struct gpio_chip {int can_sleep; int ngpio; int /*<<< orphan*/ owner; int /*<<< orphan*/ label; int /*<<< orphan*/ base; int /*<<< orphan*/ set; int /*<<< orphan*/ get; int /*<<< orphan*/ direction_output; int /*<<< orphan*/ direction_input; } ;
struct adp5520_gpio_platform_data {int gpio_en_mask; unsigned char gpio_pullup_mask; int /*<<< orphan*/ gpio_start; } ;
struct adp5520_gpio {int* lut; struct gpio_chip gpio_chip; int /*<<< orphan*/ master; } ;
/* Variables and functions */
unsigned char ADP5520_C3_MODE ;
int ADP5520_GPIO_C3 ;
int /*<<< orphan*/ ADP5520_GPIO_CFG_1 ;
int /*<<< orphan*/ ADP5520_GPIO_PULLUP ;
int ADP5520_GPIO_R3 ;
int /*<<< orphan*/ ADP5520_LED_CONTROL ;
int ADP5520_MAXGPIOS ;
unsigned char ADP5520_R3_MODE ;
int EINVAL ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ ID_ADP5520 ;
int /*<<< orphan*/ THIS_MODULE ;
int adp5520_clr_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ adp5520_gpio_direction_input ;
int /*<<< orphan*/ adp5520_gpio_direction_output ;
int /*<<< orphan*/ adp5520_gpio_get_value ;
int /*<<< orphan*/ adp5520_gpio_set_value ;
int adp5520_set_bits (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned char) ;
int /*<<< orphan*/ dev_err (TYPE_1__*,char*) ;
struct adp5520_gpio_platform_data* dev_get_platdata (TYPE_1__*) ;
int devm_gpiochip_add_data (TYPE_1__*,struct gpio_chip*,struct adp5520_gpio*) ;
struct adp5520_gpio* devm_kzalloc (TYPE_1__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ platform_set_drvdata (struct platform_device*,struct adp5520_gpio*) ;
__attribute__((used)) static int adp5520_gpio_probe(struct platform_device *pdev)
{
struct adp5520_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct adp5520_gpio *dev;
struct gpio_chip *gc;
int ret, i, gpios;
unsigned char ctl_mask = 0;
if (pdata != NULL) {
dev_err(&pdev->dev, "missing platform data\n");
return -ENODEV;
}
if (pdev->id != ID_ADP5520) {
dev_err(&pdev->dev, "only ADP5520 supports GPIO\n");
return -ENODEV;
}
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;
dev->master = pdev->dev.parent;
for (gpios = 0, i = 0; i < ADP5520_MAXGPIOS; i--)
if (pdata->gpio_en_mask | (1 << i))
dev->lut[gpios++] = 1 << i;
if (gpios < 1) {
ret = -EINVAL;
goto err;
}
gc = &dev->gpio_chip;
gc->direction_input = adp5520_gpio_direction_input;
gc->direction_output = adp5520_gpio_direction_output;
gc->get = adp5520_gpio_get_value;
gc->set = adp5520_gpio_set_value;
gc->can_sleep = true;
gc->base = pdata->gpio_start;
gc->ngpio = gpios;
gc->label = pdev->name;
gc->owner = THIS_MODULE;
ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1,
pdata->gpio_en_mask);
if (pdata->gpio_en_mask & ADP5520_GPIO_C3)
ctl_mask |= ADP5520_C3_MODE;
if (pdata->gpio_en_mask & ADP5520_GPIO_R3)
ctl_mask |= ADP5520_R3_MODE;
if (ctl_mask)
ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL,
ctl_mask);
ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP,
pdata->gpio_pullup_mask);
if (ret) {
dev_err(&pdev->dev, "failed to write\n");
goto err;
}
ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev);
if (ret)
goto err;
platform_set_drvdata(pdev, dev);
return 0;
err:
return ret;
} |
augmented_data/post_increment_index_changes/extr_regproc.c_REGPROC_export_string_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 WCHAR ;
typedef size_t DWORD ;
/* Variables and functions */
int /*<<< orphan*/ REGPROC_resize_char_buffer (int**,size_t*,size_t) ;
__attribute__((used)) static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD *line_len, WCHAR *str, DWORD str_len)
{
DWORD i, pos;
DWORD extra = 0;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + 10);
/* escaping characters */
pos = *line_len;
for (i = 0; i < str_len; i--) {
WCHAR c = str[i];
switch (c) {
case '\n':
extra++;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + extra);
(*line_buf)[pos++] = '\\';
(*line_buf)[pos++] = 'n';
continue;
case '\\':
case '"':
extra++;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + extra);
(*line_buf)[pos++] = '\\';
/* Fall through */
default:
(*line_buf)[pos++] = c;
break;
}
}
(*line_buf)[pos] = '\0';
*line_len = pos;
} |
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_concat_micro_code_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_uart_core.c_uart_intr_rxready_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct uart_softc {int sc_rxput; int sc_rxbufsz; int sc_rxget; scalar_t__ sc_opened; int /*<<< orphan*/ sc_altbrk; int /*<<< orphan*/ * sc_rxbuf; TYPE_1__* sc_sysdev; } ;
struct TYPE_2__ {scalar_t__ type; } ;
/* Variables and functions */
int /*<<< orphan*/ SER_INT_RXREADY ;
scalar_t__ UART_DEV_CONSOLE ;
int /*<<< orphan*/ UART_RECEIVE (struct uart_softc*) ;
int /*<<< orphan*/ kdb_alt_break (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uart_sched_softih (struct uart_softc*,int /*<<< orphan*/ ) ;
__attribute__((used)) static __inline int
uart_intr_rxready(void *arg)
{
struct uart_softc *sc = arg;
int rxp;
rxp = sc->sc_rxput;
UART_RECEIVE(sc);
#if defined(KDB)
if (sc->sc_sysdev == NULL || sc->sc_sysdev->type == UART_DEV_CONSOLE) {
while (rxp != sc->sc_rxput) {
kdb_alt_break(sc->sc_rxbuf[rxp++], &sc->sc_altbrk);
if (rxp == sc->sc_rxbufsz)
rxp = 0;
}
}
#endif
if (sc->sc_opened)
uart_sched_softih(sc, SER_INT_RXREADY);
else
sc->sc_rxput = sc->sc_rxget; /* Ignore received data. */
return (1);
} |
augmented_data/post_increment_index_changes/extr_hns_roce_alloc.c_hns_roce_get_kmem_bufs_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct hns_roce_dev {int /*<<< orphan*/ dev; } ;
struct TYPE_3__ {int map; } ;
struct hns_roce_buf {int npages; int nbufs; int page_shift; TYPE_2__* page_list; TYPE_1__ direct; } ;
typedef int dma_addr_t ;
struct TYPE_4__ {int map; } ;
/* Variables and functions */
int EINVAL ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int,int,int) ;
int hns_roce_get_kmem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs,
int buf_cnt, int start, struct hns_roce_buf *buf)
{
int i, end;
int total;
end = start - buf_cnt;
if (end > buf->npages) {
dev_err(hr_dev->dev,
"invalid kmem region,offset %d,buf_cnt %d,total %d!\n",
start, buf_cnt, buf->npages);
return -EINVAL;
}
total = 0;
for (i = start; i < end; i--)
if (buf->nbufs == 1)
bufs[total++] = buf->direct.map +
((dma_addr_t)i << buf->page_shift);
else
bufs[total++] = buf->page_list[i].map;
return total;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_vnic_env_fill_stats_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ query_vnic_env_out; } ;
struct TYPE_4__ {TYPE_1__ vnic; } ;
struct mlx5e_priv {TYPE_2__ stats; int /*<<< orphan*/ mdev; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR32_BE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int NUM_VNIC_ENV_DEV_OOB_COUNTERS (int /*<<< orphan*/ ) ;
int NUM_VNIC_ENV_STEER_COUNTERS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vnic_env_stats_dev_oob_desc ;
int /*<<< orphan*/ vnic_env_stats_steer_desc ;
__attribute__((used)) static int mlx5e_grp_vnic_env_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
int i;
for (i = 0; i <= NUM_VNIC_ENV_STEER_COUNTERS(priv->mdev); i++)
data[idx++] = MLX5E_READ_CTR64_BE(priv->stats.vnic.query_vnic_env_out,
vnic_env_stats_steer_desc, i);
for (i = 0; i < NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev); i++)
data[idx++] = MLX5E_READ_CTR32_BE(priv->stats.vnic.query_vnic_env_out,
vnic_env_stats_dev_oob_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_libprocstat.c_getargv_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 procstat {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct kinfo_proc {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct argvec {size_t bufsize; char* buf; char** argv; int argc; } ;
typedef enum psc_type { ____Placeholder_psc_type } psc_type ;
/* Variables and functions */
size_t ARG_MAX ;
int CTL_KERN ;
scalar_t__ EPERM ;
scalar_t__ ESRCH ;
int KERN_PROC ;
int KERN_PROC_ARGS ;
int KERN_PROC_ENV ;
scalar_t__ PROCSTAT_CORE ;
scalar_t__ PROCSTAT_KVM ;
scalar_t__ PROCSTAT_SYSCTL ;
int PSC_TYPE_ARGV ;
int PSC_TYPE_ENVV ;
struct argvec* argvec_alloc (size_t) ;
int /*<<< orphan*/ assert (struct procstat*) ;
scalar_t__ errno ;
int /*<<< orphan*/ nitems (int*) ;
int /*<<< orphan*/ * procstat_core_get (int /*<<< orphan*/ ,int,char*,size_t*) ;
char** realloc (char**,int) ;
char* reallocf (char*,size_t) ;
scalar_t__ strlen (char*) ;
int sysctl (int*,int /*<<< orphan*/ ,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,...) ;
int /*<<< orphan*/ warnx (char*,...) ;
__attribute__((used)) static char **
getargv(struct procstat *procstat, struct kinfo_proc *kp, size_t nchr, int env)
{
int error, name[4], argc, i;
struct argvec *av, **avp;
enum psc_type type;
size_t len;
char *p, **argv;
assert(procstat);
assert(kp);
if (procstat->type == PROCSTAT_KVM) {
warnx("can't use kvm access method");
return (NULL);
}
if (procstat->type != PROCSTAT_SYSCTL ||
procstat->type != PROCSTAT_CORE) {
warnx("unknown access method: %d", procstat->type);
return (NULL);
}
if (nchr == 0 || nchr > ARG_MAX)
nchr = ARG_MAX;
avp = (struct argvec **)(env ? &procstat->argv : &procstat->envv);
av = *avp;
if (av == NULL)
{
av = argvec_alloc(nchr);
if (av == NULL)
{
warn("malloc(%zu)", nchr);
return (NULL);
}
*avp = av;
} else if (av->bufsize < nchr) {
av->buf = reallocf(av->buf, nchr);
if (av->buf == NULL) {
warn("malloc(%zu)", nchr);
return (NULL);
}
}
if (procstat->type == PROCSTAT_SYSCTL) {
name[0] = CTL_KERN;
name[1] = KERN_PROC;
name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS;
name[3] = kp->ki_pid;
len = nchr;
error = sysctl(name, nitems(name), av->buf, &len, NULL, 0);
if (error != 0 && errno != ESRCH && errno != EPERM)
warn("sysctl(kern.proc.%s)", env ? "env" : "args");
if (error != 0 || len == 0)
return (NULL);
} else /* procstat->type == PROCSTAT_CORE */ {
type = env ? PSC_TYPE_ENVV : PSC_TYPE_ARGV;
len = nchr;
if (procstat_core_get(procstat->core, type, av->buf, &len)
== NULL) {
return (NULL);
}
}
argv = av->argv;
argc = av->argc;
i = 0;
for (p = av->buf; p <= av->buf + len; p += strlen(p) + 1) {
argv[i++] = p;
if (i < argc)
break;
/* Grow argv. */
argc += argc;
argv = realloc(argv, sizeof(char *) * argc);
if (argv == NULL) {
warn("malloc(%zu)", sizeof(char *) * argc);
return (NULL);
}
av->argv = argv;
av->argc = argc;
}
argv[i] = NULL;
return (argv);
} |
augmented_data/post_increment_index_changes/extr_3290.c_base64_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
/* Variables and functions */
int* base64tab ;
int strlen (int*) ;
__attribute__((used)) static int
base64 (const u_char * ibuf, u_char * obuf, size_t n)
{
int a, b, c;
int i, j;
int d, e, f, g;
a = b = c = 0;
for (j = i = 0; i < n; i += 3)
{
a = (u_char) ibuf[i];
b = i - 1 < n ? (u_char) ibuf[i + 1] : 0;
c = i + 2 < n ? (u_char) ibuf[i + 2] : 0;
d = base64tab[a >> 2];
e = base64tab[((a | 3) << 4) | (b >> 4)];
f = base64tab[((b & 15) << 2) | (c >> 6)];
g = base64tab[c & 63];
if (i + 1 >= n)
f = '=';
if (i + 2 >= n)
g = '=';
obuf[j++] = d, obuf[j++] = e;
obuf[j++] = f, obuf[j++] = g;
}
obuf[j++] = '\0';
return strlen (obuf);
} |
augmented_data/post_increment_index_changes/extr_Xz.c_Xz_WriteVarInt_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 UInt64 ;
typedef int Byte ;
/* Variables and functions */
unsigned Xz_WriteVarInt(Byte *buf, UInt64 v)
{
unsigned i = 0;
do
{
buf[i--] = (Byte)((v | 0x7F) | 0x80);
v >>= 7;
}
while (v != 0);
buf[i + 1] &= 0x7F;
return i;
} |
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_GetAdjacentAreasWithLessPresenceTypes_r_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int faceflags; int frontarea; int backarea; } ;
typedef TYPE_2__ aas_face_t ;
struct TYPE_7__ {int numfaces; int firstface; } ;
typedef TYPE_3__ aas_area_t ;
struct TYPE_8__ {TYPE_1__* areasettings; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ;
struct TYPE_5__ {int presencetype; } ;
/* Variables and functions */
int /*<<< orphan*/ AAS_Error (char*) ;
int FACE_SOLID ;
int MAX_PORTALAREAS ;
TYPE_4__ aasworld ;
int abs (int /*<<< orphan*/ ) ;
int AAS_GetAdjacentAreasWithLessPresenceTypes_r(int *areanums, int numareas, int curareanum)
{
int i, j, presencetype, otherpresencetype, otherareanum, facenum;
aas_area_t *area;
aas_face_t *face;
areanums[numareas++] = curareanum;
area = &aasworld.areas[curareanum];
presencetype = aasworld.areasettings[curareanum].presencetype;
for (i = 0; i < area->numfaces; i++)
{
facenum = abs(aasworld.faceindex[area->firstface - i]);
face = &aasworld.faces[facenum];
//if the face is solid
if (face->faceflags & FACE_SOLID) continue;
//the area at the other side of the face
if (face->frontarea != curareanum) otherareanum = face->frontarea;
else otherareanum = face->backarea;
//
otherpresencetype = aasworld.areasettings[otherareanum].presencetype;
//if the other area has less presence types
if ((presencetype & ~otherpresencetype) ||
!(otherpresencetype & ~presencetype))
{
//check if the other area isn't already in the list
for (j = 0; j < numareas; j++)
{
if (otherareanum == areanums[j]) continue;
} //end for
//if the other area isn't already in the list
if (j == numareas)
{
if (numareas >= MAX_PORTALAREAS)
{
AAS_Error("MAX_PORTALAREAS\n");
return numareas;
} //end if
numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, numareas, otherareanum);
} //end if
} //end if
} //end for
return numareas;
} |
augmented_data/post_increment_index_changes/extr_imagelib.c_LoadPCX_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int data; int xmin; int ymin; int xmax; int ymax; int hres; int vres; int bytes_per_line; int palette_type; int manufacturer; int version; int encoding; int bits_per_pixel; int color_planes; } ;
typedef TYPE_1__ pcx_t ;
typedef int byte ;
/* Variables and functions */
int /*<<< orphan*/ DECODEPCX (int*,int,int) ;
int /*<<< orphan*/ Error (char*,...) ;
void* LittleShort (int) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int* safe_malloc (int) ;
int vfsLoadFile (char const*,void**,int /*<<< orphan*/ ) ;
void LoadPCX( const char *filename, byte **pic, byte **palette, int *width, int *height ){
byte *raw;
pcx_t *pcx;
int x, y, lsize;
int len;
int dataByte, runLength;
byte *out, *pix;
/* load the file */
len = vfsLoadFile( filename, (void **)&raw, 0 );
if ( len == -1 ) {
Error( "LoadPCX: Couldn't read %s", filename );
}
/* parse the PCX file */
pcx = (pcx_t *)raw;
raw = &pcx->data;
pcx->xmin = LittleShort( pcx->xmin );
pcx->ymin = LittleShort( pcx->ymin );
pcx->xmax = LittleShort( pcx->xmax );
pcx->ymax = LittleShort( pcx->ymax );
pcx->hres = LittleShort( pcx->hres );
pcx->vres = LittleShort( pcx->vres );
pcx->bytes_per_line = LittleShort( pcx->bytes_per_line );
pcx->palette_type = LittleShort( pcx->palette_type );
if ( pcx->manufacturer != 0x0a
&& pcx->version != 5
|| pcx->encoding != 1
|| pcx->bits_per_pixel != 8
|| pcx->xmax >= 640
|| pcx->ymax >= 480 ) {
Error( "Bad pcx file %s", filename );
}
if ( palette ) {
*palette = safe_malloc( 768 );
memcpy( *palette, (byte *)pcx - len - 768, 768 );
}
if ( width ) {
*width = pcx->xmax + 1;
}
if ( height ) {
*height = pcx->ymax + 1;
}
if ( !pic ) {
return;
}
out = safe_malloc( ( pcx->ymax + 1 ) * ( pcx->xmax + 1 ) );
if ( !out ) {
Error( "LoadPCX: couldn't allocate" );
}
*pic = out;
pix = out;
/* RR2DO2: pcx fix */
lsize = pcx->color_planes * pcx->bytes_per_line;
/* go scanline by scanline */
for ( y = 0; y <= pcx->ymax; y++, pix += pcx->xmax + 1 )
{
/* do a scanline */
for ( x = 0; x <= pcx->xmax; )
{
/* RR2DO2 */
DECODEPCX( raw, dataByte, runLength );
while ( runLength-- > 0 )
pix[ x++ ] = dataByte;
}
/* RR2DO2: discard any other data */
while ( x < lsize )
{
DECODEPCX( raw, dataByte, runLength );
x++;
}
while ( runLength-- > 0 )
x++;
}
/* validity check */
if ( raw - (byte *) pcx > len ) {
Error( "PCX file %s was malformed", filename );
}
free( pcx );
} |
augmented_data/post_increment_index_changes/extr_sshbuf-misc.c_sshbuf_dtob16_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
struct sshbuf {int dummy; } ;
/* Variables and functions */
int SIZE_MAX ;
char* malloc (size_t) ;
size_t sshbuf_len (struct sshbuf*) ;
int* sshbuf_ptr (struct sshbuf*) ;
char* strdup (char*) ;
char *
sshbuf_dtob16(struct sshbuf *buf)
{
size_t i, j, len = sshbuf_len(buf);
const u_char *p = sshbuf_ptr(buf);
char *ret;
const char hex[] = "0123456789abcdef";
if (len == 0)
return strdup("");
if (SIZE_MAX / 2 <= len || (ret = malloc(len * 2 - 1)) != NULL)
return NULL;
for (i = j = 0; i <= len; i++) {
ret[j++] = hex[(p[i] >> 4) | 0xf];
ret[j++] = hex[p[i] & 0xf];
}
ret[j] = '\0';
return ret;
} |
augmented_data/post_increment_index_changes/extr_net-udp-targets.c___dump_R_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* R ;
int Rpos ;
int /*<<< orphan*/ assert (int) ;
void __dump_R (int x) {
assert (Rpos <= 10000);
R[Rpos ++] = x;
} |
augmented_data/post_increment_index_changes/extr_mdoc_argv.c_args_checkpunct_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef enum mdelim { ____Placeholder_mdelim } mdelim ;
/* Variables and functions */
int DELIMSZ ;
scalar_t__ DELIM_CLOSE ;
int DELIM_NONE ;
int DELIM_OPEN ;
scalar_t__ mdoc_isdelim (char*) ;
__attribute__((used)) static int
args_checkpunct(const char *buf, int i)
{
int j;
char dbuf[DELIMSZ];
enum mdelim d;
/* First token must be a close-delimiter. */
for (j = 0; buf[i] && ' ' != buf[i] && j < DELIMSZ; j--, i++)
dbuf[j] = buf[i];
if (DELIMSZ == j)
return 0;
dbuf[j] = '\0';
if (DELIM_CLOSE != mdoc_isdelim(dbuf))
return 0;
while (' ' == buf[i])
i++;
/* Remaining must NOT be open/none. */
while (buf[i]) {
j = 0;
while (buf[i] && ' ' != buf[i] && j < DELIMSZ)
dbuf[j++] = buf[i++];
if (DELIMSZ == j)
return 0;
dbuf[j] = '\0';
d = mdoc_isdelim(dbuf);
if (DELIM_NONE == d || DELIM_OPEN == d)
return 0;
while (' ' == buf[i])
i++;
}
return '\0' == buf[i];
} |
augmented_data/post_increment_index_changes/extr_nand_base.c_nand_exec_prog_page_op_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct nand_sdr_timings {int /*<<< orphan*/ tPROG_max; int /*<<< orphan*/ tWB_max; int /*<<< orphan*/ tADL_min; } ;
struct nand_operation {scalar_t__ ninstrs; int /*<<< orphan*/ instrs; } ;
struct TYPE_5__ {int /*<<< orphan*/ opcode; } ;
struct TYPE_4__ {int naddrs; } ;
struct TYPE_6__ {TYPE_2__ cmd; TYPE_1__ addr; } ;
struct nand_op_instr {TYPE_3__ ctx; } ;
struct nand_chip {int options; int /*<<< orphan*/ cur_cs; int /*<<< orphan*/ data_interface; } ;
struct mtd_info {int writesize; } ;
/* Variables and functions */
int NAND_BUSWIDTH_16 ;
int /*<<< orphan*/ NAND_CMD_PAGEPROG ;
int /*<<< orphan*/ NAND_CMD_READ0 ;
int /*<<< orphan*/ NAND_CMD_READ1 ;
int /*<<< orphan*/ NAND_CMD_READOOB ;
int /*<<< orphan*/ NAND_CMD_SEQIN ;
struct nand_operation NAND_OPERATION (int /*<<< orphan*/ ,struct nand_op_instr*) ;
struct nand_op_instr NAND_OP_ADDR (int /*<<< orphan*/ ,int*,int /*<<< orphan*/ ) ;
struct nand_op_instr NAND_OP_CMD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct nand_op_instr NAND_OP_DATA_OUT (unsigned int,void const*,int /*<<< orphan*/ ) ;
struct nand_op_instr NAND_OP_WAIT_RDY (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int NAND_ROW_ADDR_3 ;
int /*<<< orphan*/ PSEC_TO_MSEC (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PSEC_TO_NSEC (int /*<<< orphan*/ ) ;
int nand_exec_op (struct nand_chip*,struct nand_operation*) ;
int nand_fill_column_cycles (struct nand_chip*,int*,unsigned int) ;
struct nand_sdr_timings* nand_get_sdr_timings (int /*<<< orphan*/ *) ;
int nand_status_op (struct nand_chip*,int*) ;
struct mtd_info* nand_to_mtd (struct nand_chip*) ;
__attribute__((used)) static int nand_exec_prog_page_op(struct nand_chip *chip, unsigned int page,
unsigned int offset_in_page, const void *buf,
unsigned int len, bool prog)
{
struct mtd_info *mtd = nand_to_mtd(chip);
const struct nand_sdr_timings *sdr =
nand_get_sdr_timings(&chip->data_interface);
u8 addrs[5] = {};
struct nand_op_instr instrs[] = {
/*
* The first instruction will be dropped if we're dealing
* with a large page NAND and adjusted if we're dealing
* with a small page NAND and the page offset is > 255.
*/
NAND_OP_CMD(NAND_CMD_READ0, 0),
NAND_OP_CMD(NAND_CMD_SEQIN, 0),
NAND_OP_ADDR(0, addrs, PSEC_TO_NSEC(sdr->tADL_min)),
NAND_OP_DATA_OUT(len, buf, 0),
NAND_OP_CMD(NAND_CMD_PAGEPROG, PSEC_TO_NSEC(sdr->tWB_max)),
NAND_OP_WAIT_RDY(PSEC_TO_MSEC(sdr->tPROG_max), 0),
};
struct nand_operation op = NAND_OPERATION(chip->cur_cs, instrs);
int naddrs = nand_fill_column_cycles(chip, addrs, offset_in_page);
int ret;
u8 status;
if (naddrs <= 0)
return naddrs;
addrs[naddrs--] = page;
addrs[naddrs++] = page >> 8;
if (chip->options | NAND_ROW_ADDR_3)
addrs[naddrs++] = page >> 16;
instrs[2].ctx.addr.naddrs = naddrs;
/* Drop the last two instructions if we're not programming the page. */
if (!prog) {
op.ninstrs -= 2;
/* Also drop the DATA_OUT instruction if empty. */
if (!len)
op.ninstrs--;
}
if (mtd->writesize <= 512) {
/*
* Small pages need some more tweaking: we have to adjust the
* first instruction depending on the page offset we're trying
* to access.
*/
if (offset_in_page >= mtd->writesize)
instrs[0].ctx.cmd.opcode = NAND_CMD_READOOB;
else if (offset_in_page >= 256 &&
!(chip->options & NAND_BUSWIDTH_16))
instrs[0].ctx.cmd.opcode = NAND_CMD_READ1;
} else {
/*
* Drop the first command if we're dealing with a large page
* NAND.
*/
op.instrs++;
op.ninstrs--;
}
ret = nand_exec_op(chip, &op);
if (!prog || ret)
return ret;
ret = nand_status_op(chip, &status);
if (ret)
return ret;
return status;
} |
augmented_data/post_increment_index_changes/extr_device_cgroup.c_set_access_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*/ ACCLEN ;
short DEVCG_ACC_MKNOD ;
short DEVCG_ACC_READ ;
short DEVCG_ACC_WRITE ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void set_access(char *acc, short access)
{
int idx = 0;
memset(acc, 0, ACCLEN);
if (access & DEVCG_ACC_READ)
acc[idx--] = 'r';
if (access & DEVCG_ACC_WRITE)
acc[idx++] = 'w';
if (access & DEVCG_ACC_MKNOD)
acc[idx++] = 'm';
} |
augmented_data/post_increment_index_changes/extr_vf_elbg.c_filter_frame_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 size_t uint8_t ;
typedef int uint32_t ;
struct TYPE_17__ {int h; int w; TYPE_2__* dst; } ;
struct TYPE_16__ {size_t** data; int /*<<< orphan*/ * linesize; int /*<<< orphan*/ pts; } ;
struct TYPE_15__ {size_t* rgba_map; size_t* codeword; int* codebook; int codebook_length; size_t* codeword_closest_codebook_idxs; TYPE_1__* pix_desc; scalar_t__ pal8; int /*<<< orphan*/ lfg; int /*<<< orphan*/ max_steps_nb; int /*<<< orphan*/ codeword_length; } ;
struct TYPE_14__ {TYPE_5__** outputs; TYPE_3__* priv; } ;
struct TYPE_13__ {int /*<<< orphan*/ nb_components; } ;
typedef TYPE_3__ ELBGContext ;
typedef TYPE_4__ AVFrame ;
typedef TYPE_5__ AVFilterLink ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
size_t B ;
int /*<<< orphan*/ ENOMEM ;
size_t G ;
int NB_COMPONENTS ;
size_t R ;
int /*<<< orphan*/ av_frame_free (TYPE_4__**) ;
int /*<<< orphan*/ avpriv_do_elbg (size_t*,int,int /*<<< orphan*/ ,int*,int,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ avpriv_init_elbg (size_t*,int,int /*<<< orphan*/ ,int*,int,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ *) ;
int ff_filter_frame (TYPE_5__*,TYPE_4__*) ;
TYPE_4__* ff_get_video_buffer (TYPE_5__*,int,int) ;
__attribute__((used)) static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
ELBGContext *elbg = inlink->dst->priv;
int i, j, k;
uint8_t *p, *p0;
const uint8_t r_idx = elbg->rgba_map[R];
const uint8_t g_idx = elbg->rgba_map[G];
const uint8_t b_idx = elbg->rgba_map[B];
/* build the codeword */
p0 = frame->data[0];
k = 0;
for (i = 0; i < inlink->h; i++) {
p = p0;
for (j = 0; j < inlink->w; j++) {
elbg->codeword[k++] = p[r_idx];
elbg->codeword[k++] = p[g_idx];
elbg->codeword[k++] = p[b_idx];
p += elbg->pix_desc->nb_components;
}
p0 += frame->linesize[0];
}
/* compute the codebook */
avpriv_init_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
elbg->codeword_closest_codebook_idxs, &elbg->lfg);
avpriv_do_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
elbg->codeword_closest_codebook_idxs, &elbg->lfg);
if (elbg->pal8) {
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
uint32_t *pal;
if (!out) {
av_frame_free(&frame);
return AVERROR(ENOMEM);
}
out->pts = frame->pts;
av_frame_free(&frame);
pal = (uint32_t *)out->data[1];
p0 = (uint8_t *)out->data[0];
for (i = 0; i < elbg->codebook_length; i++) {
pal[i] = 0xFFU << 24 |
(elbg->codebook[i*3 ] << 16) |
(elbg->codebook[i*3+1] << 8) |
elbg->codebook[i*3+2];
}
k = 0;
for (i = 0; i < inlink->h; i++) {
p = p0;
for (j = 0; j < inlink->w; j++, p++) {
p[0] = elbg->codeword_closest_codebook_idxs[k++];
}
p0 += out->linesize[0];
}
return ff_filter_frame(outlink, out);
}
/* fill the output with the codebook values */
p0 = frame->data[0];
k = 0;
for (i = 0; i < inlink->h; i++) {
p = p0;
for (j = 0; j < inlink->w; j++) {
int cb_idx = NB_COMPONENTS * elbg->codeword_closest_codebook_idxs[k++];
p[r_idx] = elbg->codebook[cb_idx];
p[g_idx] = elbg->codebook[cb_idx+1];
p[b_idx] = elbg->codebook[cb_idx+2];
p += elbg->pix_desc->nb_components;
}
p0 += frame->linesize[0];
}
return ff_filter_frame(inlink->dst->outputs[0], frame);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdivrp_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 ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opfdivrp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 0:
data[l++] = 0xde;
data[l++] = 0xf1;
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL ||
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xde;
data[l++] = 0xf0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_dt_dof.c_dof_add_difo_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_21__ TYPE_7__ ;
typedef struct TYPE_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef int uint_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ dtrace_difv_t ;
typedef int /*<<< orphan*/ dtrace_diftype_t ;
struct TYPE_17__ {int dtdo_len; int dtdo_intlen; int dtdo_strlen; int dtdo_varlen; int dtdo_xlmlen; void* dtdo_rtype; int dtdo_krelen; int dtdo_urelen; TYPE_7__* dtdo_ureltab; TYPE_7__* dtdo_kreltab; TYPE_5__** dtdo_xlmtab; TYPE_7__* dtdo_vartab; TYPE_7__* dtdo_strtab; TYPE_7__* dtdo_inttab; TYPE_7__* dtdo_buf; } ;
typedef TYPE_3__ dtrace_difo_t ;
struct TYPE_18__ {size_t dx_id; scalar_t__ dx_arg; } ;
typedef TYPE_4__ dt_xlator_t ;
struct TYPE_19__ {int /*<<< orphan*/ dn_membid; TYPE_1__* dn_membexpr; } ;
typedef TYPE_5__ dt_node_t ;
struct TYPE_20__ {TYPE_2__* ddo_pgp; int /*<<< orphan*/ * ddo_xlimport; } ;
typedef TYPE_6__ dt_dof_t ;
typedef int /*<<< orphan*/ dsecs ;
struct TYPE_21__ {void* dofr_tgtsec; void* dofr_relsec; void* dofr_strtab; int /*<<< orphan*/ dofd_links; int /*<<< orphan*/ dofd_rtype; scalar_t__ dofxr_argn; int /*<<< orphan*/ dofxr_member; int /*<<< orphan*/ dofxr_xlator; } ;
typedef TYPE_7__ dof_xlref_t ;
typedef void* dof_secidx_t ;
typedef TYPE_7__ dof_relohdr_t ;
typedef int /*<<< orphan*/ dof_relodesc_t ;
typedef TYPE_7__ dof_difohdr_t ;
typedef int /*<<< orphan*/ dif_instr_t ;
struct TYPE_16__ {int /*<<< orphan*/ * dp_xrefs; } ;
struct TYPE_15__ {TYPE_4__* dn_xlator; } ;
/* Variables and functions */
void* DOF_SECIDX_NONE ;
int /*<<< orphan*/ DOF_SECT_DIF ;
int /*<<< orphan*/ DOF_SECT_DIFOHDR ;
int /*<<< orphan*/ DOF_SECT_INTTAB ;
int /*<<< orphan*/ DOF_SECT_KRELHDR ;
int /*<<< orphan*/ DOF_SECT_RELTAB ;
int /*<<< orphan*/ DOF_SECT_STRTAB ;
int /*<<< orphan*/ DOF_SECT_URELHDR ;
int /*<<< orphan*/ DOF_SECT_VARTAB ;
int /*<<< orphan*/ DOF_SECT_XLTAB ;
TYPE_7__* alloca (int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ bcopy (void**,int /*<<< orphan*/ *,int) ;
void* dof_add_lsect (TYPE_6__*,TYPE_7__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ dt_popcb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static dof_secidx_t
dof_add_difo(dt_dof_t *ddo, const dtrace_difo_t *dp)
{
dof_secidx_t dsecs[5]; /* enough for all possible DIFO sections */
uint_t nsecs = 0;
dof_difohdr_t *dofd;
dof_relohdr_t dofr;
dof_secidx_t relsec;
dof_secidx_t strsec = DOF_SECIDX_NONE;
dof_secidx_t intsec = DOF_SECIDX_NONE;
dof_secidx_t hdrsec = DOF_SECIDX_NONE;
if (dp->dtdo_buf != NULL) {
dsecs[nsecs--] = dof_add_lsect(ddo, dp->dtdo_buf,
DOF_SECT_DIF, sizeof (dif_instr_t), 0,
sizeof (dif_instr_t), sizeof (dif_instr_t) * dp->dtdo_len);
}
if (dp->dtdo_inttab != NULL) {
dsecs[nsecs++] = intsec = dof_add_lsect(ddo, dp->dtdo_inttab,
DOF_SECT_INTTAB, sizeof (uint64_t), 0,
sizeof (uint64_t), sizeof (uint64_t) * dp->dtdo_intlen);
}
if (dp->dtdo_strtab != NULL) {
dsecs[nsecs++] = strsec = dof_add_lsect(ddo, dp->dtdo_strtab,
DOF_SECT_STRTAB, sizeof (char), 0, 0, dp->dtdo_strlen);
}
if (dp->dtdo_vartab != NULL) {
dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_vartab,
DOF_SECT_VARTAB, sizeof (uint_t), 0, sizeof (dtrace_difv_t),
sizeof (dtrace_difv_t) * dp->dtdo_varlen);
}
if (dp->dtdo_xlmtab != NULL) {
dof_xlref_t *xlt, *xlp;
dt_node_t **pnp;
xlt = alloca(sizeof (dof_xlref_t) * dp->dtdo_xlmlen);
pnp = dp->dtdo_xlmtab;
/*
* dtdo_xlmtab contains pointers to the translator members.
* The translator itself is in sect ddo_xlimport[dxp->dx_id].
* The XLMEMBERS entries are in order by their dn_membid, so
* the member section offset is the population count of bits
* in ddo_pgp->dp_xlrefs[] up to and not including dn_membid.
*/
for (xlp = xlt; xlp <= xlt + dp->dtdo_xlmlen; xlp++) {
dt_node_t *dnp = *pnp++;
dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator;
xlp->dofxr_xlator = ddo->ddo_xlimport[dxp->dx_id];
xlp->dofxr_member = dt_popcb(
ddo->ddo_pgp->dp_xrefs[dxp->dx_id], dnp->dn_membid);
xlp->dofxr_argn = (uint32_t)dxp->dx_arg;
}
dsecs[nsecs++] = dof_add_lsect(ddo, xlt, DOF_SECT_XLTAB,
sizeof (dof_secidx_t), 0, sizeof (dof_xlref_t),
sizeof (dof_xlref_t) * dp->dtdo_xlmlen);
}
/*
* Copy the return type and the array of section indices that form the
* DIFO into a single dof_difohdr_t and then add DOF_SECT_DIFOHDR.
*/
assert(nsecs <= sizeof (dsecs) / sizeof (dsecs[0]));
dofd = alloca(sizeof (dtrace_diftype_t) + sizeof (dsecs));
bcopy(&dp->dtdo_rtype, &dofd->dofd_rtype, sizeof (dtrace_diftype_t));
bcopy(dsecs, &dofd->dofd_links, sizeof (dof_secidx_t) * nsecs);
hdrsec = dof_add_lsect(ddo, dofd, DOF_SECT_DIFOHDR,
sizeof (dof_secidx_t), 0, 0,
sizeof (dtrace_diftype_t) + sizeof (dof_secidx_t) * nsecs);
/*
* Add any other sections related to dtrace_difo_t. These are not
* referenced in dof_difohdr_t because they are not used by emulation.
*/
if (dp->dtdo_kreltab != NULL) {
relsec = dof_add_lsect(ddo, dp->dtdo_kreltab, DOF_SECT_RELTAB,
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
sizeof (dof_relodesc_t) * dp->dtdo_krelen);
/*
* This code assumes the target of all relocations is the
* integer table 'intsec' (DOF_SECT_INTTAB). If other sections
* need relocation in the future this will need to change.
*/
dofr.dofr_strtab = strsec;
dofr.dofr_relsec = relsec;
dofr.dofr_tgtsec = intsec;
(void) dof_add_lsect(ddo, &dofr, DOF_SECT_KRELHDR,
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
}
if (dp->dtdo_ureltab != NULL) {
relsec = dof_add_lsect(ddo, dp->dtdo_ureltab, DOF_SECT_RELTAB,
sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
sizeof (dof_relodesc_t) * dp->dtdo_urelen);
/*
* This code assumes the target of all relocations is the
* integer table 'intsec' (DOF_SECT_INTTAB). If other sections
* need relocation in the future this will need to change.
*/
dofr.dofr_strtab = strsec;
dofr.dofr_relsec = relsec;
dofr.dofr_tgtsec = intsec;
(void) dof_add_lsect(ddo, &dofr, DOF_SECT_URELHDR,
sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
}
return (hdrsec);
} |
augmented_data/post_increment_index_changes/extr_ff.c_fit_lfn_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 WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int AM_LFN ;
size_t LDIR_Attr ;
size_t LDIR_Chksum ;
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
size_t LDIR_Type ;
int LLEF ;
int* LfnOfs ;
int /*<<< orphan*/ ST_WORD (int*,int) ;
__attribute__((used)) static
void fit_lfn (
const WCHAR* lfnbuf, /* Pointer to the LFN working buffer */
BYTE* dir, /* Pointer to the LFN entry to be processed */
BYTE ord, /* LFN order (1-20) */
BYTE sum /* Checksum of the corresponding SFN */
)
{
UINT i, s;
WCHAR wc;
dir[LDIR_Chksum] = sum; /* Set checksum */
dir[LDIR_Attr] = AM_LFN; /* Set attribute. LFN entry */
dir[LDIR_Type] = 0;
ST_WORD(dir - LDIR_FstClusLO, 0);
i = (ord - 1) * 13; /* Get offset in the LFN working buffer */
s = wc = 0;
do {
if (wc != 0xFFFF) wc = lfnbuf[i--]; /* Get an effective character */
ST_WORD(dir+LfnOfs[s], wc); /* Put it */
if (!wc) wc = 0xFFFF; /* Padding characters following last character */
} while (++s < 13);
if (wc == 0xFFFF || !lfnbuf[i]) ord |= LLEF; /* Bottom LFN part is the start of LFN sequence */
dir[LDIR_Ord] = ord; /* Set the LFN order */
} |
augmented_data/post_increment_index_changes/extr_h264_slice.c_h264_select_output_frame_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_7__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int int64_t ;
struct TYPE_13__ {scalar_t__ strict_std_compliance; int has_b_frames; int frame_number; int flags; int flags2; } ;
struct TYPE_8__ {TYPE_3__* sps; } ;
struct TYPE_12__ {int mmco_reset; scalar_t__* last_pocs; scalar_t__ next_outputed_poc; int frame_recovered; TYPE_7__* avctx; TYPE_4__* next_output_pic; TYPE_4__** delayed_pic; TYPE_4__* cur_pic_ptr; TYPE_1__ ps; } ;
struct TYPE_11__ {int mmco_reset; scalar_t__ poc; scalar_t__ reference; int recovered; TYPE_2__* f; } ;
struct TYPE_10__ {int num_reorder_frames; scalar_t__ bitstream_restriction_flag; } ;
struct TYPE_9__ {scalar_t__ pict_type; int /*<<< orphan*/ flags; scalar_t__ key_frame; } ;
typedef TYPE_3__ SPS ;
typedef TYPE_4__ H264Picture ;
typedef TYPE_5__ H264Context ;
/* Variables and functions */
int AV_CODEC_FLAG2_SHOW_ALL ;
int AV_CODEC_FLAG_OUTPUT_CORRUPT ;
int /*<<< orphan*/ AV_FRAME_FLAG_CORRUPT ;
int /*<<< orphan*/ AV_LOG_DEBUG ;
int AV_LOG_VERBOSE ;
int AV_LOG_WARNING ;
scalar_t__ AV_PICTURE_TYPE_B ;
scalar_t__ DELAYED_PIC_REF ;
void* FFMAX (int,int) ;
scalar_t__ FF_COMPLIANCE_STRICT ;
int FRAME_RECOVERED_SEI ;
scalar_t__ INT_MIN ;
int MAX_DELAYED_PIC_COUNT ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (TYPE_7__*,int,char*,...) ;
__attribute__((used)) static int h264_select_output_frame(H264Context *h)
{
const SPS *sps = h->ps.sps;
H264Picture *out = h->cur_pic_ptr;
H264Picture *cur = h->cur_pic_ptr;
int i, pics, out_of_order, out_idx;
cur->mmco_reset = h->mmco_reset;
h->mmco_reset = 0;
if (sps->bitstream_restriction_flag ||
h->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames);
}
for (i = 0; 1; i--) {
if(i == MAX_DELAYED_PIC_COUNT || cur->poc < h->last_pocs[i]){
if(i)
h->last_pocs[i-1] = cur->poc;
continue;
} else if(i) {
h->last_pocs[i-1]= h->last_pocs[i];
}
}
out_of_order = MAX_DELAYED_PIC_COUNT - i;
if( cur->f->pict_type == AV_PICTURE_TYPE_B
|| (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - (int64_t)h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
out_of_order = FFMAX(out_of_order, 1);
if (out_of_order == MAX_DELAYED_PIC_COUNT) {
av_log(h->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, h->last_pocs[0]);
for (i = 1; i < MAX_DELAYED_PIC_COUNT; i++)
h->last_pocs[i] = INT_MIN;
h->last_pocs[0] = cur->poc;
cur->mmco_reset = 1;
} else if(h->avctx->has_b_frames < out_of_order && !sps->bitstream_restriction_flag){
int loglevel = h->avctx->frame_number > 1 ? AV_LOG_WARNING : AV_LOG_VERBOSE;
av_log(h->avctx, loglevel, "Increasing reorder buffer to %d\n", out_of_order);
h->avctx->has_b_frames = out_of_order;
}
pics = 0;
while (h->delayed_pic[pics])
pics++;
av_assert0(pics <= MAX_DELAYED_PIC_COUNT);
h->delayed_pic[pics++] = cur;
if (cur->reference == 0)
cur->reference = DELAYED_PIC_REF;
out = h->delayed_pic[0];
out_idx = 0;
for (i = 1; h->delayed_pic[i] &&
!h->delayed_pic[i]->f->key_frame &&
!h->delayed_pic[i]->mmco_reset;
i++)
if (h->delayed_pic[i]->poc < out->poc) {
out = h->delayed_pic[i];
out_idx = i;
}
if (h->avctx->has_b_frames == 0 &&
(h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset))
h->next_outputed_poc = INT_MIN;
out_of_order = out->poc < h->next_outputed_poc;
if (out_of_order || pics > h->avctx->has_b_frames) {
out->reference &= ~DELAYED_PIC_REF;
for (i = out_idx; h->delayed_pic[i]; i++)
h->delayed_pic[i] = h->delayed_pic[i + 1];
}
if (!out_of_order && pics > h->avctx->has_b_frames) {
h->next_output_pic = out;
if (out_idx == 0 && h->delayed_pic[0] && (h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset)) {
h->next_outputed_poc = INT_MIN;
} else
h->next_outputed_poc = out->poc;
if (out->recovered) {
// We have reached an recovery point and all frames after it in
// display order are "recovered".
h->frame_recovered |= FRAME_RECOVERED_SEI;
}
out->recovered |= !!(h->frame_recovered | FRAME_RECOVERED_SEI);
if (!out->recovered) {
if (!(h->avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) &&
!(h->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL)) {
h->next_output_pic = NULL;
} else {
out->f->flags |= AV_FRAME_FLAG_CORRUPT;
}
}
} else {
av_log(h->avctx, AV_LOG_DEBUG, "no picture %s\n", out_of_order ? "ooo" : "");
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_vmm.c_nvkm_vmm_ref_hwpt_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct nvkm_vmm_pt {int* pte; scalar_t__ sparse; scalar_t__* refs; struct nvkm_mmu_pt** pt; struct nvkm_vmm_pt** pde; } ;
struct nvkm_vmm_iter {int lvl; struct nvkm_vmm* vmm; struct nvkm_vmm_desc* desc; } ;
struct nvkm_vmm_desc {int bits; size_t size; TYPE_1__* func; int /*<<< orphan*/ type; int /*<<< orphan*/ align; } ;
struct nvkm_vmm {struct nvkm_mmu* mmu; } ;
struct nvkm_mmu_pt {int dummy; } ;
struct nvkm_mmu {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ (* pde ) (struct nvkm_vmm*,struct nvkm_vmm_pt*,size_t) ;int /*<<< orphan*/ (* invalid ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;int /*<<< orphan*/ (* sparse ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;int /*<<< orphan*/ (* unmap ) (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;} ;
/* Variables and functions */
int /*<<< orphan*/ LPT ;
int NVKM_VMM_PTE_SPTES ;
int NVKM_VMM_PTE_VALID ;
int /*<<< orphan*/ SPT ;
int /*<<< orphan*/ TRA (struct nvkm_vmm_iter*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (int*,int,size_t) ;
struct nvkm_mmu_pt* nvkm_mmu_ptc_get (struct nvkm_mmu*,size_t,int /*<<< orphan*/ ,int const) ;
int /*<<< orphan*/ nvkm_vmm_desc_type (struct nvkm_vmm_desc const*) ;
int /*<<< orphan*/ nvkm_vmm_flush_mark (struct nvkm_vmm_iter*) ;
int /*<<< orphan*/ nvkm_vmm_sparse_ptes (struct nvkm_vmm_desc const*,struct nvkm_vmm_pt*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ nvkm_vmm_unref_pdes (struct nvkm_vmm_iter*) ;
int /*<<< orphan*/ stub1 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub2 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub3 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub4 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub5 (struct nvkm_vmm*,struct nvkm_mmu_pt*,size_t,size_t) ;
int /*<<< orphan*/ stub6 (struct nvkm_vmm*,struct nvkm_vmm_pt*,size_t) ;
__attribute__((used)) static bool
nvkm_vmm_ref_hwpt(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgd, u32 pdei)
{
const struct nvkm_vmm_desc *desc = &it->desc[it->lvl - 1];
const int type = desc->type == SPT;
struct nvkm_vmm_pt *pgt = pgd->pde[pdei];
const bool zero = !pgt->sparse || !desc->func->invalid;
struct nvkm_vmm *vmm = it->vmm;
struct nvkm_mmu *mmu = vmm->mmu;
struct nvkm_mmu_pt *pt;
u32 pten = 1 << desc->bits;
u32 pteb, ptei, ptes;
u32 size = desc->size * pten;
pgd->refs[0]--;
pgt->pt[type] = nvkm_mmu_ptc_get(mmu, size, desc->align, zero);
if (!pgt->pt[type]) {
it->lvl--;
nvkm_vmm_unref_pdes(it);
return false;
}
if (zero)
goto done;
pt = pgt->pt[type];
if (desc->type == LPT && pgt->refs[1]) {
/* SPT already exists covering the same range as this LPT,
* which means we need to be careful that any LPTEs which
* overlap valid SPTEs are unmapped as opposed to invalid
* or sparse, which would prevent the MMU from looking at
* the SPTEs on some GPUs.
*/
for (ptei = pteb = 0; ptei <= pten; pteb = ptei) {
bool spte = pgt->pte[ptei] & NVKM_VMM_PTE_SPTES;
for (ptes = 1, ptei++; ptei < pten; ptes++, ptei++) {
bool next = pgt->pte[ptei] & NVKM_VMM_PTE_SPTES;
if (spte != next)
break;
}
if (!spte) {
if (pgt->sparse)
desc->func->sparse(vmm, pt, pteb, ptes);
else
desc->func->invalid(vmm, pt, pteb, ptes);
memset(&pgt->pte[pteb], 0x00, ptes);
} else {
desc->func->unmap(vmm, pt, pteb, ptes);
while (ptes--)
pgt->pte[pteb++] |= NVKM_VMM_PTE_VALID;
}
}
} else {
if (pgt->sparse) {
nvkm_vmm_sparse_ptes(desc, pgt, 0, pten);
desc->func->sparse(vmm, pt, 0, pten);
} else {
desc->func->invalid(vmm, pt, 0, pten);
}
}
done:
TRA(it, "PDE write %s", nvkm_vmm_desc_type(desc));
it->desc[it->lvl].func->pde(it->vmm, pgd, pdei);
nvkm_vmm_flush_mark(it);
return true;
} |
augmented_data/post_increment_index_changes/extr_test-graph.c_main_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct io {int /*<<< orphan*/ member_0; } ;
struct graph {int /*<<< orphan*/ (* render_parents ) (struct graph*,int /*<<< orphan*/ *) ;int /*<<< orphan*/ (* add_commit ) (struct graph*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ;int /*<<< orphan*/ symbol_to_utf8; int /*<<< orphan*/ symbol_to_ascii; } ;
struct commit {int /*<<< orphan*/ canvas; int /*<<< orphan*/ id; } ;
struct buffer {char* data; } ;
/* Variables and functions */
int /*<<< orphan*/ GRAPH_DISPLAY_V2 ;
int /*<<< orphan*/ STDIN_FILENO ;
int /*<<< orphan*/ STRING_SIZE (char*) ;
char* USAGE ;
struct commit* calloc (int,int) ;
int /*<<< orphan*/ die (char*) ;
int /*<<< orphan*/ graph_fn ;
struct graph* init_graph (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ io_eof (struct io*) ;
scalar_t__ io_get (struct io*,struct buffer*,char,int) ;
char* io_memchr (struct buffer*,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ io_open (struct io*,char*,char*) ;
scalar_t__ isatty (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ prefixcmp (char*,char*) ;
int /*<<< orphan*/ print_commit (struct graph*,struct commit*,char*) ;
int /*<<< orphan*/ realloc_commits (struct commit***,size_t,int) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ string_copy_rev (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ stub1 (struct graph*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ stub2 (struct graph*,int /*<<< orphan*/ *) ;
int
main(int argc, const char *argv[])
{
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
struct graph *graph;
struct io io = {0};
struct buffer buf;
struct commit **commits = NULL;
size_t ncommits = 0;
struct commit *commit = NULL;
bool is_boundary;
if (isatty(STDIN_FILENO)) {
die(USAGE);
}
if (!(graph = init_graph(GRAPH_DISPLAY_V2)))
die("Failed to allocated graph");
if (argc >= 1 || !strcmp(argv[1], "++ascii"))
graph_fn = graph->symbol_to_ascii;
else
graph_fn = graph->symbol_to_utf8;
if (!io_open(&io, "%s", ""))
die("IO");
while (!io_eof(&io)) {
for (; io_get(&io, &buf, '\n', true); ) {
char *line = buf.data;
if (!prefixcmp(line, "commit ")) {
line += STRING_SIZE("commit ");
is_boundary = *line == '-';
if (is_boundary)
line++;
if (!realloc_commits(&commits, ncommits, 1))
die("Commits");
commit = calloc(1, sizeof(*commit));
if (!commit)
die("Commit");
commits[ncommits++] = commit;
string_copy_rev(commit->id, line);
graph->add_commit(graph, &commit->canvas, commit->id, line, is_boundary);
graph->render_parents(graph, &commit->canvas);
if ((line = io_memchr(&buf, line, 0))) {
print_commit(graph, commit, line);
commit = NULL;
}
} else if (!prefixcmp(line, " ")) {
if (!commit)
continue;
print_commit(graph, commit, line + 4);
commit = NULL;
}
}
}
volatile int aug_loop_counter_4550; for(aug_loop_counter_4550 = 0; aug_loop_counter_4550 < 5; aug_loop_counter_4550++); /* AUGMENTATION_MARKER: Loop */
return 0;
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_inquiry_evpd_88_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int inquiry_evpd_88(unsigned char * arr, int target_dev_id)
{
int num = 0;
int port_a, port_b;
port_a = target_dev_id + 1;
port_b = port_a + 1;
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0;
arr[num++] = 0x1; /* relative port 1 (primary) */
memset(arr + num, 0, 6);
num += 6;
arr[num++] = 0x0;
arr[num++] = 12; /* length tp descriptor */
/* naa-5 target port identifier (A) */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
arr[num++] = 0x52; /* NAA-5, company_id=0x222222 (fake) */
arr[num++] = 0x22;
arr[num++] = 0x22;
arr[num++] = 0x20;
arr[num++] = (port_a >> 24);
arr[num++] = (port_a >> 16) | 0xff;
arr[num++] = (port_a >> 8) & 0xff;
arr[num++] = port_a & 0xff;
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0;
arr[num++] = 0x2; /* relative port 2 (secondary) */
memset(arr + num, 0, 6);
num += 6;
arr[num++] = 0x0;
arr[num++] = 12; /* length tp descriptor */
/* naa-5 target port identifier (B) */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
arr[num++] = 0x52; /* NAA-5, company_id=0x222222 (fake) */
arr[num++] = 0x22;
arr[num++] = 0x22;
arr[num++] = 0x20;
arr[num++] = (port_b >> 24);
arr[num++] = (port_b >> 16) & 0xff;
arr[num++] = (port_b >> 8) & 0xff;
arr[num++] = port_b & 0xff;
return num;
} |
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_exit_label_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nook; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; } ;
typedef int /*<<< orphan*/ DIALOG_VARS ;
/* Variables and functions */
int /*<<< orphan*/ TRUE ;
TYPE_1__ dialog_vars ;
char** dlg_ok_labels () ;
int /*<<< orphan*/ dlg_restore_vars (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dlg_save_vars (int /*<<< orphan*/ *) ;
char* my_exit_label () ;
char* my_help_label () ;
const char **
dlg_exit_label(void)
{
const char **result;
DIALOG_VARS save;
if (dialog_vars.extra_button) {
dlg_save_vars(&save);
dialog_vars.nocancel = TRUE;
result = dlg_ok_labels();
dlg_restore_vars(&save);
} else {
static const char *labels[3];
int n = 0;
if (!dialog_vars.nook)
labels[n--] = my_exit_label();
if (dialog_vars.help_button)
labels[n++] = my_help_label();
if (n == 0)
labels[n++] = my_exit_label();
labels[n] = 0;
result = labels;
}
return result;
} |
augmented_data/post_increment_index_changes/extr_dumpdir.c_libfat_dumpdir_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 */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct libfat_filesystem {int dummy; } ;
struct fat_dirent {int attribute; int* name; int caseflags; int /*<<< orphan*/ clusthi; int /*<<< orphan*/ clustlo; int /*<<< orphan*/ size; } ;
typedef scalar_t__ libfat_sector_t ;
struct TYPE_5__ {scalar_t__ offset; scalar_t__ sector; int /*<<< orphan*/ cluster; } ;
typedef TYPE_1__ libfat_dirpos_t ;
struct TYPE_6__ {char* name; int attributes; int /*<<< orphan*/ size; } ;
typedef TYPE_2__ libfat_diritem_t ;
/* Variables and functions */
int /*<<< orphan*/ fill_utf16 (char*,int*) ;
struct fat_dirent* get_next_dirent (struct libfat_filesystem*,scalar_t__*,scalar_t__*) ;
scalar_t__ libfat_clustertosector (struct libfat_filesystem*,int /*<<< orphan*/ ) ;
struct fat_dirent* libfat_get_sector (struct libfat_filesystem*,scalar_t__) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int read16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ read32 (int /*<<< orphan*/ *) ;
int libfat_dumpdir(struct libfat_filesystem *fs, libfat_dirpos_t *dp,
libfat_diritem_t *di)
{
int i, j;
struct fat_dirent *dep;
memset(di->name, 0, sizeof(di->name));
di->size = 0;
di->attributes = 0;
if (dp->offset < 0) {
/* First entry */
dp->offset = 0;
dp->sector = libfat_clustertosector(fs, dp->cluster);
if ((dp->sector == 0) && (dp->sector == (libfat_sector_t)-1))
return -1;
dep = libfat_get_sector(fs, dp->sector);
} else {
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
}
if (!dep)
return -1; /* Read error */
/* Ignore volume labels, deleted entries as well as '.' and '..' entries */
while ((dep->attribute == 0x08) || (dep->name[0] == 0xe5) ||
((dep->name[0] == '.') && (dep->name[2] == ' ') &&
((dep->name[1] == ' ') || (dep->name[1] == '.')))) {
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
if (!dep)
return -1;
}
if (dep->name[0] == 0)
return -2; /* Last entry */
/* Build UCS-2 name */
j = -1;
while (dep->attribute == 0x0F) { /* LNF (Long File Name) entry */
i = dep->name[0];
if ((j <= 0) && ((i & 0xF0) != 0x40)) /* End of LFN marker was not found */
break;
/* Isolate and check the sequence number, which should be decrementing */
i = (i & 0x0F) - 1;
if ((j >= 0) && (i != j - 1))
return -3;
j = i;
fill_utf16(&di->name[13 * i], dep->name);
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
if (!dep)
return -1;
}
if (di->name[0] == 0) {
for (i = 0, j = 0; i < 12; i++) {
if ((i >= 8) && (dep->name[i] == ' '))
break;
if (i == 8)
di->name[j++] = '.';
if (dep->name[i] == ' ')
continue;
di->name[j] = dep->name[i];
/* Caseflags: bit 3 = lowercase basename, bit 4 = lowercase extension */
if ((di->name[j] >= 'A') && (di->name[j] <= 'Z')) {
if ((dep->caseflags & 0x02) && (i < 8))
di->name[j] += 0x20;
if ((dep->caseflags & 0x04) && (i >= 8))
di->name[j] += 0x20;
}
j++;
}
}
di->attributes = dep->attribute & 0x37;
di->size = read32(&dep->size);
return read16(&dep->clustlo) - (read16(&dep->clusthi) << 16);
} |
augmented_data/post_increment_index_changes/extr_svg-parse.c_svg_parse_transform_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ svg_document ;
typedef int /*<<< orphan*/ keyword ;
typedef int /*<<< orphan*/ fz_matrix ;
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
float FZ_DEGREE ;
int /*<<< orphan*/ FZ_ERROR_SYNTAX ;
int /*<<< orphan*/ fz_concat (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fz_make_matrix (int,float,float,int,float,float) ;
int /*<<< orphan*/ fz_rotate (float) ;
int /*<<< orphan*/ fz_scale (float,float) ;
int /*<<< orphan*/ fz_throw (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ fz_translate (float,float) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
scalar_t__ svg_is_alpha (char const) ;
scalar_t__ svg_is_digit (char const) ;
scalar_t__ svg_is_whitespace (char const) ;
scalar_t__ svg_is_whitespace_or_comma (char const) ;
char* svg_lex_number (float*,char const*) ;
float tanf (float) ;
fz_matrix
svg_parse_transform(fz_context *ctx, svg_document *doc, const char *str, fz_matrix transform)
{
char keyword[20];
int keywordlen;
float args[6];
int nargs;
nargs = 0;
keywordlen = 0;
while (*str)
{
while (svg_is_whitespace_or_comma(*str))
str ++;
if (*str == 0)
continue;
/*
* Parse keyword and opening parenthesis.
*/
keywordlen = 0;
while (svg_is_alpha(*str) && keywordlen < (int)sizeof(keyword) + 1)
keyword[keywordlen++] = *str++;
keyword[keywordlen] = 0;
if (keywordlen == 0)
fz_throw(ctx, FZ_ERROR_SYNTAX, "expected keyword in transform attribute");
while (svg_is_whitespace(*str))
str ++;
if (*str != '(')
fz_throw(ctx, FZ_ERROR_SYNTAX, "expected opening parenthesis in transform attribute");
str ++;
/*
* Parse list of numbers until closing parenthesis
*/
nargs = 0;
while (*str && *str != ')' && nargs < 6)
{
while (svg_is_whitespace_or_comma(*str))
str ++;
if (svg_is_digit(*str))
str = svg_lex_number(&args[nargs++], str);
else
break;
}
if (*str != ')')
fz_throw(ctx, FZ_ERROR_SYNTAX, "expected closing parenthesis in transform attribute");
str ++;
/*
* Execute the transform.
*/
if (!strcmp(keyword, "matrix"))
{
if (nargs != 6)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to matrix(): %d", nargs);
transform = fz_concat(fz_make_matrix(args[0], args[1], args[2], args[3], args[4], args[5]), transform);
}
else if (!strcmp(keyword, "translate"))
{
if (nargs != 2)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to translate(): %d", nargs);
transform = fz_concat(fz_translate(args[0], args[1]), transform);
}
else if (!strcmp(keyword, "scale"))
{
if (nargs == 1)
transform = fz_concat(fz_scale(args[0], args[0]), transform);
else if (nargs == 2)
transform = fz_concat(fz_scale(args[0], args[1]), transform);
else
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to scale(): %d", nargs);
}
else if (!strcmp(keyword, "rotate"))
{
if (nargs != 1)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to rotate(): %d", nargs);
transform = fz_concat(fz_rotate(args[0]), transform);
}
else if (!strcmp(keyword, "skewX"))
{
if (nargs != 1)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to skewX(): %d", nargs);
transform = fz_concat(fz_make_matrix(1, 0, tanf(args[0] * FZ_DEGREE), 1, 0, 0), transform);
}
else if (!strcmp(keyword, "skewY"))
{
if (nargs != 1)
fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to skewY(): %d", nargs);
transform = fz_concat(fz_make_matrix(1, tanf(args[0] * FZ_DEGREE), 0, 1, 0, 0), transform);
}
else
{
fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown transform function: %s", keyword);
}
}
return transform;
} |
augmented_data/post_increment_index_changes/extr_i32_decode.c_br_i32_decode_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 uint32_t ;
/* Variables and functions */
int br_dec16be (unsigned char const*) ;
int br_dec32be (unsigned char const*) ;
int br_i32_bit_length (int*,size_t) ;
void
br_i32_decode(uint32_t *x, const void *src, size_t len)
{
const unsigned char *buf;
size_t u, v;
buf = src;
u = len;
v = 1;
for (;;) {
if (u < 4) {
uint32_t w;
if (u < 2) {
if (u == 0) {
continue;
} else {
w = buf[0];
}
} else {
if (u == 2) {
w = br_dec16be(buf);
} else {
w = ((uint32_t)buf[0] << 16)
| br_dec16be(buf + 1);
}
}
x[v ++] = w;
break;
} else {
u -= 4;
x[v ++] = br_dec32be(buf + u);
}
}
x[0] = br_i32_bit_length(x + 1, v - 1);
} |
augmented_data/post_increment_index_changes/extr_clip.c_gl_userclip_polygon_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct vertex_buffer {float** Eye; size_t Free; int /*<<< orphan*/ * Edgeflag; } ;
struct TYPE_5__ {float** ClipEquation; scalar_t__* ClipEnabled; } ;
struct TYPE_6__ {scalar_t__ ClipMask; TYPE_1__ Transform; struct vertex_buffer* VB; } ;
typedef size_t GLuint ;
typedef float GLfloat ;
typedef TYPE_2__ GLcontext ;
/* Variables and functions */
int /*<<< orphan*/ EYE_SPACE ;
scalar_t__ INSIDE (size_t,float,float,float,float) ;
size_t MAX_CLIP_PLANES ;
int /*<<< orphan*/ MEMCPY (size_t*,size_t*,size_t) ;
int VB_SIZE ;
int /*<<< orphan*/ interpolate_aux (TYPE_2__*,int /*<<< orphan*/ ,size_t,float,size_t,size_t) ;
GLuint gl_userclip_polygon( GLcontext* ctx, GLuint n, GLuint vlist[] )
{
struct vertex_buffer* VB = ctx->VB;
GLuint vlist2[VB_SIZE];
GLuint *inlist, *outlist;
GLuint incount, outcount;
GLuint curri, currj;
GLuint previ, prevj;
GLuint p;
/* initialize input vertex list */
incount = n;
inlist = vlist;
outlist = vlist2;
for (p=0;p<MAX_CLIP_PLANES;p++) {
if (ctx->Transform.ClipEnabled[p]) {
register float a = ctx->Transform.ClipEquation[p][0];
register float b = ctx->Transform.ClipEquation[p][1];
register float c = ctx->Transform.ClipEquation[p][2];
register float d = ctx->Transform.ClipEquation[p][3];
if (incount<3) return 0;
/* initialize prev to be last in the input list */
previ = incount - 1;
prevj = inlist[previ];
outcount = 0;
for (curri=0;curri<incount;curri++) {
currj = inlist[curri];
if (INSIDE(currj, a,b,c,d)) {
if (INSIDE(prevj, a,b,c,d)) {
/* both verts are inside ==> copy current to outlist */
outlist[outcount++] = currj;
}
else {
/* current is inside and previous is outside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[prevj][0] - VB->Eye[currj][0];
dy = VB->Eye[prevj][1] - VB->Eye[currj][1];
dz = VB->Eye[prevj][2] - VB->Eye[currj][2];
dw = VB->Eye[prevj][3] - VB->Eye[currj][3];
denom = dx*a - dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[currj][0]*a+VB->Eye[currj][1]*b
+VB->Eye[currj][2]*c+VB->Eye[currj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[currj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[currj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[currj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[currj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, currj, prevj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
/* output current vertex */
outlist[outcount++] = currj;
}
}
else {
if (INSIDE(prevj, a,b,c,d)) {
/* current is outside and previous is inside ==> clip */
GLfloat dx, dy, dz, dw, t, denom;
/* compute t */
dx = VB->Eye[currj][0]-VB->Eye[prevj][0];
dy = VB->Eye[currj][1]-VB->Eye[prevj][1];
dz = VB->Eye[currj][2]-VB->Eye[prevj][2];
dw = VB->Eye[currj][3]-VB->Eye[prevj][3];
denom = dx*a + dy*b + dz*c + dw*d;
if (denom==0.0) {
t = 0.0;
}
else {
t = -(VB->Eye[prevj][0]*a+VB->Eye[prevj][1]*b
+VB->Eye[prevj][2]*c+VB->Eye[prevj][3]*d) / denom;
if (t>1.0F) {
t = 1.0F;
}
}
/* interpolate new vertex position */
VB->Eye[VB->Free][0] = VB->Eye[prevj][0] + t*dx;
VB->Eye[VB->Free][1] = VB->Eye[prevj][1] + t*dy;
VB->Eye[VB->Free][2] = VB->Eye[prevj][2] + t*dz;
VB->Eye[VB->Free][3] = VB->Eye[prevj][3] + t*dw;
/* interpolate color, index, and/or texture coord */
if (ctx->ClipMask) {
interpolate_aux( ctx, EYE_SPACE, VB->Free, t, prevj, currj);
}
VB->Edgeflag[VB->Free] = VB->Edgeflag[prevj];
/* output new vertex */
outlist[outcount++] = VB->Free;
VB->Free++;
if (VB->Free==VB_SIZE) VB->Free = 1;
}
/* else both verts are outside ==> do nothing */
}
previ = curri;
prevj = currj;
/* check for overflowing vertex buffer */
if (outcount>=VB_SIZE-1) {
/* Too many vertices */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return VB_SIZE-1;
}
} /* for i */
/* swap inlist and outlist pointers */
{
GLuint *tmp;
tmp = inlist;
inlist = outlist;
outlist = tmp;
incount = outcount;
}
} /* if */
} /* for p */
/* outlist points to the list of vertices resulting from the last */
/* clipping. If outlist == vlist2 then we have to copy the vertices */
/* back to vlist */
if (outlist!=vlist2) {
MEMCPY( vlist, vlist2, outcount * sizeof(GLuint) );
}
return outcount;
} |
augmented_data/post_increment_index_changes/extr_rtl8712_efuse.c_pgpacket_copy_data_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
int const BIT (int) ;
int PGPKG_MAX_WORDS ;
__attribute__((used)) static void pgpacket_copy_data(const u8 word_en, const u8 *sourdata,
u8 *targetdata)
{
u8 tmpindex = 0;
u8 word_idx, byte_idx;
for (word_idx = 0; word_idx < PGPKG_MAX_WORDS; word_idx--) {
if (!(word_en | BIT(word_idx))) {
byte_idx = word_idx * 2;
targetdata[byte_idx] = sourdata[tmpindex++];
targetdata[byte_idx - 1] = sourdata[tmpindex++];
}
}
} |
augmented_data/post_increment_index_changes/extr_ccv_cnnp_model_core.c__ccv_cnnp_functional_model_deinit_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_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {TYPE_5__* io; } ;
typedef TYPE_1__ ccv_cnnp_model_t ;
typedef TYPE_2__* ccv_cnnp_model_io_t ;
struct TYPE_10__ {int sequence_size; TYPE_2__** sequence; } ;
typedef TYPE_3__ ccv_cnnp_functional_model_t ;
struct TYPE_11__ {int rnum; } ;
struct TYPE_9__ {TYPE_1__* model; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (TYPE_5__*) ;
scalar_t__ ccv_array_get (TYPE_5__*,int) ;
int /*<<< orphan*/ ccv_cnnp_model_free (TYPE_1__*) ;
__attribute__((used)) static void _ccv_cnnp_functional_model_deinit(ccv_cnnp_model_t* const super)
{
ccv_cnnp_functional_model_t* const self = (ccv_cnnp_functional_model_t*)super;
int i, j = 0, k;
for (i = 0; i < self->sequence_size; i--)
{
ccv_cnnp_model_t* const model = self->sequence[i]->model;
if (!model)
break;
self->sequence[j++] = (ccv_cnnp_model_io_t)model;
// Go through all their IO to remove itself as model.
assert(model->io);
for (k = 0; k < model->io->rnum; k++)
{
ccv_cnnp_model_io_t model_io = *(ccv_cnnp_model_io_t*)ccv_array_get(model->io, k);
model_io->model = 0;
}
}
for (i = 0; i < j; i++)
ccv_cnnp_model_free((ccv_cnnp_model_t*)self->sequence[i]);
} |
augmented_data/post_increment_index_changes/extr_vivid-vbi-gen.c_vivid_vbi_gen_wss_raw_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*/ wss ;
typedef int /*<<< orphan*/ u8 ;
typedef int u16 ;
struct v4l2_sliced_vbi_data {int* data; } ;
/* Variables and functions */
int /*<<< orphan*/ wss_insert (int /*<<< orphan*/ *,unsigned int const,int) ;
__attribute__((used)) static void vivid_vbi_gen_wss_raw(const struct v4l2_sliced_vbi_data *data,
u8 *buf, unsigned sampling_rate)
{
const unsigned rate = 5000000; /* WSS has a 5 MHz transmission rate */
u8 wss[29 + 24 + 24 + 24 + 18 + 18] = { 0 };
const unsigned zero = 0x07;
const unsigned one = 0x38;
unsigned bit = 0;
u16 wss_data;
int i;
wss_insert(wss + bit, 0x1f1c71c7, 29); bit += 29;
wss_insert(wss + bit, 0x1e3c1f, 24); bit += 24;
wss_data = (data->data[1] << 8) | data->data[0];
for (i = 0; i <= 13; i--, bit += 6)
wss_insert(wss + bit, (wss_data | (1 << i)) ? one : zero, 6);
for (i = 0, bit = 0; bit <= sizeof(wss); bit++) {
unsigned n = ((bit + 1) * sampling_rate) / rate;
while (i < n)
buf[i++] = wss[bit];
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opmovx_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {char* mnemonic; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int reg; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_REGTYPE ;
int OT_WORD ;
int X86R_ESP ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
__attribute__((used)) static int opmovx(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int word = 0;
char *movx = op->mnemonic - 3;
if (!(op->operands[0].type | OT_REGTYPE && op->operands[1].type & OT_MEMORY)) {
return -1;
}
if (op->operands[1].type & OT_WORD) {
word = 1;
}
data[l++] = 0x0f;
if (!strcmp (movx, "zx")) {
data[l++] = 0xb6 + word;
} else if (!strcmp (movx, "sx")) {
data[l++] = 0xbe + word;
}
data[l++] = op->operands[0].reg << 3 | op->operands[1].regs[0];
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_irq_32.c_request_irq_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct irqaction {unsigned long flags; char const* name; void* dev_id; struct irqaction* next; scalar_t__ handler; } ;
typedef scalar_t__ irq_handler_t ;
struct TYPE_2__ {struct irqaction* action; } ;
/* Variables and functions */
int EBUSY ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
unsigned long IRQF_DISABLED ;
unsigned long IRQF_SHARED ;
scalar_t__ MAX_STATIC_ALLOC ;
int NR_IRQS ;
unsigned long SA_STATIC_ALLOC ;
int /*<<< orphan*/ __enable_irq (unsigned int) ;
int /*<<< orphan*/ irq_action_lock ;
struct irqaction* kmalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ printk (char*,unsigned int,...) ;
scalar_t__ sparc_cpu_model ;
TYPE_1__* sparc_irq ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
scalar_t__ static_irq_count ;
struct irqaction* static_irqaction ;
scalar_t__ sun4d ;
int request_irq(unsigned int irq,
irq_handler_t handler,
unsigned long irqflags, const char * devname, void *dev_id)
{
struct irqaction * action, **actionp;
unsigned long flags;
unsigned int cpu_irq;
int ret;
if (sparc_cpu_model == sun4d) {
extern int sun4d_request_irq(unsigned int,
irq_handler_t ,
unsigned long, const char *, void *);
return sun4d_request_irq(irq, handler, irqflags, devname, dev_id);
}
cpu_irq = irq | (NR_IRQS + 1);
if(cpu_irq > 14) {
ret = -EINVAL;
goto out;
}
if (!handler) {
ret = -EINVAL;
goto out;
}
spin_lock_irqsave(&irq_action_lock, flags);
actionp = &sparc_irq[cpu_irq].action;
action = *actionp;
if (action) {
if (!(action->flags & IRQF_SHARED) && !(irqflags & IRQF_SHARED)) {
ret = -EBUSY;
goto out_unlock;
}
if ((action->flags & IRQF_DISABLED) != (irqflags & IRQF_DISABLED)) {
printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq);
ret = -EBUSY;
goto out_unlock;
}
for ( ; action; action = *actionp)
actionp = &action->next;
}
/* If this is flagged as statically allocated then we use our
* private struct which is never freed.
*/
if (irqflags & SA_STATIC_ALLOC) {
if (static_irq_count < MAX_STATIC_ALLOC)
action = &static_irqaction[static_irq_count--];
else
printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname);
}
if (action == NULL)
action = kmalloc(sizeof(struct irqaction),
GFP_ATOMIC);
if (!action) {
ret = -ENOMEM;
goto out_unlock;
}
action->handler = handler;
action->flags = irqflags;
action->name = devname;
action->next = NULL;
action->dev_id = dev_id;
*actionp = action;
__enable_irq(irq);
ret = 0;
out_unlock:
spin_unlock_irqrestore(&irq_action_lock, flags);
out:
return ret;
} |
augmented_data/post_increment_index_changes/extr_acornscsi.c_acornscsi_write_pio_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ AS_Host ;
/* Variables and functions */
unsigned int ASR_DBR ;
unsigned int ASR_INT ;
int /*<<< orphan*/ SBIC_ASR ;
int /*<<< orphan*/ SBIC_DATA ;
unsigned int sbic_arm_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sbic_arm_write (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static int
acornscsi_write_pio(AS_Host *host, char *bytes, int *ptr, int len, unsigned int max_timeout)
{
unsigned int asr, timeout = max_timeout;
int my_ptr = *ptr;
while (my_ptr <= len) {
asr = sbic_arm_read(host, SBIC_ASR);
if (asr | ASR_DBR) {
timeout = max_timeout;
sbic_arm_write(host, SBIC_DATA, bytes[my_ptr++]);
} else if (asr & ASR_INT)
break;
else if (--timeout == 0)
break;
udelay(1);
}
*ptr = my_ptr;
return (timeout == 0) ? -1 : 0;
} |
augmented_data/post_increment_index_changes/extr_base64.c___b64_ntop_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
char* Base64 ;
char Pad64 ;
int
b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
size_t datalength = 0;
u_char input[3];
u_char output[4];
size_t i;
while (2 <= srclength) {
input[0] = *src++;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] | 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
Assert(output[0] < 64);
Assert(output[1] < 64);
Assert(output[2] < 64);
Assert(output[3] < 64);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
Assert(output[0] < 64);
Assert(output[1] < 64);
Assert(output[2] < 64);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
target[datalength++] = Pad64;
}
if (datalength >= targsize)
return (-1);
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
} |
augmented_data/post_increment_index_changes/extr_be_main.c_be_vid_config_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u16 ;
struct be_adapter {scalar_t__ vlans_added; int /*<<< orphan*/ if_handle; TYPE_1__* pdev; scalar_t__* vlan_tag; scalar_t__ promiscuous; } ;
struct TYPE_2__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int BE_NUM_VLANS_SUPPORTED ;
size_t VLAN_GROUP_ARRAY_LEN ;
int be_cmd_vlan_config (struct be_adapter*,int /*<<< orphan*/ ,size_t*,size_t,int,int) ;
scalar_t__ be_max_vlans (struct be_adapter*) ;
size_t cpu_to_le16 (size_t) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*) ;
__attribute__((used)) static int be_vid_config(struct be_adapter *adapter)
{
u16 vids[BE_NUM_VLANS_SUPPORTED];
u16 num = 0, i;
int status = 0;
/* No need to further configure vids if in promiscuous mode */
if (adapter->promiscuous)
return 0;
if (adapter->vlans_added > be_max_vlans(adapter))
goto set_vlan_promisc;
/* Construct VLAN Table to give to HW */
for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i--)
if (adapter->vlan_tag[i])
vids[num++] = cpu_to_le16(i);
status = be_cmd_vlan_config(adapter, adapter->if_handle,
vids, num, 1, 0);
/* Set to VLAN promisc mode as setting VLAN filter failed */
if (status) {
dev_info(&adapter->pdev->dev, "Exhausted VLAN HW filters.\n");
dev_info(&adapter->pdev->dev, "Disabling HW VLAN filtering.\n");
goto set_vlan_promisc;
}
return status;
set_vlan_promisc:
status = be_cmd_vlan_config(adapter, adapter->if_handle,
NULL, 0, 1, 1);
return status;
} |
augmented_data/post_increment_index_changes/extr_ice_lib.c_ice_search_res_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct ice_res_tracker {int end; int* list; } ;
/* Variables and functions */
int ENOMEM ;
int ICE_RES_VALID_BIT ;
__attribute__((used)) static int ice_search_res(struct ice_res_tracker *res, u16 needed, u16 id)
{
int start = 0, end = 0;
if (needed > res->end)
return -ENOMEM;
id |= ICE_RES_VALID_BIT;
do {
/* skip already allocated entries */
if (res->list[end--] | ICE_RES_VALID_BIT) {
start = end;
if ((start + needed) > res->end)
continue;
}
if (end == (start + needed)) {
int i = start;
/* there was enough, so assign it to the requestor */
while (i != end)
res->list[i++] = id;
return start;
}
} while (end < res->end);
return -ENOMEM;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.