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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
long atol(char *);
struct movement_bintree *compute_tree(struct movement_bintree *, unsigned long);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ traverse_tree(struct movement_bintree *);
int main(int argc, char **argv) {
  struct movement_bintree *root = NULL;
  if (argc > 1) {
    long i = atol(argv[1]);
    if (i < 0) {
      exit(EXIT_FAILURE);
    }
    root = compute_tree(root, (unsigned long)i);
    traverse_tree(root);
    exit(EXIT_SUCCESS);
  }
  exit(EXIT_FAILURE);
}


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)
movq   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11ba <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1192 <main+0x52>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <compute_tree@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <traverse_tree@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     1154 <main+0x14>
mov    0x8(%rsi),%rdi
call   1050 <atol@plt>
test   %rax,%rax
jns    1162 <main+0x22>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
xor    %edi,%edi
mov    %rax,%rsi
call   1030 <compute_tree@plt>
mov    %rax,%rdi
call   1040 <traverse_tree@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.movement_bintree = type { i32 }
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.movement_bintree*
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.movement_bintree* null, %struct.movement_bintree** %6
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %28
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @atol(i8* %13)
store i64 %14, i64* %7
%15 = load i64, i64* %7
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %10
%21 = load %struct.movement_bintree*, %struct.movement_bintree** %6
%22 = load i64, i64* %7
%23 = call %struct.movement_bintree* @compute_tree(%struct.movement_bintree* %21, i64 %22)
store %struct.movement_bintree* %23, %struct.movement_bintree** %6
%24 = load %struct.movement_bintree*, %struct.movement_bintree** %6
%25 = call i32 @traverse_tree(%struct.movement_bintree* %24)
%26 = load i32, i32* @EXIT_SUCCESS
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %2
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
}

LLVM IR (-O2):
%struct.movement_bintree = type { i32 }
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @atol(i8* %6)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %4
%13 = tail call %struct.movement_bintree* @compute_tree(%struct.movement_bintree* null, i64 %7)
%14 = tail call i32 @traverse_tree(%struct.movement_bintree* %13)
%15 = load i32, i32* @EXIT_SUCCESS
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
}