// File: /workspace/github_c_makefile_star2_O3/ffoissey[P]push_swap_42/libft/srcs/get_next_line/get_next_line.c
// Function: get_next_line
int				get_next_line(const int fd, char **line)
{
	static	t_list	*lst = NULL;
	t_list			*tmp;

	if (!line || (!lst && !(lst = init_new_file(fd, line))))
		return (-1);
	tmp = lst;
	while (tmp)
	{
		if (FILEL->fd == fd)
		{
			ft_fill_line_with_rest(FILEL);
			if (FILEL->state != 1 && ft_read(FILEL) == -1)
				return (-1);
			break ;
		}
		if (!tmp->next && !(tmp->next = init_new_file(fd, line)))
			return (-1);
		tmp = tmp->next;
	}
	free_cp_lst(&tmp, FILEL, line);
	return (tmp ? FILEL->state : 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x2353
movq %rsi, %rbx
movl %edi, %r15d
movq 0x7f40(%rip), %r12      # 0xa068
testq %r12, %r12
jne 0x2148
movl %r15d, %edi
callq 0x2367
movq %rax, %r12
movq %rax, 0x7f29(%rip)      # 0xa068
testq %rax, %rax
je 0x2353
movq %rbx, 0x8(%rsp)
movq (%r12), %rbx
cmpl %r15d, (%rbx)
jne 0x215b
movq %r12, %r14
jmp 0x2189
movq 0x10(%r12), %r14
testq %r14, %r14
jne 0x217e
movl %r15d, %edi
callq 0x2367
movq %rax, %r14
movq %rax, 0x10(%r12)
testq %rax, %rax
je 0x2353
movq (%r14), %rbx
movq %r14, %r12
cmpl %r15d, (%rbx)
jne 0x215b
movl $0x0, 0x4(%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x2237
leaq 0x8(%rbx), %r15
movl $0xa, %esi
callq 0x5914
testq %rax, %rax
je 0x21f7
leaq 0x1(%rax), %r12
cmpb $0x0, 0x1(%rax)
movq (%r15), %rdi
je 0x2206
subq %rdi, %rax
xorl %esi, %esi
movq %rax, %rdx
callq 0x5a9c
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rax
leaq 0x10(%rsp), %r15
movq %rax, (%r15)
movq %r12, %rdi
callq 0x598c
movq %rax, 0x8(%rbx)
movq %r15, %rdi
callq 0x1d7c
movl $0x1, 0x4(%rbx)
jmp 0x2237
movq 0x8(%rbx), %rdi
callq 0x598c
movq %rax, 0x10(%rbx)
jmp 0x222f
callq 0x598c
movq %rax, 0x10(%rbx)
cmpb $0x0, (%r12)
jne 0x222f
movq %rax, %r13
movq 0x8(%rbx), %rdi
callq 0x5ae0
movb $0x0, -0x1(%r13,%rax)
movl $0x1, 0x4(%rbx)
movq %r15, %rdi
callq 0x1d7c
movq (%r14), %rbx
cmpl $0x1, 0x4(%rbx)
je 0x2314
movl (%rbx), %edi
leaq 0x10(%rsp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x1060
testl %eax, %eax
jle 0x22b0
leaq 0x10(%rsp), %r15
movq %rsp, %r12
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, 0x10(%rsp,%rax)
movq 0x10(%rbx), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movl $0xa, %esi
callq 0x5914
testq %rax, %rax
jne 0x22d6
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x5a0c
movq %rax, 0x10(%rbx)
movq %r12, %rdi
callq 0x1d7c
movl (%rbx), %edi
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rsi
callq 0x1060
testl %eax, %eax
jg 0x2261
movq 0x10(%rbx), %rcx
testq %rcx, %rcx
je 0x22c5
cmpb $0x0, (%rcx)
je 0x22c5
movl $0x1, 0x4(%rbx)
cmpl $-0x1, %eax
je 0x2353
cmpl $-0x1, 0x4(%rbx)
jne 0x2314
jmp 0x2353
movq %rax, %r13
movl $0x1, 0x4(%rbx)
cmpb $0x0, 0x1(%rax)
je 0x22f5
movq %r13, %rdi
incq %rdi
callq 0x598c
movq %rax, 0x8(%rbx)
movb $0x0, (%r13)
movq 0x10(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x5a0c
movq %rax, 0x10(%rbx)
movq %rsp, %rdi
callq 0x1d7c
movq (%r14), %r15
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x2341
addq $0x10, %r15
callq 0x598c
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq %r15, %rdi
callq 0x1d7c
movq (%r14), %rax
movl 0x4(%rax), %ebp
jmp 0x2353
movq %r15, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq