// File: /workspace/github_c_makefile_star2_O1/CkTD[P]btree/btree.c
// Function: bt_open
BTree * bt_open(BTreeOpenFlag flag)
{
    assert(flag.file);
    if(access(flag.file, F_OK) != -1)
    {
        if(flag.error_if_exist)
            return NULL;
        return bt_new_from_file(flag.file);
    }
    else
    {
        // file not exist!
        if(!flag.create_if_missing)
            return NULL;
        if(flag.order % 2 != 1 || flag.order < 3)
            return NULL;
        return bt_new_empty(flag.file, flag.order);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x30(%rsp), %r14
testq %r14, %r14
je 0x1b25
leaq 0x30(%rsp), %rbx
movq %r14, %rdi
xorl %esi, %esi
callq 0x1130
cmpl $-0x1, %eax
je 0x19fd
cmpl $0x0, 0x14(%rbx)
jne 0x1a19
movl $0x68, %edi
callq 0x10f0
movq %rax, %rbx
addq $0x30, %rax
movq %rax, 0x30(%rbx)
movq %rax, 0x38(%rbx)
leaq 0x20(%rbx), %rax
movq %rax, 0x20(%rbx)
movq %rax, 0x28(%rbx)
leaq 0x40(%rbx), %rax
movq %rax, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movq %r14, %rdi
callq 0x1080
leaq 0x1(%rax), %rdi
callq 0x10f0
movq %rax, (%rbx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1050
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movl $0x30, %edi
callq 0x10f0
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x267e
movl $0xbbbbbbbb, %eax       # imm = 0xBBBBBBBB
cmpq %rax, (%r14)
jne 0x1b44
movq 0x10(%r14), %rsi
movq %r14, %rdi
callq 0x1100
movq %rax, %r14
leaq 0x30(%rax), %rdi
movq 0x10(%rax), %rdx
addq $-0x30, %rdx
xorl %esi, %esi
callq 0x10c0
movl $0x10, %edi
callq 0x10f0
movl $0x0, 0x8(%rax)
movq %r14, (%rax)
movq %rax, 0x18(%rbx)
movq 0x8(%r14), %rax
leaq -0x1(%rax), %rcx
movq %rcx, 0x58(%rbx)
shrq %rax
movq %rax, 0x50(%rbx)
movq 0x28(%r14), %rax
leaq 0x8(,%rax,8), %r15
movq %r15, %rdi
callq 0x10f0
movq %rax, 0x60(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x10c0
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0x2601
jmp 0x1b12
cmpl $0x0, 0x10(%rbx)
je 0x1a19
movq 0x8(%rbx), %r12
testb $0x1, %r12b
sete %al
cmpq $0x3, %r12
setb %cl
orb %al, %cl
je 0x1a20
xorl %ebx, %ebx
jmp 0x1b16
movl $0x68, %edi
callq 0x10f0
movq %rax, %rbx
addq $0x30, %rax
movq %rax, 0x30(%rbx)
movq %rax, 0x38(%rbx)
leaq 0x20(%rbx), %rax
movq %rax, 0x20(%rbx)
movq %rax, 0x28(%rbx)
leaq 0x40(%rbx), %rax
movq %rax, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movq %r14, %rdi
callq 0x1080
leaq 0x1(%rax), %rdi
callq 0x10f0
movq %rax, (%rbx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1050
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
leaq -0x1(%r12), %rax
movq %rax, 0x58(%rbx)
movq %r12, %rax
shrq %rax
movq %rax, 0x50(%rbx)
movq %r12, %r14
shlq $0x4, %r14
addq $0x20, %r14
cmpq $0x2f, %r14
jbe 0x1b63
movq %r14, %rdi
callq 0x10f0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x10c0
movl $0xbbbbbbbb, %eax       # imm = 0xBBBBBBBB
movq %rax, (%r15)
movq %r12, 0x8(%r15)
movq %r14, 0x10(%r15)
movl $0x1, %eax
movq %rax, 0x20(%r15)
movq $0x0, 0x28(%r15)
movq %rax, 0x18(%r15)
movl $0x10, %edi
callq 0x10f0
movl $0x1, 0x8(%rax)
movq %r15, (%rax)
movq %rax, 0x18(%rbx)
movl $0x8, %edi
callq 0x10f0
movq %rax, 0x60(%rbx)
movb $0x0, (%rax)
movl $0x5, %esi
movq %rbx, %rdi
callq 0x23b0
movq %rax, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1669(%rip), %rdi      # 0x3195
leaq 0x14f2(%rip), %rsi      # 0x3025
leaq 0x1665(%rip), %rcx      # 0x319f
movl $0x4cd, %edx            # imm = 0x4CD
callq 0x10b0
leaq 0x1cb0(%rip), %rdi      # 0x37fb
leaq 0x14d3(%rip), %rsi      # 0x3025
leaq 0x1cc1(%rip), %rcx      # 0x381a
movl $0xc3, %edx
callq 0x10b0
leaq 0x1ce1(%rip), %rdi      # 0x384b
leaq 0x14b4(%rip), %rsi      # 0x3025
leaq 0x1cf3(%rip), %rcx      # 0x386b
movl $0x489, %edx            # imm = 0x489
callq 0x10b0