#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*/ ft_write_to_file(int, char *);
int /*<<< orphan*/ write(int, char *, int);
void ft_write_line(int fd, char *str, int indent) {
  while (indent > 0) {
    write(fd, "\t", 1);
    indent--;
  }
  ft_write_to_file(fd, str);
  write(fd, "\n", 1);
}


x86 assembly (clang, -O0):
<ft_write_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    115e <ft_write_line+0x3e>
mov    -0x4(%rbp),%edi
lea    0xeba(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1132 <ft_write_line+0x12>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <ft_write_to_file@plt>
mov    -0x4(%rbp),%edi
lea    0xe8e(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_write_line>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
test   %edx,%edx
jle    1157 <ft_write_line+0x37>
mov    %edx,%ebp
add    $0x1,%ebp
lea    0xec4(%rip),%r15
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1140 <ft_write_line+0x20>
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <ft_write_to_file@plt>
lea    0xe9a(%rip),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\09\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @ft_write_line(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %7
7: ; preds = %10, %3
%8 = load i32, i32* %6
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i32, i32* %4
%12 = call i32 @write(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%13 = load i32, i32* %6
%14 = add nsw i32 %13, -1
store i32 %14, i32* %6
br label %7
15: ; preds = %7
%16 = load i32, i32* %4
%17 = load i8*, i8** %5
%18 = call i32 @ft_write_to_file(i32 %16, i8* %17)
%19 = load i32, i32* %4
%20 = call i32 @write(i32 %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\09\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @ft_write_line(i32 %0, i8* %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %10
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ %2, %3 ]
%7 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%8 = add nsw i32 %6, -1
%9 = icmp ugt i32 %6, 1
br i1 %9, label %5, label %10
10: ; preds = %5, %3
%11 = tail call i32 @ft_write_to_file(i32 %0, i8* %1)
%12 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
ret void
}