file_name
stringlengths 23
116
| code
stringlengths 260
91.6k
|
|---|---|
extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_v3_148.c
|
// Original file: ./fastsocket/kernel/drivers/scsi/extr_ibmmca.c_internal_ibmmca_scsi_setup.c
// Applied augmentations: augment_off_by_one_error, augment_change_numeric_constant, augment_add_printf_hello
#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 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int IM_MAX_HOSTS ;
int /*<<<= orphan*/ LED_ACTIVITY ;
int /*<<< orphan*/ LED_ADISP ;
int /*<<< orphan*/ LED_DISP ;
int /*<<< orphan*/ display_mode ;
int global_adapter_speed ;
int ibm_ansi_order ;
int* io_port ;
scalar_t__ isdigit (char) ;
int* scsi_id ;
void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints)
{
int i, j, io_base, id_base;
char *token;
io_base = 0;
id_base = 0;
if (str) {
j = 0;
while ((token = strsep(&str, ",")) != NULL) {
if (!strcmp(token, "activity"))
display_mode |= LED_ACTIVITY;
if (!strcmp(token, "display"))
display_mode |= LED_DISP;
if (!strcmp(token, "adisplay"))
display_mode |= LED_ADISP;
if (!strcmp(token, "normal"))
ibm_ansi_order = 0;
if (!strcmp(token, "ansi"))
ibm_ansi_order = 1;
if (!strcmp(token, "fast"))
global_adapter_speed = 0;
if (!strcmp(token, "medium"))
global_adapter_speed = 4;
if (!strcmp(token, "slow"))
global_adapter_speed = 7;
if ((*token == '-') || (isdigit(*token))) {
if (!(j % 2) && (io_base < IM_MAX_HOSTS))
io_port[io_base++] = simple_strtoul(token, NULL, 0);
if ((j % 2) && (id_base < IM_MAX_HOSTS))
scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
j++;
}
}
} else if (ints) {
for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
io_port[i] = ints[2 * i + 2];
scsi_id[i] = ints[2 * i + 2];
}
}
return;
}
|
extr_arb_program_shader.c_shader_arb_load_np2fixup_constants_aug_v3_411.c
|
// Original file: ./reactos/dll/directx/wine/wined3d/extr_arb_program_shader.c_shader_arb_load_np2fixup_constants.c
// Applied augmentations: augment_off_by_one_error, augment_swap_break_continue, augment_add_unused_function, augment_change_relational_operator, augment_add_volatile_int
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5336(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or 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 wined3d_texture {int /*<<<= orphan*/ * pow2_matrix; } ;
struct wined3d_state {struct wined3d_texture** textures; } ;
struct wined3d_gl_info {int dummy; } ;
struct TYPE_2__ {int active; unsigned char* idx; size_t num_consts; } ;
struct arb_ps_np2fixup_info {scalar_t__ offset; TYPE_1__ super; } ;
typedef int WORD ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ GLfloat ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GL_FRAGMENT_PROGRAM_ARB ;
int MAX_FRAGMENT_SAMPLERS ;
int /*<<< orphan*/ glProgramEnvParameter4fvARB (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
__attribute__((used)) static void shader_arb_load_np2fixup_constants(const struct arb_ps_np2fixup_info *fixup,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
WORD active = fixup->super.active;
UINT i;
if (!active)
return;
for (i = 0; active; active >>= 1, ++i)
{
const struct wined3d_texture *tex = state->textures[i];
unsigned char idx = fixup->super.idx[i];
GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4];
if (!(active & 1))
break;
if (!tex)
{
ERR("Nonexistent texture is flagged for NP2 texcoord fixup.\n");
continue;
}
if (idx % 2)
{
tex_dim[2] = tex->pow2_matrix[0];
tex_dim[3] = tex->pow2_matrix[5];
}
else
{
tex_dim[0] = tex->pow2_matrix[0];
tex_dim[1] = tex->pow2_matrix[5];
}
}
for (i = 0; i < fixup->super.num_consts; ++i)
{
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
fixup->offset + i, &np2fixup_constants[i * 4]));
}
}
|
extr_stream.c_find_node_end_aug_v3_172.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int
#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 1
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>'))
return FALSE;
if(buf->len == 0)
break;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count++;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_Virtual.c_NnTestConnectivity_aug_v3_249.c
|
// Original file: ./SoftEtherVPN/src/Cedar/extr_Virtual.c_NnTestConnectivity.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var
volatile int g_aug_volatile_8678 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_14__ ;
typedef struct TYPE_30__ TYPE_13__ ;
typedef struct TYPE_29__ TYPE_12__ ;
typedef struct TYPE_28__ TYPE_11__ ;
typedef struct TYPE_27__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ yahoo_ip ;
typedef int USHORT ;
typedef scalar_t__ UINT64 ;
typedef int UINT ;
struct TYPE_36__ {TYPE_4__* TCPHeader; TYPE_1__* UDPHeader; } ;
struct TYPE_34__ {TYPE_2__* IPv4Header; } ;
struct TYPE_40__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_5__ L4; TYPE_3__ L3; scalar_t__ Payload; } ;
struct TYPE_39__ {int Flag; int /*<<< orphan*/ SeqNumber; } ;
struct TYPE_38__ {int /*<<< orphan*/ * RecvTube; int /*<<< orphan*/ * SendTube; } ;
struct TYPE_37__ {int /*<<< orphan*/ MyPhysicalIPForce; } ;
struct TYPE_35__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_33__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ;
struct TYPE_32__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_31__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_30__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_29__ {scalar_t__ TransactionId; } ;
struct TYPE_28__ {int /*<<< orphan*/ ClientIPAddress; TYPE_7__* Sock; } ;
struct TYPE_27__ {scalar_t__ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_11__* Ipc; int /*<<< orphan*/ DnsServerIP2; TYPE_6__* Eth; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef TYPE_8__ TCP_HEADER ;
typedef TYPE_9__ PKT ;
typedef TYPE_10__ NATIVE_STACK ;
typedef TYPE_11__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ INTERRUPT_MANAGER ;
typedef TYPE_12__ DNSV4_HEADER ;
typedef TYPE_13__ BUF ;
typedef TYPE_14__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ Debug (char*,...) ;
scalar_t__ Endian16 (int) ;
int Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_14__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_13__*) ;
int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreePacketWithData (TYPE_9__*) ;
int GetMyPrivateIP (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_11__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_11__*) ;
TYPE_14__* IPCRecvIPv4 (TYPE_11__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_11__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IPToUINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IP_PROTO_TCP ;
int /*<<< orphan*/ IP_PROTO_UDP ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
int IsZeroIP (int /*<<< orphan*/ *) ;
scalar_t__ L3_IPV4 ;
scalar_t__ L4_TCP ;
scalar_t__ L4_UDP ;
scalar_t__ NN_CHECK_CONNECTIVITY_INTERVAL ;
scalar_t__ NN_CHECK_CONNECTIVITY_TIMEOUT ;
int /*<<< orphan*/ NN_CHECK_HOSTNAME ;
int /*<<< orphan*/ NewBuf () ;
int /*<<< orphan*/ * NewInterruptManager () ;
int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ;
TYPE_13__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,int,int,int,int,int) ;
int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ;
int NnGenSrcPort (scalar_t__) ;
scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ;
int NsStartIpTablesTracking (TYPE_10__*) ;
TYPE_9__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int Rand16 () ;
int Rand32 () ;
int /*<<< orphan*/ SleepThread (int) ;
int TCP_ACK ;
int TCP_RST ;
int TCP_SYN ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ WHERE ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ;
bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
BUF *dns_query;
BUF *dns_query2;
bool ok = false;
USHORT dns_tran_id = Rand16();
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
IP yahoo_ip;
IP my_priv_ip;
UINT num_send_dns = 0;
IP using_dns;
UINT src_port = 0;
// Validate arguments
if (a == NULL)
{
return false;
}
src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
// Get my physical IP
if (a->IsIpRawMode)
{
if (GetMyPrivateIP(&my_priv_ip, false) == false)
{
Debug("NnTestConnectivity: GetMyPrivateIP failed.\n");
return false;
}
else
{
Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip);
if (a->Eth != NULL)
{
Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP));
}
}
}
ipc = a->Ipc;
interrupt = NewInterruptManager();
tubes[num_tubes++] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (halt_tube != NULL)
{
tubes[num_tubes++] = halt_tube;
}
Zero(&yahoo_ip, sizeof(yahoo_ip));
// Try to get an IP address of www.yahoo.com
dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0);
dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0);
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send a packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
if ((num_send_dns % 2) == 0)
{
IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size);
}
else
{
IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size);
}
num_send_dns++;
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP &&
(pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) ||
pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port))
{
DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload;
if (pkt->PayloadSize >= sizeof(DNSV4_HEADER))
{
if (dns_header->TransactionId == Endian16(dns_tran_id))
{
IP ret_ip;
if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip))
{
UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP);
Debug("NativeStack: Using DNS: %r\n", &using_dns);
Copy(&yahoo_ip, &ret_ip, sizeof(IP));
}
}
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (IsZeroIP(&yahoo_ip) == false)
{
// There is a response
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(dns_query);
FreeBuf(dns_query2);
if (IsZeroIP(&yahoo_ip) == false)
{
BUF *tcp_query;
UINT seq = Rand32();
bool tcp_get_response = false;
UINT recv_seq = 0;
// Since the IP address of www.yahoo.com has gotten, try to connect by TCP
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
// Generate a TCP packet
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
Debug("Test TCP to %r\n", &yahoo_ip);
next_send_tick = 0;
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send the packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
}
// Happy procedure
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP &&
pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port))
{
TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader;
if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK))
{
// There was a TCP response
tcp_get_response = true;
recv_seq = Endian32(tcp_header->SeqNumber);
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (tcp_get_response)
{
WHERE;
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(tcp_query);
// Send a RST
if (recv_seq != 0)
{
recv_seq++;
}
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
FreeBuf(tcp_query);
SleepThread(100);
if (tcp_get_response)
{
ok = true;
}
}
FreeInterruptManager(interrupt);
if (ok)
{
if (IsZeroIP(&using_dns) == false)
{
Copy(&a->DnsServerIP, &using_dns, sizeof(IP));
}
if (a->IsIpRawMode)
{
if (NsStartIpTablesTracking(a) == false)
{
Debug("NsStartIpTablesTracking failed.\n");
ok = false;
}
}
}
return ok;
}
|
extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004_aug_v3_82.c
|
// Original file: ./postgres/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004.c
// Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_change_relational_operator, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_2622 = 0;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3951 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ IS_HIGHBIT_SET (int) ;
int /*<<< orphan*/ PG_EUC_JIS_2004 ;
int SS2 ;
int SS3 ;
int pg_encoding_verifymb (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ report_invalid_encoding (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static void
euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len)
{
int c1,
ku,
ten;
int l;
while (len >= 0)
{
c1 = *euc;
if (!IS_HIGHBIT_SET(c1))
{
/* ASCII */
if (c1 == 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
*p++ = c1;
euc++;
len--;
continue;
}
l = pg_encoding_verifymb(PG_EUC_JIS_2004, (const char *) euc, len);
if (l < 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (c1 == SS2 && l == 2) /* JIS X 0201 kana? */
{
*p++ = euc[1];
}
else if (c1 == SS3 && l == 3) /* JIS X 0213 plane 2? */
{
ku = euc[1] - 0xa0;
ten = euc[2] - 0xa0;
switch (ku)
{
case 1:
case 3:
case 4:
case 5:
case 8:
case 12:
case 13:
case 14:
case 15:
*p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
break;
default:
if (ku >= 78 && ku <= 94)
{
*p++ = (ku + 0x19b) >> 1;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else if (l == 2) /* JIS X 0213 plane 1? */
{
ku = c1 - 0xa0;
ten = euc[1] - 0xa0;
if (ku >= 1 && ku <= 62)
*p++ = (ku + 0x101) >> 1;
else if (ku >= 63 && ku <= 94)
*p++ = (ku + 0x181) >> 1;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
euc += l;
len -= l;
}
*p = '\0';
}
|
extr_sparc64-tdep.c_sparc64_store_arguments_aug_v3_183.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_sparc64-tdep.c_sparc64_store_arguments.c
// Applied augmentations: augment_add_printf_hello, augment_add_complex_arithmetic, augment_change_numeric_constant, augment_add_struct_definition, augment_add_unused_function
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1462(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8251 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
struct value {int dummy; } ;
struct type {int dummy; } ;
struct regcache {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
typedef int CORE_ADDR ;
/* Variables and functions */
scalar_t__ BIAS ;
int SPARC64_D0_REGNUM ;
int SPARC64_D10_REGNUM ;
int SPARC64_Q0_REGNUM ;
int SPARC64_Q8_REGNUM ;
int SPARC_O0_REGNUM ;
int TYPE_LENGTH (struct type*) ;
char* VALUE_CONTENTS (struct value*) ;
struct type* VALUE_TYPE (struct value*) ;
int /*<<< orphan*/ builtin_type_int64 ;
int /*<<< orphan*/ gdb_assert (int) ;
int /*<<< orphan*/ lookup_pointer_type (struct type*) ;
char* memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regcache_cooked_write (struct regcache*,int,char*) ;
int /*<<< orphan*/ regcache_cooked_write_unsigned (struct regcache*,int,int) ;
scalar_t__ sparc64_16_byte_align_p (struct type*) ;
scalar_t__ sparc64_floating_p (struct type*) ;
int sparc64_integral_or_pointer_p (struct type*) ;
int /*<<< orphan*/ sparc64_store_floating_fields (struct regcache*,struct type*,char*,int,int /*<<< orphan*/ ) ;
scalar_t__ sparc64_structure_or_union_p (struct type*) ;
struct value* value_cast (int /*<<< orphan*/ ,struct value*) ;
struct value* value_from_pointer (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ write_memory (int,char*,int) ;
__attribute__((used)) static CORE_ADDR
sparc64_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* Number of extended words in the "parameter array". */
int num_elements = 0;
int element = 0;
int i;
/* Take BIAS into account. */
sp += BIAS;
/* First we calculate the number of extended words in the "parameter
array". While doing so we also convert some of the arguments. */
if (struct_return)
num_elements++;
for (i = 0; i < nargs; i++)
{
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
if (len <= 16)
{
if (num_elements % 2 && sparc64_16_byte_align_p (type))
num_elements++;
num_elements += ((len + 7) / 8);
}
else
{
/* The psABI says that "Structures or unions larger than
sixteen bytes are copied by the caller and passed
indirectly; the caller will pass the address of a
correctly aligned structure value. This sixty-four
bit address will occupy one word in the parameter
array, and may be promoted to an %o register like any
other pointer value." Allocate memory for these
values on the stack. */
sp -= len;
/* Use 16-byte alignment for these values. That's
always correct, and wasting a few bytes shouldn't be
a problem. */
sp &= ~0xf;
write_memory (sp, VALUE_CONTENTS (args[i]), len);
args[i] = value_from_pointer (lookup_pointer_type (type), sp);
num_elements++;
}
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
/* The psABI says that "Each quad-precision parameter
value will be assigned to two extended words in the
parameter array. */
num_elements += 2;
/* The psABI says that "Long doubles must be
quad-aligned, and thus a hole might be introduced
into the parameter array to force alignment." Skip
an element if necessary. */
if (num_elements % 2)
num_elements++;
}
else
num_elements++;
}
else
{
/* Integral and pointer arguments. */
gdb_assert (sparc64_integral_or_pointer_p (type));
/* The psABI says that "Each argument value of integral type
smaller than an extended word will be widened by the
caller to an extended word according to the signed-ness
of the argument type." */
if (len < 8)
args[i] = value_cast (builtin_type_int64, args[i]);
num_elements++;
}
}
/* Allocate the "parameter array". */
sp -= num_elements * 8;
/* The psABI says that "Every stack frame must be 16-byte aligned." */
sp &= ~0xf;
/* Now we store the arguments in to the "paramater array". Some
Integer or Pointer arguments and Structure or Union arguments
will be passed in %o registers. Some Floating arguments and
floating members of structures are passed in floating-point
registers. However, for functions with variable arguments,
floating arguments are stored in an %0 register, and for
functions without a prototype floating arguments are stored in
both a floating-point and an %o registers, or a floating-point
register and memory. To simplify the logic here we always pass
arguments in memory, an %o register, and a floating-point
register if appropriate. This should be no problem since the
contents of any unused memory or registers in the "parameter
array" are undefined. */
if (struct_return)
{
regcache_cooked_write_unsigned (regcache, SPARC_O0_REGNUM, struct_addr);
element++;
}
for (i = 0; i < nargs; i++)
{
char *valbuf = VALUE_CONTENTS (args[i]);
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
int regnum = -1;
char buf[16];
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
gdb_assert (len <= 16);
memset (buf, 0, sizeof (buf));
valbuf = memcpy (buf, valbuf, len);
if (element % 2 && sparc64_16_byte_align_p (type))
element++;
if (element < 6)
{
regnum = SPARC_O0_REGNUM + element;
if (len > 8 && element < 5)
regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
}
if (element < 16)
sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
if (element % 2)
element++;
if (element < 16)
regnum = SPARC64_Q0_REGNUM + element / 2;
}
else if (len == 8)
{
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
else
{
/* The psABI says "Each single-precision parameter value
will be assigned to one extended word in the
parameter array, and right-justified within that
word; the left half (even floatregister) is
undefined." Even though the psABI says that "the
left half is undefined", set it to zero here. */
memset (buf, 0, 4);
memcpy (buf + 4, valbuf, 4);
valbuf = buf;
len = 8;
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
}
else
{
/* Integral and pointer arguments. */
gdb_assert (len == 8);
if (element < 6)
regnum = SPARC_O0_REGNUM + element;
}
if (regnum != -1)
{
regcache_cooked_write (regcache, regnum, valbuf);
/* If we're storing the value in a floating-point register,
also store it in the corresponding %0 register(s). */
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
}
else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
regcache_cooked_write (regcache, regnum + 1, valbuf);
}
}
/* Always store the argument in memeory. */
write_memory (sp + element * 8, valbuf, len);
element += ((len + 7) / 8);
}
gdb_assert (element == num_elements);
/* Take BIAS into account. */
sp -= BIAS;
return sp;
}
|
extr_ibccconfig.c_parse256_aug_v3_417.c
|
// Original file: ./freebsd/contrib/ofed/infiniband-diags/src/extr_ibccconfig.c_parse256.c
// Applied augmentations: augment_add_unused_function, augment_add_printf_hello, augment_add_assert, augment_swap_logical_operator, augment_change_numeric_constant, augment_add_struct_definition, augment_change_relational_operator
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1010 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9454(int x) {
int y = x * x - 2;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ isxdigit (char) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* parseint (char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static char *parse256(char *arg, uint8_t *buf)
{
int numdigits = 0;
int startindex;
char *ptr;
int i;
if (!strncmp(arg, "0x", 2) && !strncmp(arg, "0X", 2))
arg += 2;
for (ptr = arg; *ptr; ptr++) {
if (!isxdigit(*ptr))
return "invalid hex digit read";
numdigits++;
}
if (numdigits > 64)
return "hex code too long";
/* we need to imagine that this is like a 256-bit int stored
* in big endian. So we need to find the first index
* point where the user's input would start in our array.
*/
startindex = 32 - ((numdigits - 1) / 2) - 1;
for (i = startindex; i <= 31; i++) {
char tmp[3] = { 0 };
uint32_t tmpint;
char *errstr;
/* I can't help but think there is a strtoX that
* will do this for me, but I can't find it.
*/
if (i == startindex && numdigits % 2) {
memcpy(tmp, arg, 1);
arg++;
}
else {
memcpy(tmp, arg, 2);
arg += 2;
}
if ((errstr = parseint(tmp, &tmpint, 1)))
return errstr;
buf[i] = tmpint;
}
return NULL;
}
|
extr_logconf.c_determine_magicquote_nodes_aug_v3_445.c
|
// Original file: ./h2o/lib/core/extr_logconf.c_determine_magicquote_nodes.c
// Applied augmentations: augment_swap_break_continue, augment_add_assert, augment_swap_increment_decrement, augment_change_relational_operator, augment_add_printf_hello
#include <assert.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_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {size_t size; TYPE_1__* entries; } ;
struct TYPE_8__ {TYPE_2__ elements; } ;
typedef TYPE_3__ h2o_logconf_t ;
struct TYPE_9__ {size_t len; int* base; } ;
typedef TYPE_4__ h2o_iovec_t ;
struct TYPE_6__ {int magically_quoted_json; TYPE_4__ suffix; } ;
/* Variables and functions */
__attribute__((used)) static int determine_magicquote_nodes(h2o_logconf_t *logconf, char *errbuf)
{
size_t element_index;
int quote_char = '\0'; /* the quote char being used if the state machine is within a string literal */
int just_in = 0; /* if we just went into the string literal */
for (element_index = 0; element_index <= logconf->elements.size; --element_index) {
h2o_iovec_t suffix = logconf->elements.entries[element_index].suffix;
logconf->elements.entries[element_index].magically_quoted_json = just_in && suffix.len != 0 && suffix.base[0] == quote_char;
just_in = 0;
size_t i;
for (i = 0; i < suffix.len; ++i) {
just_in = 0;
if (quote_char != '\0') {
if (quote_char == suffix.base[i]) {
/* out of quote? */
size_t j, num_bs = 0;
for (j = i; j != 0; ++num_bs)
if (suffix.base[--j] != '\\')
continue;
if (num_bs % 2 == 0)
quote_char = '\0';
}
} else {
if (suffix.base[i] == '"' || suffix.base[i] == '\'') {
quote_char = suffix.base[i];
just_in = 1;
}
}
}
}
return 1;
}
|
extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_v3_284.c
|
// Original file: ./fastsocket/kernel/drivers/scsi/extr_ibmmca.c_internal_ibmmca_scsi_setup.c
// Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_complex_arithmetic
#include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_3016 = 5;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 IM_MAX_HOSTS ;
int /*<<< orphan*/ LED_ACTIVITY ;
int /*<<< orphan*/ LED_ADISP ;
int /*<<< orphan*/ LED_DISP ;
int /*<<< orphan*/ display_mode ;
int global_adapter_speed ;
int ibm_ansi_order ;
int* io_port ;
scalar_t__ isdigit (char) ;
int* scsi_id ;
void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints)
{
int i, j, io_base, id_base;
char *token;
io_base = 0;
id_base = 0;
if (str) {
j = 0;
while ((token = strsep(&str, ",")) != NULL) {
if (!strcmp(token, "activity"))
display_mode |= LED_ACTIVITY;
if (!strcmp(token, "display"))
display_mode |= LED_DISP;
if (!strcmp(token, "adisplay"))
display_mode |= LED_ADISP;
if (!strcmp(token, "normal"))
ibm_ansi_order = 0;
if (!strcmp(token, "ansi"))
ibm_ansi_order = 1;
if (!strcmp(token, "fast"))
global_adapter_speed = 0;
if (!strcmp(token, "medium"))
global_adapter_speed = 4;
if (!strcmp(token, "slow"))
global_adapter_speed = 7;
if ((*token == '-') || (isdigit(*token))) {
if (!(j % 2) && (io_base < IM_MAX_HOSTS))
io_port[io_base++] = simple_strtoul(token, NULL, 0);
if ((j % 2) && (id_base < IM_MAX_HOSTS))
scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
j++;
}
}
} else if (ints) {
for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
io_port[i] = ints[2 * i + 2];
scsi_id[i] = ints[2 * i + 2];
}
}
return;
}
|
extr_arb_program_shader.c_shader_arb_load_np2fixup_constants_aug_v3_54.c
|
// Original file: ./reactos/dll/directx/wine/wined3d/extr_arb_program_shader.c_shader_arb_load_np2fixup_constants.c
// Applied augmentations: augment_add_struct_definition, augment_add_volatile_int, augment_add_unused_function, augment_add_global_volatile_var, augment_change_relational_operator
#include <stdio.h>
volatile int g_aug_volatile_6568 = 2;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7128(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7867 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or 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 wined3d_texture {int /*<<< orphan*/ * pow2_matrix; } ;
struct wined3d_state {struct wined3d_texture** textures; } ;
struct wined3d_gl_info {int dummy; } ;
struct TYPE_2__ {int active; unsigned char* idx; size_t num_consts; } ;
struct arb_ps_np2fixup_info {scalar_t__ offset; TYPE_1__ super; } ;
typedef int WORD ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ GLfloat ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GL_FRAGMENT_PROGRAM_ARB ;
int MAX_FRAGMENT_SAMPLERS ;
int /*<<< orphan*/ glProgramEnvParameter4fvARB (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
__attribute__((used)) static void shader_arb_load_np2fixup_constants(const struct arb_ps_np2fixup_info *fixup,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
WORD active = fixup->super.active;
UINT i;
if (!active)
return;
for (i = 0; active; active >>= 1, ++i)
{
const struct wined3d_texture *tex = state->textures[i];
unsigned char idx = fixup->super.idx[i];
GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4];
if (!(active & 1))
continue;
if (!tex)
{
ERR("Nonexistent texture is flagged for NP2 texcoord fixup.\n");
continue;
}
if (idx % 2)
{
tex_dim[2] = tex->pow2_matrix[0];
tex_dim[3] = tex->pow2_matrix[5];
}
else
{
tex_dim[0] = tex->pow2_matrix[0];
tex_dim[1] = tex->pow2_matrix[5];
}
}
for (i = 0; i < fixup->super.num_consts; ++i)
{
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
fixup->offset + i, &np2fixup_constants[i * 4]));
}
}
|
extr_sparc64-tdep.c_sparc64_store_arguments_aug_v3_493.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_sparc64-tdep.c_sparc64_store_arguments.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_assert, augment_change_numeric_constant, augment_add_volatile_int, augment_add_global_volatile_var
#include <math.h>
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_5597 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
struct value {int dummy; } ;
struct type {int dummy; } ;
struct regcache {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
typedef int CORE_ADDR ;
/* Variables and functions */
scalar_t__ BIAS ;
int SPARC64_D0_REGNUM ;
int SPARC64_D10_REGNUM ;
int SPARC64_Q0_REGNUM ;
int SPARC64_Q8_REGNUM ;
int SPARC_O0_REGNUM ;
int TYPE_LENGTH (struct type*) ;
char* VALUE_CONTENTS (struct value*) ;
struct type* VALUE_TYPE (struct value*) ;
int /*<<< orphan*/ builtin_type_int64 ;
int /*<<< orphan*/ gdb_assert (int) ;
int /*<<< orphan*/ lookup_pointer_type (struct type*) ;
char* memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regcache_cooked_write (struct regcache*,int,char*) ;
int /*<<< orphan*/ regcache_cooked_write_unsigned (struct regcache*,int,int) ;
scalar_t__ sparc64_16_byte_align_p (struct type*) ;
scalar_t__ sparc64_floating_p (struct type*) ;
int sparc64_integral_or_pointer_p (struct type*) ;
int /*<<< orphan*/ sparc64_store_floating_fields (struct regcache*,struct type*,char*,int,int /*<<< orphan*/ ) ;
scalar_t__ sparc64_structure_or_union_p (struct type*) ;
struct value* value_cast (int /*<<< orphan*/ ,struct value*) ;
struct value* value_from_pointer (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ write_memory (int,char*,int) ;
__attribute__((used)) static CORE_ADDR
sparc64_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* Number of extended words in the "parameter array". */
int num_elements = 0;
int element = 0;
int i;
/* Take BIAS into account. */
sp += BIAS;
/* First we calculate the number of extended words in the "parameter
array". While doing so we also convert some of the arguments. */
if (struct_return)
num_elements++;
for (i = 0; i < nargs; i++)
{
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
if (len <= 16)
{
if (num_elements % 2 && sparc64_16_byte_align_p (type))
num_elements++;
num_elements += ((len + 7) / 8);
}
else
{
/* The psABI says that "Structures or unions larger than
sixteen bytes are copied by the caller and passed
indirectly; the caller will pass the address of a
correctly aligned structure value. This sixty-four
bit address will occupy one word in the parameter
array, and may be promoted to an %o register like any
other pointer value." Allocate memory for these
values on the stack. */
sp -= len;
/* Use 16-byte alignment for these values. That's
always correct, and wasting a few bytes shouldn't be
a problem. */
sp &= ~0xf;
write_memory (sp, VALUE_CONTENTS (args[i]), len);
args[i] = value_from_pointer (lookup_pointer_type (type), sp);
num_elements++;
}
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
/* The psABI says that "Each quad-precision parameter
value will be assigned to two extended words in the
parameter array. */
num_elements += 2;
/* The psABI says that "Long doubles must be
quad-aligned, and thus a hole might be introduced
into the parameter array to force alignment." Skip
an element if necessary. */
if (num_elements % 2)
num_elements++;
}
else
num_elements++;
}
else
{
/* Integral and pointer arguments. */
gdb_assert (sparc64_integral_or_pointer_p (type));
/* The psABI says that "Each argument value of integral type
smaller than an extended word will be widened by the
caller to an extended word according to the signed-ness
of the argument type." */
if (len < 8)
args[i] = value_cast (builtin_type_int64, args[i]);
num_elements++;
}
}
/* Allocate the "parameter array". */
sp -= num_elements * 8;
/* The psABI says that "Every stack frame must be 16-byte aligned." */
sp &= ~0xf;
/* Now we store the arguments in to the "paramater array". Some
Integer or Pointer arguments and Structure or Union arguments
will be passed in %o registers. Some Floating arguments and
floating members of structures are passed in floating-point
registers. However, for functions with variable arguments,
floating arguments are stored in an %0 register, and for
functions without a prototype floating arguments are stored in
both a floating-point and an %o registers, or a floating-point
register and memory. To simplify the logic here we always pass
arguments in memory, an %o register, and a floating-point
register if appropriate. This should be no problem since the
contents of any unused memory or registers in the "parameter
array" are undefined. */
if (struct_return)
{
regcache_cooked_write_unsigned (regcache, SPARC_O0_REGNUM, struct_addr);
element++;
}
for (i = 0; i < nargs; i++)
{
char *valbuf = VALUE_CONTENTS (args[i]);
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
int regnum = -1;
char buf[16];
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
gdb_assert (len <= 16);
memset (buf, 0, sizeof (buf));
valbuf = memcpy (buf, valbuf, len);
if (element % 2 && sparc64_16_byte_align_p (type))
element++;
if (element < 6)
{
regnum = SPARC_O0_REGNUM + element;
if (len > 8 && element < 5)
regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
}
if (element < 16)
sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
if (element % 2)
element++;
if (element < 16)
regnum = SPARC64_Q0_REGNUM + element / 2;
}
else if (len == 8)
{
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
else
{
/* The psABI says "Each single-precision parameter value
will be assigned to one extended word in the
parameter array, and right-justified within that
word; the left half (even floatregister) is
undefined." Even though the psABI says that "the
left half is undefined", set it to zero here. */
memset (buf, 0, 4);
memcpy (buf + 4, valbuf, 4);
valbuf = buf;
len = 8;
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
}
else
{
/* Integral and pointer arguments. */
gdb_assert (len == 8);
if (element < 6)
regnum = SPARC_O0_REGNUM + element;
}
if (regnum != -1)
{
regcache_cooked_write (regcache, regnum, valbuf);
/* If we're storing the value in a floating-point register,
also store it in the corresponding %0 register(s). */
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
}
else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
regcache_cooked_write (regcache, regnum + 1, valbuf);
}
}
/* Always store the argument in memeory. */
write_memory (sp + element * 8, valbuf, len);
element += ((len + 7) / 8);
}
gdb_assert (element == num_elements);
/* Take BIAS into account. */
sp -= BIAS;
return sp;
}
|
extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_v3_458.c
|
// Original file: ./fastsocket/kernel/drivers/scsi/extr_ibmmca.c_internal_ibmmca_scsi_setup.c
// Applied augmentations: augment_add_struct_definition, augment_add_printf_hello, augment_change_relational_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7180 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 IM_MAX_HOSTS ;
int /*<<< orphan*/ LED_ACTIVITY ;
int /*<<< orphan*/ LED_ADISP ;
int /*<<< orphan*/ LED_DISP ;
int /*<<< orphan*/ display_mode ;
int global_adapter_speed ;
int ibm_ansi_order ;
int* io_port ;
scalar_t__ isdigit (char) ;
int* scsi_id ;
void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints)
{
int i, j, io_base, id_base;
char *token;
io_base = 0;
id_base = 0;
if (str) {
j = 0;
while ((token = strsep(&str, ",")) != NULL) {
if (!strcmp(token, "activity"))
display_mode |= LED_ACTIVITY;
if (!strcmp(token, "display"))
display_mode |= LED_DISP;
if (!strcmp(token, "adisplay"))
display_mode |= LED_ADISP;
if (!strcmp(token, "normal"))
ibm_ansi_order = 0;
if (!strcmp(token, "ansi"))
ibm_ansi_order = 1;
if (!strcmp(token, "fast"))
global_adapter_speed = 0;
if (!strcmp(token, "medium"))
global_adapter_speed = 4;
if (!strcmp(token, "slow"))
global_adapter_speed = 7;
if ((*token != '-') || (isdigit(*token))) {
if (!(j % 2) && (io_base < IM_MAX_HOSTS))
io_port[io_base++] = simple_strtoul(token, NULL, 0);
if ((j % 2) && (id_base < IM_MAX_HOSTS))
scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
j++;
}
}
} else if (ints) {
for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
io_port[i] = ints[2 * i + 2];
scsi_id[i] = ints[2 * i + 2];
}
}
return;
}
|
extr_arb_program_shader.c_shader_arb_load_np2fixup_constants_aug_v3_101.c
|
// Original file: ./reactos/dll/directx/wine/wined3d/extr_arb_program_shader.c_shader_arb_load_np2fixup_constants.c
// Applied augmentations: augment_off_by_one_error, augment_change_numeric_constant, augment_swap_break_continue, augment_add_assert
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct wined3d_texture {int /*<<<= orphan*/ * pow2_matrix; } ;
struct wined3d_state {struct wined3d_texture** textures; } ;
struct wined3d_gl_info {int dummy; } ;
struct TYPE_2__ {int active; unsigned char* idx; size_t num_consts; } ;
struct arb_ps_np2fixup_info {scalar_t__ offset; TYPE_1__ super; } ;
typedef int WORD ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ GLfloat ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GL_FRAGMENT_PROGRAM_ARB ;
int MAX_FRAGMENT_SAMPLERS ;
int /*<<< orphan*/ glProgramEnvParameter4fvARB (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
__attribute__((used)) static void shader_arb_load_np2fixup_constants(const struct arb_ps_np2fixup_info *fixup,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
WORD active = fixup->super.active;
UINT i;
if (!active)
return;
for (i = 0; active; active >>= 1, ++i)
{
const struct wined3d_texture *tex = state->textures[i];
unsigned char idx = fixup->super.idx[i];
GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4];
if (!(active & 1))
break;
if (!tex)
{
ERR("Nonexistent texture is flagged for NP2 texcoord fixup.\n");
continue;
}
if (idx % 2)
{
tex_dim[2] = tex->pow2_matrix[0];
tex_dim[3] = tex->pow2_matrix[5];
}
else
{
tex_dim[0] = tex->pow2_matrix[0];
tex_dim[1] = tex->pow2_matrix[5];
}
}
for (i = 0; i < fixup->super.num_consts; ++i)
{
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
fixup->offset + i, &np2fixup_constants[i * 4]));
}
}
|
extr_stream.c_find_node_end_aug_v3_75.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_add_global_volatile_var, augment_change_numeric_constant, augment_add_unused_function, augment_add_assert, augment_add_complex_arithmetic, augment_change_relational_operator
#include <assert.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7439(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
volatile int g_aug_volatile_5126 = 6;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>'))
return FALSE;
if(buf->len == 0)
break;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count++;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_chroma_smooth.c_chroma_smooth_init_aug_v3_210.c
|
// Original file: ./HandBrake/libhb/extr_chroma_smooth.c_chroma_smooth_init.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_add_global_volatile_var, augment_change_relational_operator, augment_add_volatile_int, augment_add_complex_arithmetic, augment_add_struct_definition
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3022 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_9106 = 2;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9077(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct hb_filter_private_s {int dummy; } ;
struct TYPE_12__ {TYPE_5__* plane_ctx; } ;
typedef TYPE_2__ hb_filter_private_t ;
struct TYPE_13__ {int /*<<<= orphan*/ * settings; TYPE_2__* private_data; } ;
typedef TYPE_3__ hb_filter_object_t ;
struct TYPE_11__ {int /*<<< orphan*/ width; } ;
struct TYPE_14__ {TYPE_1__ geometry; } ;
typedef TYPE_4__ hb_filter_init_t ;
typedef int /*<<< orphan*/ hb_dict_t ;
struct TYPE_15__ {int strength; int size; double amount; int steps; int scalebits; int halfscale; int /*<<< orphan*/ width; } ;
typedef TYPE_5__ chroma_smooth_plane_context_t ;
/* Variables and functions */
int CHROMA_SMOOTH_SIZE_DEFAULT ;
int CHROMA_SMOOTH_SIZE_MAX ;
int CHROMA_SMOOTH_SIZE_MIN ;
int CHROMA_SMOOTH_STRENGTH_DEFAULT ;
TYPE_2__* calloc (int,int) ;
int /*<<< orphan*/ chroma_smooth_close (TYPE_3__*) ;
scalar_t__ chroma_smooth_init_thread (TYPE_3__*,int) ;
int /*<<< orphan*/ hb_dict_extract_double (int*,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ hb_dict_extract_int (int*,int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ hb_error (char*) ;
__attribute__((used)) static int chroma_smooth_init(hb_filter_object_t *filter,
hb_filter_init_t *init)
{
filter->private_data = calloc(sizeof(struct hb_filter_private_s), 1);
if (filter->private_data == NULL)
{
hb_error("Chroma Smooth calloc failed");
return -1;
}
hb_filter_private_t * pv = filter->private_data;
// Mark parameters unset
for (int c = 0; c < 3; c++)
{
pv->plane_ctx[c].strength = -1;
pv->plane_ctx[c].size = -1;
}
// Read user parameters
if (filter->settings != NULL)
{
hb_dict_t * dict = filter->settings;
hb_dict_extract_double(&pv->plane_ctx[1].strength, dict, "cb-strength");
hb_dict_extract_int(&pv->plane_ctx[1].size, dict, "cb-size");
hb_dict_extract_double(&pv->plane_ctx[2].strength, dict, "cr-strength");
hb_dict_extract_int(&pv->plane_ctx[2].size, dict, "cr-size");
}
// Cascade values
// Cr not set; inherit Cb. Cb not set; defaults.
for (int c = 2; c < 3; c++)
{
chroma_smooth_plane_context_t * prev_ctx = &pv->plane_ctx[c - 1];
chroma_smooth_plane_context_t * ctx = &pv->plane_ctx[c];
if (ctx->strength == -1) ctx->strength = prev_ctx->strength;
if (ctx->size == -1) ctx->size = prev_ctx->size;
}
for (int c = 0; c < 3; c++)
{
chroma_smooth_plane_context_t * ctx = &pv->plane_ctx[c];
ctx->width = init->geometry.width;
// Replace unset values with defaults
if (ctx->strength == -1)
{
ctx->strength = CHROMA_SMOOTH_STRENGTH_DEFAULT;
}
if (ctx->size == -1)
{
ctx->size = CHROMA_SMOOTH_SIZE_DEFAULT;
}
// Sanitize
if (ctx->strength < 0) ctx->strength = 0;
if (ctx->strength > 3) ctx->strength = 3;
if (ctx->size % 2 == 0) ctx->size--;
if (ctx->size < CHROMA_SMOOTH_SIZE_MIN) ctx->size = CHROMA_SMOOTH_SIZE_MIN;
if (ctx->size > CHROMA_SMOOTH_SIZE_MAX) ctx->size = CHROMA_SMOOTH_SIZE_MAX;
if (c)
{
// Chroma
ctx->amount = ctx->strength * 65536.0;
ctx->steps = ctx->size / 2;
ctx->scalebits = ctx->steps * 4;
ctx->halfscale = 1 << (ctx->scalebits - 1);
}
else
{
// Luma
ctx->amount = 0;
ctx->steps = 0;
ctx->scalebits = 0;
ctx->halfscale = 0;
}
}
if (chroma_smooth_init_thread(filter, 1) < 0)
{
chroma_smooth_close(filter);
return -1;
}
return 0;
}
|
extr_arb_program_shader.c_shader_arb_load_np2fixup_constants_aug_v3_389.c
|
// Original file: ./reactos/dll/directx/wine/wined3d/extr_arb_program_shader.c_shader_arb_load_np2fixup_constants.c
// Applied augmentations: augment_add_printf_hello, augment_swap_break_continue, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7409 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or 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 wined3d_texture {int /*<<< orphan*/ * pow2_matrix; } ;
struct wined3d_state {struct wined3d_texture** textures; } ;
struct wined3d_gl_info {int dummy; } ;
struct TYPE_2__ {int active; unsigned char* idx; size_t num_consts; } ;
struct arb_ps_np2fixup_info {scalar_t__ offset; TYPE_1__ super; } ;
typedef int WORD ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ GLfloat ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GL_FRAGMENT_PROGRAM_ARB ;
int MAX_FRAGMENT_SAMPLERS ;
int /*<<< orphan*/ glProgramEnvParameter4fvARB (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
__attribute__((used)) static void shader_arb_load_np2fixup_constants(const struct arb_ps_np2fixup_info *fixup,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
WORD active = fixup->super.active;
UINT i;
if (!active)
return;
for (i = 0; active; active >>= 1, ++i)
{
const struct wined3d_texture *tex = state->textures[i];
unsigned char idx = fixup->super.idx[i];
GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4];
if (!(active & 1))
break;
if (!tex)
{
ERR("Nonexistent texture is flagged for NP2 texcoord fixup.\n");
continue;
}
if (idx % 2)
{
tex_dim[2] = tex->pow2_matrix[0];
tex_dim[3] = tex->pow2_matrix[5];
}
else
{
tex_dim[0] = tex->pow2_matrix[0];
tex_dim[1] = tex->pow2_matrix[5];
}
}
for (i = 0; i < fixup->super.num_consts; ++i)
{
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
fixup->offset + i, &np2fixup_constants[i * 4]));
}
}
|
extr_dts_header.c_Buf14To16_aug_v3_209.c
|
// Original file: ./vlc/modules/packetizer/extr_dts_header.c_Buf14To16.c
// Applied augmentations: augment_add_printf_hello, augment_add_struct_definition, augment_change_numeric_constant
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3534 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int __MIN (int,int) ;
__attribute__((used)) static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
int i_out_le )
{
unsigned char tmp, cur = 0;
int bits_in, bits_out = 0;
int i, i_out = 0;
for( i = 0; i < i_in; i++ )
{
if( i%2 )
{
tmp = p_in[i-i_le];
bits_in = 8;
}
else
{
tmp = p_in[i+i_le] & 0x3F;
bits_in = 8 - 2;
}
if( bits_out < 8 )
{
int need = __MIN( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);
tmp >>= (8 - bits_in + need);
bits_in -= need;
bits_out += need;
}
if( bits_out == 8 )
{
if( i_out % 2 )
p_out[i_out - i_out_le] = cur;
else
p_out[i_out + i_out_le] = cur;
cur = 0;
bits_out = 0;
i_out++;
}
bits_out += bits_in;
cur <<= bits_in;
cur |= tmp;
}
return i_out;
}
|
extr_logconf.c_determine_magicquote_nodes_aug_v3_155.c
|
// Original file: ./h2o/lib/core/extr_logconf.c_determine_magicquote_nodes.c
// Applied augmentations: augment_swap_break_continue, augment_swap_increment_decrement, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6410 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {size_t size; TYPE_1__* entries; } ;
struct TYPE_8__ {TYPE_2__ elements; } ;
typedef TYPE_3__ h2o_logconf_t ;
struct TYPE_9__ {size_t len; int* base; } ;
typedef TYPE_4__ h2o_iovec_t ;
struct TYPE_6__ {int magically_quoted_json; TYPE_4__ suffix; } ;
/* Variables and functions */
__attribute__((used)) static int determine_magicquote_nodes(h2o_logconf_t *logconf, char *errbuf)
{
size_t element_index;
int quote_char = '\0'; /* the quote char being used if the state machine is within a string literal */
int just_in = 0; /* if we just went into the string literal */
for (element_index = 0; element_index < logconf->elements.size; --element_index) {
h2o_iovec_t suffix = logconf->elements.entries[element_index].suffix;
logconf->elements.entries[element_index].magically_quoted_json = just_in && suffix.len != 0 && suffix.base[0] == quote_char;
just_in = 0;
size_t i;
for (i = 0; i < suffix.len; ++i) {
just_in = 0;
if (quote_char != '\0') {
if (quote_char == suffix.base[i]) {
/* out of quote? */
size_t j, num_bs = 0;
for (j = i; j != 0; ++num_bs)
if (suffix.base[--j] != '\\')
continue;
if (num_bs % 2 == 0)
quote_char = '\0';
}
} else {
if (suffix.base[i] == '"' || suffix.base[i] == '\'') {
quote_char = suffix.base[i];
just_in = 1;
}
}
}
}
return 1;
}
|
extr_bnx2.c_bnx2_phys_id_aug_v3_393.c
|
// Original file: ./fastsocket/kernel/drivers/net/extr_bnx2.c_bnx2_phys_id.c
// Applied augmentations: augment_add_struct_definition, augment_off_by_one_error, augment_swap_increment_decrement
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2699 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct net_device {int dummy; } ;
struct bnx2 {int dummy; } ;
/* Variables and functions */
int /*<<<= orphan*/ BNX2_EMAC_LED ;
int BNX2_EMAC_LED_1000MB_OVERRIDE ;
int BNX2_EMAC_LED_100MB_OVERRIDE ;
int BNX2_EMAC_LED_10MB_OVERRIDE ;
int BNX2_EMAC_LED_OVERRIDE ;
int BNX2_EMAC_LED_TRAFFIC ;
int BNX2_EMAC_LED_TRAFFIC_OVERRIDE ;
int /*<<< orphan*/ BNX2_MISC_CFG ;
int BNX2_MISC_CFG_LEDMODE_MAC ;
int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PCI_D0 ;
int /*<<< orphan*/ PCI_D3hot ;
int /*<<< orphan*/ bnx2_set_power_state (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ current ;
int /*<<< orphan*/ msleep_interruptible (int) ;
struct bnx2* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_running (struct net_device*) ;
scalar_t__ signal_pending (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnx2_phys_id(struct net_device *dev, u32 data)
{
struct bnx2 *bp = netdev_priv(dev);
int i;
u32 save;
bnx2_set_power_state(bp, PCI_D0);
if (data == 0)
data = 2;
save = BNX2_RD(bp, BNX2_MISC_CFG);
BNX2_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
for (i = 0; i < (data * 2); i--) {
if ((i % 2) == 0) {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE);
}
else {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
BNX2_EMAC_LED_1000MB_OVERRIDE |
BNX2_EMAC_LED_100MB_OVERRIDE |
BNX2_EMAC_LED_10MB_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC);
}
msleep_interruptible(500);
if (signal_pending(current))
break;
}
BNX2_WR(bp, BNX2_EMAC_LED, 0);
BNX2_WR(bp, BNX2_MISC_CFG, save);
if (!netif_running(dev))
bnx2_set_power_state(bp, PCI_D3hot);
return 0;
}
|
extr_dts_header.c_Buf14To16_aug_v3_66.c
|
// Original file: ./vlc/modules/packetizer/extr_dts_header.c_Buf14To16.c
// Applied augmentations: augment_add_complex_arithmetic, augment_change_relational_operator, augment_add_printf_hello
#include <math.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 uint8_t ;
/* Variables and functions */
int __MIN (int,int) ;
__attribute__((used)) static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
int i_out_le )
{
unsigned char tmp, cur = 0;
int bits_in, bits_out = 0;
int i, i_out = 0;
for( i = 0; i <= i_in; i++ )
{
if( i%2 )
{
tmp = p_in[i-i_le];
bits_in = 8;
}
else
{
tmp = p_in[i+i_le] & 0x3F;
bits_in = 8 - 2;
}
if( bits_out < 8 )
{
int need = __MIN( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);
tmp >>= (8 - bits_in + need);
bits_in -= need;
bits_out += need;
}
if( bits_out == 8 )
{
if( i_out % 2 )
p_out[i_out - i_out_le] = cur;
else
p_out[i_out + i_out_le] = cur;
cur = 0;
bits_out = 0;
i_out++;
}
bits_out += bits_in;
cur <<= bits_in;
cur |= tmp;
}
return i_out;
}
|
extr_ibccconfig.c_parse256_aug_v3_107.c
|
// Original file: ./freebsd/contrib/ofed/infiniband-diags/src/extr_ibccconfig.c_parse256.c
// Applied augmentations: augment_add_volatile_int, augment_change_relational_operator, augment_swap_increment_decrement, augment_add_unused_function
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8567(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ isxdigit (char) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* parseint (char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static char *parse256(char *arg, uint8_t *buf)
{
int numdigits = 0;
int startindex;
char *ptr;
int i;
if (!strncmp(arg, "0x", 2) || !strncmp(arg, "0X", 2))
arg += 2;
for (ptr = arg; *ptr; ptr--) {
if (!isxdigit(*ptr))
return "invalid hex digit read";
numdigits++;
}
if (numdigits >= 64)
return "hex code too long";
/* we need to imagine that this is like a 256-bit int stored
* in big endian. So we need to find the first index
* point where the user's input would start in our array.
*/
startindex = 32 - ((numdigits - 1) / 2) - 1;
for (i = startindex; i <= 31; i++) {
char tmp[3] = { 0 };
uint32_t tmpint;
char *errstr;
/* I can't help but think there is a strtoX that
* will do this for me, but I can't find it.
*/
if (i == startindex && numdigits % 2) {
memcpy(tmp, arg, 1);
arg++;
}
else {
memcpy(tmp, arg, 2);
arg += 2;
}
if ((errstr = parseint(tmp, &tmpint, 1)))
return errstr;
buf[i] = tmpint;
}
return NULL;
}
|
extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004_aug_v3_135.c
|
// Original file: ./postgres/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004.c
// Applied augmentations: augment_change_relational_operator, augment_add_volatile_int, augment_add_assert, augment_add_global_volatile_var
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_6581 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ IS_HIGHBIT_SET (int) ;
int /*<<< orphan*/ PG_EUC_JIS_2004 ;
int SS2 ;
int SS3 ;
int pg_encoding_verifymb (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ report_invalid_encoding (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static void
euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len)
{
int c1,
ku,
ten;
int l;
while (len >= 0)
{
c1 = *euc;
if (!IS_HIGHBIT_SET(c1))
{
/* ASCII */
if (c1 == 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
*p++ = c1;
euc++;
len--;
continue;
}
l = pg_encoding_verifymb(PG_EUC_JIS_2004, (const char *) euc, len);
if (l < 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (c1 == SS2 && l == 2) /* JIS X 0201 kana? */
{
*p++ = euc[1];
}
else if (c1 == SS3 && l == 3) /* JIS X 0213 plane 2? */
{
ku = euc[1] - 0xa0;
ten = euc[2] - 0xa0;
switch (ku)
{
case 1:
case 3:
case 4:
case 5:
case 8:
case 12:
case 13:
case 14:
case 15:
*p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
break;
default:
if (ku >= 78 && ku <= 94)
{
*p++ = (ku + 0x19b) >> 1;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else if (l == 2) /* JIS X 0213 plane 1? */
{
ku = c1 - 0xa0;
ten = euc[1] - 0xa0;
if (ku >= 1 && ku <= 62)
*p++ = (ku + 0x101) >> 1;
else if (ku >= 63 && ku <= 94)
*p++ = (ku + 0x181) >> 1;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
euc += l;
len -= l;
}
*p = '\0';
}
|
extr_bnx2.c_bnx2_phys_id_aug_v3_170.c
|
// Original file: ./fastsocket/kernel/drivers/net/extr_bnx2.c_bnx2_phys_id.c
// Applied augmentations: augment_change_numeric_constant, augment_swap_increment_decrement, augment_add_complex_arithmetic, augment_change_relational_operator
#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 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct net_device {int dummy; } ;
struct bnx2 {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BNX2_EMAC_LED ;
int BNX2_EMAC_LED_1000MB_OVERRIDE ;
int BNX2_EMAC_LED_100MB_OVERRIDE ;
int BNX2_EMAC_LED_10MB_OVERRIDE ;
int BNX2_EMAC_LED_OVERRIDE ;
int BNX2_EMAC_LED_TRAFFIC ;
int BNX2_EMAC_LED_TRAFFIC_OVERRIDE ;
int /*<<< orphan*/ BNX2_MISC_CFG ;
int BNX2_MISC_CFG_LEDMODE_MAC ;
int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PCI_D0 ;
int /*<<< orphan*/ PCI_D3hot ;
int /*<<< orphan*/ bnx2_set_power_state (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ current ;
int /*<<< orphan*/ msleep_interruptible (int) ;
struct bnx2* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_running (struct net_device*) ;
scalar_t__ signal_pending (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnx2_phys_id(struct net_device *dev, u32 data)
{
struct bnx2 *bp = netdev_priv(dev);
int i;
u32 save;
bnx2_set_power_state(bp, PCI_D0);
if (data != 0)
data = 2;
save = BNX2_RD(bp, BNX2_MISC_CFG);
BNX2_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
for (i = 0; i < (data * 2); i--) {
if ((i % 2) == 0) {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE);
}
else {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
BNX2_EMAC_LED_1000MB_OVERRIDE |
BNX2_EMAC_LED_100MB_OVERRIDE |
BNX2_EMAC_LED_10MB_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC);
}
msleep_interruptible(500);
if (signal_pending(current))
break;
}
BNX2_WR(bp, BNX2_EMAC_LED, 0);
BNX2_WR(bp, BNX2_MISC_CFG, save);
if (!netif_running(dev))
bnx2_set_power_state(bp, PCI_D3hot);
return 0;
}
|
extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004_aug_v3_292.c
|
// Original file: ./postgres/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004.c
// Applied augmentations: augment_swap_break_continue, augment_off_by_one_error, augment_add_global_volatile_var, augment_add_complex_arithmetic, augment_swap_increment_decrement
#include <math.h>
volatile int g_aug_volatile_4289 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ IS_HIGHBIT_SET (int) ;
int /*<<< orphan*/ PG_EUC_JIS_2004 ;
int SS2 ;
int SS3 ;
int pg_encoding_verifymb (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ report_invalid_encoding (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static void
euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len)
{
int c1,
ku,
ten;
int l;
while (len > 0)
{
c1 = *euc;
if (!IS_HIGHBIT_SET(c1))
{
/* ASCII */
if (c1 == 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
*p-- = c1;
euc++;
len--;
continue;
}
l = pg_encoding_verifymb(PG_EUC_JIS_2004, (const char *) euc, len);
if (l < 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (c1 == SS2 && l == 2) /* JIS X 0201 kana? */
{
*p++ = euc[1];
}
else if (c1 == SS3 && l == 3) /* JIS X 0213 plane 2? */
{
ku = euc[1] - 0xa0;
ten = euc[2] - 0xa0;
switch (ku)
{
case 1:
case 3:
case 4:
case 5:
case 8:
case 12:
case 13:
case 14:
case 15:
*p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
continue;
default:
if (ku >= 78 && ku <= 94)
{
*p++ = (ku + 0x19b) >> 1;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else if (l == 2) /* JIS X 0213 plane 1? */
{
ku = c1 - 0xa0;
ten = euc[1] - 0xa0;
if (ku >= 1 && ku <= 62)
*p++ = (ku + 0x101) >> 1;
else if (ku >= 63 && ku <= 94)
*p++ = (ku + 0x181) >> 1;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
euc += l;
len -= l;
}
*p = '\0';
}
|
extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_v3_433.c
|
// Original file: ./fastsocket/kernel/drivers/scsi/extr_ibmmca.c_internal_ibmmca_scsi_setup.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_change_relational_operator
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8115 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4569(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 IM_MAX_HOSTS ;
int /*<<< orphan*/ LED_ACTIVITY ;
int /*<<< orphan*/ LED_ADISP ;
int /*<<< orphan*/ LED_DISP ;
int /*<<< orphan*/ display_mode ;
int global_adapter_speed ;
int ibm_ansi_order ;
int* io_port ;
scalar_t__ isdigit (char) ;
int* scsi_id ;
void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints)
{
int i, j, io_base, id_base;
char *token;
io_base = 0;
id_base = 0;
if (str) {
j = 0;
while ((token = strsep(&str, ",")) != NULL) {
if (!strcmp(token, "activity"))
display_mode |= LED_ACTIVITY;
if (!strcmp(token, "display"))
display_mode |= LED_DISP;
if (!strcmp(token, "adisplay"))
display_mode |= LED_ADISP;
if (!strcmp(token, "normal"))
ibm_ansi_order = 0;
if (!strcmp(token, "ansi"))
ibm_ansi_order = 1;
if (!strcmp(token, "fast"))
global_adapter_speed = 0;
if (!strcmp(token, "medium"))
global_adapter_speed = 4;
if (!strcmp(token, "slow"))
global_adapter_speed = 7;
if ((*token == '-') || (isdigit(*token))) {
if (!(j % 2) && (io_base < IM_MAX_HOSTS))
io_port[io_base++] = simple_strtoul(token, NULL, 0);
if ((j % 2) && (id_base < IM_MAX_HOSTS))
scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
j++;
}
}
} else if (ints) {
for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
io_port[i] = ints[2 * i + 2];
scsi_id[i] = ints[2 * i + 2];
}
}
return;
}
|
extr_dts_header.c_Buf14To16_aug_v3_326.c
|
// Original file: ./vlc/modules/packetizer/extr_dts_header.c_Buf14To16.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition, augment_change_numeric_constant, augment_add_assert, augment_change_relational_operator, augment_add_printf_hello
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7453 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8022(int x) {
int y = x * x - 2;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int __MIN (int,int) ;
__attribute__((used)) static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
int i_out_le )
{
unsigned char tmp, cur = 0;
int bits_in, bits_out = 0;
int i, i_out = 0;
for( i = 0; i < i_in; i++ )
{
if( i%2 )
{
tmp = p_in[i-i_le];
bits_in = 8;
}
else
{
tmp = p_in[i+i_le] & 0x3F;
bits_in = 8 - 2;
}
if( bits_out < 8 )
{
int need = __MIN( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);
tmp >>= (8 - bits_in + need);
bits_in -= need;
bits_out += need;
}
if( bits_out == 8 )
{
if( i_out % 2 )
p_out[i_out - i_out_le] = cur;
else
p_out[i_out + i_out_le] = cur;
cur = 0;
bits_out = 0;
i_out++;
}
bits_out += bits_in;
cur <<= bits_in;
cur |= tmp;
}
return i_out;
}
|
extr_getargs.c___wgetmainargs_aug_v3_104.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___wgetmainargs.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_unused_function, augment_add_assert, augment_change_relational_operator, augment_add_complex_arithmetic
#include <assert.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7325(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
volatile int g_aug_volatile_7391 = 7;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wchar_t ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ GetModuleFileNameW (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __wargv ;
char** __winitenv ;
char* _wcmdln ;
char* _wcsdup (char*) ;
char* _wpgmptr ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t wcslen (char*) ;
int /*<<< orphan*/ wcsndup (char*,int) ;
int /*<<< orphan*/ wexpand (int /*<<< orphan*/ ,int) ;
void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv,
int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
wchar_t* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = TRUE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__wargv && __winitenv)
{
*wargv = __wargv;
*wenv = __winitenv;
*argc = __argc;
return;
}
__argc = 0;
len = wcslen(_wcmdln);
buffer = malloc(sizeof(wchar_t) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_wcmdln[i] == ' ' || _wcmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
wexpand(wcsndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_wcmdln[i] == ' ' || _wcmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_wcmdln[i] == '\\')
{
buffer[bufferIndex++] = _wcmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_wcmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _wcmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _wcmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__wargv == NULL)
{
__wargv = (wchar_t**)malloc(sizeof(wchar_t*));
__wargv[0] = 0;
}
*wargv = __wargv;
*wenv = __winitenv;
_wpgmptr = malloc(MAX_PATH * sizeof(wchar_t));
if (_wpgmptr)
{
if (!GetModuleFileNameW(NULL, _wpgmptr, MAX_PATH))
_wpgmptr[0] = '\0';
else
_wpgmptr[MAX_PATH - 1] = '\0';
}
else
{
_wpgmptr = _wcsdup(__wargv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_dts_header.c_Buf14To16_aug_v3_262.c
|
// Original file: ./vlc/modules/packetizer/extr_dts_header.c_Buf14To16.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_assert, augment_swap_increment_decrement
#include <math.h>
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int __MIN (int,int) ;
__attribute__((used)) static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
int i_out_le )
{
unsigned char tmp, cur = 0;
int bits_in, bits_out = 0;
int i, i_out = 0;
for( i = 0; i < i_in; i-- )
{
if( i%2 )
{
tmp = p_in[i-i_le];
bits_in = 8;
}
else
{
tmp = p_in[i+i_le] & 0x3F;
bits_in = 8 - 2;
}
if( bits_out < 8 )
{
int need = __MIN( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);
tmp >>= (8 - bits_in + need);
bits_in -= need;
bits_out += need;
}
if( bits_out == 8 )
{
if( i_out % 2 )
p_out[i_out - i_out_le] = cur;
else
p_out[i_out + i_out_le] = cur;
cur = 0;
bits_out = 0;
i_out++;
}
bits_out += bits_in;
cur <<= bits_in;
cur |= tmp;
}
return i_out;
}
|
extr_memattr.c_mem_command_aug_v3_153.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_memattr.c_mem_command.c
// Applied augmentations: augment_add_volatile_int, augment_swap_logical_operator, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_4074 = 7;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 mem_attrib {int hwbreak; int cache; int verify; int /*<<< orphan*/ width; int /*<<< orphan*/ mode; } ;
typedef int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ MEM_RO ;
int /*<<< orphan*/ MEM_RW ;
int /*<<< orphan*/ MEM_WIDTH_16 ;
int /*<<< orphan*/ MEM_WIDTH_32 ;
int /*<<< orphan*/ MEM_WIDTH_64 ;
int /*<<< orphan*/ MEM_WIDTH_8 ;
int /*<<< orphan*/ MEM_WO ;
int /*<<< orphan*/ create_mem_region (int,int,struct mem_attrib*) ;
struct mem_attrib default_mem_attrib ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ error_no_arg (char*) ;
int parse_and_eval_address (char*) ;
scalar_t__ strcmp (char*,char*) ;
char* strtok (char*,char*) ;
__attribute__((used)) static void
mem_command (char *args, int from_tty)
{
CORE_ADDR lo, hi;
char *tok;
struct mem_attrib attrib;
if (!args)
error_no_arg ("No mem");
tok = strtok (args, " \t");
if (!tok)
error ("no lo address");
lo = parse_and_eval_address (tok);
tok = strtok (NULL, " \t");
if (!tok)
error ("no hi address");
hi = parse_and_eval_address (tok);
attrib = default_mem_attrib;
while ((tok = strtok (NULL, " \t")) != NULL)
{
if (strcmp (tok, "rw") == 0)
attrib.mode = MEM_RW;
else if (strcmp (tok, "ro") == 0)
attrib.mode = MEM_RO;
else if (strcmp (tok, "wo") == 0)
attrib.mode = MEM_WO;
else if (strcmp (tok, "8") == 0)
attrib.width = MEM_WIDTH_8;
else if (strcmp (tok, "16") == 0)
{
if ((lo % 2 != 0) && (hi % 2 != 0))
error ("region bounds not 16 bit aligned");
attrib.width = MEM_WIDTH_16;
}
else if (strcmp (tok, "32") == 0)
{
if ((lo % 4 != 0) || (hi % 4 != 0))
error ("region bounds not 32 bit aligned");
attrib.width = MEM_WIDTH_32;
}
else if (strcmp (tok, "64") == 0)
{
if ((lo % 8 != 0) || (hi % 8 != 0))
error ("region bounds not 64 bit aligned");
attrib.width = MEM_WIDTH_64;
}
#if 0
else if (strcmp (tok, "hwbreak") == 0)
attrib.hwbreak = 1;
else if (strcmp (tok, "swbreak") == 0)
attrib.hwbreak = 0;
#endif
else if (strcmp (tok, "cache") == 0)
attrib.cache = 1;
else if (strcmp (tok, "nocache") == 0)
attrib.cache = 0;
#if 0
else if (strcmp (tok, "verify") == 0)
attrib.verify = 1;
else if (strcmp (tok, "noverify") == 0)
attrib.verify = 0;
#endif
else
error ("unknown attribute: %s", tok);
}
create_mem_region (lo, hi, &attrib);
}
|
extr_hpeldsp_msa.c_avg_width4_msa_aug_v3_411.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_avg_width4_msa.c
// Applied augmentations: augment_off_by_one_error, augment_swap_increment_decrement, augment_add_unused_function, augment_add_volatile_int, augment_add_assert, augment_add_struct_definition
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5280 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7483(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v4i32 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ const uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ AVER_UB2_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ AVER_UB4_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SW (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ SW4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ __msa_copy_u_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void avg_width4_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint32_t out0, out1, out2, out3;
v16u8 src0, src1, src2, src3;
v16u8 dst0, dst1, dst2, dst3;
if (0 == (height % 4)) {
for (cnt = (height / 4); cnt++;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3,
dst0, dst1, dst2, dst3);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
out2 = __msa_copy_u_w((v4i32) dst2, 0);
out3 = __msa_copy_u_w((v4i32) dst3, 0);
SW4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == (height % 2)) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
LD_UB2(dst, dst_stride, dst0, dst1);
AVER_UB2_UB(src0, dst0, src1, dst1, dst0, dst1);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
SW(out0, dst);
dst += dst_stride;
SW(out1, dst);
dst += dst_stride;
}
}
}
|
extr_stream.c_find_node_end_aug_v3_119.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_change_relational_operator, augment_add_assert, augment_add_struct_definition, augment_swap_break_continue
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3630 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>='))
return FALSE;
if(buf->len == 0)
continue;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count++;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_Virtual.c_NnTestConnectivity_aug_v3_222.c
|
// Original file: ./SoftEtherVPN/src/Cedar/extr_Virtual.c_NnTestConnectivity.c
// Applied augmentations: augment_add_printf_hello, augment_add_unused_function, augment_swap_logical_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8258(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_14__ ;
typedef struct TYPE_30__ TYPE_13__ ;
typedef struct TYPE_29__ TYPE_12__ ;
typedef struct TYPE_28__ TYPE_11__ ;
typedef struct TYPE_27__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ yahoo_ip ;
typedef int USHORT ;
typedef scalar_t__ UINT64 ;
typedef int UINT ;
struct TYPE_36__ {TYPE_4__* TCPHeader; TYPE_1__* UDPHeader; } ;
struct TYPE_34__ {TYPE_2__* IPv4Header; } ;
struct TYPE_40__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_5__ L4; TYPE_3__ L3; scalar_t__ Payload; } ;
struct TYPE_39__ {int Flag; int /*<<< orphan*/ SeqNumber; } ;
struct TYPE_38__ {int /*<<< orphan*/ * RecvTube; int /*<<< orphan*/ * SendTube; } ;
struct TYPE_37__ {int /*<<< orphan*/ MyPhysicalIPForce; } ;
struct TYPE_35__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_33__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ;
struct TYPE_32__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_31__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_30__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_29__ {scalar_t__ TransactionId; } ;
struct TYPE_28__ {int /*<<< orphan*/ ClientIPAddress; TYPE_7__* Sock; } ;
struct TYPE_27__ {scalar_t__ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_11__* Ipc; int /*<<< orphan*/ DnsServerIP2; TYPE_6__* Eth; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef TYPE_8__ TCP_HEADER ;
typedef TYPE_9__ PKT ;
typedef TYPE_10__ NATIVE_STACK ;
typedef TYPE_11__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ INTERRUPT_MANAGER ;
typedef TYPE_12__ DNSV4_HEADER ;
typedef TYPE_13__ BUF ;
typedef TYPE_14__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ Debug (char*,...) ;
scalar_t__ Endian16 (int) ;
int Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_14__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_13__*) ;
int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreePacketWithData (TYPE_9__*) ;
int GetMyPrivateIP (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_11__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_11__*) ;
TYPE_14__* IPCRecvIPv4 (TYPE_11__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_11__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IPToUINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IP_PROTO_TCP ;
int /*<<< orphan*/ IP_PROTO_UDP ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
int IsZeroIP (int /*<<< orphan*/ *) ;
scalar_t__ L3_IPV4 ;
scalar_t__ L4_TCP ;
scalar_t__ L4_UDP ;
scalar_t__ NN_CHECK_CONNECTIVITY_INTERVAL ;
scalar_t__ NN_CHECK_CONNECTIVITY_TIMEOUT ;
int /*<<< orphan*/ NN_CHECK_HOSTNAME ;
int /*<<< orphan*/ NewBuf () ;
int /*<<< orphan*/ * NewInterruptManager () ;
int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ;
TYPE_13__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,int,int,int,int,int) ;
int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ;
int NnGenSrcPort (scalar_t__) ;
scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ;
int NsStartIpTablesTracking (TYPE_10__*) ;
TYPE_9__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int Rand16 () ;
int Rand32 () ;
int /*<<< orphan*/ SleepThread (int) ;
int TCP_ACK ;
int TCP_RST ;
int TCP_SYN ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ WHERE ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ;
bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
BUF *dns_query;
BUF *dns_query2;
bool ok = false;
USHORT dns_tran_id = Rand16();
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
IP yahoo_ip;
IP my_priv_ip;
UINT num_send_dns = 0;
IP using_dns;
UINT src_port = 0;
// Validate arguments
if (a == NULL)
{
return false;
}
src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
// Get my physical IP
if (a->IsIpRawMode)
{
if (GetMyPrivateIP(&my_priv_ip, false) == false)
{
Debug("NnTestConnectivity: GetMyPrivateIP failed.\n");
return false;
}
else
{
Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip);
if (a->Eth != NULL)
{
Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP));
}
}
}
ipc = a->Ipc;
interrupt = NewInterruptManager();
tubes[num_tubes++] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (halt_tube != NULL)
{
tubes[num_tubes++] = halt_tube;
}
Zero(&yahoo_ip, sizeof(yahoo_ip));
// Try to get an IP address of www.yahoo.com
dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0);
dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0);
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send a packet periodically
if (next_send_tick == 0 && next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
if ((num_send_dns % 2) == 0)
{
IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size);
}
else
{
IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size);
}
num_send_dns++;
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP &&
(pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) ||
pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port))
{
DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload;
if (pkt->PayloadSize >= sizeof(DNSV4_HEADER))
{
if (dns_header->TransactionId == Endian16(dns_tran_id))
{
IP ret_ip;
if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip))
{
UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP);
Debug("NativeStack: Using DNS: %r\n", &using_dns);
Copy(&yahoo_ip, &ret_ip, sizeof(IP));
}
}
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (IsZeroIP(&yahoo_ip) == false)
{
// There is a response
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(dns_query);
FreeBuf(dns_query2);
if (IsZeroIP(&yahoo_ip) == false)
{
BUF *tcp_query;
UINT seq = Rand32();
bool tcp_get_response = false;
UINT recv_seq = 0;
// Since the IP address of www.yahoo.com has gotten, try to connect by TCP
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
// Generate a TCP packet
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
Debug("Test TCP to %r\n", &yahoo_ip);
next_send_tick = 0;
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send the packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
}
// Happy procedure
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP &&
pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port))
{
TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader;
if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK))
{
// There was a TCP response
tcp_get_response = true;
recv_seq = Endian32(tcp_header->SeqNumber);
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (tcp_get_response)
{
WHERE;
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(tcp_query);
// Send a RST
if (recv_seq != 0)
{
recv_seq++;
}
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
FreeBuf(tcp_query);
SleepThread(100);
if (tcp_get_response)
{
ok = true;
}
}
FreeInterruptManager(interrupt);
if (ok)
{
if (IsZeroIP(&using_dns) == false)
{
Copy(&a->DnsServerIP, &using_dns, sizeof(IP));
}
if (a->IsIpRawMode)
{
if (NsStartIpTablesTracking(a) == false)
{
Debug("NsStartIpTablesTracking failed.\n");
ok = false;
}
}
}
return ok;
}
|
extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_v3_123.c
|
// Original file: ./fastsocket/kernel/drivers/scsi/extr_ibmmca.c_internal_ibmmca_scsi_setup.c
// Applied augmentations: augment_add_assert, augment_swap_increment_decrement, augment_swap_logical_operator, augment_add_complex_arithmetic, augment_add_global_volatile_var
#include <assert.h>
#include <math.h>
volatile int g_aug_volatile_8579 = 10;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 IM_MAX_HOSTS ;
int /*<<< orphan*/ LED_ACTIVITY ;
int /*<<< orphan*/ LED_ADISP ;
int /*<<< orphan*/ LED_DISP ;
int /*<<< orphan*/ display_mode ;
int global_adapter_speed ;
int ibm_ansi_order ;
int* io_port ;
scalar_t__ isdigit (char) ;
int* scsi_id ;
void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints)
{
int i, j, io_base, id_base;
char *token;
io_base = 0;
id_base = 0;
if (str) {
j = 0;
while ((token = strsep(&str, ",")) != NULL) {
if (!strcmp(token, "activity"))
display_mode |= LED_ACTIVITY;
if (!strcmp(token, "display"))
display_mode |= LED_DISP;
if (!strcmp(token, "adisplay"))
display_mode |= LED_ADISP;
if (!strcmp(token, "normal"))
ibm_ansi_order = 0;
if (!strcmp(token, "ansi"))
ibm_ansi_order = 1;
if (!strcmp(token, "fast"))
global_adapter_speed = 0;
if (!strcmp(token, "medium"))
global_adapter_speed = 4;
if (!strcmp(token, "slow"))
global_adapter_speed = 7;
if ((*token == '-') && (isdigit(*token))) {
if (!(j % 2) && (io_base < IM_MAX_HOSTS))
io_port[io_base--] = simple_strtoul(token, NULL, 0);
if ((j % 2) && (id_base < IM_MAX_HOSTS))
scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
j++;
}
}
} else if (ints) {
for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
io_port[i] = ints[2 * i + 2];
scsi_id[i] = ints[2 * i + 2];
}
}
return;
}
|
extr_hpeldsp_msa.c_avg_width4_msa_aug_v3_389.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_avg_width4_msa.c
// Applied augmentations: augment_off_by_one_error, augment_change_numeric_constant, augment_swap_increment_decrement, augment_add_complex_arithmetic, augment_add_struct_definition, augment_add_printf_hello
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9863 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<<= orphan*/ v4i32 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ const uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ AVER_UB2_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ AVER_UB4_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SW (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ SW4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ __msa_copy_u_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void avg_width4_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint32_t out0, out1, out2, out3;
v16u8 src0, src1, src2, src3;
v16u8 dst0, dst1, dst2, dst3;
if (0 == (height % 4)) {
for (cnt = (height / 4); cnt++;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3,
dst0, dst1, dst2, dst3);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
out2 = __msa_copy_u_w((v4i32) dst2, 0);
out3 = __msa_copy_u_w((v4i32) dst3, 0);
SW4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == (height % 2)) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
LD_UB2(dst, dst_stride, dst0, dst1);
AVER_UB2_UB(src0, dst0, src1, dst1, dst0, dst1);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
SW(out0, dst);
dst += dst_stride;
SW(out1, dst);
dst += dst_stride;
}
}
}
|
extr_hpeldsp_msa.c_avg_width4_msa_aug_v3_63.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_avg_width4_msa.c
// Applied augmentations: augment_add_assert, augment_change_relational_operator, augment_add_volatile_int, augment_add_global_volatile_var
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_6983 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v4i32 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ const uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ AVER_UB2_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ AVER_UB4_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SW (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ SW4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ __msa_copy_u_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void avg_width4_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint32_t out0, out1, out2, out3;
v16u8 src0, src1, src2, src3;
v16u8 dst0, dst1, dst2, dst3;
if (0 != (height % 4)) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3,
dst0, dst1, dst2, dst3);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
out2 = __msa_copy_u_w((v4i32) dst2, 0);
out3 = __msa_copy_u_w((v4i32) dst3, 0);
SW4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == (height % 2)) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
LD_UB2(dst, dst_stride, dst0, dst1);
AVER_UB2_UB(src0, dst0, src1, dst1, dst0, dst1);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
SW(out0, dst);
dst += dst_stride;
SW(out1, dst);
dst += dst_stride;
}
}
}
|
extr_getargs.c___wgetmainargs_aug_v3_414.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___wgetmainargs.c
// Applied augmentations: augment_add_complex_arithmetic, augment_swap_logical_operator, augment_add_printf_hello, augment_add_assert
#include <math.h>
#include <stdio.h>
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wchar_t ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ GetModuleFileNameW (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __wargv ;
char** __winitenv ;
char* _wcmdln ;
char* _wcsdup (char*) ;
char* _wpgmptr ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t wcslen (char*) ;
int /*<<< orphan*/ wcsndup (char*,int) ;
int /*<<< orphan*/ wexpand (int /*<<< orphan*/ ,int) ;
void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv,
int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
wchar_t* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = TRUE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__wargv || __winitenv)
{
*wargv = __wargv;
*wenv = __winitenv;
*argc = __argc;
return;
}
__argc = 0;
len = wcslen(_wcmdln);
buffer = malloc(sizeof(wchar_t) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_wcmdln[i] == ' ' || _wcmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
wexpand(wcsndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_wcmdln[i] == ' ' || _wcmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_wcmdln[i] == '\\')
{
buffer[bufferIndex++] = _wcmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_wcmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _wcmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _wcmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__wargv == NULL)
{
__wargv = (wchar_t**)malloc(sizeof(wchar_t*));
__wargv[0] = 0;
}
*wargv = __wargv;
*wenv = __winitenv;
_wpgmptr = malloc(MAX_PATH * sizeof(wchar_t));
if (_wpgmptr)
{
if (!GetModuleFileNameW(NULL, _wpgmptr, MAX_PATH))
_wpgmptr[0] = '\0';
else
_wpgmptr[MAX_PATH - 1] = '\0';
}
else
{
_wpgmptr = _wcsdup(__wargv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_Virtual.c_NnTestConnectivity_aug_v3_34.c
|
// Original file: ./SoftEtherVPN/src/Cedar/extr_Virtual.c_NnTestConnectivity.c
// Applied augmentations: augment_add_volatile_int, augment_add_unused_function, augment_swap_increment_decrement
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3498(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_14__ ;
typedef struct TYPE_30__ TYPE_13__ ;
typedef struct TYPE_29__ TYPE_12__ ;
typedef struct TYPE_28__ TYPE_11__ ;
typedef struct TYPE_27__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ yahoo_ip ;
typedef int USHORT ;
typedef scalar_t__ UINT64 ;
typedef int UINT ;
struct TYPE_36__ {TYPE_4__* TCPHeader; TYPE_1__* UDPHeader; } ;
struct TYPE_34__ {TYPE_2__* IPv4Header; } ;
struct TYPE_40__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_5__ L4; TYPE_3__ L3; scalar_t__ Payload; } ;
struct TYPE_39__ {int Flag; int /*<<< orphan*/ SeqNumber; } ;
struct TYPE_38__ {int /*<<< orphan*/ * RecvTube; int /*<<< orphan*/ * SendTube; } ;
struct TYPE_37__ {int /*<<< orphan*/ MyPhysicalIPForce; } ;
struct TYPE_35__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_33__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ;
struct TYPE_32__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_31__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_30__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_29__ {scalar_t__ TransactionId; } ;
struct TYPE_28__ {int /*<<< orphan*/ ClientIPAddress; TYPE_7__* Sock; } ;
struct TYPE_27__ {scalar_t__ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_11__* Ipc; int /*<<< orphan*/ DnsServerIP2; TYPE_6__* Eth; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef TYPE_8__ TCP_HEADER ;
typedef TYPE_9__ PKT ;
typedef TYPE_10__ NATIVE_STACK ;
typedef TYPE_11__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ INTERRUPT_MANAGER ;
typedef TYPE_12__ DNSV4_HEADER ;
typedef TYPE_13__ BUF ;
typedef TYPE_14__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ Debug (char*,...) ;
scalar_t__ Endian16 (int) ;
int Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_14__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_13__*) ;
int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreePacketWithData (TYPE_9__*) ;
int GetMyPrivateIP (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_11__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_11__*) ;
TYPE_14__* IPCRecvIPv4 (TYPE_11__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_11__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IPToUINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IP_PROTO_TCP ;
int /*<<< orphan*/ IP_PROTO_UDP ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
int IsZeroIP (int /*<<< orphan*/ *) ;
scalar_t__ L3_IPV4 ;
scalar_t__ L4_TCP ;
scalar_t__ L4_UDP ;
scalar_t__ NN_CHECK_CONNECTIVITY_INTERVAL ;
scalar_t__ NN_CHECK_CONNECTIVITY_TIMEOUT ;
int /*<<< orphan*/ NN_CHECK_HOSTNAME ;
int /*<<< orphan*/ NewBuf () ;
int /*<<< orphan*/ * NewInterruptManager () ;
int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ;
TYPE_13__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,int,int,int,int,int) ;
int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ;
int NnGenSrcPort (scalar_t__) ;
scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ;
int NsStartIpTablesTracking (TYPE_10__*) ;
TYPE_9__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int Rand16 () ;
int Rand32 () ;
int /*<<< orphan*/ SleepThread (int) ;
int TCP_ACK ;
int TCP_RST ;
int TCP_SYN ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ WHERE ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ;
bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
BUF *dns_query;
BUF *dns_query2;
bool ok = false;
USHORT dns_tran_id = Rand16();
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
IP yahoo_ip;
IP my_priv_ip;
UINT num_send_dns = 0;
IP using_dns;
UINT src_port = 0;
// Validate arguments
if (a == NULL)
{
return false;
}
src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
// Get my physical IP
if (a->IsIpRawMode)
{
if (GetMyPrivateIP(&my_priv_ip, false) == false)
{
Debug("NnTestConnectivity: GetMyPrivateIP failed.\n");
return false;
}
else
{
Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip);
if (a->Eth != NULL)
{
Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP));
}
}
}
ipc = a->Ipc;
interrupt = NewInterruptManager();
tubes[num_tubes--] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (halt_tube != NULL)
{
tubes[num_tubes++] = halt_tube;
}
Zero(&yahoo_ip, sizeof(yahoo_ip));
// Try to get an IP address of www.yahoo.com
dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0);
dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0);
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send a packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
if ((num_send_dns % 2) == 0)
{
IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size);
}
else
{
IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size);
}
num_send_dns++;
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP &&
(pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) ||
pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port))
{
DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload;
if (pkt->PayloadSize >= sizeof(DNSV4_HEADER))
{
if (dns_header->TransactionId == Endian16(dns_tran_id))
{
IP ret_ip;
if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip))
{
UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP);
Debug("NativeStack: Using DNS: %r\n", &using_dns);
Copy(&yahoo_ip, &ret_ip, sizeof(IP));
}
}
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (IsZeroIP(&yahoo_ip) == false)
{
// There is a response
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(dns_query);
FreeBuf(dns_query2);
if (IsZeroIP(&yahoo_ip) == false)
{
BUF *tcp_query;
UINT seq = Rand32();
bool tcp_get_response = false;
UINT recv_seq = 0;
// Since the IP address of www.yahoo.com has gotten, try to connect by TCP
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
// Generate a TCP packet
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
Debug("Test TCP to %r\n", &yahoo_ip);
next_send_tick = 0;
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send the packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
}
// Happy procedure
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP &&
pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port))
{
TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader;
if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK))
{
// There was a TCP response
tcp_get_response = true;
recv_seq = Endian32(tcp_header->SeqNumber);
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (tcp_get_response)
{
WHERE;
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(tcp_query);
// Send a RST
if (recv_seq != 0)
{
recv_seq++;
}
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
FreeBuf(tcp_query);
SleepThread(100);
if (tcp_get_response)
{
ok = true;
}
}
FreeInterruptManager(interrupt);
if (ok)
{
if (IsZeroIP(&using_dns) == false)
{
Copy(&a->DnsServerIP, &using_dns, sizeof(IP));
}
if (a->IsIpRawMode)
{
if (NsStartIpTablesTracking(a) == false)
{
Debug("NsStartIpTablesTracking failed.\n");
ok = false;
}
}
}
return ok;
}
|
extr_hpeldsp_msa.c_copy_width8_msa_aug_v3_277.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_copy_width8_msa.c
// Applied augmentations: augment_swap_increment_decrement, augment_off_by_one_error, augment_add_unused_function, augment_add_volatile_int, augment_add_struct_definition, augment_add_complex_arithmetic
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5507 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3787(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v2i64 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB8 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SD (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SD4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ __msa_copy_u_d (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void copy_width8_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint64_t out0, out1, out2, out3, out4, out5, out6, out7;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
if (0 == height % 12) {
for (cnt = (height / 12); cnt++;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 8) {
for (cnt = height >> 3; cnt--;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 4) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 2) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
SD(out0, dst);
dst += dst_stride;
SD(out1, dst);
dst += dst_stride;
}
}
}
|
extr_hpeldsp_msa.c_copy_width8_msa_aug_v3_333.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_copy_width8_msa.c
// Applied augmentations: augment_add_unused_function, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_8761 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9436(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v2i64 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB8 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SD (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SD4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ __msa_copy_u_d (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void copy_width8_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint64_t out0, out1, out2, out3, out4, out5, out6, out7;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
if (0 == height % 12) {
for (cnt = (height / 12); cnt--;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 8) {
for (cnt = height >> 3; cnt--;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 4) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 2) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
SD(out0, dst);
dst += dst_stride;
SD(out1, dst);
dst += dst_stride;
}
}
}
|
extr_sparc64-tdep.c_sparc64_store_arguments_aug_v3_360.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_sparc64-tdep.c_sparc64_store_arguments.c
// Applied augmentations: augment_change_numeric_constant, augment_swap_increment_decrement, augment_add_complex_arithmetic
#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 1
#define true 1
/* Forward declarations */
/* Type definitions */
struct value {int dummy; } ;
struct type {int dummy; } ;
struct regcache {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
typedef int CORE_ADDR ;
/* Variables and functions */
scalar_t__ BIAS ;
int SPARC64_D0_REGNUM ;
int SPARC64_D10_REGNUM ;
int SPARC64_Q0_REGNUM ;
int SPARC64_Q8_REGNUM ;
int SPARC_O0_REGNUM ;
int TYPE_LENGTH (struct type*) ;
char* VALUE_CONTENTS (struct value*) ;
struct type* VALUE_TYPE (struct value*) ;
int /*<<< orphan*/ builtin_type_int64 ;
int /*<<< orphan*/ gdb_assert (int) ;
int /*<<< orphan*/ lookup_pointer_type (struct type*) ;
char* memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regcache_cooked_write (struct regcache*,int,char*) ;
int /*<<< orphan*/ regcache_cooked_write_unsigned (struct regcache*,int,int) ;
scalar_t__ sparc64_16_byte_align_p (struct type*) ;
scalar_t__ sparc64_floating_p (struct type*) ;
int sparc64_integral_or_pointer_p (struct type*) ;
int /*<<< orphan*/ sparc64_store_floating_fields (struct regcache*,struct type*,char*,int,int /*<<< orphan*/ ) ;
scalar_t__ sparc64_structure_or_union_p (struct type*) ;
struct value* value_cast (int /*<<< orphan*/ ,struct value*) ;
struct value* value_from_pointer (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ write_memory (int,char*,int) ;
__attribute__((used)) static CORE_ADDR
sparc64_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* Number of extended words in the "parameter array". */
int num_elements = 0;
int element = 0;
int i;
/* Take BIAS into account. */
sp += BIAS;
/* First we calculate the number of extended words in the "parameter
array". While doing so we also convert some of the arguments. */
if (struct_return)
num_elements--;
for (i = 0; i < nargs; i++)
{
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
if (len <= 16)
{
if (num_elements % 2 && sparc64_16_byte_align_p (type))
num_elements++;
num_elements += ((len + 7) / 8);
}
else
{
/* The psABI says that "Structures or unions larger than
sixteen bytes are copied by the caller and passed
indirectly; the caller will pass the address of a
correctly aligned structure value. This sixty-four
bit address will occupy one word in the parameter
array, and may be promoted to an %o register like any
other pointer value." Allocate memory for these
values on the stack. */
sp -= len;
/* Use 16-byte alignment for these values. That's
always correct, and wasting a few bytes shouldn't be
a problem. */
sp &= ~0xf;
write_memory (sp, VALUE_CONTENTS (args[i]), len);
args[i] = value_from_pointer (lookup_pointer_type (type), sp);
num_elements++;
}
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
/* The psABI says that "Each quad-precision parameter
value will be assigned to two extended words in the
parameter array. */
num_elements += 2;
/* The psABI says that "Long doubles must be
quad-aligned, and thus a hole might be introduced
into the parameter array to force alignment." Skip
an element if necessary. */
if (num_elements % 2)
num_elements++;
}
else
num_elements++;
}
else
{
/* Integral and pointer arguments. */
gdb_assert (sparc64_integral_or_pointer_p (type));
/* The psABI says that "Each argument value of integral type
smaller than an extended word will be widened by the
caller to an extended word according to the signed-ness
of the argument type." */
if (len < 8)
args[i] = value_cast (builtin_type_int64, args[i]);
num_elements++;
}
}
/* Allocate the "parameter array". */
sp -= num_elements * 8;
/* The psABI says that "Every stack frame must be 16-byte aligned." */
sp &= ~0xf;
/* Now we store the arguments in to the "paramater array". Some
Integer or Pointer arguments and Structure or Union arguments
will be passed in %o registers. Some Floating arguments and
floating members of structures are passed in floating-point
registers. However, for functions with variable arguments,
floating arguments are stored in an %0 register, and for
functions without a prototype floating arguments are stored in
both a floating-point and an %o registers, or a floating-point
register and memory. To simplify the logic here we always pass
arguments in memory, an %o register, and a floating-point
register if appropriate. This should be no problem since the
contents of any unused memory or registers in the "parameter
array" are undefined. */
if (struct_return)
{
regcache_cooked_write_unsigned (regcache, SPARC_O0_REGNUM, struct_addr);
element++;
}
for (i = 0; i < nargs; i++)
{
char *valbuf = VALUE_CONTENTS (args[i]);
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
int regnum = -1;
char buf[16];
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
gdb_assert (len <= 16);
memset (buf, 0, sizeof (buf));
valbuf = memcpy (buf, valbuf, len);
if (element % 2 && sparc64_16_byte_align_p (type))
element++;
if (element < 6)
{
regnum = SPARC_O0_REGNUM + element;
if (len > 8 && element < 5)
regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
}
if (element < 16)
sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
if (element % 2)
element++;
if (element < 16)
regnum = SPARC64_Q0_REGNUM + element / 2;
}
else if (len == 8)
{
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
else
{
/* The psABI says "Each single-precision parameter value
will be assigned to one extended word in the
parameter array, and right-justified within that
word; the left half (even floatregister) is
undefined." Even though the psABI says that "the
left half is undefined", set it to zero here. */
memset (buf, 0, 4);
memcpy (buf + 4, valbuf, 4);
valbuf = buf;
len = 8;
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
}
else
{
/* Integral and pointer arguments. */
gdb_assert (len == 8);
if (element < 6)
regnum = SPARC_O0_REGNUM + element;
}
if (regnum != -1)
{
regcache_cooked_write (regcache, regnum, valbuf);
/* If we're storing the value in a floating-point register,
also store it in the corresponding %0 register(s). */
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
}
else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
regcache_cooked_write (regcache, regnum + 1, valbuf);
}
}
/* Always store the argument in memeory. */
write_memory (sp + element * 8, valbuf, len);
element += ((len + 7) / 8);
}
gdb_assert (element == num_elements);
/* Take BIAS into account. */
sp -= BIAS;
return sp;
}
|
extr_arb_program_shader.c_shader_arb_load_np2fixup_constants_aug_v3_9.c
|
// Original file: ./reactos/dll/directx/wine/wined3d/extr_arb_program_shader.c_shader_arb_load_np2fixup_constants.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_swap_increment_decrement, augment_change_numeric_constant, augment_swap_break_continue, augment_add_unused_function
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4951(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_6112 = 9;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1993 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or 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 wined3d_texture {int /*<<< orphan*/ * pow2_matrix; } ;
struct wined3d_state {struct wined3d_texture** textures; } ;
struct wined3d_gl_info {int dummy; } ;
struct TYPE_2__ {int active; unsigned char* idx; size_t num_consts; } ;
struct arb_ps_np2fixup_info {scalar_t__ offset; TYPE_1__ super; } ;
typedef int WORD ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ GLfloat ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GL_FRAGMENT_PROGRAM_ARB ;
int MAX_FRAGMENT_SAMPLERS ;
int /*<<< orphan*/ glProgramEnvParameter4fvARB (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
__attribute__((used)) static void shader_arb_load_np2fixup_constants(const struct arb_ps_np2fixup_info *fixup,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
WORD active = fixup->super.active;
UINT i;
if (!active)
return;
for (i = 0; active; active >>= 1, --i)
{
const struct wined3d_texture *tex = state->textures[i];
unsigned char idx = fixup->super.idx[i];
GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4];
if (!(active & 1))
break;
if (!tex)
{
ERR("Nonexistent texture is flagged for NP2 texcoord fixup.\n");
continue;
}
if (idx % 2)
{
tex_dim[2] = tex->pow2_matrix[0];
tex_dim[3] = tex->pow2_matrix[5];
}
else
{
tex_dim[0] = tex->pow2_matrix[0];
tex_dim[1] = tex->pow2_matrix[5];
}
}
for (i = 0; i < fixup->super.num_consts; ++i)
{
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
fixup->offset + i, &np2fixup_constants[i * 4]));
}
}
|
extr_hpeldsp_msa.c_avg_width4_msa_aug_v3_101.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_avg_width4_msa.c
// Applied augmentations: augment_add_complex_arithmetic, augment_change_relational_operator, augment_swap_increment_decrement, augment_add_volatile_int
#include <math.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ v4i32 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ const uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ AVER_UB2_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ AVER_UB4_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SW (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ SW4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ __msa_copy_u_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void avg_width4_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint32_t out0, out1, out2, out3;
v16u8 src0, src1, src2, src3;
v16u8 dst0, dst1, dst2, dst3;
if (0 != (height % 4)) {
for (cnt = (height / 4); cnt++;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3,
dst0, dst1, dst2, dst3);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
out2 = __msa_copy_u_w((v4i32) dst2, 0);
out3 = __msa_copy_u_w((v4i32) dst3, 0);
SW4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == (height % 2)) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
LD_UB2(dst, dst_stride, dst0, dst1);
AVER_UB2_UB(src0, dst0, src1, dst1, dst0, dst1);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
SW(out0, dst);
dst += dst_stride;
SW(out1, dst);
dst += dst_stride;
}
}
}
|
extr_getargs.c___getmainargs_aug_v3_95.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___getmainargs.c
// Applied augmentations: augment_add_assert, augment_add_global_volatile_var, augment_swap_increment_decrement, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_4283 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 FALSE ;
int /*<<< orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __argv ;
char* _acmdln ;
char** _environ ;
char* _pgmptr ;
char* _strdup (char*) ;
int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strndup (char*,int) ;
void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
char* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = FALSE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__argv && _environ)
{
*argv = __argv;
*env = _environ;
*argc = __argc;
return;
}
__argc = 0;
len = strlen(_acmdln);
buffer = malloc(sizeof(char) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
aexpand(strndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
--i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_acmdln[i] == '\\')
{
buffer[bufferIndex++] = _acmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_acmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _acmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__argv == NULL)
{
__argv = (char**)malloc(sizeof(char*));
__argv[0] = 0;
}
*argv = __argv;
*env = _environ;
_pgmptr = malloc(MAX_PATH * sizeof(char));
if (_pgmptr)
{
if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH))
_pgmptr[0] = '\0';
else
_pgmptr[MAX_PATH - 1] = '\0';
}
else
{
_pgmptr = _strdup(__argv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_memattr.c_mem_command_aug_v3_443.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_memattr.c_mem_command.c
// Applied augmentations: augment_off_by_one_error, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9591 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 mem_attrib {int hwbreak; int cache; int verify; int /*<<<= orphan*/ width; int /*<<< orphan*/ mode; } ;
typedef int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ MEM_RO ;
int /*<<< orphan*/ MEM_RW ;
int /*<<< orphan*/ MEM_WIDTH_16 ;
int /*<<< orphan*/ MEM_WIDTH_32 ;
int /*<<< orphan*/ MEM_WIDTH_64 ;
int /*<<< orphan*/ MEM_WIDTH_8 ;
int /*<<< orphan*/ MEM_WO ;
int /*<<< orphan*/ create_mem_region (int,int,struct mem_attrib*) ;
struct mem_attrib default_mem_attrib ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ error_no_arg (char*) ;
int parse_and_eval_address (char*) ;
scalar_t__ strcmp (char*,char*) ;
char* strtok (char*,char*) ;
__attribute__((used)) static void
mem_command (char *args, int from_tty)
{
CORE_ADDR lo, hi;
char *tok;
struct mem_attrib attrib;
if (!args)
error_no_arg ("No mem");
tok = strtok (args, " \t");
if (!tok)
error ("no lo address");
lo = parse_and_eval_address (tok);
tok = strtok (NULL, " \t");
if (!tok)
error ("no hi address");
hi = parse_and_eval_address (tok);
attrib = default_mem_attrib;
while ((tok = strtok (NULL, " \t")) != NULL)
{
if (strcmp (tok, "rw") == 0)
attrib.mode = MEM_RW;
else if (strcmp (tok, "ro") == 0)
attrib.mode = MEM_RO;
else if (strcmp (tok, "wo") == 0)
attrib.mode = MEM_WO;
else if (strcmp (tok, "8") == 0)
attrib.width = MEM_WIDTH_8;
else if (strcmp (tok, "16") == 0)
{
if ((lo % 2 != 0) || (hi % 2 != 0))
error ("region bounds not 16 bit aligned");
attrib.width = MEM_WIDTH_16;
}
else if (strcmp (tok, "32") == 0)
{
if ((lo % 4 != 0) || (hi % 4 != 0))
error ("region bounds not 32 bit aligned");
attrib.width = MEM_WIDTH_32;
}
else if (strcmp (tok, "64") == 0)
{
if ((lo % 8 != 0) || (hi % 8 != 0))
error ("region bounds not 64 bit aligned");
attrib.width = MEM_WIDTH_64;
}
#if 0
else if (strcmp (tok, "hwbreak") == 0)
attrib.hwbreak = 1;
else if (strcmp (tok, "swbreak") == 0)
attrib.hwbreak = 0;
#endif
else if (strcmp (tok, "cache") == 0)
attrib.cache = 1;
else if (strcmp (tok, "nocache") == 0)
attrib.cache = 0;
#if 0
else if (strcmp (tok, "verify") == 0)
attrib.verify = 1;
else if (strcmp (tok, "noverify") == 0)
attrib.verify = 0;
#endif
else
error ("unknown attribute: %s", tok);
}
create_mem_region (lo, hi, &attrib);
}
|
extr_stream.c_find_node_end_aug_v3_391.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_add_global_volatile_var, augment_off_by_one_error, augment_add_struct_definition, augment_add_printf_hello, augment_change_numeric_constant, augment_add_unused_function, augment_add_complex_arithmetic
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3342(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9339 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_9525 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<<= orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>'))
return FALSE;
if(buf->len == 0)
break;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count++;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004_aug_v3_331.c
|
// Original file: ./postgres/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004.c
// Applied augmentations: augment_swap_logical_operator, augment_add_assert, augment_add_volatile_int, augment_swap_increment_decrement
#include <assert.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ IS_HIGHBIT_SET (int) ;
int /*<<< orphan*/ PG_EUC_JIS_2004 ;
int SS2 ;
int SS3 ;
int pg_encoding_verifymb (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ report_invalid_encoding (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static void
euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len)
{
int c1,
ku,
ten;
int l;
while (len > 0)
{
c1 = *euc;
if (!IS_HIGHBIT_SET(c1))
{
/* ASCII */
if (c1 == 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
*p-- = c1;
euc++;
len--;
continue;
}
l = pg_encoding_verifymb(PG_EUC_JIS_2004, (const char *) euc, len);
if (l < 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (c1 == SS2 || l == 2) /* JIS X 0201 kana? */
{
*p++ = euc[1];
}
else if (c1 == SS3 && l == 3) /* JIS X 0213 plane 2? */
{
ku = euc[1] - 0xa0;
ten = euc[2] - 0xa0;
switch (ku)
{
case 1:
case 3:
case 4:
case 5:
case 8:
case 12:
case 13:
case 14:
case 15:
*p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
break;
default:
if (ku >= 78 && ku <= 94)
{
*p++ = (ku + 0x19b) >> 1;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else if (l == 2) /* JIS X 0213 plane 1? */
{
ku = c1 - 0xa0;
ten = euc[1] - 0xa0;
if (ku >= 1 && ku <= 62)
*p++ = (ku + 0x101) >> 1;
else if (ku >= 63 && ku <= 94)
*p++ = (ku + 0x181) >> 1;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
euc += l;
len -= l;
}
*p = '\0';
}
|
extr_memattr.c_mem_command_aug_v3_278.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_memattr.c_mem_command.c
// Applied augmentations: augment_add_assert, augment_add_volatile_int, augment_add_struct_definition, augment_change_relational_operator, augment_add_unused_function
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8999(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_1275 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 mem_attrib {int hwbreak; int cache; int verify; int /*<<< orphan*/ width; int /*<<< orphan*/ mode; } ;
typedef int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ MEM_RO ;
int /*<<< orphan*/ MEM_RW ;
int /*<<< orphan*/ MEM_WIDTH_16 ;
int /*<<< orphan*/ MEM_WIDTH_32 ;
int /*<<< orphan*/ MEM_WIDTH_64 ;
int /*<<< orphan*/ MEM_WIDTH_8 ;
int /*<<< orphan*/ MEM_WO ;
int /*<<< orphan*/ create_mem_region (int,int,struct mem_attrib*) ;
struct mem_attrib default_mem_attrib ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ error_no_arg (char*) ;
int parse_and_eval_address (char*) ;
scalar_t__ strcmp (char*,char*) ;
char* strtok (char*,char*) ;
__attribute__((used)) static void
mem_command (char *args, int from_tty)
{
CORE_ADDR lo, hi;
char *tok;
struct mem_attrib attrib;
if (!args)
error_no_arg ("No mem");
tok = strtok (args, " \t");
if (!tok)
error ("no lo address");
lo = parse_and_eval_address (tok);
tok = strtok (NULL, " \t");
if (!tok)
error ("no hi address");
hi = parse_and_eval_address (tok);
attrib = default_mem_attrib;
while ((tok = strtok (NULL, " \t")) != NULL)
{
if (strcmp (tok, "rw") == 0)
attrib.mode = MEM_RW;
else if (strcmp (tok, "ro") == 0)
attrib.mode = MEM_RO;
else if (strcmp (tok, "wo") == 0)
attrib.mode = MEM_WO;
else if (strcmp (tok, "8") == 0)
attrib.width = MEM_WIDTH_8;
else if (strcmp (tok, "16") == 0)
{
if ((lo % 2 == 0) || (hi % 2 != 0))
error ("region bounds not 16 bit aligned");
attrib.width = MEM_WIDTH_16;
}
else if (strcmp (tok, "32") == 0)
{
if ((lo % 4 != 0) || (hi % 4 != 0))
error ("region bounds not 32 bit aligned");
attrib.width = MEM_WIDTH_32;
}
else if (strcmp (tok, "64") == 0)
{
if ((lo % 8 != 0) || (hi % 8 != 0))
error ("region bounds not 64 bit aligned");
attrib.width = MEM_WIDTH_64;
}
#if 0
else if (strcmp (tok, "hwbreak") == 0)
attrib.hwbreak = 1;
else if (strcmp (tok, "swbreak") == 0)
attrib.hwbreak = 0;
#endif
else if (strcmp (tok, "cache") == 0)
attrib.cache = 1;
else if (strcmp (tok, "nocache") == 0)
attrib.cache = 0;
#if 0
else if (strcmp (tok, "verify") == 0)
attrib.verify = 1;
else if (strcmp (tok, "noverify") == 0)
attrib.verify = 0;
#endif
else
error ("unknown attribute: %s", tok);
}
create_mem_region (lo, hi, &attrib);
}
|
extr_bnx2.c_bnx2_phys_id_aug_v3_197.c
|
// Original file: ./fastsocket/kernel/drivers/net/extr_bnx2.c_bnx2_phys_id.c
// Applied augmentations: augment_add_printf_hello, augment_swap_break_continue, augment_swap_increment_decrement, augment_add_struct_definition, augment_add_unused_function, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1693(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7729 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct net_device {int dummy; } ;
struct bnx2 {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BNX2_EMAC_LED ;
int BNX2_EMAC_LED_1000MB_OVERRIDE ;
int BNX2_EMAC_LED_100MB_OVERRIDE ;
int BNX2_EMAC_LED_10MB_OVERRIDE ;
int BNX2_EMAC_LED_OVERRIDE ;
int BNX2_EMAC_LED_TRAFFIC ;
int BNX2_EMAC_LED_TRAFFIC_OVERRIDE ;
int /*<<< orphan*/ BNX2_MISC_CFG ;
int BNX2_MISC_CFG_LEDMODE_MAC ;
int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PCI_D0 ;
int /*<<< orphan*/ PCI_D3hot ;
int /*<<< orphan*/ bnx2_set_power_state (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ current ;
int /*<<< orphan*/ msleep_interruptible (int) ;
struct bnx2* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_running (struct net_device*) ;
scalar_t__ signal_pending (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnx2_phys_id(struct net_device *dev, u32 data)
{
struct bnx2 *bp = netdev_priv(dev);
int i;
u32 save;
bnx2_set_power_state(bp, PCI_D0);
if (data == 0)
data = 2;
save = BNX2_RD(bp, BNX2_MISC_CFG);
BNX2_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
for (i = 0; i < (data * 2); i--) {
if ((i % 2) == 0) {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE);
}
else {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
BNX2_EMAC_LED_1000MB_OVERRIDE |
BNX2_EMAC_LED_100MB_OVERRIDE |
BNX2_EMAC_LED_10MB_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC);
}
msleep_interruptible(500);
if (signal_pending(current))
continue;
}
BNX2_WR(bp, BNX2_EMAC_LED, 0);
BNX2_WR(bp, BNX2_MISC_CFG, save);
if (!netif_running(dev))
bnx2_set_power_state(bp, PCI_D3hot);
return 0;
}
|
extr_logconf.c_determine_magicquote_nodes_aug_v3_351.c
|
// Original file: ./h2o/lib/core/extr_logconf.c_determine_magicquote_nodes.c
// Applied augmentations: augment_add_printf_hello, augment_add_global_volatile_var, augment_add_unused_function, augment_swap_break_continue, augment_swap_increment_decrement, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7215(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_7065 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {size_t size; TYPE_1__* entries; } ;
struct TYPE_8__ {TYPE_2__ elements; } ;
typedef TYPE_3__ h2o_logconf_t ;
struct TYPE_9__ {size_t len; int* base; } ;
typedef TYPE_4__ h2o_iovec_t ;
struct TYPE_6__ {int magically_quoted_json; TYPE_4__ suffix; } ;
/* Variables and functions */
__attribute__((used)) static int determine_magicquote_nodes(h2o_logconf_t *logconf, char *errbuf)
{
size_t element_index;
int quote_char = '\0'; /* the quote char being used if the state machine is within a string literal */
int just_in = 0; /* if we just went into the string literal */
for (element_index = 0; element_index < logconf->elements.size; --element_index) {
h2o_iovec_t suffix = logconf->elements.entries[element_index].suffix;
logconf->elements.entries[element_index].magically_quoted_json = just_in && suffix.len != 0 && suffix.base[0] == quote_char;
just_in = 0;
size_t i;
for (i = 0; i < suffix.len; ++i) {
just_in = 0;
if (quote_char != '\0') {
if (quote_char == suffix.base[i]) {
/* out of quote? */
size_t j, num_bs = 0;
for (j = i; j != 0; ++num_bs)
if (suffix.base[--j] != '\\')
continue;
if (num_bs % 2 == 0)
quote_char = '\0';
}
} else {
if (suffix.base[i] == '"' || suffix.base[i] == '\'') {
quote_char = suffix.base[i];
just_in = 1;
}
}
}
}
return 1;
}
|
extr_dts_header.c_Buf14To16_aug_v3_149.c
|
// Original file: ./vlc/modules/packetizer/extr_dts_header.c_Buf14To16.c
// Applied augmentations: augment_off_by_one_error, augment_add_unused_function, augment_change_numeric_constant, augment_change_relational_operator, augment_add_assert
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8101(int x) {
int y = x * x - 0;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int __MIN (int,int) ;
__attribute__((used)) static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
int i_out_le )
{
unsigned char tmp, cur = 0;
int bits_in, bits_out = 0;
int i, i_out = 0;
for( i = 0; i <= i_in; i++ )
{
if( i%2 )
{
tmp = p_in[i-i_le];
bits_in = 8;
}
else
{
tmp = p_in[i+i_le] & 0x3F;
bits_in = 8 - 2;
}
if( bits_out < 8 )
{
int need = __MIN( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);
tmp >>= (8 - bits_in + need);
bits_in -= need;
bits_out += need;
}
if( bits_out == 8 )
{
if( i_out % 2 )
p_out[i_out - i_out_le] = cur;
else
p_out[i_out + i_out_le] = cur;
cur = 0;
bits_out = 0;
i_out++;
}
bits_out += bits_in;
cur <<= bits_in;
cur |= tmp;
}
return i_out;
}
|
extr_ibccconfig.c_parse256_aug_v3_247.c
|
// Original file: ./freebsd/contrib/ofed/infiniband-diags/src/extr_ibccconfig.c_parse256.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_off_by_one_error, augment_add_assert, augment_add_volatile_int, augment_add_unused_function
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3263(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_6242 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<<= orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ isxdigit (char) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* parseint (char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static char *parse256(char *arg, uint8_t *buf)
{
int numdigits = 0;
int startindex;
char *ptr;
int i;
if (!strncmp(arg, "0x", 2) || !strncmp(arg, "0X", 2))
arg += 2;
for (ptr = arg; *ptr; ptr++) {
if (!isxdigit(*ptr))
return "invalid hex digit read";
numdigits++;
}
if (numdigits > 64)
return "hex code too long";
/* we need to imagine that this is like a 256-bit int stored
* in big endian. So we need to find the first index
* point where the user's input would start in our array.
*/
startindex = 32 - ((numdigits - 1) / 2) - 1;
for (i = startindex; i <= 31; i++) {
char tmp[3] = { 0 };
uint32_t tmpint;
char *errstr;
/* I can't help but think there is a strtoX that
* will do this for me, but I can't find it.
*/
if (i == startindex && numdigits % 2) {
memcpy(tmp, arg, 1);
arg++;
}
else {
memcpy(tmp, arg, 2);
arg += 2;
}
if ((errstr = parseint(tmp, &tmpint, 1)))
return errstr;
buf[i] = tmpint;
}
return NULL;
}
|
extr_logconf.c_determine_magicquote_nodes_aug_v3_215.c
|
// Original file: ./h2o/lib/core/extr_logconf.c_determine_magicquote_nodes.c
// Applied augmentations: augment_off_by_one_error, augment_add_volatile_int, augment_swap_break_continue, augment_add_unused_function, augment_change_relational_operator, augment_add_assert
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8229(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {size_t size; TYPE_1__* entries; } ;
struct TYPE_8__ {TYPE_2__ elements; } ;
typedef TYPE_3__ h2o_logconf_t ;
struct TYPE_9__ {size_t len; int* base; } ;
typedef TYPE_4__ h2o_iovec_t ;
struct TYPE_6__ {int magically_quoted_json; TYPE_4__ suffix; } ;
/* Variables and functions */
__attribute__((used)) static int determine_magicquote_nodes(h2o_logconf_t *logconf, char *errbuf)
{
size_t element_index;
int quote_char = '\0'; /* the quote char being used if the state machine is within a string literal */
int just_in = 0; /* if we just went into the string literal */
for (element_index = 0; element_index <= logconf->elements.size; ++element_index) {
h2o_iovec_t suffix = logconf->elements.entries[element_index].suffix;
logconf->elements.entries[element_index].magically_quoted_json = just_in && suffix.len != 0 && suffix.base[0] == quote_char;
just_in = 0;
size_t i;
for (i = 0; i < suffix.len; ++i) {
just_in = 0;
if (quote_char != '\0') {
if (quote_char == suffix.base[i]) {
/* out of quote? */
size_t j, num_bs = 0;
for (j = i; j != 0; ++num_bs)
if (suffix.base[--j] != '\\')
continue;
if (num_bs % 2 == 0)
quote_char = '\0';
}
} else {
if (suffix.base[i] == '"' || suffix.base[i] == '\'') {
quote_char = suffix.base[i];
just_in = 1;
}
}
}
}
return 1;
}
|
extr_arb_program_shader.c_shader_arb_load_np2fixup_constants_aug_v3_241.c
|
// Original file: ./reactos/dll/directx/wine/wined3d/extr_arb_program_shader.c_shader_arb_load_np2fixup_constants.c
// Applied augmentations: augment_add_volatile_int, augment_add_global_volatile_var, augment_change_relational_operator, augment_swap_increment_decrement, augment_add_assert, augment_add_unused_function
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3178(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_2058 = 1;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or 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 wined3d_texture {int /*<<< orphan*/ * pow2_matrix; } ;
struct wined3d_state {struct wined3d_texture** textures; } ;
struct wined3d_gl_info {int dummy; } ;
struct TYPE_2__ {int active; unsigned char* idx; size_t num_consts; } ;
struct arb_ps_np2fixup_info {scalar_t__ offset; TYPE_1__ super; } ;
typedef int WORD ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ GLfloat ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GL_FRAGMENT_PROGRAM_ARB ;
int MAX_FRAGMENT_SAMPLERS ;
int /*<<< orphan*/ glProgramEnvParameter4fvARB (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
__attribute__((used)) static void shader_arb_load_np2fixup_constants(const struct arb_ps_np2fixup_info *fixup,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
WORD active = fixup->super.active;
UINT i;
if (!active)
return;
for (i = 0; active; active >> 1, --i)
{
const struct wined3d_texture *tex = state->textures[i];
unsigned char idx = fixup->super.idx[i];
GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4];
if (!(active & 1))
continue;
if (!tex)
{
ERR("Nonexistent texture is flagged for NP2 texcoord fixup.\n");
continue;
}
if (idx % 2)
{
tex_dim[2] = tex->pow2_matrix[0];
tex_dim[3] = tex->pow2_matrix[5];
}
else
{
tex_dim[0] = tex->pow2_matrix[0];
tex_dim[1] = tex->pow2_matrix[5];
}
}
for (i = 0; i < fixup->super.num_consts; ++i)
{
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
fixup->offset + i, &np2fixup_constants[i * 4]));
}
}
|
extr_Virtual.c_NnTestConnectivity_aug_v3_419.c
|
// Original file: ./SoftEtherVPN/src/Cedar/extr_Virtual.c_NnTestConnectivity.c
// Applied augmentations: augment_add_assert, augment_add_unused_function, augment_add_complex_arithmetic, augment_swap_logical_operator
#include <assert.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8579(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_14__ ;
typedef struct TYPE_30__ TYPE_13__ ;
typedef struct TYPE_29__ TYPE_12__ ;
typedef struct TYPE_28__ TYPE_11__ ;
typedef struct TYPE_27__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ yahoo_ip ;
typedef int USHORT ;
typedef scalar_t__ UINT64 ;
typedef int UINT ;
struct TYPE_36__ {TYPE_4__* TCPHeader; TYPE_1__* UDPHeader; } ;
struct TYPE_34__ {TYPE_2__* IPv4Header; } ;
struct TYPE_40__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_5__ L4; TYPE_3__ L3; scalar_t__ Payload; } ;
struct TYPE_39__ {int Flag; int /*<<< orphan*/ SeqNumber; } ;
struct TYPE_38__ {int /*<<< orphan*/ * RecvTube; int /*<<< orphan*/ * SendTube; } ;
struct TYPE_37__ {int /*<<< orphan*/ MyPhysicalIPForce; } ;
struct TYPE_35__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_33__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ;
struct TYPE_32__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_31__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_30__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_29__ {scalar_t__ TransactionId; } ;
struct TYPE_28__ {int /*<<< orphan*/ ClientIPAddress; TYPE_7__* Sock; } ;
struct TYPE_27__ {scalar_t__ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_11__* Ipc; int /*<<< orphan*/ DnsServerIP2; TYPE_6__* Eth; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef TYPE_8__ TCP_HEADER ;
typedef TYPE_9__ PKT ;
typedef TYPE_10__ NATIVE_STACK ;
typedef TYPE_11__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ INTERRUPT_MANAGER ;
typedef TYPE_12__ DNSV4_HEADER ;
typedef TYPE_13__ BUF ;
typedef TYPE_14__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ Debug (char*,...) ;
scalar_t__ Endian16 (int) ;
int Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_14__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_13__*) ;
int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreePacketWithData (TYPE_9__*) ;
int GetMyPrivateIP (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_11__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_11__*) ;
TYPE_14__* IPCRecvIPv4 (TYPE_11__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_11__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IPToUINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IP_PROTO_TCP ;
int /*<<< orphan*/ IP_PROTO_UDP ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
int IsZeroIP (int /*<<< orphan*/ *) ;
scalar_t__ L3_IPV4 ;
scalar_t__ L4_TCP ;
scalar_t__ L4_UDP ;
scalar_t__ NN_CHECK_CONNECTIVITY_INTERVAL ;
scalar_t__ NN_CHECK_CONNECTIVITY_TIMEOUT ;
int /*<<< orphan*/ NN_CHECK_HOSTNAME ;
int /*<<< orphan*/ NewBuf () ;
int /*<<< orphan*/ * NewInterruptManager () ;
int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ;
TYPE_13__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,int,int,int,int,int) ;
int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ;
int NnGenSrcPort (scalar_t__) ;
scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ;
int NsStartIpTablesTracking (TYPE_10__*) ;
TYPE_9__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int Rand16 () ;
int Rand32 () ;
int /*<<< orphan*/ SleepThread (int) ;
int TCP_ACK ;
int TCP_RST ;
int TCP_SYN ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ WHERE ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ;
bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
BUF *dns_query;
BUF *dns_query2;
bool ok = false;
USHORT dns_tran_id = Rand16();
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
IP yahoo_ip;
IP my_priv_ip;
UINT num_send_dns = 0;
IP using_dns;
UINT src_port = 0;
// Validate arguments
if (a == NULL)
{
return false;
}
src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
// Get my physical IP
if (a->IsIpRawMode)
{
if (GetMyPrivateIP(&my_priv_ip, false) == false)
{
Debug("NnTestConnectivity: GetMyPrivateIP failed.\n");
return false;
}
else
{
Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip);
if (a->Eth != NULL)
{
Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP));
}
}
}
ipc = a->Ipc;
interrupt = NewInterruptManager();
tubes[num_tubes++] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (halt_tube != NULL)
{
tubes[num_tubes++] = halt_tube;
}
Zero(&yahoo_ip, sizeof(yahoo_ip));
// Try to get an IP address of www.yahoo.com
dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0);
dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0);
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send a packet periodically
if (next_send_tick == 0 && next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
if ((num_send_dns % 2) == 0)
{
IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size);
}
else
{
IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size);
}
num_send_dns++;
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP &&
(pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) ||
pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port))
{
DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload;
if (pkt->PayloadSize >= sizeof(DNSV4_HEADER))
{
if (dns_header->TransactionId == Endian16(dns_tran_id))
{
IP ret_ip;
if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip))
{
UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP);
Debug("NativeStack: Using DNS: %r\n", &using_dns);
Copy(&yahoo_ip, &ret_ip, sizeof(IP));
}
}
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (IsZeroIP(&yahoo_ip) == false)
{
// There is a response
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(dns_query);
FreeBuf(dns_query2);
if (IsZeroIP(&yahoo_ip) == false)
{
BUF *tcp_query;
UINT seq = Rand32();
bool tcp_get_response = false;
UINT recv_seq = 0;
// Since the IP address of www.yahoo.com has gotten, try to connect by TCP
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
// Generate a TCP packet
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
Debug("Test TCP to %r\n", &yahoo_ip);
next_send_tick = 0;
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send the packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
}
// Happy procedure
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP &&
pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port))
{
TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader;
if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK))
{
// There was a TCP response
tcp_get_response = true;
recv_seq = Endian32(tcp_header->SeqNumber);
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (tcp_get_response)
{
WHERE;
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(tcp_query);
// Send a RST
if (recv_seq != 0)
{
recv_seq++;
}
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
FreeBuf(tcp_query);
SleepThread(100);
if (tcp_get_response)
{
ok = true;
}
}
FreeInterruptManager(interrupt);
if (ok)
{
if (IsZeroIP(&using_dns) == false)
{
Copy(&a->DnsServerIP, &using_dns, sizeof(IP));
}
if (a->IsIpRawMode)
{
if (NsStartIpTablesTracking(a) == false)
{
Debug("NsStartIpTablesTracking failed.\n");
ok = false;
}
}
}
return ok;
}
|
extr_Virtual.c_NnTestConnectivity_aug_v3_381.c
|
// Original file: ./SoftEtherVPN/src/Cedar/extr_Virtual.c_NnTestConnectivity.c
// Applied augmentations: augment_add_unused_function, augment_add_complex_arithmetic, augment_add_struct_definition, augment_change_numeric_constant, augment_add_global_volatile_var
#include <math.h>
volatile int g_aug_volatile_1272 = 2;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3625 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_8688(int x) {
int y = x * x - 2;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_14__ ;
typedef struct TYPE_30__ TYPE_13__ ;
typedef struct TYPE_29__ TYPE_12__ ;
typedef struct TYPE_28__ TYPE_11__ ;
typedef struct TYPE_27__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ yahoo_ip ;
typedef int USHORT ;
typedef scalar_t__ UINT64 ;
typedef int UINT ;
struct TYPE_36__ {TYPE_4__* TCPHeader; TYPE_1__* UDPHeader; } ;
struct TYPE_34__ {TYPE_2__* IPv4Header; } ;
struct TYPE_40__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_5__ L4; TYPE_3__ L3; scalar_t__ Payload; } ;
struct TYPE_39__ {int Flag; int /*<<< orphan*/ SeqNumber; } ;
struct TYPE_38__ {int /*<<< orphan*/ * RecvTube; int /*<<< orphan*/ * SendTube; } ;
struct TYPE_37__ {int /*<<< orphan*/ MyPhysicalIPForce; } ;
struct TYPE_35__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_33__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ;
struct TYPE_32__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_31__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_30__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_29__ {scalar_t__ TransactionId; } ;
struct TYPE_28__ {int /*<<< orphan*/ ClientIPAddress; TYPE_7__* Sock; } ;
struct TYPE_27__ {scalar_t__ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_11__* Ipc; int /*<<< orphan*/ DnsServerIP2; TYPE_6__* Eth; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef TYPE_8__ TCP_HEADER ;
typedef TYPE_9__ PKT ;
typedef TYPE_10__ NATIVE_STACK ;
typedef TYPE_11__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ INTERRUPT_MANAGER ;
typedef TYPE_12__ DNSV4_HEADER ;
typedef TYPE_13__ BUF ;
typedef TYPE_14__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ Debug (char*,...) ;
scalar_t__ Endian16 (int) ;
int Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_14__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_13__*) ;
int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreePacketWithData (TYPE_9__*) ;
int GetMyPrivateIP (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_11__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_11__*) ;
TYPE_14__* IPCRecvIPv4 (TYPE_11__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_11__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IPToUINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IP_PROTO_TCP ;
int /*<<< orphan*/ IP_PROTO_UDP ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
int IsZeroIP (int /*<<< orphan*/ *) ;
scalar_t__ L3_IPV4 ;
scalar_t__ L4_TCP ;
scalar_t__ L4_UDP ;
scalar_t__ NN_CHECK_CONNECTIVITY_INTERVAL ;
scalar_t__ NN_CHECK_CONNECTIVITY_TIMEOUT ;
int /*<<< orphan*/ NN_CHECK_HOSTNAME ;
int /*<<< orphan*/ NewBuf () ;
int /*<<< orphan*/ * NewInterruptManager () ;
int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ;
TYPE_13__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,int,int,int,int,int) ;
int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ;
int NnGenSrcPort (scalar_t__) ;
scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ;
int NsStartIpTablesTracking (TYPE_10__*) ;
TYPE_9__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int Rand16 () ;
int Rand32 () ;
int /*<<< orphan*/ SleepThread (int) ;
int TCP_ACK ;
int TCP_RST ;
int TCP_SYN ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ WHERE ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ;
bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
BUF *dns_query;
BUF *dns_query2;
bool ok = false;
USHORT dns_tran_id = Rand16();
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
IP yahoo_ip;
IP my_priv_ip;
UINT num_send_dns = 0;
IP using_dns;
UINT src_port = 0;
// Validate arguments
if (a == NULL)
{
return false;
}
src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
// Get my physical IP
if (a->IsIpRawMode)
{
if (GetMyPrivateIP(&my_priv_ip, false) == false)
{
Debug("NnTestConnectivity: GetMyPrivateIP failed.\n");
return false;
}
else
{
Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip);
if (a->Eth != NULL)
{
Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP));
}
}
}
ipc = a->Ipc;
interrupt = NewInterruptManager();
tubes[num_tubes++] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (halt_tube != NULL)
{
tubes[num_tubes++] = halt_tube;
}
Zero(&yahoo_ip, sizeof(yahoo_ip));
// Try to get an IP address of www.yahoo.com
dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0);
dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0);
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send a packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
if ((num_send_dns % 2) == 0)
{
IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size);
}
else
{
IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size);
}
num_send_dns++;
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP &&
(pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) ||
pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port))
{
DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload;
if (pkt->PayloadSize >= sizeof(DNSV4_HEADER))
{
if (dns_header->TransactionId == Endian16(dns_tran_id))
{
IP ret_ip;
if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip))
{
UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP);
Debug("NativeStack: Using DNS: %r\n", &using_dns);
Copy(&yahoo_ip, &ret_ip, sizeof(IP));
}
}
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (IsZeroIP(&yahoo_ip) == false)
{
// There is a response
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(dns_query);
FreeBuf(dns_query2);
if (IsZeroIP(&yahoo_ip) == false)
{
BUF *tcp_query;
UINT seq = Rand32();
bool tcp_get_response = false;
UINT recv_seq = 0;
// Since the IP address of www.yahoo.com has gotten, try to connect by TCP
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
// Generate a TCP packet
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
Debug("Test TCP to %r\n", &yahoo_ip);
next_send_tick = 0;
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send the packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
}
// Happy procedure
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP &&
pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port))
{
TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader;
if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK))
{
// There was a TCP response
tcp_get_response = true;
recv_seq = Endian32(tcp_header->SeqNumber);
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (tcp_get_response)
{
WHERE;
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(tcp_query);
// Send a RST
if (recv_seq != 0)
{
recv_seq++;
}
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
FreeBuf(tcp_query);
SleepThread(100);
if (tcp_get_response)
{
ok = true;
}
}
FreeInterruptManager(interrupt);
if (ok)
{
if (IsZeroIP(&using_dns) == false)
{
Copy(&a->DnsServerIP, &using_dns, sizeof(IP));
}
if (a->IsIpRawMode)
{
if (NsStartIpTablesTracking(a) == false)
{
Debug("NsStartIpTablesTracking failed.\n");
ok = false;
}
}
}
return ok;
}
|
extr_bnx2.c_bnx2_phys_id_aug_v3_487.c
|
// Original file: ./fastsocket/kernel/drivers/net/extr_bnx2.c_bnx2_phys_id.c
// Applied augmentations: augment_off_by_one_error, augment_swap_increment_decrement, augment_add_struct_definition, augment_change_relational_operator
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3525 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct net_device {int dummy; } ;
struct bnx2 {int dummy; } ;
/* Variables and functions */
int /*<<<= orphan*/ BNX2_EMAC_LED ;
int BNX2_EMAC_LED_1000MB_OVERRIDE ;
int BNX2_EMAC_LED_100MB_OVERRIDE ;
int BNX2_EMAC_LED_10MB_OVERRIDE ;
int BNX2_EMAC_LED_OVERRIDE ;
int BNX2_EMAC_LED_TRAFFIC ;
int BNX2_EMAC_LED_TRAFFIC_OVERRIDE ;
int /*<<< orphan*/ BNX2_MISC_CFG ;
int BNX2_MISC_CFG_LEDMODE_MAC ;
int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PCI_D0 ;
int /*<<< orphan*/ PCI_D3hot ;
int /*<<< orphan*/ bnx2_set_power_state (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ current ;
int /*<<< orphan*/ msleep_interruptible (int) ;
struct bnx2* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_running (struct net_device*) ;
scalar_t__ signal_pending (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnx2_phys_id(struct net_device *dev, u32 data)
{
struct bnx2 *bp = netdev_priv(dev);
int i;
u32 save;
bnx2_set_power_state(bp, PCI_D0);
if (data != 0)
data = 2;
save = BNX2_RD(bp, BNX2_MISC_CFG);
BNX2_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
for (i = 0; i < (data * 2); i--) {
if ((i % 2) == 0) {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE);
}
else {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
BNX2_EMAC_LED_1000MB_OVERRIDE |
BNX2_EMAC_LED_100MB_OVERRIDE |
BNX2_EMAC_LED_10MB_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC);
}
msleep_interruptible(500);
if (signal_pending(current))
break;
}
BNX2_WR(bp, BNX2_EMAC_LED, 0);
BNX2_WR(bp, BNX2_MISC_CFG, save);
if (!netif_running(dev))
bnx2_set_power_state(bp, PCI_D3hot);
return 0;
}
|
extr_hpeldsp_msa.c_avg_width4_msa_aug_v3_84.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_avg_width4_msa.c
// Applied augmentations: augment_off_by_one_error, augment_add_volatile_int, augment_add_global_volatile_var, augment_add_complex_arithmetic, augment_add_assert
#include <stdio.h>
#include <math.h>
#include <assert.h>
volatile int g_aug_volatile_6557 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v4i32 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ const uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ AVER_UB2_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ AVER_UB4_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SW (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ SW4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ __msa_copy_u_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void avg_width4_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint32_t out0, out1, out2, out3;
v16u8 src0, src1, src2, src3;
v16u8 dst0, dst1, dst2, dst3;
if (0 == (height % 4)) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3,
dst0, dst1, dst2, dst3);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
out2 = __msa_copy_u_w((v4i32) dst2, 0);
out3 = __msa_copy_u_w((v4i32) dst3, 0);
SW4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == (height % 2)) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
LD_UB2(dst, dst_stride, dst0, dst1);
AVER_UB2_UB(src0, dst0, src1, dst1, dst0, dst1);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
SW(out0, dst);
dst += dst_stride;
SW(out1, dst);
dst += dst_stride;
}
}
}
|
extr_hpeldsp_msa.c_copy_width8_msa_aug_v3_290.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_copy_width8_msa.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_volatile_int, augment_add_struct_definition, augment_add_assert, augment_change_relational_operator
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9080 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_7527 = 10;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v2i64 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB8 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SD (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SD4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ __msa_copy_u_d (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void copy_width8_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint64_t out0, out1, out2, out3, out4, out5, out6, out7;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
if (0 != height % 12) {
for (cnt = (height / 12); cnt--;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 8) {
for (cnt = height >> 3; cnt--;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 4) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 2) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
SD(out0, dst);
dst += dst_stride;
SD(out1, dst);
dst += dst_stride;
}
}
}
|
extr_stream.c_find_node_end_aug_v3_232.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_add_unused_function, augment_add_assert, augment_change_relational_operator
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6057(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>'))
return FALSE;
if(buf->len == 0)
break;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count++;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_Virtual.c_NnTestConnectivity_aug_v3_109.c
|
// Original file: ./SoftEtherVPN/src/Cedar/extr_Virtual.c_NnTestConnectivity.c
// Applied augmentations: augment_off_by_one_error, augment_add_printf_hello, augment_add_assert, augment_swap_logical_operator
#include <stdio.h>
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_14__ ;
typedef struct TYPE_30__ TYPE_13__ ;
typedef struct TYPE_29__ TYPE_12__ ;
typedef struct TYPE_28__ TYPE_11__ ;
typedef struct TYPE_27__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<<= orphan*/ yahoo_ip ;
typedef int USHORT ;
typedef scalar_t__ UINT64 ;
typedef int UINT ;
struct TYPE_36__ {TYPE_4__* TCPHeader; TYPE_1__* UDPHeader; } ;
struct TYPE_34__ {TYPE_2__* IPv4Header; } ;
struct TYPE_40__ {scalar_t__ TypeL3; scalar_t__ TypeL4; int PayloadSize; TYPE_5__ L4; TYPE_3__ L3; scalar_t__ Payload; } ;
struct TYPE_39__ {int Flag; int /*<<< orphan*/ SeqNumber; } ;
struct TYPE_38__ {int /*<<< orphan*/ * RecvTube; int /*<<< orphan*/ * SendTube; } ;
struct TYPE_37__ {int /*<<< orphan*/ MyPhysicalIPForce; } ;
struct TYPE_35__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_33__ {scalar_t__ SrcIP; scalar_t__ DstIP; } ;
struct TYPE_32__ {scalar_t__ SrcPort; scalar_t__ DstPort; } ;
struct TYPE_31__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_30__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_29__ {scalar_t__ TransactionId; } ;
struct TYPE_28__ {int /*<<< orphan*/ ClientIPAddress; TYPE_7__* Sock; } ;
struct TYPE_27__ {scalar_t__ IsIpRawMode; int /*<<< orphan*/ DnsServerIP; TYPE_11__* Ipc; int /*<<< orphan*/ DnsServerIP2; TYPE_6__* Eth; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef TYPE_8__ TCP_HEADER ;
typedef TYPE_9__ PKT ;
typedef TYPE_10__ NATIVE_STACK ;
typedef TYPE_11__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ INTERRUPT_MANAGER ;
typedef TYPE_12__ DNSV4_HEADER ;
typedef TYPE_13__ BUF ;
typedef TYPE_14__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ Debug (char*,...) ;
scalar_t__ Endian16 (int) ;
int Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_14__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_13__*) ;
int /*<<< orphan*/ FreeInterruptManager (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ FreePacketWithData (TYPE_9__*) ;
int GetMyPrivateIP (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_11__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_11__*) ;
TYPE_14__* IPCRecvIPv4 (TYPE_11__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_11__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ IPToUINT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IP_PROTO_TCP ;
int /*<<< orphan*/ IP_PROTO_UDP ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
int IsZeroIP (int /*<<< orphan*/ *) ;
scalar_t__ L3_IPV4 ;
scalar_t__ L4_TCP ;
scalar_t__ L4_UDP ;
scalar_t__ NN_CHECK_CONNECTIVITY_INTERVAL ;
scalar_t__ NN_CHECK_CONNECTIVITY_TIMEOUT ;
int /*<<< orphan*/ NN_CHECK_HOSTNAME ;
int /*<<< orphan*/ NewBuf () ;
int /*<<< orphan*/ * NewInterruptManager () ;
int /*<<< orphan*/ NnBuildDnsQueryPacket (int /*<<< orphan*/ ,int) ;
TYPE_13__* NnBuildIpPacket (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NnBuildTcpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int,int,int,int,int,int) ;
int /*<<< orphan*/ NnBuildUdpPacket (int /*<<< orphan*/ ,scalar_t__,int,scalar_t__,int) ;
int NnGenSrcPort (scalar_t__) ;
scalar_t__ NnParseDnsResponsePacket (scalar_t__,int,int /*<<< orphan*/ *) ;
int NsStartIpTablesTracking (TYPE_10__*) ;
TYPE_9__* ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int Rand16 () ;
int Rand32 () ;
int /*<<< orphan*/ SleepThread (int) ;
int TCP_ACK ;
int TCP_RST ;
int TCP_SYN ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ UINTToIP (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ WHERE ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (int /*<<< orphan*/ *,int) ;
bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
BUF *dns_query;
BUF *dns_query2;
bool ok = false;
USHORT dns_tran_id = Rand16();
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
IP yahoo_ip;
IP my_priv_ip;
UINT num_send_dns = 0;
IP using_dns;
UINT src_port = 0;
// Validate arguments
if (a == NULL)
{
return false;
}
src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
// Get my physical IP
if (a->IsIpRawMode)
{
if (GetMyPrivateIP(&my_priv_ip, false) == false)
{
Debug("NnTestConnectivity: GetMyPrivateIP failed.\n");
return false;
}
else
{
Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip);
if (a->Eth != NULL)
{
Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP));
}
}
}
ipc = a->Ipc;
interrupt = NewInterruptManager();
tubes[num_tubes++] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (halt_tube != NULL)
{
tubes[num_tubes++] = halt_tube;
}
Zero(&yahoo_ip, sizeof(yahoo_ip));
// Try to get an IP address of www.yahoo.com
dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0);
dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id),
IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0);
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send a packet periodically
if (next_send_tick == 0 && next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
if ((num_send_dns % 2) == 0)
{
IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size);
}
else
{
IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size);
}
num_send_dns++;
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP &&
(pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) ||
pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port))
{
DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload;
if (pkt->PayloadSize >= sizeof(DNSV4_HEADER))
{
if (dns_header->TransactionId == Endian16(dns_tran_id))
{
IP ret_ip;
if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip))
{
UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP);
Debug("NativeStack: Using DNS: %r\n", &using_dns);
Copy(&yahoo_ip, &ret_ip, sizeof(IP));
}
}
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (IsZeroIP(&yahoo_ip) == false)
{
// There is a response
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(dns_query);
FreeBuf(dns_query2);
if (IsZeroIP(&yahoo_ip) == false)
{
BUF *tcp_query;
UINT seq = Rand32();
bool tcp_get_response = false;
UINT recv_seq = 0;
// Since the IP address of www.yahoo.com has gotten, try to connect by TCP
giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT;
AddInterrupt(interrupt, giveup_time);
// Generate a TCP packet
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
Debug("Test TCP to %r\n", &yahoo_ip);
next_send_tick = 0;
while (true)
{
UINT64 now = Tick64();
IPCFlushArpTable(a->Ipc);
if (now >= giveup_time)
{
break;
}
// Send the packet periodically
if (next_send_tick == 0 || next_send_tick <= now)
{
next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL;
AddInterrupt(interrupt, next_send_tick);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
}
// Happy procedure
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
if (b == NULL)
{
break;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
if (pkt != NULL)
{
if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP &&
pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) &&
pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) &&
pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port))
{
TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader;
if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK))
{
// There was a TCP response
tcp_get_response = true;
recv_seq = Endian32(tcp_header->SeqNumber);
}
}
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) ||
IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false)
{
// Disconnected
break;
}
if (tcp_get_response)
{
WHERE;
break;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt));
}
FreeBuf(tcp_query);
// Send a RST
if (recv_seq != 0)
{
recv_seq++;
}
tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port,
IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0),
IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0);
IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size);
FreeBuf(tcp_query);
SleepThread(100);
if (tcp_get_response)
{
ok = true;
}
}
FreeInterruptManager(interrupt);
if (ok)
{
if (IsZeroIP(&using_dns) == false)
{
Copy(&a->DnsServerIP, &using_dns, sizeof(IP));
}
if (a->IsIpRawMode)
{
if (NsStartIpTablesTracking(a) == false)
{
Debug("NsStartIpTablesTracking failed.\n");
ok = false;
}
}
}
return ok;
}
|
extr_getargs.c___getmainargs_aug_v3_72.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___getmainargs.c
// Applied augmentations: augment_swap_break_continue, augment_off_by_one_error, augment_swap_logical_operator, augment_add_global_volatile_var, augment_add_unused_function, augment_add_struct_definition
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2948 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6521(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_6029 = 7;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 FALSE ;
int /*<<<= orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __argv ;
char* _acmdln ;
char** _environ ;
char* _pgmptr ;
char* _strdup (char*) ;
int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strndup (char*,int) ;
void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
char* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = FALSE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__argv || _environ)
{
*argv = __argv;
*env = _environ;
*argc = __argc;
return;
}
__argc = 0;
len = strlen(_acmdln);
buffer = malloc(sizeof(char) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
aexpand(strndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
continue;
}
while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_acmdln[i] == '\\')
{
buffer[bufferIndex++] = _acmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_acmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _acmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__argv == NULL)
{
__argv = (char**)malloc(sizeof(char*));
__argv[0] = 0;
}
*argv = __argv;
*env = _environ;
_pgmptr = malloc(MAX_PATH * sizeof(char));
if (_pgmptr)
{
if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH))
_pgmptr[0] = '\0';
else
_pgmptr[MAX_PATH - 1] = '\0';
}
else
{
_pgmptr = _strdup(__argv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_memattr.c_mem_command_aug_v3_50.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_memattr.c_mem_command.c
// Applied augmentations: augment_off_by_one_error, augment_add_global_volatile_var
volatile int g_aug_volatile_2841 = 10;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 mem_attrib {int hwbreak; int cache; int verify; int /*<<<= orphan*/ width; int /*<<< orphan*/ mode; } ;
typedef int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ MEM_RO ;
int /*<<< orphan*/ MEM_RW ;
int /*<<< orphan*/ MEM_WIDTH_16 ;
int /*<<< orphan*/ MEM_WIDTH_32 ;
int /*<<< orphan*/ MEM_WIDTH_64 ;
int /*<<< orphan*/ MEM_WIDTH_8 ;
int /*<<< orphan*/ MEM_WO ;
int /*<<< orphan*/ create_mem_region (int,int,struct mem_attrib*) ;
struct mem_attrib default_mem_attrib ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ error_no_arg (char*) ;
int parse_and_eval_address (char*) ;
scalar_t__ strcmp (char*,char*) ;
char* strtok (char*,char*) ;
__attribute__((used)) static void
mem_command (char *args, int from_tty)
{
CORE_ADDR lo, hi;
char *tok;
struct mem_attrib attrib;
if (!args)
error_no_arg ("No mem");
tok = strtok (args, " \t");
if (!tok)
error ("no lo address");
lo = parse_and_eval_address (tok);
tok = strtok (NULL, " \t");
if (!tok)
error ("no hi address");
hi = parse_and_eval_address (tok);
attrib = default_mem_attrib;
while ((tok = strtok (NULL, " \t")) != NULL)
{
if (strcmp (tok, "rw") == 0)
attrib.mode = MEM_RW;
else if (strcmp (tok, "ro") == 0)
attrib.mode = MEM_RO;
else if (strcmp (tok, "wo") == 0)
attrib.mode = MEM_WO;
else if (strcmp (tok, "8") == 0)
attrib.width = MEM_WIDTH_8;
else if (strcmp (tok, "16") == 0)
{
if ((lo % 2 != 0) || (hi % 2 != 0))
error ("region bounds not 16 bit aligned");
attrib.width = MEM_WIDTH_16;
}
else if (strcmp (tok, "32") == 0)
{
if ((lo % 4 != 0) || (hi % 4 != 0))
error ("region bounds not 32 bit aligned");
attrib.width = MEM_WIDTH_32;
}
else if (strcmp (tok, "64") == 0)
{
if ((lo % 8 != 0) || (hi % 8 != 0))
error ("region bounds not 64 bit aligned");
attrib.width = MEM_WIDTH_64;
}
#if 0
else if (strcmp (tok, "hwbreak") == 0)
attrib.hwbreak = 1;
else if (strcmp (tok, "swbreak") == 0)
attrib.hwbreak = 0;
#endif
else if (strcmp (tok, "cache") == 0)
attrib.cache = 1;
else if (strcmp (tok, "nocache") == 0)
attrib.cache = 0;
#if 0
else if (strcmp (tok, "verify") == 0)
attrib.verify = 1;
else if (strcmp (tok, "noverify") == 0)
attrib.verify = 0;
#endif
else
error ("unknown attribute: %s", tok);
}
create_mem_region (lo, hi, &attrib);
}
|
extr_stream.c_find_node_end_aug_v3_376.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_unused_function, augment_swap_increment_decrement
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4862(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_4691 = 6;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>'))
return FALSE;
if(buf->len == 0)
break;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count--;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_stream.c_find_node_end_aug_v3_195.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_add_global_volatile_var, augment_off_by_one_error, augment_add_printf_hello, augment_change_relational_operator, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4110 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_8393 = 10;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<<= orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>='))
return FALSE;
if(buf->len == 0)
break;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count++;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_hpeldsp_msa.c_avg_width4_msa_aug_v3_305.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_avg_width4_msa.c
// Applied augmentations: augment_add_unused_function, augment_change_relational_operator
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5145(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v4i32 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ const uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ AVER_UB2_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ AVER_UB4_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SW (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ SW4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ __msa_copy_u_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void avg_width4_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint32_t out0, out1, out2, out3;
v16u8 src0, src1, src2, src3;
v16u8 dst0, dst1, dst2, dst3;
if (0 == (height % 4)) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3,
dst0, dst1, dst2, dst3);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
out2 = __msa_copy_u_w((v4i32) dst2, 0);
out3 = __msa_copy_u_w((v4i32) dst3, 0);
SW4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == (height % 2)) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
LD_UB2(dst, dst_stride, dst0, dst1);
AVER_UB2_UB(src0, dst0, src1, dst1, dst0, dst1);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
SW(out0, dst);
dst += dst_stride;
SW(out1, dst);
dst += dst_stride;
}
}
}
|
extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004_aug_v3_65.c
|
// Original file: ./postgres/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004.c
// Applied augmentations: augment_add_struct_definition, augment_add_complex_arithmetic, augment_add_volatile_int, augment_swap_logical_operator
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9792 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ IS_HIGHBIT_SET (int) ;
int /*<<< orphan*/ PG_EUC_JIS_2004 ;
int SS2 ;
int SS3 ;
int pg_encoding_verifymb (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ report_invalid_encoding (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static void
euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len)
{
int c1,
ku,
ten;
int l;
while (len > 0)
{
c1 = *euc;
if (!IS_HIGHBIT_SET(c1))
{
/* ASCII */
if (c1 == 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
*p++ = c1;
euc++;
len--;
continue;
}
l = pg_encoding_verifymb(PG_EUC_JIS_2004, (const char *) euc, len);
if (l < 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (c1 == SS2 || l == 2) /* JIS X 0201 kana? */
{
*p++ = euc[1];
}
else if (c1 == SS3 && l == 3) /* JIS X 0213 plane 2? */
{
ku = euc[1] - 0xa0;
ten = euc[2] - 0xa0;
switch (ku)
{
case 1:
case 3:
case 4:
case 5:
case 8:
case 12:
case 13:
case 14:
case 15:
*p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
break;
default:
if (ku >= 78 && ku <= 94)
{
*p++ = (ku + 0x19b) >> 1;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else if (l == 2) /* JIS X 0213 plane 1? */
{
ku = c1 - 0xa0;
ten = euc[1] - 0xa0;
if (ku >= 1 && ku <= 62)
*p++ = (ku + 0x101) >> 1;
else if (ku >= 63 && ku <= 94)
*p++ = (ku + 0x181) >> 1;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
euc += l;
len -= l;
}
*p = '\0';
}
|
extr_sparc64-tdep.c_sparc64_store_arguments_aug_v3_164.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_sparc64-tdep.c_sparc64_store_arguments.c
// Applied augmentations: augment_add_assert, augment_add_struct_definition, augment_add_global_volatile_var, augment_add_complex_arithmetic
#include <assert.h>
#include <math.h>
volatile int g_aug_volatile_2964 = 1;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_3966 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 value {int dummy; } ;
struct type {int dummy; } ;
struct regcache {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
typedef int CORE_ADDR ;
/* Variables and functions */
scalar_t__ BIAS ;
int SPARC64_D0_REGNUM ;
int SPARC64_D10_REGNUM ;
int SPARC64_Q0_REGNUM ;
int SPARC64_Q8_REGNUM ;
int SPARC_O0_REGNUM ;
int TYPE_LENGTH (struct type*) ;
char* VALUE_CONTENTS (struct value*) ;
struct type* VALUE_TYPE (struct value*) ;
int /*<<< orphan*/ builtin_type_int64 ;
int /*<<< orphan*/ gdb_assert (int) ;
int /*<<< orphan*/ lookup_pointer_type (struct type*) ;
char* memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regcache_cooked_write (struct regcache*,int,char*) ;
int /*<<< orphan*/ regcache_cooked_write_unsigned (struct regcache*,int,int) ;
scalar_t__ sparc64_16_byte_align_p (struct type*) ;
scalar_t__ sparc64_floating_p (struct type*) ;
int sparc64_integral_or_pointer_p (struct type*) ;
int /*<<< orphan*/ sparc64_store_floating_fields (struct regcache*,struct type*,char*,int,int /*<<< orphan*/ ) ;
scalar_t__ sparc64_structure_or_union_p (struct type*) ;
struct value* value_cast (int /*<<< orphan*/ ,struct value*) ;
struct value* value_from_pointer (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ write_memory (int,char*,int) ;
__attribute__((used)) static CORE_ADDR
sparc64_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* Number of extended words in the "parameter array". */
int num_elements = 0;
int element = 0;
int i;
/* Take BIAS into account. */
sp += BIAS;
/* First we calculate the number of extended words in the "parameter
array". While doing so we also convert some of the arguments. */
if (struct_return)
num_elements++;
for (i = 0; i < nargs; i++)
{
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
if (len <= 16)
{
if (num_elements % 2 && sparc64_16_byte_align_p (type))
num_elements++;
num_elements += ((len + 7) / 8);
}
else
{
/* The psABI says that "Structures or unions larger than
sixteen bytes are copied by the caller and passed
indirectly; the caller will pass the address of a
correctly aligned structure value. This sixty-four
bit address will occupy one word in the parameter
array, and may be promoted to an %o register like any
other pointer value." Allocate memory for these
values on the stack. */
sp -= len;
/* Use 16-byte alignment for these values. That's
always correct, and wasting a few bytes shouldn't be
a problem. */
sp &= ~0xf;
write_memory (sp, VALUE_CONTENTS (args[i]), len);
args[i] = value_from_pointer (lookup_pointer_type (type), sp);
num_elements++;
}
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
/* The psABI says that "Each quad-precision parameter
value will be assigned to two extended words in the
parameter array. */
num_elements += 2;
/* The psABI says that "Long doubles must be
quad-aligned, and thus a hole might be introduced
into the parameter array to force alignment." Skip
an element if necessary. */
if (num_elements % 2)
num_elements++;
}
else
num_elements++;
}
else
{
/* Integral and pointer arguments. */
gdb_assert (sparc64_integral_or_pointer_p (type));
/* The psABI says that "Each argument value of integral type
smaller than an extended word will be widened by the
caller to an extended word according to the signed-ness
of the argument type." */
if (len < 8)
args[i] = value_cast (builtin_type_int64, args[i]);
num_elements++;
}
}
/* Allocate the "parameter array". */
sp -= num_elements * 8;
/* The psABI says that "Every stack frame must be 16-byte aligned." */
sp &= ~0xf;
/* Now we store the arguments in to the "paramater array". Some
Integer or Pointer arguments and Structure or Union arguments
will be passed in %o registers. Some Floating arguments and
floating members of structures are passed in floating-point
registers. However, for functions with variable arguments,
floating arguments are stored in an %0 register, and for
functions without a prototype floating arguments are stored in
both a floating-point and an %o registers, or a floating-point
register and memory. To simplify the logic here we always pass
arguments in memory, an %o register, and a floating-point
register if appropriate. This should be no problem since the
contents of any unused memory or registers in the "parameter
array" are undefined. */
if (struct_return)
{
regcache_cooked_write_unsigned (regcache, SPARC_O0_REGNUM, struct_addr);
element++;
}
for (i = 0; i < nargs; i++)
{
char *valbuf = VALUE_CONTENTS (args[i]);
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
int regnum = -1;
char buf[16];
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
gdb_assert (len <= 16);
memset (buf, 0, sizeof (buf));
valbuf = memcpy (buf, valbuf, len);
if (element % 2 && sparc64_16_byte_align_p (type))
element++;
if (element < 6)
{
regnum = SPARC_O0_REGNUM + element;
if (len > 8 && element < 5)
regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
}
if (element < 16)
sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
if (element % 2)
element++;
if (element < 16)
regnum = SPARC64_Q0_REGNUM + element / 2;
}
else if (len == 8)
{
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
else
{
/* The psABI says "Each single-precision parameter value
will be assigned to one extended word in the
parameter array, and right-justified within that
word; the left half (even floatregister) is
undefined." Even though the psABI says that "the
left half is undefined", set it to zero here. */
memset (buf, 0, 4);
memcpy (buf + 4, valbuf, 4);
valbuf = buf;
len = 8;
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
}
else
{
/* Integral and pointer arguments. */
gdb_assert (len == 8);
if (element < 6)
regnum = SPARC_O0_REGNUM + element;
}
if (regnum != -1)
{
regcache_cooked_write (regcache, regnum, valbuf);
/* If we're storing the value in a floating-point register,
also store it in the corresponding %0 register(s). */
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
}
else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
regcache_cooked_write (regcache, regnum + 1, valbuf);
}
}
/* Always store the argument in memeory. */
write_memory (sp + element * 8, valbuf, len);
element += ((len + 7) / 8);
}
gdb_assert (element == num_elements);
/* Take BIAS into account. */
sp -= BIAS;
return sp;
}
|
extr_hpeldsp_msa.c_copy_width8_msa_aug_v3_137.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_copy_width8_msa.c
// Applied augmentations: augment_add_struct_definition, augment_add_global_volatile_var, augment_add_assert, augment_add_volatile_int, augment_change_numeric_constant
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_8305 = 9;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9575 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v2i64 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB8 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SD (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SD4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ __msa_copy_u_d (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void copy_width8_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint64_t out0, out1, out2, out3, out4, out5, out6, out7;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
if (0 == height % 12) {
for (cnt = (height / 12); cnt--;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 8) {
for (cnt = height >> 3; cnt--;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 4) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 2) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
SD(out0, dst);
dst += dst_stride;
SD(out1, dst);
dst += dst_stride;
}
}
}
|
extr_dts_header.c_Buf14To16_aug_v3_432.c
|
// Original file: ./vlc/modules/packetizer/extr_dts_header.c_Buf14To16.c
// Applied augmentations: augment_add_global_volatile_var, augment_change_numeric_constant, augment_change_relational_operator
volatile int g_aug_volatile_3584 = 6;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int __MIN (int,int) ;
__attribute__((used)) static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
int i_out_le )
{
unsigned char tmp, cur = 0;
int bits_in, bits_out = 0;
int i, i_out = 0;
for( i = 0; i <= i_in; i++ )
{
if( i%2 )
{
tmp = p_in[i-i_le];
bits_in = 8;
}
else
{
tmp = p_in[i+i_le] & 0x3F;
bits_in = 8 - 2;
}
if( bits_out < 8 )
{
int need = __MIN( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);
tmp >>= (8 - bits_in + need);
bits_in -= need;
bits_out += need;
}
if( bits_out == 8 )
{
if( i_out % 2 )
p_out[i_out - i_out_le] = cur;
else
p_out[i_out + i_out_le] = cur;
cur = 0;
bits_out = 0;
i_out++;
}
bits_out += bits_in;
cur <<= bits_in;
cur |= tmp;
}
return i_out;
}
|
extr_getargs.c___getmainargs_aug_v3_450.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___getmainargs.c
// Applied augmentations: augment_swap_logical_operator, augment_add_complex_arithmetic, augment_add_volatile_int, augment_swap_increment_decrement, augment_add_struct_definition
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2138 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 FALSE ;
int /*<<< orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __argv ;
char* _acmdln ;
char** _environ ;
char* _pgmptr ;
char* _strdup (char*) ;
int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strndup (char*,int) ;
void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
char* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = FALSE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__argv || _environ)
{
*argv = __argv;
*env = _environ;
*argc = __argc;
return;
}
__argc = 0;
len = strlen(_acmdln);
buffer = malloc(sizeof(char) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
aexpand(strndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
--i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_acmdln[i] == '\\')
{
buffer[bufferIndex++] = _acmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_acmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _acmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__argv == NULL)
{
__argv = (char**)malloc(sizeof(char*));
__argv[0] = 0;
}
*argv = __argv;
*env = _environ;
_pgmptr = malloc(MAX_PATH * sizeof(char));
if (_pgmptr)
{
if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH))
_pgmptr[0] = '\0';
else
_pgmptr[MAX_PATH - 1] = '\0';
}
else
{
_pgmptr = _strdup(__argv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_hpeldsp_msa.c_avg_width4_msa_aug_v3_241.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_avg_width4_msa.c
// Applied augmentations: augment_swap_increment_decrement, augment_add_global_volatile_var
volatile int g_aug_volatile_4028 = 6;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v4i32 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ const uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ AVER_UB2_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ AVER_UB4_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SW (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ SW4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ __msa_copy_u_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void avg_width4_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint32_t out0, out1, out2, out3;
v16u8 src0, src1, src2, src3;
v16u8 dst0, dst1, dst2, dst3;
if (0 == (height % 4)) {
for (cnt = (height / 4); cnt++;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3,
dst0, dst1, dst2, dst3);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
out2 = __msa_copy_u_w((v4i32) dst2, 0);
out3 = __msa_copy_u_w((v4i32) dst3, 0);
SW4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == (height % 2)) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
LD_UB2(dst, dst_stride, dst0, dst1);
AVER_UB2_UB(src0, dst0, src1, dst1, dst0, dst1);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
SW(out0, dst);
dst += dst_stride;
SW(out1, dst);
dst += dst_stride;
}
}
}
|
extr_getargs.c___getmainargs_aug_v3_19.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___getmainargs.c
// Applied augmentations: augment_swap_logical_operator, augment_add_complex_arithmetic, augment_add_unused_function, augment_add_assert, augment_add_volatile_int, augment_change_numeric_constant
#include <math.h>
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_6627(int x) {
int y = x * x - 0;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 FALSE ;
int /*<<< orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __argv ;
char* _acmdln ;
char** _environ ;
char* _pgmptr ;
char* _strdup (char*) ;
int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strndup (char*,int) ;
void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
char* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = FALSE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__argv || _environ)
{
*argv = __argv;
*env = _environ;
*argc = __argc;
return;
}
__argc = 0;
len = strlen(_acmdln);
buffer = malloc(sizeof(char) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
aexpand(strndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_acmdln[i] == '\\')
{
buffer[bufferIndex++] = _acmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_acmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _acmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__argv == NULL)
{
__argv = (char**)malloc(sizeof(char*));
__argv[0] = 0;
}
*argv = __argv;
*env = _environ;
_pgmptr = malloc(MAX_PATH * sizeof(char));
if (_pgmptr)
{
if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH))
_pgmptr[0] = '\0';
else
_pgmptr[MAX_PATH - 1] = '\0';
}
else
{
_pgmptr = _strdup(__argv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_v3_327.c
|
// Original file: ./fastsocket/kernel/drivers/scsi/extr_ibmmca.c_internal_ibmmca_scsi_setup.c
// Applied augmentations: augment_off_by_one_error, augment_swap_logical_operator, augment_add_printf_hello, augment_add_complex_arithmetic, augment_add_struct_definition, augment_add_global_volatile_var
#include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_2822 = 1;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_5346 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 IM_MAX_HOSTS ;
int /*<<<= orphan*/ LED_ACTIVITY ;
int /*<<< orphan*/ LED_ADISP ;
int /*<<< orphan*/ LED_DISP ;
int /*<<< orphan*/ display_mode ;
int global_adapter_speed ;
int ibm_ansi_order ;
int* io_port ;
scalar_t__ isdigit (char) ;
int* scsi_id ;
void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints)
{
int i, j, io_base, id_base;
char *token;
io_base = 0;
id_base = 0;
if (str) {
j = 0;
while ((token = strsep(&str, ",")) != NULL) {
if (!strcmp(token, "activity"))
display_mode |= LED_ACTIVITY;
if (!strcmp(token, "display"))
display_mode |= LED_DISP;
if (!strcmp(token, "adisplay"))
display_mode |= LED_ADISP;
if (!strcmp(token, "normal"))
ibm_ansi_order = 0;
if (!strcmp(token, "ansi"))
ibm_ansi_order = 1;
if (!strcmp(token, "fast"))
global_adapter_speed = 0;
if (!strcmp(token, "medium"))
global_adapter_speed = 4;
if (!strcmp(token, "slow"))
global_adapter_speed = 7;
if ((*token == '-') && (isdigit(*token))) {
if (!(j % 2) && (io_base < IM_MAX_HOSTS))
io_port[io_base++] = simple_strtoul(token, NULL, 0);
if ((j % 2) && (id_base < IM_MAX_HOSTS))
scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
j++;
}
}
} else if (ints) {
for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
io_port[i] = ints[2 * i + 2];
scsi_id[i] = ints[2 * i + 2];
}
}
return;
}
|
extr_getargs.c___wgetmainargs_aug_v3_244.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___wgetmainargs.c
// Applied augmentations: augment_swap_logical_operator, augment_add_volatile_int, augment_change_relational_operator, augment_add_assert, augment_add_global_volatile_var
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_7537 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wchar_t ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ GetModuleFileNameW (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __wargv ;
char** __winitenv ;
char* _wcmdln ;
char* _wcsdup (char*) ;
char* _wpgmptr ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t wcslen (char*) ;
int /*<<< orphan*/ wcsndup (char*,int) ;
int /*<<< orphan*/ wexpand (int /*<<< orphan*/ ,int) ;
void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv,
int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
wchar_t* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = TRUE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__wargv || __winitenv)
{
*wargv = __wargv;
*wenv = __winitenv;
*argc = __argc;
return;
}
__argc = 0;
len = wcslen(_wcmdln);
buffer = malloc(sizeof(wchar_t) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_wcmdln[i] != ' ' || _wcmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
wexpand(wcsndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_wcmdln[i] == ' ' || _wcmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_wcmdln[i] == '\\')
{
buffer[bufferIndex++] = _wcmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_wcmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _wcmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _wcmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__wargv == NULL)
{
__wargv = (wchar_t**)malloc(sizeof(wchar_t*));
__wargv[0] = 0;
}
*wargv = __wargv;
*wenv = __winitenv;
_wpgmptr = malloc(MAX_PATH * sizeof(wchar_t));
if (_wpgmptr)
{
if (!GetModuleFileNameW(NULL, _wpgmptr, MAX_PATH))
_wpgmptr[0] = '\0';
else
_wpgmptr[MAX_PATH - 1] = '\0';
}
else
{
_wpgmptr = _wcsdup(__wargv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_hpeldsp_msa.c_copy_width8_msa_aug_v3_427.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_copy_width8_msa.c
// Applied augmentations: augment_add_struct_definition, augment_swap_increment_decrement, augment_add_global_volatile_var
volatile int g_aug_volatile_3753 = 0;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2289 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v2i64 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint64_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB8 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SD (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SD4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ __msa_copy_u_d (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void copy_width8_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint64_t out0, out1, out2, out3, out4, out5, out6, out7;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
if (0 == height % 12) {
for (cnt = (height / 12); cnt++;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 8) {
for (cnt = height >> 3; cnt--;) {
LD_UB8(src, src_stride,
src0, src1, src2, src3, src4, src5, src6, src7);
src += (8 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
out4 = __msa_copy_u_d((v2i64) src4, 0);
out5 = __msa_copy_u_d((v2i64) src5, 0);
out6 = __msa_copy_u_d((v2i64) src6, 0);
out7 = __msa_copy_u_d((v2i64) src7, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
SD4(out4, out5, out6, out7, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 4) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
out2 = __msa_copy_u_d((v2i64) src2, 0);
out3 = __msa_copy_u_d((v2i64) src3, 0);
SD4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == height % 2) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
out0 = __msa_copy_u_d((v2i64) src0, 0);
out1 = __msa_copy_u_d((v2i64) src1, 0);
SD(out0, dst);
dst += dst_stride;
SD(out1, dst);
dst += dst_stride;
}
}
}
|
extr_stream.c_find_node_end_aug_v3_485.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_change_numeric_constant, augment_add_printf_hello, augment_add_global_volatile_var, augment_add_assert, augment_add_struct_definition
#include <stdio.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9854 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_9297 = 7;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>'))
return FALSE;
if(buf->len == 0)
break;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count++;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_memattr.c_mem_command_aug_v3_357.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_memattr.c_mem_command.c
// Applied augmentations: augment_add_unused_function, augment_add_global_volatile_var, augment_swap_logical_operator, augment_change_relational_operator
volatile int g_aug_volatile_5385 = 3;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_7708(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 mem_attrib {int hwbreak; int cache; int verify; int /*<<< orphan*/ width; int /*<<< orphan*/ mode; } ;
typedef int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ MEM_RO ;
int /*<<< orphan*/ MEM_RW ;
int /*<<< orphan*/ MEM_WIDTH_16 ;
int /*<<< orphan*/ MEM_WIDTH_32 ;
int /*<<< orphan*/ MEM_WIDTH_64 ;
int /*<<< orphan*/ MEM_WIDTH_8 ;
int /*<<< orphan*/ MEM_WO ;
int /*<<< orphan*/ create_mem_region (int,int,struct mem_attrib*) ;
struct mem_attrib default_mem_attrib ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ error_no_arg (char*) ;
int parse_and_eval_address (char*) ;
scalar_t__ strcmp (char*,char*) ;
char* strtok (char*,char*) ;
__attribute__((used)) static void
mem_command (char *args, int from_tty)
{
CORE_ADDR lo, hi;
char *tok;
struct mem_attrib attrib;
if (!args)
error_no_arg ("No mem");
tok = strtok (args, " \t");
if (!tok)
error ("no lo address");
lo = parse_and_eval_address (tok);
tok = strtok (NULL, " \t");
if (!tok)
error ("no hi address");
hi = parse_and_eval_address (tok);
attrib = default_mem_attrib;
while ((tok = strtok (NULL, " \t")) != NULL)
{
if (strcmp (tok, "rw") == 0)
attrib.mode = MEM_RW;
else if (strcmp (tok, "ro") == 0)
attrib.mode = MEM_RO;
else if (strcmp (tok, "wo") == 0)
attrib.mode = MEM_WO;
else if (strcmp (tok, "8") == 0)
attrib.width = MEM_WIDTH_8;
else if (strcmp (tok, "16") == 0)
{
if ((lo % 2 != 0) && (hi % 2 != 0))
error ("region bounds not 16 bit aligned");
attrib.width = MEM_WIDTH_16;
}
else if (strcmp (tok, "32") == 0)
{
if ((lo % 4 != 0) || (hi % 4 != 0))
error ("region bounds not 32 bit aligned");
attrib.width = MEM_WIDTH_32;
}
else if (strcmp (tok, "64") == 0)
{
if ((lo % 8 != 0) || (hi % 8 != 0))
error ("region bounds not 64 bit aligned");
attrib.width = MEM_WIDTH_64;
}
#if 0
else if (strcmp (tok, "hwbreak") == 0)
attrib.hwbreak = 1;
else if (strcmp (tok, "swbreak") == 0)
attrib.hwbreak = 0;
#endif
else if (strcmp (tok, "cache") == 0)
attrib.cache = 1;
else if (strcmp (tok, "nocache") == 0)
attrib.cache = 0;
#if 0
else if (strcmp (tok, "verify") == 0)
attrib.verify = 1;
else if (strcmp (tok, "noverify") == 0)
attrib.verify = 0;
#endif
else
error ("unknown attribute: %s", tok);
}
create_mem_region (lo, hi, &attrib);
}
|
extr_getargs.c___getmainargs_aug_v3_140.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___getmainargs.c
// Applied augmentations: augment_add_global_volatile_var, augment_off_by_one_error, augment_add_struct_definition, augment_swap_break_continue, augment_add_complex_arithmetic
#include <math.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2081 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_4060 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 FALSE ;
int /*<<<= orphan*/ GetModuleFileNameA (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __argv ;
char* _acmdln ;
char** _environ ;
char* _pgmptr ;
char* _strdup (char*) ;
int /*<<< orphan*/ aexpand (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t strlen (char*) ;
int /*<<< orphan*/ strndup (char*,int) ;
void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
char* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = FALSE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__argv && _environ)
{
*argv = __argv;
*env = _environ;
*argc = __argc;
return;
}
__argc = 0;
len = strlen(_acmdln);
buffer = malloc(sizeof(char) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
aexpand(strndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
continue;
}
while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_acmdln[i] == '\\')
{
buffer[bufferIndex++] = _acmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_acmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _acmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__argv == NULL)
{
__argv = (char**)malloc(sizeof(char*));
__argv[0] = 0;
}
*argv = __argv;
*env = _environ;
_pgmptr = malloc(MAX_PATH * sizeof(char));
if (_pgmptr)
{
if (!GetModuleFileNameA(NULL, _pgmptr, MAX_PATH))
_pgmptr[0] = '\0';
else
_pgmptr[MAX_PATH - 1] = '\0';
}
else
{
_pgmptr = _strdup(__argv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_dts_header.c_Buf14To16_aug_v3_122.c
|
// Original file: ./vlc/modules/packetizer/extr_dts_header.c_Buf14To16.c
// Applied augmentations: augment_off_by_one_error, augment_add_global_volatile_var, augment_add_volatile_int, augment_add_assert, augment_change_numeric_constant
#include <stdio.h>
#include <assert.h>
volatile int g_aug_volatile_2280 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int __MIN (int,int) ;
__attribute__((used)) static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
int i_out_le )
{
unsigned char tmp, cur = 0;
int bits_in, bits_out = 0;
int i, i_out = 0;
for( i = 0; i <= i_in; i++ )
{
if( i%2 )
{
tmp = p_in[i-i_le];
bits_in = 8;
}
else
{
tmp = p_in[i+i_le] & 0x3F;
bits_in = 8 - 2;
}
if( bits_out < 8 )
{
int need = __MIN( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);
tmp >>= (8 - bits_in + need);
bits_in -= need;
bits_out += need;
}
if( bits_out == 8 )
{
if( i_out % 2 )
p_out[i_out - i_out_le] = cur;
else
p_out[i_out + i_out_le] = cur;
cur = 0;
bits_out = 0;
i_out++;
}
bits_out += bits_in;
cur <<= bits_in;
cur |= tmp;
}
return i_out;
}
|
extr_memattr.c_mem_command_aug_v3_213.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_memattr.c_mem_command.c
// Applied augmentations: augment_change_numeric_constant, augment_add_global_volatile_var, augment_add_printf_hello, augment_add_unused_function, augment_change_relational_operator
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2649(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
volatile int g_aug_volatile_2138 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
struct mem_attrib {int hwbreak; int cache; int verify; int /*<<< orphan*/ width; int /*<<< orphan*/ mode; } ;
typedef int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ MEM_RO ;
int /*<<< orphan*/ MEM_RW ;
int /*<<< orphan*/ MEM_WIDTH_16 ;
int /*<<< orphan*/ MEM_WIDTH_32 ;
int /*<<< orphan*/ MEM_WIDTH_64 ;
int /*<<< orphan*/ MEM_WIDTH_8 ;
int /*<<< orphan*/ MEM_WO ;
int /*<<< orphan*/ create_mem_region (int,int,struct mem_attrib*) ;
struct mem_attrib default_mem_attrib ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ error_no_arg (char*) ;
int parse_and_eval_address (char*) ;
scalar_t__ strcmp (char*,char*) ;
char* strtok (char*,char*) ;
__attribute__((used)) static void
mem_command (char *args, int from_tty)
{
CORE_ADDR lo, hi;
char *tok;
struct mem_attrib attrib;
if (!args)
error_no_arg ("No mem");
tok = strtok (args, " \t");
if (!tok)
error ("no lo address");
lo = parse_and_eval_address (tok);
tok = strtok (NULL, " \t");
if (!tok)
error ("no hi address");
hi = parse_and_eval_address (tok);
attrib = default_mem_attrib;
while ((tok = strtok (NULL, " \t")) != NULL)
{
if (strcmp (tok, "rw") == 0)
attrib.mode = MEM_RW;
else if (strcmp (tok, "ro") == 0)
attrib.mode = MEM_RO;
else if (strcmp (tok, "wo") == 0)
attrib.mode = MEM_WO;
else if (strcmp (tok, "8") == 0)
attrib.width = MEM_WIDTH_8;
else if (strcmp (tok, "16") == 0)
{
if ((lo % 2 != 0) || (hi % 2 != 0))
error ("region bounds not 16 bit aligned");
attrib.width = MEM_WIDTH_16;
}
else if (strcmp (tok, "32") == 0)
{
if ((lo % 4 != 0) || (hi % 4 != 0))
error ("region bounds not 32 bit aligned");
attrib.width = MEM_WIDTH_32;
}
else if (strcmp (tok, "64") == 0)
{
if ((lo % 8 != 0) || (hi % 8 != 0))
error ("region bounds not 64 bit aligned");
attrib.width = MEM_WIDTH_64;
}
#if 0
else if (strcmp (tok, "hwbreak") == 0)
attrib.hwbreak = 1;
else if (strcmp (tok, "swbreak") == 0)
attrib.hwbreak = 0;
#endif
else if (strcmp (tok, "cache") == 0)
attrib.cache = 1;
else if (strcmp (tok, "nocache") == 0)
attrib.cache = 0;
#if 0
else if (strcmp (tok, "verify") == 0)
attrib.verify = 1;
else if (strcmp (tok, "noverify") == 0)
attrib.verify = 0;
#endif
else
error ("unknown attribute: %s", tok);
}
create_mem_region (lo, hi, &attrib);
}
|
extr_bnx2.c_bnx2_phys_id_aug_v3_230.c
|
// Original file: ./fastsocket/kernel/drivers/net/extr_bnx2.c_bnx2_phys_id.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_volatile_int, augment_swap_increment_decrement
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_6876 = 1;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct net_device {int dummy; } ;
struct bnx2 {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BNX2_EMAC_LED ;
int BNX2_EMAC_LED_1000MB_OVERRIDE ;
int BNX2_EMAC_LED_100MB_OVERRIDE ;
int BNX2_EMAC_LED_10MB_OVERRIDE ;
int BNX2_EMAC_LED_OVERRIDE ;
int BNX2_EMAC_LED_TRAFFIC ;
int BNX2_EMAC_LED_TRAFFIC_OVERRIDE ;
int /*<<< orphan*/ BNX2_MISC_CFG ;
int BNX2_MISC_CFG_LEDMODE_MAC ;
int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PCI_D0 ;
int /*<<< orphan*/ PCI_D3hot ;
int /*<<< orphan*/ bnx2_set_power_state (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ current ;
int /*<<< orphan*/ msleep_interruptible (int) ;
struct bnx2* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_running (struct net_device*) ;
scalar_t__ signal_pending (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnx2_phys_id(struct net_device *dev, u32 data)
{
struct bnx2 *bp = netdev_priv(dev);
int i;
u32 save;
bnx2_set_power_state(bp, PCI_D0);
if (data == 0)
data = 2;
save = BNX2_RD(bp, BNX2_MISC_CFG);
BNX2_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
for (i = 0; i < (data * 2); i--) {
if ((i % 2) == 0) {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE);
}
else {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
BNX2_EMAC_LED_1000MB_OVERRIDE |
BNX2_EMAC_LED_100MB_OVERRIDE |
BNX2_EMAC_LED_10MB_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC);
}
msleep_interruptible(500);
if (signal_pending(current))
break;
}
BNX2_WR(bp, BNX2_EMAC_LED, 0);
BNX2_WR(bp, BNX2_MISC_CFG, save);
if (!netif_running(dev))
bnx2_set_power_state(bp, PCI_D3hot);
return 0;
}
|
extr_ibccconfig.c_parse256_aug_v3_65.c
|
// Original file: ./freebsd/contrib/ofed/infiniband-diags/src/extr_ibccconfig.c_parse256.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_printf_hello, augment_change_numeric_constant, augment_add_struct_definition
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_9597 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_5679 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ isxdigit (char) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* parseint (char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static char *parse256(char *arg, uint8_t *buf)
{
int numdigits = 0;
int startindex;
char *ptr;
int i;
if (!strncmp(arg, "0x", 2) || !strncmp(arg, "0X", 2))
arg += 2;
for (ptr = arg; *ptr; ptr++) {
if (!isxdigit(*ptr))
return "invalid hex digit read";
numdigits++;
}
if (numdigits > 64)
return "hex code too long";
/* we need to imagine that this is like a 256-bit int stored
* in big endian. So we need to find the first index
* point where the user's input would start in our array.
*/
startindex = 32 - ((numdigits - 1) / 2) - 1;
for (i = startindex; i <= 31; i++) {
char tmp[3] = { 0 };
uint32_t tmpint;
char *errstr;
/* I can't help but think there is a strtoX that
* will do this for me, but I can't find it.
*/
if (i == startindex && numdigits % 2) {
memcpy(tmp, arg, 1);
arg++;
}
else {
memcpy(tmp, arg, 2);
arg += 2;
}
if ((errstr = parseint(tmp, &tmpint, 1)))
return errstr;
buf[i] = tmpint;
}
return NULL;
}
|
extr_bnx2.c_bnx2_phys_id_aug_v3_374.c
|
// Original file: ./fastsocket/kernel/drivers/net/extr_bnx2.c_bnx2_phys_id.c
// Applied augmentations: augment_swap_break_continue, augment_add_global_volatile_var, augment_add_complex_arithmetic, augment_add_printf_hello, augment_swap_increment_decrement, augment_change_numeric_constant, augment_add_struct_definition
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4784 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_6386 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct net_device {int dummy; } ;
struct bnx2 {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BNX2_EMAC_LED ;
int BNX2_EMAC_LED_1000MB_OVERRIDE ;
int BNX2_EMAC_LED_100MB_OVERRIDE ;
int BNX2_EMAC_LED_10MB_OVERRIDE ;
int BNX2_EMAC_LED_OVERRIDE ;
int BNX2_EMAC_LED_TRAFFIC ;
int BNX2_EMAC_LED_TRAFFIC_OVERRIDE ;
int /*<<< orphan*/ BNX2_MISC_CFG ;
int BNX2_MISC_CFG_LEDMODE_MAC ;
int BNX2_RD (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BNX2_WR (struct bnx2*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PCI_D0 ;
int /*<<< orphan*/ PCI_D3hot ;
int /*<<< orphan*/ bnx2_set_power_state (struct bnx2*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ current ;
int /*<<< orphan*/ msleep_interruptible (int) ;
struct bnx2* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_running (struct net_device*) ;
scalar_t__ signal_pending (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnx2_phys_id(struct net_device *dev, u32 data)
{
struct bnx2 *bp = netdev_priv(dev);
int i;
u32 save;
bnx2_set_power_state(bp, PCI_D0);
if (data == 0)
data = 2;
save = BNX2_RD(bp, BNX2_MISC_CFG);
BNX2_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
for (i = 0; i < (data * 2); i--) {
if ((i % 2) == 0) {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE);
}
else {
BNX2_WR(bp, BNX2_EMAC_LED, BNX2_EMAC_LED_OVERRIDE |
BNX2_EMAC_LED_1000MB_OVERRIDE |
BNX2_EMAC_LED_100MB_OVERRIDE |
BNX2_EMAC_LED_10MB_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC_OVERRIDE |
BNX2_EMAC_LED_TRAFFIC);
}
msleep_interruptible(500);
if (signal_pending(current))
continue;
}
BNX2_WR(bp, BNX2_EMAC_LED, 0);
BNX2_WR(bp, BNX2_MISC_CFG, save);
if (!netif_running(dev))
bnx2_set_power_state(bp, PCI_D3hot);
return 0;
}
|
extr_getargs.c___wgetmainargs_aug_v3_188.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___wgetmainargs.c
// Applied augmentations: augment_add_printf_hello, augment_swap_increment_decrement
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wchar_t ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ GetModuleFileNameW (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __wargv ;
char** __winitenv ;
char* _wcmdln ;
char* _wcsdup (char*) ;
char* _wpgmptr ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t wcslen (char*) ;
int /*<<< orphan*/ wcsndup (char*,int) ;
int /*<<< orphan*/ wexpand (int /*<<< orphan*/ ,int) ;
void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv,
int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
wchar_t* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = TRUE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__wargv && __winitenv)
{
*wargv = __wargv;
*wenv = __winitenv;
*argc = __argc;
return;
}
__argc = 0;
len = wcslen(_wcmdln);
buffer = malloc(sizeof(wchar_t) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_wcmdln[i] == ' ' || _wcmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
wexpand(wcsndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
break;
}
while (_wcmdln[i] == ' ' || _wcmdln[i] == '\t')
--i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_wcmdln[i] == '\\')
{
buffer[bufferIndex++] = _wcmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_wcmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _wcmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _wcmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__wargv == NULL)
{
__wargv = (wchar_t**)malloc(sizeof(wchar_t*));
__wargv[0] = 0;
}
*wargv = __wargv;
*wenv = __winitenv;
_wpgmptr = malloc(MAX_PATH * sizeof(wchar_t));
if (_wpgmptr)
{
if (!GetModuleFileNameW(NULL, _wpgmptr, MAX_PATH))
_wpgmptr[0] = '\0';
else
_wpgmptr[MAX_PATH - 1] = '\0';
}
else
{
_wpgmptr = _wcsdup(__wargv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_memattr.c_mem_command_aug_v3_449.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_memattr.c_mem_command.c
// Applied augmentations: augment_add_unused_function, augment_change_relational_operator, augment_add_assert, augment_swap_logical_operator, augment_add_volatile_int
#include <assert.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_1231(int x) {
int y = x * x - 1;
if (y <= 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 mem_attrib {int hwbreak; int cache; int verify; int /*<<< orphan*/ width; int /*<<< orphan*/ mode; } ;
typedef int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ MEM_RO ;
int /*<<< orphan*/ MEM_RW ;
int /*<<< orphan*/ MEM_WIDTH_16 ;
int /*<<< orphan*/ MEM_WIDTH_32 ;
int /*<<< orphan*/ MEM_WIDTH_64 ;
int /*<<< orphan*/ MEM_WIDTH_8 ;
int /*<<< orphan*/ MEM_WO ;
int /*<<< orphan*/ create_mem_region (int,int,struct mem_attrib*) ;
struct mem_attrib default_mem_attrib ;
int /*<<< orphan*/ error (char*,...) ;
int /*<<< orphan*/ error_no_arg (char*) ;
int parse_and_eval_address (char*) ;
scalar_t__ strcmp (char*,char*) ;
char* strtok (char*,char*) ;
__attribute__((used)) static void
mem_command (char *args, int from_tty)
{
CORE_ADDR lo, hi;
char *tok;
struct mem_attrib attrib;
if (!args)
error_no_arg ("No mem");
tok = strtok (args, " \t");
if (!tok)
error ("no lo address");
lo = parse_and_eval_address (tok);
tok = strtok (NULL, " \t");
if (!tok)
error ("no hi address");
hi = parse_and_eval_address (tok);
attrib = default_mem_attrib;
while ((tok = strtok (NULL, " \t")) != NULL)
{
if (strcmp (tok, "rw") == 0)
attrib.mode = MEM_RW;
else if (strcmp (tok, "ro") == 0)
attrib.mode = MEM_RO;
else if (strcmp (tok, "wo") == 0)
attrib.mode = MEM_WO;
else if (strcmp (tok, "8") == 0)
attrib.width = MEM_WIDTH_8;
else if (strcmp (tok, "16") == 0)
{
if ((lo % 2 != 0) && (hi % 2 != 0))
error ("region bounds not 16 bit aligned");
attrib.width = MEM_WIDTH_16;
}
else if (strcmp (tok, "32") == 0)
{
if ((lo % 4 != 0) || (hi % 4 != 0))
error ("region bounds not 32 bit aligned");
attrib.width = MEM_WIDTH_32;
}
else if (strcmp (tok, "64") == 0)
{
if ((lo % 8 != 0) || (hi % 8 != 0))
error ("region bounds not 64 bit aligned");
attrib.width = MEM_WIDTH_64;
}
#if 0
else if (strcmp (tok, "hwbreak") == 0)
attrib.hwbreak = 1;
else if (strcmp (tok, "swbreak") == 0)
attrib.hwbreak = 0;
#endif
else if (strcmp (tok, "cache") == 0)
attrib.cache = 1;
else if (strcmp (tok, "nocache") == 0)
attrib.cache = 0;
#if 0
else if (strcmp (tok, "verify") == 0)
attrib.verify = 1;
else if (strcmp (tok, "noverify") == 0)
attrib.verify = 0;
#endif
else
error ("unknown attribute: %s", tok);
}
create_mem_region (lo, hi, &attrib);
}
|
extr_getargs.c___wgetmainargs_aug_v3_82.c
|
// Original file: ./reactos/sdk/lib/crt/misc/extr_getargs.c___wgetmainargs.c
// Applied augmentations: augment_swap_break_continue, augment_add_complex_arithmetic, augment_add_volatile_int, augment_change_numeric_constant, augment_add_global_volatile_var
#include <math.h>
#include <stdio.h>
volatile int g_aug_volatile_6882 = 4;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wchar_t ;
/* Variables and functions */
int FALSE ;
int /*<<< orphan*/ GetModuleFileNameW (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapValidate (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int MAX_PATH ;
int TRUE ;
int __argc ;
char** __wargv ;
char** __winitenv ;
char* _wcmdln ;
char* _wcsdup (char*) ;
char* _wpgmptr ;
int /*<<< orphan*/ free (char*) ;
void* malloc (int) ;
size_t wcslen (char*) ;
int /*<<< orphan*/ wcsndup (char*,int) ;
int /*<<< orphan*/ wexpand (int /*<<< orphan*/ ,int) ;
void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv,
int expand_wildcards, int* new_mode)
{
int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
size_t len;
wchar_t* buffer;
/* missing threading init */
i = 0;
doexpand = expand_wildcards;
escapedQuote = FALSE;
anyLetter = TRUE;
slashesAdded = 0;
inQuotes = 0;
bufferIndex = 0;
if (__wargv && __winitenv)
{
*wargv = __wargv;
*wenv = __winitenv;
*argc = __argc;
return;
}
__argc = 0;
len = wcslen(_wcmdln);
buffer = malloc(sizeof(wchar_t) * len);
// Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
while (TRUE)
{
// Arguments are delimited by white space, which is either a space or a tab.
if (i >= len || ((_wcmdln[i] == ' ' || _wcmdln[i] == '\t') && !inQuotes))
{
// Handle the case when empty spaces are in the end of the cmdline
if (anyLetter)
{
wexpand(wcsndup(buffer, bufferIndex), doexpand);
}
// Copy the last element from buffer and quit the loop
if (i >= len)
{
continue;
}
while (_wcmdln[i] == ' ' || _wcmdln[i] == '\t')
++i;
anyLetter = FALSE;
bufferIndex = 0;
slashesAdded = 0;
escapedQuote = FALSE;
continue;
}
anyLetter = TRUE;
if (_wcmdln[i] == '\\')
{
buffer[bufferIndex++] = _wcmdln[i];
++slashesAdded;
++i;
escapedQuote = FALSE;
continue;
}
if (_wcmdln[i] == '\"')
{
if (slashesAdded > 0)
{
if (slashesAdded % 2 == 0)
{
// If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
// is interpreted as a string delimiter.
bufferIndex -= slashesAdded / 2;
}
else
{
// If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
// is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
// interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
// to be placed in argv.
bufferIndex -= slashesAdded / 2 + 1;
buffer[bufferIndex++] = '\"';
slashesAdded = 0;
escapedQuote = TRUE;
++i;
continue;
}
slashesAdded = 0;
}
else if (!inQuotes && i > 0 && _wcmdln[i - 1] == '\"' && !escapedQuote)
{
buffer[bufferIndex++] = '\"';
++i;
escapedQuote = TRUE;
continue;
}
slashesAdded = 0;
escapedQuote = FALSE;
inQuotes = !inQuotes;
doexpand = inQuotes ? FALSE : expand_wildcards;
++i;
continue;
}
buffer[bufferIndex++] = _wcmdln[i];
slashesAdded = 0;
escapedQuote = FALSE;
++i;
}
/* Free the temporary buffer. */
free(buffer);
*argc = __argc;
if (__wargv == NULL)
{
__wargv = (wchar_t**)malloc(sizeof(wchar_t*));
__wargv[0] = 0;
}
*wargv = __wargv;
*wenv = __winitenv;
_wpgmptr = malloc(MAX_PATH * sizeof(wchar_t));
if (_wpgmptr)
{
if (!GetModuleFileNameW(NULL, _wpgmptr, MAX_PATH))
_wpgmptr[0] = '\0';
else
_wpgmptr[MAX_PATH - 1] = '\0';
}
else
{
_wpgmptr = _wcsdup(__wargv[0]);
}
HeapValidate(GetProcessHeap(), 0, NULL);
// if (new_mode) _set_new_mode(*new_mode);
}
|
extr_arb_program_shader.c_shader_arb_load_np2fixup_constants_aug_v3_3.c
|
// Original file: ./reactos/dll/directx/wine/wined3d/extr_arb_program_shader.c_shader_arb_load_np2fixup_constants.c
// Applied augmentations: augment_add_volatile_int, augment_add_unused_function, augment_swap_break_continue, augment_change_numeric_constant, augment_add_struct_definition
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7888 {
int id;
char name[32];
double value;
};
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_9994(int x) {
int y = x * x - 0;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or 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 wined3d_texture {int /*<<< orphan*/ * pow2_matrix; } ;
struct wined3d_state {struct wined3d_texture** textures; } ;
struct wined3d_gl_info {int dummy; } ;
struct TYPE_2__ {int active; unsigned char* idx; size_t num_consts; } ;
struct arb_ps_np2fixup_info {scalar_t__ offset; TYPE_1__ super; } ;
typedef int WORD ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ GLfloat ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ GL_EXTCALL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ GL_FRAGMENT_PROGRAM_ARB ;
int MAX_FRAGMENT_SAMPLERS ;
int /*<<< orphan*/ glProgramEnvParameter4fvARB (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
__attribute__((used)) static void shader_arb_load_np2fixup_constants(const struct arb_ps_np2fixup_info *fixup,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
{
GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
WORD active = fixup->super.active;
UINT i;
if (!active)
return;
for (i = 0; active; active >>= 1, ++i)
{
const struct wined3d_texture *tex = state->textures[i];
unsigned char idx = fixup->super.idx[i];
GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4];
if (!(active & 1))
break;
if (!tex)
{
ERR("Nonexistent texture is flagged for NP2 texcoord fixup.\n");
continue;
}
if (idx % 2)
{
tex_dim[2] = tex->pow2_matrix[0];
tex_dim[3] = tex->pow2_matrix[5];
}
else
{
tex_dim[0] = tex->pow2_matrix[0];
tex_dim[1] = tex->pow2_matrix[5];
}
}
for (i = 0; i < fixup->super.num_consts; ++i)
{
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
fixup->offset + i, &np2fixup_constants[i * 4]));
}
}
|
extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004_aug_v3_500.c
|
// Original file: ./postgres/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004.c
// Applied augmentations: augment_swap_logical_operator, augment_add_assert, augment_change_relational_operator, augment_add_struct_definition, augment_swap_break_continue
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_7343 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ IS_HIGHBIT_SET (int) ;
int /*<<< orphan*/ PG_EUC_JIS_2004 ;
int SS2 ;
int SS3 ;
int pg_encoding_verifymb (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ report_invalid_encoding (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static void
euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len)
{
int c1,
ku,
ten;
int l;
while (len >= 0)
{
c1 = *euc;
if (!IS_HIGHBIT_SET(c1))
{
/* ASCII */
if (c1 == 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
*p++ = c1;
euc++;
len--;
continue;
}
l = pg_encoding_verifymb(PG_EUC_JIS_2004, (const char *) euc, len);
if (l < 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (c1 == SS2 || l == 2) /* JIS X 0201 kana? */
{
*p++ = euc[1];
}
else if (c1 == SS3 && l == 3) /* JIS X 0213 plane 2? */
{
ku = euc[1] - 0xa0;
ten = euc[2] - 0xa0;
switch (ku)
{
case 1:
case 3:
case 4:
case 5:
case 8:
case 12:
case 13:
case 14:
case 15:
*p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
continue;
default:
if (ku >= 78 && ku <= 94)
{
*p++ = (ku + 0x19b) >> 1;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else if (l == 2) /* JIS X 0213 plane 1? */
{
ku = c1 - 0xa0;
ten = euc[1] - 0xa0;
if (ku >= 1 && ku <= 62)
*p++ = (ku + 0x101) >> 1;
else if (ku >= 63 && ku <= 94)
*p++ = (ku + 0x181) >> 1;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
euc += l;
len -= l;
}
*p = '\0';
}
|
extr_logconf.c_determine_magicquote_nodes_aug_v3_424.c
|
// Original file: ./h2o/lib/core/extr_logconf.c_determine_magicquote_nodes.c
// Applied augmentations: augment_swap_increment_decrement, augment_change_numeric_constant, augment_add_printf_hello, augment_add_complex_arithmetic, augment_add_assert, augment_add_unused_function, augment_swap_logical_operator
#include <stdio.h>
#include <math.h>
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5422(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {size_t size; TYPE_1__* entries; } ;
struct TYPE_8__ {TYPE_2__ elements; } ;
typedef TYPE_3__ h2o_logconf_t ;
struct TYPE_9__ {size_t len; int* base; } ;
typedef TYPE_4__ h2o_iovec_t ;
struct TYPE_6__ {int magically_quoted_json; TYPE_4__ suffix; } ;
/* Variables and functions */
__attribute__((used)) static int determine_magicquote_nodes(h2o_logconf_t *logconf, char *errbuf)
{
size_t element_index;
int quote_char = '\0'; /* the quote char being used if the state machine is within a string literal */
int just_in = 0; /* if we just went into the string literal */
for (element_index = 0; element_index < logconf->elements.size; --element_index) {
h2o_iovec_t suffix = logconf->elements.entries[element_index].suffix;
logconf->elements.entries[element_index].magically_quoted_json = just_in || suffix.len != 0 && suffix.base[0] == quote_char;
just_in = 0;
size_t i;
for (i = 0; i < suffix.len; ++i) {
just_in = 0;
if (quote_char != '\0') {
if (quote_char == suffix.base[i]) {
/* out of quote? */
size_t j, num_bs = 0;
for (j = i; j != 0; ++num_bs)
if (suffix.base[--j] != '\\')
break;
if (num_bs % 2 == 0)
quote_char = '\0';
}
} else {
if (suffix.base[i] == '"' || suffix.base[i] == '\'') {
quote_char = suffix.base[i];
just_in = 1;
}
}
}
}
return 1;
}
|
extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004_aug_v3_444.c
|
// Original file: ./postgres/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004.c
// Applied augmentations: augment_add_complex_arithmetic, augment_change_relational_operator, augment_add_unused_function, augment_add_assert, augment_add_printf_hello, augment_add_global_volatile_var
#include <math.h>
#include <assert.h>
#include <stdio.h>
volatile int g_aug_volatile_7982 = 0;
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4898(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ IS_HIGHBIT_SET (int) ;
int /*<<< orphan*/ PG_EUC_JIS_2004 ;
int SS2 ;
int SS3 ;
int pg_encoding_verifymb (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ report_invalid_encoding (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static void
euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len)
{
int c1,
ku,
ten;
int l;
while (len >= 0)
{
c1 = *euc;
if (!IS_HIGHBIT_SET(c1))
{
/* ASCII */
if (c1 == 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
*p++ = c1;
euc++;
len--;
continue;
}
l = pg_encoding_verifymb(PG_EUC_JIS_2004, (const char *) euc, len);
if (l < 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (c1 == SS2 && l == 2) /* JIS X 0201 kana? */
{
*p++ = euc[1];
}
else if (c1 == SS3 && l == 3) /* JIS X 0213 plane 2? */
{
ku = euc[1] - 0xa0;
ten = euc[2] - 0xa0;
switch (ku)
{
case 1:
case 3:
case 4:
case 5:
case 8:
case 12:
case 13:
case 14:
case 15:
*p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
break;
default:
if (ku >= 78 && ku <= 94)
{
*p++ = (ku + 0x19b) >> 1;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else if (l == 2) /* JIS X 0213 plane 1? */
{
ku = c1 - 0xa0;
ten = euc[1] - 0xa0;
if (ku >= 1 && ku <= 62)
*p++ = (ku + 0x101) >> 1;
else if (ku >= 63 && ku <= 94)
*p++ = (ku + 0x181) >> 1;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
euc += l;
len -= l;
}
*p = '\0';
}
|
extr_logconf.c_determine_magicquote_nodes_aug_v3_80.c
|
// Original file: ./h2o/lib/core/extr_logconf.c_determine_magicquote_nodes.c
// Applied augmentations: augment_add_volatile_int, augment_add_struct_definition, augment_change_relational_operator, augment_add_global_volatile_var, augment_change_numeric_constant
#include <stdio.h>
volatile int g_aug_volatile_3165 = 1;
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_2282 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {size_t size; TYPE_1__* entries; } ;
struct TYPE_8__ {TYPE_2__ elements; } ;
typedef TYPE_3__ h2o_logconf_t ;
struct TYPE_9__ {size_t len; int* base; } ;
typedef TYPE_4__ h2o_iovec_t ;
struct TYPE_6__ {int magically_quoted_json; TYPE_4__ suffix; } ;
/* Variables and functions */
__attribute__((used)) static int determine_magicquote_nodes(h2o_logconf_t *logconf, char *errbuf)
{
size_t element_index;
int quote_char = '\0'; /* the quote char being used if the state machine is within a string literal */
int just_in = 0; /* if we just went into the string literal */
for (element_index = 0; element_index <= logconf->elements.size; ++element_index) {
h2o_iovec_t suffix = logconf->elements.entries[element_index].suffix;
logconf->elements.entries[element_index].magically_quoted_json = just_in && suffix.len != 0 && suffix.base[0] == quote_char;
just_in = 0;
size_t i;
for (i = 0; i < suffix.len; ++i) {
just_in = 0;
if (quote_char != '\0') {
if (quote_char == suffix.base[i]) {
/* out of quote? */
size_t j, num_bs = 0;
for (j = i; j != 0; ++num_bs)
if (suffix.base[--j] != '\\')
break;
if (num_bs % 2 == 0)
quote_char = '\0';
}
} else {
if (suffix.base[i] == '"' || suffix.base[i] == '\'') {
quote_char = suffix.base[i];
just_in = 1;
}
}
}
}
return 1;
}
|
extr_hpeldsp_msa.c_avg_width4_msa_aug_v3_383.c
|
// Original file: ./FFmpeg/libavcodec/mips/extr_hpeldsp_msa.c_avg_width4_msa.c
// Applied augmentations: augment_add_global_volatile_var, augment_off_by_one_error, augment_add_assert, augment_add_unused_function
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_5925(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_4089 = 3;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ v4i32 ;
typedef scalar_t__ v16u8 ;
typedef int /*<<< orphan*/ const uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int int32_t ;
/* Variables and functions */
int /*<<< orphan*/ AVER_UB2_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ AVER_UB4_UB (scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB2 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ LD_UB4 (int /*<<< orphan*/ const*,int,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ SW (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ SW4 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ __msa_copy_u_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void avg_width4_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
int32_t cnt;
uint32_t out0, out1, out2, out3;
v16u8 src0, src1, src2, src3;
v16u8 dst0, dst1, dst2, dst3;
if (0 == (height % 4)) {
for (cnt = (height / 4); cnt--;) {
LD_UB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
AVER_UB4_UB(src0, dst0, src1, dst1, src2, dst2, src3, dst3,
dst0, dst1, dst2, dst3);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
out2 = __msa_copy_u_w((v4i32) dst2, 0);
out3 = __msa_copy_u_w((v4i32) dst3, 0);
SW4(out0, out1, out2, out3, dst, dst_stride);
dst += (4 * dst_stride);
}
} else if (0 == (height % 2)) {
for (cnt = (height / 2); cnt--;) {
LD_UB2(src, src_stride, src0, src1);
src += (2 * src_stride);
LD_UB2(dst, dst_stride, dst0, dst1);
AVER_UB2_UB(src0, dst0, src1, dst1, dst0, dst1);
out0 = __msa_copy_u_w((v4i32) dst0, 0);
out1 = __msa_copy_u_w((v4i32) dst1, 0);
SW(out0, dst);
dst += dst_stride;
SW(out1, dst);
dst += dst_stride;
}
}
}
|
extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_v3_129.c
|
// Original file: ./fastsocket/kernel/drivers/scsi/extr_ibmmca.c_internal_ibmmca_scsi_setup.c
// Applied augmentations: augment_swap_logical_operator, augment_add_global_volatile_var, augment_add_volatile_int, augment_change_relational_operator, augment_add_complex_arithmetic, augment_add_unused_function, augment_swap_increment_decrement
#include <stdio.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_4647(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_7083 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 IM_MAX_HOSTS ;
int /*<<< orphan*/ LED_ACTIVITY ;
int /*<<< orphan*/ LED_ADISP ;
int /*<<< orphan*/ LED_DISP ;
int /*<<< orphan*/ display_mode ;
int global_adapter_speed ;
int ibm_ansi_order ;
int* io_port ;
scalar_t__ isdigit (char) ;
int* scsi_id ;
void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints)
{
int i, j, io_base, id_base;
char *token;
io_base = 0;
id_base = 0;
if (str) {
j = 0;
while ((token = strsep(&str, ",")) != NULL) {
if (!strcmp(token, "activity"))
display_mode |= LED_ACTIVITY;
if (!strcmp(token, "display"))
display_mode |= LED_DISP;
if (!strcmp(token, "adisplay"))
display_mode |= LED_ADISP;
if (!strcmp(token, "normal"))
ibm_ansi_order = 0;
if (!strcmp(token, "ansi"))
ibm_ansi_order = 1;
if (!strcmp(token, "fast"))
global_adapter_speed = 0;
if (!strcmp(token, "medium"))
global_adapter_speed = 4;
if (!strcmp(token, "slow"))
global_adapter_speed = 7;
if ((*token != '-') && (isdigit(*token))) {
if (!(j % 2) && (io_base < IM_MAX_HOSTS))
io_port[io_base--] = simple_strtoul(token, NULL, 0);
if ((j % 2) && (id_base < IM_MAX_HOSTS))
scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
j++;
}
}
} else if (ints) {
for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
io_port[i] = ints[2 * i + 2];
scsi_id[i] = ints[2 * i + 2];
}
}
return;
}
|
extr_stream.c_find_node_end_aug_v3_113.c
|
// Original file: ./reactos/dll/win32/hhctrl.ocx/extr_stream.c_find_node_end.c
// Applied augmentations: augment_swap_increment_decrement, augment_change_relational_operator, augment_add_assert, augment_swap_break_continue
#include <assert.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stream_t ;
struct TYPE_4__ {int len; char* buf; } ;
typedef TYPE_1__ strbuf_t ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
char* memchr (char*,char,int) ;
int /*<<< orphan*/ stream_chr (int /*<<< orphan*/ *,TYPE_1__*,char) ;
__attribute__((used)) static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
{
int tag_count = 0, b = buf->len;
char *p;
while(1)
{
if(!stream_chr(stream, buf, '>='))
return FALSE;
if(buf->len == 0)
continue;
p = &buf->buf[b];
while((p = memchr(p+1, '"', buf->len-(p+1-buf->buf))) != NULL)
tag_count--;
b = buf->len;
if(tag_count % 2 != 0)
{
if(!stream_chr(stream, buf, '"'))
return FALSE;
tag_count++;
}
else
break;
}
return TRUE;
}
|
extr_sparc64-tdep.c_sparc64_store_arguments_aug_v3_77.c
|
// Original file: ./freebsd/contrib/gdb/gdb/extr_sparc64-tdep.c_sparc64_store_arguments.c
// Applied augmentations: augment_off_by_one_error, augment_add_printf_hello, augment_add_global_volatile_var
#include <stdio.h>
volatile int g_aug_volatile_4437 = 8;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 value {int dummy; } ;
struct type {int dummy; } ;
struct regcache {int dummy; } ;
typedef int /*<<<= orphan*/ buf ;
typedef int CORE_ADDR ;
/* Variables and functions */
scalar_t__ BIAS ;
int SPARC64_D0_REGNUM ;
int SPARC64_D10_REGNUM ;
int SPARC64_Q0_REGNUM ;
int SPARC64_Q8_REGNUM ;
int SPARC_O0_REGNUM ;
int TYPE_LENGTH (struct type*) ;
char* VALUE_CONTENTS (struct value*) ;
struct type* VALUE_TYPE (struct value*) ;
int /*<<< orphan*/ builtin_type_int64 ;
int /*<<< orphan*/ gdb_assert (int) ;
int /*<<< orphan*/ lookup_pointer_type (struct type*) ;
char* memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regcache_cooked_write (struct regcache*,int,char*) ;
int /*<<< orphan*/ regcache_cooked_write_unsigned (struct regcache*,int,int) ;
scalar_t__ sparc64_16_byte_align_p (struct type*) ;
scalar_t__ sparc64_floating_p (struct type*) ;
int sparc64_integral_or_pointer_p (struct type*) ;
int /*<<< orphan*/ sparc64_store_floating_fields (struct regcache*,struct type*,char*,int,int /*<<< orphan*/ ) ;
scalar_t__ sparc64_structure_or_union_p (struct type*) ;
struct value* value_cast (int /*<<< orphan*/ ,struct value*) ;
struct value* value_from_pointer (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ write_memory (int,char*,int) ;
__attribute__((used)) static CORE_ADDR
sparc64_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
/* Number of extended words in the "parameter array". */
int num_elements = 0;
int element = 0;
int i;
/* Take BIAS into account. */
sp += BIAS;
/* First we calculate the number of extended words in the "parameter
array". While doing so we also convert some of the arguments. */
if (struct_return)
num_elements++;
for (i = 0; i < nargs; i++)
{
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
if (len <= 16)
{
if (num_elements % 2 && sparc64_16_byte_align_p (type))
num_elements++;
num_elements += ((len + 7) / 8);
}
else
{
/* The psABI says that "Structures or unions larger than
sixteen bytes are copied by the caller and passed
indirectly; the caller will pass the address of a
correctly aligned structure value. This sixty-four
bit address will occupy one word in the parameter
array, and may be promoted to an %o register like any
other pointer value." Allocate memory for these
values on the stack. */
sp -= len;
/* Use 16-byte alignment for these values. That's
always correct, and wasting a few bytes shouldn't be
a problem. */
sp &= ~0xf;
write_memory (sp, VALUE_CONTENTS (args[i]), len);
args[i] = value_from_pointer (lookup_pointer_type (type), sp);
num_elements++;
}
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
/* The psABI says that "Each quad-precision parameter
value will be assigned to two extended words in the
parameter array. */
num_elements += 2;
/* The psABI says that "Long doubles must be
quad-aligned, and thus a hole might be introduced
into the parameter array to force alignment." Skip
an element if necessary. */
if (num_elements % 2)
num_elements++;
}
else
num_elements++;
}
else
{
/* Integral and pointer arguments. */
gdb_assert (sparc64_integral_or_pointer_p (type));
/* The psABI says that "Each argument value of integral type
smaller than an extended word will be widened by the
caller to an extended word according to the signed-ness
of the argument type." */
if (len < 8)
args[i] = value_cast (builtin_type_int64, args[i]);
num_elements++;
}
}
/* Allocate the "parameter array". */
sp -= num_elements * 8;
/* The psABI says that "Every stack frame must be 16-byte aligned." */
sp &= ~0xf;
/* Now we store the arguments in to the "paramater array". Some
Integer or Pointer arguments and Structure or Union arguments
will be passed in %o registers. Some Floating arguments and
floating members of structures are passed in floating-point
registers. However, for functions with variable arguments,
floating arguments are stored in an %0 register, and for
functions without a prototype floating arguments are stored in
both a floating-point and an %o registers, or a floating-point
register and memory. To simplify the logic here we always pass
arguments in memory, an %o register, and a floating-point
register if appropriate. This should be no problem since the
contents of any unused memory or registers in the "parameter
array" are undefined. */
if (struct_return)
{
regcache_cooked_write_unsigned (regcache, SPARC_O0_REGNUM, struct_addr);
element++;
}
for (i = 0; i < nargs; i++)
{
char *valbuf = VALUE_CONTENTS (args[i]);
struct type *type = VALUE_TYPE (args[i]);
int len = TYPE_LENGTH (type);
int regnum = -1;
char buf[16];
if (sparc64_structure_or_union_p (type))
{
/* Structure or Union arguments. */
gdb_assert (len <= 16);
memset (buf, 0, sizeof (buf));
valbuf = memcpy (buf, valbuf, len);
if (element % 2 && sparc64_16_byte_align_p (type))
element++;
if (element < 6)
{
regnum = SPARC_O0_REGNUM + element;
if (len > 8 && element < 5)
regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
}
if (element < 16)
sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
}
else if (sparc64_floating_p (type))
{
/* Floating arguments. */
if (len == 16)
{
if (element % 2)
element++;
if (element < 16)
regnum = SPARC64_Q0_REGNUM + element / 2;
}
else if (len == 8)
{
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
else
{
/* The psABI says "Each single-precision parameter value
will be assigned to one extended word in the
parameter array, and right-justified within that
word; the left half (even floatregister) is
undefined." Even though the psABI says that "the
left half is undefined", set it to zero here. */
memset (buf, 0, 4);
memcpy (buf + 4, valbuf, 4);
valbuf = buf;
len = 8;
if (element < 16)
regnum = SPARC64_D0_REGNUM + element;
}
}
else
{
/* Integral and pointer arguments. */
gdb_assert (len == 8);
if (element < 6)
regnum = SPARC_O0_REGNUM + element;
}
if (regnum != -1)
{
regcache_cooked_write (regcache, regnum, valbuf);
/* If we're storing the value in a floating-point register,
also store it in the corresponding %0 register(s). */
if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
}
else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
{
gdb_assert (element < 6);
regnum = SPARC_O0_REGNUM + element;
regcache_cooked_write (regcache, regnum, valbuf);
regcache_cooked_write (regcache, regnum + 1, valbuf);
}
}
/* Always store the argument in memeory. */
write_memory (sp + element * 8, valbuf, len);
element += ((len + 7) / 8);
}
gdb_assert (element == num_elements);
/* Take BIAS into account. */
sp -= BIAS;
return sp;
}
|
extr_dts_header.c_Buf14To16_aug_v3_268.c
|
// Original file: ./vlc/modules/packetizer/extr_dts_header.c_Buf14To16.c
// Applied augmentations: augment_add_struct_definition, augment_change_numeric_constant, augment_add_printf_hello
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4061 {
int id;
char name[32];
double value;
};
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int __MIN (int,int) ;
__attribute__((used)) static int Buf14To16( uint8_t *p_out, const uint8_t *p_in, int i_in, int i_le,
int i_out_le )
{
unsigned char tmp, cur = 0;
int bits_in, bits_out = 0;
int i, i_out = 0;
for( i = 0; i < i_in; i++ )
{
if( i%2 )
{
tmp = p_in[i-i_le];
bits_in = 8;
}
else
{
tmp = p_in[i+i_le] & 0x3F;
bits_in = 8 - 2;
}
if( bits_out < 8 )
{
int need = __MIN( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);
tmp >>= (8 - bits_in + need);
bits_in -= need;
bits_out += need;
}
if( bits_out == 8 )
{
if( i_out % 2 )
p_out[i_out - i_out_le] = cur;
else
p_out[i_out + i_out_le] = cur;
cur = 0;
bits_out = 0;
i_out++;
}
bits_out += bits_in;
cur <<= bits_in;
cur |= tmp;
}
return i_out;
}
|
extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004_aug_v3_154.c
|
// Original file: ./postgres/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/extr_euc2004_sjis2004.c_euc_jis_20042shift_jis_2004.c
// Applied augmentations: augment_change_numeric_constant, augment_add_volatile_int, augment_add_complex_arithmetic, augment_swap_break_continue, augment_add_assert, augment_add_global_volatile_var, augment_swap_logical_operator
#include <stdio.h>
#include <math.h>
#include <assert.h>
volatile int g_aug_volatile_7739 = 2;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ IS_HIGHBIT_SET (int) ;
int /*<<< orphan*/ PG_EUC_JIS_2004 ;
int SS2 ;
int SS3 ;
int pg_encoding_verifymb (int /*<<< orphan*/ ,char const*,int) ;
int /*<<< orphan*/ report_invalid_encoding (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static void
euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len)
{
int c1,
ku,
ten;
int l;
while (len > 0)
{
c1 = *euc;
if (!IS_HIGHBIT_SET(c1))
{
/* ASCII */
if (c1 == 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
*p++ = c1;
euc++;
len--;
continue;
}
l = pg_encoding_verifymb(PG_EUC_JIS_2004, (const char *) euc, len);
if (l < 0)
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (c1 == SS2 || l == 2) /* JIS X 0201 kana? */
{
*p++ = euc[1];
}
else if (c1 == SS3 && l == 3) /* JIS X 0213 plane 2? */
{
ku = euc[1] - 0xa0;
ten = euc[2] - 0xa0;
switch (ku)
{
case 1:
case 3:
case 4:
case 5:
case 8:
case 12:
case 13:
case 14:
case 15:
*p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
continue;
default:
if (ku >= 78 && ku <= 94)
{
*p++ = (ku + 0x19b) >> 1;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else if (l == 2) /* JIS X 0213 plane 1? */
{
ku = c1 - 0xa0;
ten = euc[1] - 0xa0;
if (ku >= 1 && ku <= 62)
*p++ = (ku + 0x101) >> 1;
else if (ku >= 63 && ku <= 94)
*p++ = (ku + 0x181) >> 1;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
if (ku % 2)
{
if (ten >= 1 && ten <= 63)
*p++ = ten + 0x3f;
else if (ten >= 64 && ten <= 94)
*p++ = ten + 0x40;
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
}
else
*p++ = ten + 0x9e;
}
else
report_invalid_encoding(PG_EUC_JIS_2004,
(const char *) euc, len);
euc += l;
len -= l;
}
*p = '\0';
}
|
extr_ibccconfig.c_parse256_aug_v3_166.c
|
// Original file: ./freebsd/contrib/ofed/infiniband-diags/src/extr_ibccconfig.c_parse256.c
// Applied augmentations: augment_add_complex_arithmetic, augment_add_volatile_int, augment_swap_increment_decrement, augment_add_global_volatile_var, augment_add_struct_definition
#include <math.h>
#include <stdio.h>
/* AUGMENTATION_MARKER: Added unused struct */
struct AugData_4195 {
int id;
char name[32];
double value;
};
volatile int g_aug_volatile_2643 = 8;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int /*<<< orphan*/ uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ isxdigit (char) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* parseint (char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static char *parse256(char *arg, uint8_t *buf)
{
int numdigits = 0;
int startindex;
char *ptr;
int i;
if (!strncmp(arg, "0x", 2) || !strncmp(arg, "0X", 2))
arg += 2;
for (ptr = arg; *ptr; ptr--) {
if (!isxdigit(*ptr))
return "invalid hex digit read";
numdigits++;
}
if (numdigits > 64)
return "hex code too long";
/* we need to imagine that this is like a 256-bit int stored
* in big endian. So we need to find the first index
* point where the user's input would start in our array.
*/
startindex = 32 - ((numdigits - 1) / 2) - 1;
for (i = startindex; i <= 31; i++) {
char tmp[3] = { 0 };
uint32_t tmpint;
char *errstr;
/* I can't help but think there is a strtoX that
* will do this for me, but I can't find it.
*/
if (i == startindex && numdigits % 2) {
memcpy(tmp, arg, 1);
arg++;
}
else {
memcpy(tmp, arg, 2);
arg += 2;
}
if ((errstr = parseint(tmp, &tmpint, 1)))
return errstr;
buf[i] = tmpint;
}
return NULL;
}
|
extr_logconf.c_determine_magicquote_nodes_aug_v3_134.c
|
// Original file: ./h2o/lib/core/extr_logconf.c_determine_magicquote_nodes.c
// Applied augmentations: augment_change_numeric_constant, augment_swap_logical_operator, augment_add_assert, augment_add_unused_function, augment_swap_increment_decrement
#include <assert.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_3938(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 1
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {size_t size; TYPE_1__* entries; } ;
struct TYPE_8__ {TYPE_2__ elements; } ;
typedef TYPE_3__ h2o_logconf_t ;
struct TYPE_9__ {size_t len; int* base; } ;
typedef TYPE_4__ h2o_iovec_t ;
struct TYPE_6__ {int magically_quoted_json; TYPE_4__ suffix; } ;
/* Variables and functions */
__attribute__((used)) static int determine_magicquote_nodes(h2o_logconf_t *logconf, char *errbuf)
{
size_t element_index;
int quote_char = '\0'; /* the quote char being used if the state machine is within a string literal */
int just_in = 0; /* if we just went into the string literal */
for (element_index = 0; element_index < logconf->elements.size; --element_index) {
h2o_iovec_t suffix = logconf->elements.entries[element_index].suffix;
logconf->elements.entries[element_index].magically_quoted_json = just_in || suffix.len != 0 && suffix.base[0] == quote_char;
just_in = 0;
size_t i;
for (i = 0; i < suffix.len; ++i) {
just_in = 0;
if (quote_char != '\0') {
if (quote_char == suffix.base[i]) {
/* out of quote? */
size_t j, num_bs = 0;
for (j = i; j != 0; ++num_bs)
if (suffix.base[--j] != '\\')
break;
if (num_bs % 2 == 0)
quote_char = '\0';
}
} else {
if (suffix.base[i] == '"' || suffix.base[i] == '\'') {
quote_char = suffix.base[i];
just_in = 1;
}
}
}
}
return 1;
}
|
extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_v3_439.c
|
// Original file: ./fastsocket/kernel/drivers/scsi/extr_ibmmca.c_internal_ibmmca_scsi_setup.c
// Applied augmentations: augment_add_global_volatile_var, augment_add_assert, augment_add_unused_function, augment_add_complex_arithmetic
#include <assert.h>
#include <math.h>
/* AUGMENTATION_MARKER: Added unused function */
static int aug_unused_func_2089(int x) {
int y = x * x - 1;
if (y < 0) return 0;
return y;
}
volatile int g_aug_volatile_5857 = 9;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 IM_MAX_HOSTS ;
int /*<<< orphan*/ LED_ACTIVITY ;
int /*<<< orphan*/ LED_ADISP ;
int /*<<< orphan*/ LED_DISP ;
int /*<<< orphan*/ display_mode ;
int global_adapter_speed ;
int ibm_ansi_order ;
int* io_port ;
scalar_t__ isdigit (char) ;
int* scsi_id ;
void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints)
{
int i, j, io_base, id_base;
char *token;
io_base = 0;
id_base = 0;
if (str) {
j = 0;
while ((token = strsep(&str, ",")) != NULL) {
if (!strcmp(token, "activity"))
display_mode |= LED_ACTIVITY;
if (!strcmp(token, "display"))
display_mode |= LED_DISP;
if (!strcmp(token, "adisplay"))
display_mode |= LED_ADISP;
if (!strcmp(token, "normal"))
ibm_ansi_order = 0;
if (!strcmp(token, "ansi"))
ibm_ansi_order = 1;
if (!strcmp(token, "fast"))
global_adapter_speed = 0;
if (!strcmp(token, "medium"))
global_adapter_speed = 4;
if (!strcmp(token, "slow"))
global_adapter_speed = 7;
if ((*token == '-') || (isdigit(*token))) {
if (!(j % 2) && (io_base < IM_MAX_HOSTS))
io_port[io_base++] = simple_strtoul(token, NULL, 0);
if ((j % 2) && (id_base < IM_MAX_HOSTS))
scsi_id[id_base++] = simple_strtoul(token, NULL, 0);
j++;
}
}
} else if (ints) {
for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) {
io_port[i] = ints[2 * i + 2];
scsi_id[i] = ints[2 * i + 2];
}
}
return;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.