#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*/ atoi(char *);
int /*<<< orphan*/ k_tree_gen(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("Usage: k-tree tree_depth tree_width\n");
    return 1;
  }
  printf("Generate k tree (depth: %s, width: %s) ...\n", argv[1], argv[2]);
  k_tree_gen(atoi(argv[1]), atoi(argv[2]));
  printf("Generate k tree (depth: %s, width: %s), done\n", argv[1], argv[2]);
  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)
jge    116a <main+0x3a>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d4 <main+0xa4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1050 <k_tree_gen@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jg     115c <main+0x1c>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
jmp    11ac <main+0x6c>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
mov    0x10(%rbx),%rdx
lea    0xe92(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1060 <k_tree_gen@plt>
mov    0x8(%rbx),%rsi
mov    0x10(%rbx),%rdx
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Usage: k-tree tree_depth tree_width\0A\00"
@.str.1 = [44 x i8] c"Generate k tree (depth: %s, width: %s) ...\0A\00"
@.str.2 = [46 x i8] c"Generate k tree (depth: %s, width: %s), done\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 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %34
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %16)
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
%26 = call i32 @k_tree_gen(i32 %21, i32 %25)
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %29, i8* %32)
store i32 0, i32* %3
br label %34
34: ; preds = %10, %8
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str.1 = [44 x i8] c"Generate k tree (depth: %s, width: %s) ...\0A\00"
@.str.2 = [46 x i8] c"Generate k tree (depth: %s, width: %s), done\0A\00"
@str = [36 x i8] c"Usage: k-tree tree_depth tree_width\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %20
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* %10)
%12 = load i8*, i8** %7
%13 = tail call i32 @atoi(i8* %12)
%14 = load i8*, i8** %9
%15 = tail call i32 @atoi(i8* %14)
%16 = tail call i32 @k_tree_gen(i32 %13, i32 %15)
%17 = load i8*, i8** %7
%18 = load i8*, i8** %9
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %18)
br label %20
20: ; preds = %6, %4
%21 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %21
}