// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dataset.c
// Function: convert_byte_format_to_dataset_format
void convert_byte_format_to_dataset_format(char* inputfile, char separator, char* featuretypes, char* lengths, char* useful, char* outputfile)
{
 /*!Last Changed 20.05.2005*/
 FILE *infile1, *infile2, *outfile;
 char myline[READLINELENGTH], feature[READLINELENGTH], pst[READLINELENGTH];
 int *ftypes, fcount, i, *fsizes, *available, *fstart, tmp;
 double tmpr;
 infile1 = fopen(featuretypes, "r");
 if (!infile1)
   return;
 infile2 = fopen(lengths, "r");
 if (!infile2)
   return;
 fcount = file_length(featuretypes);
 ftypes = safemalloc(fcount * sizeof(int), "convert_byte_format_to_dataset_format", 6);
 fsizes = safemalloc(fcount * sizeof(int), "convert_byte_format_to_dataset_format", 7);
 fstart = safemalloc(fcount * sizeof(int), "convert_byte_format_to_dataset_format", 8);
 available = safecalloc(fcount, sizeof(int), "convert_byte_format_to_dataset_format", 9);
 i = 0;
 fstart[0] = 0;
 while (fgets(myline, READLINELENGTH, infile1))
  {
   tmp = strlen(myline);
   myline[tmp - 1] = '\0';
   ftypes[i] = listindex(myline, ftype, 3);
   fgets(myline, READLINELENGTH, infile2);
   fsizes[i] = atoi(myline);
   if (i > 0)
     fstart[i] = fstart[i - 1] + fsizes[i - 1];
   i++;
  }
 fclose(infile1);
 fclose(infile2);
 infile1 = fopen(useful, "r");
 if (!infile1)
   return;
 while (fgets(myline, READLINELENGTH, infile1))
  {
   i = atoi(myline);
   available[i] = 1;
  }
 fclose(infile1);
 infile1 = fopen(inputfile, "r");
 if (!infile1)
   return;
 outfile = fopen(outputfile, "w");
 if (!outfile)
  {
   printf(m1248, outputfile);
   return;
  }
 while (fgets(myline, READLINELENGTH, infile1))
  {
   for (i = 0; i < fcount; i++)
     if (available[i])
      {
       memcpy(feature, &(myline[fstart[i]]), fsizes[i]);
       feature[fsizes[i]] = '\0';
       switch (ftypes[i])
        {
         case 0 :tmp = atoi(feature);
                 fprintf(outfile, "%d%c", tmp, separator);
                 break;
         case 1 :fprintf(outfile, "%s%c", feature, separator);
                 break;
         case 2 :tmpr = atof(feature);
                 set_precision(pst, NULL, "%c");
                 fprintf(outfile, pst, tmpr, separator);
                 break;
         default:printf(m1236, ftypes[i]);
                 break;
        }
      }
   fprintf(outfile, "\n");
  }
 fclose(infile1);
 fclose(outfile);
 safe_free(ftypes);
 safe_free(fsizes);
 safe_free(available);
 safe_free(fstart);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x16e3f0, %rsp         # imm = 0x16E3F0
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xccfe6(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1b1d5
jmp 0x1b67f
movq -0x20(%rbp), %rdi
leaq 0xccfc6(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x1b1f5
jmp 0x1b67f
movq -0x18(%rbp), %rdi
callq 0x50f90
movl %eax, -0x16e3bc(%rbp)
movslq -0x16e3bc(%rbp), %rdi
shlq $0x2, %rdi
leaq 0xc7f8a(%rip), %rsi     # 0xe31a0
movl $0x6, %edx
callq 0x52d70
movq %rax, -0x16e3b8(%rbp)
movslq -0x16e3bc(%rbp), %rdi
shlq $0x2, %rdi
leaq 0xc7f67(%rip), %rsi     # 0xe31a0
movl $0x7, %edx
callq 0x52d70
movq %rax, -0x16e3c8(%rbp)
movslq -0x16e3bc(%rbp), %rdi
shlq $0x2, %rdi
leaq 0xc7f44(%rip), %rsi     # 0xe31a0
movl $0x8, %edx
callq 0x52d70
movq %rax, -0x16e3d8(%rbp)
movslq -0x16e3bc(%rbp), %rdi
movl $0x4, %esi
leaq 0xc7f20(%rip), %rdx     # 0xe31a0
movl $0x9, %ecx
callq 0x52f40
movq %rax, -0x16e3d0(%rbp)
movl $0x0, -0x16e3c0(%rbp)
movq -0x16e3d8(%rbp), %rax
movl $0x0, (%rax)
leaq -0x7a170(%rbp), %rdi
movq -0x38(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x1b3a5
leaq -0x7a170(%rbp), %rdi
callq 0x4150
movl %eax, -0x16e3dc(%rbp)
movl -0x16e3dc(%rbp), %eax
subl $0x1, %eax
cltq
movb $0x0, -0x7a170(%rbp,%rax)
leaq -0x7a170(%rbp), %rdi
leaq 0xe97b6(%rip), %rsi     # 0x104ab0
movl $0x3, %edx
callq 0x54910
movl %eax, %edx
movq -0x16e3b8(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
leaq -0x7a170(%rbp), %rdi
movq -0x40(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
leaq -0x7a170(%rbp), %rdi
callq 0x41c0
movl %eax, %edx
movq -0x16e3c8(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
cmpl $0x0, -0x16e3c0(%rbp)
jle 0x1b391
movq -0x16e3d8(%rbp), %rax
movl -0x16e3c0(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x16e3c8(%rbp), %rax
movl -0x16e3c0(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movq -0x16e3d8(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x16e3c0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e3c0(%rbp)
jmp 0x1b2a8
movq -0x38(%rbp), %rdi
callq 0x4250
movq -0x40(%rbp), %rdi
callq 0x4250
movq -0x28(%rbp), %rdi
leaq 0xccde4(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1b3d7
jmp 0x1b67f
jmp 0x1b3d9
leaq -0x7a170(%rbp), %rdi
movq -0x38(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x1b41d
leaq -0x7a170(%rbp), %rdi
callq 0x41c0
movl %eax, -0x16e3c0(%rbp)
movq -0x16e3d0(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
jmp 0x1b3d9
movq -0x38(%rbp), %rdi
callq 0x4250
movq -0x8(%rbp), %rdi
leaq 0xccd75(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1b446
jmp 0x1b67f
movq -0x30(%rbp), %rdi
leaq 0xccd6d(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x1b478
movq -0x30(%rbp), %rsi
leaq 0xc7d5a(%rip), %rdi     # 0xe31c6
movb $0x0, %al
callq 0x4030
jmp 0x1b67f
jmp 0x1b47a
leaq -0x7a170(%rbp), %rdi
movq -0x38(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x1b63d
movl $0x0, -0x16e3c0(%rbp)
movl -0x16e3c0(%rbp), %eax
cmpl -0x16e3bc(%rbp), %eax
jge 0x1b626
movq -0x16e3d0(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x1b610
movq -0x16e3d8(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
leaq -0x7a170(%rbp,%rax), %rsi
movq -0x16e3c8(%rbp), %rax
movslq (%rax,%rcx,4), %rdx
leaq -0xf4290(%rbp), %rdi
callq 0x42b0
movq -0x16e3c8(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movb $0x0, -0xf4290(%rbp,%rax)
movq -0x16e3b8(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x16e3ec(%rbp)
testl %eax, %eax
je 0x1b552
jmp 0x1b535
movl -0x16e3ec(%rbp), %eax
subl $0x1, %eax
je 0x1b585
jmp 0x1b542
movl -0x16e3ec(%rbp), %eax
subl $0x2, %eax
je 0x1b5a4
jmp 0x1b5ef
leaq -0xf4290(%rbp), %rdi
callq 0x41c0
movl %eax, -0x16e3dc(%rbp)
movq -0x48(%rbp), %rdi
movl -0x16e3dc(%rbp), %edx
movsbl -0x9(%rbp), %ecx
leaq 0xc7c72(%rip), %rsi     # 0xe31eb
movb $0x0, %al
callq 0x4280
jmp 0x1b60e
movq -0x48(%rbp), %rdi
leaq -0xf4290(%rbp), %rdx
movsbl -0x9(%rbp), %ecx
leaq 0xc7c55(%rip), %rsi     # 0xe31f0
movb $0x0, %al
callq 0x4280
jmp 0x1b60e
leaq -0xf4290(%rbp), %rdi
callq 0x4100
movsd %xmm0, -0x16e3e8(%rbp)
leaq -0x16e3b0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xcb34e(%rip), %rdx     # 0xe6918
callq 0x53310
movq -0x48(%rbp), %rdi
leaq -0x16e3b0(%rbp), %rsi
movsd -0x16e3e8(%rbp), %xmm0
movsbl -0x9(%rbp), %edx
movb $0x1, %al
callq 0x4280
jmp 0x1b60e
movq -0x16e3b8(%rbp), %rax
movslq -0x16e3c0(%rbp), %rcx
movl (%rax,%rcx,4), %esi
leaq 0xc7bee(%rip), %rdi     # 0xe31f5
movb $0x0, %al
callq 0x4030
jmp 0x1b610
jmp 0x1b612
movl -0x16e3c0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e3c0(%rbp)
jmp 0x1b4a3
movq -0x48(%rbp), %rdi
leaq 0xca70a(%rip), %rsi     # 0xe5d3b
movb $0x0, %al
callq 0x4280
jmp 0x1b47a
movq -0x38(%rbp), %rdi
callq 0x4250
movq -0x48(%rbp), %rdi
callq 0x4250
movq -0x16e3b8(%rbp), %rdi
callq 0x52e80
movq -0x16e3c8(%rbp), %rdi
callq 0x52e80
movq -0x16e3d0(%rbp), %rdi
callq 0x52e80
movq -0x16e3d8(%rbp), %rdi
callq 0x52e80
addq $0x16e3f0, %rsp         # imm = 0x16E3F0
popq %rbp
retq
nopl (%rax,%rax)