#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*/ printbuffer(char *);
void printspaces(int trace, int depth) {
  int j;
  for (j = 0; j < depth; j++)
    printbuffer("    ");
  switch (trace) {
  case 1:
    if (depth)
      printbuffer("   ");
    else
      printbuffer("       ");
    break;
  case 2:
    if (!depth)
      printbuffer("    ");
    break;
  case 3:
    if (!depth)
      printbuffer("\n    ");
    break;
  }
}


x86 assembly (clang, -O0):
<printspaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114b <printspaces+0x3b>
lea    0xed1(%rip),%rdi
call   1030 <printbuffer@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <printspaces+0x15>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1181 <printspaces+0x71>
jmp    115f <printspaces+0x4f>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11ad <printspaces+0x9d>
jmp    1170 <printspaces+0x60>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     11c8 <printspaces+0xb8>
jmp    11e3 <printspaces+0xd3>
cmpl   $0x0,-0x8(%rbp)
je     119c <printspaces+0x8c>
lea    0xe78(%rip),%rdi
call   1030 <printbuffer@plt>
jmp    11a8 <printspaces+0x98>
lea    0xe5d(%rip),%rdi
call   1030 <printbuffer@plt>
jmp    11e3 <printspaces+0xd3>
cmpl   $0x0,-0x8(%rbp)
jne    11c3 <printspaces+0xb3>
lea    0xe4b(%rip),%rdi
call   1030 <printbuffer@plt>
jmp    11e3 <printspaces+0xd3>
cmpl   $0x0,-0x8(%rbp)
jne    11de <printspaces+0xce>
lea    0xe2f(%rip),%rdi
call   1030 <printbuffer@plt>
jmp    11e3 <printspaces+0xd3>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printspaces>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%r15d
test   %esi,%esi
jle    113d <printspaces+0x2d>
lea    0xee1(%rip),%rbx
mov    %r14d,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printbuffer@plt>
add    $0xffffffff,%ebp
jne    1130 <printspaces+0x20>
cmp    $0x3,%r15d
je     1166 <printspaces+0x56>
cmp    $0x2,%r15d
je     1174 <printspaces+0x64>
cmp    $0x1,%r15d
jne    1179 <printspaces+0x69>
test   %r14d,%r14d
lea    0xea7(%rip),%rax
lea    0xeaa(%rip),%rdi
cmove  %rax,%rdi
jmp    118b <printspaces+0x7b>
test   %r14d,%r14d
jne    1179 <printspaces+0x69>
lea    0xe96(%rip),%rdi
jmp    118b <printspaces+0x7b>
test   %r14d,%r14d
je     1184 <printspaces+0x74>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7e(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printbuffer@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
@.str.1 = [4 x i8] c" \00"
@.str.2 = [8 x i8] c" \00"
@.str.3 = [6 x i8] c"\0A \00"
define void @printspaces(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %12, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = call i32 @printbuffer(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
br label %6
15: ; preds = %6
%16 = load i32, i32* %3
switch i32 %16, label %37 [
i32 1, label %17
i32 2, label %25
i32 3, label %31
]
17: ; preds = %15
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printbuffer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %24
22: ; preds = %17
%23 = call i32 @printbuffer(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
br label %37
25: ; preds = %15
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = call i32 @printbuffer(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %25
br label %37
31: ; preds = %15
%32 = load i32, i32* %4
%33 = icmp ne i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
%35 = call i32 @printbuffer(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
br label %37
37: ; preds = %15, %36, %30, %24
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
@.str.1 = [4 x i8] c" \00"
@.str.2 = [8 x i8] c" \00"
@.str.3 = [6 x i8] c"\0A \00"
define void @printspaces(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @printbuffer(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
switch i32 %0, label %20 [
i32 1, label %10
i32 2, label %13
i32 3, label %15
]
10: ; preds = %9
%11 = icmp eq i32 %1, 0
%12 = select i1 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
br label %17
13: ; preds = %9
%14 = icmp eq i32 %1, 0
br i1 %14, label %17, label %20
15: ; preds = %9
%16 = icmp eq i32 %1, 0
br i1 %16, label %17, label %20
17: ; preds = %15, %13, %10
%18 = phi i8* [ %12, %10 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %13 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %15 ]
%19 = tail call i32 @printbuffer(i8* %18)
br label %20
20: ; preds = %17, %15, %13, %9
ret void
}