// File: CYLMos[P]Read_the_tar_file/MyTar.cpp
// Function: MyTar::getFileMode[abi:cxx11](int)
string MyTar::getFileMode(int modeNum){
    char r = 'r', w = 'w', x = 'x', no = '-';
    string fileMode[3];

    int index = 2;
    while(modeNum > 0){
        int subMode = modeNum % 10;
        modeNum /= 10;

        /// Check the read priviledge section.
        if(subMode >= 4){
            fileMode[index] += r;
            subMode -= 4;
        }
        else{
            fileMode[index] += no;
        }

        /// Check the write priviledge section.
        if(subMode >= 2){
            fileMode[index] += w;
            subMode -= 2;
        }
        else{
            fileMode[index] += no;
        }

        /// Check the execution priviledge section.
        if(subMode >= 1){
            fileMode[index] += x;
            subMode -= 1;
        }
        else{
            fileMode[index] += no;
        }

        --index;
    }

    return fileMode[0] + fileMode[1] + fileMode[2];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0xd8(%rbp)
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb $0x72, -0x15(%rbp)
movb $0x77, -0x16(%rbp)
movb $0x78, -0x17(%rbp)
movb $0x2d, -0x18(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, %rcx
addq $0x60, %rcx
movq %rcx, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x22a0
movq -0xe0(%rbp), %rax
movq -0xc8(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0xc0(%rbp)
jne 0x31c0
movl $0x2, -0x84(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x3345
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %edx, -0x88(%rbp)
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, -0x14(%rbp)
cmpl $0x4, -0x88(%rbp)
jl 0x3270
movsbl -0x15(%rbp), %esi
movslq -0x84(%rbp), %rax
shlq $0x5, %rax
leaq -0x80(%rbp,%rax), %rdi
callq 0x2110
jmp 0x3248
movl -0x88(%rbp), %eax
subl $0x4, %eax
movl %eax, -0x88(%rbp)
jmp 0x328d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x33f9
movsbl -0x18(%rbp), %esi
movslq -0x84(%rbp), %rax
shlq $0x5, %rax
leaq -0x80(%rbp,%rax), %rdi
callq 0x2110
jmp 0x328b
jmp 0x328d
cmpl $0x2, -0x88(%rbp)
jl 0x32c2
movsbl -0x16(%rbp), %esi
movslq -0x84(%rbp), %rax
shlq $0x5, %rax
leaq -0x80(%rbp,%rax), %rdi
callq 0x2110
jmp 0x32b1
movl -0x88(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x88(%rbp)
jmp 0x32df
movsbl -0x18(%rbp), %esi
movslq -0x84(%rbp), %rax
shlq $0x5, %rax
leaq -0x80(%rbp,%rax), %rdi
callq 0x2110
jmp 0x32dd
jmp 0x32df
cmpl $0x1, -0x88(%rbp)
jl 0x3314
movsbl -0x17(%rbp), %esi
movslq -0x84(%rbp), %rax
shlq $0x5, %rax
leaq -0x80(%rbp,%rax), %rdi
callq 0x2110
jmp 0x3303
movl -0x88(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x3331
movsbl -0x18(%rbp), %esi
movslq -0x84(%rbp), %rax
shlq $0x5, %rax
leaq -0x80(%rbp,%rax), %rdi
callq 0x2110
jmp 0x332f
jmp 0x3331
movl -0x84(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x31fb
leaq -0x60(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x37e0
jmp 0x335b
movq -0xd8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
leaq -0xb8(%rbp), %rsi
callq 0x3790
jmp 0x3374
leaq -0xb8(%rbp), %rdi
callq 0x2100
leaq -0x80(%rbp), %rax
movq %rax, -0xf0(%rbp)
addq $0x60, %rax
movq %rax, -0xe8(%rbp)
jmp 0x33b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x2100
jmp 0x33f9
movq -0xe8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0xf8(%rbp)
callq 0x2100
movq -0xf0(%rbp), %rcx
movq -0xf8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0xe8(%rbp)
jne 0x33b8
movq -0xd0(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
leaq -0x80(%rbp), %rax
movq %rax, -0x108(%rbp)
addq $0x60, %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x110(%rbp)
callq 0x2100
movq -0x108(%rbp), %rcx
movq -0x110(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x100(%rbp)
jne 0x340f
jmp 0x3442
movq -0x90(%rbp), %rdi
callq 0x2350
nop