// File: /workspace/github_c_makefile_star2_O0/sonicse[P]dbf2mysql/dbf.c
// Function: dbf_build_record
field *dbf_build_record(dbhead *dbh)
{
    int 	t;
    field	*fields;
  
    if (!(fields = (field *)calloc(dbh->db_nfields, sizeof(field)))) {
	return (field *)DBF_ERROR;
    }
  
    for ( t = 0; t < dbh->db_nfields; t++)
    {
	switch(dbh->db_fields[t].db_type)
	{
	  case 'M':
	    fields[t].db_blen = dbh->mb_blksiz + 1;
	    break;

	  case 'B':
	  case 'Y':
	    fields[t].db_blen = 26;
	    break;

	  case 'T':
	    fields[t].db_blen = 24;
	    break;

	  case 'I':
	    fields[t].db_blen = 16;
	    break;

	  case 'G':
	  case 'P':
	    fields[t].db_blen = dbh->mb_blksiz * 2 + 2; /* Binary to hex representation */
	    break;

	  default:
	    fields[t].db_blen = dbh->db_fields[t].db_flen + 1;
	}

	if (!(fields[t].db_contents = (char *)malloc(fields[t].db_blen)))
	{
	    int		i;
	    for (i = 0; i < t; i++)
		if (fields[i].db_contents != 0)
		    free(fields[i].db_contents);
	    free(fields);
	    return (field *)DBF_ERROR;
	}
	strncpy(fields[t].db_name, dbh->db_fields[t].db_name, DBF_NAMELEN);
	fields[t].db_type = dbh->db_fields[t].db_type;
	//printf("TYPE: %d NAME: %s LEN: %d\n",dbh->db_fields[t].db_type, dbh->db_fields[t].db_name,dbh->db_fields[t].db_flen); 
	fields[t].db_flen = dbh->db_fields[t].db_flen;
	fields[t].db_dec  = dbh->db_fields[t].db_dec;
    } 
    return fields;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x32(%rax), %eax
movl %eax, %edi
movl $0x20, %esi
callq 0x2130
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x681a
movq $-0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x6a87
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x32(%rcx), %ecx
cmpl %ecx, %eax
jge 0x6a7f
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x14(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq (%rcx,%rcx,2), %rcx
movzbl 0xb(%rax,%rcx), %eax
addl $-0x42, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x17, %eax
ja 0x6909
movq -0x30(%rbp), %rax
leaq 0x22ba(%rip), %rcx      # 0x8b24
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rcx
addq $0x1, %rcx
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
jmp 0x6939
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq $0x1a, 0x10(%rax)
jmp 0x6939
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq $0x18, 0x10(%rax)
jmp 0x6939
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq $0x10, 0x10(%rax)
jmp 0x6939
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rcx
shlq %rcx
addq $0x2, %rcx
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
jmp 0x6939
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0xf, %rcx, %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
addl $0x1, %eax
movslq %eax, %rcx
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0x2260
movq -0x20(%rbp), %rcx
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movq %rax, 0x18(%rcx)
cmpq $0x0, %rax
jne 0x69cd
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x69b4
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x18(%rax)
je 0x69a7
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
callq 0x2210
jmp 0x69a9
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6971
movq -0x20(%rbp), %rdi
callq 0x2210
movq $-0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x6a87
movq -0x20(%rbp), %rdi
movslq -0x14(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
movslq -0x14(%rbp), %rax
imulq $0xf, %rax, %rax
addq %rax, %rsi
movl $0xb, %edx
callq 0x2100
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0xf, %rcx, %rcx
addq %rcx, %rax
movb 0xb(%rax), %cl
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movb %cl, 0xb(%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0xf, %rcx, %rcx
addq %rcx, %rax
movb 0xc(%rax), %cl
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movb %cl, 0xc(%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0xf, %rcx, %rcx
addq %rcx, %rax
movb 0xd(%rax), %cl
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movb %cl, 0xd(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6821
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)