#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 TreeNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ dump(struct TreeNode *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
struct TreeNode **generateTrees(int /*<<< orphan*/, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "Usage: ./test n\n");
    exit(-1);
  }
  int i, count = 0;
  struct TreeNode **results = generateTrees(atoi(argv[1]), &count);
  for (i = 0; i < count; i++) {
    dump(results[i]);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     119f <main+0x3f>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
lea    -0x18(%rbp),%rsi
call   1060 <generateTrees@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1200 <main+0xa0>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <dump@plt>
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c9 <main+0x69>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11cb <main+0x6b>
movl   $0x0,0x4(%rsp)
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
lea    0x4(%rsp),%rsi
mov    %eax,%edi
call   1060 <generateTrees@plt>
cmpl   $0x0,0x4(%rsp)
jle    11c1 <main+0x61>
mov    %rax,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1040 <dump@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     11a0 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe25(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
@stderr = global i32 0
@.str = [17 x i8] c"Usage: ./test n\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.TreeNode**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
store i32 0, i32* %7
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
%20 = call %struct.TreeNode** @generateTrees(i32 %19, i32* %7)
store %struct.TreeNode** %20, %struct.TreeNode*** %8
store i32 0, i32* %6
br label %21
21: ; preds = %33, %15
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %36
25: ; preds = %21
%26 = load %struct.TreeNode**, %struct.TreeNode*** %8
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds %struct.TreeNode*, %struct.TreeNode** %26, i64 %28
%30 = load %struct.TreeNode*, %struct.TreeNode** %29
%31 = call i32 @dump(%struct.TreeNode* %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %25
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %21
36: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
@stderr = global i32 0
@.str = [17 x i8] c"Usage: ./test n\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
%10 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = call %struct.TreeNode** @generateTrees(i32 %13, i32* %3)
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %9, %17
%18 = phi i64 [ %23, %17 ], [ 0, %9 ]
%19 = getelementptr inbounds %struct.TreeNode*, %struct.TreeNode** %14, i64 %18
%20 = load %struct.TreeNode*, %struct.TreeNode** %19
%21 = call i32 @dump(%struct.TreeNode* %20)
%22 = call i32 @putchar(i32 10)
%23 = add nuw nsw i64 %18, 1
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = icmp slt i64 %23, %25
br i1 %26, label %17, label %27
27: ; preds = %17, %9
ret i32 0
}