// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/libft/get_next_line.c
// Function: get_next_line
int			get_next_line(int const fd, char **line)
{
	static t_file	*file = NULL;
	t_file			*fil;
	int				s;
	char			*new;

	if (init(&file, &fil, fd) < 0)
		return (-1);
	file = (file == NULL ? fil : file);
	if ((s = reduce(&fil, 1)) != 1)
		return (s);
	s = size_line(fil->text, fil->size_text);
	if ((new = (char *)malloc(sizeof(char) * (s + 1))) == NULL)
		return (-1);
	ft_bzero(new, s + 1);
	ft_strncpy(new, fil->text, s);
	*line = new;
	s = fil->size_text - s - 1;
	if ((new = (char*)malloc(sizeof(char) * (s > 0 ? s : BUFF_SIZE))) == NULL)
		return (-1);
	if (s > 0)
		ft_strncpy(new, &fil->text[fil->size_text - s], s);
	ft_strdel(&(fil->text));
	fil->size_text = s;
	fil->text = new;
	return (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
movq 0x5de5(%rip), %rbx      # 0xa3a8
testl %edi, %edi
sets %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x4608
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x45eb
cmpl %ebp, (%rbx)
je 0x45eb
movq %rax, %rcx
movq 0x18(%rax), %rax
movq %rcx, %rbx
jmp 0x45d6
cmpl %ebp, (%rbx)
jne 0x4608
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x4659
cmpl %ebp, (%rbx)
je 0x4659
movq %rax, %rcx
movq 0x18(%rax), %rax
movq %rcx, %rbx
jmp 0x45f3
movq %rbx, %r12
movb $0x1, %r15b
testl %ebp, %ebp
js 0x4654
movl $0x20, %edi
callq 0x4bac
testq %rax, %rax
je 0x4654
movq %rax, %rbx
movl $0x800, %edi            # imm = 0x800
callq 0x4bac
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x4654
movl $0x0, 0x10(%rbx)
movl %ebp, (%rbx)
movq $0x0, 0x18(%rbx)
testq %r12, %r12
je 0x4682
movq %rbx, 0x18(%r12)
jmp 0x4682
movq %r12, %rbx
jmp 0x4685
cmpl %ebp, (%rbx)
jne 0x4682
cmpq $0x0, 0x8(%rbx)
jne 0x4682
movl $0x800, %edi            # imm = 0x800
callq 0x4bac
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x48c7
movl $0x0, 0x10(%rbx)
xorl %r15d, %r15d
testb %r15b, %r15b
je 0x4694
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x48b6
movq 0x5d0d(%rip), %rax      # 0xa3a8
testq %rax, %rax
cmoveq %rbx, %rax
movq %rax, 0x5cff(%rip)      # 0xa3a8
movq 0x8(%rbx), %rsi
movslq 0x10(%rbx), %rax
testq %rsi, %rsi
je 0x46ef
cmpb $0xa, (%rsi)
movq %rsi, %rcx
je 0x46e8
xorl %edx, %edx
testq %rax, %rax
movl $0x0, %ecx
cmovgq %rax, %rcx
addq %rsi, %rcx
cmpq %rax, %rdx
jge 0x46e8
leaq 0x1(%rdx), %rdi
cmpb $0xa, 0x1(%rsi,%rdx)
movq %rdi, %rdx
jne 0x46cf
addq %rsi, %rdi
movq %rdi, %rcx
cmpl %esi, %ecx
sete %cl
jmp 0x46f1
movb $0x1, %cl
testb %cl, %cl
je 0x4708
testl %eax, %eax
jne 0x4708
movl (%rbx), %edi
movl $0x800, %edx            # imm = 0x800
callq 0x1060
movl %eax, 0x10(%rbx)
leaq 0x8(%rbx), %r15
cmpl $0x0, 0x10(%rbx)
jg 0x4720
cmpq $0x0, (%r15)
je 0x4720
movq %r15, %rdi
callq 0x4be4
movl 0x10(%rbx), %eax
testl %eax, %eax
jle 0x47d1
movl $0x1, %eax
movq 0x8(%rbx), %r12
movslq 0x10(%rbx), %r13
movl $0x0, %edx
testq %r12, %r12
je 0x477a
cmpb $0xa, (%r12)
movq %r12, %rdx
je 0x4777
testq %r13, %r13
movl $0x0, %edx
cmovgq %r13, %rdx
addq %r12, %rdx
xorl %ecx, %ecx
cmpq %r13, %rcx
jge 0x4777
leaq 0x1(%rcx), %rsi
cmpb $0xa, 0x1(%r12,%rcx)
movq %rsi, %rcx
jne 0x475d
addq %r12, %rsi
movq %rsi, %rdx
subl %r12d, %edx
movl $0x1, %ecx
testl %eax, %eax
jle 0x47e5
cmpl %r13d, %edx
jl 0x47e5
leaq 0x800(%r13), %rdi
callq 0x1080
testq %rax, %rax
je 0x47e0
movq %rax, %rbp
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4b50
movq %r15, %rdi
callq 0x4be4
movq %rbp, 0x8(%rbx)
movslq 0x10(%rbx), %rsi
addq %rbp, %rsi
movl (%rbx), %edi
movl $0x800, %edx            # imm = 0x800
callq 0x1060
addl %eax, 0x10(%rbx)
jmp 0x4730
movq $0x0, (%r15)
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
jmp 0x47e5
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x1, %ecx
jne 0x48b6
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x4831
cmpb $0xa, (%rax)
movq %rax, %rbp
je 0x482d
movslq 0x10(%rbx), %rcx
xorl %edx, %edx
testq %rcx, %rcx
movl $0x0, %ebp
cmovgq %rcx, %rbp
addq %rax, %rbp
cmpq %rcx, %rdx
jge 0x482d
leaq 0x1(%rdx), %rsi
cmpb $0xa, 0x1(%rax,%rdx)
movq %rsi, %rdx
jne 0x4814
addq %rax, %rsi
movq %rsi, %rbp
subl %eax, %ebp
jmp 0x4833
xorl %ebp, %ebp
leal 0x1(%rbp), %eax
movslq %eax, %r12
movq %r12, %rdi
callq 0x1080
testq %rax, %rax
je 0x468a
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x40f4
movq 0x8(%rbx), %rsi
movslq %ebp, %rdx
movq %r13, %rdi
callq 0x4b50
movq %r13, (%r14)
notl %ebp
addl 0x10(%rbx), %ebp
testl %ebp, %ebp
movl $0x800, %eax            # imm = 0x800
cmovgl %ebp, %eax
movslq %eax, %rdi
callq 0x1080
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x48b6
movq %rax, %r14
testl %ebp, %ebp
jle 0x48a2
addq (%r15), %r12
movl %ebp, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x4b50
movq %r15, %rdi
callq 0x4be4
movl %ebp, 0x10(%rbx)
movq %r14, 0x8(%rbx)
movl $0x1, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %r15b
jmp 0x4685
nop