// File: /workspace/github_cpp_makefile_star2_O1/corecodec[P]coremake/coremake.c
// Function: reader_filename
void reader_filename(reader* p, int dst_flags)
{
    assert((dst_flags & FLAG_PATH_MASK) != FLAG_PATH_NOT_PATH);
    if (stricmp(p->token,".")==0)
        p->token[0]='\0';

    if ((dst_flags & FLAG_PATH_SET_ABSOLUTE)==0 && ((p->token[0] != '$' || p->token[1] != '(') && p->token[0] != '/'))
    {
        char* end = getfilename(p->filename);
        while (p->token[0]=='.' && p->token[1]=='.' && end != p->filename)
        {
            char* i;
            for (i=end-1;i>p->filename;--i)
                if (i[-1]=='/')
                    break;

            strdel(p->token,p->token+2);
            if (p->token[0]=='/')
                strdel(p->token,p->token+1);

            end = i;
        }
        strins(p->token,p->filename,end);
        p->r.flags &= ~FLAG_PATH_MASK;
        p->r.flags |= p->r.filename_kind & FLAG_PATH_MASK;
        // adjust the pathes according to their modifier
        if ((dst_flags & FLAG_PATH_MASK) != (p->r.filename_kind & FLAG_PATH_MASK))
        {
            if (coremake_root_len || (dst_flags & FLAG_PATH_MASK) != FLAG_PATH_COREMAKE) // keep the full path to get the coremake_root
                reader_strip_abs(p);

            switch (dst_flags & FLAG_PATH_MASK)
            {
            case FLAG_PATH_GENERATED:
                strins(p->token,proj_root,NULL);
                break;
            case FLAG_PATH_COREMAKE:
                strins(p->token,coremake_root,NULL);
                break;
            case FLAG_PATH_SOURCE:
                strins(p->token,src_root,NULL);
                break;
            }
            p->r.flags &= ~FLAG_PATH_MASK;
            p->r.flags |= (dst_flags & FLAG_PATH_MASK);
        }
    }
    pathunix(p->token);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r13d
andl $0xf, %r13d
je 0x478f
movl %esi, %ebp
movq %rdi, %rbx
movq 0x30(%rdi), %r14
leaq 0xebd1(%rip), %rsi      # 0x131ab
movq %r14, %rdi
callq 0x2070
testl %eax, %eax
jne 0x45ea
movb $0x0, (%r14)
testb $0x10, %bpl
jne 0x4766
movq 0x30(%rbx), %rax
movzbl (%rax), %ecx
cmpl $0x2f, %ecx
je 0x4766
cmpl $0x24, %ecx
jne 0x461c
cmpb $0x2f, %cl
je 0x4766
cmpb $0x28, 0x1(%rax)
je 0x4766
movq 0x38(%rbx), %r15
movq %r15, %rdi
movl $0x2f, %esi
callq 0x2150
leaq 0x1(%rax), %r14
testq %rax, %rax
cmoveq %r15, %r14
movq 0x30(%rbx), %r15
cmpb $0x2e, (%r15)
jne 0x46ad
cmpb $0x2e, 0x1(%r15)
jne 0x46ad
movq 0x38(%rbx), %rax
cmpq %rax, %r14
je 0x46ad
decq %r14
movq %r14, %rcx
movq %rcx, %r14
cmpq %rax, %rcx
jbe 0x466b
leaq -0x1(%r14), %rcx
cmpb $0x2f, -0x1(%r14)
jne 0x4658
leaq 0x2(%r15), %r12
movq %r12, %rdi
callq 0x2120
leaq 0x1(%rax), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22d0
movq 0x30(%rbx), %r15
cmpb $0x2f, (%r15)
jne 0x4638
leaq 0x1(%r15), %r12
movq %r12, %rdi
callq 0x2120
leaq 0x1(%rax), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22d0
jmp 0x4638
movq 0x38(%rbx), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x35d1
movl 0x10(%rbx), %esi
movl 0x14(%rbx), %eax
andl $-0x10, %esi
andl $0xf, %eax
orl %eax, %esi
movl %esi, 0x10(%rbx)
cmpl %eax, %r13d
je 0x4766
cmpl $0x3, %r13d
jne 0x46e6
cmpq $0x0, 0x13b2c(%rip)     # 0x18210
je 0x46ef
movq 0x30(%rbx), %rdi
callq 0x44c5
cmpl $0x1, %r13d
je 0x471b
cmpl $0x3, %r13d
je 0x470e
cmpl $0x2, %r13d
jne 0x475a
movq 0x30(%rbx), %r14
leaq 0x132f4(%rip), %r15     # 0x17a00
jmp 0x4726
movq 0x30(%rbx), %r14
leaq 0x136e7(%rip), %r15     # 0x17e00
jmp 0x4726
movq 0x30(%rbx), %r14
leaq 0x12eda(%rip), %r15     # 0x17600
movq %r15, %rdi
callq 0x2120
movq %rax, %r12
leaq (%r14,%rax), %rbp
movq %r14, %rdi
callq 0x2120
leaq 0x1(%rax), %rdx
movq %rbp, %rdi
movq %r14, %rsi
callq 0x22d0
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2240
movl 0x10(%rbx), %eax
andl $-0x10, %eax
orl %r13d, %eax
movl %eax, 0x10(%rbx)
movq 0x30(%rbx), %rax
movzbl (%rax), %ecx
cmpl $0x5c, %ecx
je 0x4778
testl %ecx, %ecx
jne 0x477b
jmp 0x4780
movb $0x2f, (%rax)
incq %rax
jmp 0x476a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xda95(%rip), %rdi      # 0x1222b
leaq 0xd909(%rip), %rsi      # 0x120a6
leaq 0xdaba(%rip), %rcx      # 0x1225e
movl $0x4fc, %edx            # imm = 0x4FC
callq 0x2160