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

/* Variables and functions */
int /*<<< orphan*/ print_tree_internal(struct bplus const *, int, int);
int /*<<< orphan*/ print_tree_leaf(struct bplus const *, int);
int /*<<< orphan*/ printf(char *, ...);
void print_tree_1(const struct bplus *tree, int nodeid, int level) {
  int i;
  for (i = 0; i < level; i++)
    printf("   ");
  printf("%6d: ", nodeid);
  if (nodeid > 0)
    print_tree_internal(tree, nodeid, level);
  else
    print_tree_leaf(tree, nodeid);
}


x86 assembly (clang, -O0):
<print_tree_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1171 <print_tree_1+0x41>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <print_tree_1+0x19>
mov    -0xc(%rbp),%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    11a0 <print_tree_1+0x70>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <print_tree_internal@plt>
jmp    11ac <print_tree_1+0x7c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <print_tree_leaf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tree_1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%r14
test   %edx,%edx
jle    115f <print_tree_1+0x2f>
lea    0xeb4(%rip),%rbp
mov    %r15d,%ebx
nop
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jne    1150 <print_tree_1+0x20>
lea    0xe9e(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r12d,%esi
test   %r12d,%r12d
jle    118b <print_tree_1+0x5b>
mov    %r15d,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <print_tree_internal@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <print_tree_leaf@plt>

LLVM IR (-O0):
%struct.bplus = type { i32 }
@.str = [4 x i8] c" \00"
@.str.1 = [6 x i8] c"%6d: \00"
define void @print_tree_1(%struct.bplus* %0, i32 %1, i32 %2) {
%4 = alloca %struct.bplus*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store %struct.bplus* %0, %struct.bplus** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %14, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
br label %8
17: ; preds = %8
%18 = load i32, i32* %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %5
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = load %struct.bplus*, %struct.bplus** %4
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = call i32 @print_tree_internal(%struct.bplus* %23, i32 %24, i32 %25)
br label %31
27: ; preds = %17
%28 = load %struct.bplus*, %struct.bplus** %4
%29 = load i32, i32* %5
%30 = call i32 @print_tree_leaf(%struct.bplus* %28, i32 %29)
br label %31
31: ; preds = %27, %22
ret void
}

LLVM IR (-O2):
%struct.bplus = type { i32 }
@.str = [4 x i8] c" \00"
@.str.1 = [6 x i8] c"%6d: \00"
define void @print_tree_1(%struct.bplus* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %10
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ 0, %3 ]
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, %2
br i1 %9, label %10, label %5
10: ; preds = %5, %3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%12 = icmp sgt i32 %1, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @print_tree_internal(%struct.bplus* %0, i32 %1, i32 %2)
br label %17
15: ; preds = %10
%16 = tail call i32 @print_tree_leaf(%struct.bplus* %0, i32 %1)
br label %17
17: ; preds = %15, %13
ret void
}