// File: /workspace/github_c_makefile_star2_O3/CkTD[P]btree/table.c
// Function: table_open
Table *table_open(TableOpenFlag flag)
{
    if(access(flag.dir, F_OK) != -1)
    {
        if(flag.error_if_exist)
            return NULL;
        return table_new_from_file(flag.dir);
    }
    else
    {
        // table not exist!
        if(!flag.create_if_missing)
            return NULL;
        return table_new_empty(flag.dir);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r12
xorl %esi, %esi
callq 0x1170
cmpl $-0x1, %eax
je 0x2e77
shrq $0x20, %rbx
jne 0x2f58
movl $0x40, %edi
callq 0x1130
movq %rax, %r15
movq %r12, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
callq 0x1130
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x1050
movq %rbx, (%r15)
movl $0x350, %edi            # imm = 0x350
callq 0x1130
movq %rax, %r13
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0x334b
movq %rax, (%r13)
movq %r13, %rdi
callq 0x3391
movl 0x8(%r13), %ebx
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10c0
testq %rax, %rax
jne 0x2f8c
leaq 0x20(%r13), %r14
movl $0x330, %edx            # imm = 0x330
movl %ebx, %edi
movq %r14, %rsi
callq 0x10f0
cmpq $0x330, %rax            # imm = 0x330
jne 0x2fab
movq %r12, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movl $0xaaaaaaaa, %eax       # imm = 0xAAAAAAAA
cmpq %rax, (%r14)
jne 0x2fca
movq 0x28(%r13), %rbx
movq %r13, 0x10(%rsp)
movq %rbx, 0x10(%r13)
movl $0x1, %r15d
movl $0x1, %edi
movl $0x10, %esi
callq 0x1100
movq %rax, %r12
testq %rbx, %rbx
je 0x2e23
movq %rbx, %rbp
movq 0x10(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0xc(%rsp)
negq %rbp
movl $0x8, %r13d
xorl %ebx, %ebx
movl $0x320, %edi            # imm = 0x320
callq 0x1130
movq %rax, %r14
movl $0x320, %edx            # imm = 0x320
movl 0xc(%rsp), %edi
movq %rax, %rsi
callq 0x10f0
cmpq $0x320, %rax            # imm = 0x320
jne 0x2f6d
movq %r15, (%r12)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1140
movq %rax, %rbx
movq %rax, 0x8(%r12)
movq %r14, -0x8(%rax,%r13)
addq $0x8, %r13
leaq (%r15,%rbp), %rax
incq %rax
incq %r15
cmpq $0x1, %rax
jne 0x2dc9
movq 0x10(%rsp), %r15
movq %r12, 0x18(%r15)
movq 0x20(%rsp), %r14
movq %r15, 0x10(%r14)
movl $0x648, %edi            # imm = 0x648
callq 0x1130
movq %rax, %rbx
movq 0x18(%rsp), %rax
movq %rax, (%rbx)
leaq 0x328(%rbx), %rdi
movl $0x320, %edx            # imm = 0x320
xorl %esi, %esi
callq 0x10e0
leaq 0x8(%rbx), %rdi
addq $0x30, %r15
movl $0x320, %edx            # imm = 0x320
movq %r15, %rsi
callq 0x1110
jmp 0x2f3a
testl %ebx, %ebx
je 0x2f58
movl $0x40, %edi
callq 0x1130
movq %rax, %r14
movq %r12, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
callq 0x1130
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x1050
movq %rbx, %rdi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x1060
testl %eax, %eax
jne 0x2fe9
movq %rbx, (%r14)
movl $0x350, %edi            # imm = 0x350
callq 0x1130
movq %rax, %rbx
movq %r12, %rdi
callq 0x334b
movq %rax, (%rbx)
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movq $0x0, 0x10(%rbx)
movl $0x1, %edi
movl $0x10, %esi
callq 0x1100
movq %rax, 0x18(%rbx)
movl $0xaaaaaaaa, %eax       # imm = 0xAAAAAAAA
movq %rax, 0x20(%rbx)
leaq 0x28(%rbx), %rdi
movl $0x328, %edx            # imm = 0x328
xorl %esi, %esi
callq 0x10e0
movq %rbx, 0x10(%r14)
movl $0x648, %edi            # imm = 0x648
callq 0x1130
movq %rax, %rbx
movq %r12, (%rax)
leaq 0x8(%rax), %rdi
movl $0x640, %edx            # imm = 0x640
xorl %esi, %esi
callq 0x10e0
movq %rbx, 0x8(%r14)
movq %r14, %rdi
addq $0x18, %rdi
xorl %esi, %esi
callq 0x1190
testl %eax, %eax
je 0x2f5b
movq %r14, %rdi
callq 0x31df
xorl %r14d, %r14d
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b82(%rip), %rdi      # 0x4af6
leaq 0x19d6(%rip), %rsi      # 0x4951
leaq 0x1af6(%rip), %rcx      # 0x4a78
movl $0xfa, %edx
callq 0x10d0
leaq 0x1a0a(%rip), %rdi      # 0x499d
leaq 0x19b7(%rip), %rsi      # 0x4951
leaq 0x1ad7(%rip), %rcx      # 0x4a78
movl $0xee, %edx
callq 0x10d0
leaq 0x1afe(%rip), %rdi      # 0x4ab0
leaq 0x1998(%rip), %rsi      # 0x4951
leaq 0x1ab8(%rip), %rcx      # 0x4a78
movl $0xf0, %edx
callq 0x10d0
leaq 0x1af8(%rip), %rdi      # 0x4ac9
leaq 0x1979(%rip), %rsi      # 0x4951
leaq 0x1a99(%rip), %rcx      # 0x4a78
movl $0xf1, %edx
callq 0x10d0
leaq 0x19ad(%rip), %rdi      # 0x499d
leaq 0x195a(%rip), %rsi      # 0x4951
leaq 0x1b5b(%rip), %rcx      # 0x4b59
movl $0x259, %edx            # imm = 0x259
callq 0x10d0