#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("7_MergeMonotonic.out");
  WSQ_SetQueryName("generated_query_7");
  WSQ_BeginTransaction(99);
  WSQ_BeginSubgraph(11);
  WSQ_AddOp(1, "NonRandomSource", "", "100", "50 |foobar.schema");
  WSQ_AddOp(2, "Filter", "100", "200", "((VOLUME % 2) == 0)");
  WSQ_AddOp(3, "Filter", "100", "300", "((VOLUME % 2) == 1)");
  WSQ_AddOp(4, "Project", "300", "400",
            "SYM, TIME, PRICE, (VOLUME + 1) AS VOLUME");
  WSQ_AddOp(5, "MergeMonotonic", "200 400", "500", "VOLUME");
  WSQ_AddOp(6, "Printer", "200", "", "In1");
  WSQ_AddOp(7, "Printer", "400", "", "In2");
  WSQ_AddOp(8, "Printer", "500", "", "Merged");
  WSQ_EndSubgraph();
  WSQ_EndTransaction();
  sleep(2);
  printf("\n ******* Query successfully ran for 3 seconds, shutting down...\n");
  WSQ_Shutdown();
  printf("Shutdown apparently successful.\n");
  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    0xe4c(%rip),%rdi
call   1080 <WSQ_SetQueryName@plt>
mov    $0x63,%edi
call   1070 <WSQ_BeginTransaction@plt>
mov    $0xb,%edi
call   10a0 <WSQ_BeginSubgraph@plt>
mov    $0x1,%edi
lea    0xe39(%rip),%rsi
lea    0xf33(%rip),%rdx
lea    0xe3b(%rip),%rcx
lea    0xe38(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x2,%edi
lea    0xe39(%rip),%rsi
lea    0xe1c(%rip),%rdx
lea    0xe32(%rip),%rcx
lea    0xe2f(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x3,%edi
lea    0xe13(%rip),%rsi
lea    0xdf6(%rip),%rdx
lea    0xe24(%rip),%rcx
lea    0xe21(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x4,%edi
lea    0xe24(%rip),%rsi
lea    0xe05(%rip),%rdx
lea    0xe5a(%rip),%rcx
lea    0xe17(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x5,%edi
lea    0xe2f(%rip),%rsi
lea    0xe37(%rip),%rdx
lea    0xe38(%rip),%rcx
lea    0xe13(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x6,%edi
lea    0xe24(%rip),%rsi
lea    0xda1(%rip),%rdx
lea    0xe6e(%rip),%rcx
lea    0xe17(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x7,%edi
lea    0xdfe(%rip),%rsi
lea    0xdef(%rip),%rdx
lea    0xe48(%rip),%rcx
lea    0xdf5(%rip),%r8
call   1090 <WSQ_AddOp@plt>
mov    $0x8,%edi
lea    0xdd8(%rip),%rsi
lea    0xdcd(%rip),%rdx
lea    0xe22(%rip),%rcx
lea    0xdd3(%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    0xdb6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <WSQ_Shutdown@plt>
lea    0xde5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xe50(%rip),%rdi
call   1060 <WSQ_Init@plt>
lea    0xe59(%rip),%rdi
call   1080 <WSQ_SetQueryName@plt>
mov    $0x63,%edi
call   1070 <WSQ_BeginTransaction@plt>
mov    $0xb,%edi
call   10a0 <WSQ_BeginSubgraph@plt>
lea    0xe4b(%rip),%rsi
lea    0xe88(%rip),%r15
lea    0xe4d(%rip),%rbx
lea    0xe4a(%rip),%r8
mov    $0x1,%edi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe45(%rip),%r12
lea    0xe45(%rip),%r14
lea    0xe42(%rip),%r8
mov    $0x2,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe3c(%rip),%r13
lea    0xe39(%rip),%r8
mov    $0x3,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe33(%rip),%rsi
lea    0xe70(%rip),%r12
lea    0xe2d(%rip),%r8
mov    $0x4,%edi
mov    %r13,%rdx
mov    %r12,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe3f(%rip),%rsi
lea    0xe47(%rip),%rdx
lea    0xe48(%rip),%r13
lea    0xe23(%rip),%r8
mov    $0x5,%edi
mov    %r13,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe31(%rip),%rbx
lea    0xe32(%rip),%r8
mov    $0x6,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe1c(%rip),%r8
mov    $0x7,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1090 <WSQ_AddOp@plt>
lea    0xe06(%rip),%r8
mov    $0x8,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r15,%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    0xddb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <WSQ_Shutdown@plt>
lea    0xe09(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"7_MergeMonotonic.out\00"
@.str.1 = [18 x i8] c"generated_query_7\00"
@.str.2 = [16 x i8] c"NonRandomSource\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"100\00"
@.str.5 = [18 x i8] c"50 |foobar.schema\00"
@.str.6 = [7 x i8] c"Filter\00"
@.str.7 = [4 x i8] c"200\00"
@.str.8 = [20 x i8] c"((VOLUME % 2) == 0)\00"
@.str.9 = [4 x i8] c"300\00"
@.str.10 = [20 x i8] c"((VOLUME % 2) == 1)\00"
@.str.11 = [8 x i8] c"Project\00"
@.str.12 = [4 x i8] c"400\00"
@.str.13 = [41 x i8] c"SYM, TIME, PRICE, (VOLUME + 1) AS VOLUME\00"
@.str.14 = [15 x i8] c"MergeMonotonic\00"
@.str.15 = [8 x i8] c"200 400\00"
@.str.16 = [4 x i8] c"500\00"
@.str.17 = [7 x i8] c"VOLUME\00"
@.str.18 = [8 x i8] c"Printer\00"
@.str.19 = [4 x i8] c"In1\00"
@.str.20 = [4 x i8] c"In2\00"
@.str.21 = [7 x i8] c"Merged\00"
@.str.22 = [66 x i8] c"\0A ******* Query successfully ran for 3 seconds, shutting down...\0A\00"
@.str.23 = [33 x i8] c"Shutdown apparently successful.\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 ([21 x i8], [21 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 @WSQ_BeginTransaction(i32 99)
%9 = call i32 @WSQ_BeginSubgraph(i32 11)
%10 = call i32 @WSQ_AddOp(i32 1, 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* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @WSQ_AddOp(i32 2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, 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.7, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @WSQ_AddOp(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, 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.9, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%13 = call i32 @WSQ_AddOp(i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0))
%14 = call i32 @WSQ_AddOp(i32 5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
%15 = call i32 @WSQ_AddOp(i32 6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, 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.19, i64 0, i64 0))
%16 = call i32 @WSQ_AddOp(i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, 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.20, i64 0, i64 0))
%17 = call i32 @WSQ_AddOp(i32 8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0))
%18 = call i32 (...) @WSQ_EndSubgraph()
%19 = call i32 (...) @WSQ_EndTransaction()
%20 = call i32 @sleep(i32 2)
%21 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.22, i64 0, i64 0))
%22 = call i32 (...) @WSQ_Shutdown()
%23 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.23, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"7_MergeMonotonic.out\00"
@.str.1 = [18 x i8] c"generated_query_7\00"
@.str.2 = [16 x i8] c"NonRandomSource\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"100\00"
@.str.5 = [18 x i8] c"50 |foobar.schema\00"
@.str.6 = [7 x i8] c"Filter\00"
@.str.7 = [4 x i8] c"200\00"
@.str.8 = [20 x i8] c"((VOLUME % 2) == 0)\00"
@.str.9 = [4 x i8] c"300\00"
@.str.10 = [20 x i8] c"((VOLUME % 2) == 1)\00"
@.str.11 = [8 x i8] c"Project\00"
@.str.12 = [4 x i8] c"400\00"
@.str.13 = [41 x i8] c"SYM, TIME, PRICE, (VOLUME + 1) AS VOLUME\00"
@.str.14 = [15 x i8] c"MergeMonotonic\00"
@.str.15 = [8 x i8] c"200 400\00"
@.str.16 = [4 x i8] c"500\00"
@.str.17 = [7 x i8] c"VOLUME\00"
@.str.18 = [8 x i8] c"Printer\00"
@.str.19 = [4 x i8] c"In1\00"
@.str.20 = [4 x i8] c"In2\00"
@.str.21 = [7 x i8] c"Merged\00"
@str = [65 x i8] c"\0A ******* Query successfully ran for 3 seconds, shutting down...\00"
@str.24 = [32 x i8] c"Shutdown apparently successful.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @WSQ_Init(i8* getelementptr inbounds ([21 x i8], [21 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 @WSQ_BeginTransaction(i32 99)
%6 = tail call i32 @WSQ_BeginSubgraph(i32 11)
%7 = tail call i32 @WSQ_AddOp(i32 1, 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* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 @WSQ_AddOp(i32 2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, 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.7, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%9 = tail call i32 @WSQ_AddOp(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, 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.9, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%10 = tail call i32 @WSQ_AddOp(i32 4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0))
%11 = tail call i32 @WSQ_AddOp(i32 5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
%12 = tail call i32 @WSQ_AddOp(i32 6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, 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.19, i64 0, i64 0))
%13 = tail call i32 @WSQ_AddOp(i32 7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, 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.20, i64 0, i64 0))
%14 = tail call i32 @WSQ_AddOp(i32 8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0))
%15 = tail call i32 (...) @WSQ_EndSubgraph()
%16 = tail call i32 (...) @WSQ_EndTransaction()
%17 = tail call i32 @sleep(i32 2)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 (...) @WSQ_Shutdown()
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.24, i64 0, i64 0))
ret i32 0
}