// File: /workspace/github_c_makefile_star2_O2/alexgirao[P]aimant/aimant.c
// Function: tail0
static int tail0(char *filename, int seek_end)
{
	int fd;

	if ((fd = open(filename, O_RDONLY)) < 0) {
		int save_errno = errno;
		assert(fd == -1);
		DEBUG("open(filename=[%s], O_RDONLY), errno=%i", filename, save_errno);
		errno = save_errno;
		perror(filename);
		return -1;
	}

	if (seek_end && lseek(fd, 0, SEEK_END) < 0) {
		int save_errno = errno;
		errno = save_errno;
		DEBUG("lseek(fd=%i, 0, SEEK_END), errno=%i", fd, save_errno);
		perror("lseek(fd, 0, SEEK_END)");

		assert(close(fd) == 0);
		fd = -1;
		return 1;
	}

	tail0loop(fd, STDOUT_FILENO);

	assert(close(fd) == 0);
	fd = -1;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x100008, %rsp         # imm = 0x100008
movl %esi, %r15d
movq %rdi, %r14
xorl %esi, %esi
xorl %eax, %eax
callq 0x22e0
movl %eax, %ebx
testl %eax, %eax
jns 0x4cb4
cmpl $-0x1, %ebx
jne 0x4e4c
callq 0x2080
movq %rax, %rbx
movl (%rax), %r15d
leaq 0x5430(%rip), %rdi      # 0xa0bc
leaq 0x613d(%rip), %rdx      # 0xadd0
movl $0x551, %esi            # imm = 0x551
movq %r14, %rcx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x8e04
movl %r15d, (%rbx)
movq %r14, %rdi
callq 0x2300
pushq $-0x1
jmp 0x4d0b
testl %r15d, %r15d
je 0x4d11
pushq $0x2
popq %rdx
movl %ebx, %edi
xorl %esi, %esi
callq 0x2190
testq %rax, %rax
jns 0x4d11
callq 0x2080
movl (%rax), %r8d
leaq 0x53e3(%rip), %rdi      # 0xa0bc
leaq 0x6118(%rip), %rdx      # 0xadf8
movl $0x55a, %esi            # imm = 0x55A
movl %ebx, %ecx
xorl %eax, %eax
callq 0x8e04
leaq 0x6127(%rip), %rdi      # 0xae1c
callq 0x2300
movl %ebx, %edi
callq 0x21e0
testl %eax, %eax
jne 0x4ec8
pushq $0x1
popq %rax
jmp 0x4e3a
xorl %r13d, %r13d
leaq -0x100030(%rbp), %r14
pushq $0x1
popq %r15
movl $0x100000, %edx         # imm = 0x100000
movl %ebx, %edi
movq %r14, %rsi
callq 0x2200
movq %rax, %r12
testl %r12d, %r12d
js 0x4d9f
je 0x4d72
xorl %r13d, %r13d
movl %r13d, %eax
leaq (%rax,%rbp), %rsi
addq $-0x100030, %rsi        # imm = 0xFFEFFFD0
movl %r12d, %eax
subl %r13d, %eax
movslq %eax, %rdx
movl %r15d, %edi
callq 0x2120
testl %eax, %eax
jle 0x4d69
addl %eax, %r13d
cmpl %r12d, %r13d
jl 0x4d3b
movl %r12d, %eax
xorl %r13d, %r13d
testl %eax, %eax
jns 0x4d1f
jmp 0x4de5
leal 0x1(%r13), %r12d
imull $0x1388, %r12d, %edi    # imm = 0x1388
cmpl $0x13, %r13d
movl $0x186a0, %eax          # imm = 0x186A0
cmovgel %eax, %edi
cmpl $0x63, %r13d
movl $0x3d090, %eax          # imm = 0x3D090
cmovgel %eax, %edi
callq 0x23c0
movl %r12d, %r13d
jmp 0x4d1f
cmpl $-0x1, %r12d
jne 0x4e6b
callq 0x2080
movq %rax, %r14
movl (%rax), %r15d
leaq 0x5301(%rip), %rdi      # 0xa0bc
leaq 0x6089(%rip), %rdx      # 0xae4b
movl $0x52a, %esi            # imm = 0x52A
movl %ebx, %ecx
movl $0x100000, %r8d         # imm = 0x100000
movl %r15d, %r9d
xorl %eax, %eax
callq 0x8e04
movl %r15d, (%r14)
leaq 0x608f(%rip), %rdi      # 0xae72
jmp 0x4e26
cmpl $-0x1, %eax
jne 0x4e8a
callq 0x2080
movq %rax, %r14
movl (%rax), %r15d
leaq 0x52bc(%rip), %rdi      # 0xa0bc
leaq 0x6082(%rip), %rdx      # 0xae89
pushq $0x1
popq %rcx
movl $0x533, %esi            # imm = 0x533
movl %r12d, %r8d
movl %r15d, %r9d
xorl %eax, %eax
callq 0x8e04
movl %r15d, (%r14)
leaq 0x608e(%rip), %rdi      # 0xaeb4
callq 0x2300
movl %ebx, %edi
callq 0x21e0
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x4ea9
addq $0x100008, %rsp         # imm = 0x100008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5b5c(%rip), %rdi      # 0xa9af
leaq 0x5262(%rip), %rsi      # 0xa0bc
leaq 0x5f58(%rip), %rcx      # 0xadb9
movl $0x550, %edx            # imm = 0x550
callq 0x21b0
leaq 0x548e(%rip), %rdi      # 0xa300
leaq 0x5243(%rip), %rsi      # 0xa0bc
leaq 0x5fb3(%rip), %rcx      # 0xae33
movl $0x529, %edx            # imm = 0x529
callq 0x21b0
leaq 0x6c33(%rip), %rdi      # 0xbac4
leaq 0x5224(%rip), %rsi      # 0xa0bc
leaq 0x5f94(%rip), %rcx      # 0xae33
movl $0x532, %edx            # imm = 0x532
callq 0x21b0
leaq 0x5c0c(%rip), %rdi      # 0xaabc
leaq 0x5205(%rip), %rsi      # 0xa0bc
leaq 0x5efb(%rip), %rcx      # 0xadb9
movl $0x564, %edx            # imm = 0x564
callq 0x21b0
leaq 0x5bed(%rip), %rdi      # 0xaabc
leaq 0x51e6(%rip), %rsi      # 0xa0bc
leaq 0x5edc(%rip), %rcx      # 0xadb9
movl $0x55d, %edx            # imm = 0x55D
callq 0x21b0
nop