// File: /workspace/github_cpp_makefile_star2_O1/pawan231[P]MiniDataBase/include/create.h
// Function: create_table(char*, int)
table * create_table(char name[],int count){
	table *toreturn = new table();
	table *temp=new table();
	temp->fp=NULL;
	temp->blockbuf=NULL;
	strcpy(temp->name,name);
	temp->name[strlen(name)]='\0';
	temp->count=count;
	temp->rec_count=0;
	temp->data_size=0;

	//enter the data for columns of table
	int i=0;
	cout<<"Enter column name,Data type(1.int 2.varchar) and max size(max allowed int=6,char=99) of column\n";
	for(i=0;i<count;i++){
		string type;
		string size;
		//verify_input_size_and_type(type,size);
		cin>>temp->col[i].col_name>>type>>size;
		//check if entered datatype no. is correct
		if(type.length()>1){
			printf("\nwrong input(datatype should be (1=int or 2=varchar))\nexiting...\n\n");
			printf("-------------------------------------------------------------------------\n");
			return NULL;
		}else{
			if(type[0] == 49 || type[0] == 50){
				temp->col[i].type = type[0]-48;
			}else{
				printf("\nwrong input(datatype should be (1=int or 2=varchar))\nexiting...\n\n");
				printf("-------------------------------------------------------------------------\n");
				return NULL;
			}
		}
		//check size input;
		if(size.length() > 2){
			printf("\n123wrong input\nmax size(max allowed int=6,char=99), exiting...\n");
			printf("---------------------------------------------------------------------\n");
			return NULL;
		}else{
			if(type[0] == 49){
				if(size.length() > 1){
					printf("\n124wrong input, max size allowed for int = 6\nexiting...\n");
					printf("--------------------------------------------------------\n");
					return NULL;
				}else{
					if(size[0] > 48 && size[0] < 55){
						temp->col[i].size = size[0] -48;
					}else{
						printf("\n125wrong input, max size allowed for int = 6\nexiting...\n");
						printf("--------------------------------------------------------\n");
						return NULL;
					}
				}
			}else if(type[0] == 50){
				if(size[0] > 48 && size[0] < 58){
					if(size.length() == 1){
						temp->col[i].size = size[0] -48;
					}else if(size.length() == 2){
						temp->col[i].size = (size[0] - 48)*10 + (size[1] - 48);
					}else{
						printf("\nwrong input\nmax size(max allowed char=99), exiting...\n");
						printf("---------------------------------------------------------------------\n");
						return NULL;
					}
				}
			}
		}
	}
	if(i<count){
		printf("\n\tYou have not entered all details of columns\n\n");
		return NULL;
	}
	else{
		toreturn = temp;
		return toreturn;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebp
movq %rdi, %r14
movl $0x420, %edi            # imm = 0x420
callq 0x21a0
movq %rax, %rbx
leaq 0x3e4(%rax), %r15
xorl %r12d, %r12d
movl $0x420, %edx            # imm = 0x420
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r15, %rdi
movq %r14, %rsi
callq 0x2180
movq %r14, %rdi
callq 0x20b0
movb $0x0, 0x3e4(%rbx,%rax)
movl %ebp, 0x3e0(%rbx)
movl %r12d, 0x418(%rbx)
movl %r12d, 0x3fc(%rbx)
movq 0x518e(%rip), %rdi      # 0x8fd0
leaq 0x221c(%rip), %rsi      # 0x6065
movl $0x5f, %edx
callq 0x21e0
testl %ebp, %ebp
jle 0x4020
leaq 0x38(%rsp), %r15
movq %rbx, %r12
addq $0x7c, %r12
movl %ebp, %ebp
xorl %r14d, %r14d
movq 0x516d(%rip), %r13      # 0x8fe0
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movb %r14b, 0x18(%rsp)
movq %r15, 0x28(%rsp)
movq %r14, 0x30(%rsp)
movb %r14b, 0x38(%rsp)
movq %r13, %rdi
movq %r12, %rsi
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
callq 0x2320
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x2230
movq %rax, %rdi
leaq 0x28(%rsp), %rsi
callq 0x2230
cmpq $0x1, 0x10(%rsp)
ja 0x3fa7
movq 0x8(%rsp), %rax
movzbl (%rax), %ecx
leal -0x31(%rcx), %edx
cmpb $0x1, %dl
ja 0x3fa7
addl $-0x30, %ecx
movl %ecx, 0x14(%r12)
movq 0x30(%rsp), %rcx
cmpq $0x2, %rcx
ja 0x3fb7
movzbl (%rax), %eax
cmpl $0x32, %eax
je 0x3f28
cmpl $0x31, %eax
jne 0x3f51
cmpq $0x2, %rcx
je 0x3fc7
movq 0x28(%rsp), %rax
movzbl (%rax), %eax
leal -0x31(%rax), %ecx
cmpb $0x5, %cl
jbe 0x3f49
jmp 0x3fd0
movq 0x28(%rsp), %rdx
movzbl (%rdx), %eax
leal -0x31(%rax), %esi
cmpb $0x8, %sil
ja 0x3f51
cmpq $0x2, %rcx
je 0x3f96
cmpq $0x1, %rcx
jne 0x4032
addl $-0x30, %eax
movl %eax, 0x18(%r12)
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x3f68
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3f84
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
addq $0x1c, %r12
decq %rbp
jne 0x3e73
jmp 0x4020
leal (%rax,%rax,4), %eax
movsbl 0x1(%rdx), %ecx
leal (%rcx,%rax,2), %eax
addl $0xfffffdf0, %eax       # imm = 0xFFFFFDF0
jmp 0x3f4c
leaq 0x2885(%rip), %rbx      # 0x6833
leaq 0x2adb(%rip), %rdi      # 0x6a90
jmp 0x3fde
leaq 0x2a92(%rip), %rdi      # 0x6a50
leaq 0x2872(%rip), %rbx      # 0x6837
jmp 0x3fde
leaq 0x2a49(%rip), %rdi      # 0x6a17
jmp 0x3fd7
leaq 0x2a07(%rip), %rdi      # 0x69de
leaq 0x2866(%rip), %rbx      # 0x6844
callq 0x22d0
movq %rbx, %rdi
callq 0x22d0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4002
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x401e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x296e(%rip), %rdi      # 0x69a7
jmp 0x3fbe
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4055
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4071
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2340