// File: wwdatabase[P]database/testsm.cpp
// Function: main
int main()
{
	SM_Manager sm ;
	string attrname1[4] = {"attr1_1","attr1_2","attr1_3","attr1_4"};
	string attrname2[4] = {"attr2_1","attr2_2","attr2_3","attr2_4"};
	int attrtype1[4] = {ATTRINT,ATTRFLOAT,ATTRSTRING,ATTRSTRING};
	int attrtype2[4] = {ATTRINT,ATTRFLOAT,ATTRSTRING,ATTRINT};
	int len1[4] = {4,4,7,3};
	int len2[4]= {4,4,3,4};
	int attrnum1 = 4;
	int attrnum2=  4;
	int prikey1 = 2;
	int prikey2 = 0;
	int isnull_1[4] = {1,1,0,0};
	int isnull_2[4] = {0,0,1,1};
	char dbname1[255] = "testdb1";
	char dbname2[255] = "testdb2";
	sm.create_db(dbname1);
	sm.use_db(dbname1);
	sm.create_table("tb1_1",attrname1,attrtype1,len1,isnull_1,attrnum1,prikey1);
	sm.create_table("tb1_2",attrname2,attrtype2,len2,isnull_2,attrnum2,prikey2);
	sm.create_db(dbname2);
	sm.use_db(dbname2);
	sm.create_table("tb2_1",attrname1,attrtype1,len1,isnull_1,attrnum1,prikey1);
	sm.create_table("tb2_2",attrname2,attrtype2,len2,isnull_2,attrnum2,prikey2);
	sm.show_db(dbname1);
	sm.show_db(dbname2);
	sm.show_table("tb2_1");
	sm.show_table("*");// wierd bug: record size is zero for the first database*/
	//sm.drop_db(dbname1);
	//sm.drop_table("tb2_2");
return 0;


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movl $0x0, -0x4(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x7160
movb $0x1, -0xd0(%rbp)
leaq -0xb0(%rbp), %rax
movq %rax, -0x3e0(%rbp)
movq %rax, -0xb8(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x23d0
movq -0x3e0(%rbp), %rdi
movq -0x3d8(%rbp), %rdx
leaq 0x9c07(%rip), %rsi      # 0xf396
callq 0x61e0
jmp 0x5796
leaq -0x90(%rbp), %rax
movq %rax, -0x3f0(%rbp)
movq %rax, -0xb8(%rbp)
leaq -0xcd(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x23d0
movq -0x3f0(%rbp), %rdi
movq -0x3e8(%rbp), %rdx
leaq 0x9bcb(%rip), %rsi      # 0xf39e
callq 0x61e0
jmp 0x57da
leaq -0x70(%rbp), %rax
movq %rax, -0x400(%rbp)
movq %rax, -0xb8(%rbp)
leaq -0xce(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x23d0
movq -0x400(%rbp), %rdi
movq -0x3f8(%rbp), %rdx
leaq 0x9b92(%rip), %rsi      # 0xf3a6
callq 0x61e0
jmp 0x581b
leaq -0x50(%rbp), %rax
movq %rax, -0x410(%rbp)
movq %rax, -0xb8(%rbp)
leaq -0xcf(%rbp), %rdi
movq %rdi, -0x408(%rbp)
callq 0x23d0
movq -0x410(%rbp), %rdi
movq -0x408(%rbp), %rdx
leaq 0x9b59(%rip), %rsi      # 0xf3ae
callq 0x61e0
jmp 0x585c
movb $0x0, -0xd0(%rbp)
leaq -0xcf(%rbp), %rdi
callq 0x2260
leaq -0xce(%rbp), %rdi
callq 0x2260
leaq -0xcd(%rbp), %rdi
callq 0x2260
leaq -0xb9(%rbp), %rdi
callq 0x2260
movb $0x1, -0x15d(%rbp)
leaq -0x150(%rbp), %rax
movq %rax, -0x420(%rbp)
movq %rax, -0x158(%rbp)
leaq -0x159(%rbp), %rdi
movq %rdi, -0x418(%rbp)
callq 0x23d0
movq -0x420(%rbp), %rdi
movq -0x418(%rbp), %rdx
leaq 0x9adf(%rip), %rsi      # 0xf3b6
callq 0x61e0
jmp 0x58de
leaq -0x130(%rbp), %rax
movq %rax, -0x430(%rbp)
movq %rax, -0x158(%rbp)
leaq -0x15a(%rbp), %rdi
movq %rdi, -0x428(%rbp)
callq 0x23d0
movq -0x430(%rbp), %rdi
movq -0x428(%rbp), %rdx
leaq 0x9aa3(%rip), %rsi      # 0xf3be
callq 0x61e0
jmp 0x5922
leaq -0x110(%rbp), %rax
movq %rax, -0x440(%rbp)
movq %rax, -0x158(%rbp)
leaq -0x15b(%rbp), %rdi
movq %rdi, -0x438(%rbp)
callq 0x23d0
movq -0x440(%rbp), %rdi
movq -0x438(%rbp), %rdx
leaq 0x9a67(%rip), %rsi      # 0xf3c6
callq 0x61e0
jmp 0x5966
leaq -0xf0(%rbp), %rax
movq %rax, -0x450(%rbp)
movq %rax, -0x158(%rbp)
leaq -0x15c(%rbp), %rdi
movq %rdi, -0x448(%rbp)
callq 0x23d0
movq -0x450(%rbp), %rdi
movq -0x448(%rbp), %rdx
leaq 0x9a2b(%rip), %rsi      # 0xf3ce
callq 0x61e0
jmp 0x59aa
movb $0x0, -0x15d(%rbp)
leaq -0x15c(%rbp), %rdi
callq 0x2260
leaq -0x15b(%rbp), %rdi
callq 0x2260
leaq -0x15a(%rbp), %rdi
callq 0x2260
leaq -0x159(%rbp), %rdi
callq 0x2260
movaps 0x9aa8(%rip), %xmm0     # 0xf490
movaps %xmm0, -0x170(%rbp)
movaps 0x9aaa(%rip), %xmm0     # 0xf4a0
movaps %xmm0, -0x180(%rbp)
movaps 0x9aac(%rip), %xmm0     # 0xf4b0
movaps %xmm0, -0x190(%rbp)
movaps 0x9aae(%rip), %xmm0     # 0xf4c0
movaps %xmm0, -0x1a0(%rbp)
movl $0x4, -0x1a4(%rbp)
movl $0x4, -0x1a8(%rbp)
movl $0x2, -0x1ac(%rbp)
movl $0x0, -0x1b0(%rbp)
movaps 0x9a88(%rip), %xmm0     # 0xf4d0
movaps %xmm0, -0x1c0(%rbp)
movaps 0x9a8a(%rip), %xmm0     # 0xf4e0
movaps %xmm0, -0x1d0(%rbp)
leaq 0x9a8c(%rip), %rsi      # 0xf4f0
leaq -0x2d0(%rbp), %rdi
movq %rdi, -0x458(%rbp)
movl $0xff, %edx
movq %rdx, -0x460(%rbp)
callq 0x21a0
movq -0x460(%rbp), %rdx
leaq 0x9b5f(%rip), %rsi      # 0xf5f0
leaq -0x3d0(%rbp), %rdi
callq 0x21a0
movq -0x458(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x3f70
jmp 0x5aaf
leaq -0x30(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x4150
jmp 0x5ac1
movl -0x1a4(%rbp), %ecx
movl -0x1ac(%rbp), %edx
movq %rsp, %rax
movl %edx, 0x8(%rax)
movl %ecx, (%rax)
leaq 0x98fa(%rip), %rsi      # 0xf3d6
leaq -0x30(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
leaq -0x170(%rbp), %rcx
leaq -0x190(%rbp), %r8
leaq -0x1c0(%rbp), %r9
callq 0x4480
jmp 0x5b03
movl -0x1a8(%rbp), %ecx
movl -0x1b0(%rbp), %edx
movq %rsp, %rax
movl %edx, 0x8(%rax)
movl %ecx, (%rax)
leaq 0x98be(%rip), %rsi      # 0xf3dc
leaq -0x30(%rbp), %rdi
leaq -0x150(%rbp), %rdx
leaq -0x180(%rbp), %rcx
leaq -0x1a0(%rbp), %r8
leaq -0x1d0(%rbp), %r9
callq 0x4480
jmp 0x5b45
leaq -0x30(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x3f70
jmp 0x5b57
leaq -0x30(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x4150
jmp 0x5b69
movl -0x1a4(%rbp), %ecx
movl -0x1ac(%rbp), %edx
movq %rsp, %rax
movl %edx, 0x8(%rax)
movl %ecx, (%rax)
leaq 0x985e(%rip), %rsi      # 0xf3e2
leaq -0x30(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
leaq -0x170(%rbp), %rcx
leaq -0x190(%rbp), %r8
leaq -0x1c0(%rbp), %r9
callq 0x4480
jmp 0x5bab
movl -0x1a8(%rbp), %ecx
movl -0x1b0(%rbp), %edx
movq %rsp, %rax
movl %edx, 0x8(%rax)
movl %ecx, (%rax)
leaq 0x9822(%rip), %rsi      # 0xf3e8
leaq -0x30(%rbp), %rdi
leaq -0x150(%rbp), %rdx
leaq -0x180(%rbp), %rcx
leaq -0x1a0(%rbp), %r8
leaq -0x1d0(%rbp), %r9
callq 0x4480
jmp 0x5bed
leaq -0x30(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x4220
jmp 0x5bff
leaq -0x30(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x4220
jmp 0x5c11
leaq 0x97ca(%rip), %rsi      # 0xf3e2
leaq -0x30(%rbp), %rdi
callq 0x4fd0
jmp 0x5c23
leaq 0x95ca(%rip), %rsi      # 0xf1f4
leaq -0x30(%rbp), %rdi
callq 0x4fd0
jmp 0x5c35
movl $0x0, -0x4(%rbp)
leaq -0x150(%rbp), %rax
movq %rax, -0x470(%rbp)
addq $0x80, %rax
movq %rax, -0x468(%rbp)
jmp 0x5e41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x5cce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x5cc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x5cb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0xcf(%rbp), %rdi
callq 0x2260
leaq -0xce(%rbp), %rdi
callq 0x2260
leaq -0xcd(%rbp), %rdi
callq 0x2260
leaq -0xb9(%rbp), %rdi
callq 0x2260
testb $0x1, -0xd0(%rbp)
jne 0x5ce5
jmp 0x5d32
movq -0xb8(%rbp), %rax
leaq -0xb0(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x478(%rbp)
je 0x5d30
movq -0x478(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x480(%rbp)
callq 0x2130
movq -0x480(%rbp), %rax
leaq -0xb0(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x478(%rbp)
jne 0x5cff
jmp 0x5d32
jmp 0x5f56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x5da9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x5d9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x5d91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x15c(%rbp), %rdi
callq 0x2260
leaq -0x15b(%rbp), %rdi
callq 0x2260
leaq -0x15a(%rbp), %rdi
callq 0x2260
leaq -0x159(%rbp), %rdi
callq 0x2260
testb $0x1, -0x15d(%rbp)
jne 0x5dc0
jmp 0x5e0d
movq -0x158(%rbp), %rax
leaq -0x150(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x488(%rbp)
je 0x5e0b
movq -0x488(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x490(%rbp)
callq 0x2130
movq -0x490(%rbp), %rax
leaq -0x150(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x488(%rbp)
jne 0x5dda
jmp 0x5e0d
jmp 0x5f08
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x150(%rbp), %rax
movq %rax, -0x4a0(%rbp)
addq $0x80, %rax
movq %rax, -0x498(%rbp)
jmp 0x5e8f
movq -0x468(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x4a8(%rbp)
callq 0x2130
movq -0x470(%rbp), %rcx
movq -0x4a8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x468(%rbp)
jne 0x5e41
leaq -0xb0(%rbp), %rax
movq %rax, -0x4b8(%rbp)
addq $0x80, %rax
movq %rax, -0x4b0(%rbp)
jmp 0x5ec2
movq -0x498(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x4c0(%rbp)
callq 0x2130
movq -0x4a0(%rbp), %rcx
movq -0x4c0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x498(%rbp)
jne 0x5e8f
jmp 0x5f08
movq -0x4b0(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x4c8(%rbp)
callq 0x2130
movq -0x4b8(%rbp), %rcx
movq -0x4c8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4b0(%rbp)
jne 0x5ec2
leaq -0x30(%rbp), %rdi
callq 0x78e0
movl -0x4(%rbp), %eax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
leaq -0xb0(%rbp), %rax
movq %rax, -0x4d8(%rbp)
addq $0x80, %rax
movq %rax, -0x4d0(%rbp)
movq -0x4d0(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x2130
movq -0x4d8(%rbp), %rcx
movq -0x4e0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4d0(%rbp)
jne 0x5f23
jmp 0x5f56
leaq -0x30(%rbp), %rdi
callq 0x78e0
movq -0xc8(%rbp), %rdi
callq 0x23c0
nopl (%rax,%rax)