#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ WSQ_AddOp(int, char *, char *, char *, char *);
int /*<<< orphan*/ WSQ_BeginSubgraph(int);
int /*<<< orphan*/ WSQ_BeginTransaction(int);
int /*<<< orphan*/ WSQ_EndSubgraph();
int /*<<< orphan*/ WSQ_EndTransaction();
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
void query_B() {
  char strargs[2048];
  char *machine = "localhost";
  sprintf(
      strargs,
      "%s | %d | bigint TIMESTAMP, string SYMBOL, bigint EXCHTIMESTAMP, bigint "
      "RECEIVEDTIME, double BID, double BIDSIZE, double ASK, double ASKSIZE ",
      machine, 5002);
  WSQ_BeginTransaction(1001);
  WSQ_BeginSubgraph(101);
  WSQ_AddOp(20, "ConnectRemoteIn", "", "100", strargs);
  WSQ_AddOp(2, "UDF", "100", "200", "output_timer.ws | output_timer | 1.0 ");
  WSQ_AddOp(3, "Printer", "200", "", " Should never see this.. ");
  WSQ_EndSubgraph();
  WSQ_EndTransaction();
}


x86 assembly (clang, -O0):
<query_B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    0xe8e(%rip),%rax
mov    %rax,-0x808(%rbp)
lea    -0x800(%rbp),%rdi
mov    -0x808(%rbp),%rdx
lea    0xe7c(%rip),%rsi
mov    $0x138a,%ecx
call   1080 <sprintf@plt>
mov    $0x3e9,%edi
call   1040 <WSQ_BeginTransaction@plt>
mov    $0x65,%edi
call   1060 <WSQ_BeginSubgraph@plt>
lea    -0x800(%rbp),%r8
mov    $0x14,%edi
lea    0xed9(%rip),%rsi
lea    0xf35(%rip),%rdx
lea    0xedb(%rip),%rcx
call   1050 <WSQ_AddOp@plt>
mov    $0x2,%edi
lea    0xece(%rip),%rsi
lea    0xec3(%rip),%rdx
lea    0xec4(%rip),%rcx
lea    0xec1(%rip),%r8
call   1050 <WSQ_AddOp@plt>
mov    $0x3,%edi
lea    0xed6(%rip),%rsi
lea    0xea5(%rip),%rdx
lea    0xee9(%rip),%rcx
lea    0xec9(%rip),%r8
call   1050 <WSQ_AddOp@plt>
mov    $0x0,%al
call   1030 <WSQ_EndSubgraph@plt>
mov    $0x0,%al
call   1070 <WSQ_EndTransaction@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<query_B>:
push   %r15
push   %r14
push   %rbx
sub    $0x800,%rsp
lea    0xe97(%rip),%rsi
lea    0xe86(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x138a,%ecx
call   1080 <sprintf@plt>
mov    $0x3e9,%edi
call   1040 <WSQ_BeginTransaction@plt>
mov    $0x65,%edi
call   1060 <WSQ_BeginSubgraph@plt>
lea    0xef3(%rip),%rsi
lea    0xf4f(%rip),%r14
lea    0xef5(%rip),%rbx
mov    $0x14,%edi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %r15,%r8
call   1050 <WSQ_AddOp@plt>
lea    0xedf(%rip),%rsi
lea    0xedc(%rip),%r15
lea    0xed9(%rip),%r8
mov    $0x2,%edi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1050 <WSQ_AddOp@plt>
lea    0xee8(%rip),%rsi
lea    0xee9(%rip),%r8
mov    $0x3,%edi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <WSQ_AddOp@plt>
xor    %eax,%eax
call   1030 <WSQ_EndSubgraph@plt>
xor    %eax,%eax
call   1070 <WSQ_EndTransaction@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [142 x i8] c"%s | %d | bigint TIMESTAMP, string SYMBOL, bigint EXCHTIMESTAMP, bigint RECEIVEDTIME, double BID, double BIDSIZE, double ASK, double ASKSIZE \00"
@.str.2 = [16 x i8] c"ConnectRemoteIn\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"100\00"
@.str.5 = [4 x i8] c"UDF\00"
@.str.6 = [4 x i8] c"200\00"
@.str.7 = [38 x i8] c"output_timer.ws | output_timer | 1.0 \00"
@.str.8 = [8 x i8] c"Printer\00"
@.str.9 = [26 x i8] c" Should never see this.. \00"
define void @query_B() {
%1 = alloca [2048 x i8]
%2 = alloca i8*
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = getelementptr inbounds [2048 x i8], [2048 x i8]* %1, i64 0, i64 0
%4 = load i8*, i8** %2
%5 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 5002)
%6 = call i32 @WSQ_BeginTransaction(i32 1001)
%7 = call i32 @WSQ_BeginSubgraph(i32 101)
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %1, i64 0, i64 0
%9 = call i32 @WSQ_AddOp(i32 20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%10 = call i32 @WSQ_AddOp(i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%11 = call i32 @WSQ_AddOp(i32 3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%12 = call i32 (...) @WSQ_EndSubgraph()
%13 = call i32 (...) @WSQ_EndTransaction()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [142 x i8] c"%s | %d | bigint TIMESTAMP, string SYMBOL, bigint EXCHTIMESTAMP, bigint RECEIVEDTIME, double BID, double BIDSIZE, double ASK, double ASKSIZE \00"
@.str.2 = [16 x i8] c"ConnectRemoteIn\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"100\00"
@.str.5 = [4 x i8] c"UDF\00"
@.str.6 = [4 x i8] c"200\00"
@.str.7 = [38 x i8] c"output_timer.ws | output_timer | 1.0 \00"
@.str.8 = [8 x i8] c"Printer\00"
@.str.9 = [26 x i8] c" Should never see this.. \00"
define void @query_B() {
%1 = alloca [2048 x i8]
%2 = getelementptr inbounds [2048 x i8], [2048 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 5002)
%4 = tail call i32 @WSQ_BeginTransaction(i32 1001)
%5 = tail call i32 @WSQ_BeginSubgraph(i32 101)
%6 = call i32 @WSQ_AddOp(i32 20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%7 = call i32 @WSQ_AddOp(i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%8 = call i32 @WSQ_AddOp(i32 3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%9 = call i32 (...) @WSQ_EndSubgraph()
%10 = call i32 (...) @WSQ_EndTransaction()
ret void
}