// File: /workspace/github_c_makefile_star2_O2/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 0x1ad4
leaq 0x30(%rsp), %rbx
movq %r14, %rdi
xorl %esi, %esi
callq 0x1140
cmpl $-0x1, %eax
je 0x19c8
cmpl $0x0, 0x14(%rbx)
jne 0x19e4
pushq $0x68
popq %rdi
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
orl $-0x1, 0x8(%rbx)
pushq $0x30
popq %rdi
callq 0x1100
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x25c8
movl $0xbbbbbbbb, %eax       # imm = 0xBBBBBBBB
cmpq %rax, (%r14)
jne 0x1af3
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
pushq $0x10
popq %rdi
callq 0x1100
andl $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
pushq $0x1
popq %rdi
callq 0x10e0
movq %rax, 0x60(%rbx)
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0x2550
jmp 0x1ac3
cmpl $0x0, 0x10(%rbx)
je 0x19e4
movq 0x8(%rbx), %r13
testb $0x1, %r13b
sete %al
cmpq $0x3, %r13
setb %cl
orb %al, %cl
je 0x19eb
xorl %ebx, %ebx
jmp 0x1ac7
pushq $0x68
popq %rdi
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
orl $-0x1, 0x8(%rbx)
leaq -0x1(%r13), %rax
movq %rax, 0x58(%rbx)
movq %r13, %rax
shrq %rax
movq %rax, 0x50(%rbx)
movq %r13, %r14
shlq $0x4, %r14
addq $0x20, %r14
cmpq $0x2f, %r14
jbe 0x1b12
pushq $0x1
popq %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x10e0
movq %rax, %r12
movl $0xbbbbbbbb, %eax       # imm = 0xBBBBBBBB
movq %rax, (%r12)
movq %r13, 0x8(%r12)
movq %r14, 0x10(%r12)
movq %r15, 0x20(%r12)
movq %r15, 0x18(%r12)
pushq $0x10
popq %rdi
callq 0x1100
movl $0x1, 0x8(%rax)
movq %r12, (%rax)
movq %rax, 0x18(%rbx)
pushq $0x8
popq %rdi
callq 0x1100
movq %rax, 0x60(%rbx)
movb $0x0, (%rax)
pushq $0x5
popq %rsi
movq %rbx, %rdi
callq 0x22e5
movq %rax, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x16ba(%rip), %rdi      # 0x3195
leaq 0x1543(%rip), %rsi      # 0x3025
leaq 0x16b6(%rip), %rcx      # 0x319f
movl $0x4cd, %edx            # imm = 0x4CD
callq 0x10b0
leaq 0x1d01(%rip), %rdi      # 0x37fb
leaq 0x1524(%rip), %rsi      # 0x3025
leaq 0x1d12(%rip), %rcx      # 0x381a
movl $0xc3, %edx
callq 0x10b0
leaq 0x1d32(%rip), %rdi      # 0x384b
leaq 0x1505(%rip), %rsi      # 0x3025
leaq 0x1d44(%rip), %rcx      # 0x386b
movl $0x489, %edx            # imm = 0x489
callq 0x10b0