#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void fPrintSpaces(FILE *file, int spaces) {
  if (spaces > 0) {
    char string[spaces * 2 + 1];
    for (int i = 0; i < spaces * 2; i++) {
      string[i] = ' ';
    }
    string[spaces * 2] = '\0';
    fprintf(file, "%s + ", string);
  } else {
    fprintf(file, " + ");
  }
}


x86 assembly (clang, -O0):
<fPrintSpaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11b5 <fPrintSpaces+0xa5>
mov    -0xc(%rbp),%ecx
mov    %ecx,%eax
lea    0x1(%rax,%rax,1),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    1187 <fPrintSpaces+0x77>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115c <fPrintSpaces+0x4c>
mov    -0x30(%rbp),%rdx
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
movb   $0x0,(%rdx,%rax,1)
mov    -0x8(%rbp),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
jmp    11c7 <fPrintSpaces+0xb7>
mov    -0x8(%rbp),%rdi
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fPrintSpaces>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    11a7 <fPrintSpaces+0x77>
mov    %rsp,%r15
mov    %esi,%r12d
add    %esi,%r12d
lea    (%rsi,%rsi,1),%eax
add    $0x1,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x2,%r12d
mov    $0x1,%edx
cmovge %r12d,%edx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <memset@plt>
movslq %r12d,%rax
movb   $0x0,(%rax,%rbx,1)
lea    0xe76(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r15,%rsp
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe54(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fwrite@plt>

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

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