#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_putchar(int /*<<< orphan*/);
void ft_putstr(const char *str) {
  if (str) {
    while (*str)
      ft_putchar(*str++);
  } else
    ft_putstr("(null)");
}


x86 assembly (clang, -O0):
<ft_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116a <ft_putstr+0x4a>
jmp    113c <ft_putstr+0x1c>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1165 <ft_putstr+0x45>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
jmp    113c <ft_putstr+0x1c>
jmp    1176 <ft_putstr+0x56>
lea    0xe8f(%rip),%rdi
call   1040 <ft_putstr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr>:
push   %rbx
test   %rdi,%rdi
je     1145 <ft_putstr+0x35>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1143 <ft_putstr+0x33>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <ft_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <ft_putstr+0x20>
pop    %rbx
ret
mov    $0x28,%edi
call   1030 <ft_putchar@plt>
mov    $0x6e,%edi
call   1030 <ft_putchar@plt>
mov    $0x75,%edi
call   1030 <ft_putchar@plt>
mov    $0x6c,%edi
call   1030 <ft_putchar@plt>
mov    $0x6c,%edi
call   1030 <ft_putchar@plt>
mov    $0x29,%edi
pop    %rbx
jmp    1030 <ft_putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"(null)\00"
define void @ft_putstr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %17
5: ; preds = %1
br label %6
6: ; preds = %10, %5
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = call i32 @ft_putchar(i32 %14)
br label %6
16: ; preds = %6
br label %18
17: ; preds = %1
br label %18
18: ; preds = %17, %16
ret void
}

LLVM IR (-O2):
define void @ft_putstr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %10
3: ; preds = %1
%4 = tail call i32 @ft_putchar(i32 40)
%5 = tail call i32 @ft_putchar(i32 110)
%6 = tail call i32 @ft_putchar(i32 117)
%7 = tail call i32 @ft_putchar(i32 108)
%8 = tail call i32 @ft_putchar(i32 108)
%9 = tail call i32 @ft_putchar(i32 41)
br label %21
10: ; preds = %1
%11 = load i8, i8* %0
%12 = icmp eq i8 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %10, %13
%14 = phi i8 [ %19, %13 ], [ %11, %10 ]
%15 = phi i8* [ %16, %13 ], [ %0, %10 ]
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = sext i8 %14 to i32
%18 = tail call i32 @ft_putchar(i32 %17)
%19 = load i8, i8* %16
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %13
21: ; preds = %13, %3, %10
ret void
}