#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 */
struct buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bprintf(struct buffer *, char *, char *);
void indent(struct buffer *b, size_t amount) {
  size_t spaces = amount * 4;
  char temp[spaces + 1];
  for (size_t i = 0; i < spaces; ++i)
    temp[i] = ' ';
  temp[spaces] = '\0';
  bprintf(b, "%s", temp);
}


x86 assembly (clang, -O0):
<indent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    %rdx,%rax
add    $0x1,%rax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
add    $0x10,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    118a <indent+0x7a>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    115f <indent+0x4f>
mov    -0x38(%rbp),%rdx
mov    -0x18(%rbp),%rax
movb   $0x0,(%rdx,%rax,1)
mov    -0x8(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1030 <bprintf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indent>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,%rbx
lea    0x10(,%rsi,4),%rax
shl    $0x2,%r15
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
test   %r15,%r15
je     115e <indent+0x3e>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %r15,%rdx
call   1040 <memset@plt>
movb   $0x0,(%rbx,%r15,1)
lea    0xe96(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1030 <bprintf@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.buffer = type { i32 }
@.str = [3 x i8] c"%s\00"
define void @indent(%struct.buffer* %0, i64 %1) {
%3 = alloca %struct.buffer*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store %struct.buffer* %0, %struct.buffer** %3
store i64 %1, i64* %4
%9 = load i64, i64* %4
%10 = mul i64 %9, 4
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = add i64 %11, 1
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %6
%14 = alloca i8, i64 %12
store i64 %12, i64* %7
store i64 0, i64* %8
br label %15
15: ; preds = %22, %2
%16 = load i64, i64* %8
%17 = load i64, i64* %5
%18 = icmp ult i64 %16, %17
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = load i64, i64* %8
%21 = getelementptr inbounds i8, i8* %14, i64 %20
store i8 32, i8* %21
br label %22
22: ; preds = %19
%23 = load i64, i64* %8
%24 = add i64 %23, 1
store i64 %24, i64* %8
br label %15
25: ; preds = %15
%26 = load i64, i64* %5
%27 = getelementptr inbounds i8, i8* %14, i64 %26
store i8 0, i8* %27
%28 = load %struct.buffer*, %struct.buffer** %3
%29 = call i32 @bprintf(%struct.buffer* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%30 = load i8*, i8** %6
ret void
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
@.str = [3 x i8] c"%s\00"
define void @indent(%struct.buffer* %0, i64 %1) {
%3 = shl i64 %1, 2
%4 = or i64 %3, 1
%5 = alloca i8, i64 %4
%6 = icmp eq i64 %3, 0
br i1 %6, label %8, label %7
7: ; preds = %2
br label %8
8: ; preds = %7, %2
%9 = getelementptr inbounds i8, i8* %5, i64 %3
store i8 0, i8* %9
%10 = call i32 @bprintf(%struct.buffer* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}