// File: establishment[P]sandman/src/rules.hpp
// Function: Rules::DirRules::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int)
int add(std::string boxPath, std::string localPath, unsigned int flags) {
            // Make sure that "boxPath" is relative
            while (boxPath.size() && boxPath[0] == '/') {
                boxPath = boxPath.substr(1);
            }

            // Check boxPath
            if (boxPath.size() == 0 || localPath.size() == 0) {
                return 0;
            }

            // Check "localPath"
            if (flags & FLAG_FS) {
                if (localPath[0] == '/') {
                    return 0;
                }
            } else if (localPath[0] != '/' && localPath.substr(0, 2) != "./") {
                return 0;
            }

            // Override an existing rule
            for (DirRule& rule : allDirRules) {
                if (rule.boxPath == boxPath) {
                    rule.localPath = localPath;
                    rule.flags = flags;
                    return 1;
                }
            }

            // Add a new rule
            allDirRules.push_back({boxPath, localPath, flags});

            return 1;
        }

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rdi, 0x118(%rsp)
movq %rsi, 0x110(%rsp)
movq %rdx, 0x108(%rsp)
movl %ecx, 0x104(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x28(%rsp), %rdi
callq 0x8c3f0
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, 0x27(%rsp)
je 0xaddd1
movq 0x28(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8cbb0
movsbl (%rax), %eax
cmpl $0x2f, %eax
sete %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0xadddb
jmp 0xade1a
movq 0x28(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x8c5e0
movq 0x28(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x8c720
leaq 0xe0(%rsp), %rdi
callq 0x8cbd8
jmp 0xadd9d
movq 0x28(%rsp), %rdi
callq 0x8c3f0
cmpq $0x0, %rax
je 0xade3a
movq 0x30(%rsp), %rdi
callq 0x8c3f0
cmpq $0x0, %rax
jne 0xade4a
movl $0x0, 0x124(%rsp)
jmp 0xae0ce
movl 0x104(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xade84
movq 0x30(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8cbb0
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0xade7f
movl $0x0, 0x124(%rsp)
jmp 0xae0ce
jmp 0xadf60
movq 0x30(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8cbb0
movsbl (%rax), %ecx
movb $0x0, 0xbf(%rsp)
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, 0x26(%rsp)
je 0xadef1
movq 0x30(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0xc0(%rsp), %rdi
movq %rdi, 0x18(%rsp)
movl $0x2, %ecx
callq 0x8c5e0
movq 0x18(%rsp), %rdi
movb $0x1, 0xbf(%rsp)
leaq 0x483a7(%rip), %rsi     # 0xf6283
callq 0xadd30
movb %al, 0x25(%rsp)
jmp 0xadee7
movb 0x25(%rsp), %al
movb %al, 0x26(%rsp)
jmp 0xadef1
movb 0x26(%rsp), %al
movb %al, 0x17(%rsp)
testb $0x1, 0xbf(%rsp)
jne 0xadf05
jmp 0xadf12
leaq 0xc0(%rsp), %rdi
callq 0x8cbd8
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0xadf1c
jmp 0xadf5e
movl $0x0, 0x124(%rsp)
jmp 0xae0ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
testb $0x1, 0xbf(%rsp)
jne 0xadf4c
jmp 0xadf59
leaq 0xc0(%rsp), %rdi
callq 0x8cbd8
jmp 0xae0dd
jmp 0xadf60
movq 0x38(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0xae2b0
movq %rax, 0x98(%rsp)
movq 0xa0(%rsp), %rdi
callq 0xae2e0
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xae310
testb $0x1, %al
jne 0xadfb2
jmp 0xae02b
leaq 0x98(%rsp), %rdi
callq 0xae350
movq 0x28(%rsp), %rsi
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rdi
callq 0xa2880
testb $0x1, %al
jne 0xadfdf
jmp 0xae017
movq 0x30(%rsp), %rsi
movq 0x88(%rsp), %rdi
addq $0x20, %rdi
callq 0x8c060
movl 0x104(%rsp), %ecx
movq 0x88(%rsp), %rax
movl %ecx, 0x40(%rax)
movl $0x1, 0x124(%rsp)
jmp 0xae0ce
jmp 0xae019
leaq 0x98(%rsp), %rdi
callq 0xae360
jmp 0xadf97
movq 0x28(%rsp), %rsi
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
leaq 0x40(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x8c220
movq 0x30(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x8c220
jmp 0xae059
movq (%rsp), %rdi
movl 0x104(%rsp), %eax
movl %eax, 0x80(%rsp)
leaq 0x40(%rsp), %rsi
callq 0xae380
jmp 0xae077
leaq 0x40(%rsp), %rdi
callq 0xae3b0
movl $0x1, 0x124(%rsp)
jmp 0xae0ce
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
callq 0x8cbd8
jmp 0xae0dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xae3b0
jmp 0xae0dd
movl 0x124(%rsp), %eax
addq $0x128, %rsp            # imm = 0x128
retq
movq 0xb0(%rsp), %rdi
callq 0x8ca40
nopw (%rax,%rax)