// File: establishment[P]sandman/src/rules.hpp
// Function: Rules::FilePermissions::modeFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string modeFromString(const std::string& mode) {
            int bitmask = 0;

            for (char c : mode) {
                if (c == 'x' or c == 'X') {
                    bitmask |= (1 << 0);
                }
                if (c == 'w' or c == 'W') {
                    bitmask |= (1 << 1);
                }
                if (c == 'r' or c == 'R') {
                    bitmask |= (1 << 2);
                }
            }

            std::string result = "";
            std::string modes = "xwr";
            for (int i = 0; i < 3; i += 1) {
                if (bitmask & (1 << i)) {
                    result += modes[i];
                }
            }

            return result;
        }

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x20(%rsp)
movq %rdi, %rax
movq %rax, 0x28(%rsp)
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movl $0x0, 0x8c(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x8c560
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rdi
callq 0x8cb00
movq %rax, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xa0a20
testb $0x1, %al
jne 0xafcd3
jmp 0xafd63
leaq 0x78(%rsp), %rdi
callq 0xa0a60
movb (%rax), %al
movb %al, 0x6f(%rsp)
movsbl 0x6f(%rsp), %eax
cmpl $0x78, %eax
je 0xafcf7
movsbl 0x6f(%rsp), %eax
cmpl $0x58, %eax
jne 0xafd08
movl 0x8c(%rsp), %eax
orl $0x1, %eax
movl %eax, 0x8c(%rsp)
movsbl 0x6f(%rsp), %eax
cmpl $0x77, %eax
je 0xafd1c
movsbl 0x6f(%rsp), %eax
cmpl $0x57, %eax
jne 0xafd2d
movl 0x8c(%rsp), %eax
orl $0x2, %eax
movl %eax, 0x8c(%rsp)
movsbl 0x6f(%rsp), %eax
cmpl $0x72, %eax
je 0xafd41
movsbl 0x6f(%rsp), %eax
cmpl $0x52, %eax
jne 0xafd52
movl 0x8c(%rsp), %eax
orl $0x4, %eax
movl %eax, 0x8c(%rsp)
jmp 0xafd54
leaq 0x78(%rsp), %rdi
callq 0xa0a70
jmp 0xafcbb
movb $0x0, 0x6e(%rsp)
leaq 0x6d(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x8ca50
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rdx
leaq 0x45424(%rip), %rsi     # 0xf51ac
callq 0xa0a90
jmp 0xafd8f
leaq 0x6d(%rsp), %rdi
callq 0x8c630
leaq 0x37(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x8ca50
movq 0x10(%rsp), %rdx
leaq 0x465a1(%rip), %rsi     # 0xf6355
leaq 0x38(%rsp), %rdi
callq 0xa0a90
jmp 0xafdc0
leaq 0x37(%rsp), %rdi
callq 0x8c630
movl $0x0, 0x30(%rsp)
cmpl $0x3, 0x30(%rsp)
jge 0xafe84
movl 0x8c(%rsp), %eax
movl 0x30(%rsp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0xafe72
movslq 0x30(%rsp), %rsi
leaq 0x38(%rsp), %rdi
callq 0x8cbb0
movq %rax, 0x8(%rsp)
jmp 0xafe0e
movq 0x20(%rsp), %rdi
movq 0x8(%rsp), %rax
movsbl (%rax), %esi
callq 0x8c390
jmp 0xafe22
jmp 0xafe72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x6d(%rsp), %rdi
callq 0x8c630
jmp 0xafebb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x37(%rsp), %rdi
callq 0x8c630
jmp 0xafeb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x8cbd8
jmp 0xafeb1
jmp 0xafe74
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0xafdd2
movb $0x1, 0x6e(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x8cbd8
testb $0x1, 0x6e(%rsp)
jne 0xafea4
movq 0x20(%rsp), %rdi
callq 0x8cbd8
movq 0x28(%rsp), %rax
addq $0xa8, %rsp
retq
movq 0x20(%rsp), %rdi
callq 0x8cbd8
movq 0x60(%rsp), %rdi
callq 0x8ca40
nopw %cs:(%rax,%rax)
nop