// File: /workspace/github_c_makefile_star2_O3/LeoFu9487[P]push_swap/libft/get_next_line.c
// Function: get_next_line
int	get_next_line(int fd, char **line)
{
	char				buff[BUFFER_SIZE + 1];
	static t_lst		*save;
	t_lst				*temp;
	int					res[3];

	temp = save;
	while (temp && temp->fd != fd)
		temp = temp->next;
	if (!temp)
		temp = ft_lst_add(&save, fd);
	if (!temp || fd < 0 || BUFFER_SIZE < 1 || !line)
		return (-1);
	*line = 0;
	if (ft_check(temp, line, save))
		return (1);
	res[2] = fd;
	while (1)
	{
		ft_gnl((int *)res, buff, line, temp);
		if (res[0] == -1 || res[1] == -1)
			return (ft_del_lst(temp, &save, (int *)res));
		if (res[1] == 1 || res[1] == 2 || res[0] == 0)
			break ;
	}
	return (ft_del_lst(temp, &save, (int *)res));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movl %edi, %r15d
movq 0x3136(%rip), %rbx      # 0x5060
testq %rbx, %rbx
je 0x1f3b
cmpl %r15d, 0xc(%rbx)
je 0x1f4d
movq 0x18(%rbx), %rbx
jmp 0x1f2a
leaq 0x311e(%rip), %rdi      # 0x5060
movl %r15d, %esi
callq 0x234e
movq %rax, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x21f6
testl %r15d, %r15d
js 0x21f6
testq %rbx, %rbx
je 0x21f6
movq $0x0, (%r14)
movq 0x30e5(%rip), %rax      # 0x5060
movq %rax, -0x38(%rbp)
movl 0x8(%rbx), %eax
movslq 0x10(%rbx), %rsi
cmpl %esi, %eax
jle 0x1fb3
movq (%rbx), %rcx
movq (%rcx), %rcx
cmpb $0xa, (%rcx,%rsi)
jne 0x1fb3
incl %esi
movl %esi, 0x10(%rbx)
leaq 0x1131(%rip), %rdi      # 0x30d3
xorl %esi, %esi
xorl %edx, %edx
callq 0x26e0
movq %rax, (%r14)
jmp 0x203a
movl $0x0, -0x6c(%rbp)
cmpl %eax, %esi
cmovgl %esi, %eax
movl %esi, %ecx
notl %ecx
addl %eax, %ecx
movslq %ecx, %rax
incq %rax
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
xorl %ecx, %ecx
movabsq $0x100000000, %r8       # imm = 0x100000000
movl %ecx, -0x70(%rbp)
cmpq %rcx, %rax
je 0x2044
movq (%rbx), %rdi
movq (%rdi), %rdi
leaq (%rdi,%rsi), %r9
leaq 0x1(%rcx), %r12
addq %r8, %rdx
cmpb $0xa, (%rcx,%r9)
movq %r12, %rcx
jne 0x1fe1
cmpq $0x1, %r12
je 0x2049
sarq $0x20, %rdx
callq 0x26e0
movq %rax, (%r14)
movl 0x8(%rbx), %eax
movl 0x10(%rbx), %ecx
leal (%rcx,%r12), %edx
movl %edx, 0x10(%rbx)
subl %ecx, %eax
cmpl %r12d, %eax
jne 0x203a
leaq -0x38(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movq %rbx, %rdi
callq 0x23d8
movl $0x1, %eax
jmp 0x21f6
testq %rcx, %rcx
jne 0x2060
movq %rbx, %rdi
callq 0x2391
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x21f6
movl %r15d, -0x30(%rbp)
movl -0x30(%rbp), %edi
movl $0x2a, %edx
leaq -0x70(%rbp), %rsi
callq 0x1060
movq %rax, %r12
movl %r12d, -0x38(%rbp)
cmpl $-0x1, %r12d
je 0x21dc
movslq %r12d, %rax
movb $0x0, -0x70(%rbp,%rax)
testl %r12d, %r12d
je 0x20f0
cmpb $0xa, -0x70(%rbp)
jne 0x20c1
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2205
cmpl $-0x1, %eax
je 0x2167
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpb $0xa, -0x70(%rbp)
leaq -0x70(%rbp), %rsi
je 0x21bd
testl %r12d, %r12d
jle 0x2106
movl %r12d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq -0x1(%rax), %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x210e
leaq 0x1(%rdx), %r13
cmpb $0xa, -0x6f(%rbp,%rdx)
movq %r13, %rdx
jne 0x20d4
cmpq %rax, %r13
setb %r15b
jmp 0x2114
xorl %r13d, %r13d
cmpl $0x0, 0x8(%rbx)
movl $0x0, %r15d
jne 0x2114
movl $0x1, %eax
jmp 0x2162
xorl %r13d, %r13d
xorl %r15d, %r15d
jmp 0x2114
xorl %r15d, %r15d
movl %r12d, %r13d
movq %rbx, %rdi
leaq -0x70(%rbp), %rsi
movl %r13d, %edx
callq 0x2294
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $-0x1, %ecx
je 0x216c
cmpl $0x2a, %r12d
sete %cl
xorb $0x1, %r15b
xorl %eax, %eax
testb %r15b, %cl
jne 0x216c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2205
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $-0x1, %ecx
je 0x216c
movl $0x2, %eax
cmpl %r12d, %r13d
jne 0x21af
movl %eax, -0x34(%rbp)
jmp 0x2175
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x38(%rbp)
jne 0x2191
cmpq $0x0, (%r14)
jne 0x2191
leaq 0xf51(%rip), %rdi       # 0x30d3
xorl %esi, %esi
xorl %edx, %edx
callq 0x26e0
movq %rax, (%r14)
movl -0x34(%rbp), %eax
movl -0x38(%rbp), %ecx
cmpl $-0x1, %ecx
je 0x21e3
cmpl $-0x1, %eax
je 0x21e3
testl %ecx, %ecx
je 0x21e3
decl %eax
cmpl $0x1, %eax
ja 0x2064
jmp 0x21e3
movl %r13d, %eax
leaq (%rax,%rbp), %rsi
addq $-0x70, %rsi
notl %r13d
incq %rsi
addl %r12d, %r13d
movq %rbx, %rdi
movl %r13d, %edx
callq 0x2294
movl %eax, -0x34(%rbp)
movl %eax, %ecx
decl %ecx
cmpl $0x2, %ecx
jae 0x216f
jmp 0x2175
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
leaq 0x2e76(%rip), %rsi      # 0x5060
leaq -0x38(%rbp), %rdx
movq %rbx, %rdi
callq 0x23d8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq