// File: /workspace/github_cpp_makefile_star2_O2/wwdatabase[P]database/./smmana/sm.h
// Function: SM_Manager::create_table(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, int*, int*, int*, int, int)
RC SM_Manager::create_table(const char* tablename,string attrname[],int attrtype[],int len[],int isnull[],int attrnum,int prim_key)//create two files
{
	table_entry tb;
	strcpy(tb.tablename,tablename);
	tb.prikeyNum = prim_key;
	tb.attrNum = attrnum;
	int record_size = attrnum/8+1;
	for(int i = 0;i < attrnum;i++)
	{
		switch(attrtype[i])
		{
			case ATTRINT :
				record_size+=4;
				tb.attrName.push_back(attrname[i]);
				tb.attrType.push_back(ATTRINT);
				tb.attrLength.push_back(4);
				tb.isNull.push_back(isnull[i]);
				break;
			case ATTRFLOAT:
				record_size+=4;
				tb.attrName.push_back(attrname[i]);
				tb.attrType.push_back(ATTRFLOAT);
				tb.attrLength.push_back(4);
				tb.isNull.push_back(isnull[i]);
				break;
			case ATTRSTRING:
				record_size+=len[i];
				tb.attrName.push_back(attrname[i]);
				tb.attrType.push_back(ATTRSTRING);
				tb.attrLength.push_back(len[i]);
				tb.isNull.push_back(isnull[i]);
				break;
			default:
				printf("Blackman question mark?\n");
				break;
		}
	}
	tb.recordSize = record_size;
	databases[current_db_index].table.push_back(tb);
	string create_location(databases[current_db_index].dbname);
	create_location  = create_location+"/"+tb.tablename;
	record_manager->createFile(create_location.c_str(),record_size,tb.attrType,tb.attrLength,tb.isNull,tb.prikeyNum);
	create_location  = create_location + ".www";
	//freopen(create_location.c_str(),"w",stdout);
	ofstream file1(create_location.c_str());
	file1 << tb.tablename << endl << tb.attrNum << " " << tb.prikeyNum<<" " <<tb.recordSize<< endl;
	//printf("%s\n%d %d\n",tb.tablename,tb.attrNum,tb.prikeyNum);
	for(int i = 0;i < tb.attrNum;i++)
	{
		file1 << tb.attrName[i] <<" "<<tb.attrType[i] <<" "<<tb.attrLength[i]<<" "<<tb.isNull[i]<< endl;
		//printf("%s %d %d %d\n",tb.attrName[i].c_str(),tb.attrType[i],tb.attrLength[i],tb.isNull[i]);
	}
	file1.close();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movq %r9, -0x30(%rbp)
movq %r8, -0x40(%rbp)
movq %rcx, %r12
movq %rdx, %r13
movq %rdi, -0x48(%rbp)
movl 0x10(%rbp), %r15d
movl 0x18(%rbp), %r14d
leaq -0x110(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x180(%rbp), %rbx
movq %rbx, %rdi
callq 0x21a0
movl %r14d, 0x6c(%rbx)
movl %r15d, 0x68(%rbx)
pushq $0x8
popq %rcx
movl %r15d, %eax
cltd
idivl %ecx
movl %eax, %ebx
incl %ebx
xorl %r14d, %r14d
testl %r15d, %r15d
cmovlel %r14d, %r15d
shlq $0x2, %r15
movq %r12, -0x38(%rbp)
cmpq %r14, %r15
je 0x38d3
movl (%r12,%r14), %eax
cmpl $0x3, %eax
je 0x385c
cmpl $0x2, %eax
je 0x37f7
cmpl $0x1, %eax
jne 0x38ba
leaq -0x110(%rbp), %rdi
movq %r13, %rsi
callq 0x494a
movl $0x1, -0x3a0(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x3a0(%rbp), %r12
movq %r12, %rsi
callq 0x5eae
movl $0x4, -0x3a0(%rbp)
leaq -0xe0(%rbp), %rdi
movq %r12, %rsi
callq 0x5eae
movq -0x30(%rbp), %rax
leaq (%rax,%r14), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x4a88
movq -0x38(%rbp), %r12
jmp 0x3857
leaq -0x110(%rbp), %rdi
movq %r13, %rsi
callq 0x494a
movl $0x2, -0x3a0(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x3a0(%rbp), %r12
movq %r12, %rsi
callq 0x5eae
movl $0x4, -0x3a0(%rbp)
leaq -0xe0(%rbp), %rdi
movq %r12, %rsi
callq 0x5eae
movq -0x30(%rbp), %rax
leaq (%rax,%r14), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x4a88
movq -0x38(%rbp), %r12
addl $0x4, %ebx
jmp 0x38c6
movq -0x40(%rbp), %rax
addl (%rax,%r14), %ebx
leaq -0x110(%rbp), %rdi
movq %r13, %rsi
callq 0x494a
movl $0x3, -0x3a0(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x5eae
movq -0x40(%rbp), %rax
leaq (%rax,%r14), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x4a88
movq -0x30(%rbp), %rax
leaq (%rax,%r14), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x4a88
jmp 0x38c6
leaq 0x3bfe(%rip), %rdi      # 0x74bf
callq 0x22e0
addq $0x4, %r14
addq $0x20, %r13
jmp 0x3771
leaq -0x180(%rbp), %rsi
movl %ebx, 0x64(%rsi)
movq -0x48(%rbp), %r12
movslq 0x18(%r12), %rax
movq (%r12), %rcx
imulq $0x118, %rax, %rax      # imm = 0x118
leaq (%rcx,%rax), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x4aae
movslq 0x18(%r12), %rax
imulq $0x118, %rax, %rsi      # imm = 0x118
addq (%r12), %rsi
leaq -0x68(%rbp), %rdi
leaq -0x3a0(%rbp), %rdx
callq 0x46c6
leaq 0x39b9(%rip), %rdx      # 0x72e1
leaq -0x1a0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4b15
leaq -0x3a0(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x180(%rbp), %rdx
callq 0x4aec
leaq -0x68(%rbp), %r15
leaq -0x3a0(%rbp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x2220
movq %r14, %rdi
callq 0x20b0
leaq -0x1a0(%rbp), %rdi
callq 0x20b0
movq 0x20(%r12), %r14
movq (%r15), %r15
leaq -0xb0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x4b4e
leaq -0x98(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x4b4e
leaq -0x80(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4b4e
movl -0x114(%rbp), %eax
movl %eax, (%rsp)
leaq -0xb0(%rbp), %rcx
leaq -0x98(%rbp), %r8
leaq -0x80(%rbp), %r9
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x2c78
leaq -0x80(%rbp), %rdi
callq 0x5c7e
leaq -0x98(%rbp), %rdi
callq 0x5c7e
leaq -0xb0(%rbp), %rdi
callq 0x5c7e
leaq 0x38d9(%rip), %rdx      # 0x72e3
leaq -0x3a0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4b15
leaq -0x68(%rbp), %rbx
leaq -0x3a0(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2220
movq %r14, %rdi
callq 0x20b0
movq (%rbx), %rsi
leaq -0x3a0(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x2200
leaq -0x3a0(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movl -0x118(%rbp), %esi
movq %rax, %rdi
callq 0x2320
leaq 0x363e(%rip), %rsi      # 0x70b8
movq %rax, %rdi
callq 0x21b0
movl -0x114(%rbp), %esi
movq %rax, %rdi
callq 0x2320
leaq 0x3621(%rip), %rsi      # 0x70b8
movq %rax, %rdi
callq 0x21b0
movl -0x11c(%rbp), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
callq 0x20d0
xorl %r15d, %r15d
leaq -0x3a0(%rbp), %rbx
leaq 0x35f2(%rip), %r14      # 0x70b8
xorl %r12d, %r12d
movslq -0x118(%rbp), %rax
cmpq %rax, %r12
jge 0x3b59
movq -0x110(%rbp), %rsi
addq %r15, %rsi
movq %rbx, %rdi
callq 0x2190
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
movq -0xf8(%rbp), %rcx
movl (%rcx,%r12,4), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
movq -0xe0(%rbp), %rcx
movl (%rcx,%r12,4), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
movq -0xc8(%rbp), %rcx
movl (%rcx,%r12,4), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
callq 0x20d0
incq %r12
addq $0x20, %r15
jmp 0x3ac9
leaq -0x3a0(%rbp), %rdi
callq 0x2270
leaq -0x3a0(%rbp), %rdi
callq 0x22a0
leaq -0x68(%rbp), %rdi
callq 0x20b0
leaq -0x180(%rbp), %rdi
callq 0x4ba6
xorl %eax, %eax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3be1
jmp 0x3be1
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x5c7e
jmp 0x3baf
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x5c7e
jmp 0x3bc0
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x5c7e
jmp 0x3c0a
jmp 0x3be1
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x20b0
jmp 0x3c0a
movq %rax, %rbx
jmp 0x3c0a
jmp 0x3bf6
jmp 0x3bf6
jmp 0x3bf6
jmp 0x3bf6
jmp 0x3bf6
jmp 0x3bf6
jmp 0x3bf6
jmp 0x3bfb
movq %rax, %rbx
jmp 0x3c13
movq %rax, %rbx
leaq -0x3a0(%rbp), %rdi
callq 0x22a0
leaq -0x68(%rbp), %rdi
callq 0x20b0
leaq -0x180(%rbp), %rdi
callq 0x4ba6
movq %rbx, %rdi
callq 0x2330
nop