LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/czmccrory[P]ManchesterBaby/line.cpp
// Function: binToDec(std::vector<bool, std::allocator<bool>>*)
int binToDec(vector<bool> * bin)
{
	bool negative = bin->back(); //1/true means negative, 0/false means positive
  int length = bin->size();
  int decimal = 0;

  for (int i = 0; i < length -1; i++)
  {
    if (bin->at(i) == 1) //add value of 2^(length - i - 1)(value of its position in the binary number)
    {
      decimal += (static_cast<int>(pow(2, i)));
    }
  }

  if (negative) {
  	return 0-decimal;
  } else {
	return decimal;
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x473e
movq %rdx, %r14
movq (%rax), %r12
movl 0x10(%rbx), %eax
movl 0x18(%rbx), %ecx
subl (%rbx), %eax
leal (%rcx,%rax,8), %r13d
decl %r13d
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
xorl %ebp, %ebp
cmpq %r15, %r13
je 0x42c6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x476c
testq %rdx, (%rax)
je 0x42c1
cvtsi2sd %r15d, %xmm0
callq 0x21c0
cvttsd2si %xmm0, %eax
addl %eax, %ebp
incq %r15
jmp 0x429c
movl %ebp, %eax
negl %eax
testq %r12, %r14
cmovel %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/czmccrory[P]ManchesterBaby/line.cpp
// Function: decToBin(int, int)
vector<bool>* decToBin(int dec, int numOfBits) 
{	
  vector<bool>* bin = new vector<bool>(numOfBits, 0); // vector to hold binary value (in this case size 8 for rule.)

  //const unsigned long long maxDec = pow(2,numOfBits)-1; //we are using operandWidth-bit numbers
   //with the last bit as the sign
  bool negative;
  if (dec < 0) {
  	negative = true;
	dec = 0 - dec;
  } else {
  	negative = false;
  }
  for (size_t i=numOfBits-1; dec>0; i--)
  {
    // take the remainder of the dec / 2 and save it to the vector
    // this value will always be 1 or 0
    (*bin).at(numOfBits-1-i) = dec%2;
    // update dec
    dec /= 2;
  }
  bin->at(numOfBits-1) = negative; //setting the 13th bit

  return bin;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movl %edi, %ebp
pushq $0x28
popq %rdi
callq 0x21e0
movq %rax, %rbx
movslq %r14d, %rsi
leaq 0xf(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xe(%rsp), %rcx
movq %rax, %rdi
callq 0x4858
movl %ebp, %r12d
negl %r12d
cmovsl %ebp, %r12d
decl %r14d
movslq %r14d, %r14
xorl %r15d, %r15d
movq %rbx, %rdi
testl %r12d, %r12d
je 0x43a4
movq %r15, %rsi
callq 0x476c
testb $0x1, %r12b
jne 0x4396
notq %rdx
andq (%rax), %rdx
jmp 0x4399
orq (%rax), %rdx
movq %rdx, (%rax)
shrl %r12d
incq %r15
jmp 0x4378
movq %r14, %rsi
callq 0x476c
testl %ebp, %ebp
js 0x43b8
notq %rdx
andq (%rax), %rdx
jmp 0x43bb
orq (%rax), %rdx
movq %rdx, (%rax)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x21f0
movq %r14, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O2/czmccrory[P]ManchesterBaby/line.cpp
// Function: printVector(std::vector<bool, std::allocator<bool>>*)
void printVector(vector<bool> * v) {
	vector<bool>::iterator it;
	for (it=v->begin(); it != v->end(); ++it) {
		cout << *it << "" <<flush;
	}
	cout <<flush;
	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r12
xorl %ebp, %ebp
movq 0x4bb1(%rip), %r14      # 0x8fc8
leaq 0xce8(%rip), %r15       # 0x5106
xorl %r13d, %r13d
cmpq 0x10(%rbx), %r12
jne 0x442d
cmpl 0x18(%rbx), %r13d
je 0x446f
movq (%r12), %rax
xorl %esi, %esi
btq %r13, %rax
setb %sil
movq %r14, %rdi
callq 0x22f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x2140
xorl %eax, %eax
cmpl $0x3f, %r13d
leal 0x1(%r13), %ecx
sete %al
leaq (%r12,%rax,8), %r12
cmovel %ebp, %ecx
movl %ecx, %r13d
jmp 0x4421
movq 0x4b52(%rip), %rdi      # 0x8fc8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2140
nop
// File: /workspace/github_cpp_makefile_star2_O2/czmccrory[P]ManchesterBaby/line.cpp
// Function: Line::set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Line::set(string s) {
	//cout << "trying to set(string) " << endl;
	//delete line;
	line = new vector<bool>; //use something else to empty it
	for (char &c : s) {
		if (c == '0') {
			line->push_back(0);
		} else if (c == '1'){ //anything that's not 0
			line->push_back(1);
		}
		//cout << c;
		//cout << static_cast<int>(c);
	}

	//cout <<endl;// << "all set. " <<endl;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x28
popq %rdi
callq 0x21e0
andq $0x0, (%rax)
andl $0x0, 0x8(%rax)
andq $0x0, 0x10(%rax)
andl $0x0, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %rax, (%rbx)
movq (%r14), %r15
movq 0x8(%r14), %r14
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x45a1
movzbl (%r15,%r12), %eax
cmpl $0x30, %eax
je 0x458f
cmpl $0x31, %eax
jne 0x459c
movb $0x1, %al
jmp 0x4591
xorl %eax, %eax
movq (%rbx), %rdi
movzbl %al, %esi
callq 0x480a
incq %r12
jmp 0x4577
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/nus-comparch[P]cs5222-lab-prefetcher/example_prefetchers/stream_prefetcher.cc
// Function: l2_prefetcher_initialize
void l2_prefetcher_initialize(int cpu_num)
{
  printf("Streaming Prefetcher\n");
  // you can inspect these knob values from your code to see which configuration you're runnig in
  printf("Knobs visible from prefetcher: %d %d %d\n", knob_scramble_loads, knob_small_llc, knob_low_bandwidth);

  int i;
  for(i=0; i<STREAM_DETECTOR_COUNT; i++)
    {
      detectors[i].page = 0;
      detectors[i].direction = 0;
      detectors[i].confidence = 0;
      detectors[i].pf_index = -1;
    }

  replacement_index = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x98ea(%rip), %rdi      # 0x40b02d
callq 0x4010e0
movq $0x4ad2f0, %rax         # imm = 0x4AD2F0
movl (%rax), %esi
movq $0x411060, %rax         # imm = 0x411060
movl (%rax), %edx
movq $0x4ad2f4, %rax         # imm = 0x4AD2F4
movl (%rax), %ecx
leaq 0x989a(%rip), %rdi      # 0x40b004
xorl %eax, %eax
callq 0x401030
pushq $0x10
popq %rax
leaq 0xca65(%rip), %rcx      # 0x40e1e0
xorps %xmm0, %xmm0
cmpq $0x610, %rax            # imm = 0x610
je 0x401795
movups %xmm0, -0x10(%rax,%rcx)
orl $-0x1, (%rax,%rcx)
addq $0x18, %rax
jmp 0x40177e
andl $0x0, 0xd044(%rip)      # 0x40e7e0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/m8pple[P]arch2-2014-cw1/src/eie2ugs/test_mips.cpp
// Function: main
int main()
{
	mips_mem_h mem=mips_mem_create_ram(
		1<<20,
		4
		);

	mips_cpu_h cpu=mips_cpu_create(mem);

	mips_test_begin_suite();

	int testId=mips_test_begin_test("and");
	int passed=0;

	
	mips_error err = mips_cpu_set_register(cpu, 8, 0x0000FFFFul);
	if(err==0)
		err = mips_cpu_set_register(cpu, 9, 0x00FFFF00ul);

	// and $10, $8, $9

	// TODO : work out the bit-wise encoding for the instruction.

	// TODO : Write it into mempory at a known address

	// TODO : Make sure the program-counter is at that address

	if(err==0)
		err=mips_cpu_step(cpu);

	uint32_t got;
	if(err==0)
		err = (mips_error)(err | mips_cpu_get_register(cpu, 10, &got));

	passed = (err == mips_Success) && (got==0x0000FF00);

	mips_test_end_test(testId, passed, NULL);

	mips_test_end_suite();

	mips_cpu_free(cpu);
	mips_mem_free(mem);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $0x4
popq %rsi
movl $0x100000, %edi         # imm = 0x100000
callq 0x3598
movq %rax, %rbx
movq %rax, %rdi
callq 0x3698
movq %rax, %r14
callq 0x245c
leaq 0x21fa(%rip), %rdi      # 0x45c4
callq 0x250c
movl %eax, %ebp
pushq $0x8
popq %rsi
movq %r14, %rdi
movl $0xffff, %edx           # imm = 0xFFFF
callq 0x36fe
testl %eax, %eax
jne 0x23f9
pushq $0x9
popq %rsi
movq %r14, %rdi
movl $0xffff00, %edx         # imm = 0xFFFF00
callq 0x36fe
testl %eax, %eax
je 0x2426
xorl %esi, %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x2676
callq 0x2727
movq %r14, %rdi
callq 0x36ce
movq %rbx, %rdi
callq 0x367c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x371c
xorl %esi, %esi
testl %eax, %eax
jne 0x23fb
pushq $0xa
popq %rsi
leaq 0x4(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x36d3
movl (%r15), %ecx
xorl $0xff00, %ecx           # imm = 0xFF00
xorl %esi, %esi
orl %eax, %ecx
sete %sil
jmp 0x23fb
nop
// File: /workspace/github_cpp_makefile_star2_O2/m8pple[P]arch2-2014-cw1/src/shared/mips_mem_ram.cpp
// Function: mips_mem_create_ram
mips_mem_h mips_mem_create_ram(
	uint32_t cbMem,	//!< Total number of bytes of ram
	uint32_t blockSize	//!< Granularity in bytes
){
	uint8_t *data=(uint8_t*)malloc(cbMem);
	if(data==0)
		return 0;
	
	struct mips_mem_provider *mem=(struct mips_mem_provider*)malloc(sizeof(struct mips_mem_provider));
	if(mem==0){
		free(data);
		return 0;
	}
	
	mem->length=cbMem;
	mem->blockSize=blockSize;
	mem->data=data;
	
	return mem;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
movl %edi, %edi
callq 0x2180
testq %rax, %rax
je 0x35cf
movq %rax, %r14
pushq $0x10
popq %rdi
callq 0x2180
testq %rax, %rax
je 0x35c7
movl %ebp, (%rax)
movl %ebx, 0x4(%rax)
movq %r14, 0x8(%rax)
jmp 0x35d1
movq %r14, %rdi
callq 0x2140
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/m8pple[P]arch2-2014-cw1/src/shared/mips_mem_ram.cpp
// Function: mips_mem_read_write(bool, mips_mem_provider*, unsigned int, unsigned int, unsigned char*)
static mips_error mips_mem_read_write(
	bool write,
    mips_mem_h mem,
    uint32_t address,
    uint32_t length,
    uint8_t *dataOut
)
{	
	if(mem==0)
		return mips_ErrorInvalidHandle;
	
	if(0 != (address%mem->blockSize) ){
		return mips_ExceptionInvalidAlignment;
	}
	if(0 != ((address+length)%mem->blockSize)){
		return mips_ExceptionInvalidAlignment;
	}
	if((address+length) > mem->length){	// A subtle bug here, maybe?
		return mips_ExceptionInvalidAddress;
	}
	
	if(write){
		for(unsigned i=0; i<length; i++){
			mem->data[address+i]=dataOut[i];
		}
	}else{
		for(unsigned i=0; i<length; i++){
			dataOut[i]=mem->data[address+i];
		}
	}
	return mips_Success;
}

// Assembly:
testq %rsi, %rsi
je 0x361d
pushq %rbx
movl %edx, %r9d
movl 0x4(%rsi), %ebx
movl %edx, %eax
xorl %edx, %edx
divl %ebx
movl $0x2002, %r10d          # imm = 0x2002
testl %edx, %edx
jne 0x361a
leal (%rcx,%r9), %r11d
movl %r11d, %eax
xorl %edx, %edx
divl %ebx
testl %edx, %edx
jne 0x361a
movl $0x2001, %r10d          # imm = 0x2001
cmpl (%rsi), %r11d
jbe 0x3627
popq %rbx
jmp 0x3623
movl $0x1002, %r10d          # imm = 0x1002
movl %r10d, %eax
retq
movl %ecx, %eax
movl %r9d, %ecx
xorl %r10d, %r10d
xorl %edx, %edx
testb %dil, %dil
je 0x3650
cmpq %rdx, %rax
je 0x361a
movb (%r8,%rdx), %dil
movq 0x8(%rsi), %r9
leal (%rcx,%rdx), %r11d
movb %dil, (%r9,%r11)
incq %rdx
jmp 0x3636
cmpq %rdx, %rax
je 0x361a
movq 0x8(%rsi), %rdi
leal (%rcx,%rdx), %r9d
movb (%rdi,%r9), %dil
movb %dil, (%r8,%rdx)
incq %rdx
jmp 0x3650
// File: /workspace/github_cpp_makefile_star2_O2/m8pple[P]arch2-2014-cw1/src/eie2ugs/mips_cpu.c
// Function: mips_cpu_create
mips_cpu_h mips_cpu_create(mips_mem_h mem)
{
	unsigned i;
	mips_cpu_h res=(mips_cpu_h)malloc(sizeof(struct mips_cpu_impl));

	res->mem=mem;

	res->pc=0;
	res->pcN=4;	// NOTE: why does this make sense?

	for( i=0;i<32;i++){
		res->regs[i]=0;
	}

	return res;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x90, %edi
callq 0x2180
movq %rbx, 0x88(%rax)
movabsq $0x400000000, %rcx      # imm = 0x400000000
movq %rcx, (%rax)
pushq $0x2
popq %rcx
cmpq $0x22, %rcx
je 0x36cc
andl $0x0, (%rax,%rcx,4)
incq %rcx
jmp 0x36bd
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::OperatingSystem(int&, unsigned int&, unsigned int&)
OperatingSystem(int & number_of_hard_disks_, unsigned int & RAM_, unsigned int & page_size_) : 
            CPU(1), 
            number_of_processes(1), 
            timestamp(0), 
            number_of_hard_disks(number_of_hard_disks_), 
            page_size(page_size_), 
            RAM(RAM_),
            number_of_frames(RAM_ / page_size_), 
            ready_queue(0), 
            hard_disks(number_of_hard_disks_), 
            frames(0) {
                
            // Creates initial process
            PCB* process_1 = new PCB{ number_of_processes };
            process_1->SetParent(1); //First process has no parent
            all_processes[number_of_processes] = process_1;

            // Initialize hard disks
            for (int i = 0; i < number_of_hard_disks; i++) {
                HardDisk* disk_ = new HardDisk{};
                hard_disks[i] = disk_;
            }
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r12
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, (%rdi)
andl $0x0, 0x8(%rdi)
movq %rsi, %rbx
movl (%rsi), %eax
movl %eax, 0xc(%rdi)
movl (%rcx), %eax
movl %eax, 0x10(%rdi)
movl (%rdx), %eax
movl %eax, 0x14(%rdi)
xorl %edx, %edx
divl (%rcx)
movl %eax, 0x18(%rdi)
addq $0x20, %rdi
leaq 0x7(%rsp), %rdx
movq %rdi, 0x10(%rsp)
xorl %esi, %esi
callq 0x322c
leaq 0x38(%r12), %r14
movslq (%rbx), %rsi
leaq 0x6(%rsp), %rdx
movq %r14, %rdi
callq 0x3260
andl $0x0, 0x58(%r12)
andq $0x0, 0x60(%r12)
leaq 0x50(%r12), %r15
leaq 0x58(%r12), %rax
movq %rax, 0x68(%r12)
movq %rax, 0x70(%r12)
andq $0x0, 0x78(%r12)
leaq 0x80(%r12), %r13
leaq 0x5(%rsp), %rdx
movq %r13, %rdi
xorl %esi, %esi
movq %r15, 0x8(%rsp)
callq 0x32b2
pushq $0x28
popq %rdi
callq 0x21a0
movq %rax, %rbp
leaq 0x4(%r12), %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3304
movl $0x1, 0x20(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3330
movq %rbp, (%rax)
xorl %r15d, %r15d
pushq $0x40
popq %rbp
movslq 0xc(%r12), %rax
cmpq %rax, %r15
jge 0x286a
movq %rbp, %rdi
callq 0x21a0
movq %rax, %rbx
movq %rax, %rdi
callq 0x337e
movq (%r14), %rax
movq %rbx, (%rax,%r15,8)
incq %r15
jmp 0x2841
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
pushq $0x28
popq %rsi
movq %rbp, %rdi
jmp 0x2899
movq %rax, %r12
jmp 0x28ab
movq %rax, %r12
jmp 0x28bd
jmp 0x28a0
movq %rax, %r12
pushq $0x40
popq %rsi
movq %rbx, %rdi
callq 0x21b0
jmp 0x28a3
movq %rax, %r12
movq %r13, %rdi
callq 0x361c
movq 0x8(%rsp), %rdi
callq 0x3cfc
movq %r14, %rdi
callq 0x3516
movq 0x10(%rsp), %rdi
callq 0x34c0
movq %r12, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::Snapshot() const
void Snapshot() const {
            std::cout << "Process using CPU: " << CPU << std::endl;
            std::cout << "Ready Queue:  ";
            for (auto itr = ready_queue.begin(); itr != ready_queue.end(); ++itr) {
                std::cout <<  " <- " << *itr;
            }
            std::cout << std::endl;
        }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x56e2(%rip), %r14      # 0x7fd0
leaq 0x27f5(%rip), %rsi      # 0x50ea
movq %r14, %rdi
callq 0x2190
movl (%rbx), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
callq 0x20c0
leaq 0x27e8(%rip), %rsi      # 0x50fe
movq %r14, %rdi
callq 0x2190
addq $0x20, %rbx
leaq 0x27e4(%rip), %r15      # 0x510d
movq %rbx, %r12
movq (%r12), %r12
cmpq %rbx, %r12
je 0x294f
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
movl 0x10(%r12), %esi
movq %rax, %rdi
callq 0x2270
jmp 0x292c
movq 0x567a(%rip), %rdi      # 0x7fd0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::IOSnapshot() const
void IOSnapshot() const {
            for (int i = 0; i < number_of_hard_disks; i++) {
                std::cout << "Disk " << i << ": ";
                if (hard_disks[i]->DiskIsIdle()) {
                    std::cout << "idle" << std::endl;
                }
                else {
                    std::cout << "[" << hard_disks[i]->GetCurrentProcess() << " " << hard_disks[i]->GetCurrentFile() << "]" << std::endl;
                    std::cout << "Queue for disk " << i << ": ";
                    hard_disks[i]->PrintQueue();
                }
            }
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x564f(%rip), %r15      # 0x7fd0
leaq 0x2773(%rip), %r13      # 0x50fb
leaq 0x8(%rsp), %rbp
movslq 0xc(%rbx), %rax
cmpq %rax, %r14
jge 0x2a94
movq %r15, %rdi
leaq 0x276e(%rip), %rsi      # 0x5112
callq 0x2190
movq %rax, %rdi
movl %r14d, %esi
callq 0x2270
movq %rax, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rax
cmpl $-0x1, (%rax)
je 0x2a75
movq %r15, %rdi
leaq 0x2758(%rip), %rsi      # 0x5132
callq 0x2190
movq 0x38(%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
leaq 0x276d(%rip), %rsi      # 0x5168
callq 0x2190
movq %rax, %r12
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rsi
addq $0x8, %rsi
movq %rbp, %rdi
callq 0x2200
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
leaq 0x26f1(%rip), %rsi      # 0x511d
callq 0x2190
movq %rax, %rdi
callq 0x20c0
movq %rbp, %rdi
callq 0x20b0
movq %r15, %rdi
leaq 0x26d4(%rip), %rsi      # 0x511f
callq 0x2190
movq %rax, %rdi
movl %r14d, %esi
callq 0x2270
movq %rax, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3d54
jmp 0x2a8c
movq %r15, %rdi
leaq 0x2699(%rip), %rsi      # 0x5118
callq 0x2190
movq %rax, %rdi
callq 0x20c0
incq %r14
jmp 0x298d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::MemorySnapshot()
void MemorySnapshot() {
            std::cout << "Frame   " << "Page Number     " << "pid       " << "ts" << std::endl;
            for (unsigned int i = 0; i < frames.size(); i++) {
                std::cout << "  " <<  i << "        ";
                if (frames[i]->pid_ != 0) {
                    std::cout << "   " << frames[i]->page_ << "          " << frames[i]->pid_ << "         " << frames[i]->timestamp_;
                }
                std::cout << std::endl;
            }
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x5503(%rip), %r14      # 0x7fd0
leaq 0x2663(%rip), %rsi      # 0x5137
movq %r14, %rdi
callq 0x2190
leaq 0x265d(%rip), %rsi      # 0x5140
movq %rax, %rdi
callq 0x2190
leaq 0x265f(%rip), %rsi      # 0x5151
movq %rax, %rdi
callq 0x2190
leaq 0x265b(%rip), %rsi      # 0x515c
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20c0
xorl %r15d, %r15d
leaq 0x264c(%rip), %r12      # 0x5167
leaq 0x263f(%rip), %r13      # 0x5161
leaq 0x2637(%rip), %rbp      # 0x5160
movl %r15d, %r15d
movq 0x88(%rbx), %rax
subq 0x80(%rbx), %rax
sarq $0x3, %rax
cmpq %r15, %rax
jbe 0x2bf3
movq %r14, %rdi
movq %r12, %rsi
callq 0x2190
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
movq %rax, %rdi
movq %r13, %rsi
callq 0x2190
movq 0x80(%rbx), %rax
movq (%rax,%r15,8), %rax
cmpl $0x0, 0x8(%rax)
je 0x2be3
movq %r14, %rdi
leaq 0x25e3(%rip), %rsi      # 0x5166
callq 0x2190
movq 0x80(%rbx), %rcx
movq (%rcx,%r15,8), %rcx
movl 0x4(%rcx), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
leaq 0x25b7(%rip), %rsi      # 0x515f
callq 0x2190
movq 0x80(%rbx), %rcx
movq (%rcx,%r15,8), %rcx
movl 0x8(%rcx), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2190
movq 0x80(%rbx), %rcx
movq (%rcx,%r15,8), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x2270
movq %r14, %rdi
callq 0x20c0
incl %r15d
jmp 0x2b29
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::CreateProcess()
void CreateProcess() {
            PCB* new_process = new PCB{ ++number_of_processes };
            all_processes[number_of_processes] = new_process;
            
            // Parent process is 1
            all_processes[1]->AddChildProcess(new_process);
            new_process->SetParent(1);

            // Adds new process to ready queue
            AddToReadyQueue(number_of_processes);
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
pushq $0x28
popq %rdi
callq 0x21a0
movq %rax, %r14
leaq 0x4(%rbx), %r15
incl 0x4(%rbx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x3304
leaq 0x50(%rbx), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x3330
movq %r14, (%rax)
pushq $0x1
popq %rbp
leaq 0xc(%rsp), %rsi
movl %ebp, (%rsi)
movq %r12, %rdi
callq 0x3de2
movq (%rax), %rdi
movq %r14, %rsi
callq 0x3e30
movl %ebp, 0x20(%r14)
movl 0x4(%rbx), %esi
movq %rbx, %rdi
callq 0x3e46
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x28
popq %rsi
movq %r14, %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2290
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::Fork()
void Fork() {
            if (CPU == 1) { // If fork called with no process in CPU
                std::cout << "There is no process in the CPU to fork" << std::endl;
            }
            else {
                PCB* new_process = new PCB(++number_of_processes);

                // Parent process is the process in the CPU that called fork
                all_processes[CPU]->AddChildProcess(new_process); 
                new_process->SetParent(CPU);

                // Add new process to ready queue
                AddToReadyQueue(number_of_processes);

                all_processes[number_of_processes] = new_process;
            }
        }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x1, (%rdi)
jne 0x2cf1
movq 0x52fe(%rip), %rdi      # 0x7fd0
leaq 0x24ab(%rip), %rsi      # 0x5184
callq 0x2190
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x20c0
movq %rdi, %r14
pushq $0x28
popq %rdi
callq 0x21a0
movq %rax, %rbx
leaq 0x4(%r14), %r15
incl 0x4(%r14)
movq %rax, %rdi
movq %r15, %rsi
callq 0x3304
leaq 0x50(%r14), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x3330
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x3e30
movl (%r14), %eax
movl %eax, 0x20(%rbx)
movl 0x4(%r14), %esi
movq %r14, %rdi
callq 0x3e46
movq %r12, %rdi
movq %r15, %rsi
callq 0x3330
movq %rbx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x21b0
movq %r14, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::Wait()
void Wait() {
            PCB* cpu_process = all_processes[CPU];

            // If the process has no children, nothing to wait for
            if (cpu_process->HasChildren()) {
                // If the process already has at least one zombie child, child disappears and parent keeps using CPU
                int PID_of_zombie_child = cpu_process->ProcessHasZombieChild();
                if (PID_of_zombie_child > 0) {  ///////////???
                    cpu_process->SetWaitingState(0);

                    // Delete the zombie child's children
                    DeleteChildren(all_processes[PID_of_zombie_child]);
                    
                    // Delete the zombie child
                    PCB* zombie = all_processes[PID_of_zombie_child];
                    PCB* parent = all_processes[zombie->GetParent()];

                    parent->RemoveChild(zombie);
                    all_processes.erase(PID_of_zombie_child);
                    delete zombie;
                    zombie = nullptr;
                }

                // If the process has no zombie children, remove the process from the ready queue and send process at front of ready queue to CPU
                else {
                    // Set process using CPU to waiting
                    cpu_process->SetWaitingState(1);
                    CPU = ready_queue.front();
                    ready_queue.pop_front();
                    // The waiting parent process will be added back to the end of the ready queue when one of its children exits.
                }
            }
        }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x50(%rdi), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3330
movq (%rax), %r15
movq 0x8(%r15), %rax
cmpq 0x10(%r15), %rax
je 0x2f60
movq %r15, %rdi
callq 0x45ba
movl %eax, (%rsp)
testl %eax, %eax
jle 0x2f48
movb $0x0, 0x25(%r15)
movq %rsp, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3330
movq (%rax), %rsi
movq %r14, %rdi
callq 0x40c0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3330
movq (%rax), %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movl 0x20(%rax), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x3de2
movq (%rax), %rdi
movq %r14, %rsi
callq 0x41c2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x43fc
movq (%r14), %rbx
testq %rbx, %rbx
je 0x2f3b
movq %rbx, %rdi
callq 0x41ec
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x21b0
jmp 0x2f60
movb $0x1, 0x25(%r15)
leaq 0x20(%r14), %rdi
movq 0x20(%r14), %rax
movl 0x10(%rax), %eax
movl %eax, (%r14)
callq 0x409c
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::RequestDisk(int const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void RequestDisk(const int & disk_number, const std::string & file_name) {
            if ((disk_number < number_of_hard_disks) && (disk_number >= 0)) {
                // Process 1 should not use any disks/be added to any queues
                if (CPU != 1) {
                    hard_disks[disk_number]->Request(file_name, CPU);
                    // Remove from CPU and replace from ready queue
                    GetNextFromReadyQueue();
                }
            }
            else {
                std::cout << "There is no disk " << disk_number << std::endl;
            }
        }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movslq (%rsi), %rax
testq %rax, %rax
js 0x2f8e
movq %rdi, %rbx
cmpl 0xc(%rdi), %eax
jge 0x2f8e
cmpl $0x1, (%rbx)
jne 0x2fbb
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x503b(%rip), %rdi      # 0x7fd0
leaq 0x220f(%rip), %rsi      # 0x51ab
callq 0x2190
movl (%r14), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20c0
movq 0x38(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
movq %rdx, %rsi
movq %rbx, %rdx
callq 0x45da
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4256
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::RemoveProcessFromDisk(int const&)
void RemoveProcessFromDisk(const int & disk_number) {
            if ((disk_number < number_of_hard_disks) && (disk_number >= 0)) {
                int removed_pcb = hard_disks[disk_number]->RemoveProcess();
                AddToReadyQueue(removed_pcb);
            }
            else {
                std::cout << "There is no disk " << disk_number << std::endl;
            }
        }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movslq (%rsi), %rax
testq %rax, %rax
js 0x3013
movq %rdi, %r14
cmpl 0xc(%rdi), %eax
jge 0x3013
movq 0x38(%r14), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x434a
movq %r14, %rdi
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3e46
movq 0x4fb6(%rip), %rdi      # 0x7fd0
leaq 0x218a(%rip), %rsi      # 0x51ab
callq 0x2190
movl (%rbx), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::RequestMemoryOperation(int const&)
void RequestMemoryOperation(const int & address) {
            int page = address / page_size;
            
            int oldest_timestamp = timestamp;
            int index_of_oldest = -1;

            // Adds frames to the vector as needed until the vector is full (size is number_of_frames). Then replaces the least recently used frame
            // If the same process wants to access the same page, just update time stamp
            for (unsigned int i = 0; i < frames.size(); i++) {
                if ((frames[i]->page_ == page) && (frames[i]->pid_ == CPU)) {
                    frames[i]->timestamp_ = timestamp;
                    timestamp++;
                    return;
                }
            }

            // If there are empty frames, create a new frame in the vector
            if (frames.size() < number_of_frames) {
                Frame* new_frame = new Frame{};
                new_frame->timestamp_ = timestamp;
                new_frame->pid_ = CPU;
                new_frame->page_ = page;
                frames.push_back(new_frame);
            }

            // Replace the least recently used frame's data
            else {
                // Find the frame with the oldest(lowest) timestamp
                for (unsigned int i = 0; i < frames.size(); i++) {
                    if (frames[i]->timestamp_ <= oldest_timestamp) {
                        index_of_oldest = i;
                        oldest_timestamp = frames[i]->timestamp_;
                    }
                }
                frames[index_of_oldest]->page_ = page;
                frames[index_of_oldest]->pid_ = CPU;
                frames[index_of_oldest]->timestamp_ = timestamp;
            }
            timestamp++;
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rsi), %eax
xorl %esi, %esi
xorl %edx, %edx
divl 0x10(%rdi)
movl %eax, %ebp
movl (%rdi), %r12d
movl 0x8(%rdi), %r15d
leaq 0x80(%rdi), %r14
movq 0x88(%rdi), %rcx
movq 0x80(%rdi), %rax
subq %rax, %rcx
sarq $0x3, %rcx
movl %esi, %esi
cmpq %rsi, %rcx
jbe 0x3097
movq (%rax,%rsi,8), %rdx
cmpl %ebp, 0x4(%rdx)
jne 0x3093
cmpl %r12d, 0x8(%rdx)
je 0x30fe
incl %esi
jmp 0x307d
movl 0x18(%rbx), %edx
cmpq %rdx, %rcx
jae 0x30c7
pushq $0xc
popq %rdi
callq 0x21a0
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movl %r15d, (%rax)
movl %r12d, 0x8(%rax)
movl %ebp, 0x4(%rax)
movq %r14, %rdi
callq 0x46f2
movl 0x8(%rbx), %r15d
jmp 0x3101
xorl %edi, %edi
pushq $-0x1
popq %rdx
movl %r15d, %esi
movl %edi, %edi
cmpq %rdi, %rcx
jbe 0x30eb
movq (%rax,%rdi,8), %r8
movl (%r8), %r8d
cmpl %esi, %r8d
cmovll %r8d, %esi
cmovlel %edi, %edx
incl %edi
jmp 0x30cf
movslq %edx, %rcx
movq (%rax,%rcx,8), %rax
movl %ebp, 0x4(%rax)
movl %r12d, 0x8(%rax)
movl %r15d, (%rax)
jmp 0x3101
movl %r15d, (%rdx)
incl %r15d
movl %r15d, 0x8(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::~OperatingSystem()
~OperatingSystem() {
            // Delete disks
            for (auto disk : hard_disks) {
                delete disk;
            }
            // Delete frames
            for (auto frame : frames) {
                delete frame;
            }
            // Delete all PCBs
            for (auto PCB : all_processes) {
                delete PCB.second;
            }

            hard_disks.clear();
            frames.clear();
            all_processes.clear();
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x38(%rdi), %rax
movq %rax, (%rsp)
movq 0x38(%rdi), %r14
movq 0x40(%rdi), %r13
pushq $0x40
popq %r15
cmpq %r13, %r14
je 0x315e
movq (%r14), %r12
testq %r12, %r12
je 0x314d
movq %r12, %rdi
callq 0x4818
movq %r12, %rdi
movq %r15, %rsi
callq 0x21b0
addq $0x8, %r14
jmp 0x3138
leaq 0x80(%rbx), %r15
movq 0x80(%rbx), %r14
movq 0x88(%rbx), %r13
pushq $0xc
popq %r12
cmpq %r13, %r14
je 0x318d
movq (%r14), %rdi
movq %r12, %rsi
callq 0x21b0
addq $0x8, %r14
jmp 0x3177
movq 0x68(%rbx), %r13
leaq 0x58(%rbx), %r14
pushq $0x28
popq %r12
cmpq %r14, %r13
je 0x31c7
movq 0x28(%r13), %rbp
testq %rbp, %rbp
je 0x31af
movq %rbp, %rdi
callq 0x41ec
movq %rbp, %rdi
movq %r12, %rsi
callq 0x21b0
movq %r13, %rdi
callq 0x2120
movq %rax, %r13
jmp 0x3199
movq 0x38(%rbx), %rax
cmpq %rax, 0x40(%rbx)
je 0x31d5
movq %rax, 0x40(%rbx)
movq 0x80(%rbx), %rax
cmpq %rax, 0x88(%rbx)
je 0x31ec
movq %rax, 0x88(%rbx)
leaq 0x50(%rbx), %r12
movq %r12, %rdi
callq 0x452e
movq %r15, %rdi
callq 0x361c
movq %r12, %rdi
callq 0x3cfc
movq (%rsp), %rdi
callq 0x3516
addq $0x20, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x34c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::AddToReadyQueue(int)
void AddToReadyQueue(const int pid) {
            // First process goes straight to CPU
            if (CPU == 1) {
                CPU = pid;
            }
            // Otherwise process added to back of queue
            else {
                ready_queue.push_back(pid);
            }
        }

// Assembly:
pushq %rax
movl %esi, 0x4(%rsp)
cmpl $0x1, (%rdi)
jne 0x3e54
movl %esi, (%rdi)
jmp 0x3e62
addq $0x20, %rdi
leaq 0x4(%rsp), %rsi
callq 0x402c
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::DeleteChildren(PCB*)
void DeleteChildren(PCB* pcb) {
            //Delete all children of the process pcb_to_delete
            for (auto itr = pcb->GetChildren().begin(); itr != pcb->GetChildren().end(); itr++) {
                PCB* child = (*itr);
                if (child->HasChildren()) {
                    DeleteChildren(child);
                }
                else {
                    RemoveFromDisks(child->GetPid());
                    RemoveFromFrames(child->GetPid());
                    RemoveFromReadyQueue(child->GetPid());

                    // Delete child from all_processes
                    all_processes.erase(child->GetPid());
                    delete child;
                    child = nullptr;
                }
            }

            pcb->ClearChildren();

            // Keep zombies around and delete later
            if (!pcb->IsZombieProcess()) {
                all_processes.erase(pcb->GetPid());
            }

            RemoveFromDisks(pcb->GetPid());
            RemoveFromFrames(pcb->GetPid());
            RemoveFromReadyQueue(pcb->GetPid());
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %r13
leaq 0x50(%rdi), %r15
leaq 0x4(%rsp), %r12
cmpq 0x10(%r14), %r13
je 0x4159
movq (%r13), %rbp
movq 0x8(%rbp), %rax
cmpq 0x10(%rbp), %rax
je 0x40ff
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x40c0
jmp 0x4153
movl (%rbp), %eax
movl %eax, 0x4(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4278
movl (%rbp), %eax
movl %eax, 0x4(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x42a4
movl (%rbp), %esi
movq %rbx, %rdi
callq 0x42d0
movl (%rbp), %eax
movl %eax, 0x4(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x43fc
movq %rbp, %rdi
callq 0x41ec
movq %rbp, %rdi
pushq $0x28
popq %rsi
callq 0x21b0
addq $0x8, %r13
jmp 0x40de
movq 0x8(%r14), %rax
cmpq %rax, %r13
je 0x4166
movq %rax, 0x10(%r14)
cmpb $0x0, 0x24(%r14)
jne 0x417f
movl (%r14), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r15, %rdi
callq 0x43fc
movl (%r14), %eax
leaq 0x4(%rsp), %r15
movl %eax, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4278
movl (%r14), %eax
movl %eax, (%r15)
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x42a4
movl (%r14), %esi
movq %rbx, %rdi
callq 0x42d0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./PCB.h
// Function: PCB::RemoveChild(PCB*&)
void RemoveChild(PCB* & child) {
            for (auto itr = child_processes.begin(); itr != child_processes.end(); itr++) {
                if ((*itr) == child) {
                    child_processes.erase(itr);
                    return;
                }
            }
        }

// Assembly:
movq %rsi, %rax
movq %rdi, %rcx
addq $0x8, %rdi
movq 0x8(%rcx), %rsi
movq 0x10(%rcx), %rcx
movq (%rax), %rax
cmpq %rcx, %rsi
je 0x41eb
cmpq %rax, (%rsi)
je 0x4580
addq $0x8, %rsi
jmp 0x41d7
retq
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::GetNextFromReadyQueue()
void GetNextFromReadyQueue() {
            if (ready_queue.empty()) {
                CPU = 1;
            }
            else {
                CPU = ready_queue.front();
                ready_queue.pop_front();
            }
        }

// Assembly:
leaq 0x20(%rdi), %rax
movq 0x20(%rdi), %rcx
cmpq %rax, %rcx
je 0x4270
movl 0x10(%rcx), %ecx
movl %ecx, (%rdi)
movq %rax, %rdi
jmp 0x409c
movl $0x1, (%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::RemoveFromReadyQueue(int)
void RemoveFromReadyQueue(const int pid_) {
            auto pid_to_delete = std::find(ready_queue.begin(), ready_queue.end(), pid_);
            // If the item is in the ready queue, removes it
            if (pid_to_delete != ready_queue.end()) {
                ready_queue.erase(pid_to_delete);
            }
        }

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %rdx
movl %esi, (%rdx)
movq 0x20(%rdi), %rdi
addq $0x20, %rbx
movq %rbx, %rsi
callq 0x43e6
cmpq %rbx, %rax
je 0x42ff
movq %rbx, %rdi
movq %rax, %rsi
callq 0x43d8
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./disk.h
// Function: HardDisk::Remove(int const&)
void Remove(const int & pid) {
            // If the process is using the disk
            if (current_process == pid) {
                RemoveProcess();
            }
            // If the process is in the io queue
            for (auto itr = io_queue.begin(); itr != io_queue.end(); itr++) {
                if ((*itr).first == pid) {
                    io_queue.erase(itr);
                }
            }
        }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %eax
cmpl (%rsi), %eax
jne 0x431f
movq %r14, %rdi
callq 0x434a
addq $0x28, %r14
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x4343
movl 0x10(%r15), %eax
cmpl (%rbx), %eax
jne 0x4326
movq %r14, %rdi
movq %r15, %rsi
callq 0x439c
jmp 0x4326
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./disk.h
// Function: HardDisk::RemoveProcess()
int RemoveProcess() {
            int removed_process = current_process;
            if (!DiskIsIdle()) {
                // No process is waiting to use the disk; set idle
                if (io_queue.empty()) {
                    current_process = -1;
                    current_file = "";
                }

                // Otherwise let the next process on the queue use the disk
                else {
                    current_process = io_queue.front().first;
                    current_file = io_queue.front().second;
                    io_queue.pop_front();
                }
            }
            return removed_process;
        }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl (%rdi), %ebx
cmpl $-0x1, %ebx
je 0x4391
leaq 0x28(%rdi), %r14
movq 0x28(%rdi), %rsi
cmpq %r14, %rsi
je 0x437e
movl 0x10(%rsi), %eax
movl %eax, (%rdi)
addq $0x18, %rsi
addq $0x8, %rdi
callq 0x20e0
movq %r14, %rdi
callq 0x43aa
jmp 0x4391
orl $-0x1, (%rdi)
addq $0x8, %rdi
leaq 0xddd(%rip), %rsi       # 0x5169
callq 0x22b0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/isabellab3[P]OS-Simulation/./disk.h
// Function: HardDisk::Request(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int const&)
void Request(const std::string & file_name, const int & pid) {
            // If there is no process using the disk already, it can go straight to the disk
            if (DiskIsIdle()) {
                current_process = pid;
                current_file = file_name;
            }
            // Otherwise add the process to the io queue
            else {
                io_queue.push_back(std::pair<int, std::string>(pid, file_name));
            }
        }

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rax
movq %rdi, %rbx
cmpl $-0x1, (%rdi)
je 0x461e
addq $0x28, %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x465a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x464e
leaq 0x8(%rsp), %rdi
callq 0x20b0
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movl (%rdx), %ecx
movl %ecx, (%rbx)
addq $0x8, %rbx
movq %rbx, %rdi
movq %rax, %rsi
addq $0x28, %rsp
popq %rbx
popq %r14
jmp 0x20e0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2290
nop
// File: /workspace/github_cpp_makefile_star2_O2/lhartmann[P]orangepi-i2s-steppers/throttle_test.cpp
// Function: main
int main() {
	Throttle t;
	t.prepare(100, 40, 5, 5);
	for (int i=0; i<200; ++i) {
		cout
			<< i << " "
			<< (t.step() ? "STEP " : "     ")
			<< (t.done() ? "DONE " : "     ")
			<< t.acc << " "
			<< t.r << " "
			<< endl;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movabsq $0x5000000000, %rax     # imm = 0x5000000000
leaq -0x4c(%rbp), %rbx
movq %rax, (%rbx)
movaps 0xe1b(%rip), %xmm0      # 0x2010
movups %xmm0, 0x8(%rbx)
movb $0x0, 0x20(%rbx)
movabsq $-0x4fffffffb, %rax     # imm = 0xFFFFFFFB00000005
movq %rax, 0x18(%rbx)
xorl %r14d, %r14d
leaq 0xe15(%rip), %r12       # 0x202a
leaq 0xe0a(%rip), %r15       # 0x2026
cmpl $0xc8, %r14d
je 0x12be
movq 0x2da8(%rip), %rdi      # 0x3fd8
movl %r14d, %esi
callq 0x1080
movq %rax, %rdi
movq %r12, %rsi
callq 0x1060
movq %rax, %r13
movq %rbx, %rdi
callq 0x12d0
testb %al, %al
movq %r15, %rsi
leaq 0xdc6(%rip), %rax       # 0x2020
cmovneq %rax, %rsi
movq %r13, %rdi
callq 0x1060
movl -0x4c(%rbp), %ecx
cmpl -0x44(%rbp), %ecx
movq %r15, %rsi
leaq 0xdb6(%rip), %rcx       # 0x202c
cmoveq %rcx, %rsi
movq %rax, %rdi
callq 0x1060
movl -0x30(%rbp), %esi
movq %rax, %rdi
callq 0x1080
movq %rax, %rdi
movq %r12, %rsi
callq 0x1060
movl -0x34(%rbp), %esi
movq %rax, %rdi
callq 0x1040
movq %rax, %rdi
movq %r12, %rsi
callq 0x1060
movq %rax, %rdi
callq 0x1030
incl %r14d
jmp 0x121c
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/waket[P]ThreadPool/main.cpp
// Function: hello()
void hello () {
    int time = random() % 8;
    cout << "\t\tHello ... " << time << " ...." << endl;
    sleep(time);
    cout << "\t\tHello ... " << time << " DONE" << endl;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
callq 0x20c0
pushq $0x8
popq %rcx
cqto
idivq %rcx
movq %rdx, %rbx
movq 0x5b40(%rip), %r14      # 0x7fd8
leaq 0x2b75(%rip), %r15      # 0x5014
movq %r14, %rdi
movq %r15, %rsi
callq 0x21a0
movq %rax, %rdi
movl %ebx, %esi
callq 0x22d0
leaq 0x2b66(%rip), %rsi      # 0x5021
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20a0
movl %ebx, %edi
callq 0x2120
movq %r14, %rdi
movq %r15, %rsi
callq 0x21a0
movq %rax, %rdi
movl %ebx, %esi
callq 0x22d0
leaq 0x2ba0(%rip), %rsi      # 0x508e
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x20a0
// File: /workspace/github_cpp_makefile_star2_O2/waket[P]ThreadPool/ThreadPoolTask.cpp
// Function: ThreadPoolTask::start()
bool ThreadPoolTask::start() {
    startWorkersMutex.lock();
    isStarted = true;
    isStopWorker = false;
    for (int i = 0; i < workerCount; i++) {
        pthread_t pth;
        if (pthread_create(&pth, NULL, start_worker, (void*) this) != 0) {
            cout << "\tFailed to create new worker" << endl;
            isStarted = false;
            startWorkersMutex.unlock();
            return false;
        }
    }
    // Lock and wait till all the workers start
    cout << "\tLock and wait for All workers to get started" << endl;
    startWorkersCond.wait(startWorkersMutex.mutexPtr());
    startWorkersMutex.unlock();

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x158(%rdi), %rbx
movq %rbx, %rdi
callq 0x3936
movb $0x1, 0x150(%r14)
movb $0x0, 0x152(%r14)
xorl %r13d, %r13d
leaq -0x476(%rip), %r15      # 0x2ed9
movq %rsp, %r12
movq 0x8(%r14), %rbp
cmpq %r13, %rbp
jbe 0x3374
movq %r12, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2300
testl %eax, %eax
jne 0x33a3
incq %r13
jmp 0x3352
movq 0x4c5d(%rip), %rdi      # 0x7fd8
leaq 0x1ef2(%rip), %rsi      # 0x5274
callq 0x21a0
movq %rax, %rdi
callq 0x20a0
addq $0x188, %r14            # imm = 0x188
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2270
jmp 0x33c6
movq 0x4c2e(%rip), %rdi      # 0x7fd8
leaq 0x1ea6(%rip), %rsi      # 0x5257
callq 0x21a0
movq %rax, %rdi
callq 0x20a0
movb $0x0, 0x150(%r14)
movq %rbx, %rdi
callq 0x3946
cmpq %r13, %rbp
setbe %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/waket[P]ThreadPool/ThreadPoolTask.cpp
// Function: ThreadPoolTask::stop()
bool ThreadPoolTask::stop() {
    //Lock by mutex before changing the value of isStarted
    tasksMutex.lock();
    isStarted = false;
    tasksMutex.unlock();

    //Lock by mutex for thread safe stop(), wait() and requestStop()
    stopMutex.lock();
    if (isShutdown) {
        stopMutex.unlock();
        return true;
    }
    bool ret = true;
    cout << "\tWakeup all the workers waiting for task" << endl;
    tasksCond.broadcast(); // Sometime calling broadcast() is not enough to wakeup all the worker
    cout << "\t" << tasksDeque.size() << " task will be ignored" << endl;

    for (std::set<pthread_t>::const_iterator it = workersSet.begin() ; it != workersSet.end(); it++) {
        if (pthread_join(*(it), NULL) != 0) {
            cout << "\tFailed to stop the worker " << *(it) << endl;
            ret = false;
        }
        tasksCond.broadcast(); // Keep waking up the workers, because of the lock "tasksMutex"
        cout << "\tStop worker " <<*(it) << " DONE" << endl;
    }
    //Remove all the task from the queue
    tasksDeque.clear();
    //Unlock wait()
    stopCond.signal();
    isShutdown = true;
    stopMutex.unlock();
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x90(%rdi), %rbx
movq %rbx, %rdi
callq 0x3936
movb $0x0, 0x150(%r14)
movq %rbx, %rdi
callq 0x3946
leaq 0xf0(%r14), %rbx
movq %rbx, %rdi
callq 0x3936
movb $0x1, %bpl
cmpb $0x0, 0x151(%r14)
jne 0x3560
movq %rbx, 0x8(%rsp)
movq 0x4b98(%rip), %r15      # 0x7fd8
leaq 0x1fd4(%rip), %rsi      # 0x541b
movq %r15, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20a0
leaq 0xc0(%r14), %r12
movq %r12, %rdi
callq 0x2070
leaq 0x1e49(%rip), %rsi      # 0x52b6
movq %r15, %rdi
callq 0x21a0
movq %rax, %rbx
leaq 0x10(%r14), %rdi
movq %rdi, (%rsp)
callq 0x3950
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2100
leaq 0x1fad(%rip), %rsi      # 0x5444
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20a0
movq 0x78(%r14), %r13
movq %r14, 0x10(%rsp)
addq $0x68, %r14
movb $0x1, %bpl
leaq 0x1bd0(%rip), %rbx      # 0x508e
cmpq %r14, %r13
je 0x353a
movq 0x20(%r13), %rdi
xorl %esi, %esi
callq 0x2170
testl %eax, %eax
je 0x34f7
movq %r15, %rdi
leaq 0x1f7e(%rip), %rsi      # 0x545a
callq 0x21a0
movq 0x20(%r13), %rsi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x20a0
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x2070
movq %r15, %rdi
leaq 0x1f6d(%rip), %rsi      # 0x5476
callq 0x21a0
movq 0x20(%r13), %rsi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20a0
movq %r13, %rdi
callq 0x21f0
movq %rax, %r13
jmp 0x34be
movq (%rsp), %rdi
callq 0x39ce
movq 0x10(%rsp), %rbx
leaq 0x120(%rbx), %rdi
callq 0x2030
movb $0x1, 0x151(%rbx)
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3946
andb $0x1, %bpl
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop