// File: /workspace/github_cpp_makefile_star2_O1/Fohlen[P]cubescript-standalone/stream.cpp
// Function: makerelpath(char const*, char const*, char const*, char const*)
char *makerelpath(const char *dir, const char *file, const char *prefix, const char *cmd)
{
    static string tmp;
    if(prefix) copystring(tmp, prefix);
    else tmp[0] = '\0';
    if(file[0]=='<')
    {
        const char *end = strrchr(file, '>');
        if(end)
        {
            size_t len = strlen(tmp);
            copystring(&tmp[len], file, min(sizeof(tmp)-len, size_t(end+2-file)));
            file = end+1;
        }
    }
    if(cmd) concatstring(tmp, cmd);
    if(dir)
    {
        defformatstring(pname)("%s/%s", dir, file);
        concatstring(tmp, pname);
    }
    else concatstring(tmp, file);
    return tmp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rcx, -0x30(%rbp)
movq %rsi, %r13
movq %rdi, -0x38(%rbp)
testq %rdx, %rdx
je 0x135cb
movq %rdx, %r12
movq %rdx, %rdi
callq 0x2080
movq %r13, %rbx
movq %rax, %r13
incq %r13
movl $0x104, %eax            # imm = 0x104
cmpq %rax, %r13
cmovaeq %rax, %r13
leaq 0xbcae(%rip), %r14      # 0x1f260
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2130
movb $0x0, -0x1(%r13,%r14)
movq %rbx, %r13
jmp 0x135d2
movb $0x0, 0xbc8e(%rip)      # 0x1f260
cmpb $0x3c, (%r13)
jne 0x1364b
movq %r13, %rdi
movl $0x3e, %esi
callq 0x21c0
testq %rax, %rax
je 0x1364b
movq %rax, %rbx
movq %r13, %r15
leaq 0xbc68(%rip), %r13      # 0x1f260
movq %r13, %rdi
callq 0x2080
addq %rax, %r13
movl $0x104, %ecx            # imm = 0x104
subq %rax, %rcx
movq %rbx, %r12
subq %r15, %r12
addq $0x2, %r12
cmpq %r12, %rcx
cmovbq %rcx, %r12
movq %r15, %rdi
callq 0x2080
movq %rax, %r14
incq %r14
cmpq %r12, %r14
cmovaeq %r12, %r14
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2130
movb $0x0, -0x1(%r14,%r13)
incq %rbx
movq %rbx, %r13
cmpq $0x0, -0x30(%rbp)
je 0x136a1
leaq 0xbc07(%rip), %r12      # 0x1f260
movq %r12, %rdi
callq 0x2080
cmpq $0x103, %rax            # imm = 0x103
ja 0x136a1
addq %rax, %r12
movl $0x104, %ebx            # imm = 0x104
subq %rax, %rbx
movq -0x30(%rbp), %r15
movq %r15, %rdi
callq 0x2080
movq %rax, %r14
incq %r14
cmpq %rbx, %r14
cmovaeq %rbx, %r14
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2130
movb $0x0, -0x1(%r14,%r12)
cmpq $0x0, -0x38(%rbp)
je 0x13724
leaq -0x150(%rbp), %rax
leaq -0x40(%rbp), %rdi
movq %rax, (%rdi)
leaq 0x44eb(%rip), %rsi      # 0x17ba8
movq -0x38(%rbp), %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x128d0
leaq 0xbb8e(%rip), %rbx      # 0x1f260
movq %rbx, %rdi
callq 0x2080
cmpq $0x103, %rax            # imm = 0x103
ja 0x1376f
addq %rax, %rbx
movl $0x104, %r12d           # imm = 0x104
subq %rax, %r12
leaq -0x150(%rbp), %r14
movq %r14, %rdi
callq 0x2080
movq %rax, %r15
incq %r15
cmpq %r12, %r15
cmovaeq %r12, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2130
movb $0x0, -0x1(%r15,%rbx)
jmp 0x1376f
leaq 0xbb35(%rip), %r14      # 0x1f260
movq %r14, %rdi
callq 0x2080
cmpq $0x103, %rax            # imm = 0x103
ja 0x1376f
addq %rax, %r14
movl $0x104, %ebx            # imm = 0x104
subq %rax, %rbx
movq %r13, %rdi
callq 0x2080
movq %rax, %r15
incq %r15
cmpq %rbx, %r15
cmovaeq %rbx, %r15
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x2130
movb $0x0, -0x1(%r15,%r14)
leaq 0xbaea(%rip), %rax      # 0x1f260
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq