// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/process.c
// Function: export_file_name
char* export_file_name(Datasetptr dataset, int exporttype, int runno, int foldno, int partno)
{
 /*!Last Changed 03.08.2006 added partno*/
 /*!Last Changed 31.10.2005*/
 char *fname, *st, converted[10];
 int i, len, len2, j = 0, k;
 fname = (char *)safemalloc(100, "definition_file_name", 2);
 st = exportfiletemplates[exporttype];
 len = strlen(st);
 if (len == 0)
  { 
   safe_free(fname);
   return NULL;
  }
 for (i = 0; i < len; i++)
   switch (st[i])
    {
     case 'D':len2 = strlen(dataset->name);
              for (k = 0; k < len2; k++, j++)
                fname[j] = dataset->name[k];
              break;
     case 'R':sprintf(converted, "%d", runno);
              len2 = strlen(converted);
              for (k = 0; k < len2; k++, j++)
                fname[j] = converted[k];
              break;
     case 'F':sprintf(converted, "%d", foldno);
              len2 = strlen(converted);
              for (k = 0; k < len2; k++, j++)
                fname[j] = converted[k];
              break;
     case 'P':sprintf(converted, "%d", partno);
              len2 = strlen(converted);
              for (k = 0; k < len2; k++, j++)
                fname[j] = converted[k];
              break;
     default :fname[j] = st[i];
              j++;
              break;
    }
 fname[j] = '\0';
 return fname;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, 0x18(%rsp)
movl %ecx, 0x14(%rsp)
movl %edx, 0x10(%rsp)
movl %esi, %ebp
movq %rdi, %r12
leaq 0x49aa7(%rip), %rsi     # 0xa7208
movl $0x64, %edi
movl $0x2, %edx
callq 0x3a0e1
movq %rax, %rbx
movslq %ebp, %rax
imulq $0x7a120, %rax, %rax    # imm = 0x7A120
leaq 0x7810c(%rip), %r13     # 0xd5890
addq %rax, %r13
movq %r13, %rdi
callq 0x4190
movq %rax, %rbp
testl %ebp, %ebp
je 0x5d8b1
xorl %eax, %eax
testl %ebp, %ebp
jle 0x5d8ab
movq %rbx, 0x8(%rsp)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
leaq 0x1e(%rsp), %r14
xorl %ebx, %ebx
xorl %r15d, %r15d
movq %rbp, (%rsp)
movsbl (%r13,%rbx), %eax
leal -0x44(%rax), %ecx
rorl %ecx
cmpl $0x7, %ecx
ja 0x5d889
leaq 0x4d6d8(%rip), %rdx     # 0xaaeb0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x8(%r12), %rdi
callq 0x4190
testl %eax, %eax
jle 0x5d897
movslq %r15d, %rcx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq 0x8(%rsp), %rcx
xorl %edx, %edx
movq 0x8(%r12), %rsi
movb (%rsi,%rdx), %sil
movb %sil, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5d802
addl %edx, %r15d
jmp 0x5d897
movq %r14, %rdi
leaq 0x533cf(%rip), %rsi     # 0xb0bf5
movl 0x18(%rsp), %edx
jmp 0x5d84a
movq %r14, %rdi
leaq 0x533bf(%rip), %rsi     # 0xb0bf5
movl 0x14(%rsp), %edx
jmp 0x5d84a
movq %r14, %rdi
leaq 0x533af(%rip), %rsi     # 0xb0bf5
movl 0x10(%rsp), %edx
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
callq 0x4190
movq %r14, %rbp
movq %rax, %r14
testl %r14d, %r14d
jle 0x5d880
movslq %r15d, %rdi
addq 0x8(%rsp), %rdi
movl %r14d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rbp, %rsi
callq 0x4310
addl %r14d, %r15d
movq %rbp, %r14
movq (%rsp), %rbp
jmp 0x5d897
movslq %r15d, %rcx
movq 0x8(%rsp), %rdx
movb %al, (%rdx,%rcx)
incl %r15d
incq %rbx
cmpq %rbp, %rbx
jne 0x5d7bd
movslq %r15d, %rax
movq 0x8(%rsp), %rbx
movb $0x0, (%rbx,%rax)
jmp 0x5d8bb
movq %rbx, %rdi
callq 0x3a180
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq