// File: /workspace/github_c_makefile_star2_O1/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 0x313a(%rip), %rbx      # 0x5060
testq %rbx, %rbx
je 0x1f37
cmpl %r15d, 0xc(%rbx)
je 0x1f49
movq 0x18(%rbx), %rbx
jmp 0x1f26
leaq 0x3122(%rip), %rdi      # 0x5060
movl %r15d, %esi
callq 0x2362
movq %rax, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x2208
testl %r15d, %r15d
js 0x2208
testq %rbx, %rbx
je 0x2208
movq $0x0, (%r14)
movq 0x30e9(%rip), %rax      # 0x5060
movq %rax, -0x38(%rbp)
movslq 0x8(%rbx), %rax
movslq 0x10(%rbx), %rsi
cmpl %esi, %eax
jle 0x1fb1
movq (%rbx), %rcx
movq (%rcx), %rcx
cmpb $0xa, (%rcx,%rsi)
jne 0x1fb1
leal 0x1(%rsi), %eax
movl %eax, 0x10(%rbx)
leaq 0x1133(%rip), %rdi      # 0x30d3
xorl %esi, %esi
xorl %edx, %edx
callq 0x2700
movq %rax, (%r14)
jmp 0x2044
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, -0x70(%rbp)
cmpl %eax, %esi
movl %eax, %edx
cmovgl %esi, %edx
movl %esi, %ecx
notl %ecx
addl %edx, %ecx
subl %esi, %edx
movslq %ecx, %r8
leaq (%r8,%rsi), %rdi
incq %rdi
incq %r8
leaq -0x1(%rsi), %r9
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
incl %ecx
movl %ecx, -0x70(%rbp)
subq $0x1, %r8
jb 0x2001
movq (%rbx), %r10
movq (%r10), %r11
leaq 0x1(%r9), %r10
cmpb $0xa, 0x1(%r11,%r9)
movq %r10, %r9
jne 0x1fdf
jmp 0x2006
movq %rdi, %r10
movl %edx, %ecx
testl %ecx, %ecx
je 0x204e
cmpq %rax, %r10
jge 0x2065
movq (%rbx), %rax
movq (%rax), %rdi
movslq %ecx, %rdx
callq 0x2700
movq %rax, (%r14)
movl -0x70(%rbp), %eax
movl 0x8(%rbx), %ecx
movl 0x10(%rbx), %edx
addl %edx, %eax
incl %eax
movl %eax, 0x10(%rbx)
cmpl %eax, %ecx
jne 0x2044
leaq -0x38(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movq %rbx, %rdi
callq 0x23f0
movl $0x1, %eax
jmp 0x2208
movq %rbx, %rdi
callq 0x23ab
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x2208
movl %r15d, -0x30(%rbp)
leaq -0x70(%rbp), %r12
movq %r14, -0x40(%rbp)
movl -0x30(%rbp), %edi
movl $0x2a, %edx
movq %r12, %rsi
callq 0x1060
movq %rax, %r15
movl %r15d, -0x38(%rbp)
cmpl $-0x1, %r15d
je 0x20cc
movslq %r15d, %rax
movb $0x0, -0x70(%rbp,%rax)
testl %r15d, %r15d
je 0x20d8
cmpb $0xa, -0x70(%rbp)
jne 0x20b1
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2217
cmpl $-0x1, %eax
je 0x212a
cmpb $0xa, -0x70(%rbp)
jne 0x20de
leal -0x1(%r15), %edx
movq %rbx, %rdi
leaq -0x6f(%rbp), %rsi
callq 0x22a8
jmp 0x21ad
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
jmp 0x21d6
cmpl $0x0, 0x8(%rbx)
je 0x2120
movq %r12, %r14
xorl %r13d, %r13d
testl %r15d, %r15d
setg %r12b
jle 0x2137
movb $0x1, %r12b
cmpb $0xa, -0x70(%rbp)
je 0x2137
movl %r15d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq -0x1(%rax), %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x2131
leaq 0x1(%rdx), %r13
cmpb $0xa, -0x6f(%rbp,%rdx)
movq %r13, %rdx
jne 0x2104
cmpq %rax, %r13
setb %r12b
jmp 0x2137
movl $0x1, %eax
jmp 0x21ad
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x21ad
xorl %r12d, %r12d
movl %r15d, %r13d
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x22a8
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $-0x1, %ecx
je 0x21a6
cmpl $0x2a, %r15d
sete %cl
xorb $0x1, %r12b
xorl %eax, %eax
testb %r12b, %cl
movq %r14, %r12
movq -0x40(%rbp), %r14
jne 0x21ad
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2217
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $-0x1, %ecx
je 0x21ad
movl $0x2, %eax
cmpl %r15d, %r13d
je 0x21ad
movl %r13d, %esi
leaq -0x6f(%rbp), %rax
addq %rax, %rsi
notl %r13d
addl %r15d, %r13d
movq %rbx, %rdi
movl %r13d, %edx
jmp 0x20c2
movq %r14, %r12
movq -0x40(%rbp), %r14
movl %eax, -0x34(%rbp)
decl %eax
cmpl $0x2, %eax
jb 0x21bd
cmpl $0x0, -0x38(%rbp)
jne 0x21d6
cmpq $0x0, (%r14)
jne 0x21d6
leaq 0xf09(%rip), %rdi       # 0x30d3
xorl %esi, %esi
xorl %edx, %edx
callq 0x2700
movq %rax, (%r14)
movl -0x38(%rbp), %ecx
cmpl $-0x1, %ecx
je 0x21f5
movl -0x34(%rbp), %eax
cmpl $-0x1, %eax
je 0x21f5
testl %ecx, %ecx
je 0x21f5
decl %eax
cmpl $0x1, %eax
ja 0x2071
leaq 0x2e64(%rip), %rsi      # 0x5060
leaq -0x38(%rbp), %rdx
movq %rbx, %rdi
callq 0x23f0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq