// File: /workspace/github_cpp_makefile_star2_O3/establishment[P]sandman/src/cgroups.hpp
// Function: CGroups::prepare()
void prepare() {
        Base::Msg("Preparing control group %s\n", cgName.c_str());
        for (auto subsystem : cgAllSubSystems) {
            struct stat st;
            std::string path = getPath(subsystem, "");
            if (stat(path.c_str(), &st) >= 0 || errno != ENOENT) {
                Base::Msg("Control group %s already exists, trying to empty it.\n", path.c_str());
                if (rmdir(path.c_str()) < 0) {
                    Base::Die("Failed to reset control group %s: %m", path.c_str());
                }
            }

            if (mkdir(path.c_str(), 0777) < 0 && !subsystem.optional) {
                Base::Die("Failed to create control group %s: %m", path.c_str());
            }
        }

        /// If cpuset module is enabled, copy allowed cpus and memory nodes from parent group
        /// limits the cpus which can be used by target process
        /// usefull in a multi cored environment
        if (readStat(cgCpuset, "cpuset.cpus", true)) { /// try to read
            writeStat(cgCpuset, "cpuset.cpus", buffer); /// write what was just read
        }

        /// sets RAM nodes which this program can use
        /// can be specified to be the first 2 GB of ram for example
        if (readStat(cgCpuset, "cpuset.mems", true)) { /// try to read
            writeStat(cgCpuset, "cpuset.mems", buffer); /// write what was just read
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rdi, 0x38(%rsp)
movq (%rdi), %rsi
leaq 0x106d6(%rip), %rdi     # 0x566bc
xorl %eax, %eax
callq 0x2ceee
leaq 0x98(%rsp), %r14
leaq 0x24a34(%rip), %rbx     # 0x6aa30
leaq 0x60(%rsp), %r12
leaq 0xf180(%rip), %r13      # 0x55188
leaq 0x88(%rsp), %rbp
leaq 0x106f7(%rip), %rax     # 0x5670e
movq %rax, 0x30(%rsp)
xorl %r15d, %r15d
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq (%r15,%rbx), %rsi
movq 0x8(%r15,%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x47420
movb 0x20(%r15,%rbx), %al
movb %al, 0x28(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x47420
movb 0x28(%rsp), %al
movb %al, 0x80(%rsp)
movq %r14, 0x88(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq %r13, %rdx
callq 0x42cf8
leaq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x39ad2
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x460ba
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x460d6
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x40(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x273f0
testl %eax, %eax
jns 0x460f6
callq 0x27050
cmpl $0x2, (%rax)
je 0x4611b
movq 0x40(%rsp), %rsi
leaq 0x105d6(%rip), %rdi     # 0x566d8
xorl %eax, %eax
callq 0x2ceee
movq 0x40(%rsp), %rdi
callq 0x271c0
testl %eax, %eax
js 0x46503
movq 0x40(%rsp), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x271f0
testl %eax, %eax
jns 0x46139
cmpb $0x1, 0x28(%rsp)
jne 0x464f7
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x46155
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x46171
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x27480
addq $0x28, %r15
cmpq $0x78, %r15
jne 0x4601f
leaq 0x1c0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x24876(%rip), %rsi     # 0x6aa08
movq 0x24877(%rip), %rdx     # 0x6aa10
addq %rsi, %rdx
leaq 0x1b0(%rsp), %rbx
movq %rbx, %rdi
callq 0x47420
movb 0x24876(%rip), %al      # 0x6aa28
movb %al, 0x20(%rbx)
leaq 0xb8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x10591(%rip), %rsi     # 0x56759
leaq 0x10595(%rip), %rdx     # 0x56764
leaq 0xa8(%rsp), %rdi
callq 0x42cf8
leaq 0x1b0(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
movq 0x38(%rsp), %r13
movq %r13, %rdi
movl $0x1, %ecx
callq 0x39946
movl %eax, %ebx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4621d
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x1b0(%rsp), %rdi
cmpq %r14, %rdi
je 0x4623a
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x27480
testl %ebx, %ebx
je 0x46339
leaq 0x198(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x247b2(%rip), %rsi     # 0x6aa08
movq 0x247b3(%rip), %rdx     # 0x6aa10
addq %rsi, %rdx
leaq 0x188(%rsp), %rbx
movq %rbx, %rdi
callq 0x47420
movb 0x247b2(%rip), %al      # 0x6aa28
movb %al, 0x20(%rbx)
leaq 0xa8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x104ce(%rip), %rsi     # 0x56759
leaq 0x104d2(%rip), %rdx     # 0x56764
callq 0x42cf8
leaq 0x28(%r13), %rbx
leaq 0x8(%rsp), %r14
leaq 0x18(%rsp), %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x271e0
leaq (%rax,%r13), %rdx
addq $0x28, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x42cf8
leaq 0x188(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r13, %rdi
xorl %r8d, %r8d
callq 0x3b556
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x462ff
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4631c
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x188(%rsp), %rdi
cmpq %r12, %rdi
je 0x46339
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x27480
leaq 0x170(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x246bc(%rip), %rsi     # 0x6aa08
movq 0x246bd(%rip), %rdx     # 0x6aa10
addq %rsi, %rdx
leaq 0x160(%rsp), %rbx
movq %rbx, %rdi
callq 0x47420
movb 0x246bc(%rip), %al      # 0x6aa28
movb %al, 0x20(%rbx)
leaq 0xa8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x103e4(%rip), %rsi     # 0x56765
leaq 0x103e8(%rip), %rdx     # 0x56770
callq 0x42cf8
leaq 0x160(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
movq %r13, %rdi
movl $0x1, %ecx
callq 0x39946
movl %eax, %ebx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x463c9
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x160(%rsp), %rdi
cmpq %r14, %rdi
je 0x463e6
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x27480
testl %ebx, %ebx
je 0x464e5
leaq 0x148(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x24606(%rip), %rsi     # 0x6aa08
movq 0x24607(%rip), %rdx     # 0x6aa10
addq %rsi, %rdx
leaq 0x138(%rsp), %rbx
movq %rbx, %rdi
callq 0x47420
movb 0x24606(%rip), %al      # 0x6aa28
movb %al, 0x20(%rbx)
leaq 0xa8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1032e(%rip), %rsi     # 0x56765
leaq 0x10332(%rip), %rdx     # 0x56770
callq 0x42cf8
leaq 0x28(%r13), %rbx
leaq 0x8(%rsp), %r14
leaq 0x18(%rsp), %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x271e0
leaq (%rax,%r13), %rdx
addq $0x28, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x42cf8
leaq 0x138(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r13, %rdi
xorl %r8d, %r8d
callq 0x3b556
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x464ab
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x464c8
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x464e5
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x27480
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10235(%rip), %rax     # 0x56733
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rsi
movq 0x30(%rsp), %rdi
xorl %eax, %eax
callq 0x2cd4f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x46538
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x27480
jmp 0x46538
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4655a
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x27480
jmp 0x4655a
movq %rax, %rbx
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x466dc
movq 0x148(%rsp), %rsi
jmp 0x466d4
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4659c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x27480
jmp 0x4659c
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x465be
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x27480
jmp 0x465be
movq %rax, %rbx
movq 0x188(%rsp), %rdi
cmpq %r12, %rdi
je 0x466dc
movq 0x198(%rsp), %rsi
jmp 0x466d4
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x46601
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x27480
jmp 0x46601
movq %rax, %rbx
movq 0x160(%rsp), %rdi
cmpq %r14, %rdi
je 0x466dc
movq 0x170(%rsp), %rsi
jmp 0x466d4
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0x46644
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x27480
jmp 0x46644
movq %rax, %rbx
movq 0x1b0(%rsp), %rdi
cmpq %r14, %rdi
je 0x466dc
movq 0x1c0(%rsp), %rsi
jmp 0x466d4
jmp 0x466a1
movq %rax, %rbx
jmp 0x466c0
movq %rax, %rbx
jmp 0x4668b
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x4668b
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x466c0
movq 0x70(%rsp), %rsi
jmp 0x466b8
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x466c0
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x27480
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x466dc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x27480
movq %rbx, %rdi
callq 0x27830