#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*/ free(char *);
char *ft_strchr(char *, char);
char *ft_strdup(char *);
char *ft_strjoinfree(char *, char *, int /*<<< orphan*/);
char *ft_strsub(char *, int /*<<< orphan*/, int);
int re_lecture2(char *buff, char **line, char **str) {
  char *tmp;
  char *stock;
  tmp = ft_strchr(buff, '\n');
  stock = ft_strsub(buff, 0, tmp - buff);
  *line = ft_strjoinfree(*line, stock, 0);
  free(*str);
  *str = ft_strdup(tmp + 1);
  free(buff);
  return (1);
}


x86 assembly (clang, -O0):
<re_lecture2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1060 <ft_strchr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <ft_strsub@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1070 <ft_strjoinfree@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1050 <ft_strdup@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<re_lecture2>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    $0xa,%esi
call   1060 <ft_strchr@plt>
mov    %rax,%rbx
mov    %ebx,%edx
sub    %r12d,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1040 <ft_strsub@plt>
mov    (%r15),%rdi
mov    %rax,%rsi
xor    %edx,%edx
call   1070 <ft_strjoinfree@plt>
mov    %rax,(%r15)
mov    (%r14),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1050 <ft_strdup@plt>
mov    %rax,(%r14)
mov    %r12,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @re_lecture2(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%9 = load i8*, i8** %4
%10 = call i8* @ft_strchr(i8* %9, i8 signext 10)
store i8* %10, i8** %7
%11 = load i8*, i8** %4
%12 = load i8*, i8** %7
%13 = load i8*, i8** %4
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
%17 = trunc i64 %16 to i32
%18 = call i8* @ft_strsub(i8* %11, i32 0, i32 %17)
store i8* %18, i8** %8
%19 = load i8**, i8*** %5
%20 = load i8*, i8** %19
%21 = load i8*, i8** %8
%22 = call i8* @ft_strjoinfree(i8* %20, i8* %21, i32 0)
%23 = load i8**, i8*** %5
store i8* %22, i8** %23
%24 = load i8**, i8*** %6
%25 = load i8*, i8** %24
%26 = call i32 @free(i8* %25)
%27 = load i8*, i8** %7
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = call i8* @ft_strdup(i8* %28)
%30 = load i8**, i8*** %6
store i8* %29, i8** %30
%31 = load i8*, i8** %4
%32 = call i32 @free(i8* %31)
ret i32 1
}

LLVM IR (-O2):
define i32 @re_lecture2(i8* %0, i8** nocapture %1, i8** nocapture %2) {
%4 = tail call i8* @ft_strchr(i8* %0, i8 signext 10)
%5 = ptrtoint i8* %4 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = tail call i8* @ft_strsub(i8* %0, i32 0, i32 %8)
%10 = load i8*, i8** %1
%11 = tail call i8* @ft_strjoinfree(i8* %10, i8* %9, i32 0)
store i8* %11, i8** %1
%12 = load i8*, i8** %2
%13 = tail call i32 @free(i8* %12)
%14 = getelementptr inbounds i8, i8* %4, i64 1
%15 = tail call i8* @ft_strdup(i8* %14)
store i8* %15, i8** %2
%16 = tail call i32 @free(i8* %0)
ret i32 1
}