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

/* Variables and functions */
struct node *makeMinimalBST(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printTree(struct node *);
int /*<<< orphan*/ printf(char *);
int main(int argc, const char *argv[]) {
  int numberOfNodes = 15;
  int nodes[numberOfNodes];
  for (int i = 0; i < numberOfNodes; i++) {
    nodes[i] = i + 1;
  }
  struct node *minimalBst = makeMinimalBST(nodes, 0, numberOfNodes - 1);
  printf("In-order traversal printing (left branch, current node, and right "
         "branch):\n");
  printTree(minimalBst);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xf,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a6 <main+0x76>
mov    -0x40(%rbp),%rax
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117b <main+0x4b>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1050 <makeMinimalBST@plt>
mov    %rax,-0x38(%rbp)
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <printTree@plt>
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movabs $0xe0000000d,%rax
mov    %rax,0x30(%rsp)
movl   $0xf,0x38(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xe,%edx
call   1060 <makeMinimalBST@plt>
mov    %rax,%rbx
lea    0xe98(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <printTree@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [76 x i8] c"In-order traversal printing (left branch, current node, and right branch):\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 i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca %struct.node*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 15, i32* %6
%11 = load i32, i32* %6
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %7
%14 = alloca i32, i64 %12
store i64 %12, i64* %8
store i32 0, i32* %9
br label %15
15: ; preds = %25, %2
%16 = load i32, i32* %9
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i32, i32* %9
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %14, i64 %23
store i32 %21, i32* %24
br label %25
25: ; preds = %19
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %15
28: ; preds = %15
%29 = load i32, i32* %6
%30 = sub nsw i32 %29, 1
%31 = call %struct.node* @makeMinimalBST(i32* %14, i32 0, i32 %30)
store %struct.node* %31, %struct.node** %10
%32 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%33 = load %struct.node*, %struct.node** %10
%34 = call i32 @printTree(%struct.node* %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
%36 = load i8*, i8** %7
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
%struct.node = type { i32 }
@str = [75 x i8] c"In-order traversal printing (left branch, current node, and right branch):\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [15 x i32]
%4 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 0
%5 = bitcast [15 x i32]* %3 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %5
%6 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 4
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %7
%8 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 8
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, <4 x i32>* %9
%10 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 12
store i32 13, i32* %10
%11 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 13
store i32 14, i32* %11
%12 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 14
store i32 15, i32* %12
%13 = call %struct.node* @makeMinimalBST(i32* %4, i32 0, i32 14)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str, i64 0, i64 0))
%15 = call i32 @printTree(%struct.node* %13)
%16 = call i32 @putchar(i32 10)
ret i32 0
}