// File: /workspace/github_cpp_makefile_star2_O3/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 0x13a7d
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 0xc7fc(%rip), %r14      # 0x20260
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2130
movb $0x0, -0x1(%r13,%r14)
movq %rbx, %r13
jmp 0x13a84
movb $0x0, 0xc7dc(%rip)      # 0x20260
cmpb $0x3c, (%r13)
jne 0x13afd
movq %r13, %rdi
movl $0x3e, %esi
callq 0x21c0
testq %rax, %rax
je 0x13afd
movq %rax, %rbx
movq %r13, %r15
leaq 0xc7b6(%rip), %r13      # 0x20260
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 0x13b53
leaq 0xc755(%rip), %r12      # 0x20260
movq %r12, %rdi
callq 0x2080
cmpq $0x103, %rax            # imm = 0x103
ja 0x13b53
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 0x13bd6
leaq -0x150(%rbp), %rax
leaq -0x40(%rbp), %rdi
movq %rax, (%rdi)
leaq 0x5199(%rip), %rsi      # 0x18d08
movq -0x38(%rbp), %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x12e1e
leaq 0xc6dc(%rip), %rbx      # 0x20260
movq %rbx, %rdi
callq 0x2080
cmpq $0x103, %rax            # imm = 0x103
ja 0x13c21
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 0x13c21
leaq 0xc683(%rip), %r14      # 0x20260
movq %r14, %rdi
callq 0x2080
cmpq $0x103, %rax            # imm = 0x103
ja 0x13c21
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 0xc638(%rip), %rax      # 0x20260
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq