#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 add_string(char **, size_t *, int *, char *);
int add_indent(char **dest, size_t *dest_size, int *current_offset, int depth) {
  int i, chars = 0;
  for (i = 0; i < depth; i++) {
    int c = add_string(dest, dest_size, current_offset, "\t");
    if (c < 0)
      return c;
    chars += c;
  }
  return chars;
}


x86 assembly (clang, -O0):
<add_indent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1188 <add_indent+0x78>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xeac(%rip),%rcx
call   1030 <add_string@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    1171 <add_indent+0x61>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118e <add_indent+0x7e>
mov    -0x30(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1135 <add_indent+0x25>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_indent>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %ecx,%ecx
jle    115e <add_indent+0x4e>
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebp,%ebp
lea    0xecd(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %r13,%rcx
call   1030 <add_string@plt>
test   %eax,%eax
js     1162 <add_indent+0x52>
add    %eax,%ebp
add    $0xffffffff,%ebx
jne    1140 <add_indent+0x30>
jmp    1164 <add_indent+0x54>
xor    %ebp,%ebp
jmp    1164 <add_indent+0x54>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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