#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_strdel(char **);
char *ft_strdup(char *);
scalar_t__ ft_strlen(char *);
int eof_exit(char **line_copy, char **buffer, char **line) {
  if (ft_strlen(*line_copy)) {
    if (!(*line = ft_strdup(*line_copy)))
      return (-1);
    ft_strdel(line_copy);
    ft_strdel(buffer);
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<eof_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <ft_strlen@plt>
cmp    $0x0,%rax
je     11a1 <eof_exit+0x71>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <ft_strdup@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1183 <eof_exit+0x53>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a8 <eof_exit+0x78>
mov    -0x10(%rbp),%rdi
call   1040 <ft_strdel@plt>
mov    -0x18(%rbp),%rdi
call   1040 <ft_strdel@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a8 <eof_exit+0x78>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eof_exit>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <ft_strlen@plt>
test   %rax,%rax
je     1172 <eof_exit+0x42>
mov    (%rbx),%rdi
call   1050 <ft_strdup@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     1176 <eof_exit+0x46>
mov    %rbx,%rdi
call   1040 <ft_strdel@plt>
mov    %r14,%rdi
call   1040 <ft_strdel@plt>
mov    $0x1,%eax
jmp    117b <eof_exit+0x4b>
xor    %eax,%eax
jmp    117b <eof_exit+0x4b>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @eof_exit(i8** %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8**
store i8** %0, i8*** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = load i8**, i8*** %5
%9 = load i8*, i8** %8
%10 = call i64 @ft_strlen(i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %3
%13 = load i8**, i8*** %5
%14 = load i8*, i8** %13
%15 = call i8* @ft_strdup(i8* %14)
%16 = load i8**, i8*** %7
store i8* %15, i8** %16
%17 = icmp ne i8* %15, null
br i1 %17, label %19, label %18
18: ; preds = %12
store i32 -1, i32* %4
br label %25
19: ; preds = %12
%20 = load i8**, i8*** %5
%21 = call i32 @ft_strdel(i8** %20)
%22 = load i8**, i8*** %6
%23 = call i32 @ft_strdel(i8** %22)
store i32 1, i32* %4
br label %25
24: ; preds = %3
store i32 0, i32* %4
br label %25
25: ; preds = %24, %19, %18
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @eof_exit(i8** %0, i8** %1, i8** nocapture writeonly %2) {
%4 = load i8*, i8** %0
%5 = tail call i64 @ft_strlen(i8* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %3
%8 = load i8*, i8** %0
%9 = tail call i8* @ft_strdup(i8* %8)
store i8* %9, i8** %2
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = tail call i32 @ft_strdel(i8** %0)
%13 = tail call i32 @ft_strdel(i8** %1)
br label %14
14: ; preds = %3, %7, %11
%15 = phi i32 [ 1, %11 ], [ -1, %7 ], [ 0, %3 ]
ret i32 %15
}