// File: /workspace/github_c_makefile_star2_O0/mmayer[P]pcal/src/pcalutil.c
// Function: mk_filespec
char *mk_filespec (char *filespec, char *path, char *name)
{
   char *p;
   
   *filespec = '\0';
   
   /* copy name intact if absolute; else merge path and relative name */
   
   /* if name starts with "~/", translate it for user */
   if (strncmp(name, "~/", 2) == 0 && (p = getenv(HOME_DIR)) != NULL) {
      strcpy(filespec, p);
      TERM_PATH(filespec);
      name += 2;   /* skip "~/" */
   }
   else if (*name != START_PATH) {   /* relative path */
      /* if path starts with "~/", translate it for user */
      if (strncmp(path, "~/", 2) == 0 && (p = getenv(HOME_DIR)) != NULL) {
         strcpy(filespec, p);
         TERM_PATH(filespec);
         path += 2;   /* skip "~/"; append rest below */
      }
      strcat(filespec, path);
      TERM_PATH(filespec);
   }
   
   return strcat(filespec, name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rdi
leaq 0x17112(%rip), %rsi     # 0x24668
movl $0x2, %edx
callq 0x5070
cmpl $0x0, %eax
jne 0xd623
leaq 0xeba5(%rip), %rdi      # 0x1c115
callq 0x5030
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xd623
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x5080
cmpq $0x0, -0x8(%rbp)
je 0xd5c8
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xd5c8
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x50e0
movq %rax, %rcx
movq -0x48(%rbp), %rax
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xd5d0
xorl %eax, %eax
movq %rax, -0x40(%rbp)
jmp 0xd5d0
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xd610
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0xd610
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x2f, 0x1(%rax)
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x0, 0x1(%rax)
jmp 0xd612
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
jmp 0xd799
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0xd797
movq -0x10(%rbp), %rdi
leaq 0x1702a(%rip), %rsi     # 0x24668
movl $0x2, %edx
callq 0x5070
cmpl $0x0, %eax
jne 0xd706
leaq 0xeabd(%rip), %rdi      # 0x1c115
callq 0x5030
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xd706
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x5080
cmpq $0x0, -0x8(%rbp)
je 0xd6b0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xd6b0
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
callq 0x50e0
movq %rax, %rcx
movq -0x58(%rbp), %rax
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0xd6b8
xorl %eax, %eax
movq %rax, -0x50(%rbp)
jmp 0xd6b8
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xd6f8
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0xd6f8
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb $0x2f, 0x1(%rax)
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb $0x0, 0x1(%rax)
jmp 0xd6fa
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5290
cmpq $0x0, -0x8(%rbp)
je 0xd74b
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xd74b
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
callq 0x50e0
movq %rax, %rcx
movq -0x68(%rbp), %rax
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0xd753
xorl %eax, %eax
movq %rax, -0x60(%rbp)
jmp 0xd753
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0xd793
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0xd793
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x2f, 0x1(%rax)
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x0, 0x1(%rax)
jmp 0xd795
jmp 0xd797
jmp 0xd799
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5290
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)