#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // 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*/ WSQ_Init(char *);
int /*<<< orphan*/ WSQ_SetQueryName(char *);
int /*<<< orphan*/ WSQ_Shutdown();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  WSQ_Init("8_TAQ_reader.out");
  WSQ_SetQueryName("generated_query_8");
  printf("PAUSING WSQ engine, run compiled query manually...\n");
  WSQ_BeginTransaction(1001);
  WSQ_BeginSubgraph(101);
  WSQ_AddOp(1, "ASCIIFileSource", "", "2",
            "-1 |foobar.schema|./example_distributed/taq_500lines.dat");
  WSQ_AddOp(2, "Printer", "2", "", "From file source:");
  WSQ_EndSubgraph();
  WSQ_EndTransaction();
  sleep(2);
  printf("Done Sleeping.  Shutting down WSQ Engine...\n");
  WSQ_Shutdown();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe43(%rip),%rdi
call   1060 <WSQ_Init@plt>
lea    0xe48(%rip),%rdi
call   1080 <WSQ_SetQueryName@plt>
lea    0xe4e(%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    0xe5d(%rip),%rsi
lea    0xee7(%rip),%rdx
lea    0xe5f(%rip),%rcx
lea    0xe5a(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x2,%edi
lea    0xe82(%rip),%rsi
lea    0xe40(%rip),%rdx
lea    0xeba(%rip),%rcx
lea    0xe75(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x0,%al
call   1050 <WSQ_EndSubgraph@plt>
mov    $0x0,%al
call   10b0 <WSQ_EndTransaction@plt>
mov    $0x2,%edi
call   10c0 <sleep@plt>
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <WSQ_Shutdown@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe55(%rip),%rdi
call   1060 <WSQ_Init@plt>
lea    0xe5a(%rip),%rdi
call   1080 <WSQ_SetQueryName@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3e9,%edi
call   1070 <WSQ_BeginTransaction@plt>
mov    $0x65,%edi
call   10a0 <WSQ_BeginSubgraph@plt>
lea    0xe40(%rip),%rsi
lea    0xefc(%rip),%r14
lea    0xe42(%rip),%rbx
lea    0xe3d(%rip),%r8
mov    $0x1,%edi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe5f(%rip),%rsi
lea    0xe60(%rip),%r8
mov    $0x2,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1090 <WSQ_AddOp@plt>
xor    %eax,%eax
call   1050 <WSQ_EndSubgraph@plt>
xor    %eax,%eax
call   10b0 <WSQ_EndTransaction@plt>
mov    $0x2,%edi
call   10c0 <sleep@plt>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <WSQ_Shutdown@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"8_TAQ_reader.out\00"
@.str.1 = [18 x i8] c"generated_query_8\00"
@.str.2 = [52 x i8] c"PAUSING WSQ engine, run compiled query manually...\0A\00"
@.str.3 = [16 x i8] c"ASCIIFileSource\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [2 x i8] c"2\00"
@.str.6 = [57 x i8] c"-1 |foobar.schema|./example_distributed/taq_500lines.dat\00"
@.str.7 = [8 x i8] c"Printer\00"
@.str.8 = [18 x i8] c"From file source:\00"
@.str.9 = [45 x i8] c"Done Sleeping. Shutting down WSQ Engine...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @WSQ_Init(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @WSQ_SetQueryName(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @WSQ_BeginTransaction(i32 1001)
%10 = call i32 @WSQ_BeginSubgraph(i32 101)
%11 = call i32 @WSQ_AddOp(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 @WSQ_AddOp(i32 2, i8* getelementptr inbounds ([8 x i8], [8 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.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 (...) @WSQ_EndSubgraph()
%14 = call i32 (...) @WSQ_EndTransaction()
%15 = call i32 @sleep(i32 2)
%16 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
%17 = call i32 (...) @WSQ_Shutdown()
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"8_TAQ_reader.out\00"
@.str.1 = [18 x i8] c"generated_query_8\00"
@.str.3 = [16 x i8] c"ASCIIFileSource\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [2 x i8] c"2\00"
@.str.6 = [57 x i8] c"-1 |foobar.schema|./example_distributed/taq_500lines.dat\00"
@.str.7 = [8 x i8] c"Printer\00"
@.str.8 = [18 x i8] c"From file source:\00"
@str = [51 x i8] c"PAUSING WSQ engine, run compiled query manually...\00"
@str.10 = [44 x i8] c"Done Sleeping. Shutting down WSQ Engine...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @WSQ_Init(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @WSQ_SetQueryName(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @WSQ_BeginTransaction(i32 1001)
%7 = tail call i32 @WSQ_BeginSubgraph(i32 101)
%8 = tail call i32 @WSQ_AddOp(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%9 = tail call i32 @WSQ_AddOp(i32 2, i8* getelementptr inbounds ([8 x i8], [8 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.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%10 = tail call i32 (...) @WSQ_EndSubgraph()
%11 = tail call i32 (...) @WSQ_EndTransaction()
%12 = tail call i32 @sleep(i32 2)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.10, i64 0, i64 0))
%14 = tail call i32 (...) @WSQ_Shutdown()
ret i32 0
}