// File: /workspace/github_cpp_makefile_star2_O3/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 0x5200(%rip), %rdi      # 0x8fd0
leaq 0x228e(%rip), %rsi      # 0x6065
movl $0x5f, %edx
callq 0x21e0
testl %ebp, %ebp
jle 0x3fc6
leaq 0x38(%rsp), %r15
movq %rbx, %r12
addq $0x7c, %r12
movl %ebp, %ebp
xorl %r14d, %r14d
movq 0x51df(%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 0x3f4d
movq 0x8(%rsp), %rdi
movzbl (%rdi), %eax
leal -0x31(%rax), %ecx
cmpb $0x1, %cl
ja 0x3f4d
addl $-0x30, %eax
movl %eax, 0x14(%r12)
movq 0x30(%rsp), %rcx
cmpq $0x2, %rcx
ja 0x3f5d
movzbl (%rdi), %eax
cmpl $0x31, %eax
je 0x3ec6
cmpl $0x32, %eax
jne 0x3eee
movq 0x28(%rsp), %rax
movzbl (%rax), %edx
leal -0x31(%rdx), %esi
cmpb $0x8, %sil
ja 0x3ef3
cmpq $0x2, %rcx
je 0x3f36
cmpq $0x1, %rcx
jne 0x3fd8
addl $-0x30, %edx
movl %edx, 0x18(%r12)
jmp 0x3ef3
cmpq $0x2, %rcx
je 0x3f6d
movq 0x28(%rsp), %rax
movzbl (%rax), %ecx
leal -0x31(%rcx), %edx
cmpb $0x5, %dl
ja 0x3f76
addl $-0x30, %ecx
movl %ecx, 0x18(%r12)
jmp 0x3ef3
movq 0x28(%rsp), %rax
cmpq %r15, %rax
je 0x3f0d
movq 0x38(%rsp), %rsi
incq %rsi
movq %rax, %rdi
callq 0x21b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3f24
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
addq $0x1c, %r12
decq %rbp
jne 0x3e01
jmp 0x3fc6
leal (%rdx,%rdx,4), %ecx
movsbl 0x1(%rax), %edx
leal (%rdx,%rcx,2), %ecx
addl $0xfffffdf0, %ecx       # imm = 0xFFFFFDF0
movl %ecx, 0x18(%r12)
jmp 0x3ef3
leaq 0x28df(%rip), %rbx      # 0x6833
leaq 0x2b35(%rip), %rdi      # 0x6a90
jmp 0x3f84
leaq 0x2aec(%rip), %rdi      # 0x6a50
leaq 0x28cc(%rip), %rbx      # 0x6837
jmp 0x3f84
leaq 0x2aa3(%rip), %rdi      # 0x6a17
jmp 0x3f7d
leaq 0x2a61(%rip), %rdi      # 0x69de
leaq 0x28c0(%rip), %rbx      # 0x6844
callq 0x22d0
movq %rbx, %rdi
callq 0x22d0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x3fa8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3fc4
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 0x29c8(%rip), %rdi      # 0x69a7
jmp 0x3f64
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x3ffb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4017
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2340