#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 *, ...);
void printSpaces(int spaces) {
  if (spaces > 0) {
    char string[spaces * 2 + 1];
    for (int i = 0; i < spaces * 2; i++) {
      string[i] = ' ';
    }
    string[spaces * 2] = '\0';
    printf("%s + ", string);
  } else {
    printf(" + ");
  }
}


x86 assembly (clang, -O0):
<printSpaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    11ad <printSpaces+0x9d>
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
lea    0x1(%rax,%rax,1),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    1183 <printSpaces+0x73>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1158 <printSpaces+0x48>
mov    -0x28(%rbp),%rsi
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cltq
movb   $0x0,(%rsi,%rax,1)
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
jmp    11bb <printSpaces+0xab>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSpaces>:
test   %edi,%edi
jle    118e <printSpaces+0x6e>
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsp,%r14
mov    %edi,%r15d
add    %edi,%r15d
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x2,%r15d
mov    $0x1,%edx
cmovge %r15d,%edx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1040 <memset@plt>
movslq %r15d,%rax
movb   $0x0,(%rax,%rbx,1)
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rsp
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%s + \00"
@.str.1 = [4 x i8] c" + \00"
define void @printSpaces(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %14
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = or i32 %4, 1
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = call i32 @llvm.smax.i32(i32 %4, i32 1)
%10 = zext i32 %9 to i64
%11 = sext i32 %4 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
store i8 0, i8* %12
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %16
14: ; preds = %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
ret void
}