// File: /workspace/github_cpp_makefile_star2_O3/wwdatabase[P]database/testrcdmana.cpp
// Function: main
int main() {
    RecordManager *prm = RecordManager::getInstance();
    const char *fileName = "database.txt";
    vector<int> attrType, attrLength, isNull;
    for (int i = 0; i < 3; ++i) {
        attrType.push_back(1);
        attrLength.push_back(4);
        isNull.push_back(1);
    }
    prm->createFile(fileName, 12, attrType, attrLength, isNull, 1);

    RM_FileHandle fileHandle(prm->pfm, prm->bpm);
    prm->openFile(fileName, fileHandle);
    RID rid;
    /*prm->fileHandle->insertRec("123451345512", rid);
    cout << rid << endl;
    prm->fileHandle->insertRec("123451345512", rid);
    cout << rid << endl;
    prm->fileHandle->insertRec("This is one ", rid);
    prm->fileHandle->insertRec("123451345512", rid);
    prm->fileHandle->insertRec("123451345512", rid);
*/
    RM_Record rec;
    /*prm->fileHandle->getRec(rid, rec);
    cout << string(rec.data) << endl;

    rec.setData("this is another case");
    prm->fileHandle->updateRec(rec);

    prm->fileHandle->getRec(rid, rec);
    cout << string(rec.data) << endl;

    prm->fileHandle->deleteRec(rid);
    prm->fileHandle->insertRec("33333333333333333333", rid);
*/
    int b = 40100200;
    char data[12];
    strcpy(data, "abcd");
    for (int i = 0; i < 4; ++i) {
        char t = *((char*)(&b)+i);
        cout << t << " ddd" << endl;
        strcat(data, &t);
        cout << data << " ddd " << strlen(data) << endl;
    }
    strcat(data, "1234");
    cout << "size : " << strlen(data) << endl;
    fileHandle.insertRec(data, rid);
    b = 20; 
    strcpy(data, "1111");
    for (int i = 0; i < 4; ++i) {
        strcat(data, (char*)(&b)+i);
    }
    strcat(data, "3333");
    fileHandle.insertRec(data, rid);
    // a = {'a', 'b', 'c', 'd'}; 
    b = 345; 
    // c = {'a', 'b', 'c', 'd'};
    strcpy(data, "2222");
    for (int i = 0; i < 4; ++i) {
        strcat(data, (char*)(&b)+i);
    }
    strcat(data, "6666");
    fileHandle.insertRec(data, rid);

    RM_FileScan fs;
    b = 40100200;
    void* value = (void*)(&b);
    fs.openScan(fileHandle,
                ATTRINT,
                4,
                4,
                GT_OP,
                value);
    fs.getNextRec(rec);
    if (!rec.empty()) {
        cout << string(rec.data) << " , " << rec.rid << endl;
    }
    fs.closeScan();

    prm->closeFile(fileHandle);

    prm->destroyFile(fileName);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
callq 0x4880
movq %rax, -0xd8(%rbp)
xorl %eax, %eax
leaq -0xb0(%rbp), %r14
movq %rax, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
leaq -0x90(%rbp), %r15
movq %rax, 0x10(%r15)
movaps %xmm0, (%r15)
leaq -0x70(%rbp), %r12
movq %rax, 0x10(%r12)
movaps %xmm0, (%r12)
movl $0x3, %ebx
leaq -0x200(%rbp), %r13
movl $0x1, -0x200(%rbp)
movq -0xa8(%rbp), %rsi
cmpq -0xa0(%rbp), %rsi
je 0x3eac
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, -0xa8(%rbp)
jmp 0x3eb7
movq %r14, %rdi
movq %r13, %rdx
callq 0x523c
movl $0x4, -0x200(%rbp)
movq -0x88(%rbp), %rsi
cmpq -0x80(%rbp), %rsi
je 0x3ee1
movl $0x4, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x88(%rbp)
jmp 0x3eec
movq %r15, %rdi
movq %r13, %rdx
callq 0x523c
movl $0x1, -0x200(%rbp)
movq -0x68(%rbp), %rsi
cmpq -0x60(%rbp), %rsi
je 0x3f10
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x68(%rbp)
jmp 0x3f1b
movq %r12, %rdi
movq %r13, %rdx
callq 0x523c
decl %ebx
jne 0x3e7f
leaq -0x120(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x48d0
leaq -0x108(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x48d0
leaq -0xf0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x48d0
movl $0x1, (%rsp)
leaq 0x239c(%rip), %rsi      # 0x6303
leaq -0x120(%rbp), %rcx
leaq -0x108(%rbp), %r8
leaq -0xf0(%rbp), %r9
movq -0xd8(%rbp), %rbx
movq %rbx, %rdi
movl $0xc, %edx
callq 0x2d3c
movq -0xf0(%rbp), %rdi
testq %rdi, %rdi
je 0x3fab
movq -0xe0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq -0x108(%rbp), %rdi
testq %rdi, %rdi
je 0x3fc6
movq -0xf8(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq -0x120(%rbp), %rdi
testq %rdi, %rdi
je 0x3fe1
movq -0x110(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movups (%rbx), %xmm0
leaq -0x200(%rbp), %rdx
movq $0x0, 0x80(%rdx)
movl $0x0, 0x88(%rdx)
xorps %xmm1, %xmm1
movaps %xmm1, (%rdx)
movaps %xmm1, 0x10(%rdx)
movaps %xmm1, 0x20(%rdx)
movaps %xmm1, 0x30(%rdx)
movaps %xmm1, 0x40(%rdx)
movaps %xmm1, 0x50(%rdx)
movaps %xmm1, 0x60(%rdx)
movups %xmm1, 0x6c(%rdx)
movaps %xmm0, 0x90(%rdx)
leaq 0x22d3(%rip), %rsi      # 0x6303
movq %rbx, %rdi
callq 0x3136
movq $0x0, -0x58(%rbp)
movl $0x263e168, -0x2c(%rbp) # imm = 0x263E168
leaq -0x38(%rbp), %rbx
movb $0x0, 0x4(%rbx)
movl $0x64636261, (%rbx)     # imm = 0x64636261
xorl %r13d, %r13d
movq 0x4f79(%rip), %r14      # 0x8fd8
leaq 0x22b4(%rip), %r15      # 0x631a
movb -0x2c(%rbp,%r13), %al
movb %al, -0xd0(%rbp)
movb %al, -0x160(%rbp)
movl $0x1, %edx
movq %r14, %rdi
leaq -0x160(%rbp), %rsi
callq 0x2170
movq %rax, %r12
movl $0x4, %edx
movq %rax, %rdi
leaq 0x2278(%rip), %rsi      # 0x6315
callq 0x2170
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20c0
movq %rbx, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2070
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2170
movl $0x5, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2070
movq %r14, %rdi
movq %rax, %rsi
callq 0x20b0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20c0
incq %r13
cmpq $0x4, %r13
jne 0x4066
leaq -0x38(%rbp), %rdi
callq 0x2070
movl $0x34333231, -0x38(%rbp,%rax) # imm = 0x34333231
movb $0x0, -0x34(%rbp,%rax)
movq 0x4e72(%rip), %rdi      # 0x8fd8
leaq 0x2003(%rip), %rsi      # 0x6170
movl $0x7, %edx
callq 0x2170
leaq -0x38(%rbp), %rdi
callq 0x2070
movq 0x4e51(%rip), %rdi      # 0x8fd8
movq %rax, %rsi
callq 0x20b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20c0
leaq -0x200(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x44(%rbp), %rdx
callq 0x25fa
movl $0x14, -0x2c(%rbp)
leaq -0x38(%rbp), %rbx
movl $0x31313131, (%rbx)     # imm = 0x31313131
movb $0x0, 0x4(%rbx)
xorl %r14d, %r14d
leaq (%r14,%rbp), %rsi
addq $-0x2c, %rsi
movq %rbx, %rdi
callq 0x2210
incq %r14
cmpq $0x4, %r14
jne 0x41e5
leaq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x2070
movl $0x33333333, -0x38(%rbp,%rax) # imm = 0x33333333
movb $0x0, -0x34(%rbp,%rax)
leaq -0x200(%rbp), %rdi
leaq -0x44(%rbp), %rdx
movq %rbx, %rsi
callq 0x25fa
movl $0x159, -0x2c(%rbp)     # imm = 0x159
movl $0x32323232, (%rbx)     # imm = 0x32323232
movb $0x0, 0x4(%rbx)
xorl %r14d, %r14d
leaq (%r14,%rbp), %rsi
addq $-0x2c, %rsi
movq %rbx, %rdi
callq 0x2210
incq %r14
cmpq $0x4, %r14
jne 0x423e
leaq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x2070
movl $0x36363636, -0x38(%rbp,%rax) # imm = 0x36363636
movb $0x0, -0x34(%rbp,%rax)
leaq -0x200(%rbp), %rdi
leaq -0x44(%rbp), %rdx
movq %rbx, %rsi
callq 0x25fa
leaq -0x160(%rbp), %rdi
movq $0x0, 0x20(%rdi)
leaq -0x2c(%rbp), %rax
movl $0x263e168, (%rax)      # imm = 0x263E168
movq %rax, (%rsp)
leaq -0x200(%rbp), %rsi
movl $0x1, %edx
movl $0x4, %ecx
movl $0x4, %r8d
movl $0x3, %r9d
callq 0x3898
leaq -0x160(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3964
movq -0x58(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
leaq -0x39(%rbp), %rdx
callq 0x4582
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
movq 0x4cdd(%rip), %rdi      # 0x8fd8
callq 0x2170
movq %rax, %rbx
leaq 0x202f(%rip), %rsi      # 0x6339
movl $0x3, %edx
movq %rax, %rdi
callq 0x2170
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x23ac
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20c0
movq -0xd0(%rbp), %rdi
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2160
movq %rax, %rbx
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4389
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2160
jmp 0x4389
jmp 0x4386
movq %rax, %rbx
movq -0x140(%rbp), %rdi
testq %rdi, %rdi
je 0x439a
callq 0x2190
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x43b1
callq 0x2190
jmp 0x43b1
jmp 0x43ae
jmp 0x43ae
movq %rax, %rbx
leaq -0x200(%rbp), %rdi
callq 0x24c0
jmp 0x4428
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
testq %rdi, %rdi
je 0x43e2
movq -0xe0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
jmp 0x43e2
movq %rax, %rbx
movq -0x108(%rbp), %rdi
testq %rdi, %rdi
je 0x4402
movq -0xf8(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
jmp 0x4402
movq %rax, %rbx
movq -0x120(%rbp), %rdi
testq %rdi, %rdi
je 0x4428
movq -0x110(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
jmp 0x4428
jmp 0x4425
jmp 0x4425
jmp 0x4425
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x443d
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x4455
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x4470
movq -0xa0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2200