// File: /workspace/github_cpp_makefile_star2_O2/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, %r14d
movq %rdi, %r15
movl $0x420, %edi            # imm = 0x420
callq 0x21a0
movq %rax, %rbx
leaq 0x3e4(%rax), %r12
xorl %ebp, %ebp
movl $0x420, %edx            # imm = 0x420
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r12, %rdi
movq %r15, %rsi
callq 0x2170
movq %r15, %rdi
callq 0x20a0
movb $0x0, 0x3e4(%rbx,%rax)
movl %r14d, 0x3e0(%rbx)
andl $0x0, 0x418(%rbx)
andl $0x0, 0x3fc(%rbx)
movq 0x71d5(%rip), %rdi      # 0x9fd0
leaq 0x3263(%rip), %rsi      # 0x6065
callq 0x2180
movq %rbx, %r13
addq $0x7c, %r13
testl %r14d, %r14d
cmovlel %ebp, %r14d
leaq 0x28(%rsp), %r15
leaq 0x8(%rsp), %r12
subq $0x1, %r14
jb 0x2f82
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb %bpl, 0x38(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
movb %bpl, 0x18(%rsp)
movq 0x7186(%rip), %rdi      # 0x9fe0
movq %r13, %rsi
callq 0x459a
movq %rax, %rdi
movq %r15, %rsi
callq 0x2220
movq %rax, %rdi
movq %r12, %rsi
callq 0x2220
cmpq $0x1, 0x30(%rsp)
ja 0x2f28
movq 0x28(%rsp), %rax
movzbl (%rax), %ecx
leal -0x31(%rcx), %edx
cmpb $0x1, %dl
ja 0x2f28
addl $-0x30, %ecx
movl %ecx, 0x14(%r13)
movq 0x10(%rsp), %rcx
cmpq $0x2, %rcx
ja 0x2f38
movzbl (%rax), %eax
cmpl $0x32, %eax
je 0x2ed7
cmpl $0x31, %eax
jne 0x2eff
cmpq $0x2, %rcx
je 0x2f48
movq 0x8(%rsp), %rax
movzbl (%rax), %eax
leal -0x31(%rax), %ecx
cmpb $0x5, %cl
jbe 0x2ef8
jmp 0x2f51
movq 0x8(%rsp), %rdx
movzbl (%rdx), %eax
leal -0x31(%rax), %esi
cmpb $0x8, %sil
ja 0x2eff
cmpq $0x2, %rcx
je 0x2f18
cmpq $0x1, %rcx
jne 0x2f94
addl $-0x30, %eax
movl %eax, 0x18(%r13)
movq %r12, %rdi
callq 0x20b0
movq %r15, %rdi
callq 0x20b0
addq $0x1c, %r13
jmp 0x2e1f
imull $0xa, %eax, %eax
movsbl 0x1(%rdx), %ecx
addl %ecx, %eax
addl $0xfffffdf0, %eax       # imm = 0xFFFFFDF0
jmp 0x2efb
leaq 0x3904(%rip), %rbx      # 0x6833
leaq 0x3b5a(%rip), %rdi      # 0x6a90
jmp 0x2f5f
leaq 0x3b11(%rip), %rdi      # 0x6a50
leaq 0x38f1(%rip), %rbx      # 0x6837
jmp 0x2f5f
leaq 0x3ac8(%rip), %rdi      # 0x6a17
jmp 0x2f58
leaq 0x3a86(%rip), %rdi      # 0x69de
leaq 0x38e5(%rip), %rbx      # 0x6844
callq 0x22c0
movq %rbx, %rdi
callq 0x22c0
leaq 0x8(%rsp), %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
callq 0x20b0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3a0c(%rip), %rdi      # 0x69a7
jmp 0x2f3f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2320