#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int ft_putendl(char *);
int ft_putchar2(char **str) {
  size_t i;
  int ret;
  i = 0;
  ret = EXIT_SUCCESS;
  while (str[i])
    ret = ft_putendl(str[i++]) == EXIT_SUCCESS ? ret : EXIT_FAILURE;
  return (ret);
}


x86 assembly (clang, -O0):
<ft_putchar2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1190 <ft_putchar2+0x80>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    (%rax,%rcx,8),%rdi
call   1030 <ft_putendl@plt>
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%eax
jne    1179 <ft_putchar2+0x69>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1185 <ft_putchar2+0x75>
mov    0x2e60(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <ft_putchar2+0x20>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putchar2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb7(%rip),%r14
mov    (%r14),%ebp
mov    (%rdi),%rdi
test   %rdi,%rdi
je     115b <ft_putchar2+0x4b>
add    $0x8,%rbx
mov    0x2ea9(%rip),%r15
jmp    114c <ft_putchar2+0x3c>
nopl   0x0(%rax)
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     115b <ft_putchar2+0x4b>
call   1030 <ft_putendl@plt>
cmp    (%r14),%eax
je     1140 <ft_putchar2+0x30>
mov    (%r15),%ebp
jmp    1140 <ft_putchar2+0x30>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @ft_putchar2(i8** %0) {
%2 = alloca i8**
%3 = alloca i64
%4 = alloca i32
store i8** %0, i8*** %2
store i64 0, i64* %3
%5 = load i32, i32* @EXIT_SUCCESS
store i32 %5, i32* %4
br label %6
6: ; preds = %25, %1
%7 = load i8**, i8*** %2
%8 = load i64, i64* %3
%9 = getelementptr inbounds i8*, i8** %7, i64 %8
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %27
12: ; preds = %6
%13 = load i8**, i8*** %2
%14 = load i64, i64* %3
%15 = add i64 %14, 1
store i64 %15, i64* %3
%16 = getelementptr inbounds i8*, i8** %13, i64 %14
%17 = load i8*, i8** %16
%18 = call i32 @ft_putendl(i8* %17)
%19 = load i32, i32* @EXIT_SUCCESS
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = load i32, i32* %4
br label %25
23: ; preds = %12
%24 = load i32, i32* @EXIT_FAILURE
br label %25
25: ; preds = %23, %21
%26 = phi i32 [ %22, %21 ], [ %24, %23 ]
store i32 %26, i32* %4
br label %6
27: ; preds = %6
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @ft_putchar2(i8** nocapture %0) {
%2 = load i32, i32* @EXIT_SUCCESS
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %18, label %5
5: ; preds = %1, %5
%6 = phi i8* [ %16, %5 ], [ %3, %1 ]
%7 = phi i32 [ %14, %5 ], [ %2, %1 ]
%8 = phi i64 [ %9, %5 ], [ 0, %1 ]
%9 = add i64 %8, 1
%10 = tail call i32 @ft_putendl(i8* %6)
%11 = load i32, i32* @EXIT_SUCCESS
%12 = icmp eq i32 %10, %11
%13 = load i32, i32* @EXIT_FAILURE
%14 = select i1 %12, i32 %7, i32 %13
%15 = getelementptr inbounds i8*, i8** %0, i64 %9
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %5
18: ; preds = %5, %1
%19 = phi i32 [ %2, %1 ], [ %14, %5 ]
ret i32 %19
}