// File: 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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x420, %edi            # imm = 0x420
callq 0x21b0
movq %rax, %rdi
movq %rdi, -0x98(%rbp)
xorl %esi, %esi
movl $0x420, %edx            # imm = 0x420
callq 0x20e0
movq -0x98(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x420, %edi            # imm = 0x420
callq 0x21b0
movq %rax, %rdi
movq %rdi, -0x90(%rbp)
xorl %esi, %esi
movl $0x420, %edx            # imm = 0x420
callq 0x20e0
movq -0x90(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq $0x0, 0x408(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x410(%rax)
movq -0x28(%rbp), %rdi
addq $0x3e4, %rdi            # imm = 0x3E4
movq -0x10(%rbp), %rsi
callq 0x2180
movq -0x28(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20a0
movq %rax, %rcx
movq -0x88(%rbp), %rax
movb $0x0, 0x3e4(%rax,%rcx)
movl -0x14(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x3e0(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x418(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x3fc(%rax)
movl $0x0, -0x2c(%rbp)
movq 0xcba9(%rip), %rdi      # 0xffd0
leaq 0x7c4f(%rip), %rsi      # 0xb07d
callq 0x2190
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x38fe
leaq -0x50(%rbp), %rdi
callq 0x2270
leaq -0x70(%rbp), %rdi
callq 0x2270
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rdx
leaq (%rdx,%rdx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rdx, %rcx
leaq 0x7c(%rax,%rcx), %rsi
movq 0xcb69(%rip), %rdi      # 0xffe0
callq 0x5f30
movq %rax, -0xa0(%rbp)
jmp 0x3485
movq -0xa0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2240
movq %rax, -0xa8(%rbp)
jmp 0x349e
movq -0xa8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2240
jmp 0x34b0
leaq -0x50(%rbp), %rdi
callq 0x22e0
cmpq $0x1, %rax
jbe 0x3516
leaq 0x7c17(%rip), %rdi      # 0xb0dd
xorl %eax, %eax
callq 0x2030
jmp 0x34cf
leaq 0x7c4a(%rip), %rdi      # 0xb120
xorl %eax, %eax
callq 0x2030
jmp 0x34df
movq $0x0, -0x8(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x38d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2110
leaq -0x50(%rbp), %rdi
callq 0x2110
jmp 0x393b
xorl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x23a0
movq %rax, -0xb0(%rbp)
jmp 0x352c
movq -0xb0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
je 0x3560
xorl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x23a0
movq %rax, -0xb8(%rbp)
jmp 0x3551
movq -0xb8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x32, %eax
jne 0x359b
xorl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x23a0
movq %rax, -0xc0(%rbp)
jmp 0x3576
movq -0xc0(%rbp), %rax
movsbl (%rax), %ecx
subl $0x30, %ecx
movq -0x28(%rbp), %rax
addq $0x7c, %rax
movslq -0x2c(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
jmp 0x35cf
leaq 0x7b3b(%rip), %rdi      # 0xb0dd
xorl %eax, %eax
callq 0x2030
jmp 0x35ab
leaq 0x7b6e(%rip), %rdi      # 0xb120
xorl %eax, %eax
callq 0x2030
jmp 0x35bb
movq $0x0, -0x8(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x38d1
jmp 0x35d1
leaq -0x70(%rbp), %rdi
callq 0x22e0
cmpq $0x2, %rax
jbe 0x3614
leaq 0x7b84(%rip), %rdi      # 0xb16b
xorl %eax, %eax
callq 0x2030
jmp 0x35f0
leaq 0x7b2d(%rip), %rdi      # 0xb124
xorl %eax, %eax
callq 0x2030
jmp 0x3600
movq $0x0, -0x8(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x38d1
xorl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x23a0
movq %rax, -0xc8(%rbp)
jmp 0x362a
movq -0xc8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0x3740
leaq -0x70(%rbp), %rdi
callq 0x22e0
cmpq $0x1, %rax
jbe 0x3680
leaq 0x7b59(%rip), %rdi      # 0xb1ac
xorl %eax, %eax
callq 0x2030
jmp 0x365c
leaq 0x7ace(%rip), %rdi      # 0xb131
xorl %eax, %eax
callq 0x2030
jmp 0x366c
movq $0x0, -0x8(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x38d1
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x23a0
movq %rax, -0xd0(%rbp)
jmp 0x3696
movq -0xd0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jle 0x3705
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x23a0
movq %rax, -0xd8(%rbp)
jmp 0x36bb
movq -0xd8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x37, %eax
jge 0x3705
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x23a0
movq %rax, -0xe0(%rbp)
jmp 0x36e0
movq -0xe0(%rbp), %rax
movsbl (%rax), %ecx
subl $0x30, %ecx
movq -0x28(%rbp), %rax
addq $0x7c, %rax
movslq -0x2c(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
jmp 0x3739
leaq 0x7ada(%rip), %rdi      # 0xb1e6
xorl %eax, %eax
callq 0x2030
jmp 0x3715
leaq 0x7a15(%rip), %rdi      # 0xb131
xorl %eax, %eax
callq 0x2030
jmp 0x3725
movq $0x0, -0x8(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x38d1
jmp 0x373b
jmp 0x38c8
xorl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
callq 0x23a0
movq %rax, -0xe8(%rbp)
jmp 0x3756
movq -0xe8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x32, %eax
jne 0x38c6
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x23a0
movq %rax, -0xf0(%rbp)
jmp 0x377f
movq -0xf0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jle 0x38c4
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x23a0
movq %rax, -0xf8(%rbp)
jmp 0x37a8
movq -0xf8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jge 0x38c4
leaq -0x70(%rbp), %rdi
callq 0x22e0
cmpq $0x1, %rax
jne 0x3808
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x23a0
movq %rax, -0x100(%rbp)
jmp 0x37e0
movq -0x100(%rbp), %rax
movsbl (%rax), %ecx
subl $0x30, %ecx
movq -0x28(%rbp), %rax
addq $0x7c, %rax
movslq -0x2c(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
jmp 0x38c2
leaq -0x70(%rbp), %rdi
callq 0x22e0
cmpq $0x2, %rax
jne 0x388f
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x23a0
movq %rax, -0x108(%rbp)
jmp 0x382d
movq -0x108(%rbp), %rax
movsbl (%rax), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %ecx
movl %ecx, %eax
leal -0x1e0(%rax,%rax), %eax
movl %eax, -0x114(%rbp)
leaq -0x70(%rbp), %rdi
movl $0x1, %esi
callq 0x23a0
movq %rax, -0x110(%rbp)
jmp 0x3862
movl -0x114(%rbp), %ecx
movq -0x110(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
addl %eax, %ecx
movq -0x28(%rbp), %rax
addq $0x7c, %rax
movslq -0x2c(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
jmp 0x38c0
leaq 0x798a(%rip), %rdi      # 0xb220
xorl %eax, %eax
callq 0x2030
jmp 0x389f
leaq 0x787e(%rip), %rdi      # 0xb124
xorl %eax, %eax
callq 0x2030
jmp 0x38af
movq $0x0, -0x8(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x38d1
jmp 0x38c2
jmp 0x38c4
jmp 0x38c6
jmp 0x38c8
jmp 0x38ca
movl $0x0, -0x80(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2110
leaq -0x50(%rbp), %rdi
callq 0x2110
movl -0x80(%rbp), %eax
testl %eax, %eax
je 0x38ee
jmp 0x38ec
jmp 0x392e
jmp 0x38f0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x343a
movl -0x2c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x391e
leaq 0x794b(%rip), %rdi      # 0xb258
movb $0x0, %al
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0x392e
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)