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


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

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

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

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