// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
movq 0x30(%rsp), %r14
testq %r14, %r14
je 0x1b4c
leaq 0x30(%rsp), %rbx
movq %r14, %rdi
xorl %esi, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x1a35
cmpl $0x0, 0x14(%rbx)
jne 0x1a51
movl $0x68, %edi
callq 0x1100
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 0x1100
movq %rax, (%rbx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1050
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movl $0x30, %edi
callq 0x1100
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x26c8
movl $0xbbbbbbbb, %eax       # imm = 0xBBBBBBBB
cmpq %rax, (%r14)
jne 0x1b6b
movq 0x10(%r14), %rsi
movq %r14, %rdi
callq 0x1110
movq %rax, %r14
leaq 0x30(%rax), %rdi
movq 0x10(%rax), %rdx
addq $-0x30, %rdx
xorl %esi, %esi
callq 0x10c0
movl $0x10, %edi
callq 0x1100
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), %rsi
movl $0x1, %edi
callq 0x10e0
movq %rax, 0x60(%rbx)
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0x264b
jmp 0x1b3b
cmpl $0x0, 0x10(%rbx)
je 0x1a51
movq 0x8(%rbx), %r12
testb $0x1, %r12b
sete %al
cmpq $0x3, %r12
setb %cl
orb %al, %cl
je 0x1a58
xorl %ebx, %ebx
jmp 0x1b3f
movl $0x68, %edi
callq 0x1100
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 0x1100
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 0x1b8a
movl $0x1, %r13d
movl $0x1, %edi
movq %r14, %rsi
callq 0x10e0
movq %rax, %r15
movl $0xbbbbbbbb, %eax       # imm = 0xBBBBBBBB
movq %rax, (%r15)
movq %r12, 0x8(%r15)
movq %r14, 0x10(%r15)
movq %r13, 0x20(%r15)
movq %r13, 0x18(%r15)
movl $0x10, %edi
callq 0x1100
movl $0x1, 0x8(%rax)
movq %r15, (%rax)
movq %rax, 0x18(%rbx)
movl $0x8, %edi
callq 0x1100
movq %rax, 0x60(%rbx)
movb $0x0, (%rax)
movl $0x5, %esi
movq %rbx, %rdi
callq 0x23eb
movq %rax, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1642(%rip), %rdi      # 0x3195
leaq 0x14cb(%rip), %rsi      # 0x3025
leaq 0x163e(%rip), %rcx      # 0x319f
movl $0x4cd, %edx            # imm = 0x4CD
callq 0x10b0
leaq 0x1c89(%rip), %rdi      # 0x37fb
leaq 0x14ac(%rip), %rsi      # 0x3025
leaq 0x1c9a(%rip), %rcx      # 0x381a
movl $0xc3, %edx
callq 0x10b0
leaq 0x1cba(%rip), %rdi      # 0x384b
leaq 0x148d(%rip), %rsi      # 0x3025
leaq 0x1ccc(%rip), %rcx      # 0x386b
movl $0x489, %edx            # imm = 0x489
callq 0x10b0