// File: /workspace/github_c_makefile_star2_O2/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, %r12
movl %edi, %r15d
leaq 0x41fe(%rip), %rbx      # 0x6058
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x1e6e
cmpl %r15d, 0xc(%rbx)
je 0x1e80
addq $0x18, %rbx
jmp 0x1e5a
leaq 0x41e3(%rip), %rdi      # 0x6058
movl %r15d, %esi
callq 0x223e
movq %rax, %rbx
pushq $-0x1
popq %rax
testq %r12, %r12
je 0x20fd
testl %r15d, %r15d
js 0x20fd
testq %rbx, %rbx
je 0x20fd
andq $0x0, (%r12)
movq 0x41ae(%rip), %rax      # 0x6058
movq %rax, -0x38(%rbp)
movslq 0x8(%rbx), %rax
movslq 0x10(%rbx), %rsi
cmpl %esi, %eax
jle 0x1ee4
movq (%rbx), %rcx
movq (%rcx), %rcx
cmpb $0xa, (%rcx,%rsi)
jne 0x1ee4
incl %esi
movl %esi, 0x10(%rbx)
leaq 0x1201(%rip), %rdi      # 0x30d3
xorl %esi, %esi
xorl %edx, %edx
callq 0x25c4
movq %rax, (%r12)
jmp 0x1f6f
andl $0x0, -0x6c(%rbp)
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
xorl %ecx, %ecx
movabsq $0x100000000, %r8       # imm = 0x100000000
movl %ecx, -0x70(%rbp)
leaq (%rsi,%rcx), %rdi
cmpq %rax, %rdi
jge 0x1f5e
movq (%rbx), %rdi
movq (%rdi), %rdi
leaq (%rdi,%rsi), %r9
leaq 0x1(%rcx), %r14
addq %r8, %rdx
cmpb $0xa, (%rcx,%r9)
movq %r14, %rcx
jne 0x1efe
cmpq $0x1, %r14
je 0x1f63
sarq $0x20, %rdx
callq 0x25c4
movq %rax, (%r12)
movl 0x8(%rbx), %eax
movl 0x10(%rbx), %ecx
leal (%rcx,%r14), %edx
movl %edx, 0x10(%rbx)
subl %ecx, %eax
cmpl %r14d, %eax
jne 0x1f6f
leaq -0x38(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movq %rbx, %rdi
callq 0x22bc
jmp 0x1f6f
testq %rcx, %rcx
jne 0x1f77
movq %rbx, %rdi
callq 0x227f
testl %eax, %eax
je 0x1f77
pushq $0x1
popq %rax
jmp 0x20fd
movl %r15d, -0x30(%rbp)
movq %r12, -0x40(%rbp)
movl -0x30(%rbp), %edi
leaq -0x70(%rbp), %rsi
pushq $0x2a
popq %rdx
callq 0x1050
movq %rax, %r13
movl %r13d, -0x38(%rbp)
cmpl $-0x1, %r13d
je 0x1fde
movslq %r13d, %r15
movb $0x0, -0x70(%rbp,%r15)
testl %r13d, %r13d
je 0x1fea
cmpb $0xa, -0x70(%rbp)
jne 0x1ff3
movq %r12, %rdi
movq %rbx, %rsi
callq 0x210c
movl %eax, %ecx
pushq $-0x1
popq %rax
cmpl $-0x1, %ecx
je 0x2070
cmpb $0xa, -0x70(%rbp)
movl %eax, %r14d
leaq -0x70(%rbp), %rsi
movq -0x40(%rbp), %r12
jne 0x1ff3
jmp 0x20ab
orl $-0x1, -0x34(%rbp)
pushq $-0x1
popq %rax
jmp 0x20ce
cmpl $0x0, 0x8(%rbx)
pushq $0x1
popq %rax
je 0x206b
testl %r13d, %r13d
movl $0x0, %r14d
cmovgl %r13d, %r14d
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x2015
cmpb $0xa, -0x70(%rbp,%r12)
je 0x201a
incq %r12
jmp 0x2003
movq %r14, %r12
jmp 0x201d
movl %r12d, %r14d
movq %rbx, %rdi
leaq -0x70(%rbp), %rsi
movl %r14d, %edx
callq 0x2194
movl %eax, %ecx
pushq $-0x1
popq %rax
cmpl $-0x1, %ecx
je 0x2070
cmpq %r15, %r12
setge %cl
cmpl $0x2a, %r13d
sete %dl
xorl %eax, %eax
testb %cl, %dl
jne 0x2070
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x210c
movl %eax, %ecx
pushq $-0x1
popq %rax
cmpl $-0x1, %ecx
je 0x2070
pushq $0x2
popq %rax
cmpl %r13d, %r14d
movq -0x40(%rbp), %r12
jne 0x209d
movl %eax, -0x34(%rbp)
jmp 0x207d
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x38(%rbp)
movq -0x40(%rbp), %r12
jne 0x20ce
cmpq $0x0, (%r12)
jne 0x20ce
leaq 0x1048(%rip), %rdi      # 0x30d3
xorl %esi, %esi
xorl %edx, %edx
callq 0x25c4
movq %rax, (%r12)
movl -0x34(%rbp), %eax
jmp 0x20ce
movl %r14d, %eax
leaq (%rax,%rbp), %rsi
addq $-0x70, %rsi
notl %r14d
incq %rsi
addl %r13d, %r14d
movq %rbx, %rdi
movl %r14d, %edx
callq 0x2194
movl %eax, -0x34(%rbp)
movl %eax, %ecx
decl %ecx
cmpl $0x2, %ecx
jb 0x207d
cmpl $0x0, -0x38(%rbp)
je 0x207d
movl -0x38(%rbp), %ecx
cmpl $-0x1, %ecx
je 0x20ea
cmpl $-0x1, %eax
je 0x20ea
testl %ecx, %ecx
je 0x20ea
decl %eax
cmpl $0x1, %eax
ja 0x1f7f
leaq 0x3f67(%rip), %rsi      # 0x6058
leaq -0x38(%rbp), %rdx
movq %rbx, %rdi
callq 0x22bc
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq