// File: /workspace/github_c_makefile_star2_O2/orempel[P]multiboot_tool/filedata.c
// Function: file_read
int file_read(const char *filename, struct databuf *dbuf)
{
    switch (get_filetype(filename))
    {
        case FILETYPE_BINARY:
            return binfile_read(filename, dbuf);

        case FILETYPE_INTELHEX:
            return hexfile_read(filename, dbuf);

        default:
            return -1;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r15
movq %rdi, %r14
callq 0x3bf4
pushq $-0x1
popq %rbx
cmpl $0x2, %eax
je 0x3cb6
cmpl $0x1, %eax
jne 0x3e4d
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2210
testl %eax, %eax
js 0x3e5e
movl %eax, %ebp
leaq 0x8(%r15), %rsi
movl (%r15), %edx
movl %eax, %edi
callq 0x2150
testq %rax, %rax
jle 0x3e75
movl %eax, 0x4(%r15)
movl %ebp, %edi
callq 0x2140
jmp 0x3e4b
leaq 0x4cd9(%rip), %rsi      # 0x8996
movq %r14, %rdi
callq 0x2220
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x3e67
movq %r15, 0x28(%rsp)
leaq 0x8(%r15), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x2260
cmpq $-0x1, %rax
je 0x3e2f
cmpq $0xb, %rax
jle 0x3e8a
movq 0x10(%rsp), %rbx
cmpb $0x3a, (%rbx)
jne 0x3eaa
leaq 0x1(%rbx), %rdi
callq 0x4214
movl %eax, %r15d
movzbl %al, %r14d
testb %al, %al
je 0x3d49
movq %r14, %rdi
callq 0x21d0
movq %rax, %r13
movq %r14, %rbp
testq %rax, %rax
jne 0x3d4e
jmp 0x3f26
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r14, 0x40(%rsp)
leaq 0x3(%rbx), %rdi
callq 0x4214
movl %eax, %r14d
leaq 0x5(%rbx), %rdi
callq 0x4214
movl %eax, %r12d
movzbl %r14b, %r14d
leaq 0x7(%rbx), %rdi
callq 0x4214
movl %r14d, 0x24(%rsp)
movl %r14d, %ecx
movb %r15b, 0xf(%rsp)
addb %r15b, %cl
movq %r12, 0x38(%rsp)
movq %rax, 0x48(%rsp)
leal (%r12,%rax), %r15d
addb %cl, %r15b
leaq 0x9(%rbx), %r12
xorl %r14d, %r14d
cmpq %r14, %rbp
je 0x3dbe
movq %r12, %rdi
callq 0x4214
movb %al, (%r13,%r14)
addb %al, %r15b
incq %r14
addq $0x2, %r12
jmp 0x3da0
movq %r12, %rdi
callq 0x4214
addb %r15b, %al
jne 0x3ec8
movq %rbx, %rdi
callq 0x2030
cmpb $0x0, 0x48(%rsp)
jne 0x3ce1
movzbl 0x38(%rsp), %eax
movzwl 0x24(%rsp), %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzwl %cx, %edi
movq 0x28(%rsp), %rax
movl (%rax), %eax
cmpl %edi, %eax
movq 0x40(%rsp), %rbx
jb 0x3f05
addl %edi, %ebx
cmpl %eax, %ebx
ja 0x3f05
addq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x21b0
movq 0x28(%rsp), %rax
movl %ebx, 0x4(%rax)
jmp 0x3ce1
movq 0x18(%rsp), %rdi
callq 0x2190
testl %eax, %eax
je 0x3ef4
movq 0x18(%rsp), %rdi
callq 0x20a0
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4b03(%rip), %rdi      # 0x8968
jmp 0x3e6e
leaq 0x4b2a(%rip), %rdi      # 0x8998
callq 0x2240
jmp 0x3e4d
leaq 0x4b03(%rip), %rdi      # 0x897f
callq 0x2240
movl %ebp, %edi
callq 0x2140
jmp 0x3e4d
movq 0x9167(%rip), %rcx      # 0xcff8
movq (%rcx), %rdi
leaq 0x4b58(%rip), %rsi      # 0x89f3
movq %rax, %rdx
xorl %eax, %eax
callq 0x2180
jmp 0x3f32
movq 0x9147(%rip), %rax      # 0xcff8
movq (%rax), %rcx
leaq 0x4b50(%rip), %rdi      # 0x8a0b
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
callq 0x2280
jmp 0x3f32
movzbl %al, %edx
movq 0x9126(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x4b60(%rip), %rsi      # 0x8a3c
xorl %eax, %eax
callq 0x2180
cmpb $0x0, 0xf(%rsp)
je 0x3f32
movq %r13, %rdi
callq 0x2030
jmp 0x3f32
leaq 0x4ad9(%rip), %rdi      # 0x89d4
callq 0x2240
jmp 0x3e41
movq 0x90ec(%rip), %rax      # 0xcff8
movq (%rax), %rcx
leaq 0x4a9a(%rip), %rdi      # 0x89b0
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
callq 0x2280
jmp 0x3e41
leaq 0x4af1(%rip), %rdi      # 0x8a1e
callq 0x2240
movq 0x10(%rsp), %rdi
callq 0x2030
jmp 0x3e41