// File: establishment[P]sandman/src/rules.hpp
// Function: Rules::FilePermissions::applyRules(unsigned int)
void applyRules(uid_t uid) {
            char* pwd = get_current_dir_name();
            if (strcmp(pwd, "/box") != 0) {
                Die("FilePermissions::applyRules must be run in /box | %s\n", pwd);
            }

            if (geteuid()) {
                Die("FilePermissions::applyRules must be run as root\n");
            }

            /// delete all privileges for other
            Base::Chmod("750 .");
            Base::Chmod("750 *");

            std::string command = "";
            for (const Permission& rule : allPermissions) {
                if (rule.mode == "") {
                    command += Base::StrCat("-x u:", uid, " ", rule.path, " ");
                } else {
                    command += Base::StrCat("-m u:", uid, ":", rule.mode, " ", rule.path, " ");
                }
            }

            Msg("permissions command:\t%s\n", command.c_str());
            Base::Setfacl(command);
        }

// Assembly:
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, 0x1a0(%rsp)
movl %esi, 0x19c(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x40(%rsp)
callq 0x8caf0
movq %rax, 0x190(%rsp)
movq 0x190(%rsp), %rdi
leaq 0x46f08(%rip), %rsi     # 0xf6267
callq 0x8c850
cmpl $0x0, %eax
je 0xaf37f
movq 0x190(%rsp), %rsi
leaq 0x46fe1(%rip), %rdi     # 0xf6359
movb $0x0, %al
callq 0x94bf0
callq 0x8c310
cmpl $0x0, %eax
je 0xaf397
leaq 0x46fff(%rip), %rdi     # 0xf638f
movb $0x0, %al
callq 0x94bf0
leaq 0x16f(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x8ca50
movq 0x38(%rsp), %rdx
leaq 0x4700b(%rip), %rsi     # 0xf63c0
leaq 0x170(%rsp), %rdi
callq 0xa0a90
jmp 0xaf3c4
leaq 0x170(%rsp), %rdi
callq 0x95520
jmp 0xaf3d3
leaq 0x170(%rsp), %rdi
callq 0x8cbd8
leaq 0x16f(%rsp), %rdi
callq 0x8c630
leaq 0x137(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x8ca50
movq 0x30(%rsp), %rdx
leaq 0x46fbb(%rip), %rsi     # 0xf63c6
leaq 0x138(%rsp), %rdi
callq 0xa0a90
jmp 0xaf41a
leaq 0x138(%rsp), %rdi
callq 0x95520
jmp 0xaf429
leaq 0x138(%rsp), %rdi
callq 0x8cbd8
leaq 0x137(%rsp), %rdi
callq 0x8c630
leaq 0x10f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x8ca50
movq 0x28(%rsp), %rdx
leaq 0x45d4b(%rip), %rsi     # 0xf51ac
leaq 0x110(%rsp), %rdi
callq 0xa0a90
jmp 0xaf470
leaq 0x10f(%rsp), %rdi
callq 0x8c630
movq 0x40(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rdi
callq 0xb0430
movq %rax, 0xf8(%rsp)
movq 0x100(%rsp), %rdi
callq 0xb0240
movq %rax, 0xf0(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0xb0aa0
testb $0x1, %al
jne 0xaf4d2
jmp 0xaf7d4
leaq 0xf8(%rsp), %rdi
callq 0xb0ae0
movq %rax, 0xe8(%rsp)
movq 0xe8(%rsp), %rdi
addq $0x20, %rdi
leaq 0x45cb2(%rip), %rsi     # 0xf51ac
callq 0xa11e0
movb %al, 0x27(%rsp)
jmp 0xaf505
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0xaf512
jmp 0xaf6b0
movl 0x19c(%rsp), %eax
movl %eax, 0x20(%rsp)
movq 0xe8(%rsp), %rsi
leaq 0xa8(%rsp), %rdi
callq 0x8c220
jmp 0xaf534
movl 0x20(%rsp), %edx
leaq 0x46e8d(%rip), %rsi     # 0xf63cc
leaq 0x470ad(%rip), %r9      # 0xf65f3
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %r8
movq %r9, %rcx
callq 0xb0af0
jmp 0xaf560
leaq 0x110(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x8c7a0
jmp 0xaf577
leaq 0xc8(%rsp), %rdi
callq 0x8cbd8
leaq 0xa8(%rsp), %rdi
callq 0x8cbd8
jmp 0xaf7c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
jmp 0xaf5cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x8cbd8
leaq 0x16f(%rsp), %rdi
callq 0x8c630
jmp 0xaf825
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
jmp 0xaf616
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x8cbd8
leaq 0x137(%rsp), %rdi
callq 0x8c630
jmp 0xaf825
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
leaq 0x10f(%rsp), %rdi
callq 0x8c630
jmp 0xaf825
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
jmp 0xaf818
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
jmp 0xaf69e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x8cbd8
leaq 0xa8(%rsp), %rdi
callq 0x8cbd8
jmp 0xaf818
movl 0x19c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0xe8(%rsp), %rsi
addq $0x20, %rsi
leaq 0x68(%rsp), %rdi
callq 0x8c220
jmp 0xaf6d3
movq 0xe8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x8c220
jmp 0xaf6e7
movl 0x1c(%rsp), %edx
leaq 0x46f01(%rip), %r9      # 0xf65f3
movq %rsp, %rax
movq %r9, 0x8(%rax)
leaq 0x48(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x46cca(%rip), %rsi     # 0xf63d2
leaq 0x45d11(%rip), %rcx     # 0xf5420
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %r8
callq 0xb0c50
jmp 0xaf723
leaq 0x110(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x8c7a0
jmp 0xaf73a
leaq 0x88(%rsp), %rdi
callq 0x8cbd8
leaq 0x48(%rsp), %rdi
callq 0x8cbd8
leaq 0x68(%rsp), %rdi
callq 0x8cbd8
jmp 0xaf7c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
jmp 0xaf7b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
jmp 0xaf7aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x8cbd8
leaq 0x48(%rsp), %rdi
callq 0x8cbd8
leaq 0x68(%rsp), %rdi
callq 0x8cbd8
jmp 0xaf818
jmp 0xaf7c2
leaq 0xf8(%rsp), %rdi
callq 0xb0e60
jmp 0xaf4b4
leaq 0x110(%rsp), %rdi
callq 0x8c1f0
movq %rax, %rsi
leaq 0x46bed(%rip), %rdi     # 0xf63d8
xorl %eax, %eax
callq 0x94e30
jmp 0xaf7f4
leaq 0x110(%rsp), %rdi
callq 0x955f0
jmp 0xaf803
leaq 0x110(%rsp), %rdi
callq 0x8cbd8
addq $0x1a8, %rsp            # imm = 0x1A8
retq
leaq 0x110(%rsp), %rdi
callq 0x8cbd8
movq 0x160(%rsp), %rdi
callq 0x8ca40
nopw %cs:(%rax,%rax)
nopl (%rax)