#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*/ fill_string(char *, int, char);
int /*<<< orphan*/ strcat(char *, char *);
void add_indents(char *line, int spaces) {
  int i, result = 0;
  char temp[100];
  fill_string(temp, 100, '\0');
  for (i = 0; i < spaces * 2; i++)
    temp[i] = ' ';
  strcat(temp, line);
  for (i = 0; i < 100; i++)
    line[i] = temp[i];
}


x86 assembly (clang, -O0):
<add_indents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
xor    %edx,%edx
call   1030 <fill_string@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    1178 <add_indents+0x58>
movslq -0x10(%rbp),%rax
movb   $0x20,-0x80(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1150 <add_indents+0x30>
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcat@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    11b7 <add_indents+0x97>
movslq -0x10(%rbp),%rax
mov    -0x80(%rbp,%rax,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118c <add_indents+0x6c>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_indents>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    $0x64,%esi
xor    %edx,%edx
call   1040 <fill_string@plt>
test   %ebp,%ebp
jle    1168 <add_indents+0x38>
add    %ebp,%ebp
cmp    $0x2,%ebp
mov    $0x1,%edx
cmovge %ebp,%edx
mov    %rsp,%rdi
mov    $0x20,%esi
call   1030 <memset@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
movaps (%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movaps 0x20(%rsp),%xmm2
movaps 0x30(%rsp),%xmm3
movups %xmm0,(%rbx)
movups %xmm1,0x10(%rbx)
movups %xmm2,0x20(%rbx)
movups %xmm3,0x30(%rbx)
movaps 0x40(%rsp),%xmm0
movups %xmm0,0x40(%rbx)
movaps 0x50(%rsp),%xmm0
movups %xmm0,0x50(%rbx)
mov    0x60(%rsp),%eax
mov    %eax,0x60(%rbx)
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @add_indents(i8* %0, i32 %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i32 @fill_string(i8* %5, i32 100, i8 signext 0)
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = shl nuw i32 %1, 1
%10 = call i32 @llvm.smax.i32(i32 %9, i32 1)
%11 = zext i32 %10 to i64
br label %12
12: ; preds = %8, %2
%13 = call i32 @strcat(i8* %5, i8* %0)
ret void
}