// File: /workspace/github_cpp_makefile_star2_O1/joakimkistowski[P]amd-disable-c6/amd-disable-c6.cpp
// Function: get_cpu_ids(std::vector<int, std::allocator<int>>&)
void get_cpu_ids(std::vector<int> &ids) {
    const std::string DOT = std::string(".");
    const std::string MICROCODE = std::string("microcode");
    DIR * dir = opendir("/dev/cpu/");
    if (!dir) {
        std::cerr << "Failed reading CPU ids" << std::endl;
        return;
    }
    struct dirent * ent;
    while ((ent = readdir(dir)) != NULL) {
            std::string name(ent->d_name);
            if (!name.compare(0, DOT.length(), DOT) == 0 && name != MICROCODE) {
                try {
                    ids.push_back(std::stoi(std::string(ent->d_name)));
                } catch (const std::invalid_argument& ia) {
                    std::cerr << "Invalid CPU ID: " << ent->d_name << std::endl;
                }
            }
            
    }
    closedir(dir);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2b25(%rip), %rsi      # 0x51c8
leaq 0x2b1f(%rip), %rdx      # 0x51c9
leaq 0x78(%rsp), %rdi
callq 0x3fac
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x297a(%rip), %rsi      # 0x503e
leaq 0x297c(%rip), %rdx      # 0x5047
leaq 0x58(%rsp), %rdi
callq 0x3fac
leaq 0x296c(%rip), %rdi      # 0x5048
callq 0x2250
testq %rax, %rax
je 0x2949
movq %rax, %r12
movq %rbx, 0x98(%rsp)
leaq 0x28(%rsp), %r15
leaq 0x18(%rsp), %r14
movq %r12, %rdi
callq 0x2260
movq %rax, %rbp
testq %rax, %rax
je 0x293f
leaq 0x13(%rbp), %r13
movq %r15, 0x18(%rsp)
movq %r13, %rdi
callq 0x20c0
leaq (%rax,%rbp), %rdx
addq $0x13, %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3fac
movq 0x80(%rsp), %rdx
movq %r14, %rbx
movq %r14, %rdi
xorl %esi, %esi
leaq 0x78(%rsp), %rcx
callq 0x2210
testl %eax, %eax
je 0x2859
movq 0x20(%rsp), %rdx
cmpq 0x60(%rsp), %rdx
jne 0x2785
testq %rdx, %rdx
je 0x2859
movq 0x58(%rsp), %rsi
movq 0x18(%rsp), %rdi
callq 0x21b0
testl %eax, %eax
je 0x2859
movq %r12, %r14
leaq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
movq %r13, %rdi
callq 0x20c0
leaq (%rax,%r13), %rdx
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x3fac
movq 0x38(%rsp), %r12
callq 0x2040
movq %rax, %rbp
movl (%rax), %r15d
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0xa0(%rsp), %rsi
movl $0xa, %edx
callq 0x2220
cmpq %r12, 0xa0(%rsp)
je 0x2878
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x2889
movl (%rbp), %ecx
cmpl $0x22, %ecx
je 0x2889
testl %ecx, %ecx
movq %r14, %r12
jne 0x2807
movl %r15d, (%rbp)
movl %eax, 0x14(%rsp)
movq 0x98(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x282e
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
leaq 0x28(%rsp), %r15
jmp 0x283d
leaq 0x14(%rsp), %rdx
leaq 0x28(%rsp), %r15
callq 0x403c
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2859
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x2870
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %r14
jmp 0x26ff
leaq 0x2b99(%rip), %rdi      # 0x5418
callq 0x20f0
jmp 0x29df
leaq 0x2b88(%rip), %rdi      # 0x5418
callq 0x2230
jmp 0x29df
movq %rdx, 0x8(%rsp)
movq %rax, %r12
jmp 0x28c0
movq %rdx, 0x8(%rsp)
movq %rax, %r12
jmp 0x28dc
movq %rdx, 0x8(%rsp)
movq %rax, %r12
cmpl $0x0, (%rbp)
jne 0x28c0
movl %r15d, (%rbp)
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x28dc
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21a0
cmpl $0x1, 0x8(%rsp)
jne 0x2a04
movq %r12, %rdi
callq 0x20b0
movl $0x10, %edx
movq 0x46f5(%rip), %rdi      # 0x6ff0
leaq 0x2767(%rip), %rsi      # 0x5069
callq 0x21e0
movq %r13, %rdi
callq 0x20c0
movq 0x46da(%rip), %rdi      # 0x6ff0
movq %r13, %rsi
movq %rax, %rdx
callq 0x21e0
movq 0x46c8(%rip), %rdi      # 0x6ff0
callq 0x20d0
leaq 0x28(%rsp), %r15
callq 0x22a0
movq %r14, %r12
jmp 0x2859
movq %r12, %rdi
callq 0x2280
jmp 0x298f
movq 0x46a0(%rip), %rbx      # 0x6ff0
leaq 0x26fb(%rip), %rsi      # 0x5052
movl $0x16, %edx
movq %rbx, %rdi
callq 0x21e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq 0x466e(%rip), %rdi      # 0x6ff0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
leaq 0x88(%rsp), %rbx
je 0x29b3
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x78(%rsp), %rdi
cmpq %rbx, %rdi
je 0x29cd
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21a0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a01
movq %rax, %r12
callq 0x22a0
jmp 0x2a04
movq %rax, %rdi
callq 0x3f33
movq %rax, %r12
jmp 0x2a41
movq %rax, %r12
jmp 0x2a63
jmp 0x2a22
jmp 0x2a22
movq %rax, %r12
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2a25
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x2a25
movq %rax, %r12
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2a41
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x2a63
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %r12, %rdi
callq 0x22c0