#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*/ printf(char *, int);
int print_depth(int thread_id, int cur_depth) {
  if (thread_id == 0)
    printf("%2d|  |  |  |  |  |  |  \n", cur_depth);
  if (thread_id == 1)
    printf("  |%2d|  |  |  |  |  |  \n", cur_depth);
  if (thread_id == 2)
    printf("  |  |%2d|  |  |  |  |  \n", cur_depth);
  if (thread_id == 3)
    printf("  |  |  |%2d|  |  |  |  \n", cur_depth);
  if (thread_id == 4)
    printf("  |  |  |  |%2d|  |  |  \n", cur_depth);
  if (thread_id == 5)
    printf("  |  |  |  |  |%2d|  |  \n", cur_depth);
  if (thread_id == 6)
    printf("  |  |  |  |  |  |%2d|  \n", cur_depth);
  if (thread_id == 7)
    printf("  |  |  |  |  |  |  |%2d\n", cur_depth);
  return 1;
}


x86 assembly (clang, -O0):
<print_depth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1137 <print_depth+0x27>
mov    -0x8(%rbp),%esi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1150 <print_depth+0x40>
mov    -0x8(%rbp),%esi
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x4(%rbp)
jne    1169 <print_depth+0x59>
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x3,-0x4(%rbp)
jne    1182 <print_depth+0x72>
mov    -0x8(%rbp),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x4,-0x4(%rbp)
jne    119b <print_depth+0x8b>
mov    -0x8(%rbp),%esi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x5,-0x4(%rbp)
jne    11b4 <print_depth+0xa4>
mov    -0x8(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x6,-0x4(%rbp)
jne    11cd <print_depth+0xbd>
mov    -0x8(%rbp),%esi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x7,-0x4(%rbp)
jne    11e6 <print_depth+0xd6>
mov    -0x8(%rbp),%esi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_depth>:
cmp    $0x7,%edi
ja     1130 <print_depth+0x20>
push   %rax
movslq %edi,%rax
lea    0xfb0(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <printf@plt>
add    $0x8,%rsp
mov    $0x1,%eax
ret

LLVM IR (-O0):
@.str = [26 x i8] c"%2d| | | | | | | \0A\00"
@.str.1 = [26 x i8] c" |%2d| | | | | | \0A\00"
@.str.2 = [26 x i8] c" | |%2d| | | | | \0A\00"
@.str.3 = [26 x i8] c" | | |%2d| | | | \0A\00"
@.str.4 = [26 x i8] c" | | | |%2d| | | \0A\00"
@.str.5 = [26 x i8] c" | | | | |%2d| | \0A\00"
@.str.6 = [26 x i8] c" | | | | | |%2d| \0A\00"
@.str.7 = [26 x i8] c" | | | | | | |%2d\0A\00"
define i32 @print_depth(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %7, %2
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %10
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19, %16
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %4
%27 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %22
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 4
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* %4
%33 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %28
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 5
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %4
%39 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %37, %34
%41 = load i32, i32* %3
%42 = icmp eq i32 %41, 6
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i32, i32* %4
%45 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %43, %40
%47 = load i32, i32* %3
%48 = icmp eq i32 %47, 7
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i32, i32* %4
%51 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %49, %46
ret i32 1
}

LLVM IR (-O2):
@.str = [26 x i8] c"%2d| | | | | | | \0A\00"
@.str.1 = [26 x i8] c" |%2d| | | | | | \0A\00"
@.str.2 = [26 x i8] c" | |%2d| | | | | \0A\00"
@.str.3 = [26 x i8] c" | | |%2d| | | | \0A\00"
@.str.4 = [26 x i8] c" | | | |%2d| | | \0A\00"
@.str.5 = [26 x i8] c" | | | | |%2d| | \0A\00"
@.str.6 = [26 x i8] c" | | | | | |%2d| \0A\00"
@.str.7 = [26 x i8] c" | | | | | | |%2d\0A\00"
@reltable.print_depth = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.print_depth to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_depth to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_depth to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_depth to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_depth to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_depth to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_depth to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.7 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_depth to i64)) to i32)]
define i32 @print_depth(i32 %0, i32 %1) {
%3 = icmp ult i32 %0, 8
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = sext i32 %0 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.print_depth to i8*), i64 %6)
%8 = tail call i32 @printf(i8* %7, i32 %1)
br label %9
9: ; preds = %2, %4
ret i32 1
}