// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/table_test1.c
// Function: main
int main()
{
    TableOpenFlag   flag;
    Table          *table;
    TableRows      *rows;
    TableRow       *row;
    uint64_t        i,j,n,count;
    

    flag.dir = "test_table";
    flag.create_if_missing = 1;
    flag.error_if_exist = 0;

    table = table_open(flag);

    printf("插入 1000000 行随机数据，每一行所有属性相同...\n");
    for(i = 0; i < 1000000; i++)
    {
        row = table_row_new();
        n = rand() % 1000000;
        for(j=0;j<100;j++)
            table_row_set_property(row, j, n );
        table_append(table, row);
        if (n<=1010 && n >=1000)
            printf("\t插入一个属性都为 %ld 的行\n", n);
    }

    printf("查找 第0个属性的范围在 1000 到 10010 的行，limit = 100.\n");
    rows = table_search_range(table, 0, 1000, 1010, 100);
    count = table_rows_get_counts(rows);
    for(i = 0; i < count; i++)
    {
        row = table_rows_get_row(rows, i);
        printf("\tROW %lu, first 10 properties: ", i);
        for(j = 0; j < 10; j++)
        {
            printf("%lu ", table_row_get_property(row, j));
        }
        printf("\n");
    }
    table_rows_destory(rows);

    printf("关闭表(刷磁盘)....\n");
    table_close(table);
    printf("done\n");
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
leaq 0x1a7c(%rip), %rax      # 0x6c92
movq %rax, -0x18(%rbp)
movl $0x1, -0x10(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x4600
movq %rax, -0x20(%rbp)
leaq 0x1a5d(%rip), %rdi      # 0x6c9d
movb $0x0, %al
callq 0x1080
movq $0x0, -0x38(%rbp)
cmpq $0xf4240, -0x38(%rbp)   # imm = 0xF4240
jae 0x52f0
movb $0x0, %al
callq 0x3df0
movq %rax, -0x30(%rbp)
callq 0x1180
movl $0xf4240, %ecx          # imm = 0xF4240
cltd
idivl %ecx
movslq %edx, %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x64, -0x40(%rbp)
jae 0x52aa
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x3e30
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x5284
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x4340
cmpq $0x3f2, -0x48(%rbp)     # imm = 0x3F2
ja 0x52dd
cmpq $0x3e8, -0x48(%rbp)     # imm = 0x3E8
jb 0x52dd
movq -0x48(%rbp), %rsi
leaq 0x1a08(%rip), %rdi      # 0x6cde
movb $0x0, %al
callq 0x1080
jmp 0x52df
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x524f
leaq 0x1a0d(%rip), %rdi      # 0x6d04
movb $0x0, %al
callq 0x1080
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x3e8, %edx            # imm = 0x3E8
movl $0x3f2, %ecx            # imm = 0x3F2
movl $0x64, %r8d
callq 0x3fe0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x3e60
movq %rax, -0x50(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x53bb
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3e80
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rsi
leaq 0x19f1(%rip), %rdi      # 0x6d4b
movb $0x0, %al
callq 0x1080
movq $0x0, -0x40(%rbp)
cmpq $0xa, -0x40(%rbp)
jae 0x539c
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3e10
movq %rax, %rsi
leaq 0xf4c(%rip), %rdi       # 0x62d3
movb $0x0, %al
callq 0x1080
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x5369
leaq 0xed8(%rip), %rdi       # 0x627b
movb $0x0, %al
callq 0x1080
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x5334
movq -0x28(%rbp), %rdi
callq 0x3ee0
leaq 0x19a0(%rip), %rdi      # 0x6d6b
movb $0x0, %al
callq 0x1080
movq -0x20(%rbp), %rdi
callq 0x4ae0
leaq 0x19a3(%rip), %rdi      # 0x6d85
movb $0x0, %al
callq 0x1080
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq