#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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 WSQ_EndTransaction();
int /*<<< orphan*/ WSQ_Init(char *);
int /*<<< orphan*/ WSQ_Pause();
int /*<<< orphan*/ WSQ_SetQueryName(char *);
int /*<<< orphan*/ WSQ_Shutdown();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main(int argc, char *argv[]) {
  char addr[128];
  sprintf(addr, "localhost | %d", 5002);
  WSQ_Init("");
  WSQ_SetQueryName("proc1query");
  WSQ_Pause();
  printf("PAUSING WSQ engine, run compiled query manually...\n");
  WSQ_BeginTransaction(1001);
  WSQ_BeginSubgraph(101);
  WSQ_AddOp(1, "ASCIIFileSource", "", "2",
            "-1 |foobar.schema|taq_500lines.dat");
  WSQ_AddOp(3, "ConnectRemoteOut", "2", "", addr);
  WSQ_EndSubgraph();
  int pid = WSQ_EndTransaction();
  WSQ_Shutdown();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe29(%rip),%rsi
mov    $0x138a,%edx
call   10c0 <sprintf@plt>
lea    0xe65(%rip),%rdi
call   1060 <WSQ_Init@plt>
lea    0xe1b(%rip),%rdi
call   1080 <WSQ_SetQueryName@plt>
mov    $0x0,%al
call   10d0 <WSQ_Pause@plt>
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3e9,%edi
call   1070 <WSQ_BeginTransaction@plt>
mov    $0x65,%edi
call   10a0 <WSQ_BeginSubgraph@plt>
mov    $0x1,%edi
lea    0xe22(%rip),%rsi
lea    0xe1a(%rip),%rdx
lea    0xe24(%rip),%rcx
lea    0xe1f(%rip),%r8
call   1090 <WSQ_AddOp@plt>
lea    -0x90(%rbp),%r8
mov    $0x3,%edi
lea    0xe2a(%rip),%rsi
lea    0xdfe(%rip),%rdx
lea    0xde6(%rip),%rcx
call   1090 <WSQ_AddOp@plt>
mov    $0x0,%al
call   1050 <WSQ_EndSubgraph@plt>
mov    $0x0,%al
call   10b0 <WSQ_EndTransaction@plt>
mov    %eax,-0x94(%rbp)
mov    $0x0,%al
call   1030 <WSQ_Shutdown@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xe3d(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x138a,%edx
call   10c0 <sprintf@plt>
lea    0xeb8(%rip),%r15
mov    %r15,%rdi
call   1060 <WSQ_Init@plt>
lea    0xe26(%rip),%rdi
call   1080 <WSQ_SetQueryName@plt>
xor    %eax,%eax
call   10d0 <WSQ_Pause@plt>
lea    0xe64(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3e9,%edi
call   1070 <WSQ_BeginTransaction@plt>
mov    $0x65,%edi
call   10a0 <WSQ_BeginSubgraph@plt>
lea    0xdfe(%rip),%rsi
lea    0xe07(%rip),%rbx
lea    0xe02(%rip),%r8
mov    $0x1,%edi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe0e(%rip),%rsi
mov    $0x3,%edi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1090 <WSQ_AddOp@plt>
xor    %eax,%eax
call   1050 <WSQ_EndSubgraph@plt>
xor    %eax,%eax
call   10b0 <WSQ_EndTransaction@plt>
xor    %eax,%eax
call   1040 <WSQ_Shutdown@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"localhost | %d\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [11 x i8] c"proc1query\00"
@.str.3 = [52 x i8] c"PAUSING WSQ engine, run compiled query manually...\0A\00"
@.str.4 = [16 x i8] c"ASCIIFileSource\00"
@.str.5 = [2 x i8] c"2\00"
@.str.6 = [35 x i8] c"-1 |foobar.schema|taq_500lines.dat\00"
@.str.7 = [17 x i8] c"ConnectRemoteOut\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%9 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 5002)
%10 = call i32 @WSQ_Init(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @WSQ_SetQueryName(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (...) @WSQ_Pause()
%13 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @WSQ_BeginTransaction(i32 1001)
%15 = call i32 @WSQ_BeginSubgraph(i32 101)
%16 = call i32 @WSQ_AddOp(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%18 = call i32 @WSQ_AddOp(i32 3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = call i32 (...) @WSQ_EndSubgraph()
%20 = call i32 (...) @WSQ_EndTransaction()
store i32 %20, i32* %7
%21 = call i32 (...) @WSQ_Shutdown()
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"localhost | %d\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [11 x i8] c"proc1query\00"
@.str.4 = [16 x i8] c"ASCIIFileSource\00"
@.str.5 = [2 x i8] c"2\00"
@.str.6 = [35 x i8] c"-1 |foobar.schema|taq_500lines.dat\00"
@.str.7 = [17 x i8] c"ConnectRemoteOut\00"
@str = [51 x i8] c"PAUSING WSQ engine, run compiled query manually...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 5002)
%6 = tail call i32 @WSQ_Init(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @WSQ_SetQueryName(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (...) @WSQ_Pause()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @WSQ_BeginTransaction(i32 1001)
%11 = tail call i32 @WSQ_BeginSubgraph(i32 101)
%12 = tail call i32 @WSQ_AddOp(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @WSQ_AddOp(i32 3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%14 = call i32 (...) @WSQ_EndSubgraph()
%15 = call i32 (...) @WSQ_EndTransaction()
%16 = call i32 (...) @WSQ_Shutdown()
ret i32 0
}