// File: establishment[P]sandman/src/rules.hpp
// Function: Rules::DiskQuota::applyQuota()
void applyQuota() {
            if (!blockQuota)
                return; // no disk quota set

            char cwd[PATH_MAX];
            if (!getcwd(cwd, sizeof(cwd)))
                Die("getcwd: %m");

            char* dev = findDevice(cwd);
            if (!dev)
                Die("Cannot identify filesystem which contains %s", cwd);
            Msg("Quota: std::mapped path %s to a filesystem on %s\n", cwd, dev);

            // Sanity check
            struct stat devStat, cwdStat;
            if (stat(dev, &devStat) < 0)
                Die("Cannot identify block device %s: %m", dev);
            if (!S_ISBLK(devStat.st_mode))
                Die("Expected that %s is a block device", dev);
            if (stat(".", &cwdStat) < 0)
                Die("Cannot stat cwd: %m");
            if (cwdStat.st_dev != devStat.st_rdev)
                Die("Identified %s as a filesystem on %s, but it is obviously false", cwd, dev);

            // Set disk quotas
            struct dqblk dq;
            bzero(&dq, sizeof(dq));
            dq.dqb_bhardlimit = blockQuota;    /* absolute limit on disk quota blocks alloc */
            dq.dqb_bsoftlimit = blockQuota;    /* preferred limit on disk quota blocks */
            dq.dqb_ihardlimit = inodeQuota;    /* maximum number of allocated inodes */
            dq.dqb_isoftlimit = inodeQuota;    /* preferred inode limit */
            dq.dqb_valid = QIF_LIMITS;          /* limit blocks and inodes */

            // Apply disk quotas
            if (quotactl(QCMD(Q_SETQUOTA, USRQUOTA), dev, processUid, (caddr_t)&dq) < 0)
                Die("Cannot set disk quota: %m");

            Msg("Quota: Set block quota %d and inode quota %d\n", blockQuota, inodeQuota);
            free(dev);
        }

// Assembly:
subq $0x1188, %rsp           # imm = 0x1188
movq %rdi, 0x1180(%rsp)
movq 0x1180(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x4(%rax)
jne 0xc89e7
jmp 0xc8ba5
leaq 0x180(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x8c2a0
cmpq $0x0, %rax
jne 0xc8a0d
leaq 0x2dd9c(%rip), %rdi     # 0xf67a2
movb $0x0, %al
callq 0x94bf0
leaq 0x180(%rsp), %rdi
callq 0xc8bb0
movq %rax, 0x178(%rsp)
cmpq $0x0, 0x178(%rsp)
jne 0xc8a43
leaq 0x180(%rsp), %rsi
leaq 0x2dd71(%rip), %rdi     # 0xf67ad
movb $0x0, %al
callq 0x94bf0
leaq 0x180(%rsp), %rsi
movq 0x178(%rsp), %rdx
leaq 0x2dd80(%rip), %rdi     # 0xf67da
movb $0x0, %al
callq 0x94e30
movq 0x178(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x8c500
cmpl $0x0, %eax
jge 0xc8a91
movq 0x178(%rsp), %rsi
leaq 0x2dd82(%rip), %rdi     # 0xf680c
movb $0x0, %al
callq 0x94bf0
movl 0x100(%rsp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x6000, %eax           # imm = 0x6000
je 0xc8aba
movq 0x178(%rsp), %rsi
leaq 0x2dd7d(%rip), %rdi     # 0xf6830
movb $0x0, %al
callq 0x94bf0
leaq 0x2d903(%rip), %rdi     # 0xf63c4
leaq 0x58(%rsp), %rsi
callq 0x8c500
cmpl $0x0, %eax
jge 0xc8ade
leaq 0x2dd7c(%rip), %rdi     # 0xf6853
movb $0x0, %al
callq 0x94bf0
movq 0x58(%rsp), %rax
cmpq 0x110(%rsp), %rax
je 0xc8b13
leaq 0x180(%rsp), %rsi
cmpq $0x0, 0x178(%rsp)
setne %al
movzbl %al, %edx
andl $0x1, %edx
leaq 0x2dd59(%rip), %rdi     # 0xf6867
callq 0x94580
leaq 0x10(%rsp), %rdi
movl $0x48, %esi
callq 0x8ca20
movq 0x8(%rsp), %rax
movslq 0x4(%rax), %rcx
movq %rcx, 0x10(%rsp)
movslq 0x4(%rax), %rcx
movq %rcx, 0x18(%rsp)
movslq 0x8(%rax), %rcx
movq %rcx, 0x28(%rsp)
movslq 0x8(%rax), %rcx
movq %rcx, 0x30(%rsp)
movl $0x5, 0x50(%rsp)
movq 0x178(%rsp), %rsi
movl (%rax), %edx
movl $0x80000800, %edi       # imm = 0x80000800
leaq 0x10(%rsp), %rcx
callq 0x8c690
cmpl $0x0, %eax
jge 0xc8b7f
leaq 0x2dd2e(%rip), %rdi     # 0xf68a6
movb $0x0, %al
callq 0x94bf0
movq 0x8(%rsp), %rax
movl 0x4(%rax), %esi
movl 0x8(%rax), %edx
leaq 0x2dd2f(%rip), %rdi     # 0xf68c0
movb $0x0, %al
callq 0x94e30
movq 0x178(%rsp), %rdi
callq 0x8c6e0
addq $0x1188, %rsp           # imm = 0x1188
retq
nopl (%rax)